[OLINGO-575] Removed V4 server code
diff --git a/dist/android-lib/pom.xml b/dist/android-lib/pom.xml
index 35fa368..423992c 100644
--- a/dist/android-lib/pom.xml
+++ b/dist/android-lib/pom.xml
@@ -31,7 +31,7 @@
<parent>
<groupId>org.apache.olingo</groupId>
<artifactId>odata-dist</artifactId>
- <version>4.0.0-beta-02</version>
+ <version>3.0.0-beta-01-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
diff --git a/dist/client-lib/pom.xml b/dist/client-lib/pom.xml
index 2f119a1..8611aa9 100644
--- a/dist/client-lib/pom.xml
+++ b/dist/client-lib/pom.xml
@@ -31,7 +31,7 @@
<parent>
<groupId>org.apache.olingo</groupId>
<artifactId>odata-dist</artifactId>
- <version>4.0.0-beta-02</version>
+ <version>3.0.0-beta-01-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
diff --git a/dist/javadoc/pom.xml b/dist/javadoc/pom.xml
index 71d6636..be92e78 100644
--- a/dist/javadoc/pom.xml
+++ b/dist/javadoc/pom.xml
@@ -31,7 +31,7 @@
<parent>
<groupId>org.apache.olingo</groupId>
<artifactId>odata-dist</artifactId>
- <version>4.0.0-beta-02</version>
+ <version>3.0.0-beta-01-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
diff --git a/dist/pom.xml b/dist/pom.xml
index 727f493..20975e7 100644
--- a/dist/pom.xml
+++ b/dist/pom.xml
@@ -31,14 +31,13 @@
<parent>
<groupId>org.apache.olingo</groupId>
<artifactId>odata-parent</artifactId>
- <version>4.0.0-beta-02</version>
+ <version>3.0.0-beta-01-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<modules>
<module>android-lib</module>
<module>client-lib</module>
- <module>server-lib</module>
<module>javadoc</module>
</modules>
diff --git a/dist/server-lib/pom.xml b/dist/server-lib/pom.xml
deleted file mode 100644
index d0ebcb5..0000000
--- a/dist/server-lib/pom.xml
+++ /dev/null
@@ -1,114 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
- 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.
-
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <artifactId>odata-dist-server-lib</artifactId>
- <packaging>pom</packaging>
-
- <name>Olingo-OData-Server-for-Java</name>
-
- <parent>
- <groupId>org.apache.olingo</groupId>
- <artifactId>odata-dist</artifactId>
- <version>4.0.0-beta-02</version>
- <relativePath>..</relativePath>
- </parent>
-
- <build>
- <finalName>${project.name}-${project.version}</finalName>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-deploy-plugin</artifactId>
- <configuration>
- <skip>true</skip>
- </configuration>
- </plugin>
- </plugins>
-
- </build>
-
- <profiles>
- <profile>
- <id>apache-release</id>
- <activation>
- <activeByDefault>false</activeByDefault>
- </activation>
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-assembly-plugin</artifactId>
- <inherited>false</inherited>
- <executions>
- <execution>
- <id>package-assemblies</id>
- <phase>package</phase>
- <goals>
- <goal>single</goal>
- </goals>
- <configuration>
- <attach>true</attach>
- <appendAssemblyId>true</appendAssemblyId>
- <descriptors>
- <descriptor>
- src/main/assembly/lib-assembly.xml
- </descriptor>
- </descriptors>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.olingo</groupId>
- <artifactId>odata-commons-api</artifactId>
- <version>${project.version}</version>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.olingo</groupId>
- <artifactId>odata-commons-core</artifactId>
- <version>${project.version}</version>
- <scope>compile</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.olingo</groupId>
- <artifactId>odata-server-api</artifactId>
- <version>${project.version}</version>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.olingo</groupId>
- <artifactId>odata-server-core</artifactId>
- <version>${project.version}</version>
- <scope>compile</scope>
- </dependency>
- </dependencies>
-</project>
diff --git a/dist/server-lib/src/main/assembly/lib-assembly.xml b/dist/server-lib/src/main/assembly/lib-assembly.xml
deleted file mode 100644
index 5de2340..0000000
--- a/dist/server-lib/src/main/assembly/lib-assembly.xml
+++ /dev/null
@@ -1,47 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- 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. -->
-<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
- <id>lib</id>
- <formats>
- <format>zip</format>
- </formats>
- <includeBaseDirectory>false</includeBaseDirectory>
- <dependencySets>
- <dependencySet>
- <useProjectArtifact>false</useProjectArtifact>
- <outputDirectory></outputDirectory>
- <outputFileNameMapping>${artifact.groupId}-${artifact.artifactId}-${artifact.version}.${artifact.extension}</outputFileNameMapping>
- <unpack>false</unpack>
- <useTransitiveDependencies>true</useTransitiveDependencies>
- <useTransitiveFiltering>true</useTransitiveFiltering>
- <scope>compile</scope>
- <includes>
- <include>org.apache.olingo:odata-commons-api</include>
- <include>org.apache.olingo:odata-commons-core</include>
- <include>org.apache.olingo:odata-server-api</include>
- <include>org.apache.olingo:odata-server-core</include>
- </includes>
- </dependencySet>
- </dependencySets>
- <fileSets>
- <fileSet>
- <directory>${project.build.directory}/maven-shared-archive-resources/META-INF</directory>
- <outputDirectory>/</outputDirectory>
- <excludes>
- <exclude>LICENSE</exclude>
- <exclude>NOTICE</exclude>
- </excludes>
- </fileSet>
- <fileSet>
- <directory>src/main/resources</directory>
- <outputDirectory>/</outputDirectory>
- </fileSet>
- </fileSets>
-</assembly>
diff --git a/dist/server-lib/src/main/resources/LICENSE b/dist/server-lib/src/main/resources/LICENSE
deleted file mode 100644
index 2ba3137..0000000
--- a/dist/server-lib/src/main/resources/LICENSE
+++ /dev/null
@@ -1,337 +0,0 @@
-licenses for server distribution
-
-
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
-TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
-1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
-2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
-3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
-4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
-5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
-6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
-7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
-8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
-9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
-END OF TERMS AND CONDITIONS
-
-APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
-Copyright [yyyy] [name of copyright owner]
-
-Licensed 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.
-
-
-From: 'abego Software GmbH, Germany' (http://abego-software.de) - abego
-TreeLayout Core (http://code.google.com/p/treelayout/)
-org.abego.treelayout:org.abego.treelayout.core:jar:1.0.1 License: BSD 3-Clause
-"New" or "Revised" License (BSD-3-Clause)
-(http://treelayout.googlecode.com/files/LICENSE.TXT)
-
-[The "BSD license"]
-Copyright (c) 2011, abego Software GmbH, Germany (http://www.abego.org)
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
-1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-3. Neither the name of the abego Software GmbH nor the names of its
- contributors may be used to endorse or promote products derived from this
- software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGE.
-
-
-
-
-From: 'ANTLR' (http://www.antlr.org) - ANTLR 4 Runtime
-(http://www.antlr.org/antlr4-runtime) org.antlr:antlr4-runtime:jar:4.1 License:
-The BSD License (http://www.antlr.org/license.html)
-
-[The BSD License]
-Copyright (c) 2012 Terence Parr and Sam Harwell
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- Redistributions of source code must retain the above copyright notice, this
- list of conditions and the following disclaimer. Redistributions in binary
- form must reproduce the above copyright notice, this list of conditions and
- the following disclaimer in the documentation and/or other materials
- provided with the distribution. Neither the name of the author nor the
- names of its contributors may be used to endorse or promote products
- derived from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
-ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-From: 'fasterxml.com' (http://fasterxml.com) - Stax2 API
-(http://wiki.fasterxml.com/WoodstoxStax2)
-org.codehaus.woodstox:stax2-api:bundle:3.1.4 License: The BSD License
-(http://www.opensource.org/licenses/bsd-license.php)
-
-Copyright (c) 2004-2010, Woodstox Project (http://woodstox.codehaus.org/)
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
-1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-3. Neither the name of the Woodstox XML Processor nor the names
- of its contributors may be used to endorse or promote products derived
- from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGE.
-
-
-From: 'QOS.ch' (http://www.qos.ch)
- - SLF4J API Module (http://www.slf4j.org) org.slf4j:slf4j-api:jar:1.7.7
- License: MIT License (http://www.opensource.org/licenses/mit-license.php)
- - SLF4J Simple Binding (http://www.slf4j.org) org.slf4j:slf4j-simple:jar:1.7.7
- License: MIT License (http://www.opensource.org/licenses/mit-license.php)
-
-
-Copyright (c) 2004-2013 QOS.ch
-
-All rights reserved. Permission is hereby granted, free of charge, to any
-person obtaining a copy of this software and associated documentation files
-(the "Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish, distribute,
-sublicense, and/or sell copies of the Software, and to permit persons to whom
-the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-
-
-
-
diff --git a/dist/server-lib/src/main/resources/NOTICE b/dist/server-lib/src/main/resources/NOTICE
deleted file mode 100644
index 32a4536..0000000
--- a/dist/server-lib/src/main/resources/NOTICE
+++ /dev/null
@@ -1,62 +0,0 @@
-Apache Olingo
-Copyright 2013-2014 The Apache Software Foundation
-
-This product includes software developed at
-The Apache Software Foundation (http://www.apache.org/).
-
-This distribution includes the Jackson JSON processor
-Jackson is a high-performance, Free/Open Source JSON processing library.
-It was originally written by Tatu Saloranta (tatu.saloranta@iki.fi), and has
-been in development since 2007.
-It is currently developed by a community of developers, as well as supported
-commercially by FasterXML.com.
-## Licensing
-Jackson core and extension components may licensed under different licenses.
-To find the details that apply to this artifact see the accompanying LICENSE file.
-For more information, including possible other licensing options, contact
-FasterXML.com (http://fasterxml.com).
-## Credits
-A list of contributors may be found from CREDITS file, which is included
-in some artifacts (usually source distributions); but is always available
-from the source code management (SCM) system project uses.
-
-This distribution includes SLF4J
-Copyright (c) 2004-2013 QOS.ch
- All rights reserved.
- Permission is hereby granted, free of charge, to any person obtaining
- a copy of this software and associated documentation files (the
- "Software"), to deal in the Software without restriction, including
- without limitation the rights to use, copy, modify, merge, publish,
- distribute, sublicense, and/or sell copies of the Software, and to
- permit persons to whom the Software is furnished to do so, subject to
- the following conditions.
- http://slf4j.org/license.html
-
-This distribution includes TreeLayout Core (http://code.google.com/p/treelayout/)
-Copyright (c) 2011, abego Software GmbH, Germany (http://www.abego.org)
-All rights reserved.
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-3. Neither the name of the abego Software GmbH nor the names of its
- contributors may be used to endorse or promote products derived from this
- software without specific prior written permission.
-(http://treelayout.googlecode.com/files/LICENSE.TXT)
-
-This distribution includes ANTLR 4 Runtime (http://www.antlr.org/antlr4-runtime)
-Copyright (c) 2012 Terence Parr and Sam Harwell
-All rights reserved.
-Redistribution and use in source and binary forms, with or without modification,
-are permitted provided that the following conditions are met:
-Redistributions of source code must retain the above copyright notice,
-this list of conditions and the following disclaimer.
-Redistributions in binary form must reproduce the above copyright notice,
-this list of conditions and the following disclaimer in the documentation
-and/or other materials provided with the distribution.
-Neither the name of the author nor the names of its contributors may be used to
-endorse or promote products derived from this software without specific prior written permission.
-(http://www.antlr.org/license.html)
diff --git a/ext/client-android/pom.xml b/ext/client-android/pom.xml
index a274bfd..76ddf5f 100644
--- a/ext/client-android/pom.xml
+++ b/ext/client-android/pom.xml
@@ -30,7 +30,7 @@
<parent>
<groupId>org.apache.olingo</groupId>
<artifactId>odata-ext</artifactId>
- <version>4.0.0-beta-02</version>
+ <version>3.0.0-beta-01-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
diff --git a/ext/client-proxy/pom.xml b/ext/client-proxy/pom.xml
index 4a06c35..6b831ae 100644
--- a/ext/client-proxy/pom.xml
+++ b/ext/client-proxy/pom.xml
@@ -31,7 +31,7 @@
<parent>
<groupId>org.apache.olingo</groupId>
<artifactId>odata-ext</artifactId>
- <version>4.0.0-beta-02</version>
+ <version>3.0.0-beta-01-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
diff --git a/ext/pojogen-maven-plugin/pom.xml b/ext/pojogen-maven-plugin/pom.xml
index e2bc8de..ad02c1b 100644
--- a/ext/pojogen-maven-plugin/pom.xml
+++ b/ext/pojogen-maven-plugin/pom.xml
@@ -31,7 +31,7 @@
<parent>
<groupId>org.apache.olingo</groupId>
<artifactId>odata-ext</artifactId>
- <version>4.0.0-beta-02</version>
+ <version>3.0.0-beta-01-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
diff --git a/ext/pojogen-maven-plugin/src/it/exchangeMail/pom.xml b/ext/pojogen-maven-plugin/src/it/exchangeMail/pom.xml
index 8955597..d2a988c 100644
--- a/ext/pojogen-maven-plugin/src/it/exchangeMail/pom.xml
+++ b/ext/pojogen-maven-plugin/src/it/exchangeMail/pom.xml
@@ -30,6 +30,8 @@
<description>A simple IT verifying the basic use case of pojogen-man-plugin.</description>
<properties>
+ <project.source>1.6</project.source>
+ <compiler.plugin.version>3.2</compiler.plugin.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
@@ -51,6 +53,18 @@
<build>
<plugins>
<plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>${compiler.plugin.version}</version>
+ <configuration>
+ <source>${project.source}</source>
+ <target>${project.source}</target>
+ <showWarnings>true</showWarnings>
+ <showDeprecation>true</showDeprecation>
+ <compilerArgument>-Xlint:unchecked</compilerArgument>
+ </configuration>
+ </plugin>
+ <plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.8</version>
diff --git a/ext/pojogen-maven-plugin/src/it/exchangeMailNoBasePkg/pom.xml b/ext/pojogen-maven-plugin/src/it/exchangeMailNoBasePkg/pom.xml
index b5441e9..0fcb69a 100644
--- a/ext/pojogen-maven-plugin/src/it/exchangeMailNoBasePkg/pom.xml
+++ b/ext/pojogen-maven-plugin/src/it/exchangeMailNoBasePkg/pom.xml
@@ -30,6 +30,8 @@
<description>A simple IT verifying the basic use case of pojogen-man-plugin.</description>
<properties>
+ <project.source>1.6</project.source>
+ <compiler.plugin.version>3.2</compiler.plugin.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
@@ -51,6 +53,18 @@
<build>
<plugins>
<plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>${compiler.plugin.version}</version>
+ <configuration>
+ <source>${project.source}</source>
+ <target>${project.source}</target>
+ <showWarnings>true</showWarnings>
+ <showDeprecation>true</showDeprecation>
+ <compilerArgument>-Xlint:unchecked</compilerArgument>
+ </configuration>
+ </plugin>
+ <plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.8</version>
diff --git a/ext/pojogen-maven-plugin/src/it/v3Sample/pom.xml b/ext/pojogen-maven-plugin/src/it/v3Sample/pom.xml
index 14a2f07..156168a 100644
--- a/ext/pojogen-maven-plugin/src/it/v3Sample/pom.xml
+++ b/ext/pojogen-maven-plugin/src/it/v3Sample/pom.xml
@@ -30,6 +30,8 @@
<description>A simple IT verifying the basic use case of pojogen-man-plugin.</description>
<properties>
+ <project.source>1.6</project.source>
+ <compiler.plugin.version>3.2</compiler.plugin.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
@@ -51,6 +53,18 @@
<build>
<plugins>
<plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>${compiler.plugin.version}</version>
+ <configuration>
+ <source>${project.source}</source>
+ <target>${project.source}</target>
+ <showWarnings>true</showWarnings>
+ <showDeprecation>true</showDeprecation>
+ <compilerArgument>-Xlint:unchecked</compilerArgument>
+ </configuration>
+ </plugin>
+ <plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.8</version>
diff --git a/ext/pojogen-maven-plugin/src/it/v4Sample/pom.xml b/ext/pojogen-maven-plugin/src/it/v4Sample/pom.xml
index 8955597..d2a988c 100644
--- a/ext/pojogen-maven-plugin/src/it/v4Sample/pom.xml
+++ b/ext/pojogen-maven-plugin/src/it/v4Sample/pom.xml
@@ -30,6 +30,8 @@
<description>A simple IT verifying the basic use case of pojogen-man-plugin.</description>
<properties>
+ <project.source>1.6</project.source>
+ <compiler.plugin.version>3.2</compiler.plugin.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
@@ -51,6 +53,18 @@
<build>
<plugins>
<plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>${compiler.plugin.version}</version>
+ <configuration>
+ <source>${project.source}</source>
+ <target>${project.source}</target>
+ <showWarnings>true</showWarnings>
+ <showDeprecation>true</showDeprecation>
+ <compilerArgument>-Xlint:unchecked</compilerArgument>
+ </configuration>
+ </plugin>
+ <plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.8</version>
diff --git a/ext/pom.xml b/ext/pom.xml
index d1e51ec..72c0d08 100644
--- a/ext/pom.xml
+++ b/ext/pom.xml
@@ -31,7 +31,7 @@
<parent>
<groupId>org.apache.olingo</groupId>
<artifactId>odata-parent</artifactId>
- <version>4.0.0-beta-02</version>
+ <version>3.0.0-beta-01-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
diff --git a/fit/pom.xml b/fit/pom.xml
index c606721..f558880 100644
--- a/fit/pom.xml
+++ b/fit/pom.xml
@@ -30,7 +30,7 @@
<parent>
<groupId>org.apache.olingo</groupId>
<artifactId>odata-parent</artifactId>
- <version>4.0.0-beta-02</version>
+ <version>3.0.0-beta-01-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
@@ -125,7 +125,7 @@
<dependency>
<groupId>org.apache.olingo</groupId>
<artifactId>odata-server-tecsvc</artifactId>
- <version>${project.version}</version>
+ <version>4.0.0-beta-02</version>
<scope>test</scope>
</dependency>
<dependency>
diff --git a/fit/src/it/actionOverloadingV3/pom.xml b/fit/src/it/actionOverloadingV3/pom.xml
index baaefd9..be62bd8 100644
--- a/fit/src/it/actionOverloadingV3/pom.xml
+++ b/fit/src/it/actionOverloadingV3/pom.xml
@@ -30,6 +30,8 @@
<description>A simple IT verifying the basic use case of pojogen-maven-plugin.</description>
<properties>
+ <project.source>1.6</project.source>
+ <compiler.plugin.version>3.2</compiler.plugin.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
@@ -51,6 +53,18 @@
<build>
<plugins>
<plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>${compiler.plugin.version}</version>
+ <configuration>
+ <source>${project.source}</source>
+ <target>${project.source}</target>
+ <showWarnings>true</showWarnings>
+ <showDeprecation>true</showDeprecation>
+ <compilerArgument>-Xlint:unchecked</compilerArgument>
+ </configuration>
+ </plugin>
+ <plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.8</version>
diff --git a/fit/src/it/demoV4/pom.xml b/fit/src/it/demoV4/pom.xml
index 1b1b1c2..0cfa319 100644
--- a/fit/src/it/demoV4/pom.xml
+++ b/fit/src/it/demoV4/pom.xml
@@ -30,6 +30,8 @@
<description>A simple IT verifying the basic use case of pojogen-maven-plugin.</description>
<properties>
+ <project.source>1.6</project.source>
+ <compiler.plugin.version>3.2</compiler.plugin.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
@@ -51,6 +53,18 @@
<build>
<plugins>
<plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>${compiler.plugin.version}</version>
+ <configuration>
+ <source>${project.source}</source>
+ <target>${project.source}</target>
+ <showWarnings>true</showWarnings>
+ <showDeprecation>true</showDeprecation>
+ <compilerArgument>-Xlint:unchecked</compilerArgument>
+ </configuration>
+ </plugin>
+ <plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.8</version>
diff --git a/fit/src/it/openTypeV3/pom.xml b/fit/src/it/openTypeV3/pom.xml
index a554c4e..75d49d5 100644
--- a/fit/src/it/openTypeV3/pom.xml
+++ b/fit/src/it/openTypeV3/pom.xml
@@ -30,6 +30,8 @@
<description>A simple IT verifying the basic use case of pojogen-man-plugin.</description>
<properties>
+ <project.source>1.6</project.source>
+ <compiler.plugin.version>3.2</compiler.plugin.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
@@ -51,6 +53,18 @@
<build>
<plugins>
<plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>${compiler.plugin.version}</version>
+ <configuration>
+ <source>${project.source}</source>
+ <target>${project.source}</target>
+ <showWarnings>true</showWarnings>
+ <showDeprecation>true</showDeprecation>
+ <compilerArgument>-Xlint:unchecked</compilerArgument>
+ </configuration>
+ </plugin>
+ <plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.8</version>
diff --git a/fit/src/it/openTypeV4/pom.xml b/fit/src/it/openTypeV4/pom.xml
index 151b5db..3ae5c84 100644
--- a/fit/src/it/openTypeV4/pom.xml
+++ b/fit/src/it/openTypeV4/pom.xml
@@ -30,6 +30,8 @@
<description>A simple IT verifying the basic use case of pojogen-man-plugin.</description>
<properties>
+ <project.source>1.6</project.source>
+ <compiler.plugin.version>3.2</compiler.plugin.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
@@ -51,6 +53,18 @@
<build>
<plugins>
<plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>${compiler.plugin.version}</version>
+ <configuration>
+ <source>${project.source}</source>
+ <target>${project.source}</target>
+ <showWarnings>true</showWarnings>
+ <showDeprecation>true</showDeprecation>
+ <compilerArgument>-Xlint:unchecked</compilerArgument>
+ </configuration>
+ </plugin>
+ <plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.8</version>
diff --git a/fit/src/it/primitiveKeysServiceV3/pom.xml b/fit/src/it/primitiveKeysServiceV3/pom.xml
index c5b4479..47df1d9 100644
--- a/fit/src/it/primitiveKeysServiceV3/pom.xml
+++ b/fit/src/it/primitiveKeysServiceV3/pom.xml
@@ -30,6 +30,8 @@
<description>A simple IT verifying the basic use case of pojogen-maven-plugin.</description>
<properties>
+ <project.source>1.6</project.source>
+ <compiler.plugin.version>3.2</compiler.plugin.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
@@ -51,6 +53,18 @@
<build>
<plugins>
<plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>${compiler.plugin.version}</version>
+ <configuration>
+ <source>${project.source}</source>
+ <target>${project.source}</target>
+ <showWarnings>true</showWarnings>
+ <showDeprecation>true</showDeprecation>
+ <compilerArgument>-Xlint:unchecked</compilerArgument>
+ </configuration>
+ </plugin>
+ <plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.8</version>
diff --git a/fit/src/it/staticServiceV3/pom.xml b/fit/src/it/staticServiceV3/pom.xml
index a95fe6b..528d94c 100644
--- a/fit/src/it/staticServiceV3/pom.xml
+++ b/fit/src/it/staticServiceV3/pom.xml
@@ -30,6 +30,8 @@
<description>A simple IT verifying the basic use case of pojogen-maven-plugin.</description>
<properties>
+ <project.source>1.6</project.source>
+ <compiler.plugin.version>3.2</compiler.plugin.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
@@ -51,6 +53,18 @@
<build>
<plugins>
<plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>${compiler.plugin.version}</version>
+ <configuration>
+ <source>${project.source}</source>
+ <target>${project.source}</target>
+ <showWarnings>true</showWarnings>
+ <showDeprecation>true</showDeprecation>
+ <compilerArgument>-Xlint:unchecked</compilerArgument>
+ </configuration>
+ </plugin>
+ <plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.8</version>
diff --git a/fit/src/it/staticServiceV4/pom.xml b/fit/src/it/staticServiceV4/pom.xml
index f18a5eb..424a17f 100644
--- a/fit/src/it/staticServiceV4/pom.xml
+++ b/fit/src/it/staticServiceV4/pom.xml
@@ -30,6 +30,8 @@
<description>A simple IT verifying the basic use case of pojogen-maven-plugin.</description>
<properties>
+ <project.source>1.6</project.source>
+ <compiler.plugin.version>3.2</compiler.plugin.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
@@ -51,6 +53,18 @@
<build>
<plugins>
<plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>${compiler.plugin.version}</version>
+ <configuration>
+ <source>${project.source}</source>
+ <target>${project.source}</target>
+ <showWarnings>true</showWarnings>
+ <showDeprecation>true</showDeprecation>
+ <compilerArgument>-Xlint:unchecked</compilerArgument>
+ </configuration>
+ </plugin>
+ <plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.8</version>
diff --git a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/BasicITCase.java b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/BasicITCase.java
index 39ed4ce..1b3537c 100644
--- a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/BasicITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/BasicITCase.java
@@ -28,20 +28,23 @@
import static org.junit.Assert.fail;
import java.io.IOException;
+import java.net.URI;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
-import org.apache.olingo.client.api.CommonODataClient;
import org.apache.olingo.client.api.communication.ODataClientErrorException;
import org.apache.olingo.client.api.communication.ODataServerErrorException;
import org.apache.olingo.client.api.communication.request.cud.ODataEntityCreateRequest;
+import org.apache.olingo.client.api.communication.request.cud.ODataEntityUpdateRequest;
+import org.apache.olingo.client.api.communication.request.cud.v4.UpdateType;
import org.apache.olingo.client.api.communication.request.retrieve.EdmMetadataRequest;
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest;
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetRequest;
import org.apache.olingo.client.api.communication.request.retrieve.ODataServiceDocumentRequest;
import org.apache.olingo.client.api.communication.request.retrieve.XMLMetadataRequest;
import org.apache.olingo.client.api.communication.response.ODataEntityCreateResponse;
+import org.apache.olingo.client.api.communication.response.ODataEntityUpdateResponse;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
import org.apache.olingo.client.api.edm.xml.XMLMetadata;
import org.apache.olingo.client.api.edm.xml.v4.Reference;
@@ -52,14 +55,19 @@
import org.apache.olingo.commons.api.domain.v4.ODataAnnotation;
import org.apache.olingo.commons.api.domain.v4.ODataEntity;
import org.apache.olingo.commons.api.domain.v4.ODataEntitySet;
+import org.apache.olingo.commons.api.domain.v4.ODataLinkedComplexValue;
+import org.apache.olingo.commons.api.domain.v4.ODataObjectFactory;
import org.apache.olingo.commons.api.domain.v4.ODataProperty;
import org.apache.olingo.commons.api.domain.v4.ODataValue;
import org.apache.olingo.commons.api.edm.Edm;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
import org.apache.olingo.commons.api.format.ContentType;
import org.apache.olingo.commons.api.format.ODataFormat;
+import org.apache.olingo.commons.api.http.HttpHeader;
import org.apache.olingo.commons.api.http.HttpStatusCode;
import org.apache.olingo.fit.AbstractBaseTestITCase;
import org.apache.olingo.fit.tecsvc.TecSvcConst;
+import org.junit.Ignore;
import org.junit.Test;
public class BasicITCase extends AbstractBaseTestITCase {
@@ -169,7 +177,7 @@
}
@Test
- public void readEntity() throws IOException {
+ public void readEntity() throws Exception {
final ODataEntityRequest<ODataEntity> request = getClient().getRetrieveRequestFactory()
.getEntityRequest(getClient().newURIBuilder(SERVICE_URI)
.appendEntitySetSegment("ESCollAllPrim").appendKeySegment(1).build());
@@ -191,15 +199,153 @@
assertEquals(30112, iterator.next().asPrimitive().toValue());
}
+ @Test
+ @Ignore
+ public void patchEntity() throws Exception {
+ final ODataClient client = getClient();
+ final ODataObjectFactory factory = client.getObjectFactory();
+ ODataEntity patchEntity = factory.newEntity(new FullQualifiedName("olingo.odata.test1", "ETAllPrim"));
+ patchEntity.getProperties().add(factory.newPrimitiveProperty("PropertyString",
+ factory.newPrimitiveValueBuilder().buildString("new")));
+ patchEntity.getProperties().add(factory.newPrimitiveProperty("PropertyDecimal",
+ factory.newPrimitiveValueBuilder().buildDouble(42.875)));
+ patchEntity.getProperties().add(factory.newPrimitiveProperty("PropertyInt64",
+ factory.newPrimitiveValueBuilder().buildInt64(null)));
+ final URI uri = client.newURIBuilder(SERVICE_URI).appendEntitySetSegment("ESAllPrim").appendKeySegment(32767)
+ .build();
+ final ODataEntityUpdateRequest<ODataEntity> request = client.getCUDRequestFactory().getEntityUpdateRequest(
+ uri, UpdateType.PATCH, patchEntity);
+ final ODataEntityUpdateResponse<ODataEntity> response = request.execute();
+ assertEquals(HttpStatusCode.NO_CONTENT.getStatusCode(), response.getStatusCode());
+
+ // Check that the patched properties have changed and the other properties not.
+ // This check has to be in the same session in order to access the same data provider.
+ ODataEntityRequest<ODataEntity> entityRequest = client.getRetrieveRequestFactory().getEntityRequest(uri);
+ entityRequest.addCustomHeader(HttpHeader.COOKIE, response.getHeader(HttpHeader.SET_COOKIE).iterator().next());
+ final ODataRetrieveResponse<ODataEntity> entityResponse = entityRequest.execute();
+ assertEquals(HttpStatusCode.OK.getStatusCode(), entityResponse.getStatusCode());
+ final ODataEntity entity = entityResponse.getBody();
+ assertNotNull(entity);
+ final ODataProperty property1 = entity.getProperty("PropertyString");
+ assertNotNull(property1);
+ assertEquals("new", property1.getPrimitiveValue().toValue());
+ final ODataProperty property2 = entity.getProperty("PropertyDecimal");
+ assertNotNull(property2);
+ assertEquals(42.875, property2.getPrimitiveValue().toValue());
+ final ODataProperty property3 = entity.getProperty("PropertyInt64");
+ assertNotNull(property3);
+ assertNull(property3.getPrimitiveValue());
+ final ODataProperty property4 = entity.getProperty("PropertyDuration");
+ assertNotNull(property4);
+ assertEquals("PT6S", property4.getPrimitiveValue().toValue());
+ }
+
+ @Test
+ @Ignore
+ public void updateEntity() throws Exception {
+ final ODataClient client = getClient();
+ final ODataObjectFactory factory = client.getObjectFactory();
+ ODataEntity newEntity = factory.newEntity(new FullQualifiedName("olingo.odata.test1", "ETAllPrim"));
+ newEntity.getProperties().add(factory.newPrimitiveProperty("PropertyInt64",
+ factory.newPrimitiveValueBuilder().buildInt32(42)));
+ final URI uri = client.newURIBuilder(SERVICE_URI).appendEntitySetSegment("ESAllPrim").appendKeySegment(32767)
+ .build();
+ final ODataEntityUpdateRequest<ODataEntity> request = client.getCUDRequestFactory().getEntityUpdateRequest(
+ uri, UpdateType.REPLACE, newEntity);
+ final ODataEntityUpdateResponse<ODataEntity> response = request.execute();
+ assertEquals(HttpStatusCode.NO_CONTENT.getStatusCode(), response.getStatusCode());
+
+ // Check that the updated properties have changed and that other properties have their default values.
+ // This check has to be in the same session in order to access the same data provider.
+ ODataEntityRequest<ODataEntity> entityRequest = client.getRetrieveRequestFactory().getEntityRequest(uri);
+ entityRequest.addCustomHeader(HttpHeader.COOKIE, response.getHeader(HttpHeader.SET_COOKIE).iterator().next());
+ final ODataRetrieveResponse<ODataEntity> entityResponse = entityRequest.execute();
+ assertEquals(HttpStatusCode.OK.getStatusCode(), entityResponse.getStatusCode());
+ final ODataEntity entity = entityResponse.getBody();
+ assertNotNull(entity);
+ final ODataProperty property1 = entity.getProperty("PropertyInt64");
+ assertNotNull(property1);
+ assertEquals(42, property1.getPrimitiveValue().toValue());
+ final ODataProperty property2 = entity.getProperty("PropertyDecimal");
+ assertNotNull(property2);
+ assertNull(property2.getPrimitiveValue());
+ }
+
+ @Test
+ @Ignore
+ public void patchEntityWithComplex() throws Exception {
+ final ODataClient client = getClient();
+ final ODataObjectFactory factory = client.getObjectFactory();
+ ODataEntity patchEntity = factory.newEntity(new FullQualifiedName("olingo.odata.test1", "ETCompComp"));
+ patchEntity.getProperties().add(factory.newComplexProperty("PropertyComp",
+ factory.newLinkedComplexValue("olingo.odata.test1.CTCompComp").add(
+ factory.newComplexProperty("PropertyComp",
+ factory.newLinkedComplexValue("olingo.odata.test1.CTTwoPrim").add(
+ factory.newPrimitiveProperty("PropertyInt16",
+ factory.newPrimitiveValueBuilder().buildInt32(42)))))));
+ final URI uri = client.newURIBuilder(SERVICE_URI).appendEntitySetSegment("ESCompComp").appendKeySegment(1).build();
+ final ODataEntityUpdateRequest<ODataEntity> request = client.getCUDRequestFactory().getEntityUpdateRequest(
+ uri, UpdateType.PATCH, patchEntity);
+ final ODataEntityUpdateResponse<ODataEntity> response = request.execute();
+ assertEquals(HttpStatusCode.NO_CONTENT.getStatusCode(), response.getStatusCode());
+
+ // Check that the patched properties have changed and the other properties not.
+ // This check has to be in the same session in order to access the same data provider.
+ ODataEntityRequest<ODataEntity> entityRequest = client.getRetrieveRequestFactory().getEntityRequest(uri);
+ entityRequest.addCustomHeader(HttpHeader.COOKIE, response.getHeader(HttpHeader.SET_COOKIE).iterator().next());
+ final ODataRetrieveResponse<ODataEntity> entityResponse = entityRequest.execute();
+ assertEquals(HttpStatusCode.OK.getStatusCode(), entityResponse.getStatusCode());
+ final ODataEntity entity = entityResponse.getBody();
+ assertNotNull(entity);
+ final ODataLinkedComplexValue complex = entity.getProperty("PropertyComp").getLinkedComplexValue()
+ .get("PropertyComp").getLinkedComplexValue();
+ assertNotNull(complex);
+ final ODataProperty property1 = complex.get("PropertyInt16");
+ assertNotNull(property1);
+ assertEquals(42, property1.getPrimitiveValue().toValue());
+ final ODataProperty property2 = complex.get("PropertyString");
+ assertNotNull(property2);
+ assertEquals("String 1", property2.getPrimitiveValue().toValue());
+ }
+
+ @Test
+ @Ignore("Actual leads to an unexpected exception")
+ public void updateEntityWithComplex() throws Exception {
+ final ODataClient client = getClient();
+ final ODataObjectFactory factory = client.getObjectFactory();
+ ODataEntity newEntity = factory.newEntity(new FullQualifiedName("olingo.odata.test1", "ETCompComp"));
+ newEntity.getProperties().add(factory.newComplexProperty("PropertyComp", null));
+ final URI uri = client.newURIBuilder(SERVICE_URI).appendEntitySetSegment("ESCompComp").appendKeySegment(1).build();
+ final ODataEntityUpdateRequest<ODataEntity> request = client.getCUDRequestFactory().getEntityUpdateRequest(
+ uri, UpdateType.REPLACE, newEntity);
+ final ODataEntityUpdateResponse<ODataEntity> response = request.execute();
+ assertEquals(HttpStatusCode.NO_CONTENT.getStatusCode(), response.getStatusCode());
+
+ // Check that the complex-property hierarchy is still there and that all primitive values are now null.
+ // This check has to be in the same session in order to access the same data provider.
+ ODataEntityRequest<ODataEntity> entityRequest = client.getRetrieveRequestFactory().getEntityRequest(uri);
+ entityRequest.addCustomHeader(HttpHeader.COOKIE, response.getHeader(HttpHeader.SET_COOKIE).iterator().next());
+ final ODataRetrieveResponse<ODataEntity> entityResponse = entityRequest.execute();
+ assertEquals(HttpStatusCode.OK.getStatusCode(), entityResponse.getStatusCode());
+ final ODataEntity entity = entityResponse.getBody();
+ assertNotNull(entity);
+ final ODataLinkedComplexValue complex = entity.getProperty("PropertyComp").getLinkedComplexValue()
+ .get("PropertyComp").getLinkedComplexValue();
+ assertNotNull(complex);
+ final ODataProperty property = complex.get("PropertyInt16");
+ assertNotNull(property);
+ assertNull(property.getPrimitiveValue());
+ }
+
/**
- * Actual an create request for an entity will lead to an "501 - Not Implemented" response
- * and hence to an ODataServerErrorException
+ * Currently a create request for an entity will lead to a "501 - Not Implemented" response
+ * and hence to an ODataServerErrorException.
*/
@Test(expected = ODataServerErrorException.class)
public void createEntity() throws IOException {
final ODataEntityRequest<ODataEntity> request = getClient().getRetrieveRequestFactory()
- .getEntityRequest(getClient().newURIBuilder(SERVICE_URI)
- .appendEntitySetSegment("ESCollAllPrim").appendKeySegment(1).build());
+ .getEntityRequest(getClient().newURIBuilder(SERVICE_URI)
+ .appendEntitySetSegment("ESCollAllPrim").appendKeySegment(1).build());
assertNotNull(request);
final ODataRetrieveResponse<ODataEntity> response = request.execute();
@@ -210,8 +356,8 @@
assertNotNull(entity);
final ODataEntityCreateRequest<ODataEntity> createRequest = getClient().getCUDRequestFactory()
- .getEntityCreateRequest(getClient().newURIBuilder(SERVICE_URI)
- .appendEntitySetSegment("ESCollAllPrim").build(), entity);
+ .getEntityCreateRequest(getClient().newURIBuilder(SERVICE_URI)
+ .appendEntitySetSegment("ESCollAllPrim").build(), entity);
assertNotNull(createRequest);
ODataEntityCreateResponse<ODataEntity> createResponse = createRequest.execute();
@@ -228,7 +374,7 @@
}
@Override
- protected CommonODataClient<?> getClient() {
+ protected ODataClient getClient() {
ODataClient odata = ODataClientFactory.getV4();
odata.getConfiguration().setDefaultPubFormat(ODataFormat.JSON);
return odata;
diff --git a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/MediaITCase.java b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/MediaITCase.java
index 18fa834..b317234 100644
--- a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/MediaITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/MediaITCase.java
@@ -49,6 +49,7 @@
import org.apache.olingo.fit.AbstractBaseTestITCase;
import org.apache.olingo.fit.tecsvc.TecSvcConst;
import org.junit.Test;
+import org.junit.Ignore;
public final class MediaITCase extends AbstractBaseTestITCase {
@@ -93,6 +94,7 @@
}
@Test
+ @Ignore
public void update() throws Exception {
final CommonODataClient<?> client = getClient();
final URI uri = client.newURIBuilder(TecSvcConst.BASE_URI)
@@ -104,13 +106,7 @@
assertNotNull(request);
final ODataMediaEntityUpdateResponse<CommonODataEntity> response = request.payloadManager().getResponse();
- assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode());
- final CommonODataEntity entity = response.getBody();
- assertNotNull(entity);
- final CommonODataProperty property = entity.getProperty("PropertyInt16");
- assertNotNull(property);
- assertNotNull(property.getPrimitiveValue());
- assertEquals(4, property.getPrimitiveValue().toValue());
+ assertEquals(HttpStatusCode.NO_CONTENT.getStatusCode(), response.getStatusCode());
// Check that the media stream has changed.
// This check has to be in the same session in order to access the same data provider.
diff --git a/lib/client-api/pom.xml b/lib/client-api/pom.xml
index 7de111d..378a3b9 100644
--- a/lib/client-api/pom.xml
+++ b/lib/client-api/pom.xml
@@ -30,7 +30,7 @@
<parent>
<groupId>org.apache.olingo</groupId>
<artifactId>odata-lib</artifactId>
- <version>4.0.0-beta-02</version>
+ <version>3.0.0-beta-01-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
diff --git a/lib/client-core/pom.xml b/lib/client-core/pom.xml
index c30515a..98d30ca 100644
--- a/lib/client-core/pom.xml
+++ b/lib/client-core/pom.xml
@@ -30,7 +30,7 @@
<parent>
<groupId>org.apache.olingo</groupId>
<artifactId>odata-lib</artifactId>
- <version>4.0.0-beta-02</version>
+ <version>3.0.0-beta-01-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
diff --git a/lib/commons-api/pom.xml b/lib/commons-api/pom.xml
index ce0d33a..a08a6a1 100644
--- a/lib/commons-api/pom.xml
+++ b/lib/commons-api/pom.xml
@@ -30,7 +30,7 @@
<parent>
<groupId>org.apache.olingo</groupId>
<artifactId>odata-lib</artifactId>
- <version>4.0.0-beta-02</version>
+ <version>3.0.0-beta-01-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
diff --git a/lib/commons-core/pom.xml b/lib/commons-core/pom.xml
index fd5aa90..005fa5e 100644
--- a/lib/commons-core/pom.xml
+++ b/lib/commons-core/pom.xml
@@ -30,7 +30,7 @@
<parent>
<groupId>org.apache.olingo</groupId>
<artifactId>odata-lib</artifactId>
- <version>4.0.0-beta-02</version>
+ <version>3.0.0-beta-01-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
diff --git a/lib/pom.xml b/lib/pom.xml
index e4280fc..7fcfa2b 100644
--- a/lib/pom.xml
+++ b/lib/pom.xml
@@ -31,7 +31,7 @@
<parent>
<groupId>org.apache.olingo</groupId>
<artifactId>odata-parent</artifactId>
- <version>4.0.0-beta-02</version>
+ <version>3.0.0-beta-01-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
@@ -40,9 +40,5 @@
<module>commons-core</module>
<module>client-api</module>
<module>client-core</module>
- <module>server-api</module>
- <module>server-core</module>
- <module>server-tecsvc</module>
- <module>server-test</module>
</modules>
</project>
diff --git a/lib/server-api/pom.xml b/lib/server-api/pom.xml
deleted file mode 100644
index 4d47a38..0000000
--- a/lib/server-api/pom.xml
+++ /dev/null
@@ -1,55 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
- 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.
-
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <artifactId>odata-server-api</artifactId>
- <packaging>jar</packaging>
- <name>${project.artifactId}</name>
-
- <parent>
- <groupId>org.apache.olingo</groupId>
- <artifactId>odata-lib</artifactId>
- <version>4.0.0-beta-02</version>
- <relativePath>..</relativePath>
- </parent>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.olingo</groupId>
- <artifactId>odata-commons-api</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- <version>2.5</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- </dependency>
- </dependencies>
-
-</project>
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/OData.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/OData.java
deleted file mode 100644
index eddd0da..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/OData.java
+++ /dev/null
@@ -1,103 +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.api;
-
-import java.util.List;
-
-import org.apache.olingo.commons.api.ODataRuntimeException;
-import org.apache.olingo.commons.api.format.ODataFormat;
-import org.apache.olingo.server.api.deserializer.DeserializerException;
-import org.apache.olingo.server.api.deserializer.FixedFormatDeserializer;
-import org.apache.olingo.server.api.deserializer.ODataDeserializer;
-import org.apache.olingo.server.api.edm.provider.EdmProvider;
-import org.apache.olingo.server.api.edmx.EdmxReference;
-import org.apache.olingo.server.api.serializer.FixedFormatSerializer;
-import org.apache.olingo.server.api.serializer.ODataSerializer;
-import org.apache.olingo.server.api.serializer.SerializerException;
-import org.apache.olingo.server.api.uri.UriHelper;
-
-/**
- * Root object for serving factory tasks and support loose coupling of implementation (core) from the API.
- * This is not a singleton (static variables) to avoid issues with synchronization, OSGi, hot deployment and so on.
- * Each thread (request) should keep its own instance.
- */
-public abstract class OData {
-
- private static final String IMPLEMENTATION = "org.apache.olingo.server.core.ODataImpl";
-
- public static OData newInstance() {
- try {
- final Class<?> clazz = Class.forName(OData.IMPLEMENTATION);
-
- /*
- * We explicitly do not use the singleton pattern to keep the server state free
- * and avoid class loading issues also during hot deployment.
- */
- final Object object = clazz.newInstance();
-
- return (OData) object;
-
- } catch (final Exception e) {
- throw new ODataRuntimeException(e);
- }
- }
-
- /**
- * Creates a new serializer object for rendering content in the specified format.
- * Serializers are used in Processor implementations.
- *
- * @param format any format supported by Olingo (XML, JSON ...)
- */
- public abstract ODataSerializer createSerializer(ODataFormat format) throws SerializerException;
-
- /**
- * Creates a new serializer object for rendering content in a fixed format, e.g., for binary output.
- * Serializers are used in Processor implementations.
- */
- public abstract FixedFormatSerializer createFixedFormatSerializer();
-
- /**
- * Creates a new deserializer object for reading content in a fixed format, e.g., for binary input.
- * Deserializers are used in Processor implementations.
- */
- public abstract FixedFormatDeserializer createFixedFormatDeserializer();
-
- /**
- * Creates a new ODataHttpHandler for handling OData requests in an HTTP context.
- *
- * @param serviceMetadata - metadata object required to handle an OData request
- */
- public abstract ODataHttpHandler createHandler(ServiceMetadata serviceMetadata);
-
- /**
- * Creates a metadata object for this service.
- *
- * @param edmProvider a custom or default implementation for creating metadata
- * @param references list of edmx references
- */
- public abstract ServiceMetadata createServiceMetadata(EdmProvider edmProvider, List<EdmxReference> references);
-
- /**
- * Creates a new URI helper object for performing URI-related tasks.
- * It can be used in Processor implementations.
- */
- public abstract UriHelper createUriHelper();
-
- public abstract ODataDeserializer createDeserializer(ODataFormat format) throws DeserializerException;
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataApplicationException.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataApplicationException.java
deleted file mode 100644
index 6dda314..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataApplicationException.java
+++ /dev/null
@@ -1,111 +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.api;
-
-import java.util.Locale;
-
-import org.apache.olingo.commons.api.ODataException;
-import org.apache.olingo.commons.api.http.HttpStatusCode;
-
-/**
- * Exception thrown by OData service implementations.
- * @see ODataException
- */
-public class ODataApplicationException extends ODataException {
-
- private static final long serialVersionUID = 5358683245923127425L;
- private int statusCode = HttpStatusCode.INTERNAL_SERVER_ERROR.getStatusCode();
- private Locale locale;
- private String oDataErrorCode;
-
- /**
- * Exception in an OData service implementation.
- * @param msg the text of the exception
- * @param statusCode the HTTP status code of the error response; the default is 500 - Internal Server Error
- * @param locale a {@link Locale} to enable translation of error messages
- * @see ODataException
- * @see HttpStatusCode
- */
- public ODataApplicationException(final String msg, final int statusCode, final Locale locale) {
- super(msg);
- this.statusCode = statusCode;
- this.locale = locale;
- }
-
- /**
- * Exception in an OData service implementation.
- * @param msg the text of the exception
- * @param statusCode the HTTP status code of the error response; the default is 500 - Internal Server Error
- * @param locale a {@link Locale} to enable translation of error messages
- * @param oDataErrorCode the error code of the exception as defined by the OData standard
- * @see ODataException
- * @see HttpStatusCode
- */
- public ODataApplicationException(final String msg, final int statusCode, final Locale locale,
- final String oDataErrorCode) {
- this(msg, statusCode, locale);
- this.oDataErrorCode = oDataErrorCode;
- }
-
- /**
- * Exception in an OData service implementation.
- * @param msg the text of the exception
- * @param statusCode the HTTP status code of the error response; the default is 500 - Internal Server Error
- * @param locale a {@link Locale} to enable translation of error messages
- * @param cause the cause of this exception
- * @see ODataException
- * @see HttpStatusCode
- * @see Throwable#getCause()
- */
- public ODataApplicationException(final String msg, final int statusCode, final Locale locale,
- final Throwable cause) {
- super(msg, cause);
- this.statusCode = statusCode;
- this.locale = locale;
- }
-
- /**
- * Exception in an OData service implementation.
- * @param msg the text of the exception
- * @param statusCode the HTTP status code of the error response; the default is 500 - Internal Server Error
- * @param locale a {@link Locale} to enable translation of error messages
- * @param cause the cause of this exception
- * @param oDataErrorCode the error code of the exception as defined by the OData standard
- * @see ODataException
- * @see HttpStatusCode
- * @see Throwable#getCause()
- */
- public ODataApplicationException(final String msg, final int statusCode, final Locale locale, final Throwable cause,
- final String oDataErrorCode) {
- this(msg, statusCode, locale, cause);
- this.oDataErrorCode = oDataErrorCode;
- }
-
- public int getStatusCode() {
- return statusCode;
- }
-
- public Locale getLocale() {
- return locale;
- }
-
- public String getODataErrorCode() {
- return oDataErrorCode;
- }
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataHttpHandler.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataHttpHandler.java
deleted file mode 100644
index 8e4f257..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataHttpHandler.java
+++ /dev/null
@@ -1,62 +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.api;
-
-import org.apache.olingo.server.api.processor.Processor;
-import org.apache.olingo.server.api.serializer.CustomContentTypeSupport;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-/**
- * Handles HTTP requests as OData requests.
- */
-public interface ODataHttpHandler {
-
- /**
- * <p>Processes an OData request.</p>
- * <p>This includes URI parsing, content negotiation, dispatching the request
- * to a specific custom processor implementation for handling data and
- * creating the serialized content for the response object.</p>
- * @param request - must be a HTTP OData request
- * @param response - HTTP OData response
- */
- void process(HttpServletRequest request, HttpServletResponse response);
-
- /**
- * <p>Registers additional custom processor implementations for handling OData requests.</p>
- * <p>If request processing requires a processor that is not registered then a
- * "not implemented" exception will happen.</p>
- */
- void register(Processor processor);
-
- /**
- * Registers a service implementation for modifying the standard list of supported
- * content types.
- * @see CustomContentTypeSupport
- */
- void register(CustomContentTypeSupport customContentTypeSupport);
-
- /**
- * Sets the split parameter which is used for service resolution.
- * @param split the number of path segments reserved for service resolution; default is 0
- */
- void setSplit(int split);
-
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataRequest.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataRequest.java
deleted file mode 100644
index 03e2936..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataRequest.java
+++ /dev/null
@@ -1,196 +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.api;
-
-import org.apache.olingo.commons.api.http.HttpMethod;
-
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * Request object to carry HTTP information optimized for and required to handle OData requests only.
- */
-public class ODataRequest {
- private HttpMethod method;
- private Map<String, List<String>> headers = new HashMap<String, List<String>>();
- private InputStream body;
- private String rawQueryPath;
- private String rawRequestUri;
- private String rawODataPath;
- private String rawBaseUri;
- private String rawServiceResolutionUri;
-
- /**
- * Gets the HTTP method.
- * @return the HTTP method (GET, PUT, POST ...)
- */
- public HttpMethod getMethod() {
- return method;
- }
-
- /**
- * Sets the HTTP method.
- * @param method the HTTP method (GET, PUT, POST ...)
- */
- public void setMethod(final HttpMethod method) {
- this.method = method;
- }
-
- /**
- * <p>Adds a header to the request.</p>
- * <p>The header name will be handled as case-insensitive key.</p>
- * <p>If a header already exists then the list of values will just be extended.</p>
- * @param name case-insensitive header name
- * @param values list of values for the given header name
- * @see <a href="http://ietf.org/rfc/rfc7230.txt">RFC 7230, section 3.2.2</a>
- */
- public void addHeader(final String name, final List<String> values) {
- String key = name.toUpperCase();
- if (headers.containsKey(key)) {
- List<String> oldValues = headers.get(key);
-
- List<String> newValues = new ArrayList<String>();
- newValues.addAll(oldValues);
- newValues.addAll(values);
-
- headers.put(name.toUpperCase(), newValues);
- } else {
- headers.put(name.toUpperCase(), values);
- }
- }
-
- /**
- * Gets header value for a given name.
- * @param name the header name as a case-insensitive key
- * @return the header value(s) or null if not found
- */
- public List<String> getHeaders(final String name) {
- return headers.get(name.toUpperCase());
- }
-
- /**
- * Gets first header value for a given name.
- * @param name the header name as a case-insensitive key
- * @return the first header value or null if not found
- */
- public String getHeader(final String name) {
- final List<String> values = getHeaders(name);
- return values == null ? null : values.get(0);
- }
-
- /**
- * Gets the body of the request.
- * @return the request payload as {@link InputStream} or null
- */
- public InputStream getBody() {
- return body;
- }
-
- /**
- * Sets the body of the request.
- * @param body the request payload as {@link InputStream}
- */
- public void setBody(final InputStream body) {
- this.body = body;
- }
-
- /**
- * Gets the query part of the request URI.
- * @return the undecoded query options, e.g., "<code>$format=json,$top=10</code>"
- * @see <a href="http://ietf.org/rfc/rfc3986.txt">RFC 3986, section 3.4</a>
- */
- public String getRawQueryPath() {
- return rawQueryPath;
- }
-
- /**
- * Sets the query part of the request URI.
- * @see #getRawQueryPath()
- */
- public void setRawQueryPath(final String rawQueryPath) {
- this.rawQueryPath = rawQueryPath;
- }
-
- /**
- * Gets the base URI.
- * @return undecoded base URI, e.g., "<code>http://localhost/my%20service</code>"
- */
- public String getRawBaseUri() {
- return rawBaseUri;
- }
-
- /**
- * Sets the base URI.
- * @see #getRawBaseUri()
- */
- public void setRawBaseUri(final String rawBaseUri) {
- this.rawBaseUri = rawBaseUri;
- }
-
- /**
- * Gets the total request URI.
- * @return undecoded request URI, e.g., "<code>http://localhost/my%20service/sys1/Employees?$format=json</code>"
- */
- public String getRawRequestUri() {
- return rawRequestUri;
- }
-
- /**
- * Sets the total request URI.
- * @see #getRawRequestUri()
- */
- public void setRawRequestUri(final String rawRequestUri) {
- this.rawRequestUri = rawRequestUri;
- }
-
- /**
- * Gets the path segments of the request URI that belong to OData.
- * @return undecoded OData path segments, e.g., "/Employees"
- */
- public String getRawODataPath() {
- return rawODataPath;
- }
-
- /**
- * Sets the path segments of the request URI that belong to OData.
- * @see #getRawODataPath()
- */
- public void setRawODataPath(final String rawODataPath) {
- this.rawODataPath = rawODataPath;
- }
-
- /**
- * Gets the URI part responsible for service resolution.
- * @return undecoded path segments that do not belong to the OData URL schema or null, e.g., "<code>sys1</code>"
- */
- public String getRawServiceResolutionUri() {
- return rawServiceResolutionUri;
- }
-
- /**
- * Sets the URI part responsible for service resolution.
- * @see #getRawServiceResolutionUri()
- */
- public void setRawServiceResolutionUri(final String rawServiceResolutionUri) {
- this.rawServiceResolutionUri = rawServiceResolutionUri;
- }
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataResponse.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataResponse.java
deleted file mode 100644
index d629112..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataResponse.java
+++ /dev/null
@@ -1,87 +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.api;
-
-import java.io.InputStream;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.olingo.commons.api.http.HttpStatusCode;
-
-/**
- * Response object to carry OData-relevant HTTP information (status code, response headers, and content).
- */
-public class ODataResponse {
-
- private int statusCode = HttpStatusCode.INTERNAL_SERVER_ERROR.getStatusCode();
- private Map<String, String> headers = new HashMap<String, String>();
- private InputStream content;
-
-
- /**
- * Sets the status code.
- * @see HttpStatusCode
- */
- public void setStatusCode(final int statusCode) {
- this.statusCode = statusCode;
- }
-
- /**
- * Gets the status code.
- * @see HttpStatusCode
- */
- public int getStatusCode() {
- return statusCode;
- }
-
- /**
- * Sets a header.
- * @param name the name
- * @param value the value
- */
- public void setHeader(final String name, final String value) {
- headers.put(name, value);
- }
-
- /**
- * Gets all headers.
- * @return an unmodifiable Map of header names/values
- */
- public Map<String, String> getHeaders() {
- return Collections.unmodifiableMap(headers);
- }
-
- /**
- * Sets the content (body).
- * @param content the content as {@link InputStream}
- */
- public void setContent(final InputStream content) {
- this.content = content;
- }
-
- /**
- * Gets the content (body).
- * @return the content as {@link InputStream}
- */
- public InputStream getContent() {
- return content;
- }
-
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataServerError.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataServerError.java
deleted file mode 100644
index 8b184b2..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataServerError.java
+++ /dev/null
@@ -1,138 +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.api;
-
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-
-import org.apache.olingo.commons.api.domain.ODataError;
-import org.apache.olingo.commons.api.domain.ODataErrorDetail;
-
-/**
- * Server error.
- */
-public class ODataServerError extends ODataError {
-
- private Exception exception;
- private int statusCode;
- private Locale locale;
-
- /**
- * Gets the locale.
- * @return the locale for the exception message
- */
- public Locale getLocale() {
- return locale;
- }
-
- /**
- * Sets the locale.
- * @return this for method chaining
- */
- public ODataServerError setLocale(Locale locale) {
- this.locale = locale;
- return this;
- }
-
- /**
- * Gets the exception.
- * @return the exception with its hierarchy
- */
- public Exception getException() {
- return exception;
- }
-
- /**
- * Sets the exception.
- * @return this for method chaining
- */
- public ODataServerError setException(Exception exception) {
- this.exception = exception;
- return this;
- }
-
- /**
- * Gets the status code.
- * @return the status code which this error results in.
- */
- public int getStatusCode() {
- return statusCode;
- }
-
- /**
- * Sets the status code.
- * @param statusCode the status code which this error results in
- * @return this for method chaining
- */
- public ODataServerError setStatusCode(int statusCode) {
- this.statusCode = statusCode;
- return this;
- }
-
- /**
- * The value for the code name/value pair is a language-independent string.
- * Its value is a service-defined error code. This code serves as a sub-status
- * for the HTTP error code specified in the response. MAY be null.
- * @return this for method chaining
- */
- public ODataServerError setCode(String code) {
- super.setCode(code);
- return this;
- }
-
- /**
- * The value for the message name/value pair MUST be a human-readable,
- * language-dependent representation of the error. MUST not be null.
- * @return this for method chaining
- */
- public ODataServerError setMessage(String message) {
- super.setMessage(message);
- return this;
- }
-
- /**
- * The value for the target name/value pair is the target of the particular error (for example, the name of the
- * property in error). MAY be null.
- * @return this for method chaining
- */
- public ODataServerError setTarget(String target) {
- super.setTarget(target);
- return this;
- }
-
- /**
- * Sets error details.
- * @return this for method chaining.
- */
- public ODataServerError setDetails(List<ODataErrorDetail> details) {
- super.setDetails(details);
- return this;
- }
-
- /**
- * Sets server defined key-value pairs for debug environment only.
- * @return this for method chaining.
- */
- public ODataServerError setInnerError(Map<String, String> innerError) {
- super.setInnerError(innerError);
- return this;
- }
-
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataTranslatedException.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataTranslatedException.java
deleted file mode 100644
index 4336456..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/ODataTranslatedException.java
+++ /dev/null
@@ -1,157 +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.api;
-
-import java.util.Arrays;
-import java.util.Formatter;
-import java.util.Locale;
-import java.util.MissingFormatArgumentException;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-import org.apache.olingo.commons.api.ODataException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Abstract superclass of all translatable server exceptions.
- */
-public abstract class ODataTranslatedException extends ODataException {
-
- private static final long serialVersionUID = -1210541002198287561L;
- private static final Logger LOG = LoggerFactory.getLogger(ODataTranslatedException.class);
- private static final Locale DEFAULT_LOCALE = Locale.ENGLISH;
-
- protected static final String DEFAULT_SERVER_BUNDLE_NAME = "server-core-exceptions-i18n";
-
- /** Key for the exception text in the resource bundle. */
- public static interface MessageKey {
- /** Gets this key. */
- public String getKey();
- }
-
- private MessageKey messageKey;
- private Object[] parameters;
-
- protected ODataTranslatedException(String developmentMessage, MessageKey messageKey, String... parameters) {
- super(developmentMessage);
- this.messageKey = messageKey;
- this.parameters = parameters;
- }
-
- protected ODataTranslatedException(String developmentMessage, Throwable cause, MessageKey messageKey,
- String... parameters) {
- super(developmentMessage, cause);
- this.messageKey = messageKey;
- this.parameters = parameters;
- }
-
- @Override
- public String getLocalizedMessage() {
- return getTranslatedMessage(DEFAULT_LOCALE).getMessage();
- }
-
- @Override
- public String toString() {
- return getMessage();
- }
-
- /** Gets the message key. */
- public MessageKey getMessageKey() {
- return messageKey;
- }
-
- /**
- * Gets the translated message text for a given locale (or the default locale if not available),
- * returning the developer message text if none is found.
- * @param locale the preferred {@link Locale}
- * @return the error message
- */
- public ODataErrorMessage getTranslatedMessage(final Locale locale) {
- if (messageKey == null) {
- return new ODataErrorMessage(getMessage(), DEFAULT_LOCALE);
- }
- ResourceBundle bundle = createResourceBundle(locale);
- if (bundle == null) {
- return new ODataErrorMessage(getMessage(), DEFAULT_LOCALE);
- }
-
- return buildMessage(bundle, locale);
- }
-
- /**
- * <p>Gets the name of the {@link ResourceBundle} containing the exception texts.</p>
- * <p>The key for an exception text is the concatenation of the exception-class name and
- * the {@link MessageKey}, separated by a dot.</p>
- * @return the name of the resource bundle
- */
- protected abstract String getBundleName();
-
- private ResourceBundle createResourceBundle(final Locale locale) {
- try {
- return ResourceBundle.getBundle(getBundleName(), locale == null ? DEFAULT_LOCALE : locale);
- } catch (final MissingResourceException e) {
- LOG.error(e.getMessage(), e);
- return null;
- }
- }
-
- private ODataErrorMessage buildMessage(ResourceBundle bundle, Locale locale) {
- String message = null;
-
- try {
- message = bundle.getString(getClass().getSimpleName() + '.' + messageKey.getKey());
- StringBuilder builder = new StringBuilder();
- Formatter f = new Formatter(builder, locale);
- f.format(message, parameters);
- f.close();
- Locale usedLocale = bundle.getLocale();
- if (Locale.ROOT.equals(usedLocale)) {
- usedLocale = DEFAULT_LOCALE;
- }
- return new ODataErrorMessage(builder.toString(), usedLocale);
- } catch (MissingResourceException e) {
- return new ODataErrorMessage("Missing message for key '" + messageKey.getKey() + "'!", DEFAULT_LOCALE);
- } catch (MissingFormatArgumentException e) {
- return new ODataErrorMessage("Missing replacement for place holder in message '" + message +
- "' for following arguments '" + Arrays.toString(parameters) + "'!", DEFAULT_LOCALE);
- }
- }
-
- /** Error message text and {@link Locale} used for it. */
- public class ODataErrorMessage {
- String message;
- Locale locale;
-
- public ODataErrorMessage(final String message, final Locale usedLocale) {
- this.message = message;
- this.locale = usedLocale;
- }
-
- /** Gets the message text. */
- public String getMessage() {
- return message;
- }
-
- /** Gets the {@link Locale} used for this message. */
- public Locale getLocale() {
- return locale;
- }
- }
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/ServiceMetadata.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/ServiceMetadata.java
deleted file mode 100644
index dc06b94..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/ServiceMetadata.java
+++ /dev/null
@@ -1,48 +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.api;
-
-import org.apache.olingo.commons.api.edm.Edm;
-import org.apache.olingo.server.api.edmx.EdmxReference;
-import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
-
-import java.util.List;
-
-/**
- * Metadata of an OData service like the Entity Data Model.
- */
-public interface ServiceMetadata {
- /**
- *
- * @return entity data model of this service
- */
- Edm getEdm();
-
- /**
- *
- * @return data service version of this service
- */
- ODataServiceVersion getDataServiceVersion();
-
- /**
- *
- * @return list of defined emdx references of this service
- */
- List<EdmxReference> getReferences();
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/batch/BatchFacade.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/batch/BatchFacade.java
deleted file mode 100644
index 64d6a51..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/batch/BatchFacade.java
+++ /dev/null
@@ -1,67 +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.api.batch;
-
-import org.apache.olingo.server.api.ODataRequest;
-import org.apache.olingo.server.api.ODataResponse;
-import org.apache.olingo.server.api.batch.exception.BatchDeserializerException;
-import org.apache.olingo.server.api.deserializer.batch.BatchRequestPart;
-import org.apache.olingo.server.api.deserializer.batch.ODataResponsePart;
-import org.apache.olingo.server.api.processor.BatchProcessor;
-
-/**
- * Provides methods to process {@link ODataRequest} and {@link BatchRequestPart}.
- *
- * Within a {@link BatchProcessor} implementation BatchRequestsParts should be passed to
- * {@link BatchFacade#handleBatchRequest(BatchRequestPart)}. If only if the BatchRequests part represents
- * a change set, the request will be delegated to
- * {@link org.apache.olingo.server.api.processor.BatchProcessor#processChangeSet(BatchFacade, java.util.List)}.
- * Otherwise the requests will be directly executed.
- *
- * The processor implementation could use {@link BatchFacade#handleODataRequest(ODataRequest)} to processes
- * requests in a change set.
- */
-public interface BatchFacade {
- /**
- * Executes a ODataRequest, which must be a part of a change set.
- * Each requests must have a Content-Id header field, which holds an id that is unique in the whole batch request.
- *
- * @param request ODataRequest to process
- * @return Corresponding ODataResult to the given request
- * @throws BatchDeserializerException
- */
- public ODataResponse handleODataRequest(ODataRequest request) throws BatchDeserializerException;
-
- /**
- * Handles a BatchRequestPart.
- *
- * @param request Request to process
- * @return Corresponding {@link ODataResponsePart}
- * @throws BatchDeserializerException
- */
- public ODataResponsePart handleBatchRequest(BatchRequestPart request) throws BatchDeserializerException;
-
- /**
- * Extracts the boundary of a multipart/mixed header.
- * See RFC 2046#5.1
- *
- * @param contentType Content Type
- * @return Boundary
- */
- public String extractBoundaryFromContentType(String contentType) throws BatchDeserializerException;
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/batch/exception/BatchDeserializerException.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/batch/exception/BatchDeserializerException.java
deleted file mode 100644
index eeb11d6..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/batch/exception/BatchDeserializerException.java
+++ /dev/null
@@ -1,65 +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.api.batch.exception;
-
-import org.apache.olingo.server.api.deserializer.DeserializerException;
-
-public class BatchDeserializerException extends DeserializerException {
- public static enum MessageKeys implements MessageKey {
- INVALID_BOUNDARY,
- INVALID_CHANGESET_METHOD,
- INVALID_CONTENT,
- INVALID_CONTENT_LENGTH,
- INVALID_CONTENT_TRANSFER_ENCODING,
- INVALID_CONTENT_TYPE,
- INVALID_HEADER,
- INVALID_HTTP_VERSION,
- INVALID_METHOD,
- INVALID_QUERY_OPERATION_METHOD,
- INVALID_STATUS_LINE,
- INVALID_URI,
- MISSING_BLANK_LINE,
- MISSING_BOUNDARY_DELIMITER,
- MISSING_CLOSE_DELIMITER,
- MISSING_CONTENT_ID,
- MISSING_CONTENT_TRANSFER_ENCODING,
- MISSING_CONTENT_TYPE,
- MISSING_MANDATORY_HEADER,
- FORBIDDEN_HEADER,
- INVALID_BASE_URI;
-
- @Override
- public String getKey() {
- return name();
- }
- }
-
- private static final long serialVersionUID = -907752788975531134L;
-
- public BatchDeserializerException(final String developmentMessage, final MessageKey messageKey,
- final int lineNumber) {
- this(developmentMessage, messageKey, "" + lineNumber);
- }
-
- public BatchDeserializerException(final String developmentMessage, final MessageKey messageKey,
- final String... parameters) {
- super(developmentMessage, messageKey, parameters);
- }
-
-}
\ No newline at end of file
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/batch/exception/BatchSerializerException.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/batch/exception/BatchSerializerException.java
deleted file mode 100644
index 03b1f14..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/batch/exception/BatchSerializerException.java
+++ /dev/null
@@ -1,46 +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.api.batch.exception;
-
-import org.apache.olingo.server.api.serializer.SerializerException;
-
-public class BatchSerializerException extends SerializerException {
-
- private static final long serialVersionUID = 2634433974342796905L;
-
- public static enum MessageKeys implements MessageKey {
- MISSING_CONTENT_ID;
-
- @Override
- public String getKey() {
- return name();
- }
- }
-
- public BatchSerializerException(final String developmentMessage, final MessageKey messageKey,
- final String... parameters) {
- super(developmentMessage, messageKey, parameters);
- }
-
- @Override
- protected String getBundleName() {
- return DEFAULT_SERVER_BUNDLE_NAME;
- }
-
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/DeserializerException.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/DeserializerException.java
deleted file mode 100644
index 0278a82..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/DeserializerException.java
+++ /dev/null
@@ -1,83 +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.api.deserializer;
-
-import org.apache.olingo.server.api.ODataTranslatedException;
-
-/** Exception thrown by deserializers. */
-public class DeserializerException extends ODataTranslatedException {
-
- private static final long serialVersionUID = 6341270437497060906L;
-
- /** Keys for exception texts in the resource bundle. */
- public static enum MessageKeys implements MessageKey {
- NOT_IMPLEMENTED,
- IO_EXCEPTION,
- //TODO: create texts for the following message keys:
- /** parameter: format */ UNSUPPORTED_FORMAT,
- JSON_SYNTAX_EXCEPTION,
- /** parameter: propertyName */ INVALID_NULL_PROPERTY,
- /** parameter: keyName */ UNKOWN_CONTENT,
- /** parameter: propertyName */ INVALID_VALUE_FOR_PROPERTY,
- /** parameter: propertyName */ INVALID_JSON_TYPE_FOR_PROPERTY,
- VALUE_ARRAY_NOT_PRESENT,
- VALUE_TAG_MUST_BE_AN_ARRAY,
- INVALID_ENTITY,
- /** parameter: navigationPropertyName */INVALID_VALUE_FOR_NAVIGATION_PROPERTY,
- DUPLICATE_PROPERTY,
- DUPLICATE_JSON_PROPERTY,
- /** parameters: primitiveTypeName, propertyName */ UNKNOWN_PRIMITIVE_TYPE,
- /** parameter: navigationPropertyName */NAVIGATION_PROPERTY_NOT_FOUND,
- /** parameter: annotationName */INVALID_ANNOTATION_TYPE,
- /** parameter: annotationName */INVALID_NULL_ANNOTATION;
-
- @Override
- public String getKey() {
- return name();
- }
- }
-
- /**
- * Creates deserializer exception.
- * @param developmentMessage message text as fallback and for debugging purposes
- * @param messageKey one of the {@link MessageKeys} for the exception text in the resource bundle
- * @param parameters parameters for the exception text
- */
- public DeserializerException(final String developmentMessage,
- final MessageKey messageKey, final String... parameters) {
- super(developmentMessage, messageKey, parameters);
- }
-
- /**
- * Creates deserializer exception.
- * @param developmentMessage message text as fallback and for debugging purposes
- * @param cause the cause of this exception
- * @param messageKey one of the {@link MessageKeys} for the exception text in the resource bundle
- * @param parameters parameters for the exception text
- */
- public DeserializerException(final String developmentMessage, final Throwable cause,
- final MessageKey messageKey, final String... parameters) {
- super(developmentMessage, cause, messageKey, parameters);
- }
-
- @Override
- protected String getBundleName() {
- return DEFAULT_SERVER_BUNDLE_NAME;
- }
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/FixedFormatDeserializer.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/FixedFormatDeserializer.java
deleted file mode 100644
index 0182d6d..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/FixedFormatDeserializer.java
+++ /dev/null
@@ -1,39 +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.api.deserializer;
-
-import java.io.InputStream;
-import java.util.List;
-
-import org.apache.olingo.server.api.batch.exception.BatchDeserializerException;
-import org.apache.olingo.server.api.deserializer.batch.BatchOptions;
-import org.apache.olingo.server.api.deserializer.batch.BatchRequestPart;
-
-public interface FixedFormatDeserializer {
-
- /**
- * Reads binary data from an InputStream.
- * @param content the binary data as input stream
- * @return the binary data
- */
- byte[] binary(InputStream content) throws DeserializerException;
-
- public List<BatchRequestPart> parseBatchRequest(InputStream content, String boundary, BatchOptions options)
- throws BatchDeserializerException;
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/ODataDeserializer.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/ODataDeserializer.java
deleted file mode 100644
index 46567ae..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/ODataDeserializer.java
+++ /dev/null
@@ -1,53 +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.api.deserializer;
-
-import java.io.InputStream;
-
-import org.apache.olingo.commons.api.data.Entity;
-import org.apache.olingo.commons.api.data.EntitySet;
-import org.apache.olingo.commons.api.edm.EdmEntityType;
-
-/**
- * Deserializer on OData server side.
- */
-public interface ODataDeserializer {
-
- /**
- * Deserializes an entity stream into an {@link Entity} object.
- * Validates: property types, no double properties, correct json types
- * @param stream
- * @param edmEntityType
- * @return deserialized {@link Entity} object
- * @throws DeserializerException
- */
- Entity entity(InputStream stream, EdmEntityType edmEntityType) throws DeserializerException;
-
- /**
- * Deserializes an entity collection stream into an {@link EntitySet} object.
- * @param stream
- * @param edmEntityType
- * @return deserialized {@link EntitySet} object
- * @throws DeserializerException
- */
- EntitySet entityCollection(InputStream stream, EdmEntityType edmEntityType) throws DeserializerException;
-
-
-
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/batch/BatchOptions.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/batch/BatchOptions.java
deleted file mode 100644
index e01d810..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/batch/BatchOptions.java
+++ /dev/null
@@ -1,114 +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.api.deserializer.batch;
-
-import java.io.InputStream;
-
-import org.apache.olingo.server.api.ODataRequest;
-import org.apache.olingo.server.api.deserializer.FixedFormatDeserializer;
-
-/**
- * Options for the batch deserializer.
- * See {@link FixedFormatDeserializer#parseBatchRequest(InputStream, String, BatchOptions)}
- */
-public class BatchOptions {
- private boolean isStrict = true;
- private String rawBaseUri = "";
- private String rawServiceResolutionUri = "";
-
- private BatchOptions() { }
-
- /**
- * Returns if the batch parsing is strict.
- * Default is true
- *
- * @return true if parsing is strict
- */
- public boolean isStrict() {
- return isStrict;
- }
-
- /**
- * See {@link ODataRequest#getRawBaseUri()}
- */
- public String getRawBaseUri() {
- return rawBaseUri;
- }
-
- /**
- * See {@link ODataRequest#getRawServiceResolutionUri()}
- */
- public String getRawServiceResolutionUri() {
- return rawServiceResolutionUri;
- }
-
- /**
- * Creates a new BatchOptions builder
- *
- * @return new BatchOptions builder instance
- */
- public static Builder with() {
- return new Builder();
- }
-
- /**
- * BatchOptions builder
- */
- public static class Builder {
- private BatchOptions options;
-
- /** Initializes the options builder. */
- public Builder() {
- options = new BatchOptions();
- }
-
- /**
- * See {@link BatchOptions#isStrict()}
- */
- public Builder isStrict(boolean isStrict) {
- options.isStrict = isStrict;
- return this;
- }
-
- /**
- * See {@link ODataRequest#getRawBaseUri()}
- */
- public Builder rawBaseUri(String baseUri) {
- options.rawBaseUri = baseUri;
- return this;
- }
-
- /**
- * See {@link ODataRequest#getRawServiceResolutionUri()}
- */
- public Builder rawServiceResolutionUri(String serviceResolutionUri) {
- options.rawServiceResolutionUri = serviceResolutionUri;
- return this;
- }
-
- /**
- * Creates a new BatchOptions instance
- *
- * @return new BatchOptions instance
- */
- public BatchOptions build() {
- return options;
- }
- }
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/batch/BatchRequestPart.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/batch/BatchRequestPart.java
deleted file mode 100644
index 01c8330..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/batch/BatchRequestPart.java
+++ /dev/null
@@ -1,73 +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.api.deserializer.batch;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import org.apache.olingo.server.api.ODataRequest;
-
-/**
- * A BatchPart
- * <p> BatchPart represents a distinct MIME part of a Batch Request body. It can be a ChangeSet or a Query Operation
- */
-public class BatchRequestPart {
- private List<ODataRequest> requests = new ArrayList<ODataRequest>();
- private boolean isChangeSet;
-
- /**
- * Creates a new instance of BachRequestPart
- *
- * @param isChangeSet True, if this instance represents a change set
- * @param requests A list of {@link ODataRequest}
- */
- public BatchRequestPart(final boolean isChangeSet, final List<ODataRequest> requests) {
- this.isChangeSet = isChangeSet;
- this.requests = requests;
- }
-
- /**
- * Creates a new instance of BachRequestPart
- *
- * @param isChangeSet True, if this instance represents a change set
- * @param request A single {@link ODataRequest}
- */
- public BatchRequestPart(final boolean isChangeSet, final ODataRequest request) {
- this.isChangeSet = isChangeSet;
- this.requests = new ArrayList<ODataRequest>();
- this.requests.add(request);
- }
-
- /**
- * Get the info if a BatchPart is a ChangeSet
- * @return true or false
- */
- public boolean isChangeSet() {
- return isChangeSet;
- }
-
- /**
- * Get requests. If a BatchPart is a Query Operation, the list contains one request.
- * @return a list of {@link ODataRequest}
- */
- public List<ODataRequest> getRequests() {
- return Collections.unmodifiableList(requests);
- }
-}
\ No newline at end of file
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/batch/ODataResponsePart.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/batch/ODataResponsePart.java
deleted file mode 100644
index 405deab..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/deserializer/batch/ODataResponsePart.java
+++ /dev/null
@@ -1,85 +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.api.deserializer.batch;
-
-import java.util.Arrays;
-import java.util.List;
-
-import org.apache.olingo.server.api.ODataResponse;
-
-/**
- * An ODataResponsePart represents a collections of ODataResponses.
- * A list of ODataResponseParts can be combined by the BatchSerializer to a single
- * OData batch response.
- */
-public class ODataResponsePart {
- private List<ODataResponse> responses;
- private boolean isChangeSet;
-
- /**
- * Creates a new ODataResponsePart.
- *
- * An ODataResponsePart represents a collections of ODataResponses.
- * A list of ODataResponseParts can be combined by the BatchSerializer to a single
- * OData batch response.
- *
- * @param responses A list of {@link ODataResponse}
- * @param isChangeSet True this ODataResponsePart represents a change set, otherwise false
- */
- public ODataResponsePart(List<ODataResponse> responses, boolean isChangeSet) {
- this.responses = responses;
- this.isChangeSet = isChangeSet;
- }
-
- /**
- * Creates a new ODataResponsePart.
- *
- * An ODataResponsePart represents a collections of ODataResponses.
- * A list of ODataResponseParts can be combined by the BatchSerializer to a single
- * OData batch response.
- *
- * @param response A single {@link ODataResponse}
- * @param isChangeSet True this ODataResponsePart represents a change set, otherwise false
- */
- public ODataResponsePart(ODataResponse response, boolean isChangeSet) {
- this.responses = Arrays.asList(response);
- this.isChangeSet = isChangeSet;
- }
-
- /**
- * Returns true if the current instance represents a change set.
- *
- * @return true or false
- */
- public List<ODataResponse> getResponses() {
- return responses;
- }
-
- /**
- * Returns a collection of ODataResponses.
- * Each collections contains at least one {@link ODataResponse}.
- *
- * If this instance represents a change set, there are may many ODataResponses
- *
- * @return a list of {@link ODataResponse}
- */
- public boolean isChangeSet() {
- return isChangeSet;
- }
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/edm/provider/Action.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/edm/provider/Action.java
deleted file mode 100644
index c33d139..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/edm/provider/Action.java
+++ /dev/null
@@ -1,54 +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.api.edm.provider;
-
-import java.util.List;
-
-public class Action extends Operation {
-
- @Override
- public Action setName(final String name) {
- this.name = name;
- return this;
- }
-
- @Override
- public Action setBound(final boolean isBound) {
- this.isBound = isBound;
- return this;
- }
-
- @Override
- public Action setEntitySetPath(final EntitySetPath entitySetPath) {
- this.entitySetPath = entitySetPath;
- return this;
- }
-
- @Override
- public Action setParameters(final List<Parameter> parameters) {
- this.parameters = parameters;
- return this;
- }
-
- @Override
- public Action setReturnType(final ReturnType returnType) {
- this.returnType = returnType;
- return this;
- }
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/edm/provider/ActionImport.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/edm/provider/ActionImport.java
deleted file mode 100644
index 5086818..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/edm/provider/ActionImport.java
+++ /dev/null
@@ -1,48 +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.api.edm.provider;
-
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.api.edm.Target;
-
-public class ActionImport extends OperationImport {
-
- private FullQualifiedName action;
-
- @Override
- public ActionImport setName(final String name) {
- this.name = name;
- return this;
- }
-
- @Override
- public ActionImport setEntitySet(final Target entitySet) {
- this.entitySet = entitySet;
- return this;
- }
-
- public FullQualifiedName getAction() {
- return action;
- }
-
- public ActionImport setAction(final FullQualifiedName action) {
- this.action = action;
- return this;
- }
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/edm/provider/AliasInfo.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/edm/provider/AliasInfo.java
deleted file mode 100644
index 9cff2c8..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/edm/provider/AliasInfo.java
+++ /dev/null
@@ -1,45 +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.api.edm.provider;
-
-public class AliasInfo {
-
- private String namespace;
-
- private String alias;
-
- public String getNamespace() {
- return namespace;
- }
-
- public AliasInfo setNamespace(final String namespace) {
- this.namespace = namespace;
- return this;
- }
-
- public String getAlias() {
- return alias;
- }
-
- public AliasInfo setAlias(final String alias) {
- this.alias = alias;
- return this;
- }
-
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/edm/provider/Annotation.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/edm/provider/Annotation.java
deleted file mode 100644
index a4a4937..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/edm/provider/Annotation.java
+++ /dev/null
@@ -1,72 +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.api.edm.provider;
-
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-
-import java.util.List;
-
-public class Annotation {
-
- private FullQualifiedName term;
-
- // Target should be a target path
-// private String targetPath;
- private String qualifier;
-
- private Expression expression;
-
- private List<Annotation> annotation;
-
- public FullQualifiedName getTerm() {
- return term;
- }
-
- public Annotation setTerm(final FullQualifiedName term) {
- this.term = term;
- return this;
- }
-
- public String getQualifier() {
- return qualifier;
- }
-
- public Annotation setQualifier(final String qualifier) {
- this.qualifier = qualifier;
- return this;
- }
-
- public Expression getExpression() {
- return expression;
- }
-
- public Annotation setExpression(final Expression expression) {
- this.expression = expression;
- return this;
- }
-
- public List<Annotation> getAnnotation() {
- return annotation;
- }
-
- public Annotation setAnnotation(final List<Annotation> annotation) {
- this.annotation = annotation;
- return this;
- }
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/edm/provider/BindingTarget.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/edm/provider/BindingTarget.java
deleted file mode 100644
index 1ca52ff..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/edm/provider/BindingTarget.java
+++ /dev/null
@@ -1,60 +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.api.edm.provider;
-
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-
-import java.util.List;
-
-public abstract class BindingTarget {
-
- protected String name;
-
- protected FullQualifiedName type;
-
- protected List<NavigationPropertyBinding> navigationPropertyBindings;
-
- public String getName() {
- return name;
- }
-
- public BindingTarget setName(final String name) {
- this.name = name;
- return this;
- }
-
- public FullQualifiedName getType() {
- return type;
- }
-
- public BindingTarget setType(final FullQualifiedName type) {
- this.type = type;
- return this;
- }
-
- public List<NavigationPropertyBinding> getNavigationPropertyBindings() {
- return navigationPropertyBindings;
- }
-
- public BindingTarget setNavigationPropertyBindings(final List<NavigationPropertyBinding> navigationPropertyBindings) {
- this.navigationPropertyBindings = navigationPropertyBindings;
- return this;
- }
-
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/edm/provider/ComplexType.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/edm/provider/ComplexType.java
deleted file mode 100644
index 9ef47ca..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/edm/provider/ComplexType.java
+++ /dev/null
@@ -1,62 +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.api.edm.provider;
-
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-
-import java.util.List;
-
-public class ComplexType extends StructuredType {
-
- @Override
- public ComplexType setName(final String name) {
- this.name = name;
- return this;
- }
-
- @Override
- public ComplexType setOpenType(final boolean isOpenType) {
- this.isOpenType = isOpenType;
- return this;
- }
-
- @Override
- public ComplexType setBaseType(final FullQualifiedName baseType) {
- this.baseType = baseType;
- return this;
- }
-
- @Override
- public ComplexType setAbstract(final boolean isAbstract) {
- this.isAbstract = isAbstract;
- return this;
- }
-
- @Override
- public ComplexType setProperties(final List<Property> properties) {
- this.properties = properties;
- return this;
- }
-
- @Override
- public ComplexType setNavigationProperties(final List<NavigationProperty> navigationProperties) {
- this.navigationProperties = navigationProperties;
- return this;
- }
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/edm/provider/EdmProvider.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/edm/provider/EdmProvider.java
deleted file mode 100644
index 9058e6b..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/edm/provider/EdmProvider.java
+++ /dev/null
@@ -1,195 +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.api.edm.provider;
-
-import org.apache.olingo.commons.api.ODataException;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-
-import java.util.List;
-
-public abstract class EdmProvider {
-
- /**
- * This method should return an {@link EnumType} or <b>null</b> if nothing is found
- *
- * @param enumTypeName
- * @return {@link EnumType} for given name
- * @throws ODataException
- */
- public EnumType getEnumType(final FullQualifiedName enumTypeName) throws ODataException {
- return null;
- }
-
- /**
- * This method should return an {@link TypeDefinition} or <b>null</b> if nothing is found
- *
- * @param typeDefinitionName
- * @return {@link TypeDefinition} for given name
- * @throws ODataException
- */
- public TypeDefinition getTypeDefinition(final FullQualifiedName typeDefinitionName) throws ODataException {
- return null;
- }
-
- /**
- * This method should return an {@link EntityType} or <b>null</b> if nothing is found
- *
- * @param entityTypeName
- * @return {@link EntityType} for the given name
- * @throws ODataException
- */
- public EntityType getEntityType(final FullQualifiedName entityTypeName) throws ODataException {
- return null;
- }
-
- /**
- * This method should return a {@link ComplexType} or <b>null</b> if nothing is found.
- *
- * @param complexTypeName
- * @return {@link ComplexType} for the given name
- * @throws ODataException
- */
- public ComplexType getComplexType(final FullQualifiedName complexTypeName) throws ODataException {
- return null;
- }
-
- /**
- * This method should return a list of all {@link Action} for the FullQualifiedname or <b>null</b> if nothing is found
- *
- * @param actionName
- * @return List of {@link Action} or null
- * @throws ODataException
- */
- public List<Action> getActions(final FullQualifiedName actionName) throws ODataException {
- return null;
- }
-
- /**
- * This method should return a list of all {@link Function} for the FullQualifiedname or <b>null</b> if nothing is
- * found
- *
- * @param functionName
- * @return List of {@link Function} or null
- * @throws ODataException
- */
- public List<Function> getFunctions(final FullQualifiedName functionName) throws ODataException {
- return null;
- }
-
- /**
- * This method should return a {@link Term} for the FullQualifiedName or <b>null</b> if nothing is found.
- * @param termName the name of the Term
- * @return {@link Term} or null
- * @throws ODataException
- */
- public Term getTerm(final FullQualifiedName termName) throws ODataException {
- return null;
- }
-
- /**
- * This method should return an {@link EntitySet} or <b>null</b> if nothing is found
- *
- * @param entityContainer this EntitySet is contained in
- * @param entitySetName
- * @return {@link EntitySet} for the given container and entityset name
- * @throws ODataException
- */
- public EntitySet getEntitySet(final FullQualifiedName entityContainer, final String entitySetName)
- throws ODataException {
- return null;
- }
-
- /**
- * This method should return an {@link Singleton} or <b>null</b> if nothing is found
- *
- * @param entityContainer this Singleton is contained in
- * @param singletonName
- * @return {@link Singleton} for given container and singleton name
- * @throws ODataException
- */
- public Singleton getSingleton(final FullQualifiedName entityContainer, final String singletonName)
- throws ODataException {
- return null;
- }
-
- /**
- * This method should return an {@link ActionImport} or <b>null</b> if nothing is found
- *
- * @param entityContainer this ActionImport is contained in
- * @param actionImportName
- * @return {@link ActionImport} for the given container and ActionImport name
- * @throws ODataException
- */
- public ActionImport getActionImport(final FullQualifiedName entityContainer, final String actionImportName)
- throws ODataException {
- return null;
- }
-
- /**
- * This method should return a {@link FunctionImport} or <b>null</b> if nothing is found
- *
- * @param entityContainer this FunctionImport is contained in
- * @param functionImportName
- * @return {@link FunctionImport} for the given container name and function import name
- * @throws ODataException
- */
- public FunctionImport getFunctionImport(final FullQualifiedName entityContainer, final String functionImportName)
- throws ODataException {
- return null;
- }
-
- /**
- * This method should return an {@link EntityContainerInfo} or <b>null</b> if nothing is found
- *
- * @param entityContainerName (null for default container)
- * @return {@link EntityContainerInfo} for the given name
- * @throws ODataException
- */
- public EntityContainerInfo getEntityContainerInfo(final FullQualifiedName entityContainerName) throws ODataException {
- return null;
- }
-
- /**
- * This method should return a list of all namespaces which have an alias
- *
- * @return List of alias info
- * @throws ODataException
- */
- public List<AliasInfo> getAliasInfos() throws ODataException {
- return null;
- }
-
- /**
- * This method should return a collection of all {@link Schema}
- *
- * @return List<{@link Schema}>
- * @throws ODataException
- */
- public List<Schema> getSchemas() throws ODataException {
- return null;
- }
-
- /**
- * Returns the entity container of this edm
- * @return {@link EntityContainer} of this edm
- */
- public EntityContainer getEntityContainer() throws ODataException {
- return null;
- }
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/edm/provider/EntityContainer.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/edm/provider/EntityContainer.java
deleted file mode 100644
index 3b993e1..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/edm/provider/EntityContainer.java
+++ /dev/null
@@ -1,93 +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.api.edm.provider;
-
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-
-import java.util.List;
-
-public class EntityContainer {
-
- private String name;
-
- private FullQualifiedName extendsContainer;
-
- private List<EntitySet> entitySets;
-
- private List<ActionImport> actionImports;
-
- private List<FunctionImport> functionImports;
-
- private List<Singleton> singletons;
-
- // Annotations
- public String getName() {
- return name;
- }
-
- public EntityContainer setName(final String name) {
- this.name = name;
- return this;
- }
-
- public FullQualifiedName getExtendsContainer() {
- return extendsContainer;
- }
-
- public EntityContainer setExtendsContainer(final FullQualifiedName extendsContainer) {
- this.extendsContainer = extendsContainer;
- return this;
- }
-
- public List<EntitySet> getEntitySets() {
- return entitySets;
- }
-
- public EntityContainer setEntitySets(final List<EntitySet> entitySets) {
- this.entitySets = entitySets;
- return this;
- }
-
- public List<ActionImport> getActionImports() {
- return actionImports;
- }
-
- public EntityContainer setActionImports(final List<ActionImport> actionImports) {
- this.actionImports = actionImports;
- return this;
- }
-
- public List<FunctionImport> getFunctionImports() {
- return functionImports;
- }
-
- public EntityContainer setFunctionImports(final List<FunctionImport> functionImports) {
- this.functionImports = functionImports;
- return this;
- }
-
- public List<Singleton> getSingletons() {
- return singletons;
- }
-
- public EntityContainer setSingletons(final List<Singleton> singletons) {
- this.singletons = singletons;
- return this;
- }
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/edm/provider/EntityContainerInfo.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/edm/provider/EntityContainerInfo.java
deleted file mode 100644
index 806d71a..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/edm/provider/EntityContainerInfo.java
+++ /dev/null
@@ -1,47 +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.api.edm.provider;
-
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-
-public class EntityContainerInfo {
-
- private FullQualifiedName containerName;
-
- private FullQualifiedName extendsContainer;
-
- public FullQualifiedName getContainerName() {
- return containerName;
- }
-
- public EntityContainerInfo setContainerName(final FullQualifiedName containerName) {
- this.containerName = containerName;
- return this;
- }
-
- public FullQualifiedName getExtendsContainer() {
- return extendsContainer;
- }
-
- public EntityContainerInfo setExtendsContainer(final FullQualifiedName extendsContainer) {
- this.extendsContainer = extendsContainer;
- return this;
- }
-
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/edm/provider/EntitySet.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/edm/provider/EntitySet.java
deleted file mode 100644
index 361d15a..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/edm/provider/EntitySet.java
+++ /dev/null
@@ -1,55 +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.api.edm.provider;
-
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-
-import java.util.List;
-
-public class EntitySet extends BindingTarget {
-
- private boolean includeInServiceDocument = true;
-
- @Override
- public EntitySet setName(final String name) {
- this.name = name;
- return this;
- }
-
- @Override
- public EntitySet setNavigationPropertyBindings(final List<NavigationPropertyBinding> navigationPropertyBindings) {
- this.navigationPropertyBindings = navigationPropertyBindings;
- return this;
- }
-
- @Override
- public EntitySet setType(final FullQualifiedName entityType) {
- type = entityType;
- return this;
- }
-
- public boolean isIncludeInServiceDocument() {
- return includeInServiceDocument;
- }
-
- public EntitySet setIncludeInServiceDocument(final boolean includeInServiceDocument) {
- this.includeInServiceDocument = includeInServiceDocument;
- return this;
- }
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/edm/provider/EntitySetPath.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/edm/provider/EntitySetPath.java
deleted file mode 100644
index ec36783..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/edm/provider/EntitySetPath.java
+++ /dev/null
@@ -1,45 +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.api.edm.provider;
-
-//TODO: Do we really need this class?
-public class EntitySetPath {
-
- private String bindingParameter;
-
- private String path;
-
- public String getBindingParameter() {
- return bindingParameter;
- }
-
- public EntitySetPath setBindingParameter(final String bindingParameter) {
- this.bindingParameter = bindingParameter;
- return this;
- }
-
- public String getPath() {
- return path;
- }
-
- public EntitySetPath setPath(final String path) {
- this.path = path;
- return this;
- }
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/edm/provider/EntityType.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/edm/provider/EntityType.java
deleted file mode 100644
index 3f3db5b..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/edm/provider/EntityType.java
+++ /dev/null
@@ -1,84 +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.api.edm.provider;
-
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-
-import java.util.List;
-
-public class EntityType extends StructuredType {
-
- private List<PropertyRef> key;
-
- private boolean hasStream;
-
- public boolean hasStream() {
- return hasStream;
- }
-
- public EntityType setHasStream(final boolean hasStream) {
- this.hasStream = hasStream;
- return this;
- }
-
- public List<PropertyRef> getKey() {
- return key;
- }
-
- public EntityType setKey(final List<PropertyRef> key) {
- this.key = key;
- return this;
- }
-
- @Override
- public EntityType setName(final String name) {
- this.name = name;
- return this;
- }
-
- @Override
- public EntityType setOpenType(final boolean isOpenType) {
- this.isOpenType = isOpenType;
- return this;
- }
-
- @Override
- public EntityType setBaseType(final FullQualifiedName baseType) {
- this.baseType = baseType;
- return this;
- }
-
- @Override
- public EntityType setAbstract(final boolean isAbstract) {
- this.isAbstract = isAbstract;
- return this;
- }
-
- @Override
- public EntityType setProperties(final List<Property> properties) {
- this.properties = properties;
- return this;
- }
-
- @Override
- public EntityType setNavigationProperties(final List<NavigationProperty> navigationProperties) {
- this.navigationProperties = navigationProperties;
- return this;
- }
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/edm/provider/EnumMember.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/edm/provider/EnumMember.java
deleted file mode 100644
index 6b83ab0..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/edm/provider/EnumMember.java
+++ /dev/null
@@ -1,44 +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.api.edm.provider;
-
-public class EnumMember {
-
- private String name;
-
- private String value;
-
- public String getName() {
- return name;
- }
-
- public EnumMember setName(final String name) {
- this.name = name;
- return this;
- }
-
- public String getValue() {
- return value;
- }
-
- public EnumMember setValue(final String value) {
- this.value = value;
- return this;
- }
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/edm/provider/EnumType.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/edm/provider/EnumType.java
deleted file mode 100644
index ee213e5..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/edm/provider/EnumType.java
+++ /dev/null
@@ -1,73 +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.api.edm.provider;
-
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-
-import java.util.List;
-
-public class EnumType {
-
- private String name;
-
- private boolean isFlags;
-
- // Underlying Type can only be primitve...
- private FullQualifiedName underlyingType;
-
- private List<EnumMember> members;
-
- // Facets
- // Annotations?
- public String getName() {
- return name;
- }
-
- public EnumType setName(final String name) {
- this.name = name;
- return this;
- }
-
- public boolean isFlags() {
- return isFlags;
- }
-
- public EnumType setFlags(final boolean isFlags) {
- this.isFlags = isFlags;
- return this;
- }
-
- public FullQualifiedName getUnderlyingType() {
- return underlyingType;
- }
-
- public EnumType setUnderlyingType(final FullQualifiedName underlyingType) {
- this.underlyingType = underlyingType;
- return this;
- }
-
- public List<EnumMember> getMembers() {
- return members;
- }
-
- public EnumType setMembers(final List<EnumMember> members) {
- this.members = members;
- return this;
- }
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/edm/provider/Expression.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/edm/provider/Expression.java
deleted file mode 100644
index 23b3eb4..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/edm/provider/Expression.java
+++ /dev/null
@@ -1,24 +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.api.edm.provider;
-
-//TODO: Expression implementation
-public class Expression {
-
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/edm/provider/Function.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/edm/provider/Function.java
deleted file mode 100644
index 18f24b2..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/edm/provider/Function.java
+++ /dev/null
@@ -1,65 +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.api.edm.provider;
-
-import java.util.List;
-
-public class Function extends Operation {
-
- private boolean isComposable;
-
- public boolean isComposable() {
- return isComposable;
- }
-
- public Function setComposable(final boolean isComposable) {
- this.isComposable = isComposable;
- return this;
- }
-
- @Override
- public Function setName(final String name) {
- this.name = name;
- return this;
- }
-
- @Override
- public Function setBound(final boolean isBound) {
- this.isBound = isBound;
- return this;
- }
-
- @Override
- public Function setEntitySetPath(final EntitySetPath entitySetPath) {
- this.entitySetPath = entitySetPath;
- return this;
- }
-
- @Override
- public Function setParameters(final List<Parameter> parameters) {
- this.parameters = parameters;
- return this;
- }
-
- @Override
- public Function setReturnType(final ReturnType returnType) {
- this.returnType = returnType;
- return this;
- }
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/edm/provider/FunctionImport.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/edm/provider/FunctionImport.java
deleted file mode 100644
index a180d5b..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/edm/provider/FunctionImport.java
+++ /dev/null
@@ -1,64 +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.api.edm.provider;
-
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.api.edm.Target;
-
-public class FunctionImport extends OperationImport {
-
- private FullQualifiedName function;
-
- private boolean includeInServiceDocument;
-
- @Override
- public String getName() {
- return name;
- }
-
- @Override
- public FunctionImport setName(final String name) {
- this.name = name;
- return this;
- }
-
- @Override
- public FunctionImport setEntitySet(final Target entitySet) {
- this.entitySet = entitySet;
- return this;
- }
-
- public FullQualifiedName getFunction() {
- return function;
- }
-
- public FunctionImport setFunction(final FullQualifiedName function) {
- this.function = function;
- return this;
- }
-
- public boolean isIncludeInServiceDocument() {
- return includeInServiceDocument;
- }
-
- public FunctionImport setIncludeInServiceDocument(final boolean includeInServiceDocument) {
- this.includeInServiceDocument = includeInServiceDocument;
- return this;
- }
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/edm/provider/Mapping.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/edm/provider/Mapping.java
deleted file mode 100644
index 82a935a..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/edm/provider/Mapping.java
+++ /dev/null
@@ -1,96 +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.api.edm.provider;
-
-import org.apache.olingo.commons.api.edm.EdmMapping;
-
-public class Mapping implements EdmMapping {
-
- private String value;
-
- private Object object;
-
- private String mediaResourceSourceKey;
-
- private String mediaResourceMimeTypeKey;
-
- @Override
- public String getInternalName() {
- return value;
- }
-
- @Override
- public Object getObject() {
- return object;
- }
-
- @Override
- public String getMediaResourceSourceKey() {
- return mediaResourceSourceKey;
- }
-
- @Override
- public String getMediaResourceMimeTypeKey() {
- return mediaResourceMimeTypeKey;
- }
-
- /**
- * Sets the value for this {@link Mapping}.
- *
- * @param value
- * @return {@link Mapping} for method chaining
- */
- public Mapping setInternalName(final String value) {
- this.value = value;
- return this;
- }
-
- /**
- * Sets an object. This method can be used by a provider to set whatever it wants to associate with this.
- *
- * @param object
- * @return {@link Mapping} for method chaining
- */
- public Mapping setObject(final Object object) {
- this.object = object;
- return this;
- }
-
- /**
- * Sets the key for the resource source key which is used for the lookup in the data map
- *
- * @param mediaResourceSourceKey under which the source can be found in the data map
- * @return {@link Mapping} for method chaining
- */
- public Mapping setMediaResourceSourceKey(final String mediaResourceSourceKey) {
- this.mediaResourceSourceKey = mediaResourceSourceKey;
- return this;
- }
-
- /**
- * Sets the key for the resource mime type key which is used for the lookup in the data map
- *
- * @param mediaResourceMimeTypeKey under which the mime type can be found in the data map
- * @return {@link Mapping} for method chaining
- */
- public Mapping setMediaResourceMimeTypeKey(final String mediaResourceMimeTypeKey) {
- this.mediaResourceMimeTypeKey = mediaResourceMimeTypeKey;
- return this;
- }
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/edm/provider/NavigationProperty.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/edm/provider/NavigationProperty.java
deleted file mode 100644
index 73f43ff..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/edm/provider/NavigationProperty.java
+++ /dev/null
@@ -1,118 +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.api.edm.provider;
-
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.api.edm.constants.EdmOnDelete;
-
-import java.util.List;
-
-public class NavigationProperty {
-
- private String name;
-
- private FullQualifiedName type;
-
- private boolean isCollection;
-
- private String partner;
-
- private boolean containsTarget;
-
- private List<ReferentialConstraint> referentialConstraints;
-
- // Facets
- private Boolean nullable;
-
- // Refactor this onDelete
- private EdmOnDelete onDelete;
-
-//Annotations?
- public String getName() {
- return name;
- }
-
- public boolean isCollection() {
- return isCollection;
- }
-
- public NavigationProperty setCollection(final boolean isCollection) {
- this.isCollection = isCollection;
- return this;
- }
-
- public NavigationProperty setName(final String name) {
- this.name = name;
- return this;
- }
-
- public FullQualifiedName getType() {
- return type;
- }
-
- public NavigationProperty setType(final FullQualifiedName type) {
- this.type = type;
- return this;
- }
-
- public String getPartner() {
- return partner;
- }
-
- public NavigationProperty setPartner(final String partner) {
- this.partner = partner;
- return this;
- }
-
- public boolean isContainsTarget() {
- return containsTarget;
- }
-
- public NavigationProperty setContainsTarget(final boolean containsTarget) {
- this.containsTarget = containsTarget;
- return this;
- }
-
- public List<ReferentialConstraint> getReferentialConstraints() {
- return referentialConstraints;
- }
-
- public NavigationProperty setReferentialConstraints(final List<ReferentialConstraint> referentialConstraints) {
- this.referentialConstraints = referentialConstraints;
- return this;
- }
-
- public Boolean getNullable() {
- return nullable;
- }
-
- public NavigationProperty setNullable(final Boolean nullable) {
- this.nullable = nullable;
- return this;
- }
-
- public EdmOnDelete getOnDelete() {
- return onDelete;
- }
-
- public NavigationProperty setOnDelete(final EdmOnDelete onDelete) {
- this.onDelete = onDelete;
- return this;
- }
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/edm/provider/NavigationPropertyBinding.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/edm/provider/NavigationPropertyBinding.java
deleted file mode 100644
index c32decc..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/edm/provider/NavigationPropertyBinding.java
+++ /dev/null
@@ -1,46 +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.api.edm.provider;
-
-import org.apache.olingo.commons.api.edm.Target;
-
-public class NavigationPropertyBinding {
-
- private String path;
-
- private Target target;
-
- public String getPath() {
- return path;
- }
-
- public NavigationPropertyBinding setPath(final String path) {
- this.path = path;
- return this;
- }
-
- public Target getTarget() {
- return target;
- }
-
- public NavigationPropertyBinding setTarget(final Target target) {
- this.target = target;
- return this;
- }
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/edm/provider/Operation.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/edm/provider/Operation.java
deleted file mode 100644
index 0b522d3..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/edm/provider/Operation.java
+++ /dev/null
@@ -1,81 +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.api.edm.provider;
-
-import java.util.List;
-
-public abstract class Operation {
-
- protected String name;
-
- protected boolean isBound;
-
- // Do we need EntitySetPath as a class?
- protected EntitySetPath entitySetPath;
-
- protected List<Parameter> parameters;
-
- protected ReturnType returnType;
-
- // Annotations?
- public String getName() {
- return name;
- }
-
- public Operation setName(final String name) {
- this.name = name;
- return this;
- }
-
- public boolean isBound() {
- return isBound;
- }
-
- public Operation setBound(final boolean isBound) {
- this.isBound = isBound;
- return this;
- }
-
- public EntitySetPath getEntitySetPath() {
- return entitySetPath;
- }
-
- public Operation setEntitySetPath(final EntitySetPath entitySetPath) {
- this.entitySetPath = entitySetPath;
- return this;
- }
-
- public List<Parameter> getParameters() {
- return parameters;
- }
-
- public Operation setParameters(final List<Parameter> parameters) {
- this.parameters = parameters;
- return this;
- }
-
- public ReturnType getReturnType() {
- return returnType;
- }
-
- public Operation setReturnType(final ReturnType returnType) {
- this.returnType = returnType;
- return this;
- }
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/edm/provider/OperationImport.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/edm/provider/OperationImport.java
deleted file mode 100644
index cabe656..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/edm/provider/OperationImport.java
+++ /dev/null
@@ -1,47 +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.api.edm.provider;
-
-import org.apache.olingo.commons.api.edm.Target;
-
-public abstract class OperationImport {
-
- protected String name;
-
- protected Target entitySet;
-
- // Annotations?
- public String getName() {
- return name;
- }
-
- public OperationImport setName(final String name) {
- this.name = name;
- return this;
- }
-
- public Target getEntitySet() {
- return entitySet;
- }
-
- public OperationImport setEntitySet(final Target entitySet) {
- this.entitySet = entitySet;
- return this;
- }
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/edm/provider/Parameter.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/edm/provider/Parameter.java
deleted file mode 100644
index b9bb6a5..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/edm/provider/Parameter.java
+++ /dev/null
@@ -1,113 +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.api.edm.provider;
-
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-
-public class Parameter {
-
- private String name;
-
- private FullQualifiedName type;
-
- private boolean isCollection;
-
- private Mapping mapping;
-
- // Facets?
- private Boolean nullable;
-
- private Integer maxLength;
-
- private Integer precision;
-
- private Integer scale;
-
- public String getName() {
- return name;
- }
-
- public Parameter setName(final String name) {
- this.name = name;
- return this;
- }
-
- public FullQualifiedName getType() {
- return type;
- }
-
- public Parameter setType(final FullQualifiedName type) {
- this.type = type;
- return this;
- }
-
- public boolean isCollection() {
- return isCollection;
- }
-
- public Parameter setCollection(final boolean isCollection) {
- this.isCollection = isCollection;
- return this;
- }
-
- public Boolean getNullable() {
- return nullable;
- }
-
- public Parameter setNullable(final Boolean nullable) {
- this.nullable = nullable;
- return this;
- }
-
- public Integer getMaxLength() {
- return maxLength;
- }
-
- public Parameter setMaxLength(final Integer maxLength) {
- this.maxLength = maxLength;
- return this;
- }
-
- public Integer getPrecision() {
- return precision;
- }
-
- public Parameter setPrecision(final Integer precision) {
- this.precision = precision;
- return this;
- }
-
- public Integer getScale() {
- return scale;
- }
-
- public Parameter setScale(final Integer scale) {
- this.scale = scale;
- return this;
- }
-
- public Mapping getMapping() {
- return mapping;
- }
-
- public Parameter setMapping(final Mapping mapping) {
- this.mapping = mapping;
- return this;
- }
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/edm/provider/Property.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/edm/provider/Property.java
deleted file mode 100644
index d58cb6a..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/edm/provider/Property.java
+++ /dev/null
@@ -1,148 +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.api.edm.provider;
-
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-
-public class Property {
-
- private String name;
-
- // Can be simple or complex
- private FullQualifiedName type;
-
- private boolean collection;
-
- // TODO: Mimetype and mapping what here
- private String mimeType;
-
- private Mapping mapping;
-
- // Facets
- private String defaultValue;
-
- private Boolean nullable;
-
- private Integer maxLength;
-
- private Integer precision;
-
- private Integer scale;
-
- private Boolean unicode;
-
- public String getName() {
- return name;
- }
-
- public Property setName(final String name) {
- this.name = name;
- return this;
- }
-
- public FullQualifiedName getType() {
- return type;
- }
-
- public Property setType(final FullQualifiedName type) {
- this.type = type;
- return this;
- }
-
- public boolean isCollection() {
- return collection;
- }
-
- public Property setCollection(final boolean isCollection) {
- collection = isCollection;
- return this;
- }
-
- public String getDefaultValue() {
- return defaultValue;
- }
-
- public Property setDefaultValue(final String defaultValue) {
- this.defaultValue = defaultValue;
- return this;
- }
-
- public Boolean getNullable() {
- return nullable;
- }
-
- public Property setNullable(final Boolean nullable) {
- this.nullable = nullable;
- return this;
- }
-
- public Integer getMaxLength() {
- return maxLength;
- }
-
- public Property setMaxLength(final Integer maxLength) {
- this.maxLength = maxLength;
- return this;
- }
-
- public Integer getPrecision() {
- return precision;
- }
-
- public Property setPrecision(final Integer precision) {
- this.precision = precision;
- return this;
- }
-
- public Integer getScale() {
- return scale;
- }
-
- public Property setScale(final Integer scale) {
- this.scale = scale;
- return this;
- }
-
- public Boolean isUnicode() {
- return unicode;
- }
-
- public Property setUnicode(final Boolean isUnicode) {
- unicode = isUnicode;
- return this;
- }
-
- public String getMimeType() {
- return mimeType;
- }
-
- public Property setMimeType(final String mimeType) {
- this.mimeType = mimeType;
- return this;
- }
-
- public Mapping getMapping() {
- return mapping;
- }
-
- public Property setMapping(final Mapping mapping) {
- this.mapping = mapping;
- return this;
- }
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/edm/provider/PropertyRef.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/edm/provider/PropertyRef.java
deleted file mode 100644
index 3c08e20..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/edm/provider/PropertyRef.java
+++ /dev/null
@@ -1,55 +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.api.edm.provider;
-
-public class PropertyRef {
-
- private String propertyName;
-
- private String alias;
-
- private String path;
-
- public String getPath() {
- return path;
- }
-
- public PropertyRef setPath(final String path) {
- this.path = path;
- return this;
- }
-
- public String getPropertyName() {
- return propertyName;
- }
-
- public PropertyRef setPropertyName(final String name) {
- propertyName = name;
- return this;
- }
-
- public String getAlias() {
- return alias;
- }
-
- public PropertyRef setAlias(final String alias) {
- this.alias = alias;
- return this;
- }
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/edm/provider/ReferentialConstraint.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/edm/provider/ReferentialConstraint.java
deleted file mode 100644
index a834707..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/edm/provider/ReferentialConstraint.java
+++ /dev/null
@@ -1,46 +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.api.edm.provider;
-
-public class ReferentialConstraint {
-
- // TODO: check data type
- private String property;
-
- private String referencedProperty;
-
- // Annotations
- public String getProperty() {
- return property;
- }
-
- public ReferentialConstraint setProperty(final String property) {
- this.property = property;
- return this;
- }
-
- public String getReferencedProperty() {
- return referencedProperty;
- }
-
- public ReferentialConstraint setReferencedProperty(final String referencedProperty) {
- this.referencedProperty = referencedProperty;
- return this;
- }
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/edm/provider/ReturnType.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/edm/provider/ReturnType.java
deleted file mode 100644
index 0dd380d..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/edm/provider/ReturnType.java
+++ /dev/null
@@ -1,91 +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.api.edm.provider;
-
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-
-public class ReturnType {
-
- private FullQualifiedName type;
-
- private boolean isCollection;
-
- // facets
- private Boolean nullable;
-
- private Integer maxLength;
-
- private Integer precision;
-
- private Integer scale;
-
- public FullQualifiedName getType() {
- return type;
- }
-
- public ReturnType setType(final FullQualifiedName type) {
- this.type = type;
- return this;
- }
-
- public boolean isCollection() {
- return isCollection;
- }
-
- public ReturnType setCollection(final boolean isCollection) {
- this.isCollection = isCollection;
- return this;
- }
-
- public Boolean getNullable() {
- return nullable;
- }
-
- public ReturnType setNullable(final Boolean nullable) {
- this.nullable = nullable;
- return this;
- }
-
- public Integer getMaxLength() {
- return maxLength;
- }
-
- public ReturnType setMaxLength(final Integer maxLength) {
- this.maxLength = maxLength;
- return this;
- }
-
- public Integer getPrecision() {
- return precision;
- }
-
- public ReturnType setPrecision(final Integer precision) {
- this.precision = precision;
- return this;
- }
-
- public Integer getScale() {
- return scale;
- }
-
- public ReturnType setScale(final Integer scale) {
- this.scale = scale;
- return this;
- }
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/edm/provider/Schema.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/edm/provider/Schema.java
deleted file mode 100644
index 235a16e..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/edm/provider/Schema.java
+++ /dev/null
@@ -1,135 +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.api.edm.provider;
-
-import java.util.List;
-
-public class Schema {
-
- private String namespace;
-
- private String alias;
-
- private List<EnumType> enumTypes;
-
- private List<TypeDefinition> typeDefinitions;
-
- private List<EntityType> entityTypes;
-
- private List<ComplexType> complexTypes;
-
- private List<Action> actions;
-
- private List<Function> functions;
-
- private EntityContainer entityContainer;
-
- private List<Term> terms;
-
- // Annotations
- public String getNamespace() {
- return namespace;
- }
-
- public Schema setNamespace(final String namespace) {
- this.namespace = namespace;
- return this;
- }
-
- public String getAlias() {
- return alias;
- }
-
- public Schema setAlias(final String alias) {
- this.alias = alias;
- return this;
- }
-
- public List<EnumType> getEnumTypes() {
- return enumTypes;
- }
-
- public Schema setEnumTypes(final List<EnumType> enumTypes) {
- this.enumTypes = enumTypes;
- return this;
- }
-
- public List<TypeDefinition> getTypeDefinitions() {
- return typeDefinitions;
- }
-
- public Schema setTypeDefinitions(final List<TypeDefinition> typeDefinitions) {
- this.typeDefinitions = typeDefinitions;
- return this;
- }
-
- public List<EntityType> getEntityTypes() {
- return entityTypes;
- }
-
- public Schema setEntityTypes(final List<EntityType> entityTypes) {
- this.entityTypes = entityTypes;
- return this;
- }
-
- public List<ComplexType> getComplexTypes() {
- return complexTypes;
- }
-
- public Schema setComplexTypes(final List<ComplexType> complexTypes) {
- this.complexTypes = complexTypes;
- return this;
- }
-
- public List<Action> getActions() {
- return actions;
- }
-
- public Schema setActions(final List<Action> actions) {
- this.actions = actions;
- return this;
- }
-
- public List<Function> getFunctions() {
- return functions;
- }
-
- public Schema setFunctions(final List<Function> functions) {
- this.functions = functions;
- return this;
- }
-
- public EntityContainer getEntityContainer() {
- return entityContainer;
- }
-
- public Schema setEntityContainer(final EntityContainer entityContainer) {
- this.entityContainer = entityContainer;
- return this;
- }
-
- public List<Term> getTerms() {
- return terms;
- }
-
- public Schema setTerms(final List<Term> terms) {
- this.terms = terms;
- return this;
- }
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/edm/provider/Singleton.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/edm/provider/Singleton.java
deleted file mode 100644
index c7dc885..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/edm/provider/Singleton.java
+++ /dev/null
@@ -1,44 +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.api.edm.provider;
-
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-
-import java.util.List;
-
-public class Singleton extends BindingTarget {
-
- @Override
- public Singleton setName(final String name) {
- this.name = name;
- return this;
- }
-
- @Override
- public Singleton setType(final FullQualifiedName type) {
- this.type = type;
- return this;
- }
-
- @Override
- public Singleton setNavigationPropertyBindings(final List<NavigationPropertyBinding> navigationPropertyBindings) {
- this.navigationPropertyBindings = navigationPropertyBindings;
- return this;
- }
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/edm/provider/StructuredType.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/edm/provider/StructuredType.java
deleted file mode 100644
index 8f0d866..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/edm/provider/StructuredType.java
+++ /dev/null
@@ -1,93 +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.api.edm.provider;
-
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-
-import java.util.List;
-
-public abstract class StructuredType {
-
- protected String name;
-
- protected boolean isOpenType;
-
- protected FullQualifiedName baseType;
-
- protected boolean isAbstract;
-
- protected List<Property> properties;
-
- protected List<NavigationProperty> navigationProperties;
-
- // What about mapping and annotations?
- public String getName() {
- return name;
- }
-
- public StructuredType setName(final String name) {
- this.name = name;
- return this;
- }
-
- public boolean isOpenType() {
- return isOpenType;
- }
-
- public StructuredType setOpenType(final boolean isOpenType) {
- this.isOpenType = isOpenType;
- return this;
- }
-
- public FullQualifiedName getBaseType() {
- return baseType;
- }
-
- public StructuredType setBaseType(final FullQualifiedName baseType) {
- this.baseType = baseType;
- return this;
- }
-
- public boolean isAbstract() {
- return isAbstract;
- }
-
- public StructuredType setAbstract(final boolean isAbstract) {
- this.isAbstract = isAbstract;
- return this;
- }
-
- public List<Property> getProperties() {
- return properties;
- }
-
- public StructuredType setProperties(final List<Property> properties) {
- this.properties = properties;
- return this;
- }
-
- public List<NavigationProperty> getNavigationProperties() {
- return navigationProperties;
- }
-
- public StructuredType setNavigationProperties(final List<NavigationProperty> navigationProperties) {
- this.navigationProperties = navigationProperties;
- return this;
- }
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/edm/provider/Term.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/edm/provider/Term.java
deleted file mode 100644
index 1303de8..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/edm/provider/Term.java
+++ /dev/null
@@ -1,150 +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.api.edm.provider;
-
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-
-import java.util.List;
-
-public class Term {
-
- private String name;
-
- private FullQualifiedName type;
-
- private FullQualifiedName baseTerm;
-
- // TODO: AppliesTo is a list of csdl elements => should we put this list inside an enum?
- private String appliesTo;
-
- private boolean isCollection;
-
- // Facets
- private String defaultValue;
-
- private Boolean nullable;
-
- private Integer maxLength;
-
- private Integer precision;
-
- private Integer scale;
-
- // Annotation
- private List<Annotation> annotations;
-
- public String getName() {
- return name;
- }
-
- public Term setName(final String name) {
- this.name = name;
- return this;
- }
-
- public FullQualifiedName getType() {
- return type;
- }
-
- public Term setType(final FullQualifiedName type) {
- this.type = type;
- return this;
- }
-
- public FullQualifiedName getBaseTerm() {
- return baseTerm;
- }
-
- public Term setBaseTerm(final FullQualifiedName baseTerm) {
- this.baseTerm = baseTerm;
- return this;
- }
-
- public String getAppliesTo() {
- return appliesTo;
- }
-
- public Term setAppliesTo(final String appliesTo) {
- this.appliesTo = appliesTo;
- return this;
- }
-
- public boolean isCollection() {
- return isCollection;
- }
-
- public Term setCollection(final boolean isCollection) {
- this.isCollection = isCollection;
- return this;
- }
-
- public String getDefaultValue() {
- return defaultValue;
- }
-
- public Term setDefaultValue(final String defaultValue) {
- this.defaultValue = defaultValue;
- return this;
- }
-
- public Boolean getNullable() {
- return nullable;
- }
-
- public Term setNullable(final Boolean nullable) {
- this.nullable = nullable;
- return this;
- }
-
- public Integer getMaxLength() {
- return maxLength;
- }
-
- public Term setMaxLength(final Integer maxLength) {
- this.maxLength = maxLength;
- return this;
- }
-
- public Integer getPrecision() {
- return precision;
- }
-
- public Term setPrecision(final Integer precision) {
- this.precision = precision;
- return this;
- }
-
- public Integer getScale() {
- return scale;
- }
-
- public Term setScale(final Integer scale) {
- this.scale = scale;
- return this;
- }
-
- public List<Annotation> getAnnotations() {
- return annotations;
- }
-
- public Term setAnnotations(final List<Annotation> annotations) {
- this.annotations = annotations;
- return this;
- }
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/edm/provider/TypeDefinition.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/edm/provider/TypeDefinition.java
deleted file mode 100644
index 1ddcbe2..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/edm/provider/TypeDefinition.java
+++ /dev/null
@@ -1,94 +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.api.edm.provider;
-
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-
-public class TypeDefinition {
-
- private String name;
-
- // TODO: UnderlyingType can only be primitve...
- private FullQualifiedName underlyingType;
-
- // Facets
- private Integer maxLength;
-
- private Integer precision;
-
- private Integer scale;
-
- private Boolean isUnicode;
-
- // Annotations
- public String getName() {
- return name;
- }
-
- public TypeDefinition setName(final String name) {
- this.name = name;
- return this;
- }
-
- public FullQualifiedName getUnderlyingType() {
- return underlyingType;
- }
-
- public TypeDefinition setUnderlyingType(final FullQualifiedName underlyingType) {
- this.underlyingType = underlyingType;
- return this;
- }
-
- public Integer getMaxLength() {
- return maxLength;
- }
-
- public TypeDefinition setMaxLength(final Integer maxLength) {
- this.maxLength = maxLength;
- return this;
- }
-
- public Integer getPrecision() {
- return precision;
- }
-
- public TypeDefinition setPrecision(final Integer precision) {
- this.precision = precision;
- return this;
- }
-
- public Integer getScale() {
- return scale;
- }
-
- public TypeDefinition setScale(final Integer scale) {
- this.scale = scale;
- return this;
- }
-
- public Boolean getIsUnicode() {
- return isUnicode;
- }
-
- public TypeDefinition setIsUnicode(final Boolean isUnicode) {
- this.isUnicode = isUnicode;
- return this;
- }
-
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/edmx/EdmxReference.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/edmx/EdmxReference.java
deleted file mode 100644
index 1af98df..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/edmx/EdmxReference.java
+++ /dev/null
@@ -1,93 +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.api.edmx;
-
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-/**
- * POJO for Edmx Reference.
- */
-public class EdmxReference {
-
- private final URI uri;
- private final List<EdmxReferenceInclude> edmxIncludes;
- private final List<EdmxReferenceIncludeAnnotation> edmxIncludeAnnotations;
-
- /**
- * Create reference with given uri
- *
- * @param uri of reference
- */
- public EdmxReference(URI uri) {
- this.uri = uri;
- edmxIncludes = new ArrayList<EdmxReferenceInclude>();
- edmxIncludeAnnotations = new ArrayList<EdmxReferenceIncludeAnnotation>();
- }
-
- /**
- * Get URI for the reference
- * @return uri for the reference
- */
- public URI getUri() {
- return uri;
- }
-
- /**
- * edmx:Include elements that specify the schemas to include from the target document
- *
- * @return list of {@link EdmxReferenceInclude} in reference or null if none specified
- */
- public List<EdmxReferenceInclude> getIncludes() {
- return Collections.unmodifiableList(edmxIncludes);
- }
-
- /**
- * Add include element to current list.
- *
- * @param include to be added
- * @return this EdmxReference object
- */
- public EdmxReference addInclude(EdmxReferenceInclude include) {
- edmxIncludes.add(include);
- return this;
- }
-
- /**
- * edmx:IncludeAnnotations elements that specify the annotations to include from the target document.
- *
- * @return List of {@link EdmxReferenceIncludeAnnotation} or null if none specified
- */
- public List<EdmxReferenceIncludeAnnotation> getIncludeAnnotations() {
- return Collections.unmodifiableList(edmxIncludeAnnotations);
- }
-
- /**
- * Add include annotation element to current list.
- *
- * @param includeAnnotation to be added
- * @return this EdmxReference object
- */
- public EdmxReference addIncludeAnnotation(EdmxReferenceIncludeAnnotation includeAnnotation) {
- edmxIncludeAnnotations.add(includeAnnotation);
- return this;
- }
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/edmx/EdmxReferenceInclude.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/edmx/EdmxReferenceInclude.java
deleted file mode 100644
index 2cbff9f..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/edmx/EdmxReferenceInclude.java
+++ /dev/null
@@ -1,61 +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.api.edmx;
-
-/**
- * edmx:Include elements that specify the schemas to include from the target document.
- */
-public class EdmxReferenceInclude {
- private final String namespace;
- private final String alias;
-
- /**
- * Create include with given namespace and alias.
- *
- * @param namespace of include
- * @param alias of include
- */
- public EdmxReferenceInclude(String namespace, String alias) {
- this.namespace = namespace;
- this.alias = alias;
- }
-
- /**
- * Create include with given namespace and empty (<code>NULL</code>) alias.
- *
- * @param namespace of include
- */
- public EdmxReferenceInclude(String namespace) {
- this(namespace, null);
- }
-
- /**
- * @return Namespace of the include
- */
- public String getNamespace() {
- return namespace;
- }
-
- /**
- * @return alias of the include if one defined; null otherwise
- */
- public String getAlias() {
- return alias;
- }
-}
\ No newline at end of file
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/edmx/EdmxReferenceIncludeAnnotation.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/edmx/EdmxReferenceIncludeAnnotation.java
deleted file mode 100644
index 9d6b6ab..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/edmx/EdmxReferenceIncludeAnnotation.java
+++ /dev/null
@@ -1,93 +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.api.edmx;
-
-/**
- * POJO for Edmx Reference Include Annotation.
- */
-public class EdmxReferenceIncludeAnnotation {
- private final String termNamespace;
- private String qualifier;
- private String targetNamespace;
-
- /**
- * Create include annotation with given termNamespace and empty qualifier and targetNamespace.
- *
- * @param termNamespace of include annotation
- */
- public EdmxReferenceIncludeAnnotation(String termNamespace) {
- this(termNamespace, null, null);
- }
-
- /**
- * Create include annotation with given termNamespace, qualifier and targetNamespace.
- *
- * @param termNamespace of include annotation
- * @param qualifier of include annotation
- * @param targetNamespace of include annotation
- */
- public EdmxReferenceIncludeAnnotation(String termNamespace, String qualifier, String targetNamespace) {
- this.termNamespace = termNamespace;
- this.qualifier = qualifier;
- this.targetNamespace = targetNamespace;
- }
-
- /**
- * @return TermNamespace of the include annotation
- */
- public String getTermNamespace() {
- return termNamespace;
- }
-
- /**
- * @return Qualifier if one defined; null otherwise
- */
- public String getQualifier() {
- return qualifier;
- }
-
- /**
- * Set qualifier for this include annotation.
- *
- * @param qualifier for include annotation
- * @return this include annotation
- */
- public EdmxReferenceIncludeAnnotation setQualifier(String qualifier) {
- this.qualifier = qualifier;
- return this;
- }
-
- /**
- * @return targetNamespace if defined; null otherwise
- */
- public String getTargetNamespace() {
- return targetNamespace;
- }
-
- /**
- * Set target namespace for this include annotation.
- *
- * @param targetNamespace for include annotation
- * @return this include annotation
- */
- public EdmxReferenceIncludeAnnotation setTargetNamespace(String targetNamespace) {
- this.targetNamespace = targetNamespace;
- return this;
- }
-}
\ No newline at end of file
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/ActionComplexCollectionProcessor.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/ActionComplexCollectionProcessor.java
deleted file mode 100644
index 31c525f..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/ActionComplexCollectionProcessor.java
+++ /dev/null
@@ -1,48 +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.api.processor;
-
-import org.apache.olingo.commons.api.format.ContentType;
-import org.apache.olingo.server.api.ODataApplicationException;
-import org.apache.olingo.server.api.ODataRequest;
-import org.apache.olingo.server.api.ODataResponse;
-import org.apache.olingo.server.api.deserializer.DeserializerException;
-import org.apache.olingo.server.api.serializer.SerializerException;
-import org.apache.olingo.server.api.uri.UriInfo;
-
-/**
- * Processor interface for handling an action import request which has a
- * return type of ComplexCollection.
- */
-public interface ActionComplexCollectionProcessor extends ComplexCollectionProcessor {
- /**
- * Process an action which has as return type a complex-type collection.
- * @param request OData request object containing raw HTTP information
- * @param response OData response object for collecting response data
- * @param uriInfo information of a parsed OData URI
- * @param requestFormat content type of body sent with request
- * @param responseFormat requested content type after content negotiation
- * @throws org.apache.olingo.server.api.ODataApplicationException if the service implementation encounters a failure
- * @throws org.apache.olingo.server.api.deserializer.DeserializerException if deserialization failed
- * @throws org.apache.olingo.server.api.serializer.SerializerException if serialization failed
- */
- void processActionComplexCollection(ODataRequest request, ODataResponse response, UriInfo uriInfo,
- ContentType requestFormat, ContentType responseFormat)
- throws ODataApplicationException, DeserializerException, SerializerException;
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/ActionComplexProcessor.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/ActionComplexProcessor.java
deleted file mode 100644
index 11e8345..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/ActionComplexProcessor.java
+++ /dev/null
@@ -1,48 +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.api.processor;
-
-import org.apache.olingo.commons.api.format.ContentType;
-import org.apache.olingo.server.api.ODataApplicationException;
-import org.apache.olingo.server.api.ODataRequest;
-import org.apache.olingo.server.api.ODataResponse;
-import org.apache.olingo.server.api.deserializer.DeserializerException;
-import org.apache.olingo.server.api.serializer.SerializerException;
-import org.apache.olingo.server.api.uri.UriInfo;
-
-/**
- * Processor interface for handling an action import request which has a
- * return type of Complex.
- */
-public interface ActionComplexProcessor extends ComplexProcessor {
- /**
- * Process an action which has as return type a complex-type.
- * @param request OData request object containing raw HTTP information
- * @param response OData response object for collecting response data
- * @param uriInfo information of a parsed OData URI
- * @param requestFormat content type of body sent with request
- * @param responseFormat requested content type after content negotiation
- * @throws org.apache.olingo.server.api.ODataApplicationException if the service implementation encounters a failure
- * @throws org.apache.olingo.server.api.deserializer.DeserializerException if deserialization failed
- * @throws org.apache.olingo.server.api.serializer.SerializerException if serialization failed
- */
- void processActionComplex(ODataRequest request, ODataResponse response, UriInfo uriInfo, ContentType requestFormat,
- ContentType responseFormat)
- throws ODataApplicationException, DeserializerException, SerializerException;
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/ActionEntityCollectionProcessor.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/ActionEntityCollectionProcessor.java
deleted file mode 100644
index edabfce..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/ActionEntityCollectionProcessor.java
+++ /dev/null
@@ -1,48 +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.api.processor;
-
-import org.apache.olingo.commons.api.format.ContentType;
-import org.apache.olingo.server.api.ODataApplicationException;
-import org.apache.olingo.server.api.ODataRequest;
-import org.apache.olingo.server.api.ODataResponse;
-import org.apache.olingo.server.api.deserializer.DeserializerException;
-import org.apache.olingo.server.api.serializer.SerializerException;
-import org.apache.olingo.server.api.uri.UriInfo;
-
-/**
- * Processor interface for handling an action import request which has a
- * return type of Entity Collection.
- */
-public interface ActionEntityCollectionProcessor extends EntityCollectionProcessor {
- /**
- * Process an action which has as return type a collection of entities.
- * @param request OData request object containing raw HTTP information
- * @param response OData response object for collecting response data
- * @param uriInfo information of a parsed OData URI
- * @param requestFormat content type of body sent with request
- * @param responseFormat requested content type after content negotiation
- * @throws org.apache.olingo.server.api.ODataApplicationException if the service implementation encounters a failure
- * @throws org.apache.olingo.server.api.deserializer.DeserializerException if deserialization failed
- * @throws org.apache.olingo.server.api.serializer.SerializerException if serialization failed
- */
- void processActionEntityCollection(ODataRequest request, ODataResponse response,
- UriInfo uriInfo, ContentType requestFormat, ContentType responseFormat)
- throws ODataApplicationException, DeserializerException, SerializerException;
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/ActionEntityProcessor.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/ActionEntityProcessor.java
deleted file mode 100644
index 8a2043e..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/ActionEntityProcessor.java
+++ /dev/null
@@ -1,48 +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.api.processor;
-
-import org.apache.olingo.commons.api.format.ContentType;
-import org.apache.olingo.server.api.ODataApplicationException;
-import org.apache.olingo.server.api.ODataRequest;
-import org.apache.olingo.server.api.ODataResponse;
-import org.apache.olingo.server.api.deserializer.DeserializerException;
-import org.apache.olingo.server.api.serializer.SerializerException;
-import org.apache.olingo.server.api.uri.UriInfo;
-
-/**
- * Processor interface for handling an action import request which has a
- * return type of Entity.
- */
-public interface ActionEntityProcessor extends EntityProcessor {
- /**
- * Process an action which has as return type an entity.
- * @param request OData request object containing raw HTTP information
- * @param response OData response object for collecting response data
- * @param uriInfo information of a parsed OData URI
- * @param requestFormat content type of body sent with request
- * @param responseFormat requested content type after content negotiation
- * @throws org.apache.olingo.server.api.ODataApplicationException if the service implementation encounters a failure
- * @throws org.apache.olingo.server.api.deserializer.DeserializerException if deserialization failed
- * @throws org.apache.olingo.server.api.serializer.SerializerException if serialization failed
- */
- void processActionEntity(ODataRequest request, ODataResponse response, UriInfo uriInfo, ContentType requestFormat,
- ContentType responseFormat)
- throws ODataApplicationException, DeserializerException, SerializerException;
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/ActionPrimitiveCollectionProcessor.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/ActionPrimitiveCollectionProcessor.java
deleted file mode 100644
index 9fd7549..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/ActionPrimitiveCollectionProcessor.java
+++ /dev/null
@@ -1,48 +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.api.processor;
-
-import org.apache.olingo.commons.api.format.ContentType;
-import org.apache.olingo.server.api.ODataApplicationException;
-import org.apache.olingo.server.api.ODataRequest;
-import org.apache.olingo.server.api.ODataResponse;
-import org.apache.olingo.server.api.deserializer.DeserializerException;
-import org.apache.olingo.server.api.serializer.SerializerException;
-import org.apache.olingo.server.api.uri.UriInfo;
-
-/**
- * Processor interface for handling an action import request which has a
- * return type of Primitive Collection.
- */
-public interface ActionPrimitiveCollectionProcessor extends PrimitiveCollectionProcessor {
- /**
- * Process an action which has as return type a primitive-type collection.
- * @param request OData request object containing raw HTTP information
- * @param response OData response object for collecting response data
- * @param uriInfo information of a parsed OData URI
- * @param requestFormat content type of body sent with request
- * @param responseFormat requested content type after content negotiation
- * @throws org.apache.olingo.server.api.ODataApplicationException if the service implementation encounters a failure
- * @throws org.apache.olingo.server.api.deserializer.DeserializerException if deserialization failed
- * @throws org.apache.olingo.server.api.serializer.SerializerException if serialization failed
- */
- void processActionPrimitiveCollection(ODataRequest request, ODataResponse response, UriInfo uriInfo,
- ContentType requestFormat, ContentType responseFormat)
- throws ODataApplicationException, DeserializerException, SerializerException;
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/ActionPrimitiveProcessor.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/ActionPrimitiveProcessor.java
deleted file mode 100644
index 362621b..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/ActionPrimitiveProcessor.java
+++ /dev/null
@@ -1,48 +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.api.processor;
-
-import org.apache.olingo.commons.api.format.ContentType;
-import org.apache.olingo.server.api.ODataApplicationException;
-import org.apache.olingo.server.api.ODataRequest;
-import org.apache.olingo.server.api.ODataResponse;
-import org.apache.olingo.server.api.deserializer.DeserializerException;
-import org.apache.olingo.server.api.serializer.SerializerException;
-import org.apache.olingo.server.api.uri.UriInfo;
-
-/**
- * Processor interface for handling an action import request which has a
- * return type of Primitive.
- */
-public interface ActionPrimitiveProcessor extends PrimitiveProcessor {
- /**
- * Process an action which has as return type a primitive-type.
- * @param request OData request object containing raw HTTP information
- * @param response OData response object for collecting response data
- * @param uriInfo information of a parsed OData URI
- * @param requestFormat content type of body sent with request
- * @param responseFormat requested content type after content negotiation
- * @throws org.apache.olingo.server.api.ODataApplicationException if the service implementation encounters a failure
- * @throws org.apache.olingo.server.api.deserializer.DeserializerException if deserialization failed
- * @throws org.apache.olingo.server.api.serializer.SerializerException if serialization failed
- */
- void processActionPrimitive(ODataRequest request, ODataResponse response, UriInfo uriInfo,
- ContentType requestFormat, ContentType responseFormat)
- throws ODataApplicationException, DeserializerException, SerializerException;
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/BatchProcessor.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/BatchProcessor.java
deleted file mode 100644
index d0f828d..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/BatchProcessor.java
+++ /dev/null
@@ -1,56 +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.api.processor;
-
-import java.util.List;
-
-import org.apache.olingo.server.api.ODataRequest;
-import org.apache.olingo.server.api.ODataResponse;
-import org.apache.olingo.server.api.batch.BatchFacade;
-import org.apache.olingo.server.api.batch.exception.BatchDeserializerException;
-import org.apache.olingo.server.api.batch.exception.BatchSerializerException;
-import org.apache.olingo.server.api.deserializer.batch.ODataResponsePart;
-
-/**
- * Processor interface for handling a single instance of an Entity Type.
- */
-public interface BatchProcessor extends Processor {
-
- /**
- * Process a complete batch request and puts serialized content and status into the response.
- * @param facade BatchFacade which should be used for further batch part handling
- * @param request OData request object containing raw HTTP information
- * @param response OData response object for collecting response data
- * @throws BatchException if the service implementation encounters a failure
- * @throws BatchDeserializerException if de-serialization failed
- */
- void processBatch(BatchFacade facade, ODataRequest request, ODataResponse response)
- throws BatchSerializerException, BatchDeserializerException;
-
-
- /**
- * Process a batch change set (containing several batch requests)
- * and puts serialized content and status into the response.
- * @param facade BatchFacade which should be used for further batch part handling
- * @param requests List of ODataRequests which are included in the to be processed change set
- * @throws BatchDeserializerException if de-serialization failed
- */
- ODataResponsePart processChangeSet(BatchFacade facade, List<ODataRequest> requests)
- throws BatchDeserializerException;
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/ComplexCollectionProcessor.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/ComplexCollectionProcessor.java
deleted file mode 100644
index 1fe0b0c..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/ComplexCollectionProcessor.java
+++ /dev/null
@@ -1,77 +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.api.processor;
-
-import org.apache.olingo.commons.api.format.ContentType;
-import org.apache.olingo.server.api.ODataApplicationException;
-import org.apache.olingo.server.api.ODataRequest;
-import org.apache.olingo.server.api.ODataResponse;
-import org.apache.olingo.server.api.deserializer.DeserializerException;
-import org.apache.olingo.server.api.serializer.SerializerException;
-import org.apache.olingo.server.api.uri.UriInfo;
-
-/**
- * Processor interface for handling a collection of complex-type instances, e.g.,
- * a property of an entity defined as collection of complex-type instances.
- */
-public interface ComplexCollectionProcessor extends Processor {
-
- /**
- * Reads complex-type collection.
- * If it is not available, for example due to permissions, the service responds with 404 Not Found.
- * @param request OData request object containing raw HTTP information
- * @param response OData response object for collecting response data
- * @param uriInfo information of a parsed OData URI
- * @param responseFormat requested content type after content negotiation
- * @throws ODataApplicationException if the service implementation encounters a failure
- * @throws SerializerException if serialization failed
- */
- void readComplexCollection(ODataRequest request, ODataResponse response, UriInfo uriInfo, ContentType responseFormat)
- throws ODataApplicationException, SerializerException;
-
- /**
- * Update (replace) complex-type collection with send data in the persistence and
- * puts content, status, and Location into the response.
- * Update of complex-type collection is equal to a complete replace
- * of the property (see chapter "11.4.9.4 Update a Collection Property").
- * @param request OData request object containing raw HTTP information
- * @param response OData response object for collecting response data
- * @param uriInfo information of a parsed OData URI
- * @param requestFormat content type of body sent with request
- * @param responseFormat requested content type after content negotiation
- * @throws ODataApplicationException if the service implementation encounters a failure
- * @throws DeserializerException if de-serialization failed
- * @throws SerializerException if serialization failed
- */
- void updateComplexCollection(ODataRequest request, ODataResponse response, UriInfo uriInfo,
- ContentType requestFormat, ContentType responseFormat)
- throws ODataApplicationException, DeserializerException, SerializerException;
-
- /**
- * Deletes complex-type collection from an entity and puts the status into the response.
- * Deletion for complex-type collection is equal to
- * set the content to <code>EMPTY</code>.
- * @param request OData request object containing raw HTTP information
- * @param response OData response object for collecting response data
- * @param uriInfo information of a parsed OData URI
- * @throws ODataApplicationException if the service implementation encounters a failure
- */
- void deleteComplexCollection(ODataRequest request, ODataResponse response, UriInfo uriInfo)
- throws ODataApplicationException;
-}
\ No newline at end of file
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/ComplexProcessor.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/ComplexProcessor.java
deleted file mode 100644
index 58d9bc8..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/ComplexProcessor.java
+++ /dev/null
@@ -1,74 +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.api.processor;
-
-import org.apache.olingo.commons.api.format.ContentType;
-import org.apache.olingo.server.api.ODataApplicationException;
-import org.apache.olingo.server.api.ODataRequest;
-import org.apache.olingo.server.api.ODataResponse;
-import org.apache.olingo.server.api.deserializer.DeserializerException;
-import org.apache.olingo.server.api.serializer.SerializerException;
-import org.apache.olingo.server.api.uri.UriInfo;
-
-/**
- * Processor interface for handling an instance of a complex type, e.g., a complex property of an entity.
- */
-public interface ComplexProcessor extends Processor {
-
- /**
- * Reads complex-type instance.
- * If it is not available, for example due to permissions, the service responds with 404 Not Found.
- * @param request OData request object containing raw HTTP information
- * @param response OData response object for collecting response data
- * @param uriInfo information of a parsed OData URI
- * @param responseFormat requested content type after content negotiation
- * @throws ODataApplicationException if the service implementation encounters a failure
- * @throws SerializerException if serialization failed
- */
- void readComplex(ODataRequest request, ODataResponse response, UriInfo uriInfo, ContentType responseFormat)
- throws ODataApplicationException, SerializerException;
-
- /**
- * Update complex-type instance with send data in the persistence and
- * puts content, status, and Location into the response.
- * @param request OData request object containing raw HTTP information
- * @param response OData response object for collecting response data
- * @param uriInfo information of a parsed OData URI
- * @param requestFormat content type of body sent with request
- * @param responseFormat requested content type after content negotiation
- * @throws ODataApplicationException if the service implementation encounters a failure
- * @throws DeserializerException if de-serialization failed
- * @throws SerializerException if serialization failed
- */
- void updateComplex(ODataRequest request, ODataResponse response, UriInfo uriInfo,
- ContentType requestFormat, ContentType responseFormat)
- throws ODataApplicationException, DeserializerException, SerializerException;
-
- /**
- * Deletes complex-type value from an entity and puts the status into the response.
- * Deletion for complex-type values is equal to
- * set the value to <code>NULL</code> (see chapter "11.4.9.2 Set a Value to Null")
- * @param request OData request object containing raw HTTP information
- * @param response OData response object for collecting response data
- * @param uriInfo information of a parsed OData URI
- * @throws ODataApplicationException if the service implementation encounters a failure
- */
- void deleteComplex(ODataRequest request, ODataResponse response, UriInfo uriInfo)
- throws ODataApplicationException;
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/CountComplexCollectionProcessor.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/CountComplexCollectionProcessor.java
deleted file mode 100644
index 29b1528..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/CountComplexCollectionProcessor.java
+++ /dev/null
@@ -1,43 +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.api.processor;
-
-import org.apache.olingo.server.api.ODataApplicationException;
-import org.apache.olingo.server.api.ODataRequest;
-import org.apache.olingo.server.api.ODataResponse;
-import org.apache.olingo.server.api.serializer.SerializerException;
-import org.apache.olingo.server.api.uri.UriInfo;
-
-/**
- * Processor interface for handling counting a collection of complex properties, e.g. an EdmComplexType.
- */
-public interface CountComplexCollectionProcessor extends Processor {
-
- /**
- * Counts complex properties from persistence and puts serialized content and status into the response.
- * Response content type is <code>text/plain</code> by default.
- * @param request OData request object containing raw HTTP information.
- * @param response OData response object for collecting response data
- * @param uriInfo information of a parsed OData URI
- * @throws ODataApplicationException if the service implementation encounters a failure
- * @throws SerializerException if serialization failed
- */
- void countComplexCollection(ODataRequest request, ODataResponse response, UriInfo uriInfo)
- throws ODataApplicationException, SerializerException;
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/CountEntityCollectionProcessor.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/CountEntityCollectionProcessor.java
deleted file mode 100644
index d64c6ce..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/CountEntityCollectionProcessor.java
+++ /dev/null
@@ -1,43 +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.api.processor;
-
-import org.apache.olingo.server.api.ODataApplicationException;
-import org.apache.olingo.server.api.ODataRequest;
-import org.apache.olingo.server.api.ODataResponse;
-import org.apache.olingo.server.api.serializer.SerializerException;
-import org.apache.olingo.server.api.uri.UriInfo;
-
-/**
- * Processor interface for handling counting a collection of entities, e.g. an Entity Set.
- */
-public interface CountEntityCollectionProcessor extends Processor {
-
- /**
- * Counts entities from persistence and puts serialized content and status into the response.
- * Response content type is <code>text/plain</code> by default.
- * @param request OData request object containing raw HTTP information.
- * @param response OData response object for collecting response data
- * @param uriInfo information of a parsed OData URI
- * @throws ODataApplicationException if the service implementation encounters a failure
- * @throws SerializerException if serialization failed
- */
- void countEntityCollection(ODataRequest request, ODataResponse response, UriInfo uriInfo)
- throws ODataApplicationException, SerializerException;
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/CountPrimitiveCollectionProcessor.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/CountPrimitiveCollectionProcessor.java
deleted file mode 100644
index 31c76ee..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/CountPrimitiveCollectionProcessor.java
+++ /dev/null
@@ -1,43 +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.api.processor;
-
-import org.apache.olingo.server.api.ODataApplicationException;
-import org.apache.olingo.server.api.ODataRequest;
-import org.apache.olingo.server.api.ODataResponse;
-import org.apache.olingo.server.api.serializer.SerializerException;
-import org.apache.olingo.server.api.uri.UriInfo;
-
-/**
- * Processor interface for handling counting a collection of primitive properties, e.g. an collection of EdmString.
- */
-public interface CountPrimitiveCollectionProcessor extends Processor {
-
- /**
- * Counts primitive properties from persistence and puts serialized content and status into the response.
- * Response content type is <code>text/plain</code> by default.
- * @param request OData request object containing raw HTTP information.
- * @param response OData response object for collecting response data
- * @param uriInfo information of a parsed OData URI
- * @throws ODataApplicationException if the service implementation encounters a failure
- * @throws SerializerException if serialization failed
- */
- void countPrimitiveCollection(ODataRequest request, ODataResponse response, UriInfo uriInfo)
- throws ODataApplicationException, SerializerException;
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/DefaultProcessor.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/DefaultProcessor.java
deleted file mode 100644
index 302959a..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/DefaultProcessor.java
+++ /dev/null
@@ -1,91 +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.api.processor;
-
-import java.io.ByteArrayInputStream;
-
-import org.apache.olingo.commons.api.format.ContentType;
-import org.apache.olingo.commons.api.format.ODataFormat;
-import org.apache.olingo.commons.api.http.HttpHeader;
-import org.apache.olingo.commons.api.http.HttpStatusCode;
-import org.apache.olingo.server.api.OData;
-import org.apache.olingo.server.api.ODataApplicationException;
-import org.apache.olingo.server.api.ODataRequest;
-import org.apache.olingo.server.api.ODataResponse;
-import org.apache.olingo.server.api.ODataServerError;
-import org.apache.olingo.server.api.ServiceMetadata;
-import org.apache.olingo.server.api.serializer.ODataSerializer;
-import org.apache.olingo.server.api.serializer.SerializerException;
-import org.apache.olingo.server.api.uri.UriInfo;
-
-/**
- * <p>Processor implementation for handling default cases:
- * <ul><li>request for the metadata document</li>
- * <li>request for the service document</li>
- * <li>error handling</li></ul></p>
- * <p>This implementation is registered in the ODataHandler by default.
- * The default can be replaced by re-registering a custom implementation.</p>
- */
-public class DefaultProcessor implements MetadataProcessor, ServiceDocumentProcessor, ErrorProcessor {
- private OData odata;
- private ServiceMetadata serviceMetadata;
-
- @Override
- public void init(final OData odata, final ServiceMetadata serviceMetadata) {
- this.odata = odata;
- this.serviceMetadata = serviceMetadata;
- }
-
- @Override
- public void readServiceDocument(final ODataRequest request, final ODataResponse response, final UriInfo uriInfo,
- final ContentType requestedContentType) throws ODataApplicationException, SerializerException {
- ODataSerializer serializer = odata.createSerializer(ODataFormat.fromContentType(requestedContentType));
- response.setContent(serializer.serviceDocument(serviceMetadata.getEdm(), request.getRawBaseUri()));
- response.setStatusCode(HttpStatusCode.OK.getStatusCode());
- response.setHeader(HttpHeader.CONTENT_TYPE, requestedContentType.toContentTypeString());
- }
-
- @Override
- public void readMetadata(final ODataRequest request, final ODataResponse response, final UriInfo uriInfo,
- final ContentType requestedContentType) throws ODataApplicationException, SerializerException {
- ODataSerializer serializer = odata.createSerializer(ODataFormat.fromContentType(requestedContentType));
- response.setContent(serializer.metadataDocument(serviceMetadata));
- response.setStatusCode(HttpStatusCode.OK.getStatusCode());
- response.setHeader(HttpHeader.CONTENT_TYPE, requestedContentType.toContentTypeString());
- }
-
- @Override
- public void processError(ODataRequest request, ODataResponse response, ODataServerError serverError,
- ContentType requestedContentType) {
- try {
- ODataSerializer serializer = odata.createSerializer(ODataFormat.fromContentType(requestedContentType));
- response.setContent(serializer.error(serverError));
- response.setStatusCode(serverError.getStatusCode());
- response.setHeader(HttpHeader.CONTENT_TYPE, requestedContentType.toContentTypeString());
- } catch (Exception e) {
- // This should never happen but to be sure we have this catch here to prevent sending a stacktrace to a client.
- String responseContent =
- "{\"error\":{\"code\":null,\"message\":\"An unexpected exception occurred during " +
- "error processing with message: " + e.getMessage() + "\"}}";
- response.setContent(new ByteArrayInputStream(responseContent.getBytes()));
- response.setStatusCode(HttpStatusCode.INTERNAL_SERVER_ERROR.getStatusCode());
- response.setHeader(HttpHeader.CONTENT_TYPE, ContentType.APPLICATION_JSON.toContentTypeString());
- }
- }
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/DeltaProcessor.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/DeltaProcessor.java
deleted file mode 100644
index a834657..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/DeltaProcessor.java
+++ /dev/null
@@ -1,39 +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.api.processor;
-
-/**
- * Processor interface for handling a single instance of an Delta Response.
- */
-public interface DeltaProcessor extends Processor {
-
-// NOT YET AVAILABLE
-// /**
-// * Reads delta information from persistence and put it as serialized content and
-// * with according status into the response.
-// * @param request OData request object containing raw HTTP information
-// * @param response OData response object for collecting response data
-// * @param uriInfo information of a parsed OData URI
-// * @param responseFormat requested content type after content negotiation
-// * @throws ODataApplicationException if the service implementation encounters a failure
-// * @throws SerializerException if serialization failed
-// */
-// void readDelta(ODataRequest request, ODataResponse response, UriInfo uriInfo, ContentType responseFormat)
-// throws ODataApplicationException, SerializerException;
-}
\ No newline at end of file
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/EntityCollectionProcessor.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/EntityCollectionProcessor.java
deleted file mode 100644
index de96ab5..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/EntityCollectionProcessor.java
+++ /dev/null
@@ -1,45 +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.api.processor;
-
-import org.apache.olingo.commons.api.format.ContentType;
-import org.apache.olingo.server.api.ODataApplicationException;
-import org.apache.olingo.server.api.ODataRequest;
-import org.apache.olingo.server.api.ODataResponse;
-import org.apache.olingo.server.api.serializer.SerializerException;
-import org.apache.olingo.server.api.uri.UriInfo;
-
-/**
- * Processor interface for handling a collection of entities, e.g., an Entity Set.
- */
-public interface EntityCollectionProcessor extends Processor {
-
- /**
- * Reads entities data from persistence and puts serialized content and status into the response.
- * @param request OData request object containing raw HTTP information
- * @param response OData response object for collecting response data
- * @param uriInfo information of a parsed OData URI
- * @param responseFormat requested content type after content negotiation
- * @throws ODataApplicationException if the service implementation encounters a failure
- * @throws SerializerException if serialization failed
- */
- void readEntityCollection(ODataRequest request, ODataResponse response, UriInfo uriInfo, ContentType responseFormat)
- throws ODataApplicationException, SerializerException;
-
-}
\ No newline at end of file
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/EntityProcessor.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/EntityProcessor.java
deleted file mode 100644
index dbce4f2..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/EntityProcessor.java
+++ /dev/null
@@ -1,85 +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.api.processor;
-
-import org.apache.olingo.commons.api.format.ContentType;
-import org.apache.olingo.server.api.ODataApplicationException;
-import org.apache.olingo.server.api.ODataRequest;
-import org.apache.olingo.server.api.ODataResponse;
-import org.apache.olingo.server.api.deserializer.DeserializerException;
-import org.apache.olingo.server.api.serializer.SerializerException;
-import org.apache.olingo.server.api.uri.UriInfo;
-
-/**
- * Processor interface for handling a single instance of an Entity Type.
- */
-public interface EntityProcessor extends Processor {
-
- /**
- * Reads entity data from persistence and puts serialized content and status into the response.
- * @param request OData request object containing raw HTTP information
- * @param response OData response object for collecting response data
- * @param uriInfo information of a parsed OData URI
- * @param responseFormat requested content type after content negotiation
- * @throws ODataApplicationException if the service implementation encounters a failure
- * @throws SerializerException if serialization failed
- */
- void readEntity(ODataRequest request, ODataResponse response, UriInfo uriInfo, ContentType responseFormat)
- throws ODataApplicationException, SerializerException;
-
- /**
- * Creates an entity with send data in the persistence and puts content, status, and Location into the response.
- * @param request OData request object containing raw HTTP information
- * @param response OData response object for collecting response data
- * @param uriInfo information of a parsed OData URI
- * @param requestFormat content type of body sent with request
- * @param responseFormat requested content type after content negotiation
- * @throws ODataApplicationException if the service implementation encounters a failure
- * @throws DeserializerException if deserialization failed
- * @throws SerializerException if serialization failed
- */
- void createEntity(ODataRequest request, ODataResponse response, UriInfo uriInfo,
- ContentType requestFormat, ContentType responseFormat)
- throws ODataApplicationException, DeserializerException, SerializerException;
-
- /**
- * Update entity data with send data in the persistence and puts content, status, and Location into the response.
- * @param request OData request object containing raw HTTP information
- * @param response OData response object for collecting response data
- * @param uriInfo information of a parsed OData URI
- * @param requestFormat content type of body sent with request
- * @param responseFormat requested content type after content negotiation
- * @throws ODataApplicationException if the service implementation encounters a failure
- * @throws DeserializerException if deserialization failed
- * @throws SerializerException if serialization failed
- */
- void updateEntity(ODataRequest request, ODataResponse response, UriInfo uriInfo,
- ContentType requestFormat, ContentType responseFormat)
- throws ODataApplicationException, DeserializerException, SerializerException;
-
- /**
- * Deletes entity from persistence and puts the status into the response.
- * @param request OData request object containing raw HTTP information
- * @param response OData response object for collecting response data
- * @param uriInfo information of a parsed OData URI
- * @throws ODataApplicationException if the service implementation encounters a failure
- */
- void deleteEntity(ODataRequest request, ODataResponse response, UriInfo uriInfo) throws ODataApplicationException;
-
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/ErrorProcessor.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/ErrorProcessor.java
deleted file mode 100644
index 145fb5b..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/ErrorProcessor.java
+++ /dev/null
@@ -1,41 +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.api.processor;
-
-import org.apache.olingo.commons.api.format.ContentType;
-import org.apache.olingo.server.api.ODataRequest;
-import org.apache.olingo.server.api.ODataResponse;
-import org.apache.olingo.server.api.ODataServerError;
-
-/**
- * Processor which is called if any error/exception occurs inside the library or another processor.
- */
-public interface ErrorProcessor extends Processor {
-
- /**
- * Processes an error/exception. MUST NOT throw an exception!
- *
- * @param request OData request object containing raw HTTP information
- * @param response OData response object for collecting response data
- * @param serverError the server error
- * @param responseFormat requested content type after content negotiation
- */
- public void processError(ODataRequest request, ODataResponse response, ODataServerError serverError,
- ContentType responseFormat);
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/MediaEntityProcessor.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/MediaEntityProcessor.java
deleted file mode 100644
index e700fa1..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/MediaEntityProcessor.java
+++ /dev/null
@@ -1,75 +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.api.processor;
-
-import org.apache.olingo.commons.api.format.ContentType;
-import org.apache.olingo.server.api.ODataApplicationException;
-import org.apache.olingo.server.api.ODataRequest;
-import org.apache.olingo.server.api.ODataResponse;
-import org.apache.olingo.server.api.deserializer.DeserializerException;
-import org.apache.olingo.server.api.serializer.SerializerException;
-import org.apache.olingo.server.api.uri.UriInfo;
-
-/**
- * Processor interface for handling Entity Media.
- */
-public interface MediaEntityProcessor extends EntityProcessor {
-
- /**
- * Reads entity media data from persistence and puts content and status into the response.
- * @param request OData request object containing raw HTTP information
- * @param response OData response object for collecting response data
- * @param uriInfo information of a parsed OData URI
- * @param responseFormat requested content type after content negotiation
- * @throws ODataApplicationException if the service implementation encounters a failure
- * @throws SerializerException if serialization failed
- */
- void readMediaEntity(ODataRequest request, ODataResponse response, UriInfo uriInfo, ContentType responseFormat)
- throws ODataApplicationException, SerializerException;
-
- /**
- * Creates an entity with send media data in the persistence and puts content, status and Location into the response.
- * @param request OData request object containing raw HTTP information
- * @param response OData response object for collecting response data
- * @param uriInfo information of a parsed OData URI
- * @param requestFormat content type of body sent with request
- * @param responseFormat requested content type after content negotiation
- * @throws ODataApplicationException if the service implementation encounters a failure
- * @throws DeserializerException if deserialization failed
- * @throws SerializerException if serialization failed
- */
- void createMediaEntity(ODataRequest request, ODataResponse response, UriInfo uriInfo,
- ContentType requestFormat, ContentType responseFormat)
- throws ODataApplicationException, DeserializerException, SerializerException;
-
- /**
- * Updates entity media data in the persistence and puts content and status into the response.
- * @param request OData request object containing raw HTTP information
- * @param response OData response object for collecting response data
- * @param uriInfo information of a parsed OData URI
- * @param requestFormat content type of body sent with request
- * @param responseFormat requested content type after content negotiation
- * @throws ODataApplicationException if the service implementation encounters a failure
- * @throws DeserializerException if deserialization failed
- * @throws SerializerException if serialization failed
- */
- void updateMediaEntity(ODataRequest request, ODataResponse response, UriInfo uriInfo,
- ContentType requestFormat, ContentType responseFormat)
- throws ODataApplicationException, DeserializerException, SerializerException;
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/MetadataProcessor.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/MetadataProcessor.java
deleted file mode 100644
index 5faa56d..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/MetadataProcessor.java
+++ /dev/null
@@ -1,44 +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.api.processor;
-
-import org.apache.olingo.commons.api.format.ContentType;
-import org.apache.olingo.server.api.ODataApplicationException;
-import org.apache.olingo.server.api.ODataRequest;
-import org.apache.olingo.server.api.ODataResponse;
-import org.apache.olingo.server.api.serializer.SerializerException;
-import org.apache.olingo.server.api.uri.UriInfo;
-
-/**
- * Processor interface for handling the metadata document.
- */
-public interface MetadataProcessor extends Processor {
-
- /**
- * Reads data from persistence and puts serialized content and status into the response.
- * @param request OData request object containing raw HTTP information
- * @param response OData response object for collecting response data
- * @param uriInfo information of a parsed OData URI
- * @param responseFormat requested content type after content negotiation
- * @throws ODataApplicationException if the service implementation encounters a failure
- * @throws SerializerException if serialization failed
- */
- void readMetadata(ODataRequest request, ODataResponse response, UriInfo uriInfo, ContentType responseFormat)
- throws ODataApplicationException, SerializerException;
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/PrimitiveCollectionProcessor.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/PrimitiveCollectionProcessor.java
deleted file mode 100644
index 07f3678..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/PrimitiveCollectionProcessor.java
+++ /dev/null
@@ -1,78 +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.api.processor;
-
-import org.apache.olingo.commons.api.format.ContentType;
-import org.apache.olingo.server.api.ODataApplicationException;
-import org.apache.olingo.server.api.ODataRequest;
-import org.apache.olingo.server.api.ODataResponse;
-import org.apache.olingo.server.api.deserializer.DeserializerException;
-import org.apache.olingo.server.api.serializer.SerializerException;
-import org.apache.olingo.server.api.uri.UriInfo;
-
-/**
- * Processor interface for handling a collection of primitive-type instances, e.g.,
- * a property of an entity defined as collection of primitive-type instances.
- */
-public interface PrimitiveCollectionProcessor extends Processor {
-
- /**
- * Reads primitive-type collection.
- * If it is not available, for example due to permissions, the service responds with 404 Not Found.
- * @param request OData request object containing raw HTTP information
- * @param response OData response object for collecting response data
- * @param uriInfo information of a parsed OData URI
- * @param responseFormat requested content type after content negotiation
- * @throws ODataApplicationException if the service implementation encounters a failure
- * @throws SerializerException if serialization failed
- */
- void readPrimitiveCollection(ODataRequest request, ODataResponse response, UriInfo uriInfo,
- ContentType responseFormat)
- throws ODataApplicationException, SerializerException;
-
- /**
- * Update (replace) primitive-type collection with send data in the persistence and
- * puts content, status, and Location into the response.
- * Update of primitive-type collection is equal to a complete replace
- * of the property (see chapter "11.4.9.4 Update a Collection Property").
- * @param request OData request object containing raw HTTP information
- * @param response OData response object for collecting response data
- * @param uriInfo information of a parsed OData URI
- * @param requestFormat content type of body sent with request
- * @param responseFormat requested content type after content negotiation
- * @throws ODataApplicationException if the service implementation encounters a failure
- * @throws DeserializerException if deserialization failed
- * @throws SerializerException if serialization failed
- */
- void updatePrimitiveCollection(ODataRequest request, ODataResponse response, UriInfo uriInfo,
- ContentType requestFormat, ContentType responseFormat)
- throws ODataApplicationException, DeserializerException, SerializerException;
-
- /**
- * Deletes primitive-type collection from an entity and puts the status into the response.
- * Deletion for primitive-type collection is equal to
- * set the content to <code>EMPTY</code>.
- * @param request OData request object containing raw HTTP information
- * @param response OData response object for collecting response data
- * @param uriInfo information of a parsed OData URI
- * @throws ODataApplicationException if the service implementation encounters a failure
- */
- void deletePrimitiveCollection(ODataRequest request, ODataResponse response, UriInfo uriInfo)
- throws ODataApplicationException;
-}
\ No newline at end of file
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/PrimitiveProcessor.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/PrimitiveProcessor.java
deleted file mode 100644
index 8c24060..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/PrimitiveProcessor.java
+++ /dev/null
@@ -1,76 +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.api.processor;
-
-import org.apache.olingo.commons.api.format.ContentType;
-import org.apache.olingo.server.api.ODataApplicationException;
-import org.apache.olingo.server.api.ODataRequest;
-import org.apache.olingo.server.api.ODataResponse;
-import org.apache.olingo.server.api.deserializer.DeserializerException;
-import org.apache.olingo.server.api.serializer.SerializerException;
-import org.apache.olingo.server.api.uri.UriInfo;
-
-/**
- * Processor interface for handling an instance of a primitive type, e.g., a primitive property of an entity.
- */
-public interface PrimitiveProcessor extends Processor {
-
- /**
- * Reads primitive-type instance.
- * If its value is <code>null</code>, the service responds with 204 No Content.
- * If it is not available, for example due to permissions, the service responds with 404 Not Found.
- * @param request OData request object containing raw HTTP information
- * @param response OData response object for collecting response data
- * @param uriInfo information of a parsed OData URI
- * @param responseFormat requested content type after content negotiation
- * @throws ODataApplicationException if the service implementation encounters a failure
- * @throws SerializerException if serialization failed
- */
- void readPrimitive(ODataRequest request, ODataResponse response, UriInfo uriInfo, ContentType responseFormat)
- throws ODataApplicationException, SerializerException;
-
- /**
- * Update primitive-type instance with send data in the persistence and
- * puts content, status, and Location into the response.
- * @param request OData request object containing raw HTTP information
- * @param response OData response object for collecting response data
- * @param uriInfo information of a parsed OData URI
- * @param requestFormat content type of body sent with request
- * @param responseFormat requested content type after content negotiation
- * @throws ODataApplicationException if the service implementation encounters a failure
- * @throws DeserializerException if deserialization failed
- * @throws SerializerException if serialization failed
- */
- void updatePrimitive(ODataRequest request, ODataResponse response, UriInfo uriInfo,
- ContentType requestFormat, ContentType responseFormat)
- throws ODataApplicationException, DeserializerException, SerializerException;
-
- /**
- * Deletes primitive-type value from an entity and puts the status into the response.
- * Deletion for primitive-type values is equal to
- * set the value to <code>NULL</code> (see chapter "11.4.9.2 Set a Value to Null")
- * @param request OData request object containing raw HTTP information
- * @param response OData response object for collecting response data
- * @param uriInfo information of a parsed OData URI
- * @throws ODataApplicationException if the service implementation encounters a failure
- */
- void deletePrimitive(ODataRequest request, ODataResponse response, UriInfo uriInfo)
- throws ODataApplicationException;
-
-}
\ No newline at end of file
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/PrimitiveValueProcessor.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/PrimitiveValueProcessor.java
deleted file mode 100644
index 0770c2e..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/PrimitiveValueProcessor.java
+++ /dev/null
@@ -1,46 +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.api.processor;
-
-import org.apache.olingo.commons.api.format.ContentType;
-import org.apache.olingo.server.api.ODataApplicationException;
-import org.apache.olingo.server.api.ODataRequest;
-import org.apache.olingo.server.api.ODataResponse;
-import org.apache.olingo.server.api.serializer.SerializerException;
-import org.apache.olingo.server.api.uri.UriInfo;
-
-/**
- * Processor interface for handling an instance of a primitive type, e.g., a primitive property of an entity.
- */
-public interface PrimitiveValueProcessor extends PrimitiveProcessor {
-
- /**
- * Reads raw value of a primitive-type instance, e.g., of a primitive property of an entity.
- * If the value is <code>null</code>, the service responds with 204 No Content.
- * If it is not available, for example due to permissions, the service responds with 404 Not Found.
- * @param request OData request object containing raw HTTP information
- * @param response OData response object for collecting response data
- * @param uriInfo information of a parsed OData URI
- * @param responseFormat requested content type after content negotiation
- * @throws org.apache.olingo.server.api.ODataApplicationException if the service implementation encounters a failure
- * @throws org.apache.olingo.server.api.serializer.SerializerException if serialization failed
- */
- void readPrimitiveValue(ODataRequest request, ODataResponse response, UriInfo uriInfo, ContentType responseFormat)
- throws ODataApplicationException, SerializerException;
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/Processor.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/Processor.java
deleted file mode 100644
index 2b5eec2..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/Processor.java
+++ /dev/null
@@ -1,38 +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.api.processor;
-
-import org.apache.olingo.server.api.OData;
-import org.apache.olingo.server.api.ServiceMetadata;
-
-/**
- * <p>Base interface for all processor types.</p>
- * <p>Processors are responsible to read and write data and marshalling content
- * within a request - response cycle.</p>
- */
-public interface Processor {
-
- /**
- * Initializes the processor for each HTTP request - response cycle.
- * @param odata Olingo's root object, acting as a factory for various object types
- * @param serviceMetadata metadata of the OData service like the EDM that have to be created
- * before the OData request handling takes place
- */
- void init(OData odata, ServiceMetadata serviceMetadata);
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/ReferenceCollectionProcessor.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/ReferenceCollectionProcessor.java
deleted file mode 100644
index 3373e3f..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/ReferenceCollectionProcessor.java
+++ /dev/null
@@ -1,46 +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.api.processor;
-
-import org.apache.olingo.commons.api.format.ContentType;
-import org.apache.olingo.server.api.ODataApplicationException;
-import org.apache.olingo.server.api.ODataRequest;
-import org.apache.olingo.server.api.ODataResponse;
-import org.apache.olingo.server.api.serializer.SerializerException;
-import org.apache.olingo.server.api.uri.UriInfo;
-
-/**
- * Processor interface for handling a collection an Entity References.
- */
-public interface ReferenceCollectionProcessor extends Processor {
-
- /**
- * Reads entity references from persistence and put them as serialized content and with
- * according status into the response.
- * @param request OData request object containing raw HTTP information
- * @param response OData response object for collecting response data
- * @param uriInfo information of a parsed OData URI
- * @param responseFormat requested content type after content negotiation
- * @throws ODataApplicationException if the service implementation encounters a failure
- * @throws SerializerException if serialization failed
- */
- void readReferenceCollection(ODataRequest request, ODataResponse response, UriInfo uriInfo,
- ContentType responseFormat)
- throws ODataApplicationException, SerializerException;
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/ReferenceProcessor.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/ReferenceProcessor.java
deleted file mode 100644
index 43c94ba..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/ReferenceProcessor.java
+++ /dev/null
@@ -1,81 +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.api.processor;
-
-import org.apache.olingo.commons.api.format.ContentType;
-import org.apache.olingo.server.api.ODataApplicationException;
-import org.apache.olingo.server.api.ODataRequest;
-import org.apache.olingo.server.api.ODataResponse;
-import org.apache.olingo.server.api.deserializer.DeserializerException;
-import org.apache.olingo.server.api.serializer.SerializerException;
-import org.apache.olingo.server.api.uri.UriInfo;
-
-/**
- * Processor interface for handling a single instance of an Entity Reference.
- */
-public interface ReferenceProcessor extends Processor {
-
- /**
- * Reads entity reference from persistence and put it as serialized content and status into the response.
- * @param request OData request object containing raw HTTP information
- * @param response OData response object for collecting response data
- * @param uriInfo information of a parsed OData URI
- * @param responseFormat requested content type after content negotiation
- * @throws ODataApplicationException if the service implementation encounters a failure
- * @throws SerializerException if serialization failed
- */
- void readReference(ODataRequest request, ODataResponse response, UriInfo uriInfo, ContentType responseFormat)
- throws ODataApplicationException, SerializerException;
-
- /**
- * Creates entity reference in the persistence and puts content, status, and Location into the response.
- * @param request OData request object containing raw HTTP information
- * @param response OData response object for collecting response data
- * @param uriInfo information of a parsed OData URI
- * @param requestFormat content type of body sent with request
- * @throws ODataApplicationException if the service implementation encounters a failure
- * @throws DeserializerException if de-serialization failed
- */
- void createReference(ODataRequest request, ODataResponse response, UriInfo uriInfo, ContentType requestFormat)
- throws ODataApplicationException, DeserializerException;
-
- /**
- * Update entity reference in the persistence and puts content, status, and Location into the response.
- * @param request OData request object containing raw HTTP information
- * @param response OData response object for collecting response data
- * @param uriInfo information of a parsed OData URI
- * @param requestFormat content type of body sent with request
- * @throws ODataApplicationException if the service implementation encounters a failure
- * @throws DeserializerException if de-serialization failed
- */
- void updateReference(ODataRequest request, ODataResponse response, UriInfo uriInfo, ContentType requestFormat)
- throws ODataApplicationException, DeserializerException;
-
- /**
- * Deletes reference to an entity from persistence and puts the status into the response.
- * Delete on a reference only removes the reference to and not the entity itself
- * (see chapter "11.4.6.2 Remove a Reference to an Entity")
- * @param request OData request object containing raw HTTP information
- * @param response OData response object for collecting response data
- * @param uriInfo information of a parsed OData URI
- * @throws ODataApplicationException if the service implementation encounters a failure
- */
- void deleteReference(ODataRequest request, ODataResponse response, UriInfo uriInfo)
- throws ODataApplicationException;
-}
\ No newline at end of file
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/ServiceDocumentProcessor.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/ServiceDocumentProcessor.java
deleted file mode 100644
index 5f0d4f9..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/processor/ServiceDocumentProcessor.java
+++ /dev/null
@@ -1,44 +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.api.processor;
-
-import org.apache.olingo.commons.api.format.ContentType;
-import org.apache.olingo.server.api.ODataApplicationException;
-import org.apache.olingo.server.api.ODataRequest;
-import org.apache.olingo.server.api.ODataResponse;
-import org.apache.olingo.server.api.serializer.SerializerException;
-import org.apache.olingo.server.api.uri.UriInfo;
-
-/**
- * Processor interface for handling the service document.
- */
-public interface ServiceDocumentProcessor extends Processor {
-
- /**
- * Reads service-document information from persistence and puts serialized content and status into the response.
- * @param request OData request object containing raw HTTP information
- * @param response OData response object for collecting response data
- * @param uriInfo information of a parsed OData URI
- * @param responseFormat requested content type after content negotiation
- * @throws ODataApplicationException if the service implementation encounters a failure
- * @throws SerializerException if serialization failed
- */
- void readServiceDocument(ODataRequest request, ODataResponse response, UriInfo uriInfo, ContentType responseFormat)
- throws ODataApplicationException, SerializerException;
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/ComplexSerializerOptions.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/ComplexSerializerOptions.java
deleted file mode 100644
index d6788e5..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/ComplexSerializerOptions.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.api.serializer;
-
-import org.apache.olingo.commons.api.data.ContextURL;
-import org.apache.olingo.server.api.uri.queryoption.ExpandOption;
-import org.apache.olingo.server.api.uri.queryoption.SelectOption;
-
-/** Options for the OData serializer. */
-public class ComplexSerializerOptions {
-
- private ContextURL contextURL;
- private ExpandOption expand;
- private SelectOption select;
-
- /** Gets the {@link ContextURL}. */
- public ContextURL getContextURL() {
- return contextURL;
- }
-
- /** Gets the $expand system query option. */
- public ExpandOption getExpand() {
- return expand;
- }
-
- /** Gets the $select system query option. */
- public SelectOption getSelect() {
- return select;
- }
-
- private ComplexSerializerOptions() {}
-
- /** Initializes the options builder. */
- public static Builder with() {
- return new Builder();
- }
-
- /** Builder of OData serializer options. */
- public static final class Builder {
-
- private ComplexSerializerOptions options;
-
- private Builder() {
- options = new ComplexSerializerOptions();
- }
-
- /** Sets the {@link ContextURL}. */
- public Builder contextURL(final ContextURL contextURL) {
- options.contextURL = contextURL;
- return this;
- }
-
- /** Sets the $expand system query option. */
- public Builder expand(final ExpandOption expand) {
- options.expand = expand;
- return this;
- }
-
- /** Sets the $select system query option. */
- public Builder select(final SelectOption select) {
- options.select = select;
- return this;
- }
-
- /** Builds the OData serializer options. */
- public ComplexSerializerOptions build() {
- return options;
- }
- }
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/CustomContentTypeSupport.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/CustomContentTypeSupport.java
deleted file mode 100644
index ca4f0cb..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/CustomContentTypeSupport.java
+++ /dev/null
@@ -1,46 +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.api.serializer;
-
-import java.util.List;
-
-import org.apache.olingo.commons.api.format.ContentType;
-
-/**
- * <p>Processors that supports custom content types can implement this interface.</p>
- * <p>The processor can also remove default content types if the default (de-)serializers
- * of Olingo are not used. By default this interface is not implemented and
- * a processor supports content types implemented by Olingo's default (de-)serializer
- * (e.g., <code>application/xml</code> for the metadata and
- * </code>application/json</code> for the service document).</p>
- * <p>Requesting a content type that is not supported results in an HTTP error
- * 406 (Not Acceptable); sending content of an unsupported type results in an
- * HTTP error 415 (Unsupported Media Type).</p>
- */
-public interface CustomContentTypeSupport {
-
- /**
- * Returns a list of supported content types.
- * @param defaultContentTypes content types supported by Olingo's (de-)serializer
- * @param type the current type of representation
- * @return modified list of supported content types
- */
- public List<ContentType> modifySupportedContentTypes(
- List<ContentType> defaultContentTypes, RepresentationType type);
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/EntityCollectionSerializerOptions.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/EntityCollectionSerializerOptions.java
deleted file mode 100644
index 14c588d..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/EntityCollectionSerializerOptions.java
+++ /dev/null
@@ -1,97 +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.api.serializer;
-
-import org.apache.olingo.commons.api.data.ContextURL;
-import org.apache.olingo.server.api.uri.queryoption.CountOption;
-import org.apache.olingo.server.api.uri.queryoption.ExpandOption;
-import org.apache.olingo.server.api.uri.queryoption.SelectOption;
-
-/** Options for the OData serializer. */
-public class EntityCollectionSerializerOptions {
-
- private ContextURL contextURL;
- private CountOption count;
- private ExpandOption expand;
- private SelectOption select;
-
- /** Gets the {@link ContextURL}. */
- public ContextURL getContextURL() {
- return contextURL;
- }
-
- /** Gets the $count system query option. */
- public CountOption getCount() {
- return count;
- }
-
- /** Gets the $expand system query option. */
- public ExpandOption getExpand() {
- return expand;
- }
-
- /** Gets the $select system query option. */
- public SelectOption getSelect() {
- return select;
- }
-
- /** Initializes the options builder. */
- public static Builder with() {
- return new Builder();
- }
-
- /** Builder of OData serializer options. */
- public static final class Builder {
-
- private EntityCollectionSerializerOptions options;
-
- private Builder() {
- options = new EntityCollectionSerializerOptions();
- }
-
- /** Sets the {@link ContextURL}. */
- public Builder contextURL(final ContextURL contextURL) {
- options.contextURL = contextURL;
- return this;
- }
-
- /** Sets the $count system query option. */
- public Builder count(final CountOption count) {
- options.count = count;
- return this;
- }
-
- /** Sets the $expand system query option. */
- public Builder expand(final ExpandOption expand) {
- options.expand = expand;
- return this;
- }
-
- /** Sets the $select system query option. */
- public Builder select(final SelectOption select) {
- options.select = select;
- return this;
- }
-
- /** Builds the OData serializer options. */
- public EntityCollectionSerializerOptions build() {
- return options;
- }
- }
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/EntitySerializerOptions.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/EntitySerializerOptions.java
deleted file mode 100644
index 7805fb0..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/EntitySerializerOptions.java
+++ /dev/null
@@ -1,85 +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.api.serializer;
-
-import org.apache.olingo.commons.api.data.ContextURL;
-import org.apache.olingo.server.api.uri.queryoption.ExpandOption;
-import org.apache.olingo.server.api.uri.queryoption.SelectOption;
-
-/** Options for the OData serializer. */
-public class EntitySerializerOptions {
- private ContextURL contextURL;
- private ExpandOption expand;
- private SelectOption select;
-
- /** Gets the {@link ContextURL}. */
- public ContextURL getContextURL() {
- return contextURL;
- }
-
- /** Gets the $expand system query option. */
- public ExpandOption getExpand() {
- return expand;
- }
-
- /** Gets the $select system query option. */
- public SelectOption getSelect() {
- return select;
- }
-
- private EntitySerializerOptions() {}
-
- /** Initializes the options builder. */
- public static final Builder with() {
- return new Builder();
- }
-
- /** Builder of OData serializer options. */
- public static final class Builder {
-
- private EntitySerializerOptions options;
-
- private Builder() {
- options = new EntitySerializerOptions();
- }
-
- /** Sets the {@link ContextURL}. */
- public Builder contextURL(final ContextURL contextURL) {
- options.contextURL = contextURL;
- return this;
- }
-
- /** Sets the $expand system query option. */
- public Builder expand(final ExpandOption expand) {
- options.expand = expand;
- return this;
- }
-
- /** Sets the $select system query option. */
- public Builder select(final SelectOption select) {
- options.select = select;
- return this;
- }
-
- /** Builds the OData serializer options. */
- public EntitySerializerOptions build() {
- return options;
- }
- }
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/FixedFormatSerializer.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/FixedFormatSerializer.java
deleted file mode 100644
index 19ae37d..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/FixedFormatSerializer.java
+++ /dev/null
@@ -1,55 +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.api.serializer;
-
-import java.io.InputStream;
-import java.util.List;
-
-import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
-import org.apache.olingo.server.api.batch.exception.BatchSerializerException;
-import org.apache.olingo.server.api.deserializer.batch.ODataResponsePart;
-
-/** OData serializer for fixed output formats. */
-public interface FixedFormatSerializer {
-
- /**
- * Writes binary output into an InputStream.
- * @param binary the binary data
- */
- InputStream binary(byte[] binary) throws SerializerException;
-
- /**
- * Writes a count into an InputStream as plain text.
- * @param count the count
- */
- InputStream count(Integer count) throws SerializerException;
-
- /**
- * Writes the raw value of a primitive-type instance into an InputStream.
- * @param type the primitive type
- * @param value the value
- * @param options options for the serializer
- */
- InputStream primitiveValue(EdmPrimitiveType type, Object value, PrimitiveValueSerializerOptions options)
- throws SerializerException;
-
- // TODO: Document
- // TODO: Return type
- InputStream batchResponse(List<ODataResponsePart> batchResponses, String boundary) throws BatchSerializerException;
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/ODataSerializer.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/ODataSerializer.java
deleted file mode 100644
index 72f8ee8..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/ODataSerializer.java
+++ /dev/null
@@ -1,112 +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.api.serializer;
-
-import java.io.InputStream;
-
-import org.apache.olingo.commons.api.data.Entity;
-import org.apache.olingo.commons.api.data.EntitySet;
-import org.apache.olingo.commons.api.data.Property;
-import org.apache.olingo.commons.api.edm.Edm;
-import org.apache.olingo.commons.api.edm.EdmComplexType;
-import org.apache.olingo.commons.api.edm.EdmEntityType;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
-import org.apache.olingo.server.api.ODataServerError;
-import org.apache.olingo.server.api.ServiceMetadata;
-
-/** OData serializer */
-public interface ODataSerializer {
-
- /** The default character set is UTF-8. */
- public static final String DEFAULT_CHARSET = "UTF-8";
-
- /**
- * Writes the service document into an InputStream.
- * @param edm the Entity Data Model
- * @param serviceRoot the service-root URI of this OData service
- */
- InputStream serviceDocument(Edm edm, String serviceRoot) throws SerializerException;
-
- /**
- * Writes the metadata document into an InputStream.
- * @param serviceMetadata the metadata information for the service
- */
- InputStream metadataDocument(ServiceMetadata serviceMetadata) throws SerializerException;
-
- /**
- * Writes an ODataError into an InputStream.
- * @param error the main error
- * @return inputStream containing the OData-formatted error
- */
- InputStream error(ODataServerError error) throws SerializerException;
-
- /**
- * Writes entity-collection data into an InputStream.
- * @param entityType the {@link EdmEntityType}
- * @param entitySet the data of the entity set
- * @param options options for the serializer
- */
- InputStream entityCollection(EdmEntityType entityType, EntitySet entitySet,
- EntityCollectionSerializerOptions options) throws SerializerException;
-
- /**
- * Writes entity data into an InputStream.
- * @param entityType the {@link EdmEntityType}
- * @param entity the data of the entity
- * @param options options for the serializer
- */
- InputStream entity(EdmEntityType entityType, Entity entity, EntitySerializerOptions options)
- throws SerializerException;
-
- /**
- * Writes primitive-type instance data into an InputStream.
- * @param type primitive type
- * @param property property value
- * @param options options for the serializer
- */
- InputStream primitive(EdmPrimitiveType type, Property property, PrimitiveSerializerOptions options)
- throws SerializerException;
-
- /**
- * Writes complex-type instance data into an InputStream.
- * @param type complex type
- * @param property property value
- * @param options options for the serializer
- */
- InputStream complex(EdmComplexType type, Property property, ComplexSerializerOptions options)
- throws SerializerException;
-
- /**
- * Writes data of a collection of primitive-type instances into an InputStream.
- * @param type primitive type
- * @param property property value
- * @param options options for the serializer
- */
- InputStream primitiveCollection(EdmPrimitiveType type, Property property, PrimitiveSerializerOptions options)
- throws SerializerException;
-
- /**
- * Writes data of a collection of complex-type instances into an InputStream.
- * @param type complex type
- * @param property property value
- * @param options options for the serializer
- */
- InputStream complexCollection(EdmComplexType type, Property property, ComplexSerializerOptions options)
- throws SerializerException;
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/PrimitiveSerializerOptions.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/PrimitiveSerializerOptions.java
deleted file mode 100644
index 9339592..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/PrimitiveSerializerOptions.java
+++ /dev/null
@@ -1,131 +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.api.serializer;
-
-import org.apache.olingo.commons.api.data.ContextURL;
-import org.apache.olingo.commons.api.edm.EdmProperty;
-
-/** Options for the OData serializer. */
-public class PrimitiveSerializerOptions {
-
- private ContextURL contextURL;
- private Boolean isNullable;
- private Integer maxLength;
- private Integer precision;
- private Integer scale;
- private Boolean isUnicode;
-
- /** Gets the {@link ContextURL}. */
- public ContextURL getContextURL() {
- return contextURL;
- }
-
- /** Gets the nullable facet. */
- public Boolean isNullable() {
- return isNullable;
- }
-
- /** Gets the maxLength facet. */
- public Integer getMaxLength() {
- return maxLength;
- }
-
- /** Gets the precision facet. */
- public Integer getPrecision() {
- return precision;
- }
-
- /** Gets the scale facet. */
- public Integer getScale() {
- return scale;
- }
-
- /** Gets the unicode facet. */
- public Boolean isUnicode() {
- return isUnicode;
- }
-
- private PrimitiveSerializerOptions() {}
-
- /** Initializes the options builder. */
- public static Builder with() {
- return new Builder();
- }
-
- /** Builder of OData serializer options. */
- public static final class Builder {
-
- private PrimitiveSerializerOptions options;
-
- private Builder() {
- options = new PrimitiveSerializerOptions();
- }
-
- /** Sets the {@link ContextURL}. */
- public Builder contextURL(final ContextURL contextURL) {
- options.contextURL = contextURL;
- return this;
- }
-
- /** Sets the nullable facet. */
- public Builder nullable(final Boolean isNullable) {
- options.isNullable = isNullable;
- return this;
- }
-
- /** Sets the maxLength facet. */
- public Builder maxLength(final Integer maxLength) {
- options.maxLength = maxLength;
- return this;
- }
-
- /** Sets the precision facet. */
- public Builder precision(final Integer precision) {
- options.precision = precision;
- return this;
- }
-
- /** Sets the scale facet. */
- public Builder scale(final Integer scale) {
- options.scale = scale;
- return this;
- }
-
- /** Sets the unicode facet. */
- public Builder unicode(final Boolean isUnicode) {
- options.isUnicode = isUnicode;
- return this;
- }
-
- /** Sets all facets from an EDM property. */
- public Builder facetsFrom(final EdmProperty property) {
- options.isNullable = property.isNullable();
- options.maxLength = property.getMaxLength();
- options.precision = property.getPrecision();
- options.scale = property.getScale();
- options.isUnicode = property.isUnicode();
- return this;
- }
-
- /** Builds the OData serializer options. */
- public PrimitiveSerializerOptions build() {
- return options;
- }
- }
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/PrimitiveValueSerializerOptions.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/PrimitiveValueSerializerOptions.java
deleted file mode 100644
index e84aaa4..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/PrimitiveValueSerializerOptions.java
+++ /dev/null
@@ -1,118 +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.api.serializer;
-
-import org.apache.olingo.commons.api.edm.EdmProperty;
-
-/** Options for the OData serializer. */
-public class PrimitiveValueSerializerOptions {
-
- private Boolean isNullable;
- private Integer maxLength;
- private Integer precision;
- private Integer scale;
- private Boolean isUnicode;
-
- /** Gets the nullable facet. */
- public Boolean isNullable() {
- return isNullable;
- }
-
- /** Gets the maxLength facet. */
- public Integer getMaxLength() {
- return maxLength;
- }
-
- /** Gets the precision facet. */
- public Integer getPrecision() {
- return precision;
- }
-
- /** Gets the scale facet. */
- public Integer getScale() {
- return scale;
- }
-
- /** Gets the unicode facet. */
- public Boolean isUnicode() {
- return isUnicode;
- }
-
- private PrimitiveValueSerializerOptions() {}
-
- /** Initializes the options builder. */
- public static Builder with() {
- return new Builder();
- }
-
- /** Builder of OData serializer options. */
- public static final class Builder {
-
- private PrimitiveValueSerializerOptions options;
-
- private Builder() {
- options = new PrimitiveValueSerializerOptions();
- }
-
- /** Sets the nullable facet. */
- public Builder nullable(final Boolean isNullable) {
- options.isNullable = isNullable;
- return this;
- }
-
- /** Sets the maxLength facet. */
- public Builder maxLength(final Integer maxLength) {
- options.maxLength = maxLength;
- return this;
- }
-
- /** Sets the precision facet. */
- public Builder precision(final Integer precision) {
- options.precision = precision;
- return this;
- }
-
- /** Sets the scale facet. */
- public Builder scale(final Integer scale) {
- options.scale = scale;
- return this;
- }
-
- /** Sets the unicode facet. */
- public Builder unicode(final Boolean isUnicode) {
- options.isUnicode = isUnicode;
- return this;
- }
-
- /** Sets all facets from an EDM property. */
- public Builder facetsFrom(final EdmProperty property) {
- options.isNullable = property.isNullable();
- options.maxLength = property.getMaxLength();
- options.precision = property.getPrecision();
- options.scale = property.getScale();
- options.isUnicode = property.isUnicode();
- return this;
- }
-
- /** Builds the OData serializer options. */
- public PrimitiveValueSerializerOptions build() {
- return options;
- }
- }
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/RepresentationType.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/RepresentationType.java
deleted file mode 100644
index 22efa28..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/RepresentationType.java
+++ /dev/null
@@ -1,44 +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.api.serializer;
-
-/**
- * The different types of representations that form the body of either the
- * OData request or the OData response, primarily used for content negotiation.
- */
-public enum RepresentationType {
- /** service document */ SERVICE,
- /** metadata document */ METADATA,
- /** batch request or response */ BATCH,
- /** error document */ ERROR,
- /** single entity */ ENTITY,
- /** collection of entities (entity set) */ COLLECTION_ENTITY,
- /** single primitive-type instance */ PRIMITIVE,
- /** collection of primitive-type instances */ COLLECTION_PRIMITIVE,
- /** single complex-type instance */ COMPLEX,
- /** collection of complex-type instances */ COLLECTION_COMPLEX,
- /** differences */ DIFFERENCES,
- /** media entity */ MEDIA,
- /** binary-type instance */ BINARY,
- /** single reference */ REFERENCE,
- /** collection of references */ COLLECTION_REFERENCE,
- /** textual raw value of a primitive-type instance (except binary) */ VALUE,
- /** count of instances */ COUNT,
- /** parameters of an action */ ACTION_PARAMETERS
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/SerializerException.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/SerializerException.java
deleted file mode 100644
index 1583241..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/serializer/SerializerException.java
+++ /dev/null
@@ -1,75 +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.api.serializer;
-
-import org.apache.olingo.server.api.ODataTranslatedException;
-
-/** Exception thrown by the {@link ODataSerializer}. */
-public class SerializerException extends ODataTranslatedException {
-
- private static final long serialVersionUID = 5358683245923127425L;
-
- /** Keys for exception texts in the resource bundle. */
- public static enum MessageKeys implements MessageKey {
- NOT_IMPLEMENTED,
- /** parameter: format */ UNSUPPORTED_FORMAT,
- JSON_METADATA,
- IO_EXCEPTION,
- NULL_INPUT,
- NO_CONTEXT_URL,
- /** parameter: property name */ UNSUPPORTED_PROPERTY_TYPE,
- /** parameter: property name */ INCONSISTENT_PROPERTY_TYPE,
- /** parameter: property name */ MISSING_PROPERTY,
- /** parameters: property name, property value */ WRONG_PROPERTY_VALUE,
- /** parameters: primitive-type name, value */ WRONG_PRIMITIVE_VALUE;
-
- @Override
- public String getKey() {
- return name();
- }
- }
-
- /**
- * Creates serializer exception.
- * @param developmentMessage message text as fallback and for debugging purposes
- * @param messageKey one of the {@link MessageKeys} for the exception text in the resource bundle
- * @param parameters parameters for the exception text
- */
- public SerializerException(final String developmentMessage,
- final MessageKey messageKey, final String... parameters) {
- super(developmentMessage, messageKey, parameters);
- }
-
- /**
- * Creates serializer exception.
- * @param developmentMessage message text as fallback and for debugging purposes
- * @param cause the cause of this exception
- * @param messageKey one of the {@link MessageKeys} for the exception text in the resource bundle
- * @param parameters parameters for the exception text
- */
- public SerializerException(final String developmentMessage, final Throwable cause,
- final MessageKey messageKey, final String... parameters) {
- super(developmentMessage, cause, messageKey, parameters);
- }
-
- @Override
- protected String getBundleName() {
- return DEFAULT_SERVER_BUNDLE_NAME;
- }
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriHelper.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriHelper.java
deleted file mode 100644
index 16ec276..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriHelper.java
+++ /dev/null
@@ -1,59 +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.api.uri;
-
-import java.util.List;
-
-import org.apache.olingo.commons.api.data.Entity;
-import org.apache.olingo.commons.api.edm.EdmEntitySet;
-import org.apache.olingo.commons.api.edm.EdmStructuredType;
-import org.apache.olingo.server.api.serializer.SerializerException;
-import org.apache.olingo.server.api.uri.queryoption.ExpandOption;
-import org.apache.olingo.server.api.uri.queryoption.SelectOption;
-
-/**
- * Used for URI-related tasks.
- */
-public interface UriHelper {
-
- /**
- * Builds the select-list part of a {@link org.apache.olingo.commons.api.data.ContextURL ContextURL}.
- * @param type the {@link EdmStructuredType}
- * @param expand the $expand option
- * @param select the $select option
- * @return a String with the select list
- */
- String buildContextURLSelectList(EdmStructuredType type, ExpandOption expand, SelectOption select)
- throws SerializerException;
-
- /**
- * Builds the key-predicate part of a {@link org.apache.olingo.commons.api.data.ContextURL ContextURL}.
- * @param keys the keys as a list of {@link UriParameter} instances
- * @return a String with the key predicate
- */
- String buildContextURLKeyPredicate(List<UriParameter> keys) throws SerializerException;
-
- /**
- * Builds the relative canonical URL for the given entity in the given entity set.
- * @param edmEntitySet the entity set
- * @param entity the entity data
- * @return the relative canonical URL
- */
- String buildCanonicalURL(EdmEntitySet edmEntitySet, Entity entity) throws SerializerException;
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriInfo.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriInfo.java
deleted file mode 100644
index a4af588..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriInfo.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.api.uri;
-
-import org.apache.olingo.server.api.uri.queryoption.SystemQueryOption;
-
-import java.util.Collection;
-
-/**
- * Object acting as general access to URI information extracted from the request URI. Depending on
- * the URI info kind different interfaces are used to provide access to that information. </p>
- * Use method {@link #getKind()} to obtain URI info kind information and to perform an appropriate cast.
- */
-public interface UriInfo extends
- UriInfoService, UriInfoAll, UriInfoBatch, UriInfoCrossjoin,
- UriInfoEntityId, UriInfoMetadata, UriInfoResource {
-
- public UriInfoKind getKind();
-
- public UriInfoService asUriInfoService();
-
- public UriInfoAll asUriInfoAll();
-
- public UriInfoBatch asUriInfoBatch();
-
- public UriInfoCrossjoin asUriInfoCrossjoin();
-
- public UriInfoEntityId asUriInfoEntityId();
-
- public UriInfoMetadata asUriInfoMetadata();
-
- public UriInfoResource asUriInfoResource();
-
- public Collection<SystemQueryOption> getSystemQueryOptions();
-
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriInfoAll.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriInfoAll.java
deleted file mode 100644
index d76eb55..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriInfoAll.java
+++ /dev/null
@@ -1,27 +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.api.uri;
-
-/**
- * Used for URI info kind {@link UriInfoKind#all} to describe URIs like
- * http://.../serviceroot/$all
- */
-public interface UriInfoAll {
-
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriInfoBatch.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriInfoBatch.java
deleted file mode 100644
index 3d31838..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriInfoBatch.java
+++ /dev/null
@@ -1,27 +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.api.uri;
-
-/**
- * Used for URI info kind {@link UriInfoKind#batch} to describe URIs like
- * http://.../serviceroot/$batch
- */
-public interface UriInfoBatch {
-
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriInfoCrossjoin.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriInfoCrossjoin.java
deleted file mode 100644
index 1352486..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriInfoCrossjoin.java
+++ /dev/null
@@ -1,34 +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.api.uri;
-
-import java.util.List;
-
-/**
- * Used for URI info kind {@link UriInfoKind#crossjoin} to describe URIs like
- * http://.../serviceroot/$crossjoin(...)
- */
-public interface UriInfoCrossjoin {
-
- /**
- * @return List of entity set names
- */
- List<String> getEntitySetNames();
-
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriInfoEntityId.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriInfoEntityId.java
deleted file mode 100644
index 3412517..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriInfoEntityId.java
+++ /dev/null
@@ -1,68 +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.api.uri;
-
-import org.apache.olingo.commons.api.edm.EdmEntityType;
-import org.apache.olingo.server.api.uri.queryoption.CustomQueryOption;
-import org.apache.olingo.server.api.uri.queryoption.ExpandOption;
-import org.apache.olingo.server.api.uri.queryoption.FormatOption;
-import org.apache.olingo.server.api.uri.queryoption.IdOption;
-import org.apache.olingo.server.api.uri.queryoption.SelectOption;
-
-import java.util.List;
-
-/**
- * Used for URI info kind {@link UriInfoKind#entityId} to describe URIs like
- * http://.../serviceroot/$entity...
- */
-public interface UriInfoEntityId {
-
- /**
- * @return List of custom query options used in the URI
- */
- public List<CustomQueryOption> getCustomQueryOptions();
-
- /**
- * Behind $entity a optional type cast can be used in the URI.
- * For example: http://.../serviceroot/$entity/namespace.entitytype
- * @return Type cast if found, otherwise null
- */
- public EdmEntityType getEntityTypeCast();
-
- /**
- * @return Object containing information of the $expand option
- */
- public ExpandOption getExpandOption();
-
- /**
- * @return Object containing information of the $format option
- */
- public FormatOption getFormatOption();
-
- /**
- * @return Object containing information of the $id option
- */
- public IdOption getIdOption();
-
- /**
- * @return Object containing information of the $select option
- */
- public SelectOption getSelectOption();
-
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriInfoKind.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriInfoKind.java
deleted file mode 100644
index bb13374..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriInfoKind.java
+++ /dev/null
@@ -1,67 +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.api.uri;
-
-/**
- * Defining the various info kinds
- */
-public enum UriInfoKind {
-
- /**
- * Class: {@link UriInfoAll}<br>
- * URI: http://.../serviceroot/$all
- */
- all,
-
- /**
- * Class: {@link UriInfoBatch}<br>
- * URI: http://.../serviceroot/$batch
- */
- batch,
-
- /**
- * Class: {@link UriInfoCrossjoin}<br>
- * URI: http://.../serviceroot/$crossjoin
- */
- crossjoin,
-
- /**
- * Class: {@link UriInfoEntityId}<br>
- * URI: http://.../serviceroot/$entity(...)
- */
- entityId,
-
- /**
- * Class: {@link UriInfoMetadata}<br>
- * URI: http://.../serviceroot/$metadata...
- */
- metadata,
-
- /**
- * Class: {@link UriInfoResource}<br>
- * URI: http://.../serviceroot/entitySet
- */
- resource,
-
- /**
- * Class: {@link UriInfoService}<br>
- * URI: http://.../serviceroot
- */
- service;
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriInfoMetadata.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriInfoMetadata.java
deleted file mode 100644
index 8906a64..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriInfoMetadata.java
+++ /dev/null
@@ -1,39 +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.api.uri;
-
-import org.apache.olingo.server.api.uri.queryoption.FormatOption;
-
-/**
- * Used for URI info kind {@link UriInfoKind#metadata} to describe URIs like
- * http://.../serviceroot/$metadata...
- */
-public interface UriInfoMetadata {
-
- /**
- * @return Object containing information of the $id option
- */
- public FormatOption getFormatOption();
-
- /**
- * @return Object containing information of the URI fragment
- */
- public String getFragment();
-
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriInfoResource.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriInfoResource.java
deleted file mode 100644
index 7a62c36..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriInfoResource.java
+++ /dev/null
@@ -1,124 +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.api.uri;
-
-import org.apache.olingo.server.api.uri.queryoption.CountOption;
-import org.apache.olingo.server.api.uri.queryoption.CustomQueryOption;
-import org.apache.olingo.server.api.uri.queryoption.ExpandOption;
-import org.apache.olingo.server.api.uri.queryoption.FilterOption;
-import org.apache.olingo.server.api.uri.queryoption.FormatOption;
-import org.apache.olingo.server.api.uri.queryoption.IdOption;
-import org.apache.olingo.server.api.uri.queryoption.OrderByOption;
-import org.apache.olingo.server.api.uri.queryoption.SearchOption;
-import org.apache.olingo.server.api.uri.queryoption.SelectOption;
-import org.apache.olingo.server.api.uri.queryoption.SkipOption;
-import org.apache.olingo.server.api.uri.queryoption.SkipTokenOption;
-import org.apache.olingo.server.api.uri.queryoption.TopOption;
-
-import java.util.List;
-
-/**
- * Used for URI info kind {@link UriInfoKind#resource} to describe URIs like
- * E.g. http://.../serviceroot/entitySet
- */
-public interface UriInfoResource {
-
- /**
- * @return List of custom query options used in the URI
- */
- List<CustomQueryOption> getCustomQueryOptions();
-
- /**
- * @return Object containing information of the $expand option
- */
- ExpandOption getExpandOption();
-
- /**
- * @return Object containing information of the $filter option
- */
- FilterOption getFilterOption();
-
- /**
- * @return Object containing information of the $format option
- */
- FormatOption getFormatOption();
-
- /**
- * @return Object containing information of the $id option
- */
- IdOption getIdOption();
-
- /**
- * @return Object containing information of the $count option
- */
- CountOption getCountOption();
-
- /**
- * @return Object containing information of the $orderby option
- */
- OrderByOption getOrderByOption();
-
- /**
- * @return Object containing information of the $search option
- */
- SearchOption getSearchOption();
-
- /**
- * @return Object containing information of the $select option
- */
- SelectOption getSelectOption();
-
- /**
- * @return Object containing information of the $skip option
- */
- SkipOption getSkipOption();
-
- /**
- * @return Object containing information of the $skiptoken option
- */
- SkipTokenOption getSkipTokenOption();
-
- /**
- * @return Object containing information of the $top option
- */
- TopOption getTopOption();
-
- /**
- * The path segments behind the service root define which resources are
- * requested by that URI. This may be entities/functions/actions and more.
- * Each segments information (name, key predicates, function parameters, ...) is
- * stored within an resource object dedicated for that segment type.</p>
- * For example: the URI http://.../serviceroot/entitySet(1)/Adresse will
- * have 2 ResourceParts:<br>
- * - The first one of type {@link UriResourceEntitySet} containing the name of the entity set and also the key
- * predicate information.<br>
- * - The second one of type {@link UriResourceComplexProperty} containing the name of
- * the accessed complex property
- *
- * @return List of resource parts.
- */
- List<UriResource> getUriResourceParts();
-
- /**
- * @param alias
- * @return the value for the given alias or null if no value is defined
- */
- String getValueForAlias(String alias);
-
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriInfoService.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriInfoService.java
deleted file mode 100644
index 137a986..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriInfoService.java
+++ /dev/null
@@ -1,27 +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.api.uri;
-
-/**
- * Used for URI info kind {@link UriInfoKind#service} to describe URIs like
- * http://.../serviceroot
- */
-public interface UriInfoService {
-
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriParameter.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriParameter.java
deleted file mode 100644
index 9f3d45f..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriParameter.java
+++ /dev/null
@@ -1,53 +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.api.uri;
-
-import org.apache.olingo.server.api.uri.queryoption.expression.Expression;
-
-/**
- * Represents an function parameter or key predicate when used in the URI.
- */
-public interface UriParameter {
-
- /**
- * @return Alias name if the parameters values is an alias, otherwise null
- */
- public String getAlias();
-
- /**
- * @return Text of the parameters value
- */
- public String getText();
-
- /**
- * @return If the parameters value is a expression and expression is returned, otherwise null
- */
- public Expression getExpression();
-
- /**
- * @return Name of the parameter
- */
- public String getName();
-
- /**
- * @return Name of the referenced property when referential constrains are used
- */
- public String getReferencedProperty();
-
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriResource.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriResource.java
deleted file mode 100644
index 468b15c..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriResource.java
+++ /dev/null
@@ -1,35 +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.api.uri;
-
-/**
- * Super interface for all objects representing resource parts.
- * See {@link UriInfoResource} for details.
- */
-public interface UriResource {
-
- /**
- * @return Kind of the resource part
- */
- UriResourceKind getKind();
-
- @Override
- String toString();
-
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriResourceAction.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriResourceAction.java
deleted file mode 100644
index 3ba7ce7..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriResourceAction.java
+++ /dev/null
@@ -1,42 +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.api.uri;
-
-import org.apache.olingo.commons.api.edm.EdmAction;
-import org.apache.olingo.commons.api.edm.EdmActionImport;
-
-/**
- * Used to describe an action used within an resource path
- * For example: http://.../serviceroot/action()
- */
-public interface UriResourceAction extends UriResourcePartTyped {
-
- /**
- * @return Action used in the resource path
- */
- EdmAction getAction();
-
- /**
- * Convenience method which returns the {@link EdmActionImport} which was used in
- * the resource path to define the {@link EdmAction}.
- * @return Action Import used in the resource path
- */
- EdmActionImport getActionImport();
-
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriResourceComplexProperty.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriResourceComplexProperty.java
deleted file mode 100644
index 5a1f0ae..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriResourceComplexProperty.java
+++ /dev/null
@@ -1,41 +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.api.uri;
-
-import org.apache.olingo.commons.api.edm.EdmComplexType;
-
-/**
- * Used to describe an complex property used within an resource path
- * E.g. http://.../serviceroot/entityset(1)/complexproperty
- */
-public interface UriResourceComplexProperty extends UriResourceProperty {
-
- /**
- * @return Complex property used in the resource path
- */
- EdmComplexType getComplexType();
-
- /**
- * Behind a complex property may be a type filter
- * E.g. http://.../serviceroot/entityset(1)/complexproperty/namespace.complextype
- * @return Type filter if found, otherwise null
- */
- EdmComplexType getComplexTypeFilter();
-
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriResourceCount.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriResourceCount.java
deleted file mode 100644
index ba77d2c..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriResourceCount.java
+++ /dev/null
@@ -1,27 +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.api.uri;
-
-/**
- * Used to describe an $count used within an resource path
- * For example: http://.../serviceroot/entityset(1)/$count
- */
-public interface UriResourceCount extends UriResource {
-
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriResourceEntitySet.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriResourceEntitySet.java
deleted file mode 100644
index d7f35fb..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriResourceEntitySet.java
+++ /dev/null
@@ -1,58 +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.api.uri;
-
-import org.apache.olingo.commons.api.edm.EdmEntitySet;
-import org.apache.olingo.commons.api.edm.EdmEntityType;
-import org.apache.olingo.commons.api.edm.EdmType;
-
-import java.util.List;
-
-/**
- * Used to describe an entity set used within an resource path
- * For example: http://.../serviceroot/entityset(1)
- */
-public interface UriResourceEntitySet extends UriResourcePartTyped {
-
- /**
- * @return Entity set used in the resource path
- */
- EdmEntitySet getEntitySet();
-
- /**
- * @return Type of the entity set
- */
- EdmEntityType getEntityType();
-
- /**
- * @return Key predicates if used, otherwise null
- */
- List<UriParameter> getKeyPredicates();
-
- /**
- * @return Type filter before key predicates if used, otherwise null
- */
- EdmType getTypeFilterOnCollection();
-
- /**
- * @return Type filter behind key predicates if used, otherwise null
- */
- EdmType getTypeFilterOnEntry();
-
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriResourceFunction.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriResourceFunction.java
deleted file mode 100644
index 00db971..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriResourceFunction.java
+++ /dev/null
@@ -1,65 +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.api.uri;
-
-import org.apache.olingo.commons.api.edm.EdmFunction;
-import org.apache.olingo.commons.api.edm.EdmFunctionImport;
-import org.apache.olingo.commons.api.edm.EdmType;
-
-import java.util.List;
-
-/**
- * Used to describe an function import or bound function used within an resource path
- * For example: http://.../serviceroot/functionImport(P1=1,P2='A')
- */
-public interface UriResourceFunction extends UriResourcePartTyped {
-
- /**
- * @return Function used in the resource path
- */
- EdmFunction getFunction();
-
- /**
- * Convenience method which returns the {@link EdmFunctionImport} which was used in
- * the resource path to define the {@link EdmFunction}.
- * @return Function Import used in the resource path
- */
- EdmFunctionImport getFunctionImport();
-
- /**
- * @return Key predicates if used, otherwise null
- */
- List<UriParameter> getKeyPredicates();
-
- /**
- * @return List of function parameters
- */
- List<UriParameter> getParameters();
-
- /**
- * @return Type filter before key predicates if used, otherwise null
- */
- EdmType getTypeFilterOnCollection();
-
- /**
- * @return Type filter behind key predicates if used, otherwise null
- */
- EdmType getTypeFilterOnEntry();
-
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriResourceIt.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriResourceIt.java
deleted file mode 100644
index c61ce19..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriResourceIt.java
+++ /dev/null
@@ -1,38 +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.api.uri;
-
-import org.apache.olingo.commons.api.edm.EdmType;
-
-/**
- * Class indicating the $it reference. $it may be used within expression to
- * refer to the last EDM object referenced in the resource path.
- */
-public interface UriResourceIt extends UriResourcePartTyped {
-
- /**
- * @return Type filter if $it refers to a collection
- */
- EdmType getTypeFilterOnCollection();
-
- /**
- * @return Type filter if $it refers to a single entry
- */
- EdmType getTypeFilterOnEntry();
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriResourceKind.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriResourceKind.java
deleted file mode 100644
index 9e65dc1..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriResourceKind.java
+++ /dev/null
@@ -1,115 +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.api.uri;
-
-/**
- * Defining the various resource part types
- */
-public enum UriResourceKind {
-
- /**
- * Class: {@link UriResourceAction}<br>
- * URI: http://.../serviceroot/action()
- */
- action,
-
- /**
- * Class: {@link UriResourceComplexProperty}<br>
- * URI: http://.../serviceroot/entityset(1)/complexproperty()
- */
- complexProperty,
-
- /**
- * Class: {@link UriResourceCount}<br>
- * URI: http://.../serviceroot/entityset/$count
- */
- count,
-
- /**
- * Class: {@link UriResourceEntitySet}<br>
- * URI: http://.../serviceroot/entityset
- */
- entitySet,
-
- /**
- * Class: {@link UriResourceFunction}<br>
- * URI: http://.../serviceroot/functionimport(P1=1,P2='a')
- */
- function,
-
- /**
- * Class: {@link UriResourceIt}<br>
- * URI: http://.../serviceroot/entityset?$filter=$it/property
- */
- it,
-
- /**
- * Class: {@link UriResourceLambdaAll}<br>
- * URI: http://.../serviceroot/entityset/all(...)
- */
- lambdaAll,
-
- /**
- * Class: {@link UriResourceLambdaAny}<br>
- * URI: http://.../serviceroot/entityset/any(...)
- */
- lambdaAny,
-
- /**
- * Class: {@link UriResourceLambdaVariable}<br>
- * URI: http://.../serviceroot/entityset/listofstring/any(d: 'string' eq d)
- */
- lambdaVariable,
-
- /**
- * Class: {@link UriResourceNavigation}<br>
- * URI: http://.../serviceroot/entityset(1)/navProperty
- */
- navigationProperty,
-
- /**
- * Class: {@link UriResourceRef}<br>
- * URI: http://.../serviceroot/entityset/$ref
- */
- ref,
-
- /**
- * Class: {@link UriResourceRoot}<br>
- * URI: http://.../serviceroot/entityset(1)?$filter=property eq $root/singleton/configstring
- */
- root,
-
- /**
- * Class: {@link UriResourceProperty}<br>
- * URI: http://.../serviceroot/entityset(1)/property
- */
- primitiveProperty,
-
- /**
- * Class: {@link UriResourceSingleton}<br>
- * URI: http://.../serviceroot/singleton
- */
- singleton,
-
- /**
- * Class: {@link UriResourceValue}<br>
- * URI: http://.../serviceroot/entityset(1)/property/$value
- */
- value,
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriResourceLambdaAll.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriResourceLambdaAll.java
deleted file mode 100644
index 328d59b..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriResourceLambdaAll.java
+++ /dev/null
@@ -1,39 +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.api.uri;
-
-import org.apache.olingo.server.api.uri.queryoption.expression.Expression;
-
-/**
- * Used to describe an all lambda expression used within an resource path
- * For example: http://.../serviceroot/entityset/all(...)
- */
-public interface UriResourceLambdaAll extends UriResourcePartTyped {
-
- /**
- * @return Name of the lambda variable
- */
- public String getLambdaVariable();
-
- /**
- * @return Lambda expression
- */
- public Expression getExpression();
-
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriResourceLambdaAny.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriResourceLambdaAny.java
deleted file mode 100644
index 2d1408d..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriResourceLambdaAny.java
+++ /dev/null
@@ -1,39 +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.api.uri;
-
-import org.apache.olingo.server.api.uri.queryoption.expression.Expression;
-
-/**
- * Used to describe an any lambda expression used within an resource path
- * For example: http://.../serviceroot/entityset/any(...)
- */
-public interface UriResourceLambdaAny extends UriResourcePartTyped {
-
- /**
- * @return Name of the lambda variable
- */
- public String getLamdaVariable();
-
- /**
- * @return Lambda expression
- */
- public Expression getExpression();
-
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriResourceLambdaVariable.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriResourceLambdaVariable.java
deleted file mode 100644
index db60dd4..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriResourceLambdaVariable.java
+++ /dev/null
@@ -1,32 +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.api.uri;
-
-/**
- * Used to describe an lambda variable used within an resource path
- * For example: http://.../serviceroot/entityset/listofstring/any(d: 'string' eq d)
- */
-public interface UriResourceLambdaVariable extends UriResourcePartTyped {
-
- /**
- * @return Name of the lambda variable
- */
- public String getVariableName();
-
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriResourceNavigation.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriResourceNavigation.java
deleted file mode 100644
index 9139edf..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriResourceNavigation.java
+++ /dev/null
@@ -1,51 +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.api.uri;
-
-import org.apache.olingo.commons.api.edm.EdmNavigationProperty;
-import org.apache.olingo.commons.api.edm.EdmType;
-
-import java.util.List;
-
-/**
- * Used to describe an navigation property used within an resource path
- * For example: http://.../serviceroot/entityset(1)/navProperty
- */
-public interface UriResourceNavigation extends UriResourcePartTyped {
-
- /**
- * @return Navigation property
- */
- EdmNavigationProperty getProperty();
-
- /**
- * @return Key predicates if used, otherwise null
- */
- List<UriParameter> getKeyPredicates();
-
- /**
- * @return Type filter before key predicates if used, otherwise null
- */
- EdmType getTypeFilterOnCollection();
-
- /**
- * @return Type filter behind key predicates if used, otherwise null
- */
- EdmType getTypeFilterOnEntry();
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriResourcePartTyped.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriResourcePartTyped.java
deleted file mode 100644
index 0b624f2..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriResourcePartTyped.java
+++ /dev/null
@@ -1,43 +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.api.uri;
-
-import org.apache.olingo.commons.api.edm.EdmType;
-
-/**
- * Used to describe an typed resource part (super interface)
- */
-public interface UriResourcePartTyped extends UriResource {
-
- /**
- * @return Type of the resource part
- */
- EdmType getType();
-
- /**
- * @return True if the resource part is a collection, otherwise false
- */
- boolean isCollection();
-
- /**
- * @return String representation of the type
- */
- String toString(boolean includeFilters);
-
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriResourcePrimitiveProperty.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriResourcePrimitiveProperty.java
deleted file mode 100644
index dccd8d4..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriResourcePrimitiveProperty.java
+++ /dev/null
@@ -1,27 +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.api.uri;
-
-/**
- * Used to describe an primitive property used within an resource path
- * For example: http://.../serviceroot/entityset(1)/property
- */
-public interface UriResourcePrimitiveProperty extends UriResourceProperty {
-
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriResourceProperty.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriResourceProperty.java
deleted file mode 100644
index c9f7f85..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriResourceProperty.java
+++ /dev/null
@@ -1,33 +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.api.uri;
-
-import org.apache.olingo.commons.api.edm.EdmProperty;
-
-/**
- * Used to describe an resource part which is an property (super interface)
- */
-public interface UriResourceProperty extends UriResourcePartTyped {
-
- /**
- * @return Property used in the resource path
- */
- EdmProperty getProperty();
-
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriResourceRef.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriResourceRef.java
deleted file mode 100644
index 7051028..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriResourceRef.java
+++ /dev/null
@@ -1,27 +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.api.uri;
-
-/**
- * Used to describe an $ref used within an resource path
- * For example: http://.../serviceroot/entityset/$ref
- */
-public interface UriResourceRef extends UriResource {
-
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriResourceRoot.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriResourceRoot.java
deleted file mode 100644
index 3ce942e..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriResourceRoot.java
+++ /dev/null
@@ -1,28 +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.api.uri;
-
-/**
- * Class indicating the $root reference. $root may be used within expressions to
- * refer to the current OData service
- * For example: http://.../serviceroot/entityset(1)?$filter=property eq $root/singleton/configstring
- */
-public interface UriResourceRoot extends UriResource {
-
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriResourceSingleton.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriResourceSingleton.java
deleted file mode 100644
index 89004cc..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriResourceSingleton.java
+++ /dev/null
@@ -1,45 +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.api.uri;
-
-import org.apache.olingo.commons.api.edm.EdmEntityType;
-import org.apache.olingo.commons.api.edm.EdmSingleton;
-
-/**
- * Used to describe an entity set used within an resource path
- * For example: http://.../serviceroot/singleton
- */
-public interface UriResourceSingleton extends UriResourcePartTyped {
-
- /**
- * @return Singleton used in the resource path
- */
- EdmSingleton getSingleton();
-
- /**
- * @return Type of the Singleton
- */
- EdmEntityType getEntityType();
-
- /**
- * @return Type filter
- */
- EdmEntityType getEntityTypeFilter();
-
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriResourceValue.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriResourceValue.java
deleted file mode 100644
index e879b80..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/UriResourceValue.java
+++ /dev/null
@@ -1,27 +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.api.uri;
-
-/**
- * Used to describe an $value used within an resource path
- * For example: http://.../serviceroot/entityset(1)/property/$value
- */
-public interface UriResourceValue extends UriResource {
-
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/AliasQueryOption.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/AliasQueryOption.java
deleted file mode 100644
index 842d0c5..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/AliasQueryOption.java
+++ /dev/null
@@ -1,35 +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.api.uri.queryoption;
-
-import org.apache.olingo.server.api.uri.queryoption.expression.Expression;
-
-/**
- * Represents an alias value defined as query option
- * For example:
- * http://.../?filter=@value eq name&@value='test'
- */
-public interface AliasQueryOption extends QueryOption {
-
- /**
- * @return Value of the alias
- */
- public Expression getValue();
-
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/CountOption.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/CountOption.java
deleted file mode 100644
index 4d78b77..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/CountOption.java
+++ /dev/null
@@ -1,33 +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.api.uri.queryoption;
-
-/**
- * Represents the system query option $count
- * For example:
- * http://.../entitySet?$count=true
- */
-public interface CountOption extends SystemQueryOption {
-
- /**
- * @return Value of $count
- */
- boolean getValue();
-
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/CustomQueryOption.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/CustomQueryOption.java
deleted file mode 100644
index cd01e17..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/CustomQueryOption.java
+++ /dev/null
@@ -1,28 +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.api.uri.queryoption;
-
-/**
- * Represents a custom query option
- * For example:
- * http://.../entitySet?myOption=true
- */
-public interface CustomQueryOption extends QueryOption {
-
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/ExceptionVisitExpand.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/ExceptionVisitExpand.java
deleted file mode 100644
index cd6f452..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/ExceptionVisitExpand.java
+++ /dev/null
@@ -1,25 +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.api.uri.queryoption;
-
-public class ExceptionVisitExpand extends Exception {
-
- private static final long serialVersionUID = 1L;
-
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/ExpandItem.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/ExpandItem.java
deleted file mode 100644
index 6954831..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/ExpandItem.java
+++ /dev/null
@@ -1,98 +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.api.uri.queryoption;
-
-import org.apache.olingo.commons.api.edm.EdmType;
-import org.apache.olingo.server.api.uri.UriInfoResource;
-
-/**
- * Represents a single resource path which should be expanded with using the system query option $expand
- * For example: http://.../entitySet?$expand=Products($filter=DiscontinuedDate eq null)
- */
-public interface ExpandItem {
-
- /**
- * @return Information of the option $level when used within $expand
- */
- LevelsExpandOption getLevelsOption();
-
- /**
- * @return Information of the option $filter when used within $expand
- */
- FilterOption getFilterOption();
-
- /**
- * @return Information of the option $search when used within $expand
- */
- SearchOption getSearchOption();
-
- /**
- * @return Information of the option $orderby when used within $expand
- */
- OrderByOption getOrderByOption();
-
- /**
- * @return Information of the option $skip when used within $expand
- */
- SkipOption getSkipOption();
-
- /**
- * @return Information of the option $top when used within $expand
- */
- TopOption getTopOption();
-
- /**
- * @return Information of the option $count when used within $expand
- */
- CountOption getCountOption();
-
- /**
- * @return Information of the option $select when used within $expand
- */
- SelectOption getSelectOption();
-
- /**
- * @return Information of the option $expand when used within $expand
- */
- ExpandOption getExpandOption();
-
- /**
- * @return A {@link UriInfoResource} object containing the resource path segments to be expanded
- */
- UriInfoResource getResourcePath();
-
- /**
- * @return A star is used within $expand.
- * For example: ...?$expand=*
- */
- boolean isStar();
-
- /**
- * @return A $ref is used within $expand.
- * For example: ...?$expand=$ref
- */
- boolean isRef();
-
- /**
- * @return Before resource path segments which should be expanded a type filter may be used.
- * For example: ...persons?$expand=namespace.managertype/team
- */
- EdmType getStartTypeFilter();
-
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/ExpandOption.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/ExpandOption.java
deleted file mode 100644
index 634802d..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/ExpandOption.java
+++ /dev/null
@@ -1,34 +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.api.uri.queryoption;
-
-import java.util.List;
-
-/**
- * Represents the system query option $expand
- * For example: http://.../entitySet?$expand=Products,Customers
- */
-public interface ExpandOption extends SystemQueryOption {
-
- /**
- * @return A list of resource paths which should be expanded
- */
- List<ExpandItem> getExpandItems();
-
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/FilterOption.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/FilterOption.java
deleted file mode 100644
index 9ba1496..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/FilterOption.java
+++ /dev/null
@@ -1,33 +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.api.uri.queryoption;
-
-import org.apache.olingo.server.api.uri.queryoption.expression.Expression;
-
-/**
- * Represents the system query option $filter
- * For example: http://.../entitySet?$filter=name eq 'tester'
- */
-public interface FilterOption extends SystemQueryOption {
-
- /**
- * @return Expression tree created from the filter value (see {@link Expression})
- */
- Expression getExpression();
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/FormatOption.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/FormatOption.java
deleted file mode 100644
index 0efb0d4..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/FormatOption.java
+++ /dev/null
@@ -1,29 +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.api.uri.queryoption;
-
-/**
- * Represents the system query option $format
- * For example: http://.../entitySet?$format=json
- */
-public interface FormatOption extends SystemQueryOption {
-
- // TODO planned: define best representation for format to enable user defined formats
- String getFormat();
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/IdOption.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/IdOption.java
deleted file mode 100644
index 89b18b1..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/IdOption.java
+++ /dev/null
@@ -1,32 +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.api.uri.queryoption;
-
-/**
- * Represents the system query option $id when using a entity-id to resolve the entity
- * For example: http://.../$entity?$id=Products(0)
- */
-public interface IdOption extends SystemQueryOption {
-
- /**
- * @return Value of $id
- */
- String getValue();
-
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/LevelsExpandOption.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/LevelsExpandOption.java
deleted file mode 100644
index 69166fc..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/LevelsExpandOption.java
+++ /dev/null
@@ -1,37 +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.api.uri.queryoption;
-
-/**
- * Represents the system query option $levels when used inside $expand
- * For example: http://.../Employees?$expand=Model.Manager/DirectReports($levels=3)
- */
-public interface LevelsExpandOption {
-
- /**
- * @return Levels was max
- */
- boolean isMax();
-
- /**
- * @return Value of $levels
- */
- int getValue();
-
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/OrderByItem.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/OrderByItem.java
deleted file mode 100644
index e7f7037..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/OrderByItem.java
+++ /dev/null
@@ -1,40 +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.api.uri.queryoption;
-
-import org.apache.olingo.server.api.uri.queryoption.expression.Expression;
-
-/**
- * Represents a single orderby information
- * For example: http://.../Employees?$orderby=Name
- */
-public interface OrderByItem {
-
- /**
- * Returns the sort order of the orderby item
- * @return if false (default) the sort order is ascending, if true the sort order is descending
- */
- boolean isDescending();
-
- /**
- * @return Expression which is used to order the items
- */
- Expression getExpression();
-
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/OrderByOption.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/OrderByOption.java
deleted file mode 100644
index 4612f21..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/OrderByOption.java
+++ /dev/null
@@ -1,34 +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.api.uri.queryoption;
-
-import java.util.List;
-
-/**
- * Represents the system query option $orderby
- * For example: http://.../Employees?$orderby=Name, Age desc
- */
-public interface OrderByOption extends SystemQueryOption {
-
- /**
- * @return List of single orders used in $orderby
- */
- List<OrderByItem> getOrders();
-
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/QueryOption.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/QueryOption.java
deleted file mode 100644
index 860eaa6..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/QueryOption.java
+++ /dev/null
@@ -1,36 +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.api.uri.queryoption;
-
-/**
- * Super interface used for any query option
- */
-public interface QueryOption {
-
- /**
- * @return Name of query option
- */
- public String getName();
-
- /**
- * @return Value of query option
- */
- public String getText();
-
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/SearchOption.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/SearchOption.java
deleted file mode 100644
index ae608f2..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/SearchOption.java
+++ /dev/null
@@ -1,34 +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.api.uri.queryoption;
-
-import org.apache.olingo.server.api.uri.queryoption.search.SearchExpression;
-
-/**
- * Represents the system query option $search
- * For example: http://.../entitySet?$search=SearchString
- */
-public interface SearchOption extends SystemQueryOption {
-
- /**
- * @return Search expression tree created from the $search value (see {@link SearchExpression})
- */
- SearchExpression getSearchExpression();
-
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/SelectItem.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/SelectItem.java
deleted file mode 100644
index 6ee25ec..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/SelectItem.java
+++ /dev/null
@@ -1,57 +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.api.uri.queryoption;
-
-import org.apache.olingo.commons.api.edm.EdmType;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.server.api.uri.UriInfoResource;
-
-/**
- * Represents a single select item information
- * For example: http://.../Employees?select=name,age
- */
-public interface SelectItem {
-
- /**
- * @return A star is used as select item
- */
- boolean isStar();
-
- /**
- * @return Namespace and star is used as select item in order to select operations
- */
- boolean isAllOperationsInSchema();
-
- /**
- * @return Namespace when a star is used in combination with an namespace
- */
- FullQualifiedName getAllOperationsInSchemaNameSpace();
-
- /**
- * @return A {@link UriInfoResource} object containing the resource path segments to be selected
- */
- UriInfoResource getResourcePath();
-
- /**
- * @return Before resource path segments which should be selected a type filter may be used.
- * For example: ...Suppliers?$select=Namespace.PreferredSupplier/AccountRepresentative
- */
- EdmType getStartTypeFilter();
-
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/SelectOption.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/SelectOption.java
deleted file mode 100644
index 18ee432..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/SelectOption.java
+++ /dev/null
@@ -1,34 +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.api.uri.queryoption;
-
-import java.util.List;
-
-/**
- * Represents the system query option $select
- * For example: http://.../entitySet?select=name,age
- */
-public interface SelectOption extends SystemQueryOption {
-
- /**
- * @return A list of select items used in $select
- */
- List<SelectItem> getSelectItems();
-
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/SkipOption.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/SkipOption.java
deleted file mode 100644
index ecf94c7..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/SkipOption.java
+++ /dev/null
@@ -1,32 +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.api.uri.queryoption;
-
-/**
- * Represents the system query option $skip
- * For example: http://.../entitySet?$skip=10
- */
-public interface SkipOption extends SystemQueryOption {
-
- /**
- * @return Value of $skip
- */
- int getValue();
-
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/SkipTokenOption.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/SkipTokenOption.java
deleted file mode 100644
index f0cc0f8..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/SkipTokenOption.java
+++ /dev/null
@@ -1,32 +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.api.uri.queryoption;
-
-/**
- * Represents the system query option $skiptoken
- * For example: http://.../entitySet?$skiptoken=abv
- */
-public interface SkipTokenOption extends SystemQueryOption {
-
- /**
- * @return Value of $skiptoken
- */
- String getValue();
-
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/SystemQueryOption.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/SystemQueryOption.java
deleted file mode 100644
index 2d3cd0d..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/SystemQueryOption.java
+++ /dev/null
@@ -1,30 +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.api.uri.queryoption;
-
-/**
- * Super interface used for any system query option
- */
-public interface SystemQueryOption extends QueryOption {
-
- /**
- * @return Kind of system query option
- */
- SystemQueryOptionKind getKind();
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/SystemQueryOptionKind.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/SystemQueryOptionKind.java
deleted file mode 100644
index 431882c..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/SystemQueryOptionKind.java
+++ /dev/null
@@ -1,97 +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.api.uri.queryoption;
-
-/**
- * Defining the supported system query options
- */
-
-public enum SystemQueryOptionKind {
-
- /**
- * See {@link FilterOption}<br>
- */
- FILTER("$filter"),
-
- /**
- * See {@link FormatOption}<br>
- */
- FORMAT("$format"),
-
- /**
- * See {@link ExpandOption}<br>
- */
- EXPAND("$expand"),
-
- /**
- * See {@link IdOption}<br>
- */
- ID("$id"),
-
- /**
- * See {@link CountOption}<br>
- */
- COUNT("$count"),
-
- /**
- * See {@link OrderByOption}<br>
- */
- ORDERBY("$orderby"),
-
- /**
- * See {@link SearchOption}<br>
- */
- SEARCH("$search"),
-
- /**
- * See {@link SelectOption}<br>
- */
- SELECT("$select"),
-
- /**
- * See {@link SkipOption}<br>
- */
- SKIP("$skip"),
-
- /**
- * See {@link SkipTokenOption}<br>
- */
- SKIPTOKEN("$skiptoken"),
-
- /**
- * See {@link TopOption}<br>
- */
- TOP("$top"),
-
- /**
- * See {@link LevelsExpandOption}<br>
- */
- LEVELS("$level");
-
- String syntax;
-
- private SystemQueryOptionKind(final String syntax) {
- this.syntax = syntax;
- }
-
- @Override
- public String toString() {
- return syntax;
- }
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/TopOption.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/TopOption.java
deleted file mode 100644
index 9e782e5..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/TopOption.java
+++ /dev/null
@@ -1,32 +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.api.uri.queryoption;
-
-/**
- * Represents the system query option $top
- * For example: http://.../entitySet?$top=10
- */
-public interface TopOption extends SystemQueryOption {
-
- /**
- * @return Value of $top
- */
- int getValue();
-
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/expression/Alias.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/expression/Alias.java
deleted file mode 100644
index 9d44c65..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/expression/Alias.java
+++ /dev/null
@@ -1,34 +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.api.uri.queryoption.expression;
-
-/**
- * Represents an alias expression node in the expression tree
- * <br>
- * A alias expression node is inserted in the expression tree for any valid alias<br>
- * E.g. $filter=name eq @alias
- */
-public interface Alias extends Expression {
-
- /**
- * @return Name of the used alias
- */
- public String getParameterName();
-
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/expression/Binary.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/expression/Binary.java
deleted file mode 100644
index c13d15f..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/expression/Binary.java
+++ /dev/null
@@ -1,45 +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.api.uri.queryoption.expression;
-
-/**
- * Represents a binary expression node in the expression tree
- * <br>
- * A binary expression node is inserted in the expression tree for any valid
- * ODATA binary operator in {@link BinaryOperatorKind}.
- */
-public interface Binary extends Expression {
-
- /**
- * @return binary operator kind
- * @see BinaryOperatorKind
- */
- public BinaryOperatorKind getOperator();
-
- /**
- * @return Expression sub tree of the left operand
- */
- public Expression getLeftOperand();
-
- /**
- * @return Expression sub tree of the right operand
- */
- public Expression getRightOperand();
-
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/expression/BinaryOperatorKind.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/expression/BinaryOperatorKind.java
deleted file mode 100644
index 9db126d..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/expression/BinaryOperatorKind.java
+++ /dev/null
@@ -1,129 +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.api.uri.queryoption.expression;
-
-/**
- * Enumeration of supported binary operators<br>
- * For the semantic of these operators please see the ODATA specification for URL conventions
- */
-public enum BinaryOperatorKind {
-
- /**
- * OData has operator used for OData enumerations
- */
- HAS("has"),
-
- /**
- * Multiplication operator
- */
- MUL("mul"),
-
- /**
- * Division operator
- */
- DIV("div"),
-
- /**
- * Modulo operator
- */
- MOD("mod"),
-
- /**
- * Addition operator
- */
- ADD("add"),
-
- /**
- * Subtraction operator
- */
- SUB("sub"),
-
- /**
- * Greater than operator (">")
- */
- GT("gt"),
-
- /**
- * Greater than or equals (">=") operator
- */
- GE("ge"),
-
- /**
- * Lesser than operator ("<")
- */
- LT("lt"),
-
- /**
- * Lesser operator or equals ("<=") operator
- */
- LE("le"),
-
- /**
- * Equality operator
- */
- EQ("eq"),
-
- /**
- * Inequality operator
- */
- NE("ne"),
-
- /**
- * And operator
- */
- AND("and"),
-
- /**
- * Or operator
- */
- OR("or");
-
- private String syntax;
-
- /**
- * Constructor for enumeration value
- * @param Syntax used in the URI
- */
- private BinaryOperatorKind(final String syntax) {
- this.syntax = syntax;
- }
-
- /**
- * URI syntax to enumeration value
- * @param operator Operator in the syntax used in the URI
- * @return Operator kind which represents the given syntax
- */
- public static BinaryOperatorKind get(final String operator) {
- for (BinaryOperatorKind op : BinaryOperatorKind.values()) {
- if (op.toString().equals(operator)) {
- return op;
- }
- }
- return null;
- }
-
- /**
- * @return URI syntax for that operator kind
- */
- @Override
- public String toString() {
- return syntax;
- }
-
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/expression/Enumeration.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/expression/Enumeration.java
deleted file mode 100644
index 641794c..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/expression/Enumeration.java
+++ /dev/null
@@ -1,43 +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.api.uri.queryoption.expression;
-
-import org.apache.olingo.commons.api.edm.EdmEnumType;
-
-import java.util.List;
-
-/**
- * Represents a enumeration expression node in the expression tree
- * <br>
- * A enumeration expression node is inserted in the expression tree for any valid
- * enumeration. E.g. for $filter=style has Sales.Pattern'Yellow'
- */
-public interface Enumeration extends Expression {
-
- /**
- * @return A list of enumeration values
- */
- public List<String> getValues();
-
- /**
- * @return The enumeration type used before the enumeration values
- */
- public EdmEnumType getType();
-
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/expression/Expression.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/expression/Expression.java
deleted file mode 100644
index 088db9a..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/expression/Expression.java
+++ /dev/null
@@ -1,26 +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.api.uri.queryoption.expression;
-
-/**
- * Super class of all classes used to build the expression tree
- */
-public interface Expression extends VisitableExpression {
-
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/expression/ExpressionVisitException.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/expression/ExpressionVisitException.java
deleted file mode 100644
index 01098df..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/expression/ExpressionVisitException.java
+++ /dev/null
@@ -1,28 +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.api.uri.queryoption.expression;
-
-/**
- * Exception class used by the {@link ExpressionVisitor} to throw exceptions while traversing the expression tree
- */
-public class ExpressionVisitException extends Exception {
-
- private static final long serialVersionUID = 1L;
-
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/expression/ExpressionVisitor.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/expression/ExpressionVisitor.java
deleted file mode 100644
index 147e65e..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/expression/ExpressionVisitor.java
+++ /dev/null
@@ -1,137 +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.api.uri.queryoption.expression;
-
-import org.apache.olingo.commons.api.edm.EdmEnumType;
-import org.apache.olingo.commons.api.edm.EdmType;
-import org.apache.olingo.server.api.ODataApplicationException;
-import org.apache.olingo.server.api.uri.UriInfoResource;
-
-import java.util.List;
-
-/**
- * Generic interface to define expression visitors with arbitrary return types.
- *
- * @param <T> Return type
- */
-public interface ExpressionVisitor<T> {
-
- /**
- * Called for each traversed {@link Binary} expression
- * @param operator Operator kind
- * @param left Application return value of left sub tree
- * @param right Application return value of right sub tree
- * @return Application return value of type T
- * @throws ExpressionVisitException Thrown if an exception while traversing occured
- * @throws ODataApplicationException Thrown by the application
- */
- T visitBinaryOperator(BinaryOperatorKind operator, T left, T right)
- throws ExpressionVisitException, ODataApplicationException;
-
- /**
- * Called for each traversed {@link Unary} expression
- * @param operator Operator kind
- * @param operand return value of sub tree
- * @return Application return value of type T
- * @throws ExpressionVisitException Thrown if an exception while traversing occured
- * @throws ODataApplicationException Thrown by the application
- */
- T visitUnaryOperator(UnaryOperatorKind operator, T operand)
- throws ExpressionVisitException, ODataApplicationException;
-
- /**
- * Called for each traversed {@link Method} expression
- * @param methodCall Method
- * @param parameters List of application return values created by visiting each method parameter
- * @return Application return value of type T
- * @throws ExpressionVisitException Thrown if an exception while traversing occurred
- * @throws ODataApplicationException Thrown by the application
- */
- T visitMethodCall(MethodKind methodCall, List<T> parameters)
- throws ExpressionVisitException, ODataApplicationException;
-
- /**
- * Called for each traversed lambda expression
- * @param lambdaFunction "ALL" or "ANY"
- * @param lambdaVariable Variable name used lambda variable
- * @param expression Lambda expression
- * @return Application return value of type T
- * @throws ExpressionVisitException Thrown if an exception while traversing occured
- * @throws ODataApplicationException Thrown by the application
- */
- T visitLambdaExpression(String lambdaFunction, String lambdaVariable, Expression expression)
- throws ExpressionVisitException, ODataApplicationException;
-
- /**
- * Called for each traversed {@link Literal} expression
- * @param literal Literal
- * @return Application return value of type T
- * @throws ExpressionVisitException Thrown if an exception while traversing occured
- * @throws ODataApplicationException Thrown by the application
- */
- T visitLiteral(String literal) throws ExpressionVisitException, ODataApplicationException;
-
- /**
- * Called for each traversed {@link Member} expression
- * @param member UriInfoResource object describing the whole path used to access an data value
- * (this includes for example the usage of $root and $it inside the URI)
- * @return Application return value of type T
- * @throws ExpressionVisitException Thrown if an exception while traversing occured
- * @throws ODataApplicationException Thrown by the application
- */
- T visitMember(UriInfoResource member) throws ExpressionVisitException, ODataApplicationException;
-
- /**
- * Called for each traversed {@link Alias} expression
- * @param aliasName Name of the alias
- * @return Application return value of type T
- * @throws ExpressionVisitException Thrown if an exception while traversing occured
- * @throws ODataApplicationException Thrown by the application
- */
- T visitAlias(String aliasName) throws ExpressionVisitException, ODataApplicationException;
-
- /**
- * Called for each traversed {@link TypeLiteral} expression
- * @param type EdmType
- * @return Application return value of type T
- * @throws ExpressionVisitException Thrown if an exception while traversing occured
- * @throws ODataApplicationException Thrown by the application
- */
- T visitTypeLiteral(EdmType type) throws ExpressionVisitException, ODataApplicationException;
-
- /**
- * Called for each traversed {@link LambdaRef}
- * @param variableName Name of the used lambda variable
- * @return Application return value of type T
- * @throws ExpressionVisitException Thrown if an exception while traversing occured
- * @throws ODataApplicationException Thrown by the application
- */
- T visitLambdaReference(String variableName) throws ExpressionVisitException, ODataApplicationException;
-
- /**
- * Called for each traversed {@link Enumeration} expression
- * @param type Type used in the URI before the enumeration values
- * @param enumValues List of enumeration values
- * @return Application return value of type T
- * @throws ExpressionVisitException Thrown if an exception while traversing occured
- * @throws ODataApplicationException Thrown by the application
- */
- T visitEnum(EdmEnumType type, List<String> enumValues) throws ExpressionVisitException, ODataApplicationException;
-
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/expression/LambdaRef.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/expression/LambdaRef.java
deleted file mode 100644
index 3830e3b..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/expression/LambdaRef.java
+++ /dev/null
@@ -1,31 +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.api.uri.queryoption.expression;
-
-/**
- * Used to within a lambda expression tree to define an access to the lambda variable
- */
-public interface LambdaRef extends Expression {
-
- /**
- * @return Name of the lambda variable
- */
- public String getVariableName();
-
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/expression/Literal.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/expression/Literal.java
deleted file mode 100644
index d1a50dc..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/expression/Literal.java
+++ /dev/null
@@ -1,38 +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.api.uri.queryoption.expression;
-
-import org.apache.olingo.commons.api.edm.EdmType;
-
-/**
- * Represents a literal expression node in the expression tree
- */
-public interface Literal extends Expression {
-
- /**
- * @return Literal
- */
- public String getText();
-
- /**
- * @return Type of the literal if detected
- */
- public EdmType getType();
-
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/expression/Member.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/expression/Member.java
deleted file mode 100644
index 4aa9fd3..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/expression/Member.java
+++ /dev/null
@@ -1,51 +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.api.uri.queryoption.expression;
-
-import org.apache.olingo.commons.api.edm.EdmType;
-import org.apache.olingo.server.api.uri.UriInfoResource;
-
-/**
- * Represents a member expression node in the expression tree. This expression is used to describe access paths
- * to properties and other EDM elements.
- */
-public interface Member extends Expression {
-
- /**
- * @return UriInfoResource object describing the whole path used to access an data value
- * (this includes for example the usage of $root and $it inside the URI)
- */
- public UriInfoResource getResourcePath();
-
- /**
- * @return Type
- */
- public EdmType getType();
-
- /**
- * @return The used type filter ahead of the path
- */
- public EdmType getStartTypeFilter();
-
- /**
- * @return true if the accessed data is a collection, otherwise false
- */
- public boolean isCollection();
-
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/expression/Method.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/expression/Method.java
deleted file mode 100644
index 00bb69b..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/expression/Method.java
+++ /dev/null
@@ -1,39 +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.api.uri.queryoption.expression;
-
-import java.util.List;
-
-/**
- * Represents a method expression in the expression tree
- */
-public interface Method extends Expression {
-
- /**
- * @return The used method
- * @see MethodKind
- */
- public MethodKind getMethod();
-
- /**
- * @return The list of expression tree which form the actual method parameters
- */
- public List<Expression> getParameters();
-
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/expression/MethodKind.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/expression/MethodKind.java
deleted file mode 100644
index ef0d7cf..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/expression/MethodKind.java
+++ /dev/null
@@ -1,90 +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.api.uri.queryoption.expression;
-
-/**
- * Enumeration of supported methods
- * For the semantic of these methods please see the ODATA specification for URL conventions
- */
-public enum MethodKind {
- CONTAINS("contains"),
- STARTSWITH("startswith"),
- ENDSWITH("endswith"),
- LENGTH("length"),
- INDEXOF("indexof"),
- SUBSTRING("substring"),
- TOLOWER("tolower"),
- TOUPPER("toupper"),
- TRIM("trim"),
- CONCAT("concat"),
- YEAR("year"),
- MONTH("month"),
- DAY("day"),
- HOUR("hour"),
- MINUTE("minute"),
- SECOND("second"),
- FRACTIONALSECONDS("fractionalseconds"),
- TOTALSECONDS("totalseconds"), DATE("date"), TIME("time"),
- TOTALOFFSETMINUTES("totaloffsetminutes"),
- MINDATETIME("mindatetime"),
- MAXDATETIME("maxdatetime"),
- NOW("now"),
- ROUND("round"),
- FLOOR("floor"),
- CEILING("ceiling"),
- GEODISTANCE("geo.distance"),
- GEOLENGTH("geo.length"),
- GEOINTERSECTS("geo.intersects"),
- CAST("cast"),
- ISOF("isof");
-
- private String syntax;
-
- /**
- * Constructor for enumeration value
- * @param Syntax used in the URI
- */
- private MethodKind(final String syntax) {
- this.syntax = syntax;
- }
-
- @Override
- /**
- * @return URI syntax for that operator kind
- */
- public String toString() {
- return syntax;
- }
-
- /**
- * URI syntax to enumeration value
- * @param method Method in the syntax used in the URI
- * @return Method kind which represents the given syntax
- */
- public static MethodKind get(final String method) {
- for (MethodKind op : MethodKind.values()) {
-
- if (op.toString().equals(method)) {
- return op;
- }
- }
- return null;
- }
-
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/expression/TypeLiteral.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/expression/TypeLiteral.java
deleted file mode 100644
index c259eba..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/expression/TypeLiteral.java
+++ /dev/null
@@ -1,33 +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.api.uri.queryoption.expression;
-
-import org.apache.olingo.commons.api.edm.EdmType;
-
-/**
- * Represents a type literal expression in the expression tree
- */
-public interface TypeLiteral extends Expression {
-
- /**
- * @return Type defined by the type literal
- */
- public EdmType getType();
-
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/expression/Unary.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/expression/Unary.java
deleted file mode 100644
index 7f37a0c..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/expression/Unary.java
+++ /dev/null
@@ -1,40 +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.api.uri.queryoption.expression;
-
-/**
- * Represents a unary expression node in the expression tree
- * <br>
- * A binary expression node is inserted in the expression tree for any valid
- * ODATA unary operator in {@link UnaryOperatorKind}
- */
-public interface Unary extends Expression {
-
- /**
- * @return The used binary operator
- * @see UnaryOperatorKind
- */
- public Expression getOperand();
-
- /**
- * @return Expression sub tree to which the operator applies
- */
- public UnaryOperatorKind getOperator();
-
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/expression/UnaryOperatorKind.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/expression/UnaryOperatorKind.java
deleted file mode 100644
index 3e0907b..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/expression/UnaryOperatorKind.java
+++ /dev/null
@@ -1,69 +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.api.uri.queryoption.expression;
-
-/**
- * Enumeration of supported unary operators<br>
- * For the semantic of these operators please see the ODATA specification for URL conventions
- */
-public enum UnaryOperatorKind {
-
- /**
- * Minus operator
- */
- MINUS("-"),
-
- /**
- * not operator
- */
- NOT("not");
-
- private String syntax;
-
- /**
- * Constructor for enumeration value
- * @param Syntax used in the URI
- */
- private UnaryOperatorKind(final String syntax) {
- this.syntax = syntax;
- }
-
- /**
- * @return URI syntax for that operator kind
- */
- @Override
- public String toString() {
- return syntax;
- }
-
- /**
- * URI syntax to enumeration value
- * @param operator Operator in the syntax used in the URI
- * @return Operator kind which represents the given syntax
- */
- public static UnaryOperatorKind get(final String operator) {
- for (UnaryOperatorKind op : UnaryOperatorKind.values()) {
- if (op.toString().equals(operator)) {
- return op;
- }
- }
- return null;
- }
-
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/expression/VisitableExpression.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/expression/VisitableExpression.java
deleted file mode 100644
index 1588dcf..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/expression/VisitableExpression.java
+++ /dev/null
@@ -1,50 +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.api.uri.queryoption.expression;
-
-import org.apache.olingo.server.api.ODataApplicationException;
-
-/**
- * Marks an expression node a visitable by an expression visitor
- */
-public interface VisitableExpression {
-
- /**
- * Method {@link #accept(ExpressionVisitor)} is called when traversing the expression tree. This method is invoked on
- * each expression used as node in an expression tree. The implementations should
- * behave as follows:
- * <li>Call accept on all sub nodes and store the returned Objects which are of the generic type T
- * <li>Call the appropriate method on the {@link ExpressionVisitor} instance and provide the stored return objects
- * to that instance
- * <li>Return the object which should be passed to the processing algorithm of the parent expression node
- * <br>
- * <br>
- * @param visitor
- * Visitor object (implementing {@link ExpressionVisitor}) whose methods are called during traversing a
- * expression node of the expression tree.
- * @return
- * Object of type T which should be passed to the processing algorithm of the parent expression node
- * @throws ExpressionVisitException
- * Exception occurred in the OData library while traversing the tree
- * @throws ODataApplicationException
- * Exception thrown by the application who implemented the visitor
- */
- <T> T accept(ExpressionVisitor<T> visitor) throws ExpressionVisitException, ODataApplicationException;
-
-}
\ No newline at end of file
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/search/SearchBinary.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/search/SearchBinary.java
deleted file mode 100644
index f24554d..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/search/SearchBinary.java
+++ /dev/null
@@ -1,29 +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.api.uri.queryoption.search;
-
-public interface SearchBinary extends SearchExpression {
-
- SearchBinaryOperatorKind getOperator();
-
- SearchExpression getLeftOperand();
-
- SearchExpression getRightOperand();
-
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/search/SearchBinaryOperatorKind.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/search/SearchBinaryOperatorKind.java
deleted file mode 100644
index 224d3c1..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/search/SearchBinaryOperatorKind.java
+++ /dev/null
@@ -1,45 +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.api.uri.queryoption.search;
-
-public enum SearchBinaryOperatorKind {
- // and/or
- AND("and"), OR("or");
-
- private String syntax;
-
- private SearchBinaryOperatorKind(final String syntax) {
- this.syntax = syntax;
- }
-
- @Override
- public String toString() {
- return syntax;
- }
-
- public static SearchBinaryOperatorKind get(final String operator) {
- for (SearchBinaryOperatorKind op : SearchBinaryOperatorKind.values()) {
- if (op.toString().equals(operator)) {
- return op;
- }
- }
- return null;
- }
-
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/search/SearchExpression.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/search/SearchExpression.java
deleted file mode 100644
index f471d27..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/search/SearchExpression.java
+++ /dev/null
@@ -1,23 +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.api.uri.queryoption.search;
-
-public interface SearchExpression {
-
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/search/SearchTerm.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/search/SearchTerm.java
deleted file mode 100644
index a3d69ad..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/search/SearchTerm.java
+++ /dev/null
@@ -1,25 +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.api.uri.queryoption.search;
-
-public interface SearchTerm extends SearchExpression {
-
- String getSearchTerm();
-
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/search/SearchUnary.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/search/SearchUnary.java
deleted file mode 100644
index 2a424ce..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/search/SearchUnary.java
+++ /dev/null
@@ -1,25 +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.api.uri.queryoption.search;
-
-public interface SearchUnary {
-
- SearchExpression getOperand();
-
-}
diff --git a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/search/SearchUnaryOperatorKind.java b/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/search/SearchUnaryOperatorKind.java
deleted file mode 100644
index 07d1302..0000000
--- a/lib/server-api/src/main/java/org/apache/olingo/server/api/uri/queryoption/search/SearchUnaryOperatorKind.java
+++ /dev/null
@@ -1,43 +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.api.uri.queryoption.search;
-
-public enum SearchUnaryOperatorKind {
- NOT("not");
-
- private String syntax;
-
- private SearchUnaryOperatorKind(final String syntax) {
- this.syntax = syntax;
- }
-
- @Override
- public String toString() {
- return syntax;
- }
-
- public static SearchUnaryOperatorKind get(final String operator) {
- for (SearchUnaryOperatorKind op : SearchUnaryOperatorKind.values()) {
- if (op.toString().equals(operator)) {
- return op;
- }
- }
- return null;
- }
-}
diff --git a/lib/server-api/src/test/java/org/apache/olingo/server/api/ODataRequestTest.java b/lib/server-api/src/test/java/org/apache/olingo/server/api/ODataRequestTest.java
deleted file mode 100644
index d2f9bef..0000000
--- a/lib/server-api/src/test/java/org/apache/olingo/server/api/ODataRequestTest.java
+++ /dev/null
@@ -1,70 +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.api;
-
-import org.junit.Test;
-
-import java.util.Arrays;
-
-import static org.junit.Assert.assertEquals;
-
-public class ODataRequestTest {
-
- @Test
- public void testHeader() {
- ODataRequest r = new ODataRequest();
-
- r.addHeader("aa", Arrays.asList("cc"));
-
- assertEquals("cc", r.getHeaders("aa").get(0));
- assertEquals("cc", r.getHeaders("aA").get(0));
- assertEquals("cc", r.getHeaders("AA").get(0));
-
- assertEquals("cc", r.getHeader("aa"));
- assertEquals("cc", r.getHeader("aA"));
- assertEquals("cc", r.getHeader("AA"));
-
- }
-
- @Test
- public void testHeader2() {
- ODataRequest r = new ODataRequest();
- r.addHeader("AA", Arrays.asList("dd"));
-
- assertEquals("dd", r.getHeaders("aa").get(0));
- assertEquals("dd", r.getHeaders("aA").get(0));
- assertEquals("dd", r.getHeaders("AA").get(0));
- }
-
- @Test
- public void testMultiValueHeader() {
- ODataRequest r = new ODataRequest();
-
- r.addHeader("aa", Arrays.asList("a", "b"));
-
- assertEquals("a", r.getHeaders("aa").get(0));
- assertEquals("b", r.getHeaders("aA").get(1));
-
- r.addHeader("Aa", Arrays.asList("c"));
-
- assertEquals("a", r.getHeaders("aa").get(0));
- assertEquals("b", r.getHeaders("aA").get(1));
- assertEquals("c", r.getHeaders("aA").get(2));
- }
-}
diff --git a/lib/server-api/src/test/java/org/apache/olingo/server/api/TranslatedExceptionsTest.java b/lib/server-api/src/test/java/org/apache/olingo/server/api/TranslatedExceptionsTest.java
deleted file mode 100644
index c22546b..0000000
--- a/lib/server-api/src/test/java/org/apache/olingo/server/api/TranslatedExceptionsTest.java
+++ /dev/null
@@ -1,159 +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.api;
-
-import static org.hamcrest.CoreMatchers.containsString;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertThat;
-
-import java.util.Locale;
-
-import org.apache.olingo.server.api.ODataTranslatedException.ODataErrorMessage;
-import org.junit.Test;
-
-public class TranslatedExceptionsTest {
-
- private static final String DEV = "devMessage";
-
- private static class TestException extends ODataTranslatedException {
- private static final long serialVersionUID = -7199975861656921724L;
- public static enum Keys implements MessageKey {
- BASIC, ONEPARAM, TWOPARAM, NOMESSAGE, ONLY_ROOT, ONLY_GERMAN;
- @Override
- public String getKey() {
- return name();
- }
- }
- protected TestException(final MessageKey messageKey, final String... parameters) {
- super(DEV, messageKey, parameters);
- }
- @Override
- protected String getBundleName() {
- return "i18n";
- }
- }
-
- @Test
- public void basic() {
- TestException exp = new TestException(TestException.Keys.BASIC);
- assertEquals(DEV, exp.getMessage());
- assertEquals(DEV, exp.toString());
- assertEquals("Test Default", exp.getLocalizedMessage());
- assertEquals(TestException.Keys.BASIC, exp.getMessageKey());
-
- checkTranslatedMessage(exp.getTranslatedMessage(null), "Test Default", Locale.ENGLISH);
- checkTranslatedMessage(exp.getTranslatedMessage(Locale.ENGLISH), "Test Default", Locale.ENGLISH);
- checkTranslatedMessage(exp.getTranslatedMessage(Locale.UK), "Test Default", Locale.ENGLISH);
- checkTranslatedMessage(exp.getTranslatedMessage(Locale.GERMAN), "Test DE", Locale.GERMAN);
- checkTranslatedMessage(exp.getTranslatedMessage(Locale.GERMANY), "Test DE", Locale.GERMAN);
- }
-
- @Test
- public void unusedParametersMustNotResultInAnException() {
- TestException exp = new TestException(TestException.Keys.BASIC, "unusedParam1", "unusedParam2");
- assertEquals(DEV, exp.getMessage());
- checkTranslatedMessage(exp.getTranslatedMessage(null), "Test Default", Locale.ENGLISH);
- }
-
- @Test
- public void useOneParameter() {
- TestException exp = new TestException(TestException.Keys.ONEPARAM, "usedParam1");
- assertEquals(DEV, exp.getMessage());
- checkTranslatedMessage(exp.getTranslatedMessage(null), "Param1: usedParam1", Locale.ENGLISH);
- }
-
- @Test
- public void useOneParameterExpectedButMultipleGiven() {
- TestException exp = new TestException(TestException.Keys.ONEPARAM, "usedParam1", "unusedParam2");
- assertEquals(DEV, exp.getMessage());
- checkTranslatedMessage(exp.getTranslatedMessage(null), "Param1: usedParam1", Locale.ENGLISH);
- }
-
- @Test
- public void useTwoParameters() {
- TestException exp = new TestException(TestException.Keys.TWOPARAM, "usedParam1", "usedParam2");
- assertEquals(DEV, exp.getMessage());
- checkTranslatedMessage(exp.getTranslatedMessage(null), "Param1: usedParam1 Param2: usedParam2", Locale.ENGLISH);
- }
-
- @Test
- public void parametersNotGivenAlthoughNeeded() {
- TestException exp = new TestException(TestException.Keys.ONEPARAM);
- assertEquals(DEV, exp.getMessage());
-
- ODataErrorMessage translatedMessage = exp.getTranslatedMessage(null);
- assertNotNull(translatedMessage);
- assertThat(translatedMessage.getMessage(), containsString("Missing replacement for place holder in message"));
- }
-
- @Test
- public void noMessageKey() {
- TestException exp = new TestException(null);
- assertEquals(DEV, exp.getMessage());
-
- ODataErrorMessage translatedMessage = exp.getTranslatedMessage(null);
- assertNotNull(translatedMessage);
- assertEquals(DEV, translatedMessage.getMessage());
- }
-
- @Test
- public void noMessageForKey() {
- TestException exp = new TestException(TestException.Keys.NOMESSAGE);
- assertEquals(DEV, exp.getMessage());
-
- ODataErrorMessage translatedMessage = exp.getTranslatedMessage(null);
- assertNotNull(translatedMessage);
- assertThat(translatedMessage.getMessage(), containsString("Missing message for key"));
- }
-
- @Test
- public void keyForRootBundleButNotPresentInDerivedBundle() {
- TestException exp = new TestException(TestException.Keys.ONLY_ROOT);
- assertEquals(DEV, exp.getMessage());
-
- checkTranslatedMessage(exp.getTranslatedMessage(Locale.GERMAN), "Root message", Locale.GERMAN);
- checkTranslatedMessage(exp.getTranslatedMessage(Locale.ROOT), "Root message", Locale.ENGLISH);
- }
-
- @Test
- public void defaultLocale() {
- TestException exp = new TestException(TestException.Keys.ONLY_GERMAN);
- assertEquals(DEV, exp.getMessage());
-
- Locale.setDefault(Locale.GERMAN);
- ODataErrorMessage translatedMessage = exp.getTranslatedMessage(null);
- assertNotNull(translatedMessage);
- assertThat(translatedMessage.getMessage(), containsString("Missing message for key"));
- assertEquals(Locale.ENGLISH, translatedMessage.getLocale());
-
- Locale.setDefault(Locale.ENGLISH);
- translatedMessage = exp.getTranslatedMessage(null);
- assertNotNull(translatedMessage);
- assertThat(translatedMessage.getMessage(), containsString("Missing message for key"));
- assertEquals(Locale.ENGLISH, translatedMessage.getLocale());
- }
-
- private void checkTranslatedMessage(final ODataErrorMessage translatedMessage,
- final String expectedText, final Locale expectedLocale) {
- assertNotNull(translatedMessage);
- assertEquals(expectedText, translatedMessage.getMessage());
- assertEquals(expectedLocale, translatedMessage.getLocale());
- }
-}
diff --git a/lib/server-api/src/test/resources/i18n.properties b/lib/server-api/src/test/resources/i18n.properties
deleted file mode 100644
index 58c31b3..0000000
--- a/lib/server-api/src/test/resources/i18n.properties
+++ /dev/null
@@ -1,21 +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.
-#-------------------------------------------------------------------------------
-# Basic Apache Olingo exception messages
-#
-TestException.ONLY_ROOT=Root message
\ No newline at end of file
diff --git a/lib/server-api/src/test/resources/i18n_de.properties b/lib/server-api/src/test/resources/i18n_de.properties
deleted file mode 100644
index b919483..0000000
--- a/lib/server-api/src/test/resources/i18n_de.properties
+++ /dev/null
@@ -1,20 +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.
-#-------------------------------------------------------------------------------
-TestException.BASIC=Test DE
-TestException.ONLY_GERMAN=Deutsche Nachricht
\ No newline at end of file
diff --git a/lib/server-api/src/test/resources/i18n_en.properties b/lib/server-api/src/test/resources/i18n_en.properties
deleted file mode 100644
index 84dd9d1..0000000
--- a/lib/server-api/src/test/resources/i18n_en.properties
+++ /dev/null
@@ -1,23 +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.
-#-------------------------------------------------------------------------------
-# Basic Apache Olingo exception messages
-#
-TestException.BASIC=Test Default
-TestException.ONEPARAM=Param1: %1$s
-TestException.TWOPARAM=Param1: %1$s Param2: %2$s
\ No newline at end of file
diff --git a/lib/server-core/pom.xml b/lib/server-core/pom.xml
deleted file mode 100644
index 92538ce..0000000
--- a/lib/server-core/pom.xml
+++ /dev/null
@@ -1,120 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
- 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.
-
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <artifactId>odata-server-core</artifactId>
- <packaging>jar</packaging>
- <name>${project.artifactId}</name>
-
- <parent>
- <groupId>org.apache.olingo</groupId>
- <artifactId>odata-lib</artifactId>
- <version>4.0.0-beta-02</version>
- <relativePath>..</relativePath>
- </parent>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.olingo</groupId>
- <artifactId>odata-server-api</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.olingo</groupId>
- <artifactId>odata-commons-core</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.antlr</groupId>
- <artifactId>antlr4-runtime</artifactId>
- </dependency>
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- <version>2.5</version>
- <scope>provided</scope>
- </dependency>
-
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- </dependency>
- <dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-all</artifactId>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-simple</artifactId>
- </dependency>
- <dependency>
- <groupId>commons-io</groupId>
- <artifactId>commons-io</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>build-helper-maven-plugin</artifactId>
- <executions>
- <execution>
- <phase>generate-sources</phase>
- <goals>
- <goal>add-source</goal>
- </goals>
- <configuration>
- <sources>
- <source>target/generated-sources/antlr4</source>
- </sources>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.antlr</groupId>
- <artifactId>antlr4-maven-plugin</artifactId>
- <executions>
- <execution>
- <goals>
- <goal>antlr4</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <!--<arguments><argument>-atn</argument></arguments> -->
- <listener>true</listener>
- <visitor>true</visitor>
- <!--maven antlr plugin has trouble with grammer import if the grammerfiles
- are not directly inside src/main/antlr4, hence we have to set the libDirectory -->
- <libDirectory>src/main/antlr4/org/apache/olingo/server/core/uri/antlr</libDirectory>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/lib/server-core/src/main/antlr4/org/apache/olingo/server/core/uri/antlr/UriLexer.g4 b/lib/server-core/src/main/antlr4/org/apache/olingo/server/core/uri/antlr/UriLexer.g4
deleted file mode 100644
index 13ed27a..0000000
--- a/lib/server-core/src/main/antlr4/org/apache/olingo/server/core/uri/antlr/UriLexer.g4
+++ /dev/null
@@ -1,409 +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.
- ******************************************************************************/
-lexer grammar UriLexer;
-
-//;==============================================================================
-// Mode "DEFAULT_MODE": Processes everything before the first '?' char.
-// On '?' the next mode "MODE_QUERY" is used.
-// The percent encoding rules are defined in RFC3986; ABNF rule "path-rootless" applies.
-//;==============================================================================
-QM : '?' -> pushMode(MODE_QUERY); //first query parameter
-AMP : '&' -> pushMode(MODE_QUERY); //more query parameters
-STRING : '\'' -> more, pushMode(MODE_STRING); //reads up to next single '
-QUOTATION_MARK : ('\u0022' | '%22') -> more, pushMode(MODE_JSON_STRING); //reads up to next unescaped "
-SEARCH_INLINE : '$search' -> pushMode(MODE_SYSTEM_QUERY_SEARCH); //
-FRAGMENT : '#' -> pushMode(MODE_FRAGMENT); //
-
-GEOGRAPHY : G E O G R A P H Y SQUOTE -> pushMode(MODE_ODATA_GEO); //TODO make case insensitive
-GEOMETRY : G E O M E T R Y SQUOTE -> pushMode(MODE_ODATA_GEO);
-
-//Letters for case insensitivity
-fragment A : 'A'|'a';
-fragment B : 'B'|'b';
-fragment D : 'D'|'d';
-fragment E : 'E'|'e';
-fragment F : 'F'|'f';
-fragment G : 'G'|'g';
-fragment H : 'H'|'h';
-fragment I : 'I'|'i';
-fragment L : 'L'|'l';
-fragment M : 'M'|'m';
-fragment N : 'N'|'n';
-fragment O : 'O'|'o';
-fragment P : 'P'|'p';
-fragment R : 'R'|'r';
-fragment S : 'S'|'s';
-fragment T : 'T'|'t';
-fragment U : 'U'|'u';
-fragment Y : 'Y'|'y';
-fragment Z : 'Z'|'z';
-
-//special chars
-OPEN : '(' | '%28';
-CLOSE : ')' | '%29';
-COMMA : ',' | '%2C';
-SLASH : '/';
-POINT : '.';
-AT : '@';
-EQ : '=' ;
-STAR : '*';
-SEMI : ';' | '%3b';
-COLON : ':';
-
-EQ_sq : '=' -> type(EQ);
-AMP_sq : '&' -> type(AMP), popMode;
-fragment WS : ( ' ' | '%09' | '%20' | '%09' );
-WSP : WS+;
-
-//JSON support
-BEGIN_OBJECT : WS* ( '{' / '%7B' ) WS*;
-END_OBJECT : WS* ( '}' / '%7D' ) WS*;
-
-BEGIN_ARRAY : WS* ( '[' / '%5B' ) WS*;
-END_ARRAY : WS* ( ']' / '%5D' ) WS*;
-
-
-//alpha stuff
-fragment ALPHA : 'a'..'z' | 'A'..'Z';
-fragment ALPHA_A_TO_F : 'a'..'f' | 'A'..'F';
-fragment DIGIT : '0'..'9';
-fragment DIGITS : DIGIT+;
-fragment HEXDIG : DIGIT | ALPHA_A_TO_F;
-fragment ODI_LEADINGCHARACTER : ALPHA | '_'; //TODO; add Unicode characters from the categories L or Nl
-fragment ODI_CHARACTER : ALPHA | '_' | DIGIT; //TODO; add Unicode characters from the categories L, Nl, Nd, Mn, Mc, Pc, or Cf
-
-//helper for date/time values
-fragment ONE_TO_NINE : '1'..'9';
-fragment ZERO_TO_FIFTYNINE : ('0'..'5') DIGIT;
-fragment FRACTIONALSECONDS : DIGIT+;
-fragment SECOND : ZERO_TO_FIFTYNINE;
-fragment MINUTE : ZERO_TO_FIFTYNINE;
-fragment HOUR : ('0' | '1') DIGIT | '2' ( '0'..'3');
-fragment DAY : '0' '1'..'9' | ('1'|'2') DIGIT | '3' ('0'|'1');
-fragment MONTH : '0' ONE_TO_NINE | '1' ( '0' | '1' | '2' );
-fragment YEAR : ('-')? ( '0' DIGIT DIGIT DIGIT | ONE_TO_NINE DIGIT DIGIT DIGIT );
-
-//tags starting with $
-BATCH : '$batch';
-ENTITY : '$entity';
-METADATA : '$metadata';
-
-ALL : '$all';
-CROSSJOIN : '$crossjoin';
-
-VALUE : '$value';
-REF : '$ref';
-COUNT : '$count';
-
-//inlined query parameters ( e.g. $skip)
-TOP_I : '$top' -> type(TOP);
-SKIP_I : '$skip' -> type(SKIP);
-FILTER_I : '$filter' -> type(FILTER);
-ORDERBY_I: '$orderby' -> type(ORDERBY);
-SELECT_I : '$select' -> type(SELECT);
-EXPAND_I : '$expand' -> type(EXPAND);
-LEVELS_I : '$levels' -> type(LEVELS);
-MAX: 'max';
-
-ROOT : '$root/';
-
-//rest
-NULLVALUE : 'null';
-
-TRUE : 'true';
-FALSE : 'false';
-BOOLEAN : T R U E | F A L S E;
-PLUS : '+';
-
-MINUS : '-';
-SIGN : PLUS | '%2B' | '-';
-INT : SIGN? DIGITS;
-DECIMAL : INT '.' DIGITS (('e'|'E') SIGN? DIGITS)?;
-NANINFINITY : 'NaN' | '-INF' | 'INF';
-//primary types
-BINARY : B I N A R Y SQUOTE (HEXDIG HEXDIG)* SQUOTE;
-DATE : YEAR '-' MONTH '-' DAY;
-DATETIMEOFFSET : YEAR '-' MONTH '-' DAY T HOUR ':' MINUTE ( ':' SECOND ( '.' FRACTIONALSECONDS )? )? ( Z | SIGN HOUR ':' MINUTE );
-fragment DUSECONDFRAG : DIGITS ('.' DIGITS)? 'S';
-fragment DUTIMEFRAG : 'T' (
- ( DIGITS 'H' (DIGITS 'M')? DUSECONDFRAG?)
- | (DIGITS 'M' DUSECONDFRAG?)
- | DUSECONDFRAG
- );
-fragment DUDAYTIMEFRAG : DIGITS 'D' DUTIMEFRAG? | DUTIMEFRAG;
-DURATION : D U R A T I O N SQUOTE '-'? 'P' DUDAYTIMEFRAG SQUOTE;
-TIMEOFDAY : HOUR ':' MINUTE ( ':' SECOND ( '.' FRACTIONALSECONDS )? )?;
-fragment GUIDVALUE : HEXDIG HEXDIG HEXDIG HEXDIG HEXDIG HEXDIG HEXDIG HEXDIG'-'
- HEXDIG HEXDIG HEXDIG HEXDIG '-'
- HEXDIG HEXDIG HEXDIG HEXDIG '-'
- HEXDIG HEXDIG HEXDIG HEXDIG '-'
- HEXDIG HEXDIG HEXDIG HEXDIG HEXDIG HEXDIG HEXDIG HEXDIG HEXDIG HEXDIG HEXDIG HEXDIG;
-GUID : GUIDVALUE;
-
-//expression tokens
-ASC : 'asc';
-DESC : 'desc';
-MUL : 'mul';
-DIV : 'div';
-MOD : 'mod';
-HAS : 'has';
-
-ADD : 'add';
-SUB : 'sub';
-
-ANY_LAMDA : 'any';
-ALL_LAMDA : 'all';
-
-GT : 'gt';
-GE : 'ge';
-LT : 'lt';
-LE : 'le';
-ISOF : 'isof';
-
-EQ_ALPHA : 'eq';
-NE : 'ne';
-
-AND : 'and';
-OR : 'or';
-
-
-NOT : 'not';
-
-
-IT : '$it';
-ITSLASH : '$it/';
-LEVELS : '$levels';
-
-CONTAINS_WORD : 'contains(';
-STARTSWITH_WORD : 'startswith(';
-ENDSWITH_WORD : 'endswith(';
-LENGTH_WORD : 'length(';
-INDEXOF_WORD : 'indexof(';
-SUBSTRING_WORD : 'substring(';
-TOLOWER_WORD : 'tolower(';
-TOUPPER_WORD : 'toupper(';
-TRIM_WORD : 'trim(';
-CONCAT_WORD : 'concat(';
-YEAR_WORD : 'year(';
-MONTH_WORD : 'month(';
-DAY_WORD : 'day(';
-HOUR_WORD : 'hour(';
-MINUTE_WORD : 'minute(';
-SECOND_WORD : 'second(';
-FRACTIONALSECONDS_WORD : 'fractionalseconds(';
-TOTALSECONDS_WORD : 'totalseconds(';
-DATE_WORD : 'date(';
-TIME_WORD : 'time(';
-TOTALOFFSETMINUTES_WORD : 'totaloffsetminutes(';
-
-MINDATETIME_WORD : 'mindatetime(';
-MAXDATETIME_WORD : 'maxdatetime(';
-NOW_WORD : 'now(';
-
-ROUND_WORD : 'round(';
-FLOOR_WORD : 'floor(';
-CEILING_WORD : 'ceiling(';
-
-GEO_DISTANCE_WORD : 'geo.distance(';
-GEO_LENGTH_WORD : 'geo.length(';
-GEO_INTERSECTS_WORD : 'geo.intersects(';
-ISOF_WORD : 'isof(';
-CAST_WORD : 'cast(';
-
-COLLECTION_REF : 'Collection($ref)';
-COLLECTION_ENTITY_TYPE : 'Collection(Edm.EntityType)';
-COLLECTION_COMPLEX_TYPE : 'Collection(Edm.ComplexType)';
-COLLECTION : 'Collection(' -> type(COLLECTION);
-
-//used in fragment only
-DELETED_ENTITY : '$deletedEntity';
-LINK : '$link';
-DELETED_LINK : '$deletedLink';
-DELTA : '$delta';
-
-ODATAIDENTIFIER : ODI_LEADINGCHARACTER (ODI_CHARACTER)*;
-
-//handle characters that failed to match any other token
-ERROR_CHARACTER : .;
-
-//;==============================================================================
-// Mode "QUERY": Processes everything between the first '?' and the '#' char.
-// On '?' the next mode "FRAGMENT" is used.
-// The percent encoding rules are defined in RFC3986; ABNF rule "query" applies.
-mode MODE_QUERY;
-//;==============================================================================
-
-FRAGMENT_q : '#' -> type(FRAGMENT);
-FILTER : '$filter' -> pushMode(DEFAULT_MODE);
-ORDERBY : '$orderby' -> pushMode(DEFAULT_MODE);
-EXPAND : '$expand' -> pushMode(DEFAULT_MODE);
-SELECT : '$select' -> pushMode(DEFAULT_MODE);
-SKIP : '$skip' -> pushMode(DEFAULT_MODE);
-SKIPTOKEN : '$skiptoken' -> pushMode(MODE_SYSTEM_QUERY_REST);
-TOP : '$top' -> pushMode(DEFAULT_MODE);
-LEVELS_q : '$levels' -> type(LEVELS), pushMode(DEFAULT_MODE);
-FORMAT : '$format' -> pushMode(MODE_SYSTEM_QUERY_PCHAR);
-COUNT_q : '$count' -> type(COUNT), pushMode(DEFAULT_MODE);
-REF_q : '$ref' -> type(REF);
-VALUE_q : '$value' -> type(VALUE);
-ID : '$id' -> pushMode(MODE_SYSTEM_QUERY_REST);
-SEARCH : '$search' -> pushMode(MODE_SYSTEM_QUERY_SEARCH);
-
-EQ_q : '=' -> type(EQ);
-AMP_q : '&' -> type(AMP);
-
-AT_Q : '@' -> pushMode(DEFAULT_MODE);
-
-CUSTOMNAME : ~[&=@$] ~[&=]* -> pushMode(MODE_SYSTEM_QUERY_REST);
-
-//handle characters that failed to match any other token
-ERROR_CHARACTER_q : .;
-
-//;==============================================================================
-mode MODE_SYSTEM_QUERY_PCHAR;
-//;==============================================================================
-
-AMP_sqp : '&' -> type(AMP), popMode;
-
-fragment ALPHA_sqp : 'a'..'z'|'A'..'Z';
-fragment A_TO_F_sqp : 'a'..'f'|'A'..'F';
-fragment DIGIT_sqp : '0'..'9';
-fragment HEXDIG_sqp : DIGIT_sqp | A_TO_F_sqp;
-fragment PCT_ENCODED_sqp : '%' HEXDIG_sqp HEXDIG_sqp;
-fragment SUB_DELIMS_sqp : '$' | /*'&' |*/ '\'' | EQ_sqp | OTHER_DELIMS_sqp;
-fragment OTHER_DELIMS_sqp : '!' | '(' | ')' | '*' | '+' | ',' | ';';
-fragment UNRESERVED_sqp : ALPHA_sqp | DIGIT_sqp | '-' |'.' | '_' | '~';
-fragment PCHAR : UNRESERVED_sqp | PCT_ENCODED_sqp | SUB_DELIMS_sqp | ':' | '@';
-fragment PCHARSTART : UNRESERVED_sqp | PCT_ENCODED_sqp | '$' | /*'&' |*/ '\'' | OTHER_DELIMS_sqp | ':' | '@';
-
-ATOM : [Aa][Tt][Oo][Mm];
-JSON : [Jj][Ss][Oo][Nn];
-XML : [Xx][Mm][Ll];
-
-PCHARS : PCHARSTART PCHAR*;
-
-SLASH_sqp : '/' -> type(SLASH);
-EQ_sqp : '=' -> type(EQ);
-FRAGMENT_sqp : '#' -> type(FRAGMENT), pushMode(MODE_FRAGMENT);
-
-//handle characters that failed to match any other token
-ERROR_CHARACTER_sqp : .;
-
-//;==============================================================================
-mode MODE_FRAGMENT;
-// Read the remaining characters of a URI queryparameter up to an & or #
-// character.
-//;==============================================================================
-
-REST_F : ~('\r'|'\n')* -> type(REST), popMode;
-
-//;==============================================================================
-mode MODE_SYSTEM_QUERY_REST;
-// Read the remaining characters of a URI queryparameter up to an & or #
-// character.
-//;==============================================================================
-
-AMP_sqr : '&' -> type(AMP), popMode;
-FRAGMENT_sqr : '#' -> type(FRAGMENT), popMode;
-
-EQ_sqr : '=' -> type(EQ);
-REST : ~[&#=] ~[&#]*;
-
-//;==============================================================================
-mode MODE_SYSTEM_QUERY_SEARCH;
-//;==============================================================================
-
-NOT_sqc : 'NOT' -> type(NOT);
-AND_sqc : 'AND' -> type(AND);
-OR_sqc : 'OR' -> type(OR);
-EQ_sqc : '=' -> type(EQ);
-
-fragment WS_sqc : ( ' ' | '\u0009' | '%20' | '%09' );
-WSP_sqc : WS_sqc+ -> type(WSP);
-
-QUOTATION_MARK_sqc : '\u0022' | '%22';
-
-SEARCHWORD : ('a'..'z'|'A'..'Z')+;
-SEARCHPHRASE : QUOTATION_MARK_sqc ~["]* QUOTATION_MARK_sqc -> popMode;
-
-//;==============================================================================
-mode MODE_STRING;
-// Reads the remaining characters up to an ' character.
-// Any "'" characters inside a string are expressed as double "''".
-//;==============================================================================
-
-STRING_s : ('\'\'' | ~[\u0027] )* '\'' -> type(STRING), popMode;
-
-//;==============================================================================
-mode MODE_JSON_STRING;
-// Reads the remaining characters up to an " character.
-// Any """ characters inside a string are escaped with "\".
-//;==============================================================================
-
-STRING_IN_JSON : ('\\"' | ~[\u0022] )* ('"' | '%22') -> popMode;
-
-//;==============================================================================
-mode MODE_ODATA_GEO;
-//;==============================================================================
-
-fragment C_ : 'c'|'C';
-fragment D_ : 'd'|'D';
-fragment E_ : 'e'|'E';
-fragment G_ : 'g'|'G';
-fragment H_ : 'h'|'H';
-fragment I_ : 'i'|'I';
-fragment L_ : 'l'|'L';
-fragment M_ : 'm'|'M';
-fragment N_ : 'n'|'N';
-fragment O_ : 'o'|'O';
-fragment P_ : 'p'|'P';
-fragment R_ : 'r'|'R';
-fragment S_ : 's'|'S';
-fragment T_ : 't'|'T';
-fragment U_ : 'u'|'U';
-fragment Y_ : 'y'|'Y';
-
-fragment SP_g : ' ';//'\u0020'; // a simple space
-fragment WS_g : ( ' ' | '%20' | '%09' );
-
-OPEN_g : ('(' | '%28') -> type(OPEN);
-CLOSE_g : (')' | '%29') -> type(CLOSE);
-COMMA_g : (',' | '%2C') -> type(COMMA);
-WSP_g : WS_g+ -> type(WSP);
-POINT_g : '.' -> type(POINT);
-AT_g : '@' -> type(AT);
-SEMI_g : (';' | '%3B') -> type(SEMI);
-EQ_g : '=' -> type(EQ);
-
-fragment DIGIT_g : '0'..'9';
-fragment DIGITS_g : DIGIT_g+;
-SIGN_g : ('+' | '%2B' |'-') -> type(SIGN);
-INT_g : SIGN_g? DIGITS_g -> type(INT);
-DECIMAL_g : 'SS' INT_g '.' DIGITS_g (('e'|'E') SIGN_g? DIGITS_g)? -> type(DECIMAL);
-COLLECTION_g : C_ O_ L_ L_ E_ C_ T_ I_ O_ N_ -> type(COLLECTION);
-LINESTRING : L_ I_ N_ E_ S_ T_ R_ I_ N_ G_ ;
-MULTILINESTRING : M_ U_ L_ T_ I_ L_ I_ N_ E_ S_ T_ R_ I_ N_ G_;
-MULTIPOINT : M_ U_ L_ T_ I_ P_ O_ I_ N_ T_ ;
-MULTIPOLYGON : M_ U_ L_ T_ I_ P_ O_ L_ Y_ G_ O_ N_;
-GEO_POINT : P_ O_ I_ N_ T_;
-POLYGON : P_ O_ L_ Y_ G_ O_ N_ ;
-
-SRID : S_ R_ I_ D_;
-
-SQUOTE : '\'' -> popMode;
diff --git a/lib/server-core/src/main/antlr4/org/apache/olingo/server/core/uri/antlr/UriParser.g4 b/lib/server-core/src/main/antlr4/org/apache/olingo/server/core/uri/antlr/UriParser.g4
deleted file mode 100644
index 7efc14c..0000000
--- a/lib/server-core/src/main/antlr4/org/apache/olingo/server/core/uri/antlr/UriParser.g4
+++ /dev/null
@@ -1,439 +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.
- ******************************************************************************/
-
-grammar UriParser;
-
-//------------------------------------------------------------------------------
-// This grammar refers to the "odata-abnf-construction-rules.txt" Revision 517.
-// URL: https://tools.oasis-open.org/version-control/browse/wsvn/odata/trunk/spec/ABNF/odata-abnf-construction-rules.txt?rev=517
-
-// While contructing this grammar we tried to keep it close to the ABNF.
-// However this is not really possible in order to support
-// - percent decoding
-// - operator precedence
-// - having a context free grammar ( without java snipplets to add context)
-// - generating the parser in different target languages
-// Currently not supported are
-// - $search
-// - geometry data
-// - json data in url
-//------------------------------------------------------------------------------
-
-
-options {
- language = Java;
- tokenVocab = UriLexer;
-}
-
-//;------------------------------------------------------------------------------
-//; 0. URI
-//;------------------------------------------------------------------------------
-
-batchEOF : BATCH EOF;
-
-entityEOF : vNS=namespace vODI=odataIdentifier;
-
-metadataEOF : METADATA EOF;
-
-//;------------------------------------------------------------------------------
-//; 1. Resource Path
-//;------------------------------------------------------------------------------
-
-//resourcePathEOF : vlPS=pathSegments EOF;
-
-crossjoinEOF : CROSSJOIN OPEN WSP? vlODI+=odataIdentifier WSP? ( COMMA WSP? vlODI+=odataIdentifier WSP?)* CLOSE EOF;
-
-allEOF : ALL;
-
-pathSegmentEOF : (pathSegment | constSegment) EOF;
-
-pathSegments : vlPS+=pathSegment (SLASH vlPS+=pathSegment)* (SLASH vCS=constSegment)?;
-
-pathSegment : vNS=namespace? vODI=odataIdentifier vlNVO+=nameValueOptList*;
-
-nameValueOptList : OPEN (vVO=commonExpr | vNVL=nameValueList)? CLOSE;
-nameValueList : WSP* vlNVP+=nameValuePair WSP* ( COMMA WSP* vlNVP+=nameValuePair WSP*)* ;
-nameValuePair : vODI=odataIdentifier EQ (AT vALI=odataIdentifier | vCOM=commonExpr /*TODO | val2=enumX*/);
-
-constSegment : (vV=value | vC=count | vR=ref | vAll=allExpr | vAny=anyExpr);
-
-count : COUNT;
-ref : REF;
-value : VALUE;
-
-//;------------------------------------------------------------------------------
-//; 2. Query Options
-//;------------------------------------------------------------------------------
-
-queryOptions : vlQO+=queryOption ( AMP vlQO+=queryOption )*;//TODO can this be removed
-
-queryOption : systemQueryOption;
-
-systemQueryOption : expand
- | filter
- | inlinecount
- | orderBy
- | search
- | select
- | skip
- | skiptoken
- | top
- ;
-
-skiptoken : SKIPTOKEN EQ REST;
-expand : EXPAND EQ expandItems;
-
-expandItemsEOF : expandItems EOF;
-expandItems : vlEI+=expandItem ( COMMA vlEI+=expandItem )*;
-
-
-expandItem : vS=STAR ( SLASH vR=ref | OPEN LEVELS EQ ( vL=INT | vM=MAX) CLOSE )?
- | vEP=expandPath vEPE=expandPathExtension?;
-
-
-expandPath : vlPS+=pathSegment (SLASH vlPS+=pathSegment)*;
-
-expandPathExtension : OPEN vlEO+=expandOption ( SEMI vlEO+=expandOption )* CLOSE
- | SLASH vR=ref ( OPEN vlEOR+=expandRefOption ( SEMI vlEOR+=expandRefOption )* CLOSE )?
- | SLASH vC=count ( OPEN vlEOC+=expandCountOption ( SEMI vlEOC+=expandCountOption )* CLOSE )?
- ;
-
-expandCountOption : filter
- | search
- ;
-
-expandRefOption : expandCountOption
- | orderBy
- | skip
- | top
- | inlinecount
- ;
-
-expandOption : expandRefOption
- | select
- | expand
- | levels;
-
-levels : LEVELS EQ ( INT | MAX );
-
-filter : FILTER EQ commonExpr;
-
-filterExpressionEOF : commonExpr EOF;
-
-orderBy : ORDERBY EQ orderList;
-
-orderByEOF : orderList EOF;
-
-orderList : vlOI+=orderByItem ( WSP* COMMA WSP* vlOI+=orderByItem )*;
-
-orderByItem : vC=commonExpr ( WSP ( vA=ASC | vD=DESC ) )?;
-
-skip : SKIP EQ INT;
-top : TOP EQ INT;
-//format : FORMAT EQ ( ATOM | JSON | XML | PCHARS SLASH PCHARS);
-
-inlinecount : COUNT EQ booleanNonCase;
-
-search : SEARCH searchSpecialToken;
-searchInline : SEARCH_INLINE searchSpecialToken;
-
-searchSpecialToken : EQ WSP? searchExpr;
-
-searchExpr : (NOT WSP) searchExpr
- | searchExpr searchExpr
- | searchExpr WSP searchExpr
- | searchExpr ( WSP AND WSP) searchExpr
- | searchExpr ( WSP OR WSP) searchExpr
- | searchPhrase
- | searchWord
- ;
-
-searchPhrase : SEARCHPHRASE;
-searchWord : SEARCHWORD;
-
-select : SELECT EQ vlSI+=selectItem ( COMMA vlSI+=selectItem )*;
-selectEOF : vlSI+=selectItem ( COMMA vlSI+=selectItem )*;
-
-selectItem : vlSS+=selectSegment ( SLASH vlSS+=selectSegment ) *;
-selectSegment : vNS=namespace? ( vODI=odataIdentifier | vS=STAR );
-
-aliasAndValue : vODI=ODATAIDENTIFIER EQ vV=parameterValue;
-
-parameterValue : commonExpr //TODO json not supported arrayOrObject
- ;
-
-//;------------------------------------------------------------------------------
-//; 3. Context URL Fragments
-//;------------------------------------------------------------------------------
-
-contextFragment : REST; // the context fragment is only required on the client side
-
-//;------------------------------------------------------------------------------
-//; 4. Expressions
-//;------------------------------------------------------------------------------
-
-commonExpr : OPEN commonExpr CLOSE #altPharenthesis
- | vE1=commonExpr (WSP HAS WSP) vE2=commonExpr #altHas
- | methodCallExpr #altMethod
- | ( unary WSP? ) commonExpr #altUnary
- | anyExpr #altAny
- | allExpr #altAll
- | memberExpr #altMember
- | vE1=commonExpr (WSP vO=MUL WSP | WSP vO=DIV WSP | WSP vO=MOD WSP ) vE2=commonExpr #altMult
- | vE1=commonExpr (WSP vO=ADD WSP | WSP vO=SUB WSP) vE2=commonExpr #altAdd
- | vE1=commonExpr (WSP vO=GT WSP | WSP vO=GE WSP | WSP vO=LT WSP
- | WSP vO=LE WSP ) vE2=commonExpr #altComparism
- | vE1=commonExpr (WSP vO=EQ_ALPHA WSP | WSP vO=NE WSP) vE2=commonExpr #altEquality
- | vE1=commonExpr (WSP AND WSP) vE2=commonExpr #altAnd
- | vE1=commonExpr (WSP OR WSP) vE2=commonExpr #altOr
- | rootExpr #altRoot // $...
- | AT odataIdentifier #altAlias // @...
- | primitiveLiteral #altLiteral // ...
- ;
-
-unary : (MINUS| NOT) ;
-
-rootExpr : ROOT vPs=pathSegments;
-
-memberExpr : vIt=IT ( SLASH (vANY=anyExpr | vALL=allExpr))?
- | vIts=ITSLASH? vPs=pathSegments ( SLASH (vANY=anyExpr | vALL=allExpr))?;
-
-anyExpr : ANY_LAMDA OPEN WSP? ( vLV=odataIdentifier WSP? COLON WSP? vLE=commonExpr WSP? )? CLOSE;
-allExpr : ALL_LAMDA OPEN WSP? vLV=odataIdentifier WSP? COLON WSP? vLE=commonExpr WSP? CLOSE;
-
-methodCallExpr : indexOfMethodCallExpr
- | toLowerMethodCallExpr
- | toUpperMethodCallExpr
- | trimMethodCallExpr
- | substringMethodCallExpr
- | concatMethodCallExpr
- | lengthMethodCallExpr
- | yearMethodCallExpr
- | monthMethodCallExpr
- | dayMethodCallExpr
- | hourMethodCallExpr
- | minuteMethodCallExpr
- | secondMethodCallExpr
- | fractionalsecondsMethodCallExpr
- | totalsecondsMethodCallExpr
- | dateMethodCallExpr
- | timeMethodCallExpr
- | roundMethodCallExpr
- | floorMethodCallExpr
- | ceilingMethodCallExpr
- | geoDistanceMethodCallExpr
- | geoLengthMethodCallExpr
- | totalOffsetMinutesMethodCallExpr
- | minDateTimeMethodCallExpr
- | maxDateTimeMethodCallExpr
- | nowMethodCallExpr
- //from boolean
- | isofExpr
- | castExpr
- | endsWithMethodCallExpr
- | startsWithMethodCallExpr
- | containsMethodCallExpr
- | geoIntersectsMethodCallExpr
- ;
-
-
-containsMethodCallExpr : CONTAINS_WORD WSP? vE1=commonExpr WSP? COMMA WSP? vE2=commonExpr WSP? CLOSE;
-startsWithMethodCallExpr : STARTSWITH_WORD WSP? vE1=commonExpr WSP? COMMA WSP? vE2=commonExpr WSP? CLOSE;
-endsWithMethodCallExpr : ENDSWITH_WORD WSP? vE1=commonExpr WSP? COMMA WSP? vE2=commonExpr WSP? CLOSE;
-lengthMethodCallExpr : LENGTH_WORD WSP? vE1=commonExpr WSP? CLOSE;
-indexOfMethodCallExpr : INDEXOF_WORD WSP? vE1=commonExpr WSP? COMMA WSP? vE2=commonExpr WSP? CLOSE;
-substringMethodCallExpr : SUBSTRING_WORD WSP? vE1=commonExpr WSP? COMMA WSP? vE2=commonExpr WSP? ( COMMA WSP? vE3=commonExpr WSP? )? CLOSE;
-toLowerMethodCallExpr : TOLOWER_WORD WSP? vE1=commonExpr WSP? CLOSE;
-toUpperMethodCallExpr : TOUPPER_WORD WSP? vE1=commonExpr WSP? CLOSE;
-trimMethodCallExpr : TRIM_WORD WSP? vE1=commonExpr WSP? CLOSE;
-concatMethodCallExpr : CONCAT_WORD WSP? vE1=commonExpr WSP? COMMA WSP? vE2=commonExpr WSP? CLOSE;
-
-yearMethodCallExpr : YEAR_WORD WSP? vE1=commonExpr WSP? CLOSE;
-monthMethodCallExpr : MONTH_WORD WSP? vE1=commonExpr WSP? CLOSE;
-dayMethodCallExpr : DAY_WORD WSP? vE1=commonExpr WSP? CLOSE;
-hourMethodCallExpr : HOUR_WORD WSP? vE1=commonExpr WSP? CLOSE;
-minuteMethodCallExpr : MINUTE_WORD WSP? vE1=commonExpr WSP? CLOSE;
-secondMethodCallExpr : SECOND_WORD WSP? vE1=commonExpr WSP? CLOSE;
-fractionalsecondsMethodCallExpr : FRACTIONALSECONDS_WORD WSP? vE1=commonExpr WSP? CLOSE;
-totalsecondsMethodCallExpr : TOTALSECONDS_WORD WSP? vE1=commonExpr WSP? CLOSE;
-dateMethodCallExpr : DATE_WORD WSP? vE1=commonExpr WSP? CLOSE;
-timeMethodCallExpr : TIME_WORD WSP? vE1=commonExpr WSP? CLOSE;
-totalOffsetMinutesMethodCallExpr : TOTALOFFSETMINUTES_WORD WSP? vE1=commonExpr WSP? CLOSE;
-
-minDateTimeMethodCallExpr : MINDATETIME_WORD WSP? CLOSE;
-maxDateTimeMethodCallExpr : MAXDATETIME_WORD WSP? CLOSE;
-nowMethodCallExpr : NOW_WORD WSP? CLOSE;
-
-roundMethodCallExpr : ROUND_WORD WSP? vE1=commonExpr WSP? CLOSE;
-floorMethodCallExpr : FLOOR_WORD WSP? vE1=commonExpr WSP? CLOSE;
-ceilingMethodCallExpr : CEILING_WORD WSP? vE1=commonExpr WSP? CLOSE;
-
-geoDistanceMethodCallExpr : GEO_DISTANCE_WORD WSP? vE1=commonExpr WSP? COMMA WSP? vE2=commonExpr WSP? CLOSE;
-geoLengthMethodCallExpr : GEO_LENGTH_WORD WSP? vE1=commonExpr WSP? CLOSE;
-geoIntersectsMethodCallExpr : GEO_INTERSECTS_WORD WSP? vE1=commonExpr WSP? COMMA WSP? vE2=commonExpr WSP? CLOSE;
-
-isofExpr : ISOF_WORD WSP? ( vE1=commonExpr WSP? COMMA WSP? )? vNS=namespace vODI=odataIdentifier WSP? CLOSE;
-castExpr : CAST_WORD WSP? ( vE1=commonExpr WSP? COMMA WSP? )? vNS=namespace vODI=odataIdentifier WSP? CLOSE;
-
-//;------------------------------------------------------------------------------
-//; 5. JSON format for function parameters
-//;------------------------------------------------------------------------------
-//; Note: the query part of a URI needs to be partially percent-decoded before
-//; applying these rules, see comment at the top of this file
-//;------------------------------------------------------------------------------
-
-arrayOrObject : json_array
- | json_object;
-
-json_array : BEGIN_ARRAY json_value ( WSP? COMMA WSP? json_value)* END_ARRAY;
-
-json_value : jsonPrimitiv
- | rootExpr
- | json_object
- | json_array;
-
-json_object : BEGIN_OBJECT
- STRING_IN_JSON
- WSP? COLON WSP?
- json_value
- END_OBJECT;
-
-
-//; JSON syntax: adapted to URI restrictions from [RFC4627]
-jsonPrimitiv : STRING_IN_JSON
- | number_in_json
- | TRUE
- | FALSE
- | 'null'
- ;
-
-number_in_json : INT | DECIMAL;
-
-//;------------------------------------------------------------------------------
-//; 6. Names and identifiers
-//;------------------------------------------------------------------------------
-
-qualifiedtypename : namespace odataIdentifier
- | 'collection' OPEN ( namespace odataIdentifier ) CLOSE
- ;
-
-namespace : (odataIdentifier POINT)+;
-
-odataIdentifier : ODATAIDENTIFIER;
-
-//;------------------------------------------------------------------------------
-//; 7. Literal Data Values
-//;------------------------------------------------------------------------------
-
-
-primitiveLiteral : nullrule
- | booleanNonCase
- | DECIMAL //includes double and single literals
- | naninfinity
- | INT //includes int16/int32 and int64 literals
- | BINARY
- | DATE
- | DATETIMEOFFSET
- | DURATION
- | GUID
- | string
- | TIMEOFDAY
- | enumLit
- | geographyCollection
- | geographyLineString
- | geographyMultilineString
- | geographyMultipoint
- | geographyMultipolygon
- | geographyPoint
- | geographyPolygon
- | geometryCollection
- | geometryLineString
- | geometryMultilineString
- | geometryMultipoint
- | geometryMultipolygon
- | geometryPoint
- | geometryPolygon
- ;
-
-naninfinity : NANINFINITY;
-
-nullrule : NULLVALUE;
-booleanNonCase : BOOLEAN | TRUE | FALSE;
-string : STRING;
-
-enumLit : vNS=namespace vODI=odataIdentifier vValues=STRING;
-enumValues : vlODI+=odataIdentifier ( COMMA vlODI+=odataIdentifier )*;
-
-geographyCollection : GEOGRAPHY fullCollectionLiteral SQUOTE;
-fullCollectionLiteral : sridLiteral collectionLiteral;
-
-collectionLiteral : (COLLECTION ) OPEN geoLiteral ( COMMA geoLiteral )* CLOSE;
-
-geoLiteral : collectionLiteral
- | lineStringLiteral
- | multipointLiteral
- | multilineStringLiteral
- | multipolygonLiteral
- | pointLiteral
- | polygonLiteral;
-
-geographyLineString : GEOGRAPHY fullLineStringLiteral SQUOTE;
-fullLineStringLiteral : sridLiteral lineStringLiteral;
-lineStringLiteral : LINESTRING lineStringData;
-lineStringData : OPEN positionLiteral ( COMMA positionLiteral )* CLOSE;
-
-geographyMultilineString : GEOGRAPHY fullMultilineStringLiteral SQUOTE;
-fullMultilineStringLiteral : sridLiteral multilineStringLiteral;
-multilineStringLiteral : MULTILINESTRING OPEN ( lineStringData ( COMMA lineStringData )* )? CLOSE;
-
-geographyMultipoint : GEOGRAPHY fullMultipointLiteral SQUOTE;
-fullMultipointLiteral : sridLiteral multipointLiteral;
-multipointLiteral : MULTIPOINT OPEN ( pointData ( COMMA pointData )* )? CLOSE ;
-
-geographyMultipolygon : GEOGRAPHY fullmultipolygonLiteral SQUOTE;
-fullmultipolygonLiteral : sridLiteral multipolygonLiteral;
-multipolygonLiteral : MULTIPOLYGON OPEN ( polygonData ( COMMA polygonData )* )? CLOSE;
-
-geographyPoint : GEOGRAPHY fullpointLiteral SQUOTE;
-fullpointLiteral : sridLiteral pointLiteral;
-
-pointLiteral : GEO_POINT pointData;
-pointData : OPEN positionLiteral CLOSE;
-
-positionLiteral : (DECIMAL | INT ) WSP (DECIMAL | INT ); //; longitude, then latitude
-
-
-geographyPolygon : GEOGRAPHY fullPolygonLiteral SQUOTE;
-fullPolygonLiteral : sridLiteral polygonLiteral;
-polygonLiteral : POLYGON polygonData;
-polygonData : OPEN ringLiteral ( COMMA ringLiteral )* CLOSE;
-ringLiteral : OPEN positionLiteral ( COMMA positionLiteral )* CLOSE;
-
-
-geometryCollection : GEOMETRY fullCollectionLiteral SQUOTE;
-geometryLineString : GEOMETRY fullLineStringLiteral SQUOTE;
-geometryMultilineString : GEOMETRY fullMultilineStringLiteral SQUOTE;
-geometryMultipoint : GEOMETRY fullMultipointLiteral SQUOTE;
-geometryMultipolygon : GEOMETRY fullmultipolygonLiteral SQUOTE;
-geometryPoint : GEOMETRY fullpointLiteral SQUOTE;
-geometryPolygon : GEOMETRY fullPolygonLiteral SQUOTE;
-
-sridLiteral : SRID EQ INT SEMI;
-
-
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/ContentNegotiator.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/ContentNegotiator.java
deleted file mode 100644
index f0e3d2d..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/ContentNegotiator.java
+++ /dev/null
@@ -1,167 +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;
-
-import java.util.Arrays;
-import java.util.List;
-
-import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
-import org.apache.olingo.commons.api.format.AcceptType;
-import org.apache.olingo.commons.api.format.ContentType;
-import org.apache.olingo.commons.api.format.ODataFormat;
-import org.apache.olingo.commons.api.http.HttpHeader;
-import org.apache.olingo.server.api.ODataRequest;
-import org.apache.olingo.server.api.serializer.CustomContentTypeSupport;
-import org.apache.olingo.server.api.serializer.RepresentationType;
-import org.apache.olingo.server.api.uri.queryoption.FormatOption;
-
-public class ContentNegotiator {
-
- private ContentNegotiator() {}
-
- private static List<ContentType> getDefaultSupportedContentTypes(final RepresentationType type) {
- switch (type) {
- case METADATA:
- return Arrays.asList(ContentType.APPLICATION_XML);
- case MEDIA:
- case BINARY:
- return Arrays.asList(ContentType.APPLICATION_OCTET_STREAM);
- case VALUE:
- case COUNT:
- return Arrays.asList(ContentType.TEXT_PLAIN);
- case BATCH:
- return Arrays.asList(ContentType.MULTIPART_MIXED);
- default:
- return Arrays.asList(
- ODataFormat.JSON.getContentType(ODataServiceVersion.V40),
- ODataFormat.JSON_NO_METADATA.getContentType(ODataServiceVersion.V40));
- }
- }
-
- private static List<ContentType> getSupportedContentTypes(
- final CustomContentTypeSupport customContentTypeSupport, final RepresentationType representationType)
- throws ContentNegotiatorException {
- final List<ContentType> defaultSupportedContentTypes = getDefaultSupportedContentTypes(representationType);
- final List<ContentType> result = customContentTypeSupport == null ? defaultSupportedContentTypes :
- customContentTypeSupport.modifySupportedContentTypes(defaultSupportedContentTypes, representationType);
- if (result == null || result.isEmpty()) {
- throw new ContentNegotiatorException("No content type has been specified as supported.",
- ContentNegotiatorException.MessageKeys.NO_CONTENT_TYPE_SUPPORTED);
- } else {
- return result;
- }
- }
-
- public static ContentType doContentNegotiation(final FormatOption formatOption, final ODataRequest request,
- final CustomContentTypeSupport customContentTypeSupport, final RepresentationType representationType)
- throws ContentNegotiatorException {
- final List<ContentType> supportedContentTypes =
- getSupportedContentTypes(customContentTypeSupport, representationType);
- final String acceptHeaderValue = request.getHeader(HttpHeader.ACCEPT);
- ContentType result = null;
-
- if (formatOption != null && formatOption.getFormat() != null) {
- final String formatString = formatOption.getFormat().trim();
- final ODataFormat format =
- ODataFormat.JSON.name().equalsIgnoreCase(formatString) ? ODataFormat.JSON :
- ODataFormat.XML.name().equalsIgnoreCase(formatString) ? ODataFormat.XML :
- ODataFormat.ATOM.name().equalsIgnoreCase(formatString) ? ODataFormat.ATOM : null;
- try {
- result = getAcceptedType(
- AcceptType.fromContentType(format == null ?
- ContentType.create(formatOption.getFormat()) : format.getContentType(ODataServiceVersion.V40)),
- supportedContentTypes);
- } catch (final IllegalArgumentException e) {}
- if (result == null) {
- throw new ContentNegotiatorException("Unsupported $format = " + formatString,
- ContentNegotiatorException.MessageKeys.UNSUPPORTED_FORMAT_OPTION, formatString);
- }
- } else if (acceptHeaderValue != null) {
- final List<AcceptType> acceptedContentTypes = AcceptType.create(acceptHeaderValue);
- try {
- result = getAcceptedType(acceptedContentTypes, supportedContentTypes);
- } catch (final IllegalArgumentException e) {
- throw new ContentNegotiatorException("charset in accept header not supported: " + acceptHeaderValue, e,
- ContentNegotiatorException.MessageKeys.WRONG_CHARSET_IN_HEADER, HttpHeader.ACCEPT, acceptHeaderValue);
- }
- if (result == null) {
- throw new ContentNegotiatorException(
- "unsupported accept content type: " + acceptedContentTypes + " != " + supportedContentTypes,
- ContentNegotiatorException.MessageKeys.UNSUPPORTED_CONTENT_TYPES, acceptedContentTypes.toString());
- }
- } else {
- final ContentType requestedContentType = getDefaultSupportedContentTypes(representationType).get(0);
- result = getAcceptedType(AcceptType.fromContentType(requestedContentType), supportedContentTypes);
- if (result == null) {
- throw new ContentNegotiatorException(
- "unsupported accept content type: " + requestedContentType + " != " + supportedContentTypes,
- ContentNegotiatorException.MessageKeys.UNSUPPORTED_CONTENT_TYPE,
- requestedContentType.toContentTypeString());
- }
- }
- return result;
- }
-
- private static ContentType getAcceptedType(final List<AcceptType> acceptedContentTypes,
- final List<ContentType> supportedContentTypes) {
- for (final AcceptType acceptedType : acceptedContentTypes) {
- for (final ContentType supportedContentType : supportedContentTypes) {
- ContentType contentType = supportedContentType;
- if (acceptedType.getParameters().containsKey("charset")) {
- final String value = acceptedType.getParameters().get("charset");
- if ("utf8".equalsIgnoreCase(value) || "utf-8".equalsIgnoreCase(value)) {
- contentType = ContentType.create(contentType, ContentType.PARAMETER_CHARSET_UTF8);
- } else {
- throw new IllegalArgumentException("charset not supported: " + acceptedType);
- }
- }
- if (acceptedType.matches(contentType)) {
- return contentType;
- }
- }
- }
- return null;
- }
-
- public static void checkSupport(final ContentType contentType,
- final CustomContentTypeSupport customContentTypeSupport, final RepresentationType representationType)
- throws ContentNegotiatorException {
- for (final ContentType supportedContentType :
- getSupportedContentTypes(customContentTypeSupport, representationType)) {
- if (AcceptType.fromContentType(supportedContentType).get(0).matches(contentType)) {
- return;
- }
- }
- throw new ContentNegotiatorException("unsupported content type: " + contentType,
- ContentNegotiatorException.MessageKeys.UNSUPPORTED_CONTENT_TYPE, contentType.toContentTypeString());
- }
-
- public static boolean isSupported(final ContentType contentType,
- final CustomContentTypeSupport customContentTypeSupport,
- final RepresentationType representationType) throws ContentNegotiatorException {
-
- for (final ContentType supportedContentType :
- getSupportedContentTypes(customContentTypeSupport, representationType)) {
- if (AcceptType.fromContentType(supportedContentType).get(0).matches(contentType)) {
- return true;
- }
- }
- return false;
- }
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/ContentNegotiatorException.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/ContentNegotiatorException.java
deleted file mode 100644
index e2ee866..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/ContentNegotiatorException.java
+++ /dev/null
@@ -1,57 +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;
-
-import org.apache.olingo.server.api.ODataTranslatedException;
-
-public class ContentNegotiatorException extends ODataTranslatedException {
- private static final long serialVersionUID = -8112658467394158700L;
-
- public static enum MessageKeys implements MessageKey {
- /** parameters: HTTP header name, HTTP header value */
- WRONG_CHARSET_IN_HEADER,
- /** parameter: list of content-type ranges */
- UNSUPPORTED_CONTENT_TYPES,
- /** parameter: content type */
- UNSUPPORTED_CONTENT_TYPE,
- /** no parameter */
- NO_CONTENT_TYPE_SUPPORTED,
- /** parameter: format string */
- UNSUPPORTED_FORMAT_OPTION;
-
- @Override
- public String getKey() {
- return name();
- }
- }
-
- public ContentNegotiatorException(String developmentMessage, MessageKey messageKey, String... parameters) {
- super(developmentMessage, messageKey, parameters);
- }
-
- public ContentNegotiatorException(String developmentMessage, Throwable cause, MessageKey messageKey,
- String... parameters) {
- super(developmentMessage, cause, messageKey, parameters);
- }
-
- @Override
- protected String getBundleName() {
- return DEFAULT_SERVER_BUNDLE_NAME;
- }
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/DefaultRedirectProcessor.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/DefaultRedirectProcessor.java
deleted file mode 100644
index 23e539b..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/DefaultRedirectProcessor.java
+++ /dev/null
@@ -1,49 +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;
-
-import org.apache.olingo.commons.api.http.HttpHeader;
-import org.apache.olingo.commons.api.http.HttpStatusCode;
-import org.apache.olingo.server.api.OData;
-import org.apache.olingo.server.api.ODataRequest;
-import org.apache.olingo.server.api.ODataResponse;
-import org.apache.olingo.server.api.ServiceMetadata;
-
-public class DefaultRedirectProcessor implements RedirectProcessor {
-
- @Override
- public void init(final OData odata, final ServiceMetadata serviceMetadata) {}
-
- @Override
- public void redirect(final ODataRequest request, final ODataResponse response) {
- response.setStatusCode(HttpStatusCode.TEMPORARY_REDIRECT.getStatusCode());
-
- String location;
-
- String rawUri = request.getRawRequestUri();
- String rawQueryPath = request.getRawQueryPath();
- if (rawQueryPath == null) {
- location = request.getRawRequestUri() + "/";
- } else {
- location = rawUri.substring(0, rawUri.indexOf(rawQueryPath) - 1) + "/?" + rawQueryPath;
- }
-
- response.setHeader(HttpHeader.LOCATION, location);
- }
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataExceptionHelper.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataExceptionHelper.java
deleted file mode 100644
index be3e7ec..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataExceptionHelper.java
+++ /dev/null
@@ -1,136 +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;
-
-import java.util.Locale;
-
-import org.apache.olingo.commons.api.http.HttpStatusCode;
-import org.apache.olingo.server.api.ODataApplicationException;
-import org.apache.olingo.server.api.ODataServerError;
-import org.apache.olingo.server.api.ODataTranslatedException;
-import org.apache.olingo.server.api.ODataTranslatedException.ODataErrorMessage;
-import org.apache.olingo.server.api.batch.exception.BatchDeserializerException;
-import org.apache.olingo.server.api.serializer.SerializerException;
-import org.apache.olingo.server.core.uri.parser.UriParserException;
-import org.apache.olingo.server.core.uri.parser.UriParserSemanticException;
-import org.apache.olingo.server.core.uri.parser.UriParserSyntaxException;
-import org.apache.olingo.server.core.uri.validator.UriValidationException;
-
-public class ODataExceptionHelper {
-
- public static ODataServerError createServerErrorObject(UriValidationException e, Locale requestedLocale) {
- ODataServerError serverError = basicTranslatedError(e, requestedLocale);
- serverError.setStatusCode(HttpStatusCode.BAD_REQUEST.getStatusCode());
- return serverError;
- }
-
- public static ODataServerError createServerErrorObject(UriParserSemanticException e, Locale requestedLocale) {
- ODataServerError serverError = basicTranslatedError(e, requestedLocale);
- if (UriParserSemanticException.MessageKeys.RESOURCE_NOT_FOUND.equals(e.getMessageKey())
- || UriParserSemanticException.MessageKeys.FUNCTION_NOT_FOUND.equals(e.getMessageKey())
- || UriParserSemanticException.MessageKeys.PROPERTY_NOT_IN_TYPE.equals(e.getMessageKey())) {
- serverError.setStatusCode(HttpStatusCode.NOT_FOUND.getStatusCode());
- } else {
- serverError.setStatusCode(HttpStatusCode.BAD_REQUEST.getStatusCode());
- }
- return serverError;
- }
-
- public static ODataServerError createServerErrorObject(UriParserSyntaxException e, Locale requestedLocale) {
- ODataServerError serverError = basicTranslatedError(e, requestedLocale);
- serverError.setStatusCode(
- UriParserSyntaxException.MessageKeys.WRONG_VALUE_FOR_SYSTEM_QUERY_OPTION_FORMAT.equals(e.getMessageKey()) ?
- HttpStatusCode.NOT_ACCEPTABLE.getStatusCode() :
- HttpStatusCode.BAD_REQUEST.getStatusCode());
- return serverError;
- }
-
- public static ODataServerError createServerErrorObject(UriParserException e, Locale requestedLocale) {
- ODataServerError serverError = basicTranslatedError(e, requestedLocale);
- serverError.setStatusCode(HttpStatusCode.BAD_REQUEST.getStatusCode());
- return serverError;
- }
-
- public static ODataServerError createServerErrorObject(ContentNegotiatorException e, Locale requestedLocale) {
- ODataServerError serverError = basicTranslatedError(e, requestedLocale);
- serverError.setStatusCode(HttpStatusCode.NOT_ACCEPTABLE.getStatusCode());
- return serverError;
- }
-
- public static ODataServerError createServerErrorObject(ODataHandlerException e, Locale requestedLocale) {
- ODataServerError serverError = basicTranslatedError(e, requestedLocale);
- if (ODataHandlerException.MessageKeys.FUNCTIONALITY_NOT_IMPLEMENTED.equals(e.getMessageKey())
- || ODataHandlerException.MessageKeys.PROCESSOR_NOT_IMPLEMENTED.equals(e.getMessageKey())) {
- serverError.setStatusCode(HttpStatusCode.NOT_IMPLEMENTED.getStatusCode());
- } else if (ODataHandlerException.MessageKeys.ODATA_VERSION_NOT_SUPPORTED.equals(e.getMessageKey())
- || ODataHandlerException.MessageKeys.INVALID_HTTP_METHOD.equals(e.getMessageKey())
- || ODataHandlerException.MessageKeys.AMBIGUOUS_XHTTP_METHOD.equals(e.getMessageKey())) {
- serverError.setStatusCode(HttpStatusCode.BAD_REQUEST.getStatusCode());
- } else if (ODataHandlerException.MessageKeys.HTTP_METHOD_NOT_ALLOWED.equals(e.getMessageKey())) {
- serverError.setStatusCode(HttpStatusCode.METHOD_NOT_ALLOWED.getStatusCode());
- }
-
- return serverError;
- }
-
- public static ODataServerError createServerErrorObject(SerializerException e, Locale requestedLocale) {
- ODataServerError serverError = basicTranslatedError(e, requestedLocale);
- serverError.setStatusCode(HttpStatusCode.BAD_REQUEST.getStatusCode());
- return serverError;
- }
-
- public static ODataServerError createServerErrorObject(BatchDeserializerException e, Locale requestedLocale) {
- ODataServerError serverError = basicTranslatedError(e, requestedLocale);
- serverError.setStatusCode(HttpStatusCode.BAD_REQUEST.getStatusCode());
- return serverError;
- }
-
- public static ODataServerError createServerErrorObject(ODataTranslatedException e, Locale requestedLocale) {
- return basicTranslatedError(e, requestedLocale);
- }
-
- public static ODataServerError createServerErrorObject(ODataApplicationException e) {
- ODataServerError serverError = basicServerError(e);
- serverError.setStatusCode(e.getStatusCode());
- serverError.setLocale(e.getLocale());
- serverError.setCode(e.getODataErrorCode());
- return serverError;
- }
-
- public static ODataServerError createServerErrorObject(Exception e) {
- ODataServerError serverError = basicServerError(e);
- serverError.setStatusCode(HttpStatusCode.INTERNAL_SERVER_ERROR.getStatusCode());
- serverError.setLocale(Locale.ENGLISH);
- return serverError;
- }
-
- private static ODataServerError basicServerError(Exception e) {
- ODataServerError serverError = new ODataServerError().setException(e).setMessage(e.getMessage());
- return serverError;
- }
-
- private static ODataServerError basicTranslatedError(ODataTranslatedException e, Locale requestedLocale) {
- ODataServerError serverError = basicServerError(e);
- ODataErrorMessage translatedMessage = e.getTranslatedMessage(requestedLocale);
- serverError.setMessage(translatedMessage.getMessage());
- serverError.setLocale(translatedMessage.getLocale());
- serverError.setStatusCode(HttpStatusCode.INTERNAL_SERVER_ERROR.getStatusCode());
- return serverError;
- }
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataHandler.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataHandler.java
deleted file mode 100644
index 4528d3a..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataHandler.java
+++ /dev/null
@@ -1,699 +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;
-
-import java.util.LinkedList;
-import java.util.List;
-
-import org.apache.olingo.commons.api.edm.EdmAction;
-import org.apache.olingo.commons.api.edm.EdmActionImport;
-import org.apache.olingo.commons.api.edm.EdmEntityType;
-import org.apache.olingo.commons.api.edm.EdmFunction;
-import org.apache.olingo.commons.api.edm.EdmFunctionImport;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
-import org.apache.olingo.commons.api.edm.EdmReturnType;
-import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
-import org.apache.olingo.commons.api.format.ContentType;
-import org.apache.olingo.commons.api.format.ODataFormat;
-import org.apache.olingo.commons.api.http.HttpHeader;
-import org.apache.olingo.commons.api.http.HttpMethod;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
-import org.apache.olingo.server.api.OData;
-import org.apache.olingo.server.api.ODataApplicationException;
-import org.apache.olingo.server.api.ODataRequest;
-import org.apache.olingo.server.api.ODataResponse;
-import org.apache.olingo.server.api.ODataServerError;
-import org.apache.olingo.server.api.ServiceMetadata;
-import org.apache.olingo.server.api.batch.exception.BatchDeserializerException;
-import org.apache.olingo.server.api.deserializer.DeserializerException;
-import org.apache.olingo.server.api.processor.ActionComplexCollectionProcessor;
-import org.apache.olingo.server.api.processor.ActionComplexProcessor;
-import org.apache.olingo.server.api.processor.ActionEntityCollectionProcessor;
-import org.apache.olingo.server.api.processor.ActionEntityProcessor;
-import org.apache.olingo.server.api.processor.ActionPrimitiveCollectionProcessor;
-import org.apache.olingo.server.api.processor.ActionPrimitiveProcessor;
-import org.apache.olingo.server.api.processor.BatchProcessor;
-import org.apache.olingo.server.api.processor.ComplexCollectionProcessor;
-import org.apache.olingo.server.api.processor.ComplexProcessor;
-import org.apache.olingo.server.api.processor.CountComplexCollectionProcessor;
-import org.apache.olingo.server.api.processor.CountEntityCollectionProcessor;
-import org.apache.olingo.server.api.processor.CountPrimitiveCollectionProcessor;
-import org.apache.olingo.server.api.processor.DefaultProcessor;
-import org.apache.olingo.server.api.processor.EntityCollectionProcessor;
-import org.apache.olingo.server.api.processor.EntityProcessor;
-import org.apache.olingo.server.api.processor.ErrorProcessor;
-import org.apache.olingo.server.api.processor.MediaEntityProcessor;
-import org.apache.olingo.server.api.processor.MetadataProcessor;
-import org.apache.olingo.server.api.processor.PrimitiveCollectionProcessor;
-import org.apache.olingo.server.api.processor.PrimitiveProcessor;
-import org.apache.olingo.server.api.processor.PrimitiveValueProcessor;
-import org.apache.olingo.server.api.processor.Processor;
-import org.apache.olingo.server.api.processor.ReferenceCollectionProcessor;
-import org.apache.olingo.server.api.processor.ReferenceProcessor;
-import org.apache.olingo.server.api.processor.ServiceDocumentProcessor;
-import org.apache.olingo.server.api.serializer.CustomContentTypeSupport;
-import org.apache.olingo.server.api.serializer.RepresentationType;
-import org.apache.olingo.server.api.serializer.SerializerException;
-import org.apache.olingo.server.api.uri.UriInfo;
-import org.apache.olingo.server.api.uri.UriResource;
-import org.apache.olingo.server.api.uri.UriResourceAction;
-import org.apache.olingo.server.api.uri.UriResourceEntitySet;
-import org.apache.olingo.server.api.uri.UriResourceFunction;
-import org.apache.olingo.server.api.uri.UriResourceNavigation;
-import org.apache.olingo.server.api.uri.UriResourcePartTyped;
-import org.apache.olingo.server.api.uri.UriResourcePrimitiveProperty;
-import org.apache.olingo.server.api.uri.UriResourceProperty;
-import org.apache.olingo.server.core.batchhandler.BatchHandler;
-import org.apache.olingo.server.core.uri.parser.Parser;
-import org.apache.olingo.server.core.uri.parser.UriParserException;
-import org.apache.olingo.server.core.uri.parser.UriParserSemanticException;
-import org.apache.olingo.server.core.uri.parser.UriParserSyntaxException;
-import org.apache.olingo.server.core.uri.validator.UriValidationException;
-import org.apache.olingo.server.core.uri.validator.UriValidator;
-
-public class ODataHandler {
-
- private final OData odata;
- private final ServiceMetadata serviceMetadata;
- private List<Processor> processors = new LinkedList<Processor>();
- private CustomContentTypeSupport customContentTypeSupport = null;
-
- private UriInfo uriInfo;
-
- public ODataHandler(final OData server, final ServiceMetadata serviceMetadata) {
- odata = server;
- this.serviceMetadata = serviceMetadata;
-
- register(new DefaultProcessor());
- register(new DefaultRedirectProcessor());
- }
-
- public ODataResponse process(final ODataRequest request) {
- ODataResponse response = new ODataResponse();
- try {
-
- processInternal(request, response);
-
- } catch (final UriValidationException e) {
- ODataServerError serverError = ODataExceptionHelper.createServerErrorObject(e, null);
- handleException(request, response, serverError);
- } catch (final UriParserSemanticException e) {
- ODataServerError serverError = ODataExceptionHelper.createServerErrorObject(e, null);
- handleException(request, response, serverError);
- } catch (final UriParserSyntaxException e) {
- ODataServerError serverError = ODataExceptionHelper.createServerErrorObject(e, null);
- handleException(request, response, serverError);
- } catch (final UriParserException e) {
- ODataServerError serverError = ODataExceptionHelper.createServerErrorObject(e, null);
- handleException(request, response, serverError);
- } catch (ContentNegotiatorException e) {
- ODataServerError serverError = ODataExceptionHelper.createServerErrorObject(e, null);
- handleException(request, response, serverError);
- } catch (SerializerException e) {
- ODataServerError serverError = ODataExceptionHelper.createServerErrorObject(e, null);
- handleException(request, response, serverError);
- } catch (BatchDeserializerException e) {
- ODataServerError serverError = ODataExceptionHelper.createServerErrorObject(e, null);
- handleException(request, response, serverError);
- } catch (DeserializerException e) {
- ODataServerError serverError = ODataExceptionHelper.createServerErrorObject(e, null);
- handleException(request, response, serverError);
- } catch (ODataHandlerException e) {
- ODataServerError serverError = ODataExceptionHelper.createServerErrorObject(e, null);
- handleException(request, response, serverError);
- } catch (ODataApplicationException e) {
- ODataServerError serverError = ODataExceptionHelper.createServerErrorObject(e);
- handleException(request, response, serverError);
- } catch (Exception e) {
- ODataServerError serverError = ODataExceptionHelper.createServerErrorObject(e);
- handleException(request, response, serverError);
- }
- return response;
- }
-
- private void processInternal(final ODataRequest request, final ODataResponse response)
- throws ODataHandlerException, UriParserException, UriValidationException, ContentNegotiatorException,
- ODataApplicationException, SerializerException, DeserializerException {
- validateODataVersion(request, response);
-
- uriInfo = new Parser().parseUri(request.getRawODataPath(), request.getRawQueryPath(), null,
- serviceMetadata.getEdm());
-
- final HttpMethod method = request.getMethod();
- new UriValidator().validate(uriInfo, method);
-
- switch (uriInfo.getKind()) {
- case metadata:
- if (method == HttpMethod.GET) {
- final ContentType requestedContentType = ContentNegotiator.doContentNegotiation(uriInfo.getFormatOption(),
- request, customContentTypeSupport, RepresentationType.METADATA);
- selectProcessor(MetadataProcessor.class)
- .readMetadata(request, response, uriInfo, requestedContentType);
- } else {
- throw new ODataHandlerException("HttpMethod " + method + " not allowed for metadata document",
- ODataHandlerException.MessageKeys.HTTP_METHOD_NOT_ALLOWED, method.toString());
- }
- break;
-
- case service:
- if (method == HttpMethod.GET) {
- if ("".equals(request.getRawODataPath())) {
- selectProcessor(RedirectProcessor.class).redirect(request, response);
- } else {
- final ContentType requestedContentType = ContentNegotiator.doContentNegotiation(uriInfo.getFormatOption(),
- request, customContentTypeSupport, RepresentationType.SERVICE);
-
- selectProcessor(ServiceDocumentProcessor.class)
- .readServiceDocument(request, response, uriInfo, requestedContentType);
- }
- } else {
- throw new ODataHandlerException("HttpMethod " + method + " not allowed for service document",
- ODataHandlerException.MessageKeys.HTTP_METHOD_NOT_ALLOWED, method.toString());
- }
- break;
-
- case resource:
- handleResourceDispatching(request, response);
- break;
-
- case batch:
- if (method == HttpMethod.POST) {
- final BatchProcessor bp = selectProcessor(BatchProcessor.class);
- final BatchHandler handler = new BatchHandler(this, bp);
- handler.process(request, response, true);
- } else {
- throw new ODataHandlerException("HTTP method " + method + " is not allowed.",
- ODataHandlerException.MessageKeys.HTTP_METHOD_NOT_ALLOWED, method.toString());
- }
- break;
-
- default:
- throw new ODataHandlerException("not implemented",
- ODataHandlerException.MessageKeys.FUNCTIONALITY_NOT_IMPLEMENTED);
- }
- }
-
- public void handleException(final ODataRequest request, final ODataResponse response,
- final ODataServerError serverError) {
-
- ErrorProcessor exceptionProcessor;
- try {
- exceptionProcessor = selectProcessor(ErrorProcessor.class);
- } catch (ODataHandlerException e) {
- // This cannot happen since there is always an ExceptionProcessor registered.
- exceptionProcessor = new DefaultProcessor();
- }
- ContentType requestedContentType;
- try {
- requestedContentType = ContentNegotiator.doContentNegotiation(
- uriInfo == null ? null : uriInfo.getFormatOption(), request, customContentTypeSupport,
- RepresentationType.ERROR);
- } catch (final ContentNegotiatorException e) {
- requestedContentType = ODataFormat.JSON.getContentType(ODataServiceVersion.V40);
- }
- exceptionProcessor.processError(request, response, serverError, requestedContentType);
- }
-
- private void handleResourceDispatching(final ODataRequest request, final ODataResponse response)
- throws ODataHandlerException, ContentNegotiatorException, ODataApplicationException,
- SerializerException, DeserializerException {
-
- final int lastPathSegmentIndex = uriInfo.getUriResourceParts().size() - 1;
- final UriResource lastPathSegment = uriInfo.getUriResourceParts().get(lastPathSegmentIndex);
-
- switch (lastPathSegment.getKind()) {
- case action:
- handleActionDispatching(request, response, (UriResourceAction) lastPathSegment);
- break;
-
- case function:
- handleFunctionDispatching(request, response, (UriResourceFunction) lastPathSegment);
- break;
-
- case entitySet:
- case navigationProperty:
- handleEntityDispatching(request, response, (UriResourcePartTyped) lastPathSegment);
- break;
-
- case count:
- handleCountDispatching(request, response, lastPathSegmentIndex);
- break;
-
- case primitiveProperty:
- handlePrimitivePropertyDispatching(request, response, false,
- ((UriResourceProperty) lastPathSegment).isCollection());
- break;
-
- case complexProperty:
- handleComplexPropertyDispatching(request, response, false,
- ((UriResourceProperty) lastPathSegment).isCollection());
- break;
-
- case value:
- handleValueDispatching(request, response, lastPathSegmentIndex);
- break;
-
- case ref:
- handleReferenceDispatching(request, response, lastPathSegmentIndex);
- break;
-
- default:
- throw new ODataHandlerException("not implemented",
- ODataHandlerException.MessageKeys.FUNCTIONALITY_NOT_IMPLEMENTED);
- }
- }
-
- private void handleFunctionDispatching(final ODataRequest request, final ODataResponse response,
- final UriResourceFunction uriResourceFunction)
- throws ODataHandlerException, SerializerException, ContentNegotiatorException,
- ODataApplicationException, DeserializerException {
- final HttpMethod method = request.getMethod();
- if(method != HttpMethod.GET) {
- throw new ODataHandlerException("HTTP method " + method + " is not allowed.",
- ODataHandlerException.MessageKeys.HTTP_METHOD_NOT_ALLOWED, method.toString());
- }
-
- EdmFunctionImport functionImport = uriResourceFunction.getFunctionImport();
- // could be null for bound functions
- if(functionImport == null) {
- throw new ODataHandlerException("Bound functions are not implemented yet",
- ODataHandlerException.MessageKeys.FUNCTIONALITY_NOT_IMPLEMENTED);
- }
-
- List<EdmFunction> unboundFunctions = functionImport.getUnboundFunctions();
- if(unboundFunctions == null || unboundFunctions.isEmpty()) {
- throw new ODataHandlerException("No unbound function defined for function import",
- ODataHandlerException.MessageKeys.FUNCTIONALITY_NOT_IMPLEMENTED);
- }
- EdmReturnType returnType = unboundFunctions.get(0).getReturnType();
- handleOperationDispatching(request, response, false, returnType);
- }
-
- private void handleActionDispatching(final ODataRequest request, final ODataResponse response,
- final UriResourceAction uriResourceAction)
- throws ODataHandlerException, SerializerException, ContentNegotiatorException,
- ODataApplicationException, DeserializerException {
-
- final HttpMethod method = request.getMethod();
- if(request.getMethod() != HttpMethod.POST) {
- throw new ODataHandlerException("HTTP method " + method + " is not allowed.",
- ODataHandlerException.MessageKeys.HTTP_METHOD_NOT_ALLOWED, method.toString());
- }
-
- EdmActionImport actionImport = uriResourceAction.getActionImport();
- // could be null for bound actions
- if(actionImport == null) {
- throw new ODataHandlerException("Bound actions are not implemented yet",
- ODataHandlerException.MessageKeys.FUNCTIONALITY_NOT_IMPLEMENTED);
- }
-
- EdmAction unboundActions = actionImport.getUnboundAction();
- if(unboundActions == null) {
- throw new ODataHandlerException("No unbound function defined for function import",
- ODataHandlerException.MessageKeys.FUNCTIONALITY_NOT_IMPLEMENTED);
- }
- EdmReturnType returnType = unboundActions.getReturnType();
- handleOperationDispatching(request, response, true, returnType);
- }
-
-
- private void handleOperationDispatching(final ODataRequest request, final ODataResponse response,
- final boolean isAction, final EdmReturnType edmReturnTypeKind)
- throws ODataHandlerException, SerializerException, ContentNegotiatorException,
- ODataApplicationException, DeserializerException {
-
- switch (edmReturnTypeKind.getType().getKind()) {
- case ENTITY:
- handleEntityDispatching(request, response, edmReturnTypeKind.isCollection(), false, isAction);
- break;
- case PRIMITIVE:
- handlePrimitivePropertyDispatching(request, response, isAction, edmReturnTypeKind.isCollection());
- break;
- case COMPLEX:
- handleComplexPropertyDispatching(request, response, isAction, edmReturnTypeKind.isCollection());
- break;
- default:
- throw new ODataHandlerException("not implemented",
- ODataHandlerException.MessageKeys.FUNCTIONALITY_NOT_IMPLEMENTED);
- }
- }
-
-
- private void handleReferenceDispatching(final ODataRequest request, final ODataResponse response,
- final int lastPathSegmentIndex)
- throws ContentNegotiatorException, ODataApplicationException, SerializerException, ODataHandlerException,
- DeserializerException {
- final HttpMethod method = request.getMethod();
- if (((UriResourcePartTyped) uriInfo.getUriResourceParts().get(lastPathSegmentIndex - 1)).isCollection()) {
- if (method == HttpMethod.GET) {
- final ContentType responseFormat = ContentNegotiator.doContentNegotiation(uriInfo.getFormatOption(),
- request, customContentTypeSupport, RepresentationType.COLLECTION_REFERENCE);
- selectProcessor(ReferenceCollectionProcessor.class)
- .readReferenceCollection(request, response, uriInfo, responseFormat);
- } else if (method == HttpMethod.POST) {
- final ContentType requestFormat = ContentType.parse(request.getHeader(HttpHeader.CONTENT_TYPE));
- checkContentTypeSupport(requestFormat, RepresentationType.REFERENCE);
- selectProcessor(ReferenceProcessor.class)
- .createReference(request, response, uriInfo, requestFormat);
- } else {
- throw new ODataHandlerException("HTTP method " + method + " is not allowed.",
- ODataHandlerException.MessageKeys.HTTP_METHOD_NOT_ALLOWED, method.toString());
- }
- } else {
- if (method == HttpMethod.GET) {
- final ContentType responseFormat = ContentNegotiator.doContentNegotiation(uriInfo.getFormatOption(),
- request, customContentTypeSupport, RepresentationType.REFERENCE);
- selectProcessor(ReferenceProcessor.class).readReference(request, response, uriInfo, responseFormat);
- } else if (method == HttpMethod.PUT || method == HttpMethod.PATCH) {
- final ContentType requestFormat = ContentType.parse(request.getHeader(HttpHeader.CONTENT_TYPE));
- checkContentTypeSupport(requestFormat, RepresentationType.REFERENCE);
- selectProcessor(ReferenceProcessor.class)
- .updateReference(request, response, uriInfo, requestFormat);
- } else if (method == HttpMethod.DELETE) {
- selectProcessor(ReferenceProcessor.class)
- .deleteReference(request, response, uriInfo);
- } else {
- throw new ODataHandlerException("HTTP method " + method + " is not allowed.",
- ODataHandlerException.MessageKeys.HTTP_METHOD_NOT_ALLOWED, method.toString());
- }
- }
- }
-
- private void handleValueDispatching(final ODataRequest request, final ODataResponse response,
- final int lastPathSegmentIndex)
- throws ContentNegotiatorException, ODataApplicationException, SerializerException, ODataHandlerException,
- DeserializerException {
- final HttpMethod method = request.getMethod();
- final UriResource resource = uriInfo.getUriResourceParts().get(lastPathSegmentIndex - 1);
- if (resource instanceof UriResourceProperty) {
- final RepresentationType valueRepresentationType =
- ((UriResourceProperty) resource).getType() ==
- EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Binary) ?
- RepresentationType.BINARY : RepresentationType.VALUE;
- if (method == HttpMethod.GET) {
- final ContentType requestedContentType = ContentNegotiator.doContentNegotiation(uriInfo.getFormatOption(),
- request, customContentTypeSupport, valueRepresentationType);
-
- selectProcessor(PrimitiveValueProcessor.class)
- .readPrimitiveValue(request, response, uriInfo, requestedContentType);
- } else if (method == HttpMethod.PUT) {
- final ContentType requestFormat = ContentType.parse(request.getHeader(HttpHeader.CONTENT_TYPE));
- checkContentTypeSupport(requestFormat, valueRepresentationType);
- final ContentType responseFormat = ContentNegotiator.doContentNegotiation(uriInfo.getFormatOption(),
- request, customContentTypeSupport, valueRepresentationType);
- selectProcessor(PrimitiveValueProcessor.class)
- .updatePrimitive(request, response, uriInfo, requestFormat, responseFormat);
- } else if (method == HttpMethod.DELETE) {
- selectProcessor(PrimitiveValueProcessor.class).deletePrimitive(request, response, uriInfo);
- } else {
- throw new ODataHandlerException("HTTP method " + method + " is not allowed.",
- ODataHandlerException.MessageKeys.HTTP_METHOD_NOT_ALLOWED, method.toString());
- }
- } else {
- if (method == HttpMethod.GET) {
- final ContentType requestedContentType = ContentNegotiator.doContentNegotiation(uriInfo.getFormatOption(),
- request, customContentTypeSupport, RepresentationType.MEDIA);
- selectProcessor(MediaEntityProcessor.class)
- .readMediaEntity(request, response, uriInfo, requestedContentType);
- } else if (method == HttpMethod.PUT) {
- final ContentType requestFormat = ContentType.parse(request.getHeader(HttpHeader.CONTENT_TYPE));
- final ContentType responseFormat = ContentNegotiator.doContentNegotiation(uriInfo.getFormatOption(),
- request, customContentTypeSupport, RepresentationType.ENTITY);
- selectProcessor(MediaEntityProcessor.class)
- .updateMediaEntity(request, response, uriInfo, requestFormat, responseFormat);
- } else if (method == HttpMethod.DELETE) {
- selectProcessor(MediaEntityProcessor.class).deleteEntity(request, response, uriInfo);
- } else {
- throw new ODataHandlerException("HTTP method " + method + " is not allowed.",
- ODataHandlerException.MessageKeys.HTTP_METHOD_NOT_ALLOWED, method.toString());
- }
- }
- }
-
- private void handleComplexPropertyDispatching(final ODataRequest request, final ODataResponse response,
- final boolean isAction, final boolean isCollection)
- throws ContentNegotiatorException, ODataApplicationException, SerializerException, ODataHandlerException,
- DeserializerException {
-
- final HttpMethod method = request.getMethod();
- final RepresentationType complexRepresentationType = isCollection ?
- RepresentationType.COLLECTION_COMPLEX : RepresentationType.COMPLEX;
- if (method == HttpMethod.GET) {
- final ContentType requestedContentType = ContentNegotiator.doContentNegotiation(uriInfo.getFormatOption(),
- request, customContentTypeSupport, complexRepresentationType);
- if (complexRepresentationType == RepresentationType.COMPLEX) {
- selectProcessor(ComplexProcessor.class)
- .readComplex(request, response, uriInfo, requestedContentType);
- } else {
- selectProcessor(ComplexCollectionProcessor.class)
- .readComplexCollection(request, response, uriInfo, requestedContentType);
- }
- } else if (method == HttpMethod.PUT || method == HttpMethod.PATCH) {
- final ContentType requestFormat = ContentType.parse(request.getHeader(HttpHeader.CONTENT_TYPE));
- checkContentTypeSupport(requestFormat, complexRepresentationType);
- final ContentType responseFormat = ContentNegotiator.doContentNegotiation(uriInfo.getFormatOption(),
- request, customContentTypeSupport, complexRepresentationType);
- if (complexRepresentationType == RepresentationType.COMPLEX) {
- selectProcessor(ComplexProcessor.class)
- .updateComplex(request, response, uriInfo, requestFormat, responseFormat);
- } else {
- selectProcessor(ComplexCollectionProcessor.class)
- .updateComplexCollection(request, response, uriInfo, requestFormat, responseFormat);
- }
- } else if (method == HttpMethod.POST && isAction) {
- final ContentType requestFormat = ContentType.parse(request.getHeader(HttpHeader.CONTENT_TYPE));
- checkContentTypeSupport(requestFormat, complexRepresentationType);
- final ContentType responseFormat = ContentNegotiator.doContentNegotiation(uriInfo.getFormatOption(),
- request, customContentTypeSupport, complexRepresentationType);
- if (complexRepresentationType == RepresentationType.COMPLEX) {
- selectProcessor(ActionComplexProcessor.class)
- .processActionComplex(request, response, uriInfo, requestFormat, responseFormat);
- } else {
- selectProcessor(ActionComplexCollectionProcessor.class)
- .processActionComplexCollection(request, response, uriInfo, requestFormat, responseFormat);
- }
- } else if (method == HttpMethod.DELETE) {
- if (complexRepresentationType == RepresentationType.COMPLEX) {
- selectProcessor(ComplexProcessor.class).deleteComplex(request, response, uriInfo);
- } else {
- selectProcessor(ComplexCollectionProcessor.class).deleteComplexCollection(request, response, uriInfo);
- }
- } else {
- throw new ODataHandlerException("HTTP method " + method + " is not allowed.",
- ODataHandlerException.MessageKeys.HTTP_METHOD_NOT_ALLOWED, method.toString());
- }
- }
-
- private void handlePrimitivePropertyDispatching(final ODataRequest request, final ODataResponse response,
- boolean isAction, final boolean isCollection)
- throws ContentNegotiatorException, ODataApplicationException, SerializerException, ODataHandlerException,
- DeserializerException {
-
- final HttpMethod method = request.getMethod();
- final RepresentationType representationType = isCollection ?
- RepresentationType.COLLECTION_PRIMITIVE : RepresentationType.PRIMITIVE;
- if (method == HttpMethod.GET) {
- final ContentType requestedContentType = ContentNegotiator.doContentNegotiation(uriInfo.getFormatOption(),
- request, customContentTypeSupport, representationType);
- if (representationType == RepresentationType.PRIMITIVE) {
- selectProcessor(PrimitiveProcessor.class).readPrimitive(request, response, uriInfo, requestedContentType);
- } else {
- selectProcessor(PrimitiveCollectionProcessor.class)
- .readPrimitiveCollection(request, response, uriInfo, requestedContentType);
- }
- } else if (method == HttpMethod.PUT || method == HttpMethod.PATCH) {
- final ContentType requestFormat = ContentType.parse(request.getHeader(HttpHeader.CONTENT_TYPE));
- checkContentTypeSupport(requestFormat, representationType);
- final ContentType responseFormat = ContentNegotiator.doContentNegotiation(uriInfo.getFormatOption(),
- request, customContentTypeSupport, representationType);
- if (representationType == RepresentationType.PRIMITIVE) {
- selectProcessor(PrimitiveProcessor.class)
- .updatePrimitive(request, response, uriInfo, requestFormat, responseFormat);
- } else {
- selectProcessor(PrimitiveCollectionProcessor.class)
- .updatePrimitiveCollection(request, response, uriInfo, requestFormat, responseFormat);
- }
- } else if (method == HttpMethod.DELETE) {
- if (representationType == RepresentationType.PRIMITIVE) {
- selectProcessor(PrimitiveProcessor.class).deletePrimitive(request, response, uriInfo);
- } else {
- selectProcessor(PrimitiveCollectionProcessor.class).deletePrimitiveCollection(request, response, uriInfo);
- }
- } else if (method == HttpMethod.POST && isAction) {
- final ContentType requestFormat = ContentType.parse(request.getHeader(HttpHeader.CONTENT_TYPE));
- checkContentTypeSupport(requestFormat, representationType);
- final ContentType responseFormat = ContentNegotiator.doContentNegotiation(uriInfo.getFormatOption(),
- request, customContentTypeSupport, representationType);
- if (representationType == RepresentationType.PRIMITIVE) {
- selectProcessor(ActionPrimitiveProcessor.class)
- .processActionPrimitive(request, response, uriInfo, requestFormat, responseFormat);
- } else {
- selectProcessor(ActionPrimitiveCollectionProcessor.class)
- .processActionPrimitiveCollection(request, response, uriInfo, requestFormat, responseFormat);
- }
- } else {
- throw new ODataHandlerException("HTTP method " + method + " is not allowed.",
- ODataHandlerException.MessageKeys.HTTP_METHOD_NOT_ALLOWED, method.toString());
- }
- }
-
- private void handleCountDispatching(final ODataRequest request, final ODataResponse response,
- final int lastPathSegmentIndex)
- throws ODataApplicationException, SerializerException, ODataHandlerException {
-
- final HttpMethod method = request.getMethod();
- if (method == HttpMethod.GET) {
- final UriResource resource = uriInfo.getUriResourceParts().get(lastPathSegmentIndex - 1);
- if (resource instanceof UriResourceEntitySet || resource instanceof UriResourceNavigation) {
- selectProcessor(CountEntityCollectionProcessor.class)
- .countEntityCollection(request, response, uriInfo);
- } else if (resource instanceof UriResourcePrimitiveProperty) {
- selectProcessor(CountPrimitiveCollectionProcessor.class)
- .countPrimitiveCollection(request, response, uriInfo);
- } else {
- selectProcessor(CountComplexCollectionProcessor.class)
- .countComplexCollection(request, response, uriInfo);
- }
- } else {
- throw new ODataHandlerException("HTTP method " + method + " is not allowed for count.",
- ODataHandlerException.MessageKeys.HTTP_METHOD_NOT_ALLOWED, method.toString());
- }
- }
-
- private void handleEntityDispatching(final ODataRequest request, final ODataResponse response,
- final UriResourcePartTyped uriResourcePart)
- throws ContentNegotiatorException, ODataApplicationException, SerializerException, ODataHandlerException,
- DeserializerException {
- handleEntityDispatching(request, response, uriResourcePart.isCollection(), isMedia(uriResourcePart), false);
- }
-
- private void handleEntityDispatching(final ODataRequest request, final ODataResponse response,
- final boolean isCollection, final boolean isMedia, boolean isAction)
- throws ContentNegotiatorException, ODataApplicationException, SerializerException, ODataHandlerException,
- DeserializerException {
-
- final HttpMethod method = request.getMethod();
- if (isCollection) {
- if (method == HttpMethod.GET) {
- final ContentType requestedContentType = ContentNegotiator.doContentNegotiation(uriInfo.getFormatOption(),
- request, customContentTypeSupport, RepresentationType.COLLECTION_ENTITY);
-
- selectProcessor(EntityCollectionProcessor.class)
- .readEntityCollection(request, response, uriInfo, requestedContentType);
- } else if (method == HttpMethod.POST) {
- final ContentType requestFormat = ContentType.parse(request.getHeader(HttpHeader.CONTENT_TYPE));
- if (isMedia) {
- final ContentType responseFormat = ContentNegotiator.doContentNegotiation(uriInfo.getFormatOption(),
- request, customContentTypeSupport, RepresentationType.ENTITY);
- selectProcessor(MediaEntityProcessor.class)
- .createMediaEntity(request, response, uriInfo, requestFormat, responseFormat);
- } else if(isAction) {
- checkContentTypeSupport(requestFormat, RepresentationType.ENTITY);
- final ContentType responseFormat = ContentNegotiator.doContentNegotiation(uriInfo.getFormatOption(),
- request, customContentTypeSupport, RepresentationType.ENTITY);
- selectProcessor(ActionEntityCollectionProcessor.class)
- .processActionEntityCollection(request, response, uriInfo, requestFormat, responseFormat);
- } else {
- checkContentTypeSupport(requestFormat, RepresentationType.ENTITY);
- final ContentType responseFormat = ContentNegotiator.doContentNegotiation(uriInfo.getFormatOption(),
- request, customContentTypeSupport, RepresentationType.ENTITY);
- selectProcessor(EntityProcessor.class)
- .createEntity(request, response, uriInfo, requestFormat, responseFormat);
- }
- } else {
- throw new ODataHandlerException("HTTP method " + method + " is not allowed.",
- ODataHandlerException.MessageKeys.HTTP_METHOD_NOT_ALLOWED, method.toString());
- }
- } else {
- if (method == HttpMethod.GET) {
- final ContentType requestedContentType = ContentNegotiator.doContentNegotiation(uriInfo.getFormatOption(),
- request, customContentTypeSupport, RepresentationType.ENTITY);
-
- selectProcessor(EntityProcessor.class).readEntity(request, response, uriInfo, requestedContentType);
- } else if (method == HttpMethod.PUT || method == HttpMethod.PATCH) {
- final ContentType requestFormat = ContentType.parse(request.getHeader(HttpHeader.CONTENT_TYPE));
- checkContentTypeSupport(requestFormat, RepresentationType.ENTITY);
- final ContentType responseFormat = ContentNegotiator.doContentNegotiation(uriInfo.getFormatOption(),
- request, customContentTypeSupport, RepresentationType.ENTITY);
- selectProcessor(EntityProcessor.class).updateEntity(request, response, uriInfo, requestFormat, responseFormat);
- } else if (method == HttpMethod.POST && isAction) {
- final ContentType requestFormat = ContentType.parse(request.getHeader(HttpHeader.CONTENT_TYPE));
- checkContentTypeSupport(requestFormat, RepresentationType.ENTITY);
- final ContentType responseFormat = ContentNegotiator.doContentNegotiation(uriInfo.getFormatOption(),
- request, customContentTypeSupport, RepresentationType.ENTITY);
- selectProcessor(ActionEntityProcessor.class).processActionEntity(
- request, response, uriInfo, requestFormat, responseFormat);
- } else if (method == HttpMethod.DELETE) {
- selectProcessor(isMedia ? MediaEntityProcessor.class : EntityProcessor.class)
- .deleteEntity(request, response, uriInfo);
- } else {
- throw new ODataHandlerException("HTTP method " + method + " is not allowed.",
- ODataHandlerException.MessageKeys.HTTP_METHOD_NOT_ALLOWED, method.toString());
- }
- }
- }
-
- private void checkContentTypeSupport(ContentType requestFormat, RepresentationType representationType)
- throws ODataHandlerException, ContentNegotiatorException {
- if (!ContentNegotiator.isSupported(requestFormat, customContentTypeSupport, representationType)) {
- final String contentTypeString = requestFormat.toContentTypeString();
- throw new ODataHandlerException("ContentType " + contentTypeString + " is not supported.",
- ODataHandlerException.MessageKeys.UNSUPPORTED_CONTENT_TYPE, contentTypeString);
- }
- }
-
- private void validateODataVersion(final ODataRequest request, final ODataResponse response)
- throws ODataHandlerException {
- final String maxVersion = request.getHeader(HttpHeader.ODATA_MAX_VERSION);
- response.setHeader(HttpHeader.ODATA_VERSION, ODataServiceVersion.V40.toString());
-
- if (maxVersion != null) {
- if (ODataServiceVersion.isBiggerThan(ODataServiceVersion.V40.toString(), maxVersion)) {
- throw new ODataHandlerException("ODataVersion not supported: " + maxVersion,
- ODataHandlerException.MessageKeys.ODATA_VERSION_NOT_SUPPORTED, maxVersion);
- }
- }
- }
-
- private boolean isMedia(final UriResource pathSegment) {
- return pathSegment instanceof UriResourceEntitySet
- && ((UriResourceEntitySet) pathSegment).getEntityType().hasStream()
- || pathSegment instanceof UriResourceNavigation
- && ((EdmEntityType) ((UriResourceNavigation) pathSegment).getType()).hasStream();
- }
-
- private <T extends Processor> T selectProcessor(final Class<T> cls) throws ODataHandlerException {
- for (final Processor processor : processors) {
- if (cls.isAssignableFrom(processor.getClass())) {
- processor.init(odata, serviceMetadata);
- return cls.cast(processor);
- }
- }
- throw new ODataHandlerException("Processor: " + cls.getSimpleName() + " not registered.",
- ODataHandlerException.MessageKeys.PROCESSOR_NOT_IMPLEMENTED, cls.getSimpleName());
- }
-
- public void register(final Processor processor) {
- processors.add(0, processor);
- }
-
- public void register(final CustomContentTypeSupport customContentTypeSupport) {
- this.customContentTypeSupport = customContentTypeSupport;
- }
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataHandlerException.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataHandlerException.java
deleted file mode 100644
index 8ebbc26..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataHandlerException.java
+++ /dev/null
@@ -1,51 +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;
-
-import org.apache.olingo.server.api.ODataTranslatedException;
-
-/** Exception thrown during basic request handling. */
-public class ODataHandlerException extends ODataTranslatedException {
- private static final long serialVersionUID = -907752788975531134L;
-
- public static enum MessageKeys implements MessageKey {
- /** parameters: HTTP method, HTTP method */ AMBIGUOUS_XHTTP_METHOD,
- /** parameter: HTTP method */ INVALID_HTTP_METHOD,
- /** parameter: HTTP method */ HTTP_METHOD_NOT_ALLOWED,
- /** parameter: processor interface */ PROCESSOR_NOT_IMPLEMENTED,
- /** no parameter */ FUNCTIONALITY_NOT_IMPLEMENTED,
- /** parameter: content type */ UNSUPPORTED_CONTENT_TYPE,
- /** parameter: version */ ODATA_VERSION_NOT_SUPPORTED;
-
- @Override
- public String getKey() {
- return name();
- }
- }
-
- public ODataHandlerException(final String developmentMessage, final MessageKey messageKey,
- final String... parameters) {
- super(developmentMessage, messageKey, parameters);
- }
-
- @Override
- protected String getBundleName() {
- return DEFAULT_SERVER_BUNDLE_NAME;
- }
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataHttpHandlerImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataHttpHandlerImpl.java
deleted file mode 100644
index 36cbd18..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataHttpHandlerImpl.java
+++ /dev/null
@@ -1,245 +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;
-
-import java.io.Closeable;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.List;
-import java.util.Map.Entry;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.apache.olingo.commons.api.ODataRuntimeException;
-import org.apache.olingo.commons.api.http.HttpHeader;
-import org.apache.olingo.commons.api.http.HttpMethod;
-import org.apache.olingo.server.api.OData;
-import org.apache.olingo.server.api.ODataHttpHandler;
-import org.apache.olingo.server.api.ODataRequest;
-import org.apache.olingo.server.api.ODataResponse;
-import org.apache.olingo.server.api.ODataServerError;
-import org.apache.olingo.server.api.ODataTranslatedException;
-import org.apache.olingo.server.api.ServiceMetadata;
-import org.apache.olingo.server.api.processor.Processor;
-import org.apache.olingo.server.api.serializer.CustomContentTypeSupport;
-import org.apache.olingo.server.api.serializer.SerializerException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class ODataHttpHandlerImpl implements ODataHttpHandler {
-
- private static final Logger LOG = LoggerFactory.getLogger(ODataHttpHandlerImpl.class);
-
- private ODataHandler handler;
- private int split = 0;
-
- public ODataHttpHandlerImpl(final OData odata, final ServiceMetadata serviceMetadata) {
- handler = new ODataHandler(odata, serviceMetadata);
- }
-
- @Override
- public void process(final HttpServletRequest request, final HttpServletResponse response) {
- ODataRequest odRequest = null;
- ODataResponse odResponse;
- try {
- odRequest = createODataRequest(request, split);
- odResponse = handler.process(odRequest);
- // ALL future methods after process must not throw exceptions!
- } catch (Exception e) {
- odResponse = handleException(odRequest, e);
- }
-
- convertToHttp(response, odResponse);
- }
-
- @Override
- public void setSplit(int split) {
- this.split = split;
- }
-
- private ODataResponse handleException(ODataRequest odRequest, Exception e) {
- ODataResponse resp = new ODataResponse();
- ODataServerError serverError;
- if (e instanceof ODataHandlerException) {
- serverError = ODataExceptionHelper.createServerErrorObject((ODataHandlerException) e, null);
- } else if (e instanceof ODataTranslatedException) {
- serverError = ODataExceptionHelper.createServerErrorObject((ODataTranslatedException) e, null);
- } else {
- serverError = ODataExceptionHelper.createServerErrorObject(e);
- }
- handler.handleException(odRequest, resp, serverError);
- return resp;
- }
-
- static void convertToHttp(final HttpServletResponse response, final ODataResponse odResponse) {
- response.setStatus(odResponse.getStatusCode());
-
- for (Entry<String, String> entry : odResponse.getHeaders().entrySet()) {
- response.setHeader(entry.getKey(), entry.getValue());
- }
-
- InputStream input = odResponse.getContent();
- if (input != null) {
- OutputStream output = null;
- try {
- output = response.getOutputStream();
- byte[] buffer = new byte[1024];
- int n;
- while (-1 != (n = input.read(buffer))) {
- output.write(buffer, 0, n);
- }
- } catch (IOException e) {
- LOG.error(e.getMessage(), e);
- throw new ODataRuntimeException(e);
- } finally {
- closeStream(output);
- closeStream(input);
- }
- }
- }
-
- private static void closeStream(Closeable closeable) {
- if(closeable != null) {
- try {
- closeable.close();
- } catch (IOException e) {
- LOG.error(e.getMessage(), e);
- }
- }
- }
-
- private ODataRequest createODataRequest(final HttpServletRequest httpRequest, final int split)
- throws ODataTranslatedException {
- try {
- ODataRequest odRequest = new ODataRequest();
-
- odRequest.setBody(httpRequest.getInputStream());
- extractHeaders(odRequest, httpRequest);
- extractMethod(odRequest, httpRequest);
- extractUri(odRequest, httpRequest, split);
-
- return odRequest;
- } catch (final IOException e) {
- throw new SerializerException("An I/O exception occurred.", e,
- SerializerException.MessageKeys.IO_EXCEPTION);
- }
- }
-
- static void extractMethod(final ODataRequest odRequest, final HttpServletRequest httpRequest)
- throws ODataTranslatedException {
- try {
- HttpMethod httpRequestMethod = HttpMethod.valueOf(httpRequest.getMethod());
-
- if (httpRequestMethod == HttpMethod.POST) {
- String xHttpMethod = httpRequest.getHeader(HttpHeader.X_HTTP_METHOD);
- String xHttpMethodOverride = httpRequest.getHeader(HttpHeader.X_HTTP_METHOD_OVERRIDE);
-
- if (xHttpMethod == null && xHttpMethodOverride == null) {
- odRequest.setMethod(httpRequestMethod);
- } else if (xHttpMethod == null) {
- odRequest.setMethod(HttpMethod.valueOf(xHttpMethodOverride));
- } else if (xHttpMethodOverride == null) {
- odRequest.setMethod(HttpMethod.valueOf(xHttpMethod));
- } else {
- if (!xHttpMethod.equalsIgnoreCase(xHttpMethodOverride)) {
- throw new ODataHandlerException("Ambiguous X-HTTP-Methods",
- ODataHandlerException.MessageKeys.AMBIGUOUS_XHTTP_METHOD, xHttpMethod, xHttpMethodOverride);
- }
- odRequest.setMethod(HttpMethod.valueOf(xHttpMethod));
- }
- } else {
- odRequest.setMethod(httpRequestMethod);
- }
- } catch (IllegalArgumentException e) {
- throw new ODataHandlerException("Invalid HTTP method" + httpRequest.getMethod(),
- ODataHandlerException.MessageKeys.INVALID_HTTP_METHOD, httpRequest.getMethod());
- }
- }
-
- static void extractUri(final ODataRequest odRequest, final HttpServletRequest httpRequest, final int split) {
- String rawRequestUri = httpRequest.getRequestURL().toString();
-
- String rawODataPath;
- if (!"".equals(httpRequest.getServletPath())) {
- int beginIndex;
- beginIndex = rawRequestUri.indexOf(httpRequest.getServletPath());
- beginIndex += httpRequest.getServletPath().length();
- rawODataPath = rawRequestUri.substring(beginIndex);
- } else if (!"".equals(httpRequest.getContextPath())) {
- int beginIndex;
- beginIndex = rawRequestUri.indexOf(httpRequest.getContextPath());
- beginIndex += httpRequest.getContextPath().length();
- rawODataPath = rawRequestUri.substring(beginIndex);
- } else {
- rawODataPath = httpRequest.getRequestURI();
- }
-
- String rawServiceResolutionUri;
- if (split > 0) {
- rawServiceResolutionUri = rawODataPath;
- for (int i = 0; i < split; i++) {
- int e = rawODataPath.indexOf("/", 1);
- if (-1 == e) {
- rawODataPath = "";
- } else {
- rawODataPath = rawODataPath.substring(e);
- }
- }
- int end = rawServiceResolutionUri.length() - rawODataPath.length();
- rawServiceResolutionUri = rawServiceResolutionUri.substring(0, end);
- } else {
- rawServiceResolutionUri = null;
- }
-
- String rawBaseUri = rawRequestUri.substring(0, rawRequestUri.length() - rawODataPath.length());
-
- odRequest.setRawQueryPath(httpRequest.getQueryString());
- odRequest.setRawRequestUri(rawRequestUri
- + (httpRequest.getQueryString() == null ? "" : "?" + httpRequest.getQueryString()));
- odRequest.setRawODataPath(rawODataPath);
- odRequest.setRawBaseUri(rawBaseUri);
- odRequest.setRawServiceResolutionUri(rawServiceResolutionUri);
- }
-
- static void extractHeaders(final ODataRequest odRequest, final HttpServletRequest req) {
- for (Enumeration<?> headerNames = req.getHeaderNames(); headerNames.hasMoreElements();) {
- String headerName = (String) headerNames.nextElement();
- List<String> headerValues = new ArrayList<String>();
- for (Enumeration<?> headers = req.getHeaders(headerName); headers.hasMoreElements();) {
- String value = (String) headers.nextElement();
- headerValues.add(value);
- }
- odRequest.addHeader(headerName, headerValues);
- }
- }
-
- @Override
- public void register(final Processor processor) {
- handler.register(processor);
- }
-
- @Override
- public void register(final CustomContentTypeSupport customContentTypeSupport) {
- handler.register(customContentTypeSupport);
- }
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataImpl.java
deleted file mode 100644
index 1551461..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/ODataImpl.java
+++ /dev/null
@@ -1,109 +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;
-
-import java.util.List;
-
-import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
-import org.apache.olingo.commons.api.format.ODataFormat;
-import org.apache.olingo.server.api.OData;
-import org.apache.olingo.server.api.ODataHttpHandler;
-import org.apache.olingo.server.api.ServiceMetadata;
-import org.apache.olingo.server.api.deserializer.DeserializerException;
-import org.apache.olingo.server.api.deserializer.FixedFormatDeserializer;
-import org.apache.olingo.server.api.deserializer.ODataDeserializer;
-import org.apache.olingo.server.api.edm.provider.EdmProvider;
-import org.apache.olingo.server.api.edmx.EdmxReference;
-import org.apache.olingo.server.api.serializer.FixedFormatSerializer;
-import org.apache.olingo.server.api.serializer.ODataSerializer;
-import org.apache.olingo.server.api.serializer.SerializerException;
-import org.apache.olingo.server.api.uri.UriHelper;
-import org.apache.olingo.server.core.deserializer.FixedFormatDeserializerImpl;
-import org.apache.olingo.server.core.deserializer.json.ODataJsonDeserializer;
-import org.apache.olingo.server.core.serializer.FixedFormatSerializerImpl;
-import org.apache.olingo.server.core.serializer.json.ODataJsonSerializer;
-import org.apache.olingo.server.core.serializer.xml.ODataXmlSerializerImpl;
-import org.apache.olingo.server.core.uri.UriHelperImpl;
-
-public class ODataImpl extends OData {
-
- @Override
- public ODataSerializer createSerializer(final ODataFormat format) throws SerializerException {
- ODataSerializer serializer;
- switch (format) {
- case JSON:
- case JSON_NO_METADATA:
- case JSON_FULL_METADATA:
- serializer = new ODataJsonSerializer(format);
- break;
- case XML:
- serializer = new ODataXmlSerializerImpl();
- break;
- default:
- throw new SerializerException("Unsupported format: " + format,
- SerializerException.MessageKeys.UNSUPPORTED_FORMAT, format.toString());
- }
-
- return serializer;
- }
-
- @Override
- public FixedFormatSerializer createFixedFormatSerializer() {
- return new FixedFormatSerializerImpl();
- }
-
- @Override
- public ODataHttpHandler createHandler(final ServiceMetadata edm) {
- return new ODataHttpHandlerImpl(this, edm);
- }
-
- @Override
- public ServiceMetadata createServiceMetadata(EdmProvider edmProvider, List<EdmxReference> references) {
- return new ServiceMetadataImpl(ODataServiceVersion.V40, edmProvider, references);
- }
-
- @Override
- public FixedFormatDeserializer createFixedFormatDeserializer() {
- return new FixedFormatDeserializerImpl();
- }
-
- @Override
- public UriHelper createUriHelper() {
- return new UriHelperImpl();
- }
-
- @Override
- public ODataDeserializer createDeserializer(ODataFormat format) throws DeserializerException{
- ODataDeserializer serializer;
- switch (format) {
- case JSON:
- case JSON_NO_METADATA:
- case JSON_FULL_METADATA:
- serializer = new ODataJsonDeserializer();
- break;
- case XML:
- //We do not support xml deserialization right now so this mus lead to an error
- default:
- throw new DeserializerException("Unsupported format: " + format,
- SerializerException.MessageKeys.UNSUPPORTED_FORMAT, format.toString());
- }
-
- return serializer;
- }
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/RedirectProcessor.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/RedirectProcessor.java
deleted file mode 100644
index 4e99d31..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/RedirectProcessor.java
+++ /dev/null
@@ -1,29 +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;
-
-import org.apache.olingo.server.api.ODataRequest;
-import org.apache.olingo.server.api.ODataResponse;
-import org.apache.olingo.server.api.processor.Processor;
-
-public interface RedirectProcessor extends Processor {
-
- void redirect(ODataRequest request, ODataResponse response);
-
-}
\ No newline at end of file
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/ServiceMetadataImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/ServiceMetadataImpl.java
deleted file mode 100644
index 5008092..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/ServiceMetadataImpl.java
+++ /dev/null
@@ -1,60 +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;
-
-import org.apache.olingo.commons.api.edm.Edm;
-import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
-import org.apache.olingo.server.api.edmx.EdmxReference;
-import org.apache.olingo.server.api.ServiceMetadata;
-import org.apache.olingo.server.api.edm.provider.EdmProvider;
-import org.apache.olingo.server.core.edm.provider.EdmProviderImpl;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-/**
- */
-public class ServiceMetadataImpl implements ServiceMetadata {
-
- private final EdmProviderImpl edm;
- private final ODataServiceVersion version;
- private final List<EdmxReference> references = new ArrayList<EdmxReference>();
-
- public ServiceMetadataImpl(ODataServiceVersion version, EdmProvider edmProvider, List<EdmxReference> references) {
- this.edm = new EdmProviderImpl(edmProvider);
- this.version = version;
- this.references.addAll(references);
- }
-
- @Override
- public Edm getEdm() {
- return edm;
- }
-
- @Override
- public ODataServiceVersion getDataServiceVersion() {
- return version;
- }
-
- @Override
- public List<EdmxReference> getReferences() {
- return Collections.unmodifiableList(references);
- }
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/batchhandler/BatchFascadeImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/batchhandler/BatchFascadeImpl.java
deleted file mode 100644
index 6b2ee39..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/batchhandler/BatchFascadeImpl.java
+++ /dev/null
@@ -1,53 +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.batchhandler;
-
-import org.apache.olingo.server.api.ODataRequest;
-import org.apache.olingo.server.api.ODataResponse;
-import org.apache.olingo.server.api.batch.BatchFacade;
-import org.apache.olingo.server.api.batch.exception.BatchDeserializerException;
-import org.apache.olingo.server.api.deserializer.batch.BatchRequestPart;
-import org.apache.olingo.server.api.deserializer.batch.ODataResponsePart;
-import org.apache.olingo.server.api.processor.BatchProcessor;
-import org.apache.olingo.server.core.ODataHandler;
-import org.apache.olingo.server.core.deserializer.batch.BatchParserCommon;
-
-public class BatchFascadeImpl implements BatchFacade {
- private final BatchPartHandler partHandler;
-
- public BatchFascadeImpl(ODataHandler oDataHandler, ODataRequest request, BatchProcessor batchProcessor,
- final boolean isStrict) {
- partHandler = new BatchPartHandler(oDataHandler, batchProcessor, this);
- }
-
- @Override
- public ODataResponse handleODataRequest(ODataRequest request) throws BatchDeserializerException {
- return partHandler.handleODataRequest(request);
- }
-
- @Override
- public ODataResponsePart handleBatchRequest(BatchRequestPart request) throws BatchDeserializerException {
- return partHandler.handleBatchRequest(request);
- }
-
- @Override
- public String extractBoundaryFromContentType(String contentType) throws BatchDeserializerException {
- return BatchParserCommon.getBoundary(contentType, 0);
- }
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/batchhandler/BatchHandler.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/batchhandler/BatchHandler.java
deleted file mode 100644
index e8fe1db..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/batchhandler/BatchHandler.java
+++ /dev/null
@@ -1,70 +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.batchhandler;
-
-import org.apache.olingo.commons.api.http.HttpHeader;
-import org.apache.olingo.commons.api.http.HttpMethod;
-import org.apache.olingo.server.api.ODataRequest;
-import org.apache.olingo.server.api.ODataResponse;
-import org.apache.olingo.server.api.batch.BatchFacade;
-import org.apache.olingo.server.api.batch.exception.BatchDeserializerException;
-import org.apache.olingo.server.api.batch.exception.BatchDeserializerException.MessageKeys;
-import org.apache.olingo.server.api.deserializer.DeserializerException;
-import org.apache.olingo.server.api.processor.BatchProcessor;
-import org.apache.olingo.server.api.serializer.SerializerException;
-import org.apache.olingo.server.core.ODataHandler;
-import org.apache.olingo.server.core.deserializer.batch.BatchParserCommon;
-
-public class BatchHandler {
- private final BatchProcessor batchProcessor;
- private final ODataHandler oDataHandler;
-
- public BatchHandler(final ODataHandler oDataHandler, final BatchProcessor batchProcessor) {
-
- this.batchProcessor = batchProcessor;
- this.oDataHandler = oDataHandler;
- }
-
- public void process(final ODataRequest request, final ODataResponse response, final boolean isStrict)
- throws DeserializerException, SerializerException {
- validateRequest(request);
-
- final BatchFacade operation = new BatchFascadeImpl(oDataHandler, request, batchProcessor, isStrict);
- batchProcessor.processBatch(operation, request, response);
- }
-
- private void validateRequest(final ODataRequest request) throws BatchDeserializerException {
- validateHttpMethod(request);
- validateContentType(request);
- }
-
- private void validateContentType(final ODataRequest request) throws BatchDeserializerException {
- final String contentType = request.getHeader(HttpHeader.CONTENT_TYPE);
-
- if (contentType == null || !BatchParserCommon.PATTERN_MULTIPART_BOUNDARY.matcher(contentType).matches()) {
- throw new BatchDeserializerException("Invalid content type", MessageKeys.INVALID_CONTENT_TYPE, 0);
- }
- }
-
- private void validateHttpMethod(final ODataRequest request) throws BatchDeserializerException {
- if (request.getMethod() != HttpMethod.POST) {
- throw new BatchDeserializerException("Invalid HTTP method", MessageKeys.INVALID_METHOD, 0);
- }
- }
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/batchhandler/BatchPartHandler.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/batchhandler/BatchPartHandler.java
deleted file mode 100644
index b140b0b..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/batchhandler/BatchPartHandler.java
+++ /dev/null
@@ -1,87 +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.batchhandler;
-
-import org.apache.olingo.server.api.ODataRequest;
-import org.apache.olingo.server.api.ODataResponse;
-import org.apache.olingo.server.api.batch.BatchFacade;
-import org.apache.olingo.server.api.batch.exception.BatchDeserializerException;
-import org.apache.olingo.server.api.deserializer.batch.BatchRequestPart;
-import org.apache.olingo.server.api.deserializer.batch.ODataResponsePart;
-import org.apache.olingo.server.api.processor.BatchProcessor;
-import org.apache.olingo.server.core.ODataHandler;
-import org.apache.olingo.server.core.batchhandler.referenceRewriting.BatchReferenceRewriter;
-import org.apache.olingo.server.core.deserializer.batch.BatchParserCommon;
-
-public class BatchPartHandler {
- private final ODataHandler oDataHandler;
- private final BatchProcessor batchProcessor;
- private final BatchFacade batchFascade;
- private final BatchReferenceRewriter rewriter;
-
- public BatchPartHandler(final ODataHandler oDataHandler, final BatchProcessor processor,
- final BatchFacade batchFascade) {
- this.oDataHandler = oDataHandler;
- this.batchProcessor = processor;
- this.batchFascade = batchFascade;
- this.rewriter = new BatchReferenceRewriter();
- }
-
- public ODataResponse handleODataRequest(ODataRequest request) throws BatchDeserializerException {
- return handle(request, true);
- }
-
- public ODataResponsePart handleBatchRequest(BatchRequestPart request) throws BatchDeserializerException {
- if (request.isChangeSet()) {
- return handleChangeSet(request);
- } else {
- final ODataResponse response = handle(request.getRequests().get(0), false);
-
- return new ODataResponsePart(response, false);
- }
- }
-
- public ODataResponse handle(ODataRequest request, boolean isChangeSet)
- throws BatchDeserializerException {
- final ODataResponse response;
-
- if (isChangeSet) {
- rewriter.replaceReference(request);
-
- response = oDataHandler.process(request);
-
- rewriter.addMapping(request, response);
- } else {
- response = oDataHandler.process(request);
- }
-
- // Add content id to response
- final String contentId = request.getHeader(BatchParserCommon.HTTP_CONTENT_ID);
- if (contentId != null) {
- response.setHeader(BatchParserCommon.HTTP_CONTENT_ID, contentId);
- }
-
- return response;
- }
-
- private ODataResponsePart handleChangeSet(BatchRequestPart request) throws BatchDeserializerException {
- return batchProcessor.processChangeSet(batchFascade, request.getRequests());
- }
-
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/batchhandler/referenceRewriting/BatchReferenceRewriter.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/batchhandler/referenceRewriting/BatchReferenceRewriter.java
deleted file mode 100644
index 772fd9d..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/batchhandler/referenceRewriting/BatchReferenceRewriter.java
+++ /dev/null
@@ -1,109 +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.batchhandler.referenceRewriting;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.apache.olingo.commons.api.ODataRuntimeException;
-import org.apache.olingo.commons.api.http.HttpHeader;
-import org.apache.olingo.commons.api.http.HttpMethod;
-import org.apache.olingo.server.api.ODataRequest;
-import org.apache.olingo.server.api.ODataResponse;
-import org.apache.olingo.server.api.batch.exception.BatchDeserializerException;
-import org.apache.olingo.server.api.batch.exception.BatchDeserializerException.MessageKeys;
-import org.apache.olingo.server.core.deserializer.batch.BatchParserCommon;
-
-public class BatchReferenceRewriter {
- private static final String REG_EX_REFERENCE = "\\$(.*)(/.*)?";
- private static final Pattern REFERENCE_PATTERN = Pattern.compile(REG_EX_REFERENCE);
-
- private Map<String, String> contentIdMapping = new HashMap<String, String>();
-
- public String getReferenceInURI(ODataRequest request) {
- Matcher matcher = REFERENCE_PATTERN.matcher(removeSlash(removeSlash(request.getRawODataPath(), true), false));
-
- return (matcher.matches()) ? matcher.group(1) : null;
- }
-
- public void replaceReference(ODataRequest request) {
- final String reference = getReferenceInURI(request);
-
- if (reference != null) {
- final String replacement = contentIdMapping.get(reference);
-
- if (replacement != null) {
- replaceContentIdReference(request, reference, replacement);
- } else {
- throw new ODataRuntimeException("Required Content-Id for reference \"" + reference + "\" not found.");
- }
- }
- }
-
- private void replaceContentIdReference(ODataRequest request, String contentId, String resourceUri) {
- final String newUri = request.getRawODataPath().replace("/$" + contentId, resourceUri);
- request.setRawODataPath(newUri);
- request.setRawRequestUri(request.getRawBaseUri() + "/" + newUri);
- }
-
- public void addMapping(ODataRequest request, ODataResponse response)
- throws BatchDeserializerException {
- final String resourceUri = getODataPath(request, response);
- final String contentId = request.getHeader(BatchParserCommon.HTTP_CONTENT_ID);
-
- contentIdMapping.put(contentId, resourceUri);
- }
-
- private String getODataPath(ODataRequest request, ODataResponse response) throws BatchDeserializerException {
- String resourceUri = null;
-
- if (request.getMethod() == HttpMethod.POST) {
- // Create entity
- // The URI of the new resource will be generated by the server and published in the location header
- resourceUri = parseODataPath(response.getHeaders().get(HttpHeader.LOCATION), request.getRawBaseUri());
- } else {
- // Update, Upsert (PUT, PATCH, Delete)
- // These methods still addresses a given resource, so we use the URI given by the request
- resourceUri = request.getRawODataPath();
- }
-
- return resourceUri;
- }
-
- private String parseODataPath(String uri, String rawBaseUri) throws BatchDeserializerException {
- int index = uri.indexOf(rawBaseUri);
-
- if(index == 0) {
- return uri.substring(rawBaseUri.length());
- } else {
- throw new BatchDeserializerException("Invalid base uri or uri", MessageKeys.INVALID_URI, 0);
- }
- }
-
- private String removeSlash(String rawODataPath, boolean first) {
- final int indexOfSlash = rawODataPath.indexOf("/");
- if (first) {
- return (indexOfSlash == 0) ? rawODataPath.substring(1) : rawODataPath;
- } else {
- return (indexOfSlash != -1) ? rawODataPath.substring(0, indexOfSlash) : rawODataPath;
- }
- }
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/FixedFormatDeserializerImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/FixedFormatDeserializerImpl.java
deleted file mode 100644
index a34aa95..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/FixedFormatDeserializerImpl.java
+++ /dev/null
@@ -1,60 +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.deserializer;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.List;
-
-import org.apache.olingo.server.api.batch.exception.BatchDeserializerException;
-import org.apache.olingo.server.api.deserializer.DeserializerException;
-import org.apache.olingo.server.api.deserializer.FixedFormatDeserializer;
-import org.apache.olingo.server.api.deserializer.batch.BatchOptions;
-import org.apache.olingo.server.api.deserializer.batch.BatchRequestPart;
-import org.apache.olingo.server.core.deserializer.batch.BatchParser;
-
-public class FixedFormatDeserializerImpl implements FixedFormatDeserializer {
-
- @Override
- public byte[] binary(InputStream content) throws DeserializerException {
- ByteArrayOutputStream result = new ByteArrayOutputStream();
- byte[] buffer = new byte[128];
- int count = -1;
- try {
- while ((count = content.read(buffer)) > -1) {
- result.write(buffer, 0, count);
- }
- result.flush();
- } catch (final IOException e) {
- throw new DeserializerException("An I/O exception occurred.", e,
- DeserializerException.MessageKeys.IO_EXCEPTION);
- }
- return result.toByteArray();
- }
-
- // TODO: Deserializer
- @Override
- public List<BatchRequestPart> parseBatchRequest(InputStream content, String boundary, BatchOptions options)
- throws BatchDeserializerException {
- final BatchParser parser = new BatchParser();
-
- return parser.parseBatchRequest(content, boundary, options);
- }
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/BatchBodyPart.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/BatchBodyPart.java
deleted file mode 100644
index a11b886..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/BatchBodyPart.java
+++ /dev/null
@@ -1,139 +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.deserializer.batch;
-
-import java.util.LinkedList;
-import java.util.List;
-
-import org.apache.olingo.commons.api.http.HttpHeader;
-import org.apache.olingo.server.api.batch.exception.BatchDeserializerException;
-
-public class BatchBodyPart implements BatchPart {
- final private String boundary;
- final private boolean isStrict;
- final List<Line> remainingMessage = new LinkedList<Line>();
-
- private Header headers;
- private boolean isChangeSet;
- private List<BatchQueryOperation> requests;
-
- public BatchBodyPart(final List<Line> message, final String boundary, final boolean isStrict) {
- this.boundary = boundary;
- this.isStrict = isStrict;
- remainingMessage.addAll(message);
- }
-
- public BatchBodyPart parse() throws BatchDeserializerException {
- headers = BatchParserCommon.consumeHeaders(remainingMessage);
- BatchParserCommon.consumeBlankLine(remainingMessage, isStrict);
- isChangeSet = isChangeSet(headers);
- requests = consumeRequest(remainingMessage);
-
- return this;
- }
-
- private boolean isChangeSet(final Header header) throws BatchDeserializerException {
- final List<String> contentTypes = headers.getHeaders(HttpHeader.CONTENT_TYPE);
- boolean isChangeSet = false;
-
- if (contentTypes.size() == 0) {
- throw new BatchDeserializerException("Missing content type",
- BatchDeserializerException.MessageKeys.MISSING_CONTENT_TYPE, ""
- + headers.getLineNumber());
- }
-
- for (String contentType : contentTypes) {
- if (isContentTypeMultiPartMixed(contentType)) {
- isChangeSet = true;
- }
- }
-
- return isChangeSet;
- }
-
- private List<BatchQueryOperation> consumeRequest(final List<Line> remainingMessage)
- throws BatchDeserializerException {
- if (isChangeSet) {
- return consumeChangeSet(remainingMessage);
- } else {
- return consumeQueryOperation(remainingMessage);
- }
- }
-
- private List<BatchQueryOperation> consumeChangeSet(final List<Line> remainingMessage2)
- throws BatchDeserializerException {
- final List<List<Line>> changeRequests = splitChangeSet(remainingMessage);
- final List<BatchQueryOperation> requestList = new LinkedList<BatchQueryOperation>();
-
- for (List<Line> changeRequest : changeRequests) {
- requestList.add(new BatchChangeSetPart(changeRequest, isStrict).parse());
- }
-
- return requestList;
- }
-
- private List<List<Line>> splitChangeSet(final List<Line> remainingMessage2) throws BatchDeserializerException {
-
- final HeaderField contentTypeField = headers.getHeaderField(HttpHeader.CONTENT_TYPE);
- final String changeSetBoundary = BatchParserCommon.getBoundary(contentTypeField.getValueNotNull(),
- contentTypeField.getLineNumber());
- validateChangeSetBoundary(changeSetBoundary, headers);
-
- return BatchParserCommon.splitMessageByBoundary(remainingMessage, changeSetBoundary);
- }
-
- private void validateChangeSetBoundary(final String changeSetBoundary, final Header header)
- throws BatchDeserializerException {
- if (changeSetBoundary.equals(boundary)) {
- throw new BatchDeserializerException("Change set boundary is equals to batch request boundary",
- BatchDeserializerException.MessageKeys.INVALID_BOUNDARY,
- "" + header.getHeaderField(HttpHeader.CONTENT_TYPE).getLineNumber());
- }
- }
-
- private List<BatchQueryOperation> consumeQueryOperation(final List<Line> remainingMessage)
- throws BatchDeserializerException {
- final List<BatchQueryOperation> requestList = new LinkedList<BatchQueryOperation>();
- requestList.add(new BatchQueryOperation(remainingMessage, isStrict).parse());
-
- return requestList;
- }
-
- private boolean isContentTypeMultiPartMixed(final String contentType) {
- return BatchParserCommon.PATTERN_MULTIPART_BOUNDARY.matcher(contentType).matches();
- }
-
- @Override
- public Header getHeaders() {
- return headers;
- }
-
- @Override
- public boolean isStrict() {
- return isStrict;
- }
-
- public boolean isChangeSet() {
- return isChangeSet;
- }
-
- public List<BatchQueryOperation> getRequests() {
- return requests;
- }
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/BatchChangeSetPart.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/BatchChangeSetPart.java
deleted file mode 100644
index 47210c3..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/BatchChangeSetPart.java
+++ /dev/null
@@ -1,55 +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.deserializer.batch;
-
-import java.util.List;
-
-import org.apache.olingo.server.api.batch.exception.BatchDeserializerException;
-
-public class BatchChangeSetPart extends BatchQueryOperation {
- private BatchQueryOperation request;
-
- public BatchChangeSetPart(final List<Line> message, final boolean isStrict) throws BatchDeserializerException {
- super(message, isStrict);
- }
-
- @Override
- public BatchChangeSetPart parse() throws BatchDeserializerException {
- headers = BatchParserCommon.consumeHeaders(message);
- BatchParserCommon.consumeBlankLine(message, isStrict);
-
- request = new BatchQueryOperation(message, isStrict).parse();
-
- return this;
- }
-
- public BatchQueryOperation getRequest() {
- return request;
- }
-
- @Override
- public List<Line> getBody() {
- return request.getBody();
- }
-
- @Override
- public Line getHttpStatusLine() {
- return request.getHttpStatusLine();
- }
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/BatchParser.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/BatchParser.java
deleted file mode 100644
index f7a78b8..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/BatchParser.java
+++ /dev/null
@@ -1,82 +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.deserializer.batch;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.util.LinkedList;
-import java.util.List;
-
-import org.apache.olingo.commons.api.ODataRuntimeException;
-import org.apache.olingo.server.api.batch.exception.BatchDeserializerException;
-import org.apache.olingo.server.api.deserializer.batch.BatchOptions;
-import org.apache.olingo.server.api.deserializer.batch.BatchRequestPart;
-
-public class BatchParser {
-
- private BatchOptions options;
-
- public List<BatchRequestPart> parseBatchRequest(InputStream content, String boundary, BatchOptions options)
- throws BatchDeserializerException {
- this.options = options;
-
- BatchRequestTransformator transformator = new BatchRequestTransformator(options.getRawBaseUri(),
- options.getRawServiceResolutionUri());
- return parse(content, boundary, transformator);
- }
-
- private List<BatchRequestPart> parse(final InputStream in, String boundary,
- final BatchRequestTransformator transformator)
- throws BatchDeserializerException {
- try {
- return parseBatch(in, boundary, transformator);
- } catch (IOException e) {
- throw new ODataRuntimeException(e);
- } finally {
- try {
- in.close();
- } catch (IOException e) {
- throw new ODataRuntimeException(e);
- }
- }
- }
-
- private List<BatchRequestPart> parseBatch(final InputStream in, final String boundary,
- final BatchRequestTransformator transformator) throws IOException, BatchDeserializerException {
- final List<BatchRequestPart> resultList = new LinkedList<BatchRequestPart>();
- final List<List<Line>> bodyPartStrings = splitBodyParts(in, boundary);
-
- for (List<Line> bodyPartString : bodyPartStrings) {
- BatchBodyPart bodyPart = new BatchBodyPart(bodyPartString, boundary, options.isStrict()).parse();
- resultList.addAll(transformator.transform(bodyPart));
- }
-
- return resultList;
- }
-
- private List<List<Line>> splitBodyParts(final InputStream in, final String boundary) throws IOException,
- BatchDeserializerException {
- final BufferedReaderIncludingLineEndings reader = new BufferedReaderIncludingLineEndings(new InputStreamReader(in));
- final List<Line> message = reader.toLineList();
- reader.close();
-
- return BatchParserCommon.splitMessageByBoundary(message, boundary);
- }
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/BatchParserCommon.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/BatchParserCommon.java
deleted file mode 100644
index b09f56b..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/BatchParserCommon.java
+++ /dev/null
@@ -1,229 +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.deserializer.batch;
-
-import java.io.ByteArrayInputStream;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Locale;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.apache.olingo.commons.api.http.HttpContentType;
-import org.apache.olingo.server.api.batch.exception.BatchDeserializerException;
-
-public class BatchParserCommon {
-
- private static final String REG_EX_BOUNDARY =
- "([a-zA-Z0-9_\\-\\.'\\+]{1,70})|\"([a-zA-Z0-9_\\-\\.'\\+\\s\\" +
- "(\\),/:=\\?]{1,69}[a-zA-Z0-9_\\-\\.'\\+\\(\\),/:=\\?])\"";
- private static final Pattern PATTERN_LAST_CRLF = Pattern.compile("(.*)(\r\n){1}( *)", Pattern.DOTALL);
- private static final Pattern PATTERN_HEADER_LINE = Pattern.compile("([a-zA-Z\\-]+):\\s?(.*)\\s*");
- private static final String REG_EX_APPLICATION_HTTP = "application/http";
-
- public static final Pattern PATTERN_MULTIPART_BOUNDARY = Pattern.compile("multipart/mixed(.*)",
- Pattern.CASE_INSENSITIVE);
- public static final Pattern PATTERN_CONTENT_TYPE_APPLICATION_HTTP = Pattern.compile(REG_EX_APPLICATION_HTTP,
- Pattern.CASE_INSENSITIVE);
- public static final String BINARY_ENCODING = "binary";
- public static final String HTTP_CONTENT_ID = "Content-Id";
- public static final String HTTP_CONTENT_TRANSFER_ENCODING = "Content-Transfer-Encoding";
-
- public static final String HTTP_EXPECT = "Expect";
- public static final String HTTP_FROM = "From";
- public static final String HTTP_MAX_FORWARDS = "Max-Forwards";
- public static final String HTTP_RANGE = "Range";
- public static final String HTTP_TE = "TE";
-
- public static String getBoundary(final String contentType, final int line) throws BatchDeserializerException {
- if (contentType == null) {
- throw new BatchDeserializerException("Missing content type",
- BatchDeserializerException.MessageKeys.MISSING_CONTENT_TYPE, line);
- }
-
- if (contentType.toLowerCase(Locale.ENGLISH).startsWith("multipart/mixed")) {
- final String[] parameter = contentType.split(";");
-
- for (final String pair : parameter) {
-
- final String[] attrValue = pair.split("=");
- if (attrValue.length == 2 && "boundary".equals(attrValue[0].trim().toLowerCase(Locale.ENGLISH))) {
- if (attrValue[1].matches(REG_EX_BOUNDARY)) {
- return trimQuota(attrValue[1].trim());
- } else {
- throw new BatchDeserializerException("Invalid boundary format",
- BatchDeserializerException.MessageKeys.INVALID_BOUNDARY, "" + line);
- }
- }
-
- }
- }
- throw new BatchDeserializerException("Content type is not multipart mixed",
- BatchDeserializerException.MessageKeys.INVALID_CONTENT_TYPE, HttpContentType.MULTIPART_MIXED);
- }
-
- public static String removeEndingSlash(String content) {
- content = content.trim();
- int lastSlashIndex = content.lastIndexOf('/');
-
- return (lastSlashIndex == content.length() - 1) ? content.substring(0, content.length() - 1) : content;
- }
-
- private static String trimQuota(String boundary) {
- if (boundary.matches("\".*\"")) {
- boundary = boundary.replace("\"", "");
- }
-
- return boundary;
- }
-
- public static List<List<Line>> splitMessageByBoundary(final List<Line> message, final String boundary)
- throws BatchDeserializerException {
- final List<List<Line>> messageParts = new LinkedList<List<Line>>();
- List<Line> currentPart = new ArrayList<Line>();
- boolean isEndReached = false;
-
- final String quotedBoundary = Pattern.quote(boundary);
- final Pattern boundaryDelimiterPattern = Pattern.compile("--" + quotedBoundary + "--[\\s ]*");
- final Pattern boundaryPattern = Pattern.compile("--" + quotedBoundary + "[\\s ]*");
-
- for (Line currentLine : message) {
- if (boundaryDelimiterPattern.matcher(currentLine.toString()).matches()) {
- removeEndingCRLFFromList(currentPart);
- messageParts.add(currentPart);
- isEndReached = true;
- } else if (boundaryPattern.matcher(currentLine.toString()).matches()) {
- removeEndingCRLFFromList(currentPart);
- messageParts.add(currentPart);
- currentPart = new LinkedList<Line>();
- } else {
- currentPart.add(currentLine);
- }
-
- if (isEndReached) {
- break;
- }
- }
-
- final int lineNumer = (message.size() > 0) ? message.get(0).getLineNumber() : 0;
- // Remove preamble
- if (messageParts.size() > 0) {
- messageParts.remove(0);
- }
-
- if (!isEndReached) {
- throw new BatchDeserializerException("Missing close boundary delimiter",
- BatchDeserializerException.MessageKeys.MISSING_CLOSE_DELIMITER,
- "" + lineNumer);
- }
-
- return messageParts;
- }
-
- private static void removeEndingCRLFFromList(final List<Line> list) {
- if (list.size() > 0) {
- Line lastLine = list.remove(list.size() - 1);
- list.add(removeEndingCRLF(lastLine));
- }
- }
-
- public static Line removeEndingCRLF(final Line line) {
- Pattern pattern = PATTERN_LAST_CRLF;
- Matcher matcher = pattern.matcher(line.toString());
-
- if (matcher.matches()) {
- return new Line(matcher.group(1), line.getLineNumber());
- } else {
- return line;
- }
- }
-
- public static Header consumeHeaders(final List<Line> remainingMessage) {
- final int headerLineNumber = remainingMessage.size() != 0 ? remainingMessage.get(0).getLineNumber() : 0;
- final Header headers = new Header(headerLineNumber);
- final Iterator<Line> iter = remainingMessage.iterator();
- Line currentLine;
- boolean isHeader = true;
-
- while (iter.hasNext() && isHeader) {
- currentLine = iter.next();
- final Matcher headerMatcher = PATTERN_HEADER_LINE.matcher(currentLine.toString());
-
- if (headerMatcher.matches() && headerMatcher.groupCount() == 2) {
- iter.remove();
-
- String headerName = headerMatcher.group(1).trim();
- String headerValue = headerMatcher.group(2).trim();
-
- headers.addHeader(headerName, Header.splitValuesByComma(headerValue), currentLine.getLineNumber());
- } else {
- isHeader = false;
- }
- }
-
- return headers;
- }
-
- public static void consumeBlankLine(final List<Line> remainingMessage, final boolean isStrict)
- throws BatchDeserializerException {
- // TODO is \r\n to strict?
- if (remainingMessage.size() > 0 && remainingMessage.get(0).toString().matches("\\s*(\r\n|\n)\\s*")) {
- remainingMessage.remove(0);
- } else {
- if (isStrict) {
- final int lineNumber = (remainingMessage.size() > 0) ? remainingMessage.get(0).getLineNumber() : 0;
- throw new BatchDeserializerException("Missing blank line",
- BatchDeserializerException.MessageKeys.MISSING_BLANK_LINE, "[None]", ""
- + lineNumber);
- }
- }
- }
-
- public static InputStream convertLineListToInputStream(final List<Line> messageList) {
- final String message = lineListToString(messageList);
-
- return new ByteArrayInputStream(message.getBytes());
- }
-
- private static String lineListToString(final List<Line> messageList) {
- final StringBuilder builder = new StringBuilder();
-
- for (Line currentLine : messageList) {
- builder.append(currentLine.toString());
- }
-
- return builder.toString();
- }
-
- public static String trimLineListToLength(final List<Line> list, final int length) {
- final String message = lineListToString(list);
- final int lastIndex = Math.min(length, message.length());
-
- return (lastIndex > 0) ? message.substring(0, lastIndex) : "";
- }
-
- public static InputStream convertLineListToInputStream(final List<Line> list, final int length) {
- final String message = trimLineListToLength(list, length);
-
- return new ByteArrayInputStream(message.getBytes());
- }
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/BatchPart.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/BatchPart.java
deleted file mode 100644
index 9ee642d..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/BatchPart.java
+++ /dev/null
@@ -1,25 +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.deserializer.batch;
-
-public interface BatchPart {
- public Header getHeaders();
-
- public boolean isStrict();
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/BatchQueryOperation.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/BatchQueryOperation.java
deleted file mode 100644
index efc9f32..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/BatchQueryOperation.java
+++ /dev/null
@@ -1,82 +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.deserializer.batch;
-
-import java.util.List;
-
-import org.apache.olingo.server.api.batch.exception.BatchDeserializerException;
-
-public class BatchQueryOperation implements BatchPart {
-
- protected final boolean isStrict;
- protected Line httpStatusLine;
- protected Header headers;
- protected List<Line> body;
- protected int bodySize;
- protected List<Line> message;
-
- public BatchQueryOperation(final List<Line> message, final boolean isStrict) {
- this.isStrict = isStrict;
- this.message = message;
- }
-
- public BatchQueryOperation parse() throws BatchDeserializerException {
- httpStatusLine = consumeHttpStatusLine(message);
- headers = BatchParserCommon.consumeHeaders(message);
- BatchParserCommon.consumeBlankLine(message, isStrict);
- body = message;
-
- return this;
- }
-
- protected Line consumeHttpStatusLine(final List<Line> message) throws BatchDeserializerException {
- if (message.size() > 0 && !message.get(0).toString().trim().equals("")) {
- final Line method = message.get(0);
- message.remove(0);
-
- return method;
- } else {
- final int line = (message.size() > 0) ? message.get(0).getLineNumber() : 0;
- throw new BatchDeserializerException("Missing http request line",
- BatchDeserializerException.MessageKeys.INVALID_STATUS_LINE, "" + line);
- }
- }
-
- public Line getHttpStatusLine() {
- return httpStatusLine;
- }
-
- public List<Line> getBody() {
- return body;
- }
-
- public int getBodySize() {
- return bodySize;
- }
-
- @Override
- public Header getHeaders() {
- return headers;
- }
-
- @Override
- public boolean isStrict() {
- return isStrict;
- }
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/BatchRequestTransformator.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/BatchRequestTransformator.java
deleted file mode 100644
index 6da8de8..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/BatchRequestTransformator.java
+++ /dev/null
@@ -1,184 +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.deserializer.batch;
-
-import java.io.ByteArrayInputStream;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.LinkedList;
-import java.util.List;
-
-import org.apache.olingo.commons.api.http.HttpHeader;
-import org.apache.olingo.commons.api.http.HttpMethod;
-import org.apache.olingo.server.api.ODataRequest;
-import org.apache.olingo.server.api.batch.exception.BatchDeserializerException;
-import org.apache.olingo.server.api.batch.exception.BatchDeserializerException.MessageKeys;
-import org.apache.olingo.server.api.deserializer.batch.BatchRequestPart;
-
-public class BatchRequestTransformator {
- private final String baseUri;
- private final String rawServiceResolutionUri;
-
- public BatchRequestTransformator(final String baseUri, final String serviceResolutionUri) {
- this.baseUri = baseUri;
- rawServiceResolutionUri = serviceResolutionUri;
- }
-
- public List<BatchRequestPart> transform(final BatchBodyPart bodyPart) throws BatchDeserializerException {
- final List<ODataRequest> requests = new LinkedList<ODataRequest>();
- final List<BatchRequestPart> resultList = new ArrayList<BatchRequestPart>();
-
- validateBodyPartHeader(bodyPart);
-
- for (BatchQueryOperation queryOperation : bodyPart.getRequests()) {
- requests.add(processQueryOperation(bodyPart, baseUri, queryOperation));
- }
-
- resultList.add(new BatchRequestPart(bodyPart.isChangeSet(), requests));
- return resultList;
- }
-
- private ODataRequest processQueryOperation(final BatchBodyPart bodyPart, final String baseUri,
- final BatchQueryOperation queryOperation) throws BatchDeserializerException {
- if (bodyPart.isChangeSet()) {
- BatchQueryOperation encapsulatedQueryOperation = ((BatchChangeSetPart) queryOperation).getRequest();
- handleContentId(queryOperation, encapsulatedQueryOperation);
- validateHeader(queryOperation, true);
-
- return createRequest(encapsulatedQueryOperation, baseUri, bodyPart.isChangeSet());
- } else {
- return createRequest(queryOperation, baseUri, bodyPart.isChangeSet());
- }
- }
-
- private void handleContentId(final BatchQueryOperation changeRequestPart, final BatchQueryOperation request)
- throws BatchDeserializerException {
- final HeaderField contentIdChangeRequestPart = getContentId(changeRequestPart);
- final HeaderField contentIdRequest = getContentId(request);
-
- if (contentIdChangeRequestPart == null && contentIdRequest == null) {
- throw new BatchDeserializerException("Missing content id", MessageKeys.MISSING_CONTENT_ID, changeRequestPart
- .getHeaders()
- .getLineNumber());
- } else if (contentIdChangeRequestPart != null) {
- request.getHeaders().replaceHeaderField(contentIdChangeRequestPart);
- }
- }
-
- private HeaderField getContentId(final BatchQueryOperation queryOperation) throws BatchDeserializerException {
- final HeaderField contentTypeHeader = queryOperation.getHeaders().getHeaderField(BatchParserCommon.HTTP_CONTENT_ID);
-
- if (contentTypeHeader != null) {
- if (contentTypeHeader.getValues().size() == 1) {
- return contentTypeHeader;
- } else {
- throw new BatchDeserializerException("Invalid header", MessageKeys.INVALID_HEADER, contentTypeHeader
- .getLineNumber());
- }
- }
-
- return null;
- }
-
- private ODataRequest createRequest(final BatchQueryOperation operation, final String baseUri,
- final boolean isChangeSet)
- throws BatchDeserializerException {
- final HttpRequestStatusLine statusLine =
- new HttpRequestStatusLine(operation.getHttpStatusLine(), baseUri, rawServiceResolutionUri);
- statusLine.validateHttpMethod(isChangeSet);
-
- validateBody(statusLine, operation);
- InputStream bodyStrean = getBodyStream(operation, statusLine);
-
- validateForbiddenHeader(operation);
-
- final ODataRequest request = new ODataRequest();
- request.setBody(bodyStrean);
- request.setMethod(statusLine.getMethod());
- request.setRawBaseUri(statusLine.getRawBaseUri());
- request.setRawODataPath(statusLine.getRawODataPath());
- request.setRawQueryPath(statusLine.getRawQueryPath());
- request.setRawRequestUri(statusLine.getRawRequestUri());
- request.setRawServiceResolutionUri(statusLine.getRawServiceResolutionUri());
-
- for (final HeaderField field : operation.getHeaders()) {
- request.addHeader(field.getFieldName(), field.getValues());
- }
-
- return request;
- }
-
- private void validateForbiddenHeader(final BatchQueryOperation operation) throws BatchDeserializerException {
- final Header header = operation.getHeaders();
-
- if (header.exists(HttpHeader.AUTHORIZATION) || header.exists(BatchParserCommon.HTTP_EXPECT)
- || header.exists(BatchParserCommon.HTTP_FROM) || header.exists(BatchParserCommon.HTTP_MAX_FORWARDS)
- || header.exists(BatchParserCommon.HTTP_RANGE) || header.exists(BatchParserCommon.HTTP_TE)) {
- throw new BatchDeserializerException("Forbidden header", MessageKeys.FORBIDDEN_HEADER, header.getLineNumber());
- }
- }
-
- private InputStream getBodyStream(final BatchQueryOperation operation, final HttpRequestStatusLine statusLine)
- throws BatchDeserializerException {
- if (statusLine.getMethod().equals(HttpMethod.GET)) {
- return new ByteArrayInputStream(new byte[0]);
- } else {
- int contentLength = BatchTransformatorCommon.getContentLength(operation.getHeaders());
-
- if (contentLength == -1) {
- return BatchParserCommon.convertLineListToInputStream(operation.getBody());
- } else {
- return BatchParserCommon.convertLineListToInputStream(operation.getBody(), contentLength);
- }
- }
- }
-
- private void validateBody(final HttpRequestStatusLine statusLine, final BatchQueryOperation operation)
- throws BatchDeserializerException {
- if (statusLine.getMethod().equals(HttpMethod.GET) && isUnvalidGetRequestBody(operation)) {
- throw new BatchDeserializerException("Invalid request line", MessageKeys.INVALID_CONTENT, statusLine
- .getLineNumber());
- }
- }
-
- private boolean isUnvalidGetRequestBody(final BatchQueryOperation operation) {
- return (operation.getBody().size() > 1)
- || (operation.getBody().size() == 1 && !"".equals(operation.getBody().get(0).toString().trim()));
- }
-
- private void validateHeader(final BatchPart bodyPart, final boolean isChangeSet) throws BatchDeserializerException {
- final Header headers = bodyPart.getHeaders();
-
- BatchTransformatorCommon.validateContentType(headers, BatchParserCommon.PATTERN_CONTENT_TYPE_APPLICATION_HTTP);
- if (isChangeSet) {
- BatchTransformatorCommon.validateContentTransferEncoding(headers);
- }
- }
-
- private void validateBodyPartHeader(final BatchBodyPart bodyPart) throws BatchDeserializerException {
- final Header header = bodyPart.getHeaders();
-
- if (bodyPart.isChangeSet()) {
- BatchTransformatorCommon.validateContentType(header, BatchParserCommon.PATTERN_MULTIPART_BOUNDARY);
- } else {
- BatchTransformatorCommon.validateContentTransferEncoding(header);
- BatchTransformatorCommon.validateContentType(header, BatchParserCommon.PATTERN_CONTENT_TYPE_APPLICATION_HTTP);
- }
- }
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/BatchTransformatorCommon.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/BatchTransformatorCommon.java
deleted file mode 100644
index 2a55bed..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/BatchTransformatorCommon.java
+++ /dev/null
@@ -1,93 +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.deserializer.batch;
-
-import java.util.List;
-import java.util.regex.Pattern;
-
-import org.apache.olingo.commons.api.http.HttpContentType;
-import org.apache.olingo.commons.api.http.HttpHeader;
-import org.apache.olingo.server.api.batch.exception.BatchDeserializerException;
-import org.apache.olingo.server.api.batch.exception.BatchDeserializerException.MessageKeys;
-
-public class BatchTransformatorCommon {
-
- public static void validateContentType(final Header headers, final Pattern pattern)
- throws BatchDeserializerException {
- List<String> contentTypes = headers.getHeaders(HttpHeader.CONTENT_TYPE);
-
- if (contentTypes.size() == 0) {
- throw new BatchDeserializerException("Missing content type", MessageKeys.MISSING_CONTENT_TYPE, headers
- .getLineNumber());
- }
- if (!headers.isHeaderMatching(HttpHeader.CONTENT_TYPE, pattern)) {
-
- throw new BatchDeserializerException("Invalid content type", MessageKeys.INVALID_CONTENT_TYPE,
- HttpContentType.MULTIPART_MIXED + " or " + HttpContentType.APPLICATION_HTTP);
- }
- }
-
- public static void validateContentTransferEncoding(final Header headers) throws BatchDeserializerException {
- final HeaderField contentTransferField = headers.getHeaderField(BatchParserCommon.HTTP_CONTENT_TRANSFER_ENCODING);
-
- if (contentTransferField != null) {
- final List<String> contentTransferValues = contentTransferField.getValues();
- if (contentTransferValues.size() == 1) {
- String encoding = contentTransferValues.get(0);
-
- if (!BatchParserCommon.BINARY_ENCODING.equalsIgnoreCase(encoding)) {
- throw new BatchDeserializerException("Invalid content transfer encoding",
- MessageKeys.INVALID_CONTENT_TRANSFER_ENCODING,
- headers.getLineNumber());
- }
- } else {
- throw new BatchDeserializerException("Invalid header", MessageKeys.INVALID_HEADER, headers.getLineNumber());
- }
- } else {
- throw new BatchDeserializerException("Missing mandatory content transfer encoding",
- MessageKeys.MISSING_CONTENT_TRANSFER_ENCODING,
- headers.getLineNumber());
- }
- }
-
- public static int getContentLength(final Header headers) throws BatchDeserializerException {
- final HeaderField contentLengthField = headers.getHeaderField(HttpHeader.CONTENT_LENGTH);
-
- if (contentLengthField != null && contentLengthField.getValues().size() == 1) {
- final List<String> contentLengthValues = contentLengthField.getValues();
-
- try {
- int contentLength = Integer.parseInt(contentLengthValues.get(0));
-
- if (contentLength < 0) {
- throw new BatchDeserializerException("Invalid content length", MessageKeys.INVALID_CONTENT_LENGTH,
- contentLengthField
- .getLineNumber());
- }
-
- return contentLength;
- } catch (NumberFormatException e) {
- throw new BatchDeserializerException("Invalid header", MessageKeys.INVALID_HEADER, contentLengthField
- .getLineNumber());
- }
- }
-
- return -1;
- }
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/BufferedReaderIncludingLineEndings.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/BufferedReaderIncludingLineEndings.java
deleted file mode 100644
index 2268a1d..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/BufferedReaderIncludingLineEndings.java
+++ /dev/null
@@ -1,233 +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.deserializer.batch;
-
-import java.io.IOException;
-import java.io.Reader;
-import java.util.ArrayList;
-import java.util.List;
-
-public class BufferedReaderIncludingLineEndings extends Reader {
- private static final char CR = '\r';
- private static final char LF = '\n';
- private static final int EOF = -1;
- private static final int BUFFER_SIZE = 8192;
- private Reader reader;
- private char[] buffer;
- private int offset = 0;
- private int limit = 0;
-
- public BufferedReaderIncludingLineEndings(final Reader reader) {
- this(reader, BUFFER_SIZE);
- }
-
- public BufferedReaderIncludingLineEndings(final Reader reader, final int bufferSize) {
- if (bufferSize <= 0) {
- throw new IllegalArgumentException("Buffer size must be greater than zero.");
- }
-
- this.reader = reader;
- buffer = new char[bufferSize];
- }
-
- @Override
- public int read(final char[] charBuffer, final int bufferOffset, final int length) throws IOException {
- if ((bufferOffset + length) > charBuffer.length) {
- throw new IndexOutOfBoundsException("Buffer is too small");
- }
-
- if (length < 0 || bufferOffset < 0) {
- throw new IndexOutOfBoundsException("Offset and length must be grater than zero");
- }
-
- // Check if buffer is filled. Return if EOF is reached
- // Is buffer refill required
- if (limit == offset || isEOF()) {
- fillBuffer();
-
- if (isEOF()) {
- return EOF;
- }
- }
-
- int bytesRead = 0;
- int bytesToRead = length;
- int currentOutputOffset = bufferOffset;
-
- while (bytesToRead != 0) {
- // Is buffer refill required?
- if (limit == offset) {
- fillBuffer();
-
- if (isEOF()) {
- bytesToRead = 0;
- }
- }
-
- if (bytesToRead > 0) {
- int readByte = Math.min(limit - offset, bytesToRead);
- bytesRead += readByte;
- bytesToRead -= readByte;
-
- for (int i = 0; i < readByte; i++) {
- charBuffer[currentOutputOffset++] = buffer[offset++];
- }
- }
- }
-
- return bytesRead;
- }
-
- public List<String> toList() throws IOException {
- final List<String> result = new ArrayList<String>();
- String currentLine;
-
- while ((currentLine = readLine()) != null) {
- result.add(currentLine);
- }
-
- return result;
- }
-
- public List<Line> toLineList() throws IOException {
- final List<Line> result = new ArrayList<Line>();
- String currentLine;
- int counter = 1;
-
- while ((currentLine = readLine()) != null) {
- result.add(new Line(currentLine, counter++));
- }
-
- return result;
- }
-
- public String readLine() throws IOException {
- if (limit == EOF) {
- return null;
- }
-
- final StringBuilder stringBuffer = new StringBuilder();
- boolean foundLineEnd = false; // EOF will be considered as line ending
-
- while (!foundLineEnd) {
- // Is buffer refill required?
- if (limit == offset) {
- if (fillBuffer() == EOF) {
- foundLineEnd = true;
- }
- }
-
- if (!foundLineEnd) {
- char currentChar = buffer[offset++];
- stringBuffer.append(currentChar);
-
- if (currentChar == LF) {
- foundLineEnd = true;
- } else if (currentChar == CR) {
- foundLineEnd = true;
-
- // Check next char. Consume \n if available
- // Is buffer refill required?
- if (limit == offset) {
- fillBuffer();
- }
-
- // Check if there is at least one character
- if (limit != EOF && buffer[offset] == LF) {
- stringBuffer.append(LF);
- offset++;
- }
- }
- }
- }
-
- return (stringBuffer.length() == 0) ? null : stringBuffer.toString();
- }
-
- @Override
- public void close() throws IOException {
- reader.close();
- }
-
- @Override
- public boolean ready() throws IOException {
- // Not EOF and buffer refill is not required
- return !isEOF() && !(limit == offset);
- }
-
- @Override
- public void reset() throws IOException {
- throw new IOException("Reset is not supported");
- }
-
- @Override
- public void mark(final int readAheadLimit) throws IOException {
- throw new IOException("Mark is not supported");
- }
-
- @Override
- public boolean markSupported() {
- return false;
- }
-
- @Override
- public long skip(final long n) throws IOException {
- if (n == 0) {
- return 0;
- } else if (n < 0) {
- throw new IllegalArgumentException("skip value is negative");
- } else {
- long charactersToSkip = n;
- long charactersSkiped = 0;
-
- while (charactersToSkip != 0) {
- // Is buffer refill required?
- if (limit == offset) {
- fillBuffer();
-
- if (isEOF()) {
- charactersToSkip = 0;
- }
- }
-
- // Check if more characters are available
- if (!isEOF()) {
- int skipChars = (int) Math.min(limit - offset, charactersToSkip);
-
- charactersSkiped += skipChars;
- charactersToSkip -= skipChars;
- offset += skipChars;
- }
- }
-
- return charactersSkiped;
- }
- }
-
- private boolean isEOF() {
- return limit == EOF;
- }
-
- private int fillBuffer() throws IOException {
- limit = reader.read(buffer, 0, buffer.length);
- offset = 0;
-
- return limit;
- }
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/Header.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/Header.java
deleted file mode 100644
index a9b05b1..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/Header.java
+++ /dev/null
@@ -1,181 +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.deserializer.batch;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-import java.util.regex.Pattern;
-
-public class Header implements Iterable<HeaderField> {
- private final Map<String, HeaderField> headers = new HashMap<String, HeaderField>();
- private int lineNumber;
-
- public Header(final int lineNumer) {
- lineNumber = lineNumer;
- }
-
- public void addHeader(final String name, final String value, final int lineNumber) {
- final HeaderField headerField = getHeaderFieldOrDefault(name, lineNumber);
- final List<String> headerValues = headerField.getValues();
-
- if (!headerValues.contains(value)) {
- headerValues.add(value);
- }
- }
-
- public void addHeader(final String name, final List<String> values, final int lineNumber) {
- final HeaderField headerField = getHeaderFieldOrDefault(name, lineNumber);
- final List<String> headerValues = headerField.getValues();
-
- for (final String value : values) {
- if (!headerValues.contains(value)) {
- headerValues.add(value);
- }
- }
- }
-
- public void replaceHeaderField(final HeaderField headerField) {
- headers.put(headerField.getFieldName().toLowerCase(Locale.ENGLISH), headerField);
- }
-
- public boolean exists(final String name) {
- final HeaderField field = headers.get(name.toLowerCase(Locale.ENGLISH));
-
- return field != null && field.getValues().size() != 0;
- }
-
- public boolean isHeaderMatching(final String name, final Pattern pattern) {
- if (getHeaders(name).size() != 1) {
- return false;
- } else {
- return pattern.matcher(getHeaders(name).get(0)).matches();
- }
- }
-
- public void removeHeader(final String name) {
- headers.remove(name.toLowerCase(Locale.ENGLISH));
- }
-
- public String getHeader(final String name) {
- final HeaderField headerField = getHeaderField(name);
-
- return (headerField == null) ? null : headerField.getValue();
- }
-
- public String getHeaderNotNull(final String name) {
- final HeaderField headerField = getHeaderField(name);
-
- return (headerField == null) ? "" : headerField.getValueNotNull();
- }
-
- public List<String> getHeaders(final String name) {
- final HeaderField headerField = getHeaderField(name);
-
- return (headerField == null) ? new ArrayList<String>() : headerField.getValues();
- }
-
- public HeaderField getHeaderField(final String name) {
- return headers.get(name.toLowerCase(Locale.ENGLISH));
- }
-
- public int getLineNumber() {
- return lineNumber;
- }
-
- public Map<String, String> toSingleMap() {
- final Map<String, String> singleMap = new HashMap<String, String>();
-
- for (final String key : headers.keySet()) {
- HeaderField field = headers.get(key);
- singleMap.put(field.getFieldName(), getHeader(key));
- }
-
- return singleMap;
- }
-
- public Map<String, List<String>> toMultiMap() {
- final Map<String, List<String>> singleMap = new HashMap<String, List<String>>();
-
- for (final String key : headers.keySet()) {
- HeaderField field = headers.get(key);
- singleMap.put(field.getFieldName(), field.getValues());
- }
-
- return singleMap;
- }
-
- private HeaderField getHeaderFieldOrDefault(final String name, final int lineNumber) {
- HeaderField headerField = headers.get(name.toLowerCase(Locale.ENGLISH));
-
- if (headerField == null) {
- headerField = new HeaderField(name, lineNumber);
- headers.put(name.toLowerCase(Locale.ENGLISH), headerField);
- }
-
- return headerField;
- }
-
- @Override
- public Header clone() {
- final Header newInstance = new Header(lineNumber);
-
- for (final String key : headers.keySet()) {
- newInstance.headers.put(key, headers.get(key).clone());
- }
-
- return newInstance;
- }
-
- @Override
- public Iterator<HeaderField> iterator() {
- return new Iterator<HeaderField>() {
- Iterator<String> keyIterator = headers.keySet().iterator();
-
- @Override
- public boolean hasNext() {
- return keyIterator.hasNext();
- }
-
- @Override
- public HeaderField next() {
- return headers.get(keyIterator.next());
- }
-
- @Override
- public void remove() {
- throw new UnsupportedOperationException();
- }
- };
- }
-
- public static List<String> splitValuesByComma(final String headerValue) {
- final List<String> singleValues = new ArrayList<String>();
-
- String[] parts = headerValue.split(",");
- for (final String value : parts) {
- singleValues.add(value.trim());
- }
-
- return singleValues;
- }
-}
\ No newline at end of file
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/HeaderField.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/HeaderField.java
deleted file mode 100644
index 870f276..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/HeaderField.java
+++ /dev/null
@@ -1,121 +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.deserializer.batch;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class HeaderField implements Cloneable {
- private final String fieldName;
- private final List<String> values;
- private final int lineNumber;
-
- public HeaderField(final String fieldName, final int lineNumber) {
- this(fieldName, new ArrayList<String>(), lineNumber);
- }
-
- public HeaderField(final String fieldName, final List<String> values, final int lineNumber) {
- this.fieldName = fieldName;
- this.values = values;
- this.lineNumber = lineNumber;
- }
-
- public String getFieldName() {
- return fieldName;
- }
-
- public List<String> getValues() {
- return values;
- }
-
- public String getValue() {
- final StringBuilder result = new StringBuilder();
-
- for (final String value : values) {
- result.append(value);
- result.append(", ");
- }
-
- if (result.length() > 0) {
- result.delete(result.length() - 2, result.length());
- }
-
- return result.toString();
- }
-
- public String getValueNotNull() {
- final String value = getValue();
-
- return (value == null) ? "" : value;
- }
-
- @Override
- public HeaderField clone() {
- List<String> newValues = new ArrayList<String>();
- newValues.addAll(values);
-
- return new HeaderField(fieldName, newValues, lineNumber);
- }
-
- public int getLineNumber() {
- return lineNumber;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((fieldName == null) ? 0 : fieldName.hashCode());
- result = prime * result + lineNumber;
- result = prime * result + ((values == null) ? 0 : values.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(final Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- HeaderField other = (HeaderField) obj;
- if (fieldName == null) {
- if (other.fieldName != null) {
- return false;
- }
- } else if (!fieldName.equals(other.fieldName)) {
- return false;
- }
- if (lineNumber != other.lineNumber) {
- return false;
- }
- if (values == null) {
- if (other.values != null) {
- return false;
- }
- } else if (!values.equals(other.values)) {
- return false;
- }
- return true;
- }
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/HttpRequestStatusLine.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/HttpRequestStatusLine.java
deleted file mode 100644
index 74b67cb..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/HttpRequestStatusLine.java
+++ /dev/null
@@ -1,194 +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.deserializer.batch;
-
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Set;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.apache.olingo.commons.api.http.HttpMethod;
-import org.apache.olingo.server.api.batch.exception.BatchDeserializerException;
-import org.apache.olingo.server.api.batch.exception.BatchDeserializerException.MessageKeys;
-
-public class HttpRequestStatusLine {
- private static final Pattern PATTERN_RELATIVE_URI = Pattern.compile("([^/][^?]*)(?:\\?(.*))?");
-
- private static final Set<String> HTTP_BATCH_METHODS = new HashSet<String>(Arrays.asList(new String[] { "GET" }));
- private static final Set<String> HTTP_CHANGE_SET_METHODS = new HashSet<String>(Arrays.asList(new String[] { "POST",
- "PUT", "DELETE", "PATCH" }));
- private static final String HTTP_VERSION = "HTTP/1.1";
-
- final private Line statusLine;
- final String requestBaseUri;
-
- private HttpMethod method;
- private String httpVersion;
- private String rawServiceResolutionUri;
- private String rawQueryPath;
- private String rawODataPath;
- private String rawBaseUri;
- private String rawRequestUri;
-
- public HttpRequestStatusLine(final Line httpStatusLine, final String baseUri, final String serviceResolutionUri)
- throws BatchDeserializerException {
- statusLine = httpStatusLine;
- requestBaseUri = baseUri;
- rawServiceResolutionUri = serviceResolutionUri;
-
- parse();
- }
-
- private void parse() throws BatchDeserializerException {
- final String[] parts = statusLine.toString().split(" ");
-
- if (parts.length == 3) {
- method = parseMethod(parts[0]);
- // uri = new ODataURI(parts[1], requestBaseUri, statusLine.getLineNumber(), header.getHeaders(HttpHeader.HOST));
- parseUri(parts[1], requestBaseUri);
- httpVersion = parseHttpVersion(parts[2]);
- } else {
- throw new BatchDeserializerException("Invalid status line", MessageKeys.INVALID_STATUS_LINE, statusLine
- .getLineNumber());
- }
- }
-
- private void parseUri(String rawUri, String baseUri) throws BatchDeserializerException {
- try {
- final URI uri = new URI(rawUri);
-
- if (uri.isAbsolute()) {
- parseAbsoluteUri(rawUri, baseUri);
- } else {
- parseRelativeUri(rawUri);
- }
- } catch (URISyntaxException e) {
- throw new BatchDeserializerException("Malformed uri", MessageKeys.INVALID_URI, statusLine.getLineNumber());
- }
- }
-
- private void parseAbsoluteUri(String rawUri, String baseUri) throws BatchDeserializerException {
- if (rawUri.startsWith(baseUri)) {
- final String relativeUri = removeLeadingSlash(rawUri.substring(baseUri.length()));
- parseRelativeUri(relativeUri);
- } else {
- throw new BatchDeserializerException("Base uri do not match", MessageKeys.INVALID_BASE_URI, statusLine
- .getLineNumber());
- }
- }
-
- private String removeLeadingSlash(String value) {
- return (value.length() > 0 && value.charAt(0) == '/') ? value.substring(1) : value;
- }
-
- private void parseRelativeUri(String rawUri) throws BatchDeserializerException {
- final Matcher relativeUriMatcher = PATTERN_RELATIVE_URI.matcher(rawUri);
-
- if (relativeUriMatcher.matches()) {
- buildUri(relativeUriMatcher.group(1), relativeUriMatcher.group(2));
- } else {
- throw new BatchDeserializerException("Malformed uri", MessageKeys.INVALID_URI, statusLine.getLineNumber());
- }
- }
-
- private void buildUri(final String oDataPath, final String queryOptions) throws BatchDeserializerException {
- rawBaseUri = requestBaseUri;
- rawODataPath = "/" + oDataPath;
- rawRequestUri = requestBaseUri + rawODataPath;
-
- if (queryOptions != null) {
- rawRequestUri += "?" + queryOptions;
- rawQueryPath = queryOptions;
- } else {
- rawQueryPath = "";
- }
- }
-
- private HttpMethod parseMethod(final String method) throws BatchDeserializerException {
- try {
- return HttpMethod.valueOf(method.trim());
- } catch (IllegalArgumentException e) {
- throw new BatchDeserializerException("Illegal http method", MessageKeys.INVALID_METHOD, statusLine
- .getLineNumber());
- }
- }
-
- private String parseHttpVersion(final String httpVersion) throws BatchDeserializerException {
- if (!HTTP_VERSION.equals(httpVersion.trim())) {
- throw new BatchDeserializerException("Invalid http version", MessageKeys.INVALID_HTTP_VERSION, statusLine
- .getLineNumber());
- } else {
- return HTTP_VERSION;
- }
- }
-
- public void validateHttpMethod(final boolean isChangeSet) throws BatchDeserializerException {
- Set<String> validMethods = (isChangeSet) ? HTTP_CHANGE_SET_METHODS : HTTP_BATCH_METHODS;
-
- if (!validMethods.contains(getMethod().toString())) {
- if (isChangeSet) {
- throw new BatchDeserializerException("Invalid change set method", MessageKeys.INVALID_CHANGESET_METHOD,
- statusLine.getLineNumber());
- } else {
- throw new BatchDeserializerException("Invalid query operation method",
- MessageKeys.INVALID_QUERY_OPERATION_METHOD,
- statusLine.getLineNumber());
- }
- }
- }
-
- public HttpMethod getMethod() {
- return method;
- }
-
- public String getHttpVersion() {
- return httpVersion;
- }
-
- public int getLineNumber() {
- return statusLine.getLineNumber();
- }
-
- public String getRequestBaseUri() {
- return requestBaseUri;
- }
-
- public String getRawServiceResolutionUri() {
- return rawServiceResolutionUri;
- }
-
- public String getRawQueryPath() {
- return rawQueryPath;
- }
-
- public String getRawODataPath() {
- return rawODataPath;
- }
-
- public String getRawBaseUri() {
- return rawBaseUri;
- }
-
- public String getRawRequestUri() {
- return rawRequestUri;
- }
-}
\ No newline at end of file
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/Line.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/Line.java
deleted file mode 100644
index 6485a49..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/batch/Line.java
+++ /dev/null
@@ -1,72 +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.deserializer.batch;
-
-public class Line {
- private final int lineNumber;
- private final String content;
-
- public Line(final String content, final int lineNumber) {
- this.content = content;
- this.lineNumber = lineNumber;
- }
-
- public int getLineNumber() {
- return lineNumber;
- }
-
- @Override
- public String toString() {
- return content;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((content == null) ? 0 : content.hashCode());
- result = prime * result + lineNumber;
- return result;
- }
-
- @Override
- public boolean equals(final Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- Line other = (Line) obj;
- if (content == null) {
- if (other.content != null) {
- return false;
- }
- } else if (!content.equals(other.content)) {
- return false;
- }
- if (lineNumber != other.lineNumber) {
- return false;
- }
- return true;
- }
-}
\ No newline at end of file
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/json/ODataJsonDeserializer.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/json/ODataJsonDeserializer.java
deleted file mode 100644
index 6d03215..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/deserializer/json/ODataJsonDeserializer.java
+++ /dev/null
@@ -1,616 +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.deserializer.json;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-
-import org.apache.olingo.commons.api.Constants;
-import org.apache.olingo.commons.api.data.Entity;
-import org.apache.olingo.commons.api.data.EntitySet;
-import org.apache.olingo.commons.api.data.Link;
-import org.apache.olingo.commons.api.data.Property;
-import org.apache.olingo.commons.api.data.ValueType;
-import org.apache.olingo.commons.api.domain.ODataLinkType;
-import org.apache.olingo.commons.api.edm.EdmComplexType;
-import org.apache.olingo.commons.api.edm.EdmEntityType;
-import org.apache.olingo.commons.api.edm.EdmEnumType;
-import org.apache.olingo.commons.api.edm.EdmNavigationProperty;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
-import org.apache.olingo.commons.api.edm.EdmProperty;
-import org.apache.olingo.commons.api.edm.EdmTypeDefinition;
-import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
-import org.apache.olingo.commons.core.data.EntityImpl;
-import org.apache.olingo.commons.core.data.EntitySetImpl;
-import org.apache.olingo.commons.core.data.LinkImpl;
-import org.apache.olingo.commons.core.data.PropertyImpl;
-import org.apache.olingo.server.api.deserializer.DeserializerException;
-import org.apache.olingo.server.api.deserializer.ODataDeserializer;
-
-import com.fasterxml.jackson.core.JsonFactory;
-import com.fasterxml.jackson.core.JsonParseException;
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.databind.DeserializationFeature;
-import com.fasterxml.jackson.databind.JsonMappingException;
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-
-public class ODataJsonDeserializer implements ODataDeserializer {
-
- private static final String ODATA_ANNOTATION_MARKER = "@";
- private static final String ODATA_CONTROL_INFORMATION_PREFIX = "@odata.";
-
- @Override
- public EntitySet entityCollection(InputStream stream, EdmEntityType edmEntityType) throws DeserializerException {
- try {
- ObjectMapper objectMapper = new ObjectMapper();
- objectMapper.configure(DeserializationFeature.FAIL_ON_READING_DUP_TREE_KEY, true);
- JsonParser parser = new JsonFactory(objectMapper).createParser(stream);
- final ObjectNode tree = parser.getCodec().readTree(parser);
-
- return consumeEntitySetNode(edmEntityType, tree);
- } catch (JsonParseException e) {
- throw new DeserializerException("An JsonParseException occurred", e,
- DeserializerException.MessageKeys.JSON_SYNTAX_EXCEPTION);
- } catch (JsonMappingException e) {
- throw new DeserializerException("Duplicate json property detected", e,
- DeserializerException.MessageKeys.DUPLICATE_JSON_PROPERTY);
- } catch (IOException e) {
- throw new DeserializerException("An IOException occurred", e, DeserializerException.MessageKeys.IO_EXCEPTION);
- }
- }
-
- private EntitySet consumeEntitySetNode(EdmEntityType edmEntityType, final ObjectNode tree)
- throws DeserializerException {
- EntitySetImpl entitySet = new EntitySetImpl();
-
- // Consume entities
- JsonNode jsonNode = tree.get(Constants.VALUE);
- if (jsonNode != null) {
- if (!jsonNode.isArray()) {
- throw new DeserializerException("The content of the value tag must be an Array but is not. ",
- DeserializerException.MessageKeys.VALUE_TAG_MUST_BE_AN_ARRAY);
- }
-
- entitySet.getEntities().addAll(consumeEntitySetArray(edmEntityType, jsonNode));
- tree.remove(Constants.VALUE);
- } else {
- throw new DeserializerException("Could not find value array.",
- DeserializerException.MessageKeys.VALUE_ARRAY_NOT_PRESENT);
- }
-
- final List<String> toRemove = new ArrayList<String>();
- Iterator<Entry<String, JsonNode>> fieldsIterator = tree.fields();
- while (fieldsIterator.hasNext()) {
- Map.Entry<String, JsonNode> field = fieldsIterator.next();
-
- if (field.getKey().contains(ODATA_CONTROL_INFORMATION_PREFIX)) {
- // Control Information is ignored for requests as per specification chapter "4.5 Control Information"
- toRemove.add(field.getKey());
- } else if (field.getKey().contains(ODATA_ANNOTATION_MARKER)) {
- throw new DeserializerException("Custom annotation with field name: " + field.getKey() + " not supported",
- DeserializerException.MessageKeys.NOT_IMPLEMENTED);
- }
- }
- // remove here to avoid iterator issues.
- tree.remove(toRemove);
- assertJsonNodeIsEmpty(tree);
-
- return entitySet;
- }
-
- private List<Entity> consumeEntitySetArray(EdmEntityType edmEntityType, JsonNode jsonNode)
- throws DeserializerException {
- List<Entity> entities = new ArrayList<Entity>();
- for (JsonNode arrayElement : jsonNode) {
- if (arrayElement.isArray() || arrayElement.isValueNode()) {
- throw new DeserializerException("Nested Arrays and primitive values are not allowed for an entity value.",
- DeserializerException.MessageKeys.INVALID_ENTITY);
- }
-
- entities.add(consumeEntityNode(edmEntityType, (ObjectNode) arrayElement));
- }
- return entities;
- }
-
- @Override
- public Entity entity(InputStream stream, EdmEntityType edmEntityType) throws DeserializerException {
- try {
- ObjectMapper objectMapper = new ObjectMapper();
- objectMapper.configure(DeserializationFeature.FAIL_ON_READING_DUP_TREE_KEY, true);
- JsonParser parser = new JsonFactory(objectMapper).createParser(stream);
- final ObjectNode tree = parser.getCodec().readTree(parser);
-
- return consumeEntityNode(edmEntityType, tree);
-
- } catch (JsonParseException e) {
- throw new DeserializerException("An JsonParseException occurred", e,
- DeserializerException.MessageKeys.JSON_SYNTAX_EXCEPTION);
- } catch (JsonMappingException e) {
- throw new DeserializerException("Duplicate property detected", e,
- DeserializerException.MessageKeys.DUPLICATE_PROPERTY);
- } catch (IOException e) {
- throw new DeserializerException("An IOException occurred", e, DeserializerException.MessageKeys.IO_EXCEPTION);
- }
-
- }
-
- private Entity consumeEntityNode(EdmEntityType edmEntityType, final ObjectNode tree) throws DeserializerException {
- EntityImpl entity = new EntityImpl();
- entity.setType(edmEntityType.getFullQualifiedName().getFullQualifiedNameAsString());
-
- // Check and consume all Properties
- consumeEntityProperties(edmEntityType, tree, entity);
-
- // Check and consume all expanded Navigation Properties
- consumeExpandedNavigationProperties(edmEntityType, tree, entity);
-
- // consume remaining json node fields
- consumeRemainingJsonNodeFields(edmEntityType, tree, entity);
-
- assertJsonNodeIsEmpty(tree);
-
- return entity;
- }
-
- /**
- * Consume all remaining fields of Json ObjectNode and try to map found values
- * to according Entity fields and omit to be ignored OData fields (e.g. control information).
- *
- * @param edmEntityType edm entity type which for which the json node is consumed
- * @param node json node which is consumed
- * @param entity entity instance which is filled
- * @throws DeserializerException if an exception during consummation occurs
- */
- private void consumeRemainingJsonNodeFields(final EdmEntityType edmEntityType, final ObjectNode node,
- final EntityImpl
- entity) throws DeserializerException {
- final List<String> toRemove = new ArrayList<String>();
- Iterator<Entry<String, JsonNode>> fieldsIterator = node.fields();
- while (fieldsIterator.hasNext()) {
- Entry<String, JsonNode> field = fieldsIterator.next();
-
- if (field.getKey().contains(Constants.JSON_BIND_LINK_SUFFIX)) {
- Link bindingLink = consumeBindingLink(field.getKey(), field.getValue(), edmEntityType);
- entity.getNavigationBindings().add(bindingLink);
- toRemove.add(field.getKey());
- } else if (field.getKey().contains(ODATA_CONTROL_INFORMATION_PREFIX)) {
- // Control Information is ignored for requests as per specification chapter "4.5 Control Information"
- toRemove.add(field.getKey());
- } else if (field.getKey().contains(ODATA_ANNOTATION_MARKER)) {
- throw new DeserializerException("Custom annotation with field name: " + field.getKey() + " not supported",
- DeserializerException.MessageKeys.NOT_IMPLEMENTED);
- }
- }
- // remove here to avoid iterator issues.
- node.remove(toRemove);
- }
-
- private void consumeEntityProperties(final EdmEntityType edmEntityType, final ObjectNode node, final EntityImpl
- entity) throws DeserializerException {
- List<String> propertyNames = edmEntityType.getPropertyNames();
- for (String propertyName : propertyNames) {
- JsonNode jsonNode = node.get(propertyName);
- if (jsonNode != null) {
- EdmProperty edmProperty = (EdmProperty) edmEntityType.getProperty(propertyName);
- if (jsonNode.isNull() && !isNullable(edmProperty)) {
- throw new DeserializerException("Property: " + propertyName + " must not be null.",
- DeserializerException.MessageKeys.INVALID_NULL_PROPERTY, propertyName);
- }
- Property property = consumePropertyNode(edmProperty, jsonNode);
- entity.addProperty(property);
- node.remove(propertyName);
- }
- }
- }
-
- private void consumeExpandedNavigationProperties(final EdmEntityType edmEntityType, final ObjectNode node,
- final EntityImpl entity) throws DeserializerException {
- List<String> navigationPropertyNames = edmEntityType.getNavigationPropertyNames();
- for (String navigationPropertyName : navigationPropertyNames) {
- // read expanded navigation property
- JsonNode jsonNode = node.get(navigationPropertyName);
- if (jsonNode != null) {
- EdmNavigationProperty edmNavigationProperty = edmEntityType.getNavigationProperty(navigationPropertyName);
- boolean isNullable = edmNavigationProperty.isNullable() == null ? true : edmNavigationProperty.isNullable();
- if (jsonNode.isNull() && !isNullable) {
- throw new DeserializerException("Property: " + navigationPropertyName + " must not be null.",
- DeserializerException.MessageKeys.INVALID_NULL_PROPERTY, navigationPropertyName);
- }
-
- LinkImpl link = new LinkImpl();
- link.setTitle(navigationPropertyName);
- if (jsonNode.isArray() && edmNavigationProperty.isCollection()) {
- link.setType(ODataLinkType.ENTITY_SET_NAVIGATION.toString());
- EntitySetImpl inlineEntitySet = new EntitySetImpl();
- inlineEntitySet.getEntities().addAll(consumeEntitySetArray(edmNavigationProperty.getType(), jsonNode));
- link.setInlineEntitySet(inlineEntitySet);
- } else if (!jsonNode.isArray() && !jsonNode.isValueNode() && !edmNavigationProperty.isCollection()) {
- link.setType(ODataLinkType.ENTITY_NAVIGATION.toString());
- if (!jsonNode.isNull()) {
- Entity inlineEntity = consumeEntityNode(edmNavigationProperty.getType(), (ObjectNode) jsonNode);
- link.setInlineEntity(inlineEntity);
- }
- } else {
- throw new DeserializerException("Invalid value: " + jsonNode.getNodeType()
- + " for expanded navigation property: " + navigationPropertyName,
- DeserializerException.MessageKeys.INVALID_VALUE_FOR_NAVIGATION_PROPERTY, navigationPropertyName);
- }
- entity.getNavigationLinks().add(link);
- node.remove(navigationPropertyName);
- }
- }
- }
-
- private Link consumeBindingLink(String key, JsonNode jsonNode, EdmEntityType edmEntityType)
- throws DeserializerException {
- String[] splitKey = key.split("@");
- String navigationPropertyName = splitKey[0];
- EdmNavigationProperty edmNavigationProperty = edmEntityType.getNavigationProperty(navigationPropertyName);
- if (edmNavigationProperty == null) {
- throw new DeserializerException("Invalid navigationPropertyName: " + navigationPropertyName,
- DeserializerException.MessageKeys.NAVIGATION_PROPERTY_NOT_FOUND, navigationPropertyName);
- }
- LinkImpl bindingLink = new LinkImpl();
- bindingLink.setTitle(navigationPropertyName);
-
- if (edmNavigationProperty.isCollection()) {
- assertIsNullNode(key, jsonNode);
- if (!jsonNode.isArray()) {
- throw new DeserializerException("Binding annotation: " + key + " must be an array.",
- DeserializerException.MessageKeys.INVALID_ANNOTATION_TYPE, key);
- }
- List<String> bindingLinkStrings = new ArrayList<String>();
- for (JsonNode arrayValue : jsonNode) {
- assertIsNullNode(key, arrayValue);
- if (!arrayValue.isTextual()) {
- throw new DeserializerException("Binding annotation: " + key + " must have string valued array.",
- DeserializerException.MessageKeys.INVALID_ANNOTATION_TYPE, key);
- }
- bindingLinkStrings.add(arrayValue.asText());
- }
- bindingLink.setType(ODataLinkType.ENTITY_COLLECTION_BINDING.toString());
- bindingLink.setBindingLinks(bindingLinkStrings);
- } else {
- assertIsNullNode(key, jsonNode);
- if (!jsonNode.isValueNode()) {
- throw new DeserializerException("Binding annotation: " + key + " must be a string value.",
- DeserializerException.MessageKeys.INVALID_ANNOTATION_TYPE, key);
- }
- bindingLink.setBindingLink(jsonNode.asText());
- bindingLink.setType(ODataLinkType.ENTITY_BINDING.toString());
- }
- return bindingLink;
- }
-
- private void assertIsNullNode(String key, JsonNode jsonNode) throws DeserializerException {
- if (jsonNode.isNull()) {
- throw new DeserializerException("Annotation: " + key + "must not have a null value.",
- DeserializerException.MessageKeys.INVALID_NULL_ANNOTATION, key);
- }
- }
-
- private Property consumePropertyNode(final EdmProperty edmProperty, final JsonNode jsonNode)
- throws DeserializerException {
- Property property = new PropertyImpl();
- property.setName(edmProperty.getName());
- property.setType(edmProperty.getType().getFullQualifiedName().getFullQualifiedNameAsString());
- if (edmProperty.isCollection()) {
- consumePropertyCollectionNode(edmProperty, jsonNode, property);
- } else {
- consumePropertySingleNode(edmProperty, jsonNode, property);
- }
- return property;
- }
-
- private void consumePropertySingleNode(final EdmProperty edmProperty,
- final JsonNode jsonNode, final Property property)
- throws DeserializerException {
- switch (edmProperty.getType().getKind()) {
- case PRIMITIVE:
- Object value = readPrimitiveValue(edmProperty, jsonNode);
- property.setValue(ValueType.PRIMITIVE, value);
- break;
- case DEFINITION:
- value = readTypeDefinitionValue(edmProperty, jsonNode);
- property.setValue(ValueType.PRIMITIVE, value);
- break;
- case ENUM:
- value = readEnumValue(edmProperty, jsonNode);
- property.setValue(ValueType.PRIMITIVE, value);
- break;
- case COMPLEX:
- value = readComplexNode(edmProperty, jsonNode);
- property.setValue(ValueType.COMPLEX, value);
-
- break;
- default:
- throw new DeserializerException("Invalid Type Kind for a property found: " + edmProperty.getType().getKind(),
- DeserializerException.MessageKeys.INVALID_JSON_TYPE_FOR_PROPERTY, edmProperty.getName());
- }
- }
-
- private Object readComplexNode(final EdmProperty edmProperty, final JsonNode jsonNode)
- throws DeserializerException {
- // read and add all complex properties
- Object value = readComplexValue(edmProperty, jsonNode);
-
- final List<String> toRemove = new ArrayList<String>();
- Iterator<Entry<String, JsonNode>> fieldsIterator = jsonNode.fields();
- while (fieldsIterator.hasNext()) {
- Entry<String, JsonNode> field = fieldsIterator.next();
-
- if (field.getKey().contains(ODATA_CONTROL_INFORMATION_PREFIX)) {
- // Control Information is ignored for requests as per specification chapter "4.5 Control Information"
- toRemove.add(field.getKey());
- } else if (field.getKey().contains(ODATA_ANNOTATION_MARKER)) {
- throw new DeserializerException("Custom annotation with field name: " + field.getKey() + " not supported",
- DeserializerException.MessageKeys.NOT_IMPLEMENTED);
- }
- }
- // remove here to avoid iterator issues.
- if(!jsonNode.isNull()) {
- ((ObjectNode) jsonNode).remove(toRemove);
- }
- // Afterwards the node must be empty
- assertJsonNodeIsEmpty(jsonNode);
-
- return value;
- }
-
- private void consumePropertyCollectionNode(final EdmProperty edmProperty, final JsonNode jsonNode,
- final Property property) throws DeserializerException {
- if (!jsonNode.isArray()) {
- throw new DeserializerException("Value for property: " + edmProperty.getName()
- + " must be an array but is not.", DeserializerException.MessageKeys.INVALID_JSON_TYPE_FOR_PROPERTY,
- edmProperty.getName());
- }
- List<Object> valueArray = new ArrayList<Object>();
- Iterator<JsonNode> iterator = jsonNode.iterator();
- switch (edmProperty.getType().getKind()) {
- case PRIMITIVE:
- while (iterator.hasNext()) {
- JsonNode arrayElement = iterator.next();
- Object value = readPrimitiveValue(edmProperty, arrayElement);
- valueArray.add(value);
- }
- property.setValue(ValueType.COLLECTION_PRIMITIVE, valueArray);
- break;
- case DEFINITION:
- while (iterator.hasNext()) {
- JsonNode arrayElement = iterator.next();
- Object value = readTypeDefinitionValue(edmProperty, arrayElement);
- valueArray.add(value);
- }
- property.setValue(ValueType.COLLECTION_PRIMITIVE, valueArray);
- break;
- case ENUM:
- while (iterator.hasNext()) {
- JsonNode arrayElement = iterator.next();
- Object value = readEnumValue(edmProperty, arrayElement);
- valueArray.add(value);
- }
- property.setValue(ValueType.COLLECTION_ENUM, valueArray);
- break;
- case COMPLEX:
- while (iterator.hasNext()) {
- // read and add all complex properties
- Object value = readComplexNode(edmProperty, iterator.next());
- valueArray.add(value);
- }
- property.setValue(ValueType.COLLECTION_COMPLEX, valueArray);
- break;
- default:
- throw new DeserializerException("Invalid Type Kind for a property found: " + edmProperty.getType().getKind(),
- DeserializerException.MessageKeys.INVALID_JSON_TYPE_FOR_PROPERTY, edmProperty.getName());
- }
- }
-
- private Object readComplexValue(EdmProperty edmComplexProperty, JsonNode jsonNode) throws DeserializerException {
- if(isValidNull(edmComplexProperty, jsonNode)) {
- return null;
- }
- if (jsonNode.isArray() || !jsonNode.isContainerNode()) {
- throw new DeserializerException(
- "Invalid value for property: " + edmComplexProperty.getName() + " must not be an array or primitive value.",
- DeserializerException.MessageKeys.INVALID_JSON_TYPE_FOR_PROPERTY, edmComplexProperty.getName());
- }
- // Even if there are no properties defined we have to give back an empty list
- List<Property> propertyList = new ArrayList<Property>();
- EdmComplexType edmType = (EdmComplexType) edmComplexProperty.getType();
- // Check and consume all Properties
- for (String propertyName : edmType.getPropertyNames()) {
- JsonNode subNode = jsonNode.get(propertyName);
- if (subNode != null) {
- EdmProperty edmProperty = (EdmProperty) edmType.getProperty(propertyName);
- if (subNode.isNull() && !isNullable(edmProperty)) {
- throw new DeserializerException("Property: " + propertyName + " must not be null.",
- DeserializerException.MessageKeys.INVALID_NULL_PROPERTY, propertyName);
- }
- Property property = consumePropertyNode(edmProperty, subNode);
- propertyList.add(property);
- ((ObjectNode) jsonNode).remove(propertyName);
- }
- }
- return propertyList;
- }
-
- private boolean isNullable(EdmProperty edmProperty) {
- return edmProperty.isNullable() == null ? true : edmProperty.isNullable();
- }
-
- private Object readTypeDefinitionValue(EdmProperty edmProperty, JsonNode jsonNode) throws DeserializerException {
- checkForValueNode(edmProperty, jsonNode);
- if(isValidNull(edmProperty, jsonNode)) {
- return null;
- }
- try {
- EdmTypeDefinition edmTypeDefinition = (EdmTypeDefinition) edmProperty.getType();
- checkJsonTypeBasedOnPrimitiveType(edmProperty.getName(), edmTypeDefinition.getUnderlyingType().getName(),
- jsonNode);
- return edmTypeDefinition.valueOfString(jsonNode.asText(), edmProperty.isNullable(),
- edmTypeDefinition.getMaxLength(),
- edmTypeDefinition.getPrecision(), edmTypeDefinition.getScale(), edmTypeDefinition.isUnicode(),
- edmTypeDefinition.getDefaultType());
- } catch (EdmPrimitiveTypeException e) {
- throw new DeserializerException(
- "Invalid value: " + jsonNode.asText() + " for property: " + edmProperty.getName(), e,
- DeserializerException.MessageKeys.INVALID_VALUE_FOR_PROPERTY, edmProperty.getName());
- }
- }
-
- private boolean isValidNull(EdmProperty edmProperty, JsonNode jsonNode) throws DeserializerException {
- if (jsonNode.isNull()) {
- if (isNullable(edmProperty)) {
- return true;
- } else {
- throw new DeserializerException("Property: " + edmProperty.getName() + " must not be null.",
- DeserializerException.MessageKeys.INVALID_NULL_PROPERTY, edmProperty.getName());
- }
-
- }
- return false;
- }
-
- private Object readEnumValue(EdmProperty edmProperty, JsonNode jsonNode) throws DeserializerException {
- checkForValueNode(edmProperty, jsonNode);
- if(isValidNull(edmProperty, jsonNode)) {
- return null;
- }
- try {
- EdmEnumType edmEnumType = (EdmEnumType) edmProperty.getType();
- checkJsonTypeBasedOnPrimitiveType(edmProperty.getName(), edmEnumType.getUnderlyingType().getName(), jsonNode);
- return edmEnumType
- .valueOfString(jsonNode.asText(), edmProperty.isNullable(), edmProperty.getMaxLength(), edmProperty
- .getPrecision(), edmProperty.getScale(), edmProperty.isUnicode(), edmEnumType.getDefaultType());
- } catch (EdmPrimitiveTypeException e) {
- throw new DeserializerException(
- "Invalid value: " + jsonNode.asText() + " for property: " + edmProperty.getName(), e,
- DeserializerException.MessageKeys.INVALID_VALUE_FOR_PROPERTY, edmProperty.getName());
- }
- }
-
- private Object readPrimitiveValue(EdmProperty edmProperty, JsonNode jsonNode) throws DeserializerException {
- checkForValueNode(edmProperty, jsonNode);
- if(isValidNull(edmProperty, jsonNode)) {
- return null;
- }
- try {
- EdmPrimitiveType edmPrimitiveType = (EdmPrimitiveType) edmProperty.getType();
- checkJsonTypeBasedOnPrimitiveType(edmProperty.getName(), edmPrimitiveType.getName(), jsonNode);
- return edmPrimitiveType.valueOfString(jsonNode.asText(), edmProperty.isNullable(),
- edmProperty.getMaxLength(), edmProperty.getPrecision(), edmProperty.getScale(),
- edmProperty.isUnicode(), edmPrimitiveType.getDefaultType());
- } catch (EdmPrimitiveTypeException e) {
- throw new DeserializerException(
- "Invalid value: " + jsonNode.asText() + " for property: " + edmProperty.getName(), e,
- DeserializerException.MessageKeys.INVALID_VALUE_FOR_PROPERTY, edmProperty.getName());
- }
- }
-
- /**
- * Check if JsonNode is a value node (<code>jsonNode.isValueNode()</code>) and if not throw
- * an DeserializerException.
- *
- * @param edmProperty property which is checked
- * @param jsonNode node which is checked
- * @throws DeserializerException is thrown if json node is not a value node
- */
- private void checkForValueNode(final EdmProperty edmProperty, final JsonNode jsonNode)
- throws DeserializerException {
- if (!jsonNode.isValueNode()) {
- throw new DeserializerException(
- "Invalid value for property: " + edmProperty.getName() + " must not be an object or array.",
- DeserializerException.MessageKeys.INVALID_JSON_TYPE_FOR_PROPERTY, edmProperty.getName());
- }
- }
-
- /**
- * Validate that node is empty (<code>node.size == 0</code>) and if not throw
- * an <code>DeserializerException</code>.
- *
- * @param node node to be checked
- * @throws DeserializerException if node is not empty
- */
- private void assertJsonNodeIsEmpty(JsonNode node) throws DeserializerException {
- if (node.size() != 0) {
- final String unknownField = node.fieldNames().next();
- throw new DeserializerException("Tree should be empty but still has content left: " + unknownField,
- DeserializerException.MessageKeys.UNKOWN_CONTENT, unknownField);
- }
- }
-
- private void checkJsonTypeBasedOnPrimitiveType(String propertyName, String edmPrimitiveTypeName, JsonNode jsonNode)
- throws DeserializerException {
- EdmPrimitiveTypeKind primKind;
- try {
- primKind = EdmPrimitiveTypeKind.valueOf(ODataServiceVersion.V40, edmPrimitiveTypeName);
- } catch (IllegalArgumentException e) {
- throw new DeserializerException("Unknown Primitive Type: " + edmPrimitiveTypeName, e,
- DeserializerException.MessageKeys.UNKNOWN_PRIMITIVE_TYPE, edmPrimitiveTypeName, propertyName);
- }
- switch (primKind) {
- // Booleans
- case Boolean:
- if (!jsonNode.isBoolean()) {
- throw new DeserializerException("Invalid json type: " + jsonNode.getNodeType() + " for edm " + primKind
- + " property: " + propertyName, DeserializerException.MessageKeys.INVALID_VALUE_FOR_PROPERTY, propertyName);
- }
- break;
- // Numbers
- case Int16:
- case Int32:
- case Int64:
- case Byte:
- case SByte:
- case Single:
- case Double:
- case Decimal:
- if (!jsonNode.isNumber()) {
- throw new DeserializerException("Invalid json type: " + jsonNode.getNodeType() + " for edm " + primKind
- + " property: " + propertyName, DeserializerException.MessageKeys.INVALID_VALUE_FOR_PROPERTY, propertyName);
- }
- break;
- // Strings
- case String:
- case Binary:
- case Date:
- case DateTimeOffset:
- case Duration:
- case Guid:
- case TimeOfDay:
- if (!jsonNode.isTextual()) {
- throw new DeserializerException("Invalid json type: " + jsonNode.getNodeType() + " for edm " + primKind
- + " property: " + propertyName, DeserializerException.MessageKeys.INVALID_VALUE_FOR_PROPERTY, propertyName);
- }
- break;
- default:
- throw new DeserializerException("Unsupported Edm Primitive Type: " + primKind,
- DeserializerException.MessageKeys.NOT_IMPLEMENTED);
- }
- }
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmActionImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmActionImpl.java
deleted file mode 100644
index e96e165..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmActionImpl.java
+++ /dev/null
@@ -1,36 +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.edm.provider;
-
-import org.apache.olingo.commons.api.edm.Edm;
-import org.apache.olingo.commons.api.edm.EdmAction;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
-import org.apache.olingo.server.api.edm.provider.Action;
-
-public class EdmActionImpl extends EdmOperationImpl implements EdmAction {
-
- public static EdmActionImpl getInstance(final Edm edm, final FullQualifiedName name, final Action action) {
- return EdmOperationImpl.getInstance(new EdmActionImpl(edm, name, action));
- }
-
- private EdmActionImpl(final Edm edm, final FullQualifiedName name, final Action action) {
- super(edm, name, action, EdmTypeKind.ACTION);
- }
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmActionImportImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmActionImportImpl.java
deleted file mode 100644
index 0278f6b..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmActionImportImpl.java
+++ /dev/null
@@ -1,47 +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.edm.provider;
-
-import org.apache.olingo.commons.api.edm.Edm;
-import org.apache.olingo.commons.api.edm.EdmAction;
-import org.apache.olingo.commons.api.edm.EdmActionImport;
-import org.apache.olingo.commons.api.edm.EdmEntityContainer;
-import org.apache.olingo.server.api.edm.provider.ActionImport;
-
-public class EdmActionImportImpl extends EdmOperationImportImpl implements EdmActionImport {
-
- private final ActionImport actionImport;
-
- public EdmActionImportImpl(final Edm edm, final EdmEntityContainer container, final ActionImport actionImport) {
-
- super(edm, container, actionImport);
- this.actionImport = actionImport;
- }
-
- @Override
- public EdmAction getUnboundAction() {
- return edm.getUnboundAction(actionImport.getAction());
- }
-
- @Override
- public TargetType getAnnotationsTargetType() {
- return TargetType.ActionImport;
- }
-
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmBindingTargetImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmBindingTargetImpl.java
deleted file mode 100644
index bd3df0a..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmBindingTargetImpl.java
+++ /dev/null
@@ -1,62 +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.edm.provider;
-
-import org.apache.olingo.commons.api.edm.Edm;
-import org.apache.olingo.commons.api.edm.EdmEntityContainer;
-import org.apache.olingo.commons.api.edm.EdmNavigationPropertyBinding;
-import org.apache.olingo.commons.api.edm.Target;
-import org.apache.olingo.commons.core.edm.AbstractEdmBindingTarget;
-import org.apache.olingo.commons.core.edm.EdmNavigationPropertyBindingImpl;
-import org.apache.olingo.server.api.edm.provider.BindingTarget;
-import org.apache.olingo.server.api.edm.provider.NavigationPropertyBinding;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public abstract class EdmBindingTargetImpl extends AbstractEdmBindingTarget {
-
- private final BindingTarget target;
- private List<EdmNavigationPropertyBinding> navigationPropertyBindings;
-
- public EdmBindingTargetImpl(final Edm edm, final EdmEntityContainer container, final BindingTarget target) {
- super(edm, container, target.getName(), target.getType());
- this.target = target;
- }
-
- @Override
- public List<EdmNavigationPropertyBinding> getNavigationPropertyBindings() {
- if (navigationPropertyBindings == null) {
- List<NavigationPropertyBinding> providerBindings = target.getNavigationPropertyBindings();
- navigationPropertyBindings = new ArrayList<EdmNavigationPropertyBinding>();
- if (providerBindings != null) {
- for (NavigationPropertyBinding binding : providerBindings) {
- Target providerTarget = binding.getTarget();
- String targetString = "";
- if (providerTarget.getEntityContainer() != null) {
- targetString = targetString + providerTarget.getEntityContainer().getFullQualifiedNameAsString() + "/";
- }
- targetString = targetString + providerTarget.getTargetName();
- navigationPropertyBindings.add(new EdmNavigationPropertyBindingImpl(binding.getPath(), targetString));
- }
- }
- }
- return navigationPropertyBindings;
- }
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmComplexTypeImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmComplexTypeImpl.java
deleted file mode 100644
index 36c5193..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmComplexTypeImpl.java
+++ /dev/null
@@ -1,81 +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.edm.provider;
-
-import org.apache.olingo.commons.api.edm.Edm;
-import org.apache.olingo.commons.api.edm.EdmAnnotation;
-import org.apache.olingo.commons.api.edm.EdmNavigationProperty;
-import org.apache.olingo.commons.api.edm.EdmProperty;
-import org.apache.olingo.commons.api.edm.EdmTerm;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.core.edm.AbstractEdmComplexType;
-import org.apache.olingo.commons.core.edm.EdmStructuredTypeHelper;
-import org.apache.olingo.server.api.edm.provider.ComplexType;
-
-import java.util.List;
-import java.util.Map;
-
-public class EdmComplexTypeImpl extends AbstractEdmComplexType {
-
- private final EdmStructuredTypeHelper helper;
-
- public static EdmComplexTypeImpl getInstance(
- final Edm edm, final FullQualifiedName name, final ComplexType complexType) {
-
- final EdmComplexTypeImpl instance = new EdmComplexTypeImpl(edm, name, complexType);
- return instance;
- }
-
- private EdmComplexTypeImpl(final Edm edm, final FullQualifiedName name, final ComplexType complexType) {
- super(edm, name, complexType.getBaseType());
- helper = new EdmStructuredTypeHelperImpl(edm, name, complexType);
- }
-
- @Override
- protected Map<String, EdmProperty> getProperties() {
- return helper.getProperties();
- }
-
- @Override
- protected Map<String, EdmNavigationProperty> getNavigationProperties() {
- return helper.getNavigationProperties();
- }
-
- @Override
- public boolean isOpenType() {
- return helper.isOpenType();
- }
-
- @Override
- public boolean isAbstract() {
- return helper.isAbstract();
- }
-
- @Override
- public EdmAnnotation getAnnotation(final EdmTerm term) {
- // TODO: implement
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- @Override
- public List<EdmAnnotation> getAnnotations() {
- // TODO: implement
- throw new UnsupportedOperationException("Not supported yet.");
- }
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmEntityContainerImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmEntityContainerImpl.java
deleted file mode 100644
index 1ed8d56..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmEntityContainerImpl.java
+++ /dev/null
@@ -1,210 +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.edm.provider;
-
-import org.apache.olingo.commons.api.ODataException;
-import org.apache.olingo.commons.api.edm.Edm;
-import org.apache.olingo.commons.api.edm.EdmActionImport;
-import org.apache.olingo.commons.api.edm.EdmAnnotation;
-import org.apache.olingo.commons.api.edm.EdmEntitySet;
-import org.apache.olingo.commons.api.edm.EdmException;
-import org.apache.olingo.commons.api.edm.EdmFunctionImport;
-import org.apache.olingo.commons.api.edm.EdmSingleton;
-import org.apache.olingo.commons.api.edm.EdmTerm;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.core.edm.AbstractEdmEntityContainer;
-import org.apache.olingo.server.api.edm.provider.ActionImport;
-import org.apache.olingo.server.api.edm.provider.EdmProvider;
-import org.apache.olingo.server.api.edm.provider.EntityContainer;
-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.FunctionImport;
-import org.apache.olingo.server.api.edm.provider.Singleton;
-
-import java.util.List;
-
-public class EdmEntityContainerImpl extends AbstractEdmEntityContainer {
-
- private final EdmProvider provider;
-
- private EntityContainer container;
-
- public EdmEntityContainerImpl(final Edm edm, final EdmProvider provider,
- final EntityContainerInfo entityContainerInfo) {
- super(edm, entityContainerInfo.getContainerName(), entityContainerInfo.getExtendsContainer());
- this.provider = provider;
- }
-
- public EdmEntityContainerImpl(final Edm edm, final EdmProvider provider, final FullQualifiedName containerFQN,
- final EntityContainer entityContainer) {
- super(edm, containerFQN, entityContainer.getExtendsContainer());
- this.provider = provider;
- container = entityContainer;
- }
-
- @Override
- protected EdmSingleton createSingleton(final String singletonName) {
- EdmSingleton singleton = null;
-
- try {
- final Singleton providerSingleton = provider.getSingleton(entityContainerName, singletonName);
- if (providerSingleton != null) {
- singleton = new EdmSingletonImpl(edm, this, providerSingleton);
- }
- } catch (ODataException e) {
- throw new EdmException(e);
- }
-
- return singleton;
- }
-
- @Override
- protected EdmEntitySet createEntitySet(final String entitySetName) {
- EdmEntitySet entitySet = null;
-
- try {
- final EntitySet providerEntitySet = provider.getEntitySet(entityContainerName, entitySetName);
- if (providerEntitySet != null) {
- entitySet = new EdmEntitySetImpl(edm, this, providerEntitySet);
- }
- } catch (ODataException e) {
- throw new EdmException(e);
- }
-
- return entitySet;
- }
-
- @Override
- protected EdmActionImport createActionImport(final String actionImportName) {
- EdmActionImport actionImport = null;
-
- try {
- final ActionImport providerImport = provider.getActionImport(entityContainerName, actionImportName);
- if (providerImport != null) {
- actionImport = new EdmActionImportImpl(edm, this, providerImport);
- }
- } catch (ODataException e) {
- throw new EdmException(e);
- }
-
- return actionImport;
- }
-
- @Override
- protected EdmFunctionImport createFunctionImport(final String functionImportName) {
- EdmFunctionImport functionImport = null;
-
- try {
- final FunctionImport providerImport = provider.getFunctionImport(entityContainerName, functionImportName);
- if (providerImport != null) {
- functionImport = new EdmFunctionImportImpl(edm, this, providerImport);
- }
- } catch (ODataException e) {
- throw new EdmException(e);
- }
-
- return functionImport;
- }
-
- @Override
- protected void loadAllEntitySets() {
- loadContainer();
- List<EntitySet> providerEntitySets = container.getEntitySets();
- if (providerEntitySets != null) {
- for (EntitySet entitySet : providerEntitySets) {
- if (!entitySets.containsKey(entitySet.getName())) {
- EdmEntitySetImpl impl = new EdmEntitySetImpl(edm, this, entitySet);
- entitySets.put(impl.getName(), impl);
- }
- }
- }
- }
-
- @Override
- protected void loadAllFunctionImports() {
- loadContainer();
- List<FunctionImport> providerFuctionImports = container.getFunctionImports();
- if (providerFuctionImports != null) {
- for (FunctionImport functionImport : providerFuctionImports) {
- String functionName = functionImport.getName();
- if (!functionImports.containsKey(functionName)) {
- EdmFunctionImportImpl impl = new EdmFunctionImportImpl(edm, this, functionImport);
- functionImports.put(functionName, impl);
- }
- }
- }
-
- }
-
- @Override
- protected void loadAllSingletons() {
- loadContainer();
- List<Singleton> providerSingletons = container.getSingletons();
- if (providerSingletons != null) {
- for (Singleton singleton : providerSingletons) {
- if (!singletons.containsKey(singleton.getName())) {
- EdmSingletonImpl impl = new EdmSingletonImpl(edm, this, singleton);
- singletons.put(singleton.getName(), impl);
- }
- }
- }
-
- }
-
- @Override
- protected void loadAllActionImports() {
- loadContainer();
- List<ActionImport> providerActionImports = container.getActionImports();
- if (providerActionImports != null) {
- for (ActionImport actionImport : providerActionImports) {
- if (!actionImports.containsKey(actionImport.getName())) {
- EdmActionImportImpl impl = new EdmActionImportImpl(edm, this, actionImport);
- actionImports.put(actionImport.getName(), impl);
- }
- }
- }
-
- }
-
- private void loadContainer() {
- if (container == null) {
- try {
- container = provider.getEntityContainer();
- if (container == null) {
- // TODO: Should we throw an exception here?
- container = new EntityContainer().setName(getName());
- }
- } catch (ODataException e) {
- throw new EdmException(e);
- }
- }
- }
-
- @Override
- public EdmAnnotation getAnnotation(final EdmTerm term) {
- // TODO: implement
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- @Override
- public List<EdmAnnotation> getAnnotations() {
- // TODO: implement
- throw new UnsupportedOperationException("Not supported yet.");
- }
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmEntitySetImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmEntitySetImpl.java
deleted file mode 100644
index a2926eb..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmEntitySetImpl.java
+++ /dev/null
@@ -1,60 +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.edm.provider;
-
-import org.apache.olingo.commons.api.edm.Edm;
-import org.apache.olingo.commons.api.edm.EdmAnnotation;
-import org.apache.olingo.commons.api.edm.EdmEntityContainer;
-import org.apache.olingo.commons.api.edm.EdmEntitySet;
-import org.apache.olingo.commons.api.edm.EdmTerm;
-import org.apache.olingo.server.api.edm.provider.EntitySet;
-
-import java.util.List;
-
-public class EdmEntitySetImpl extends EdmBindingTargetImpl implements EdmEntitySet {
-
- private EntitySet entitySet;
-
- public EdmEntitySetImpl(final Edm edm, final EdmEntityContainer container, final EntitySet entitySet) {
- super(edm, container, entitySet);
- this.entitySet = entitySet;
- }
-
- @Override
- public boolean isIncludeInServiceDocument() {
- return entitySet.isIncludeInServiceDocument();
- }
-
- @Override
- public TargetType getAnnotationsTargetType() {
- return TargetType.EntitySet;
- }
-
- @Override
- public EdmAnnotation getAnnotation(final EdmTerm term) {
- // TODO: implement
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- @Override
- public List<EdmAnnotation> getAnnotations() {
- // TODO: implement
- throw new UnsupportedOperationException("Not supported yet.");
- }
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmEntityTypeImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmEntityTypeImpl.java
deleted file mode 100644
index 4dff2ba..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmEntityTypeImpl.java
+++ /dev/null
@@ -1,112 +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.edm.provider;
-
-import org.apache.olingo.commons.api.edm.Edm;
-import org.apache.olingo.commons.api.edm.EdmAnnotation;
-import org.apache.olingo.commons.api.edm.EdmEntityType;
-import org.apache.olingo.commons.api.edm.EdmKeyPropertyRef;
-import org.apache.olingo.commons.api.edm.EdmNavigationProperty;
-import org.apache.olingo.commons.api.edm.EdmProperty;
-import org.apache.olingo.commons.api.edm.EdmTerm;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.core.edm.AbstractEdmEntityType;
-import org.apache.olingo.commons.core.edm.EdmStructuredTypeHelper;
-import org.apache.olingo.server.api.edm.provider.EntityType;
-import org.apache.olingo.server.api.edm.provider.PropertyRef;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-public class EdmEntityTypeImpl extends AbstractEdmEntityType {
-
- private final EdmStructuredTypeHelper helper;
-
- private EntityType entityType;
-
- private boolean baseTypeChecked = false;
-
- public static EdmEntityTypeImpl getInstance(final Edm edm, final FullQualifiedName name,
- final EntityType entityType) {
-
- final EdmEntityTypeImpl instance = new EdmEntityTypeImpl(edm, name, entityType);
- return instance;
- }
-
- private EdmEntityTypeImpl(final Edm edm, final FullQualifiedName name, final EntityType entityType) {
- super(edm, name, entityType.getBaseType(), entityType.hasStream());
- this.entityType = entityType;
- helper = new EdmStructuredTypeHelperImpl(edm, name, entityType);
- }
-
- @Override
- protected Map<String, EdmProperty> getProperties() {
- return helper.getProperties();
- }
-
- @Override
- protected Map<String, EdmNavigationProperty> getNavigationProperties() {
- return helper.getNavigationProperties();
- }
-
- @Override
- protected void checkBaseType() {
- if (!baseTypeChecked) {
- if (baseTypeName != null) {
- baseType = buildBaseType(baseTypeName);
- entityBaseType = (EdmEntityType) baseType;
- }
- if (baseType == null
- || (baseType.isAbstract() && ((AbstractEdmEntityType) baseType).getKeyPropertyRefs().size() == 0)) {
- final List<PropertyRef> key = entityType.getKey();
- if (key != null) {
- final List<EdmKeyPropertyRef> edmKey = new ArrayList<EdmKeyPropertyRef>();
- for (PropertyRef ref : key) {
- edmKey.add(new EdmKeyPropertyRefImpl(this, ref));
- }
- setEdmKeyPropertyRef(edmKey);
- }
- }
- baseTypeChecked = true;
- }
- }
-
- @Override
- public boolean isOpenType() {
- return helper.isOpenType();
- }
-
- @Override
- public boolean isAbstract() {
- return helper.isAbstract();
- }
-
- @Override
- public EdmAnnotation getAnnotation(final EdmTerm term) {
- // TODO: implement
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- @Override
- public List<EdmAnnotation> getAnnotations() {
- // TODO: implement
- throw new UnsupportedOperationException("Not supported yet.");
- }
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmEnumTypeImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmEnumTypeImpl.java
deleted file mode 100644
index ac1c83d..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmEnumTypeImpl.java
+++ /dev/null
@@ -1,72 +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.edm.provider;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.olingo.commons.api.edm.Edm;
-import org.apache.olingo.commons.api.edm.EdmMember;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.core.edm.AbstractEdmEnumType;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
-import org.apache.olingo.server.api.edm.provider.EnumMember;
-import org.apache.olingo.server.api.edm.provider.EnumType;
-
-public class EdmEnumTypeImpl extends AbstractEdmEnumType {
-
- private final EdmPrimitiveType underlyingType;
-
- private final EnumType enumType;
-
- private List<EdmMember> members;
-
- public EdmEnumTypeImpl(final Edm edm, final FullQualifiedName enumName, final EnumType enumType) {
- super(edm, enumName, enumType.isFlags());
-
- if (enumType.getUnderlyingType() == null) {
- underlyingType = EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Int32);
- } else {
- underlyingType = EdmPrimitiveTypeFactory.getInstance(
- EdmPrimitiveTypeKind.valueOf(enumType.getUnderlyingType().getName()));
- // TODO: Should we validate that the underlying type is of byte, sbyte, in16, int32 or int64?
- }
-
- this.enumType = enumType;
- }
-
- @Override
- public EdmPrimitiveType getUnderlyingType() {
- return underlyingType;
- }
-
- @Override
- protected List<? extends EdmMember> getMembers() {
- if (members == null) {
- members = new ArrayList<EdmMember>(enumType.getMembers().size());
- for (EnumMember member : enumType.getMembers()) {
- members.add(new EdmMemberImpl(edm, getFullQualifiedName(), member.getName(), member.getValue()));
- }
- }
- return members;
- }
-
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmFunctionImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmFunctionImpl.java
deleted file mode 100644
index f23e0a8..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmFunctionImpl.java
+++ /dev/null
@@ -1,56 +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.edm.provider;
-
-import org.apache.olingo.commons.api.edm.Edm;
-import org.apache.olingo.commons.api.edm.EdmException;
-import org.apache.olingo.commons.api.edm.EdmFunction;
-import org.apache.olingo.commons.api.edm.EdmReturnType;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
-import org.apache.olingo.server.api.edm.provider.Function;
-
-public class EdmFunctionImpl extends EdmOperationImpl implements EdmFunction {
-
- private final Function function;
-
- public static EdmFunctionImpl getInstance(final Edm edm, final FullQualifiedName name, final Function function) {
- return EdmOperationImpl.getInstance(new EdmFunctionImpl(edm, name, function));
- }
-
- private EdmFunctionImpl(final Edm edm, final FullQualifiedName name, final Function function) {
- super(edm, name, function, EdmTypeKind.FUNCTION);
- this.function = function;
- }
-
- @Override
- public boolean isComposable() {
- return function.isComposable();
- }
-
- @Override
- public EdmReturnType getReturnType() {
- final EdmReturnType returnType = super.getReturnType();
- if (returnType == null) {
- throw new EdmException("ReturnType for a function must not be null");
- }
- return returnType;
- }
-
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmFunctionImportImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmFunctionImportImpl.java
deleted file mode 100644
index e07eb9f..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmFunctionImportImpl.java
+++ /dev/null
@@ -1,71 +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.edm.provider;
-
-import org.apache.olingo.commons.api.edm.Edm;
-import org.apache.olingo.commons.api.edm.EdmAnnotation;
-import org.apache.olingo.commons.api.edm.EdmEntityContainer;
-import org.apache.olingo.commons.api.edm.EdmFunction;
-import org.apache.olingo.commons.api.edm.EdmFunctionImport;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.server.api.edm.provider.FunctionImport;
-
-import java.util.List;
-
-public class EdmFunctionImportImpl extends EdmOperationImportImpl implements EdmFunctionImport {
-
- private final FunctionImport functionImport;
-
- public EdmFunctionImportImpl(final Edm edm, final EdmEntityContainer container, final FunctionImport functionImport) {
-
- super(edm, container, functionImport);
- this.functionImport = functionImport;
- }
-
- @Override
- public FullQualifiedName getFunctionFqn() {
- return functionImport.getFunction();
- }
-
- @Override
- public EdmFunction getUnboundFunction(final List<String> parameterNames) {
- return edm.getUnboundFunction(getFunctionFqn(), parameterNames);
- }
-
- @Override
- public List<EdmFunction> getUnboundFunctions() {
- return edm.getUnboundFunctions(getFunctionFqn());
- }
-
- @Override
- public boolean isIncludeInServiceDocument() {
- return functionImport.isIncludeInServiceDocument();
- }
-
- @Override
- public TargetType getAnnotationsTargetType() {
- return TargetType.FunctionImport;
- }
-
- @Override
- public List<EdmAnnotation> getAnnotations() {
- // TODO: implement
- throw new UnsupportedOperationException("Not supported yet.");
- }
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmKeyPropertyRefImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmKeyPropertyRefImpl.java
deleted file mode 100644
index 0660ac0..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmKeyPropertyRefImpl.java
+++ /dev/null
@@ -1,48 +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.edm.provider;
-
-import org.apache.olingo.commons.api.edm.EdmEntityType;
-import org.apache.olingo.commons.core.edm.AbstractEdmKeyPropertyRef;
-import org.apache.olingo.server.api.edm.provider.PropertyRef;
-
-public class EdmKeyPropertyRefImpl extends AbstractEdmKeyPropertyRef {
-
- private final PropertyRef ref;
-
- public EdmKeyPropertyRefImpl(final EdmEntityType edmEntityType, final PropertyRef ref) {
- super(edmEntityType);
- this.ref = ref;
- }
-
- @Override
- public String getKeyPropertyName() {
- return ref.getPropertyName();
- }
-
- @Override
- public String getAlias() {
- return ref.getAlias();
- }
-
- @Override
- public String getPath() {
- return ref.getPath();
- }
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmMemberImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmMemberImpl.java
deleted file mode 100644
index 5ffe031..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmMemberImpl.java
+++ /dev/null
@@ -1,47 +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.edm.provider;
-
-import org.apache.olingo.commons.api.edm.Edm;
-import org.apache.olingo.commons.api.edm.EdmAnnotation;
-import org.apache.olingo.commons.api.edm.EdmTerm;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.core.edm.AbstractEdmMember;
-
-import java.util.List;
-
-public class EdmMemberImpl extends AbstractEdmMember {
-
- public EdmMemberImpl(final Edm edm, final FullQualifiedName enumFQN, final String name, final String value) {
- super(edm, enumFQN, name, value);
- }
-
- @Override
- public EdmAnnotation getAnnotation(final EdmTerm term) {
- // TODO: implement
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- @Override
- public List<EdmAnnotation> getAnnotations() {
- // TODO: implement
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmNavigationPropertyImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmNavigationPropertyImpl.java
deleted file mode 100644
index 7562360..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmNavigationPropertyImpl.java
+++ /dev/null
@@ -1,119 +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.edm.provider;
-
-import org.apache.olingo.commons.api.edm.Edm;
-import org.apache.olingo.commons.api.edm.EdmAnnotation;
-import org.apache.olingo.commons.api.edm.EdmReferentialConstraint;
-import org.apache.olingo.commons.api.edm.EdmTerm;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.core.edm.AbstractEdmNavigationProperty;
-import org.apache.olingo.server.api.edm.provider.NavigationProperty;
-import org.apache.olingo.server.api.edm.provider.ReferentialConstraint;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class EdmNavigationPropertyImpl extends AbstractEdmNavigationProperty {
-
- private final FullQualifiedName structuredTypeName;
-
- private final NavigationProperty navigationProperty;
-
- private List<EdmReferentialConstraint> referentialConstraints;
-
- public EdmNavigationPropertyImpl(
- final Edm edm, final FullQualifiedName structuredTypeName, final NavigationProperty navigationProperty) {
-
- super(edm, navigationProperty.getName());
-
- this.structuredTypeName = structuredTypeName;
- this.navigationProperty = navigationProperty;
- }
-
- @Override
- protected FullQualifiedName getTypeFQN() {
- return navigationProperty.getType();
- }
-
- @Override
- public boolean isCollection() {
- return navigationProperty.isCollection();
- }
-
- @Override
- public Boolean isNullable() {
- return navigationProperty.getNullable();
- }
-
- @Override
- public Boolean containsTarget() {
- return navigationProperty.isContainsTarget();
- }
-
- @Override
- protected String internatGetPartner() {
- return navigationProperty.getPartner();
- }
-
- @Override
- public String getReferencingPropertyName(final String referencedPropertyName) {
- final List<ReferentialConstraint> referentialConstraints = navigationProperty.getReferentialConstraints();
- if (referentialConstraints != null) {
- for (ReferentialConstraint constraint : referentialConstraints) {
- if (constraint.getReferencedProperty().equals(referencedPropertyName)) {
- return constraint.getProperty();
- }
- }
- }
- return null;
- }
-
- @Override
- public List<EdmReferentialConstraint> getReferentialConstraints() {
- if (referentialConstraints == null) {
- final List<ReferentialConstraint> providerConstraints = navigationProperty.getReferentialConstraints();
- referentialConstraints = new ArrayList<EdmReferentialConstraint>();
- if (providerConstraints != null) {
- for (ReferentialConstraint constraint : providerConstraints) {
- referentialConstraints.add(
- new EdmReferentialConstraintImpl(constraint.getProperty(), constraint.getReferencedProperty()));
- }
- }
- }
- return referentialConstraints;
- }
-
- @Override
- public FullQualifiedName getAnnotationsTargetFQN() {
- return structuredTypeName;
- }
-
- @Override
- public EdmAnnotation getAnnotation(final EdmTerm term) {
- // TODO: implement
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- @Override
- public List<EdmAnnotation> getAnnotations() {
- // TODO: implement
- throw new UnsupportedOperationException("Not supported yet.");
- }
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmOperationImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmOperationImpl.java
deleted file mode 100644
index 0b5a8f2..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmOperationImpl.java
+++ /dev/null
@@ -1,100 +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.edm.provider;
-
-import org.apache.olingo.commons.api.edm.Edm;
-import org.apache.olingo.commons.api.edm.EdmAnnotation;
-import org.apache.olingo.commons.api.edm.EdmParameter;
-import org.apache.olingo.commons.api.edm.EdmTerm;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
-import org.apache.olingo.commons.core.edm.AbstractEdmOperation;
-import org.apache.olingo.server.api.edm.provider.EntitySetPath;
-import org.apache.olingo.server.api.edm.provider.Operation;
-import org.apache.olingo.server.api.edm.provider.Parameter;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public abstract class EdmOperationImpl extends AbstractEdmOperation {
-
- protected final Operation operation;
-
- protected static <T extends EdmOperationImpl> T getInstance(final T instance) {
- final List<Parameter> providerParameters = instance.operation.getParameters();
- if (providerParameters != null) {
- final List<EdmParameter> _parameters = new ArrayList<EdmParameter>(providerParameters.size());
- for (Parameter parameter : providerParameters) {
- _parameters.add(new EdmParameterImpl(instance.edm, parameter));
- }
- instance.setParameters(_parameters);
- }
-
- final EntitySetPath entitySetPath = instance.operation.getEntitySetPath();
- if (entitySetPath != null && entitySetPath.getPath() != null) {
- instance.setEntitySetPath(entitySetPath.getPath());
- }
-
- instance.setIsBound(instance.operation.isBound());
-
- if (instance.operation.getReturnType() != null) {
- instance.setReturnType(new EdmReturnTypeImpl(instance.edm, instance.operation.getReturnType()));
- }
-
- return instance;
- }
-
- protected EdmOperationImpl(final Edm edm, final FullQualifiedName name, final Operation operation,
- final EdmTypeKind kind) {
-
- super(edm, name, kind);
- this.operation = operation;
- }
-
- @Override
- public FullQualifiedName getBindingParameterTypeFqn() {
- if (isBound()) {
- Parameter bindingParameter = operation.getParameters().get(0);
- return bindingParameter.getType();
- }
- return null;
- }
-
- @Override
- public Boolean isBindingParameterTypeCollection() {
- if (isBound()) {
- Parameter bindingParameter = operation.getParameters().get(0);
- return bindingParameter.isCollection();
- }
- return null;
- }
-
- @Override
- public EdmAnnotation getAnnotation(final EdmTerm term) {
- // TODO: implement
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- @Override
- public List<EdmAnnotation> getAnnotations() {
- // TODO: implement
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmOperationImportImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmOperationImportImpl.java
deleted file mode 100644
index 2cc85d0..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmOperationImportImpl.java
+++ /dev/null
@@ -1,48 +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.edm.provider;
-
-import org.apache.olingo.commons.api.edm.Edm;
-import org.apache.olingo.commons.api.edm.EdmAnnotation;
-import org.apache.olingo.commons.api.edm.EdmEntityContainer;
-import org.apache.olingo.commons.api.edm.EdmTerm;
-import org.apache.olingo.commons.core.edm.AbstractEdmOperationImport;
-import org.apache.olingo.server.api.edm.provider.OperationImport;
-
-import java.util.List;
-
-public abstract class EdmOperationImportImpl extends AbstractEdmOperationImport {
-
- public EdmOperationImportImpl(final Edm edm, final EdmEntityContainer container,
- final OperationImport operationImport) {
- super(edm, container, operationImport.getName(), operationImport.getEntitySet());
- }
-
- @Override
- public EdmAnnotation getAnnotation(final EdmTerm term) {
- // TODO: implement
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- @Override
- public List<EdmAnnotation> getAnnotations() {
- // TODO: implement
- throw new UnsupportedOperationException("Not supported yet.");
- }
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmParameterImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmParameterImpl.java
deleted file mode 100644
index 53b46d2..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmParameterImpl.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.edm.provider;
-
-import org.apache.olingo.commons.api.edm.Edm;
-import org.apache.olingo.commons.api.edm.EdmAnnotation;
-import org.apache.olingo.commons.api.edm.EdmMapping;
-import org.apache.olingo.commons.api.edm.EdmTerm;
-import org.apache.olingo.commons.api.edm.geo.SRID;
-import org.apache.olingo.commons.core.edm.AbstractEdmParameter;
-import org.apache.olingo.server.api.edm.provider.Parameter;
-
-import java.util.List;
-
-public class EdmParameterImpl extends AbstractEdmParameter {
-
- private final Parameter parameter;
-
- public EdmParameterImpl(final Edm edm, final Parameter parameter) {
- super(edm, parameter.getName(), parameter.getType());
- this.parameter = parameter;
- }
-
- @Override
- public boolean isCollection() {
- return parameter.isCollection();
- }
-
- @Override
- public EdmMapping getMapping() {
- return parameter.getMapping();
- }
-
- @Override
- public Boolean isNullable() {
- return parameter.getNullable();
- }
-
- @Override
- public Integer getMaxLength() {
- return parameter.getMaxLength();
- }
-
- @Override
- public Integer getPrecision() {
- return parameter.getPrecision();
- }
-
- @Override
- public Integer getScale() {
- return parameter.getScale();
- }
-
- @Override
- public SRID getSrid() {
- return null; // TODO: provide implementation
- }
-
- @Override
- public EdmAnnotation getAnnotation(final EdmTerm term) {
- // TODO: implement
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- @Override
- public List<EdmAnnotation> getAnnotations() {
- // TODO: implement
- throw new UnsupportedOperationException("Not supported yet.");
- }
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmPropertyImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmPropertyImpl.java
deleted file mode 100644
index 290a952..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmPropertyImpl.java
+++ /dev/null
@@ -1,120 +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.edm.provider;
-
-import java.util.List;
-
-import org.apache.olingo.commons.api.edm.Edm;
-import org.apache.olingo.commons.api.edm.EdmAnnotation;
-import org.apache.olingo.commons.api.edm.EdmMapping;
-import org.apache.olingo.commons.api.edm.EdmTerm;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.api.edm.geo.SRID;
-import org.apache.olingo.commons.core.edm.AbstractEdmProperty;
-import org.apache.olingo.commons.core.edm.EdmTypeInfo;
-import org.apache.olingo.server.api.edm.provider.Property;
-
-public class EdmPropertyImpl extends AbstractEdmProperty {
-
- private final FullQualifiedName structuredTypeName;
-
- private final Property property;
-
- private final EdmTypeInfo typeInfo;
-
- public EdmPropertyImpl(final Edm edm, final FullQualifiedName structuredTypeName, final Property property) {
- super(edm, property.getName());
-
- this.structuredTypeName = structuredTypeName;
- this.property = property;
- typeInfo = new EdmTypeInfo.Builder().setEdm(edm).setTypeExpression(property.getType().toString()).build();
- }
-
- @Override
- public EdmTypeInfo getTypeInfo() {
- return typeInfo;
- }
-
- @Override
- public boolean isCollection() {
- return property.isCollection();
- }
-
- @Override
- public EdmMapping getMapping() {
- return property.getMapping();
- }
-
- @Override
- public String getMimeType() {
- return property.getMimeType();
- }
-
- @Override
- public Boolean isNullable() {
- return property.getNullable();
- }
-
- @Override
- public Integer getMaxLength() {
- return property.getMaxLength();
- }
-
- @Override
- public Integer getPrecision() {
- return property.getPrecision();
- }
-
- @Override
- public Integer getScale() {
- return property.getScale();
- }
-
- @Override
- public SRID getSrid() {
- return null; // TODO: provide implementation
- }
-
- @Override
- public Boolean isUnicode() {
- return property.isUnicode();
- }
-
- @Override
- public String getDefaultValue() {
- return property.getDefaultValue();
- }
-
- @Override
- public FullQualifiedName getAnnotationsTargetFQN() {
- return structuredTypeName;
- }
-
- @Override
- public EdmAnnotation getAnnotation(final EdmTerm term) {
- // TODO: implement
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- @Override
- public List<EdmAnnotation> getAnnotations() {
- // TODO: implement
- throw new UnsupportedOperationException("Not supported yet.");
- }
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmProviderImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmProviderImpl.java
deleted file mode 100644
index baf8093..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmProviderImpl.java
+++ /dev/null
@@ -1,346 +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.edm.provider;
-
-import org.apache.olingo.commons.api.ODataException;
-import org.apache.olingo.commons.api.edm.EdmAction;
-import org.apache.olingo.commons.api.edm.EdmAnnotation;
-import org.apache.olingo.commons.api.edm.EdmAnnotations;
-import org.apache.olingo.commons.api.edm.EdmComplexType;
-import org.apache.olingo.commons.api.edm.EdmEntityContainer;
-import org.apache.olingo.commons.api.edm.EdmEntityType;
-import org.apache.olingo.commons.api.edm.EdmEnumType;
-import org.apache.olingo.commons.api.edm.EdmException;
-import org.apache.olingo.commons.api.edm.EdmFunction;
-import org.apache.olingo.commons.api.edm.EdmSchema;
-import org.apache.olingo.commons.api.edm.EdmTerm;
-import org.apache.olingo.commons.api.edm.EdmTypeDefinition;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.core.edm.AbstractEdm;
-import org.apache.olingo.server.api.edm.provider.Action;
-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.EntityType;
-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.Parameter;
-import org.apache.olingo.server.api.edm.provider.Schema;
-import org.apache.olingo.server.api.edm.provider.TypeDefinition;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-
-public class EdmProviderImpl extends AbstractEdm {
-
- private final EdmProvider provider;
-
- private final Map<FullQualifiedName, List<Action>> actionsMap = new HashMap<FullQualifiedName, List<Action>>();
-
- private final Map<FullQualifiedName, List<Function>> functionsMap = new HashMap<FullQualifiedName, List<Function>>();
-
- public EdmProviderImpl(final EdmProvider provider) {
- this.provider = provider;
-
- }
-
- @Override
- public EdmEntityContainer createEntityContainer(final FullQualifiedName containerName) {
- try {
- EntityContainerInfo entityContainerInfo = provider.getEntityContainerInfo(containerName);
- if (entityContainerInfo != null) {
- return new EdmEntityContainerImpl(this, provider, entityContainerInfo);
- }
- return null;
- } catch (ODataException e) {
- throw new EdmException(e);
- }
- }
-
- @Override
- public EdmEnumType createEnumType(final FullQualifiedName enumName) {
- try {
- EnumType enumType = provider.getEnumType(enumName);
- if (enumType != null) {
- return new EdmEnumTypeImpl(this, enumName, enumType);
- }
- return null;
- } catch (ODataException e) {
- throw new EdmException(e);
- }
- }
-
- @Override
- public EdmTypeDefinition createTypeDefinition(final FullQualifiedName typeDefinitionName) {
- try {
- TypeDefinition typeDefinition = provider.getTypeDefinition(typeDefinitionName);
- if (typeDefinition != null) {
- return new EdmTypeDefinitionImpl(this, typeDefinitionName, typeDefinition);
- }
- return null;
- } catch (ODataException e) {
- throw new EdmException(e);
- }
- }
-
- @Override
- public EdmEntityType createEntityType(final FullQualifiedName entityTypeName) {
- try {
- EntityType entityType = provider.getEntityType(entityTypeName);
- if (entityType != null) {
- return EdmEntityTypeImpl.getInstance(this, entityTypeName, entityType);
- }
- return null;
- } catch (ODataException e) {
- throw new EdmException(e);
- }
- }
-
- @Override
- public EdmComplexType createComplexType(final FullQualifiedName complexTypeName) {
- try {
- final ComplexType complexType = provider.getComplexType(complexTypeName);
- if (complexType != null) {
- return EdmComplexTypeImpl.getInstance(this, complexTypeName, complexType);
- }
- return null;
- } catch (ODataException e) {
- throw new EdmException(e);
- }
- }
-
- @Override
- public EdmAction createBoundAction(final FullQualifiedName actionName,
- final FullQualifiedName bindingParameterTypeName, final Boolean isBindingParameterCollection) {
-
- try {
- List<Action> actions = actionsMap.get(actionName);
- if (actions == null) {
- actions = provider.getActions(actionName);
- if (actions == null) {
- return null;
- } else {
- actionsMap.put(actionName, actions);
- }
- }
- // Search for bound action where binding parameter matches
- for (Action action : actions) {
- if (action.isBound()) {
- final List<Parameter> parameters = action.getParameters();
- final Parameter parameter = parameters.get(0);
- if (bindingParameterTypeName.equals(parameter.getType())
- && isBindingParameterCollection.booleanValue() == parameter.isCollection()) {
-
- return EdmActionImpl.getInstance(this, actionName, action);
- }
-
- }
- }
- return null;
- } catch (ODataException e) {
- throw new EdmException(e);
- }
- }
-
- @Override
- public EdmFunction createBoundFunction(final FullQualifiedName functionName,
- final FullQualifiedName bindingParameterTypeName, final Boolean isBindingParameterCollection,
- final List<String> parameterNames) {
-
- try {
- List<Function> functions = functionsMap.get(functionName);
- if (functions == null) {
- functions = provider.getFunctions(functionName);
- if (functions == null) {
- return null;
- } else {
- functionsMap.put(functionName, functions);
- }
- }
- final List<String> parameterNamesCopy =
- parameterNames == null ? Collections.<String> emptyList() : parameterNames;
- for (Function function : functions) {
- if (function.isBound()) {
- List<Parameter> providerParameters = function.getParameters();
- if (providerParameters == null || providerParameters.size() == 0) {
- throw new EdmException("No parameter specified for bound function: " + functionName);
- }
- final Parameter bindingParameter = providerParameters.get(0);
- if (bindingParameterTypeName.equals(bindingParameter.getType())
- && isBindingParameterCollection.booleanValue() == bindingParameter.isCollection()) {
-
- if (parameterNamesCopy.size() == providerParameters.size() - 1) {
- final List<String> providerParameterNames = new ArrayList<String>();
- for (int i = 1; i < providerParameters.size(); i++) {
- providerParameterNames.add(providerParameters.get(i).getName());
- }
- if (parameterNamesCopy.containsAll(providerParameterNames)) {
- return EdmFunctionImpl.getInstance(this, functionName, function);
- }
- }
- }
- }
- }
- return null;
- } catch (ODataException e) {
- throw new EdmException(e);
- }
- }
-
- @Override
- protected Map<String, String> createAliasToNamespaceInfo() {
- final Map<String, String> aliasToNamespaceInfos = new HashMap<String, String>();
- try {
- final List<AliasInfo> aliasInfos = provider.getAliasInfos();
- if (aliasInfos != null) {
- for (AliasInfo info : aliasInfos) {
- aliasToNamespaceInfos.put(info.getAlias(), info.getNamespace());
- }
- }
- } catch (ODataException e) {
- throw new EdmException(e);
- }
- return aliasToNamespaceInfos;
- }
-
- @Override
- protected EdmAction createUnboundAction(final FullQualifiedName actionName) {
- try {
- List<Action> actions = actionsMap.get(actionName);
- if (actions == null) {
- actions = provider.getActions(actionName);
- if (actions == null) {
- return null;
- } else {
- actionsMap.put(actionName, actions);
- }
- }
- // Search for first unbound action
- for (Action action : actions) {
- if (!action.isBound()) {
- return EdmActionImpl.getInstance(this, actionName, action);
- }
- }
- return null;
- } catch (ODataException e) {
- throw new EdmException(e);
- }
- }
-
- @Override
- protected List<EdmFunction> createUnboundFunctions(final FullQualifiedName functionName) {
- List<EdmFunction> result = new ArrayList<EdmFunction>();
-
- try {
- List<Function> functions = functionsMap.get(functionName);
- if (functions == null) {
- functions = provider.getFunctions(functionName);
- if (functions != null) {
- functionsMap.put(functionName, functions);
- }
- }
- if (functions != null) {
- for (Function function : functions) {
- if (!function.isBound()) {
- result.add(EdmFunctionImpl.getInstance(this, functionName, function));
- }
- }
- }
- } catch (ODataException e) {
- throw new EdmException(e);
- }
-
- return result;
- }
-
- @Override
- protected EdmFunction createUnboundFunction(final FullQualifiedName functionName, final List<String> parameterNames) {
- try {
- List<Function> functions = functionsMap.get(functionName);
- if (functions == null) {
- functions = provider.getFunctions(functionName);
- if (functions == null) {
- return null;
- } else {
- functionsMap.put(functionName, functions);
- }
- }
-
- final List<String> parameterNamesCopy =
- parameterNames == null ? Collections.<String> emptyList() : parameterNames;
- for (Function function : functions) {
- if (!function.isBound()) {
- List<Parameter> providerParameters = function.getParameters();
- if (providerParameters == null) {
- providerParameters = Collections.emptyList();
- }
- if (parameterNamesCopy.size() == providerParameters.size()) {
- final List<String> functionParameterNames = new ArrayList<String>();
- for (Parameter parameter : providerParameters) {
- functionParameterNames.add(parameter.getName());
- }
-
- if (parameterNamesCopy.containsAll(functionParameterNames)) {
- return EdmFunctionImpl.getInstance(this, functionName, function);
- }
- }
- }
- }
- return null;
- } catch (ODataException e) {
- throw new EdmException(e);
- }
- }
-
- @Override
- protected Map<String, EdmSchema> createSchemas() {
- try {
- final Map<String, EdmSchema> _schemas = new LinkedHashMap<String, EdmSchema>();
- for (Schema schema : provider.getSchemas()) {
- _schemas.put(schema.getNamespace(), new EdmSchemaImpl(this, provider, schema));
- }
- return _schemas;
- } catch (ODataException e) {
- throw new EdmException(e);
- }
- }
-
- @Override
- protected EdmTerm createTerm(final FullQualifiedName termName) {
- // TODO: implement
- return null;
- }
-
- @Override
- protected EdmAnnotations createAnnotationGroup(final FullQualifiedName targetName) {
- // TODO: implement
- return null;
- }
-
- @Override
- protected List<EdmAnnotation> createAnnotations(final FullQualifiedName annotatedName) {
- // TODO: implement
- return null;
- }
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmReferentialConstraintImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmReferentialConstraintImpl.java
deleted file mode 100644
index 7007740..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmReferentialConstraintImpl.java
+++ /dev/null
@@ -1,44 +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.edm.provider;
-
-import org.apache.olingo.commons.api.edm.EdmAnnotation;
-import org.apache.olingo.commons.api.edm.EdmTerm;
-import org.apache.olingo.commons.core.edm.AbstractEdmReferentialConstraint;
-
-import java.util.List;
-
-public class EdmReferentialConstraintImpl extends AbstractEdmReferentialConstraint {
-
- public EdmReferentialConstraintImpl(final String property, final String referencedProperty) {
- super(property, referencedProperty);
- }
-
- @Override
- public EdmAnnotation getAnnotation(final EdmTerm term) {
- // TODO: implement
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- @Override
- public List<EdmAnnotation> getAnnotations() {
- // TODO: implement
- throw new UnsupportedOperationException("Not supported yet.");
- }
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmReturnTypeImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmReturnTypeImpl.java
deleted file mode 100644
index 95c2c83..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmReturnTypeImpl.java
+++ /dev/null
@@ -1,64 +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.edm.provider;
-
-import org.apache.olingo.commons.api.edm.Edm;
-import org.apache.olingo.commons.api.edm.geo.SRID;
-import org.apache.olingo.commons.core.edm.AbstractEdmReturnType;
-import org.apache.olingo.server.api.edm.provider.ReturnType;
-
-public class EdmReturnTypeImpl extends AbstractEdmReturnType {
-
- private final ReturnType returnType;
-
- public EdmReturnTypeImpl(final Edm edm, final ReturnType returnType) {
- super(edm, returnType.getType());
- this.returnType = returnType;
- }
-
- @Override
- public boolean isCollection() {
- return returnType.isCollection();
- }
-
- @Override
- public Boolean isNullable() {
- return returnType.getNullable();
- }
-
- @Override
- public Integer getMaxLength() {
- return returnType.getMaxLength();
- }
-
- @Override
- public Integer getPrecision() {
- return returnType.getPrecision();
- }
-
- @Override
- public Integer getScale() {
- return returnType.getScale();
- }
-
- @Override
- public SRID getSrid() {
- return null; // TODO: provide implementation
- }
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmSchemaImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmSchemaImpl.java
deleted file mode 100644
index b617db9..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmSchemaImpl.java
+++ /dev/null
@@ -1,174 +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.edm.provider;
-
-import org.apache.olingo.commons.api.edm.Edm;
-import org.apache.olingo.commons.api.edm.EdmAction;
-import org.apache.olingo.commons.api.edm.EdmAnnotation;
-import org.apache.olingo.commons.api.edm.EdmAnnotations;
-import org.apache.olingo.commons.api.edm.EdmComplexType;
-import org.apache.olingo.commons.api.edm.EdmEntityContainer;
-import org.apache.olingo.commons.api.edm.EdmEntityType;
-import org.apache.olingo.commons.api.edm.EdmEnumType;
-import org.apache.olingo.commons.api.edm.EdmFunction;
-import org.apache.olingo.commons.api.edm.EdmTerm;
-import org.apache.olingo.commons.api.edm.EdmTypeDefinition;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.core.edm.AbstractEdmSchema;
-import org.apache.olingo.server.api.edm.provider.Action;
-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.EntityType;
-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.Schema;
-import org.apache.olingo.server.api.edm.provider.TypeDefinition;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-public class EdmSchemaImpl extends AbstractEdmSchema {
-
- private final Schema schema;
-
- private final Edm edm;
-
- private final EdmProvider provider;
-
- public EdmSchemaImpl(final Edm edm, final EdmProvider provider, final Schema schema) {
- super(schema.getNamespace(), schema.getAlias());
- this.edm = edm;
- this.provider = provider;
- this.schema = schema;
- }
-
- @Override
- protected EdmEntityContainer createEntityContainer() {
- if (schema.getEntityContainer() != null) {
- FullQualifiedName containerFQN = new FullQualifiedName(namespace, schema.getEntityContainer().getName());
- return new EdmEntityContainerImpl(edm, provider, containerFQN, schema.getEntityContainer());
- }
- return null;
- }
-
- @Override
- protected List<EdmTypeDefinition> createTypeDefinitions() {
- final List<EdmTypeDefinition> typeDefinitions = new ArrayList<EdmTypeDefinition>();
- final List<TypeDefinition> providerTypeDefinitions = schema.getTypeDefinitions();
- if (providerTypeDefinitions != null) {
- for (TypeDefinition def : providerTypeDefinitions) {
- typeDefinitions.add(new EdmTypeDefinitionImpl(edm, new FullQualifiedName(namespace, def.getName()), def));
- }
- }
- return typeDefinitions;
- }
-
- @Override
- protected List<EdmEnumType> createEnumTypes() {
- final List<EdmEnumType> enumTypes = new ArrayList<EdmEnumType>();
- final List<EnumType> providerEnumTypes = schema.getEnumTypes();
- if (providerEnumTypes != null) {
- for (EnumType enumType : providerEnumTypes) {
- enumTypes.add(new EdmEnumTypeImpl(edm, new FullQualifiedName(namespace, enumType.getName()), enumType));
- }
- }
- return enumTypes;
- }
-
- @Override
- protected List<EdmEntityType> createEntityTypes() {
- final List<EdmEntityType> entityTypes = new ArrayList<EdmEntityType>();
- final List<EntityType> providerEntityTypes = schema.getEntityTypes();
- if (providerEntityTypes != null) {
- for (EntityType entityType : providerEntityTypes) {
- entityTypes.add(EdmEntityTypeImpl.getInstance(edm, new FullQualifiedName(namespace, entityType.getName()),
- entityType));
- }
- }
- return entityTypes;
- }
-
- @Override
- protected List<EdmComplexType> createComplexTypes() {
- final List<EdmComplexType> complexTypes = new ArrayList<EdmComplexType>();
- final List<ComplexType> providerComplexTypes = schema.getComplexTypes();
- if (providerComplexTypes != null) {
- for (ComplexType complexType : providerComplexTypes) {
- complexTypes.add(EdmComplexTypeImpl.getInstance(edm, new FullQualifiedName(namespace, complexType.getName()),
- complexType));
- }
- }
- return complexTypes;
- }
-
- @Override
- protected List<EdmAction> createActions() {
- final List<EdmAction> actions = new ArrayList<EdmAction>();
- final List<Action> providerActions = schema.getActions();
- if (providerActions != null) {
- for (Action action : providerActions) {
- actions.add(EdmActionImpl.getInstance(edm, new FullQualifiedName(namespace, action.getName()), action));
- }
- }
- return actions;
- }
-
- @Override
- protected List<EdmFunction> createFunctions() {
- final List<EdmFunction> functions = new ArrayList<EdmFunction>();
- final List<Function> providerFunctions = schema.getFunctions();
- if (providerFunctions != null) {
- for (Function function : providerFunctions) {
- functions.add(EdmFunctionImpl.getInstance(edm, new FullQualifiedName(namespace, function.getName()), function));
- }
- }
- return functions;
- }
-
- @Override
- protected List<EdmTerm> createTerms() {
- // TODO: implement
- return Collections.emptyList();
- }
-
- @Override
- protected List<EdmAnnotations> createAnnotationGroups() {
- // TODO: implement
- return Collections.emptyList();
- }
-
- @Override
- protected List<EdmAnnotation> createAnnotations() {
- // TODO: implement
- return Collections.emptyList();
- }
-
- @Override
- public EdmAnnotation getAnnotation(final EdmTerm term) {
- // TODO: implement
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- @Override
- public List<EdmAnnotation> getAnnotations() {
- // TODO: implement
- throw new UnsupportedOperationException("Not supported yet.");
- }
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmSingletonImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmSingletonImpl.java
deleted file mode 100644
index 41efc54..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmSingletonImpl.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.edm.provider;
-
-import org.apache.olingo.commons.api.edm.Edm;
-import org.apache.olingo.commons.api.edm.EdmAnnotation;
-import org.apache.olingo.commons.api.edm.EdmEntityContainer;
-import org.apache.olingo.commons.api.edm.EdmSingleton;
-import org.apache.olingo.commons.api.edm.EdmTerm;
-import org.apache.olingo.server.api.edm.provider.Singleton;
-
-import java.util.List;
-
-public class EdmSingletonImpl extends EdmBindingTargetImpl implements EdmSingleton {
-
- public EdmSingletonImpl(final Edm edm, final EdmEntityContainer container, final Singleton singleton) {
- super(edm, container, singleton);
- }
-
- @Override
- public TargetType getAnnotationsTargetType() {
- return TargetType.Singleton;
- }
-
- @Override
- public EdmAnnotation getAnnotation(final EdmTerm term) {
- // TODO: implement
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- @Override
- public List<EdmAnnotation> getAnnotations() {
- // TODO: implement
- throw new UnsupportedOperationException("Not supported yet.");
- }
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmStructuredTypeHelperImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmStructuredTypeHelperImpl.java
deleted file mode 100644
index cc4c7f1..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmStructuredTypeHelperImpl.java
+++ /dev/null
@@ -1,89 +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.edm.provider;
-
-import org.apache.olingo.commons.api.edm.Edm;
-import org.apache.olingo.commons.api.edm.EdmNavigationProperty;
-import org.apache.olingo.commons.api.edm.EdmProperty;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.core.edm.EdmStructuredTypeHelper;
-import org.apache.olingo.server.api.edm.provider.NavigationProperty;
-import org.apache.olingo.server.api.edm.provider.Property;
-import org.apache.olingo.server.api.edm.provider.StructuredType;
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-public class EdmStructuredTypeHelperImpl implements EdmStructuredTypeHelper {
-
- private final Edm edm;
-
- private final FullQualifiedName structuredTypeName;
-
- private final StructuredType structuredType;
-
- private Map<String, EdmProperty> properties;
-
- private Map<String, EdmNavigationProperty> navigationProperties;
-
- public EdmStructuredTypeHelperImpl(
- final Edm edm, final FullQualifiedName structuredTypeName, final StructuredType structuredType) {
-
- this.edm = edm;
- this.structuredTypeName = structuredTypeName;
- this.structuredType = structuredType;
- }
-
- @Override
- public Map<String, EdmProperty> getProperties() {
- if (properties == null) {
- properties = new LinkedHashMap<String, EdmProperty>();
- if (structuredType.getProperties() != null) {
- for (Property property : structuredType.getProperties()) {
- properties.put(property.getName(), new EdmPropertyImpl(edm, structuredTypeName, property));
- }
- }
- }
- return properties;
- }
-
- @Override
- public Map<String, EdmNavigationProperty> getNavigationProperties() {
- if (navigationProperties == null) {
- navigationProperties = new LinkedHashMap<String, EdmNavigationProperty>();
- if (structuredType.getNavigationProperties() != null) {
- for (NavigationProperty navigationProperty : structuredType.getNavigationProperties()) {
- navigationProperties.put(navigationProperty.getName(),
- new EdmNavigationPropertyImpl(edm, structuredTypeName, navigationProperty));
- }
- }
- }
- return navigationProperties;
- }
-
- @Override
- public boolean isOpenType() {
- return structuredType.isOpenType();
- }
-
- @Override
- public boolean isAbstract() {
- return structuredType.isAbstract();
- }
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmTypeDefinitionImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmTypeDefinitionImpl.java
deleted file mode 100644
index 0f8c808..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/edm/provider/EdmTypeDefinitionImpl.java
+++ /dev/null
@@ -1,97 +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.edm.provider;
-
-import java.util.List;
-
-import org.apache.olingo.commons.api.edm.Edm;
-import org.apache.olingo.commons.api.edm.EdmAnnotation;
-import org.apache.olingo.commons.api.edm.EdmException;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
-import org.apache.olingo.commons.api.edm.EdmTerm;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.api.edm.geo.SRID;
-import org.apache.olingo.commons.core.edm.AbstractEdmTypeDefinition;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
-import org.apache.olingo.server.api.edm.provider.TypeDefinition;
-
-public class EdmTypeDefinitionImpl extends AbstractEdmTypeDefinition {
-
- private TypeDefinition typeDefinition;
-
- private EdmPrimitiveType edmPrimitiveTypeInstance;
-
- public EdmTypeDefinitionImpl(final Edm edm, final FullQualifiedName typeDefinitionName,
- final TypeDefinition typeDefinition) {
-
- super(edm, typeDefinitionName);
- this.typeDefinition = typeDefinition;
- }
-
- @Override
- public EdmPrimitiveType getUnderlyingType() {
- if (edmPrimitiveTypeInstance == null) {
- try {
- edmPrimitiveTypeInstance = EdmPrimitiveTypeFactory.getInstance(
- EdmPrimitiveTypeKind.valueOf(typeDefinition.getUnderlyingType().getName()));
- } catch (IllegalArgumentException e) {
- throw new EdmException("Invalid underlying type: " + typeDefinition.getUnderlyingType(), e);
- }
- }
- return edmPrimitiveTypeInstance;
- }
-
- @Override
- public Integer getMaxLength() {
- return typeDefinition.getMaxLength();
- }
-
- @Override
- public Integer getPrecision() {
- return typeDefinition.getPrecision();
- }
-
- @Override
- public Integer getScale() {
- return typeDefinition.getScale();
- }
-
- @Override
- public SRID getSrid() {
- return null; // TODO: provide implementation
- }
-
- @Override
- public Boolean isUnicode() {
- return typeDefinition.getIsUnicode();
- }
-
- @Override
- public EdmAnnotation getAnnotation(final EdmTerm term) {
- // TODO: implement
- throw new UnsupportedOperationException("Not supported yet.");
- }
-
- @Override
- public List<EdmAnnotation> getAnnotations() {
- // TODO: implement
- throw new UnsupportedOperationException("Not supported yet.");
- }
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/BatchResponseSerializer.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/BatchResponseSerializer.java
deleted file mode 100644
index a8d7898..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/BatchResponseSerializer.java
+++ /dev/null
@@ -1,184 +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.serializer;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
-
-import org.apache.olingo.commons.api.ODataRuntimeException;
-import org.apache.olingo.commons.api.http.HttpContentType;
-import org.apache.olingo.commons.api.http.HttpHeader;
-import org.apache.olingo.commons.api.http.HttpStatusCode;
-import org.apache.olingo.server.api.ODataResponse;
-import org.apache.olingo.server.api.batch.exception.BatchSerializerException;
-import org.apache.olingo.server.api.batch.exception.BatchSerializerException.MessageKeys;
-import org.apache.olingo.server.api.deserializer.batch.ODataResponsePart;
-import org.apache.olingo.server.core.deserializer.batch.BatchParserCommon;
-
-public class BatchResponseSerializer {
- private static final int BUFFER_SIZE = 4096;
- private static final String DOUBLE_DASH = "--";
- private static final String COLON = ":";
- private static final String SP = " ";
- private static final String CRLF = "\r\n";
-
- public InputStream serialize(final List<ODataResponsePart> responses, final String boundary)
- throws BatchSerializerException {
- StringBuilder builder = createBody(responses, boundary);
-
- return new ByteArrayInputStream(builder.toString().getBytes());
- }
-
- private StringBuilder createBody(final List<ODataResponsePart> batchResponses, final String boundary)
- throws BatchSerializerException {
- final StringBuilder builder = new StringBuilder();
-
- for (final ODataResponsePart part : batchResponses) {
- builder.append(getDashBoundary(boundary));
-
- if (part.isChangeSet()) {
- appendChangeSet(part, builder);
- } else {
- appendBodyPart(part.getResponses().get(0), builder, false);
- }
- }
- builder.append(getCloseDelimiter(boundary));
-
- return builder;
- }
-
- private void appendChangeSet(ODataResponsePart part, StringBuilder builder) throws BatchSerializerException {
- final String changeSetBoundary = generateBoundary("changeset");
-
- appendChangeSetHeader(builder, changeSetBoundary);
- builder.append(CRLF);
-
- for (final ODataResponse response : part.getResponses()) {
- builder.append(getDashBoundary(changeSetBoundary));
- appendBodyPart(response, builder, true);
- }
-
- builder.append(getCloseDelimiter(changeSetBoundary));
- }
-
- private void appendBodyPart(ODataResponse response, StringBuilder builder, boolean isChangeSet)
- throws BatchSerializerException {
- byte[] body = getBody(response);
-
- appendBodyPartHeader(response, builder, isChangeSet);
- builder.append(CRLF);
-
- appendStatusLine(response, builder);
- appendResponseHeader(response, body.length, builder);
- builder.append(CRLF);
-
- builder.append(new String(body));
- builder.append(CRLF);
- }
-
- private byte[] getBody(final ODataResponse response) {
- final InputStream content = response.getContent();
- final ByteArrayOutputStream out = new ByteArrayOutputStream();
-
- if (content != null) {
- byte[] buffer = new byte[BUFFER_SIZE];
- int n;
-
- try {
- while ((n = content.read(buffer, 0, buffer.length)) != -1) {
- out.write(buffer, 0, n);
- }
- out.flush();
- } catch (IOException e) {
- throw new ODataRuntimeException(e);
- }
-
- return out.toByteArray();
- } else {
- return new byte[0];
- }
- }
-
- private void appendChangeSetHeader(StringBuilder builder, final String changeSetBoundary) {
- appendHeader(HttpHeader.CONTENT_TYPE, HttpContentType.MULTIPART_MIXED.toString() + "; boundary="
- + changeSetBoundary, builder);
- }
-
- private void appendHeader(String name, String value, StringBuilder builder) {
- builder.append(name)
- .append(COLON)
- .append(SP)
- .append(value)
- .append(CRLF);
- }
-
- private void appendStatusLine(ODataResponse response, StringBuilder builder) {
- builder.append("HTTP/1.1")
- .append(SP)
- .append("" + response.getStatusCode())
- .append(SP)
- .append(HttpStatusCode.fromStatusCode(response.getStatusCode()).toString())
- .append(CRLF);
- }
-
- private void appendResponseHeader(ODataResponse response, int contentLength, StringBuilder builder) {
- final Map<String, String> header = response.getHeaders();
-
- for (final String key : header.keySet()) {
- // Requests do never has a content id header
- if (!key.equalsIgnoreCase(BatchParserCommon.HTTP_CONTENT_ID)) {
- appendHeader(key, header.get(key), builder);
- }
- }
-
- appendHeader(HttpHeader.CONTENT_LENGTH, "" + contentLength, builder);
- }
-
- private void appendBodyPartHeader(ODataResponse response, StringBuilder builder, boolean isChangeSet)
- throws BatchSerializerException {
- appendHeader(HttpHeader.CONTENT_TYPE, HttpContentType.APPLICATION_HTTP, builder);
- appendHeader(BatchParserCommon.HTTP_CONTENT_TRANSFER_ENCODING, BatchParserCommon.BINARY_ENCODING, builder);
-
- if (isChangeSet) {
- if (response.getHeaders().get(BatchParserCommon.HTTP_CONTENT_ID) != null) {
- appendHeader(BatchParserCommon.HTTP_CONTENT_ID, response.getHeaders().get(BatchParserCommon.HTTP_CONTENT_ID),
- builder);
- } else {
- throw new BatchSerializerException("Missing content id", MessageKeys.MISSING_CONTENT_ID);
- }
- }
- }
-
- private String getDashBoundary(String boundary) {
- return DOUBLE_DASH + boundary + CRLF;
- }
-
- private String getCloseDelimiter(final String boundary) {
- return DOUBLE_DASH + boundary + DOUBLE_DASH + CRLF;
- }
-
- private String generateBoundary(final String value) {
- return value + "_" + UUID.randomUUID().toString();
- }
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/FixedFormatSerializerImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/FixedFormatSerializerImpl.java
deleted file mode 100644
index 004b23a..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/FixedFormatSerializerImpl.java
+++ /dev/null
@@ -1,71 +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.serializer;
-
-import java.io.ByteArrayInputStream;
-import java.io.InputStream;
-import java.io.UnsupportedEncodingException;
-import java.util.List;
-
-import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
-import org.apache.olingo.server.api.batch.exception.BatchSerializerException;
-import org.apache.olingo.server.api.deserializer.batch.ODataResponsePart;
-import org.apache.olingo.server.api.serializer.FixedFormatSerializer;
-import org.apache.olingo.server.api.serializer.PrimitiveValueSerializerOptions;
-import org.apache.olingo.server.api.serializer.SerializerException;
-
-public class FixedFormatSerializerImpl implements FixedFormatSerializer {
-
- @Override
- public InputStream binary(final byte[] binary) throws SerializerException {
- return new ByteArrayInputStream(binary);
- }
-
- @Override
- public InputStream count(final Integer count) throws SerializerException {
- return new ByteArrayInputStream(count.toString().getBytes());
- }
-
- @Override
- public InputStream primitiveValue(final EdmPrimitiveType type, final Object value,
- final PrimitiveValueSerializerOptions options) throws SerializerException {
- try {
- final String result = type.valueToString(value,
- options.isNullable(), options.getMaxLength(),
- options.getPrecision(), options.getScale(), options.isUnicode());
- return new ByteArrayInputStream(result.getBytes("UTF-8"));
- } catch (final EdmPrimitiveTypeException e) {
- throw new SerializerException("Error in primitive-value formatting.", e,
- SerializerException.MessageKeys.WRONG_PRIMITIVE_VALUE,
- type.getFullQualifiedName().getFullQualifiedNameAsString(), value.toString());
- } catch (final UnsupportedEncodingException e) {
- throw new SerializerException("Encoding exception.", e, SerializerException.MessageKeys.IO_EXCEPTION);
- }
- }
-
- // TODO: Signature
- @Override
- public InputStream batchResponse(final List<ODataResponsePart> batchResponses, final String boundary)
- throws BatchSerializerException {
- final BatchResponseSerializer serializer = new BatchResponseSerializer();
-
- return serializer.serialize(batchResponses, boundary);
- }
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/json/ODataErrorSerializer.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/json/ODataErrorSerializer.java
deleted file mode 100644
index 14381bb..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/json/ODataErrorSerializer.java
+++ /dev/null
@@ -1,77 +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.serializer.json;
-
-import java.io.IOException;
-
-import org.apache.olingo.commons.api.Constants;
-import org.apache.olingo.commons.api.domain.ODataError;
-import org.apache.olingo.commons.api.domain.ODataErrorDetail;
-import org.apache.olingo.server.api.serializer.SerializerException;
-
-import com.fasterxml.jackson.core.JsonGenerator;
-
-public class ODataErrorSerializer {
-
- public void writeErrorDocument(JsonGenerator json, final ODataError error)
- throws IOException, SerializerException {
- if (error == null) {
- throw new SerializerException("ODataError object MUST NOT be null!",
- SerializerException.MessageKeys.NULL_INPUT);
- }
- json.writeStartObject();
- json.writeFieldName(Constants.JSON_ERROR);
-
- json.writeStartObject();
- writeODataError(json, error.getCode(), error.getMessage(), error.getTarget());
-
- if (error.getDetails() != null) {
- json.writeArrayFieldStart(Constants.ERROR_DETAILS);
- for (ODataErrorDetail detail : error.getDetails()) {
- json.writeStartObject();
- writeODataError(json, detail.getCode(), detail.getMessage(), detail.getTarget());
- json.writeEndObject();
- }
- json.writeEndArray();
- }
-
- json.writeEndObject();
- json.writeEndObject();
- }
-
- private void writeODataError(JsonGenerator json, String code, String message, String target) throws IOException {
- json.writeFieldName(Constants.ERROR_CODE);
- if (code == null) {
- json.writeNull();
- } else {
- json.writeString(code);
- }
-
- json.writeFieldName(Constants.ERROR_MESSAGE);
- if (message == null) {
- json.writeNull();
- } else {
- json.writeString(message);
- }
-
- if (target != null) {
- json.writeStringField(Constants.ERROR_TARGET, target);
- }
- }
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/json/ODataJsonSerializer.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/json/ODataJsonSerializer.java
deleted file mode 100644
index 6067312..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/json/ODataJsonSerializer.java
+++ /dev/null
@@ -1,560 +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.serializer.json;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Collections;
-import java.util.List;
-import java.util.Set;
-
-import org.apache.olingo.commons.api.Constants;
-import org.apache.olingo.commons.api.data.ContextURL;
-import org.apache.olingo.commons.api.data.Entity;
-import org.apache.olingo.commons.api.data.EntitySet;
-import org.apache.olingo.commons.api.data.Link;
-import org.apache.olingo.commons.api.data.Linked;
-import org.apache.olingo.commons.api.data.LinkedComplexValue;
-import org.apache.olingo.commons.api.data.Property;
-import org.apache.olingo.commons.api.edm.Edm;
-import org.apache.olingo.commons.api.edm.EdmComplexType;
-import org.apache.olingo.commons.api.edm.EdmEntityType;
-import org.apache.olingo.commons.api.edm.EdmNavigationProperty;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
-import org.apache.olingo.commons.api.edm.EdmProperty;
-import org.apache.olingo.commons.api.edm.EdmStructuredType;
-import org.apache.olingo.commons.api.format.ODataFormat;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
-import org.apache.olingo.server.api.ODataServerError;
-import org.apache.olingo.server.api.ServiceMetadata;
-import org.apache.olingo.server.api.serializer.ComplexSerializerOptions;
-import org.apache.olingo.server.api.serializer.EntityCollectionSerializerOptions;
-import org.apache.olingo.server.api.serializer.ODataSerializer;
-import org.apache.olingo.server.api.serializer.PrimitiveSerializerOptions;
-import org.apache.olingo.server.api.serializer.SerializerException;
-import org.apache.olingo.server.api.serializer.EntitySerializerOptions;
-import org.apache.olingo.server.api.uri.queryoption.ExpandItem;
-import org.apache.olingo.server.api.uri.queryoption.ExpandOption;
-import org.apache.olingo.server.api.uri.queryoption.SelectOption;
-import org.apache.olingo.server.core.serializer.utils.CircleStreamBuffer;
-import org.apache.olingo.server.core.serializer.utils.ContextURLBuilder;
-import org.apache.olingo.server.core.serializer.utils.ExpandSelectHelper;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.fasterxml.jackson.core.JsonFactory;
-import com.fasterxml.jackson.core.JsonGenerator;
-import com.fasterxml.jackson.core.util.DefaultPrettyPrinter;
-
-public class ODataJsonSerializer implements ODataSerializer {
-
- private static final Logger log = LoggerFactory.getLogger(ODataJsonSerializer.class);
-
- private final ODataFormat format;
-
- public ODataJsonSerializer(final ODataFormat format) {
- this.format = format;
- }
-
- @Override
- public InputStream serviceDocument(final Edm edm, final String serviceRoot) throws SerializerException {
- CircleStreamBuffer buffer;
- JsonGenerator gen = null;
-
- // TODO: move stream initialization into separate method
- try {
- buffer = new CircleStreamBuffer();
- gen = new JsonFactory().createGenerator(buffer.getOutputStream())
- .setPrettyPrinter(new DefaultPrettyPrinter());
-
- new ServiceDocumentJsonSerializer(edm, serviceRoot).writeServiceDocument(gen);
-
- gen.close();
-
- // TODO: Check correct stream handling
- // writer.flush();
- // buffer.closeWrite();
-
- return buffer.getInputStream();
-
- } catch (final IOException e) {
- log.error(e.getMessage(), e);
- throw new SerializerException("An I/O exception occurred.", e,
- SerializerException.MessageKeys.IO_EXCEPTION);
- } finally {
- if (gen != null) {
- try {
- gen.close();
- } catch (IOException e) {
- throw new SerializerException("An I/O exception occurred.", e,
- SerializerException.MessageKeys.IO_EXCEPTION);
- }
- }
- }
- }
-
- @Override
- public InputStream metadataDocument(final ServiceMetadata serviceMetadata) throws SerializerException {
- throw new SerializerException("Metadata in JSON format not supported!",
- SerializerException.MessageKeys.JSON_METADATA);
- }
-
- @Override
- public InputStream error(final ODataServerError error) throws SerializerException {
- CircleStreamBuffer buffer = new CircleStreamBuffer();
- try {
- JsonGenerator json = new JsonFactory().createGenerator(buffer.getOutputStream());
- new ODataErrorSerializer().writeErrorDocument(json, error);
- json.close();
- } catch (final IOException e) {
- throw new SerializerException("An I/O exception occurred.", e,
- SerializerException.MessageKeys.IO_EXCEPTION);
- }
- return buffer.getInputStream();
- }
-
- @Override
- public InputStream entityCollection(final EdmEntityType entityType, final EntitySet entitySet,
- final EntityCollectionSerializerOptions options) throws SerializerException {
- CircleStreamBuffer buffer = new CircleStreamBuffer();
- try {
- JsonGenerator json = new JsonFactory().createGenerator(buffer.getOutputStream());
- json.writeStartObject();
-
- final ContextURL contextURL = checkContextURL(options == null ? null : options.getContextURL());
- if (contextURL != null) {
- json.writeStringField(Constants.JSON_CONTEXT,
- ContextURLBuilder.create(contextURL).toASCIIString());
- }
-
- if (options != null && options.getCount() != null && options.getCount().getValue()
- && entitySet.getCount() != null) {
- json.writeNumberField(Constants.JSON_COUNT, entitySet.getCount());
- }
- json.writeFieldName(Constants.VALUE);
- writeEntitySet(entityType, entitySet,
- options == null ? null : options.getExpand(), options == null ? null : options.getSelect(), json);
- if (entitySet.getNext() != null) {
- json.writeStringField(Constants.JSON_NEXT_LINK, entitySet.getNext().toASCIIString());
- }
- json.close();
- } catch (final IOException e) {
- throw new SerializerException("An I/O exception occurred.", e,
- SerializerException.MessageKeys.IO_EXCEPTION);
- }
- return buffer.getInputStream();
- }
-
- @Override
- public InputStream entity(final EdmEntityType entityType, final Entity entity,
- final EntitySerializerOptions options) throws SerializerException {
- final ContextURL contextURL = checkContextURL(options == null ? null : options.getContextURL());
- CircleStreamBuffer buffer = new CircleStreamBuffer();
- try {
- JsonGenerator json = new JsonFactory().createGenerator(buffer.getOutputStream());
- writeEntity(entityType, entity, contextURL,
- options == null ? null : options.getExpand(), options == null ? null : options.getSelect(), json);
- json.close();
- } catch (final IOException e) {
- throw new SerializerException("An I/O exception occurred.", e,
- SerializerException.MessageKeys.IO_EXCEPTION);
- }
- return buffer.getInputStream();
- }
-
- private ContextURL checkContextURL(final ContextURL contextURL) throws SerializerException {
- if (format == ODataFormat.JSON_NO_METADATA) {
- return null;
- } else if (contextURL == null) {
- throw new SerializerException("ContextURL null!", SerializerException.MessageKeys.NO_CONTEXT_URL);
- }
- return contextURL;
- }
-
- protected void writeEntitySet(final EdmEntityType entityType, final EntitySet entitySet,
- final ExpandOption expand, final SelectOption select, final JsonGenerator json)
- throws IOException, SerializerException {
- json.writeStartArray();
- for (final Entity entity : entitySet.getEntities()) {
- writeEntity(entityType, entity, null, expand, select, json);
- }
- json.writeEndArray();
- }
-
- protected void writeEntity(final EdmEntityType entityType, final Entity entity, final ContextURL contextURL,
- final ExpandOption expand, final SelectOption select, final JsonGenerator json)
- throws IOException, SerializerException {
- json.writeStartObject();
- if (format != ODataFormat.JSON_NO_METADATA) {
- if (contextURL != null) {
- json.writeStringField(Constants.JSON_CONTEXT, ContextURLBuilder.create(contextURL).toASCIIString());
- }
- if (entity.getETag() != null) {
- json.writeStringField(Constants.JSON_ETAG, entity.getETag());
- }
- if (entityType.hasStream()) {
- if (entity.getMediaETag() != null) {
- json.writeStringField(Constants.JSON_MEDIA_ETAG, entity.getMediaETag());
- }
- if (entity.getMediaContentType() != null) {
- json.writeStringField(Constants.JSON_MEDIA_CONTENT_TYPE, entity.getMediaContentType());
- }
- }
- }
- writeProperties(entityType, entity.getProperties(), select, json);
- writeNavigationProperties(entityType, entity, expand, json);
- json.writeEndObject();
- }
-
- protected void writeProperties(final EdmStructuredType type, final List<Property> properties,
- final SelectOption select, JsonGenerator json) throws IOException, SerializerException {
- final boolean all = ExpandSelectHelper.isAll(select);
- final Set<String> selected = all ? null :
- ExpandSelectHelper.getSelectedPropertyNames(select.getSelectItems());
- for (final String propertyName : type.getPropertyNames()) {
- if (all || selected.contains(propertyName)) {
- final EdmProperty edmProperty = type.getStructuralProperty(propertyName);
- final Property property = findProperty(propertyName, properties);
- final Set<List<String>> selectedPaths = all || edmProperty.isPrimitive() ? null :
- ExpandSelectHelper.getSelectedPaths(select.getSelectItems(), propertyName);
- writeProperty(edmProperty, property, selectedPaths, json);
- }
- }
- }
-
- protected void writeNavigationProperties(final EdmStructuredType type, final Linked linked,
- final ExpandOption expand, final JsonGenerator json) throws SerializerException, IOException {
- if (ExpandSelectHelper.hasExpand(expand)) {
- final boolean expandAll = ExpandSelectHelper.isExpandAll(expand);
- final Set<String> expanded = expandAll ? null :
- ExpandSelectHelper.getExpandedPropertyNames(expand.getExpandItems());
- for (final String propertyName : type.getNavigationPropertyNames()) {
- if (expandAll || expanded.contains(propertyName)) {
- final EdmNavigationProperty property = type.getNavigationProperty(propertyName);
- final Link navigationLink = linked.getNavigationLink(property.getName());
- final ExpandItem innerOptions = expandAll ? null :
- ExpandSelectHelper.getExpandItem(expand.getExpandItems(), propertyName);
- if (innerOptions != null && (innerOptions.isRef() || innerOptions.getLevelsOption() != null)) {
- throw new SerializerException("Expand options $ref and $levels are not supported.",
- SerializerException.MessageKeys.NOT_IMPLEMENTED);
- }
- writeExpandedNavigationProperty(property, navigationLink,
- innerOptions == null ? null : innerOptions.getExpandOption(),
- innerOptions == null ? null : innerOptions.getSelectOption(),
- json);
- }
- }
- }
- }
-
- protected void writeExpandedNavigationProperty(final EdmNavigationProperty property, final Link navigationLink,
- final ExpandOption innerExpand, final SelectOption innerSelect, JsonGenerator json)
- throws IOException, SerializerException {
- json.writeFieldName(property.getName());
- if (property.isCollection()) {
- if (navigationLink == null || navigationLink.getInlineEntitySet() == null) {
- json.writeStartArray();
- json.writeEndArray();
- } else {
- writeEntitySet(property.getType(), navigationLink.getInlineEntitySet(), innerExpand, innerSelect, json);
- }
- } else {
- if (navigationLink == null || navigationLink.getInlineEntity() == null) {
- json.writeNull();
- } else {
- writeEntity(property.getType(), navigationLink.getInlineEntity(), null, innerExpand, innerSelect, json);
- }
- }
- }
-
- protected void writeProperty(final EdmProperty edmProperty, final Property property,
- final Set<List<String>> selectedPaths, final JsonGenerator json) throws IOException, SerializerException {
- json.writeFieldName(edmProperty.getName());
- if (property == null || property.isNull()) {
- if (edmProperty.isNullable() == Boolean.FALSE) {
- throw new SerializerException("Non-nullable property not present!",
- SerializerException.MessageKeys.MISSING_PROPERTY, edmProperty.getName());
- } else {
- json.writeNull();
- }
- } else {
- writePropertyValue(edmProperty, property, selectedPaths, json);
- }
- }
-
- private void writePropertyValue(final EdmProperty edmProperty,
- final Property property, final Set<List<String>> selectedPaths,
- final JsonGenerator json) throws IOException, SerializerException {
- try {
- if (edmProperty.isPrimitive()) {
- if (edmProperty.isCollection()) {
- writePrimitiveCollection((EdmPrimitiveType) edmProperty.getType(), property,
- edmProperty.isNullable(), edmProperty.getMaxLength(),
- edmProperty.getPrecision(), edmProperty.getScale(), edmProperty.isUnicode(),
- json);
- } else {
- writePrimitive((EdmPrimitiveType) edmProperty.getType(), property,
- edmProperty.isNullable(), edmProperty.getMaxLength(),
- edmProperty.getPrecision(), edmProperty.getScale(), edmProperty.isUnicode(),
- json);
- }
- } else if (edmProperty.isCollection()) {
- writeComplexCollection((EdmComplexType) edmProperty.getType(), property, selectedPaths, json);
- } else if (property.isLinkedComplex()) {
- writeComplexValue((EdmComplexType) edmProperty.getType(), property.asLinkedComplex().getValue(),
- selectedPaths, json);
- } else if (property.isComplex()) {
- writeComplexValue((EdmComplexType) edmProperty.getType(), property.asComplex(), selectedPaths, json);
- } else {
- throw new SerializerException("Property type not yet supported!",
- SerializerException.MessageKeys.UNSUPPORTED_PROPERTY_TYPE, edmProperty.getName());
- }
- } catch (final EdmPrimitiveTypeException e) {
- throw new SerializerException("Wrong value for property!", e,
- SerializerException.MessageKeys.WRONG_PROPERTY_VALUE,
- edmProperty.getName(), property.getValue().toString());
- }
- }
-
- private void writePrimitiveCollection(final EdmPrimitiveType type, final Property property,
- final Boolean isNullable, final Integer maxLength, final Integer precision, final Integer scale,
- final Boolean isUnicode,
- JsonGenerator json) throws IOException, EdmPrimitiveTypeException, SerializerException {
- json.writeStartArray();
- for (Object value : property.asCollection()) {
- switch (property.getValueType()) {
- case COLLECTION_PRIMITIVE:
- writePrimitiveValue(type, value, isNullable, maxLength, precision, scale, isUnicode, json);
- break;
- case COLLECTION_GEOSPATIAL:
- throw new SerializerException("Property type not yet supported!",
- SerializerException.MessageKeys.UNSUPPORTED_PROPERTY_TYPE, property.getName());
- case COLLECTION_ENUM:
- json.writeString(value.toString());
- break;
- default:
- throw new SerializerException("Property type not yet supported!",
- SerializerException.MessageKeys.UNSUPPORTED_PROPERTY_TYPE, property.getName());
- }
- }
- json.writeEndArray();
- }
-
- private void writeComplexCollection(final EdmComplexType type, final Property property,
- final Set<List<String>> selectedPaths, JsonGenerator json)
- throws IOException, EdmPrimitiveTypeException, SerializerException {
- json.writeStartArray();
- for (Object value : property.asCollection()) {
- switch (property.getValueType()) {
- case COLLECTION_LINKED_COMPLEX:
- writeComplexValue(type, ((LinkedComplexValue) value).getValue(), selectedPaths, json);
- break;
- case COLLECTION_COMPLEX:
- writeComplexValue(type, ((Property) value).asComplex(), selectedPaths, json);
- break;
- default:
- throw new SerializerException("Property type not yet supported!",
- SerializerException.MessageKeys.UNSUPPORTED_PROPERTY_TYPE, property.getName());
- }
- }
- json.writeEndArray();
- }
-
- private void writePrimitive(final EdmPrimitiveType type, final Property property,
- final Boolean isNullable, final Integer maxLength, final Integer precision, final Integer scale,
- final Boolean isUnicode, JsonGenerator json)
- throws EdmPrimitiveTypeException, IOException, SerializerException {
- if (property.isPrimitive()) {
- writePrimitiveValue(type, property.asPrimitive(),
- isNullable, maxLength, precision, scale, isUnicode, json);
- } else if (property.isGeospatial()) {
- throw new SerializerException("Property type not yet supported!",
- SerializerException.MessageKeys.UNSUPPORTED_PROPERTY_TYPE, property.getName());
- } else if (property.isEnum()) {
- writePrimitiveValue(type, property.asEnum(),
- isNullable, maxLength, precision, scale, isUnicode, json);
- } else {
- throw new SerializerException("Inconsistent property type!",
- SerializerException.MessageKeys.INCONSISTENT_PROPERTY_TYPE, property.getName());
- }
- }
-
- protected void writePrimitiveValue(final EdmPrimitiveType type, final Object primitiveValue,
- final Boolean isNullable, final Integer maxLength, final Integer precision, final Integer scale,
- final Boolean isUnicode,
- final JsonGenerator json) throws EdmPrimitiveTypeException, IOException {
- final String value = type.valueToString(primitiveValue,
- isNullable, maxLength, precision, scale, isUnicode);
- if (type == EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Boolean)) {
- json.writeBoolean(Boolean.parseBoolean(value));
- } else if (type == EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Byte)
- || type == EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Decimal)
- || type == EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Double)
- || type == EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Int16)
- || type == EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Int32)
- || type == EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Int64)
- || type == EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.SByte)
- || type == EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Single)) {
- json.writeNumber(value);
- } else {
- json.writeString(value);
- }
- }
-
- protected void writeComplexValue(final EdmComplexType type, final List<Property> properties,
- final Set<List<String>> selectedPaths, JsonGenerator json)
- throws IOException, EdmPrimitiveTypeException, SerializerException {
- json.writeStartObject();
- for (final String propertyName : type.getPropertyNames()) {
- final Property property = findProperty(propertyName, properties);
- if (selectedPaths == null || ExpandSelectHelper.isSelected(selectedPaths, propertyName)) {
- writeProperty((EdmProperty) type.getProperty(propertyName), property,
- selectedPaths == null ? null : ExpandSelectHelper.getReducedSelectedPaths(selectedPaths, propertyName),
- json);
- }
- }
- json.writeEndObject();
- }
-
- private Property findProperty(final String propertyName, final List<Property> properties) {
- for (final Property property : properties) {
- if (propertyName.equals(property.getName())) {
- return property;
- }
- }
- return null;
- }
-
- @Override
- public InputStream primitive(final EdmPrimitiveType type, final Property property,
- final PrimitiveSerializerOptions options) throws SerializerException {
- final ContextURL contextURL = checkContextURL(options == null ? null : options.getContextURL());
- CircleStreamBuffer buffer = new CircleStreamBuffer();
- try {
- JsonGenerator json = new JsonFactory().createGenerator(buffer.getOutputStream());
- json.writeStartObject();
- if (contextURL != null) {
- json.writeStringField(Constants.JSON_CONTEXT, ContextURLBuilder.create(contextURL).toASCIIString());
- }
- if (property.isNull()) {
- throw new SerializerException("Property value can not be null.", SerializerException.MessageKeys.NULL_INPUT);
- } else {
- json.writeFieldName(Constants.VALUE);
- writePrimitive(type, property,
- options.isNullable(), options.getMaxLength(), options.getPrecision(), options.getScale(),
- options.isUnicode(),
- json);
- }
- json.writeEndObject();
- json.close();
- } catch (final IOException e) {
- throw new SerializerException("An I/O exception occurred.", e,
- SerializerException.MessageKeys.IO_EXCEPTION);
- } catch (final EdmPrimitiveTypeException e) {
- throw new SerializerException("Wrong value for property!", e,
- SerializerException.MessageKeys.WRONG_PROPERTY_VALUE,
- property.getName(), property.getValue().toString());
- }
- return buffer.getInputStream();
- }
-
- @Override
- public InputStream complex(final EdmComplexType type, final Property property,
- final ComplexSerializerOptions options) throws SerializerException {
- final ContextURL contextURL = checkContextURL(options == null ? null : options.getContextURL());
- CircleStreamBuffer buffer = new CircleStreamBuffer();
- try {
- JsonGenerator json = new JsonFactory().createGenerator(buffer.getOutputStream());
- json.writeStartObject();
- if (contextURL != null) {
- json.writeStringField(Constants.JSON_CONTEXT, ContextURLBuilder.create(contextURL).toASCIIString());
- }
- final List<Property> values = property.isNull() ? Collections.<Property> emptyList() :
- property.isComplex() ? property.asComplex() : property.asLinkedComplex().getValue();
- writeProperties(type, values, options == null ? null : options.getSelect(), json);
- if (!property.isNull() && property.isLinkedComplex()) {
- writeNavigationProperties(type, property.asLinkedComplex(),
- options == null ? null : options.getExpand(), json);
- }
- json.writeEndObject();
- json.close();
- } catch (final IOException e) {
- throw new SerializerException("An I/O exception occurred.", e,
- SerializerException.MessageKeys.IO_EXCEPTION);
- }
- return buffer.getInputStream();
- }
-
- @Override
- public InputStream primitiveCollection(final EdmPrimitiveType type, final Property property,
- final PrimitiveSerializerOptions options) throws SerializerException {
- final ContextURL contextURL = checkContextURL(options == null ? null : options.getContextURL());
- CircleStreamBuffer buffer = new CircleStreamBuffer();
- try {
- JsonGenerator json = new JsonFactory().createGenerator(buffer.getOutputStream());
- json.writeStartObject();
- if (contextURL != null) {
- json.writeStringField(Constants.JSON_CONTEXT, ContextURLBuilder.create(contextURL).toASCIIString());
- }
- json.writeFieldName(Constants.VALUE);
- writePrimitiveCollection(type, property,
- options.isNullable(), options.getMaxLength(), options.getPrecision(), options.getScale(),
- options.isUnicode(),
- json);
- json.writeEndObject();
- json.close();
- } catch (final IOException e) {
- throw new SerializerException("An I/O exception occurred.", e,
- SerializerException.MessageKeys.IO_EXCEPTION);
- } catch (final EdmPrimitiveTypeException e) {
- throw new SerializerException("Wrong value for property!", e,
- SerializerException.MessageKeys.WRONG_PROPERTY_VALUE,
- property.getName(), property.getValue().toString());
- }
- return buffer.getInputStream();
- }
-
- @Override
- public InputStream complexCollection(final EdmComplexType type, final Property property,
- final ComplexSerializerOptions options) throws SerializerException {
- final ContextURL contextURL = checkContextURL(options == null ? null : options.getContextURL());
- CircleStreamBuffer buffer = new CircleStreamBuffer();
- try {
- JsonGenerator json = new JsonFactory().createGenerator(buffer.getOutputStream());
- json.writeStartObject();
- if (contextURL != null) {
- json.writeStringField(Constants.JSON_CONTEXT, ContextURLBuilder.create(contextURL).toASCIIString());
- }
- json.writeFieldName(Constants.VALUE);
- writeComplexCollection(type, property, null, json);
- json.writeEndObject();
- json.close();
- } catch (final IOException e) {
- throw new SerializerException("An I/O exception occurred.", e,
- SerializerException.MessageKeys.IO_EXCEPTION);
- } catch (final EdmPrimitiveTypeException e) {
- throw new SerializerException("Wrong value for property!", e,
- SerializerException.MessageKeys.WRONG_PROPERTY_VALUE,
- property.getName(), property.getValue().toString());
- }
- return buffer.getInputStream();
- }
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/json/ServiceDocumentJsonSerializer.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/json/ServiceDocumentJsonSerializer.java
deleted file mode 100644
index e2f7261..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/json/ServiceDocumentJsonSerializer.java
+++ /dev/null
@@ -1,108 +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.serializer.json;
-
-import java.io.IOException;
-
-import org.apache.olingo.commons.api.Constants;
-import org.apache.olingo.commons.api.edm.Edm;
-import org.apache.olingo.commons.api.edm.EdmEntityContainer;
-import org.apache.olingo.commons.api.edm.EdmEntitySet;
-import org.apache.olingo.commons.api.edm.EdmFunctionImport;
-import org.apache.olingo.commons.api.edm.EdmSingleton;
-
-import com.fasterxml.jackson.core.JsonGenerator;
-
-public class ServiceDocumentJsonSerializer {
- public static final String KIND = "kind";
-
- public static final String FUNCTION_IMPORT = "FunctionImport";
- public static final String SINGLETON = "Singleton";
- public static final String SERVICE_DOCUMENT = "ServiceDocument";
-
- private final Edm edm;
- private final String serviceRoot;
-
- public ServiceDocumentJsonSerializer(final Edm edm, final String serviceRoot) {
- this.edm = edm;
- this.serviceRoot = serviceRoot;
- }
-
- public void writeServiceDocument(final JsonGenerator gen) throws IOException {
- gen.writeStartObject();
-
- Object metadataUri;
-
- if (serviceRoot == null) {
- metadataUri = Constants.METADATA;
- } else {
- if (serviceRoot.endsWith("/")) {
- metadataUri = serviceRoot + Constants.METADATA;
- } else {
- metadataUri = serviceRoot + "/" + Constants.METADATA;
- }
- }
-
- gen.writeObjectField(Constants.JSON_CONTEXT, metadataUri);
- gen.writeArrayFieldStart(Constants.VALUE);
-
- writeEntitySets(gen, edm);
- writeFunctionImports(gen, edm);
- writeSingletons(gen, edm);
- }
-
- private void writeEntitySets(final JsonGenerator gen, final Edm edm) throws IOException {
- EdmEntityContainer container = edm.getEntityContainer(null);
-
- for (EdmEntitySet edmEntitySet : container.getEntitySets()) {
- if (edmEntitySet.isIncludeInServiceDocument()) {
- gen.writeStartObject();
- gen.writeObjectField(Constants.JSON_NAME, edmEntitySet.getName());
- gen.writeObjectField(Constants.JSON_URL, edmEntitySet.getName());
- gen.writeEndObject();
- }
- }
- }
-
- private void writeFunctionImports(final JsonGenerator gen, final Edm edm) throws IOException {
- EdmEntityContainer container = edm.getEntityContainer(null);
-
- for (EdmFunctionImport edmFunctionImport : container.getFunctionImports()) {
- if (edmFunctionImport.isIncludeInServiceDocument()) {
- gen.writeStartObject();
- gen.writeObjectField(Constants.JSON_NAME, edmFunctionImport.getName());
- gen.writeObjectField(Constants.JSON_URL, edmFunctionImport.getName());
- gen.writeObjectField(KIND, FUNCTION_IMPORT);
- gen.writeEndObject();
- }
- }
- }
-
- private void writeSingletons(final JsonGenerator gen, final Edm edm) throws IOException {
- EdmEntityContainer container = edm.getEntityContainer(null);
-
- for (EdmSingleton edmSingleton : container.getSingletons()) {
- gen.writeStartObject();
- gen.writeObjectField(Constants.JSON_NAME, edmSingleton.getName());
- gen.writeObjectField(Constants.JSON_URL, edmSingleton.getName());
- gen.writeObjectField(KIND, SINGLETON);
- gen.writeEndObject();
- }
- }
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/utils/CircleStreamBuffer.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/utils/CircleStreamBuffer.java
deleted file mode 100644
index 3bf8a7a..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/utils/CircleStreamBuffer.java
+++ /dev/null
@@ -1,327 +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.serializer.utils;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.nio.ByteBuffer;
-import java.util.Queue;
-import java.util.concurrent.LinkedBlockingQueue;
-
-/**
- * Circular stream buffer to write/read into/from one single buffer.
- * With support of {@link InputStream} and {@link OutputStream} access to buffered data.
- *
- *
- */
-public class CircleStreamBuffer {
-
- private static final int NEW_BUFFER_RESIZE_FACTOR = 2;
- private static final int READ_EOF = -1;
- private static final int DEFAULT_CAPACITY = 8192;
- private static final int MAX_CAPACITY = DEFAULT_CAPACITY * 32;
-
- private int currentAllocateCapacity = DEFAULT_CAPACITY;
-
- private boolean writeMode = true;
- private boolean writeClosed = false;
- private boolean readClosed = false;
-
- private Queue<ByteBuffer> bufferQueue = new LinkedBlockingQueue<ByteBuffer>();
- private ByteBuffer currentWriteBuffer;
-
- private InternalInputStream inStream;
- private InternalOutputStream outStream;
-
- /**
- * Creates a {@link CircleStreamBuffer} with default buffer size.
- */
- public CircleStreamBuffer() {
- this(DEFAULT_CAPACITY);
- }
-
- /**
- * Create a {@link CircleStreamBuffer} with given buffer size in bytes.
- *
- * @param bufferSize
- */
- public CircleStreamBuffer(final int bufferSize) {
- currentAllocateCapacity = bufferSize;
- createNewWriteBuffer();
- inStream = new InternalInputStream(this);
- outStream = new InternalOutputStream(this);
- }
-
- /**
- * Get {@link InputStream} for data read access.
- *
- * @return the stream
- */
- public InputStream getInputStream() {
- return inStream;
- }
-
- /**
- * Get {@link OutputStream} for write data.
- *
- * @return the stream
- */
- public OutputStream getOutputStream() {
- return outStream;
- }
-
- // #############################################
- // #
- // # Common parts
- // #
- // #############################################
-
- /**
- * Closes the write (input) part of the {@link CircleStreamBuffer}.
- * After this call the buffer can only be read out.
- */
- public void closeWrite() {
- writeClosed = true;
- }
-
- /**
- * Closes the read (output) part of the {@link CircleStreamBuffer}.
- * After this call it is possible to write into the buffer (but can never be read out).
- */
- public void closeRead() {
- readClosed = true;
- // clear references to byte buffers
- ByteBuffer buffer = bufferQueue.poll();
- while (buffer != null) {
- buffer.clear();
- buffer = bufferQueue.poll();
- }
- }
-
- /**
- * Closes write and read part (and hence the complete buffer).
- */
- public void close() {
- closeWrite();
- closeRead();
- }
-
- private int remaining() throws IOException {
- if (writeMode) {
- return currentWriteBuffer.remaining();
- } else {
- ByteBuffer toRead = getReadBuffer();
- if (toRead == null) {
- return 0;
- }
- return toRead.remaining();
- }
- }
-
- // #############################################
- // #
- // # Reading parts
- // #
- // #############################################
-
- private ByteBuffer getReadBuffer() throws IOException {
- if (readClosed) {
- throw new IOException("Tried to read from closed stream.");
- }
-
- boolean next = false;
- ByteBuffer tmp = null;
- if (writeMode) {
- writeMode = false;
- next = true;
- } else {
- tmp = bufferQueue.peek();
- if (tmp != null && !tmp.hasRemaining()) {
- tmp = bufferQueue.poll();
- next = true;
- }
- }
-
- if (next) {
- tmp = bufferQueue.peek();
- if (tmp != null) {
- tmp.flip();
- }
- tmp = getReadBuffer();
- }
-
- return tmp;
- }
-
- private int read(final byte[] b, final int off, final int len) throws IOException {
- ByteBuffer readBuffer = getReadBuffer();
- if (readBuffer == null) {
- return READ_EOF;
- }
-
- int toReadLength = readBuffer.remaining();
- if (len < toReadLength) {
- toReadLength = len;
- }
- readBuffer.get(b, off, toReadLength);
- return toReadLength;
- }
-
- private int read() throws IOException {
- ByteBuffer readBuffer = getReadBuffer();
- if (readBuffer == null) {
- return READ_EOF;
- }
-
- return readBuffer.get();
- }
-
- // #############################################
- // #
- // # Writing parts
- // #
- // #############################################
-
- private void write(final byte[] data, final int off, final int len) throws IOException {
- ByteBuffer writeBuffer = getWriteBuffer(len);
- writeBuffer.put(data, off, len);
- }
-
- private ByteBuffer getWriteBuffer(final int size) throws IOException {
- if (writeClosed) {
- throw new IOException("Tried to write into closed stream.");
- }
-
- if (writeMode) {
- if (remaining() < size) {
- createNewWriteBuffer(size);
- }
- } else {
- writeMode = true;
- createNewWriteBuffer();
- }
-
- return currentWriteBuffer;
- }
-
- private void write(final int b) throws IOException {
- ByteBuffer writeBuffer = getWriteBuffer(1);
- writeBuffer.put((byte) b);
- }
-
- private void createNewWriteBuffer() {
- createNewWriteBuffer(currentAllocateCapacity);
- }
-
- /**
- * Creates a new buffer (per {@link #allocateBuffer(int)}) with the requested capacity as minimum capacity, add the
- * new allocated
- * buffer to the {@link #bufferQueue} and set it as {@link #currentWriteBuffer}.
- *
- * @param requestedCapacity minimum capacity for new allocated buffer
- */
- private void createNewWriteBuffer(final int requestedCapacity) {
- ByteBuffer b = allocateBuffer(requestedCapacity);
- bufferQueue.add(b);
- currentWriteBuffer = b;
- }
-
- /**
- *
- * @param requestedCapacity
- * @return the buffer
- */
- private ByteBuffer allocateBuffer(final int requestedCapacity) {
- int allocateCapacity = requestedCapacity;
- if (allocateCapacity < currentAllocateCapacity) {
- allocateCapacity = currentAllocateCapacity * NEW_BUFFER_RESIZE_FACTOR;
- }
- if (allocateCapacity > MAX_CAPACITY) {
- allocateCapacity = MAX_CAPACITY;
- }
- // update current
- currentAllocateCapacity = allocateCapacity;
- return ByteBuffer.allocate(allocateCapacity);
- }
-
- // #############################################
- // #
- // # Inner classes (streams)
- // #
- // #############################################
-
- /**
- *
- */
- private static class InternalInputStream extends InputStream {
-
- private final CircleStreamBuffer inBuffer;
-
- public InternalInputStream(final CircleStreamBuffer csBuffer) {
- inBuffer = csBuffer;
- }
-
- @Override
- public int available() throws IOException {
- return inBuffer.remaining();
- }
-
- @Override
- public int read() throws IOException {
- return inBuffer.read();
- }
-
- @Override
- public int read(final byte[] b, final int off, final int len) throws IOException {
- return inBuffer.read(b, off, len);
- }
-
- @Override
- public void close() throws IOException {
- inBuffer.closeRead();
- }
- }
-
- /**
- *
- */
- private static class InternalOutputStream extends OutputStream {
- private final CircleStreamBuffer outBuffer;
-
- public InternalOutputStream(final CircleStreamBuffer csBuffer) {
- outBuffer = csBuffer;
- }
-
- @Override
- public void write(final int b) throws IOException {
- outBuffer.write(b);
- }
-
- @Override
- public void write(final byte[] b, final int off, final int len) throws IOException {
- outBuffer.write(b, off, len);
- }
-
- @Override
- public void close() throws IOException {
- outBuffer.closeWrite();
- }
- }
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/utils/ContextURLBuilder.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/utils/ContextURLBuilder.java
deleted file mode 100644
index 4a3f82a..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/utils/ContextURLBuilder.java
+++ /dev/null
@@ -1,78 +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.serializer.utils;
-
-import java.net.URI;
-
-import org.apache.olingo.commons.api.Constants;
-import org.apache.olingo.commons.api.data.ContextURL;
-import org.apache.olingo.commons.core.Encoder;
-
-/**
- * Builder to build a context URL (as defined in the <a
- * href="http://docs.oasis-open.org/odata/odata/v4.0/os/part1-protocol/odata-v4.0-os-part1-protocol.html#_Toc372793655">
- * protocol specification</a>).
- */
-public final class ContextURLBuilder {
-
- public static URI create(final ContextURL contextURL) {
- StringBuilder result = new StringBuilder();
- if (contextURL.getServiceRoot() != null) {
- result.append(contextURL.getServiceRoot());
- }
- result.append(Constants.METADATA);
- if (contextURL.getEntitySetOrSingletonOrType() != null) {
- result.append('#');
- if(contextURL.isCollection()) {
- result.append("Collection(")
- .append(Encoder.encode(contextURL.getEntitySetOrSingletonOrType()))
- .append(")");
- } else {
- result.append(Encoder.encode(contextURL.getEntitySetOrSingletonOrType()));
- }
- }
- if (contextURL.getDerivedEntity() != null) {
- if (contextURL.getEntitySetOrSingletonOrType() == null) {
- throw new IllegalArgumentException("ContextURL: Derived Type without anything to derive from!");
- }
- result.append('/').append(Encoder.encode(contextURL.getDerivedEntity()));
- }
- if (contextURL.getKeyPath() != null) {
- result.append('(').append(contextURL.getKeyPath()).append(')');
- }
- if (contextURL.getNavOrPropertyPath() != null) {
- result.append('/').append(contextURL.getNavOrPropertyPath());
- }
- if (contextURL.getSelectList() != null) {
- result.append('(').append(contextURL.getSelectList()).append(')');
- }
- if (contextURL.isReference()) {
- if (contextURL.getEntitySetOrSingletonOrType() != null) {
- throw new IllegalArgumentException("ContextURL: $ref with Entity Set");
- }
- result.append('#').append(ContextURL.Suffix.REFERENCE.getRepresentation());
- } else if (contextURL.getSuffix() != null) {
- if (contextURL.getEntitySetOrSingletonOrType() == null) {
- throw new IllegalArgumentException("ContextURL: Suffix without preceding Entity Set!");
- }
- result.append('/').append(contextURL.getSuffix().getRepresentation());
- }
- return URI.create(result.toString());
- }
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/utils/ContextURLHelper.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/utils/ContextURLHelper.java
deleted file mode 100644
index e9eb880..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/utils/ContextURLHelper.java
+++ /dev/null
@@ -1,168 +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.serializer.utils;
-
-import java.util.ArrayList;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Set;
-
-import org.apache.olingo.commons.api.edm.EdmComplexType;
-import org.apache.olingo.commons.api.edm.EdmProperty;
-import org.apache.olingo.commons.api.edm.EdmStructuredType;
-import org.apache.olingo.commons.core.Encoder;
-import org.apache.olingo.server.api.serializer.SerializerException;
-import org.apache.olingo.server.api.uri.UriParameter;
-import org.apache.olingo.server.api.uri.queryoption.ExpandItem;
-import org.apache.olingo.server.api.uri.queryoption.ExpandOption;
-import org.apache.olingo.server.api.uri.queryoption.SelectItem;
-import org.apache.olingo.server.api.uri.queryoption.SelectOption;
-
-public final class ContextURLHelper {
-
- /** Builds a list of selected Properties for the ContextURL,
- * taking care to preserve the order as defined in the EDM;
- * returns NULL if no selection has taken place.
- * @param type the structured type
- * @param expand the Expand option (from the URL's $expand query option)
- * @param select the Select option (from the URL's $select query option)
- * @return a select-list String
- * @throws SerializerException if an unsupported feature is used
- */
- public static String buildSelectList(final EdmStructuredType type,
- final ExpandOption expand, final SelectOption select) throws SerializerException {
- StringBuilder result = new StringBuilder();
- if (ExpandSelectHelper.hasSelect(select)) {
- handleSelect(type, select, result);
- }
-
- if (ExpandSelectHelper.hasExpand(expand) && !ExpandSelectHelper.isExpandAll(expand)) {
- handleExpand(type, expand, result);
- }
- return result.length() == 0 ? null : result.toString();
- }
-
- private static void handleSelect(final EdmStructuredType type, final SelectOption select, StringBuilder result) {
- if (ExpandSelectHelper.isAll(select)) {
- result.append('*');
- } else {
- final List<SelectItem> selectItems = select.getSelectItems();
- final Set<String> selectedPropertyNames = ExpandSelectHelper.getSelectedPropertyNames(selectItems);
- for (final String propertyName : type.getPropertyNames()) {
- if (selectedPropertyNames.contains(propertyName)) {
- if (result.length() > 0) {
- result.append(',');
- }
- final EdmProperty edmProperty = type.getStructuralProperty(propertyName);
- final Set<List<String>> selectedPaths = ExpandSelectHelper.getSelectedPaths(selectItems, propertyName);
- if (selectedPaths == null) {
- result.append(Encoder.encode(propertyName));
- } else {
- final List<List<String>> complexSelectedPaths = getComplexSelectedPaths(edmProperty, selectedPaths);
- boolean first = true;
- for (final List<String> path : complexSelectedPaths) {
- if (first) {
- first = false;
- } else {
- result.append(',');
- }
- boolean innerFirst = true;
- for (final String name : path) {
- if (innerFirst) {
- innerFirst = false;
- } else {
- result.append('/');
- }
- result.append(Encoder.encode(name));
- }
- }
- }
- }
- }
- }
- }
-
- private static void handleExpand(final EdmStructuredType type, final ExpandOption expand, StringBuilder result)
- throws SerializerException {
- final Set<String> expandedPropertyNames = ExpandSelectHelper.getExpandedPropertyNames(expand.getExpandItems());
- for (final String propertyName : type.getNavigationPropertyNames()) {
- if (expandedPropertyNames.contains(propertyName)) {
- final ExpandItem expandItem = ExpandSelectHelper.getExpandItem(expand.getExpandItems(), propertyName);
- if (ExpandSelectHelper.hasExpand(expandItem.getExpandOption())
- && !ExpandSelectHelper.isExpandAll(expandItem.getExpandOption())
- || ExpandSelectHelper.hasSelect(expandItem.getSelectOption())) {
- final String innerSelectList = buildSelectList(type.getNavigationProperty(propertyName).getType(),
- expandItem.getExpandOption(), expandItem.getSelectOption());
- if (innerSelectList != null) {
- if (result.length() > 0) {
- result.append(',');
- }
- result.append(Encoder.encode(propertyName)).append('(').append(innerSelectList).append(')');
- }
- }
- }
- }
- }
-
- private static List<List<String>> getComplexSelectedPaths(final EdmProperty edmProperty,
- final Set<List<String>> selectedPaths) {
- List<List<String>> result = new ArrayList<List<String>>();
- if (selectedPaths == null) {
- List<String> path = new LinkedList<String>();
- path.add(edmProperty.getName());
- result.add(path);
- } else {
- final EdmComplexType type = (EdmComplexType) edmProperty.getType();
- for (final String complexPropertyName : type.getPropertyNames()) {
- if (ExpandSelectHelper.isSelected(selectedPaths, complexPropertyName)) {
- List<List<String>> complexSelectedPaths = getComplexSelectedPaths(
- (EdmProperty) type.getProperty(complexPropertyName),
- ExpandSelectHelper.getReducedSelectedPaths(selectedPaths, complexPropertyName));
- for (final List<String> path : complexSelectedPaths) {
- path.add(0, edmProperty.getName());
- result.add(path);
- }
- }
- }
- }
- return result;
- }
-
- /**
- * Builds a key predicate for the ContextURL.
- * @param keys the keys as a list of {@link UriParameter} instances
- * @return a String with the key predicate
- */
- public static String buildKeyPredicate(List<UriParameter> keys) throws SerializerException {
- if (keys == null || keys.isEmpty()) {
- return null;
- } else if (keys.size() == 1) {
- return Encoder.encode(keys.get(0).getText());
- } else {
- StringBuilder result = new StringBuilder();
- for (final UriParameter key : keys) {
- if (result.length() > 0) {
- result.append(',');
- }
- result.append(Encoder.encode(key.getName())).append('=').append(Encoder.encode(key.getText()));
- }
- return result.toString();
- }
- }
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/utils/ExpandSelectHelper.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/utils/ExpandSelectHelper.java
deleted file mode 100644
index c537fbd..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/utils/ExpandSelectHelper.java
+++ /dev/null
@@ -1,155 +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.serializer.utils;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.apache.olingo.server.api.serializer.SerializerException;
-import org.apache.olingo.server.api.uri.UriResource;
-import org.apache.olingo.server.api.uri.UriResourceNavigation;
-import org.apache.olingo.server.api.uri.UriResourceProperty;
-import org.apache.olingo.server.api.uri.queryoption.ExpandItem;
-import org.apache.olingo.server.api.uri.queryoption.ExpandOption;
-import org.apache.olingo.server.api.uri.queryoption.SelectItem;
-import org.apache.olingo.server.api.uri.queryoption.SelectOption;
-
-public abstract class ExpandSelectHelper {
-
- public static boolean hasSelect(final SelectOption select) {
- return select != null && select.getSelectItems() != null && !select.getSelectItems().isEmpty();
- }
-
- public static boolean isAll(final SelectOption select) {
- if (hasSelect(select)) {
- for (final SelectItem item : select.getSelectItems()) {
- if (item.isStar()) {
- return true;
- }
- }
- return false;
- } else {
- return true;
- }
- }
-
- public static Set<String> getSelectedPropertyNames(final List<SelectItem> selectItems) {
- Set<String> selected = new HashSet<String>();
- for (final SelectItem item : selectItems) {
- final UriResource resource = item.getResourcePath().getUriResourceParts().get(0);
- if (resource instanceof UriResourceProperty) {
- selected.add(((UriResourceProperty) resource).getProperty().getName());
- }
- }
- return selected;
- }
-
- public static Set<List<String>> getSelectedPaths(final List<SelectItem> selectItems, final String propertyName) {
- Set<List<String>> selectedPaths = new HashSet<List<String>>();
- for (final SelectItem item : selectItems) {
- final List<UriResource> parts = item.getResourcePath().getUriResourceParts();
- final UriResource resource = parts.get(0);
- if (resource instanceof UriResourceProperty
- && propertyName.equals(((UriResourceProperty) resource).getProperty().getName())) {
- if (parts.size() > 1) {
- List<String> path = new ArrayList<String>();
- for (final UriResource part : parts.subList(1, parts.size())) {
- if (part instanceof UriResourceProperty) {
- path.add(((UriResourceProperty) part).getProperty().getName());
- }
- }
- selectedPaths.add(path);
- } else {
- return null;
- }
- }
- }
- return selectedPaths.isEmpty() ? null : selectedPaths;
- }
-
-
- public static boolean isSelected(final Set<List<String>> selectedPaths, final String propertyName) {
- for (final List<String> path : selectedPaths) {
- if (propertyName.equals(path.get(0))) {
- return true;
- }
- }
- return false;
- }
-
- public static Set<List<String>> getReducedSelectedPaths(final Set<List<String>> selectedPaths,
- final String propertyName) {
- Set<List<String>> reducedPaths = new HashSet<List<String>>();
- for (final List<String> path : selectedPaths) {
- if (propertyName.equals(path.get(0))) {
- if (path.size() > 1) {
- reducedPaths.add(path.subList(1, path.size()));
- } else {
- return null;
- }
- }
- }
- return reducedPaths.isEmpty() ? null : reducedPaths;
- }
-
- public static boolean hasExpand(final ExpandOption expand) {
- return expand != null && expand.getExpandItems() != null && !expand.getExpandItems().isEmpty();
- }
-
- public static boolean isExpandAll(final ExpandOption expand) {
- for (final ExpandItem item : expand.getExpandItems()) {
- if (item.isStar()) {
- return true;
- }
- }
- return false;
- }
-
- public static Set<String> getExpandedPropertyNames(final List<ExpandItem> expandItems)
- throws SerializerException {
- Set<String> expanded = new HashSet<String>();
- for (final ExpandItem item : expandItems) {
- final List<UriResource> resourceParts = item.getResourcePath().getUriResourceParts();
- if (resourceParts.size() == 1) {
- final UriResource resource = resourceParts.get(0);
- if (resource instanceof UriResourceNavigation) {
- expanded.add(((UriResourceNavigation) resource).getProperty().getName());
- }
- } else {
- throw new SerializerException("Expand is not supported within complex properties.",
- SerializerException.MessageKeys.NOT_IMPLEMENTED);
- }
- }
- return expanded;
- }
-
- public static ExpandItem getExpandItem(final List<ExpandItem> expandItems, final String propertyName) {
- for (final ExpandItem item : expandItems) {
- final UriResource resource = item.getResourcePath().getUriResourceParts().get(0);
- if (resource instanceof UriResourceNavigation
- && propertyName.equals(((UriResourceNavigation) resource).getProperty().getName())) {
- return item;
- }
- }
- return null;
- }
-
-}
\ No newline at end of file
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentXmlSerializer.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentXmlSerializer.java
deleted file mode 100644
index 25610fb..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentXmlSerializer.java
+++ /dev/null
@@ -1,645 +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.serializer.xml;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamWriter;
-
-import org.apache.olingo.commons.api.edm.EdmAction;
-import org.apache.olingo.commons.api.edm.EdmActionImport;
-import org.apache.olingo.commons.api.edm.EdmBindingTarget;
-import org.apache.olingo.commons.api.edm.EdmComplexType;
-import org.apache.olingo.commons.api.edm.EdmEntityContainer;
-import org.apache.olingo.commons.api.edm.EdmEntitySet;
-import org.apache.olingo.commons.api.edm.EdmEntityType;
-import org.apache.olingo.commons.api.edm.EdmEnumType;
-import org.apache.olingo.commons.api.edm.EdmFunction;
-import org.apache.olingo.commons.api.edm.EdmFunctionImport;
-import org.apache.olingo.commons.api.edm.EdmKeyPropertyRef;
-import org.apache.olingo.commons.api.edm.EdmNavigationProperty;
-import org.apache.olingo.commons.api.edm.EdmNavigationPropertyBinding;
-import org.apache.olingo.commons.api.edm.EdmOperation;
-import org.apache.olingo.commons.api.edm.EdmParameter;
-import org.apache.olingo.commons.api.edm.EdmProperty;
-import org.apache.olingo.commons.api.edm.EdmReferentialConstraint;
-import org.apache.olingo.commons.api.edm.EdmReturnType;
-import org.apache.olingo.commons.api.edm.EdmSchema;
-import org.apache.olingo.commons.api.edm.EdmSingleton;
-import org.apache.olingo.commons.api.edm.EdmStructuredType;
-import org.apache.olingo.commons.api.edm.EdmType;
-import org.apache.olingo.commons.api.edm.EdmTypeDefinition;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
-import org.apache.olingo.server.api.ServiceMetadata;
-import org.apache.olingo.server.api.edmx.EdmxReference;
-import org.apache.olingo.server.api.edmx.EdmxReferenceInclude;
-import org.apache.olingo.server.api.edmx.EdmxReferenceIncludeAnnotation;
-import org.apache.olingo.server.api.serializer.ODataSerializer;
-
-public class MetadataDocumentXmlSerializer {
-
- private static final String TRUE = "true";
- private static final String XML_EXTENDS = "Extends";
- private static final String XML_TARGET = "Target";
- private static final String XML_PATH = "Path";
- private static final String XML_NAVIGATION_PROPERTY_BINDING = "NavigationPropertyBinding";
- private static final String XML_VALUE = "Value";
- private static final String XML_MEMBER = "Member";
- private static final String XML_UNDERLYING_TYPE = "UnderlyingType";
- private static final String XML_IS_FLAGS = "IsFlags";
- private static final String XML_ENUM_TYPE = "EnumType";
- private static final String XML_PROPERTY_REF = "PropertyRef";
- private static final String XML_KEY = "Key";
- private static final String XML_SCALE = "Scale";
- private static final String XML_PRECISION = "Precision";
- private static final String XML_MAX_LENGTH = "MaxLength";
- private static final String XML_DEFAULT_VALUE = "DefaultValue";
- private static final String XML_UNICODE = "Unicode";
- private static final String XML_PROPERTY = "Property";
- private static final String XML_PARTNER = "Partner";
- private static final String XML_NULLABLE = "Nullable";
- private static final String XML_NAVIGATION_PROPERTY = "NavigationProperty";
- private static final String XML_HAS_STREAM = "HasStream";
- private static final String XML_BASE_TYPE = "BaseType";
- private static final String XML_COMPLEX_TYPE = "ComplexType";
- private static final String XML_RETURN_TYPE = "ReturnType";
- private static final String XML_TYPE = "Type";
- private static final String XML_PARAMETER = "Parameter";
- private static final String XML_IS_COMPOSABLE = "IsComposable";
- private static final String XML_IS_BOUND = "IsBound";
- private static final String XML_ENTITY_TYPE = "EntityType";
- private static final String XML_SINGLETON = "Singleton";
- private static final String XML_ACTION = "Action";
- private static final String XML_ACTION_IMPORT = "ActionImport";
- private static final String XML_INCLUDE_IN_SERVICE_DOCUMENT = "IncludeInServiceDocument";
- private static final String XML_ENTITY_SET = "EntitySet";
- private static final String XML_FUNCTION = "Function";
- private static final String XML_FUNCTION_IMPORT = "FunctionImport";
- private static final String XML_NAME = "Name";
- private static final String XML_ENTITY_CONTAINER = "EntityContainer";
- private static final String XML_ALIAS = "Alias";
- private static final String XML_NAMESPACE = "Namespace";
- private static final String XML_TYPE_DEFINITION = "TypeDefinition";
- private static final String REFERENCE = "Reference";
- private static final String INCLUDE = "Include";
- private static final String INCLUDE_ANNOTATIONS = "IncludeAnnotations";
- private static final String XML_TERM_NAMESPACE = "TermNamespace";
- private static final String XML_TARGET_NAMESPACE = "TargetNamespace";
- private static final String XML_QUALIFIER = "Qualifier";
- private static final String URI = "Uri";
- private static final String SCHEMA = "Schema";
- private static final String DATA_SERVICES = "DataServices";
- private static final String ABSTRACT = "Abstract";
-
- private final static String EDMX = "Edmx";
- private final static String PREFIX_EDMX = "edmx";
- private final static String NS_EDMX = "http://docs.oasis-open.org/odata/ns/edmx";
-
- private final static String NS_EDM = "http://docs.oasis-open.org/odata/ns/edm";
-
- private final ServiceMetadata serviceMetadata;
- private final Map<String, String> namespaceToAlias = new HashMap<String, String>();
-
- public MetadataDocumentXmlSerializer(final ServiceMetadata serviceMetadata) {
- this.serviceMetadata = serviceMetadata;
- }
-
- public void writeMetadataDocument(final XMLStreamWriter writer) throws XMLStreamException {
- writer.writeStartDocument(ODataSerializer.DEFAULT_CHARSET, "1.0");
- writer.setPrefix(PREFIX_EDMX, NS_EDMX);
- writer.setDefaultNamespace(NS_EDMX);
- writer.writeStartElement(PREFIX_EDMX, EDMX, NS_EDMX);
- writer.writeAttribute("Version", "4.0");
- writer.writeNamespace(PREFIX_EDMX, NS_EDMX);
-
- appendReference(writer);
- appendDataServices(writer);
-
- writer.writeEndDocument();
- }
-
- private void appendDataServices(final XMLStreamWriter writer) throws XMLStreamException {
- writer.setDefaultNamespace(NS_EDM);
- writer.writeStartElement(NS_EDMX, DATA_SERVICES);
- for (EdmSchema schema : serviceMetadata.getEdm().getSchemas()) {
- appendSchema(writer, schema);
- }
- writer.writeEndElement();
- }
-
- private void appendSchema(final XMLStreamWriter writer, final EdmSchema schema) throws XMLStreamException {
- writer.writeStartElement(NS_EDM, SCHEMA);
- writer.writeDefaultNamespace(NS_EDM);
- writer.writeAttribute(XML_NAMESPACE, schema.getNamespace());
- if (schema.getAlias() != null) {
- writer.writeAttribute(XML_ALIAS, schema.getAlias());
- namespaceToAlias.put(schema.getNamespace(), schema.getAlias());
- }
-
- // EnumTypes
- appendEnumTypes(writer, schema.getEnumTypes());
-
- // EntityTypes
- appendEntityTypes(writer, schema.getEntityTypes());
-
- // ComplexTypes
- appendComplexTypes(writer, schema.getComplexTypes());
-
- // TypeDefinitions
- appendTypeDefinitions(writer, schema.getTypeDefinitions());
-
- // Actions
- appendActions(writer, schema.getActions());
-
- // Functions
- appendFunctions(writer, schema.getFunctions());
-
- // EntityContainer
- appendEntityContainer(writer, schema.getEntityContainer());
-
- writer.writeEndElement();
- }
-
- private void appendTypeDefinitions(final XMLStreamWriter writer, final List<EdmTypeDefinition> typeDefinitions)
- throws XMLStreamException {
- for (EdmTypeDefinition definition : typeDefinitions) {
- writer.writeEmptyElement(XML_TYPE_DEFINITION);
- writer.writeAttribute(XML_NAME, definition.getName());
- writer.writeAttribute(XML_UNDERLYING_TYPE, getFullQualifiedName(definition.getUnderlyingType(), false));
-
- // Facets
- if (definition.getMaxLength() != null) {
- writer.writeAttribute(XML_MAX_LENGTH, "" + definition.getMaxLength());
- }
-
- if (definition.getPrecision() != null) {
- writer.writeAttribute(XML_PRECISION, "" + definition.getPrecision());
- }
-
- if (definition.getScale() != null) {
- writer.writeAttribute(XML_SCALE, "" + definition.getScale());
- }
- }
- }
-
- private void appendEntityContainer(final XMLStreamWriter writer, final EdmEntityContainer container)
- throws XMLStreamException {
- if (container != null) {
- writer.writeStartElement(XML_ENTITY_CONTAINER);
-
- writer.writeAttribute(XML_NAME, container.getName());
- FullQualifiedName parentContainerName = container.getParentContainerName();
- if (parentContainerName != null) {
- String parentContainerNameString;
- if (namespaceToAlias.get(parentContainerName.getNamespace()) != null) {
- parentContainerNameString =
- namespaceToAlias.get(parentContainerName.getNamespace()) + "." + parentContainerName.getName();
- } else {
- parentContainerNameString = parentContainerName.getFullQualifiedNameAsString();
- }
- writer.writeAttribute(XML_EXTENDS, parentContainerNameString);
- }
-
- // EntitySets
- appendEntitySets(writer, container.getEntitySets());
-
- // Singletons
- appendSingletons(writer, container.getSingletons());
-
- // ActionImports
- appendActionImports(writer, container.getActionImports());
-
- // FunctionImports
- String containerNamespace;
- if (namespaceToAlias.get(container.getNamespace()) != null) {
- containerNamespace = namespaceToAlias.get(container.getNamespace());
- } else {
- containerNamespace = container.getNamespace();
- }
- appendFunctionImports(writer, container.getFunctionImports(), containerNamespace);
-
- writer.writeEndElement();
- }
- }
-
- private void appendFunctionImports(final XMLStreamWriter writer, final List<EdmFunctionImport> functionImports,
- final String containerNamespace) throws XMLStreamException {
- for (EdmFunctionImport functionImport : functionImports) {
- writer.writeStartElement(XML_FUNCTION_IMPORT);
- writer.writeAttribute(XML_NAME, functionImport.getName());
-
- String functionFQNString;
- FullQualifiedName functionFqn = functionImport.getFunctionFqn();
- if (namespaceToAlias.get(functionFqn.getNamespace()) != null) {
- functionFQNString = namespaceToAlias.get(functionFqn.getNamespace()) + "." + functionFqn.getName();
- } else {
- functionFQNString = functionFqn.getFullQualifiedNameAsString();
- }
- writer.writeAttribute(XML_FUNCTION, functionFQNString);
-
- EdmEntitySet returnedEntitySet = functionImport.getReturnedEntitySet();
- if (returnedEntitySet != null) {
- writer.writeAttribute(XML_ENTITY_SET, containerNamespace + "." + returnedEntitySet.getName());
- }
- writer.writeAttribute(XML_INCLUDE_IN_SERVICE_DOCUMENT, "" + functionImport.isIncludeInServiceDocument());
-
- // TODO: Annotations
- writer.writeEndElement();
- }
- }
-
- private void appendActionImports(final XMLStreamWriter writer, final List<EdmActionImport> actionImports)
- throws XMLStreamException {
- for (EdmActionImport actionImport : actionImports) {
- writer.writeStartElement(XML_ACTION_IMPORT);
- writer.writeAttribute(XML_NAME, actionImport.getName());
- writer.writeAttribute(XML_ACTION, getAliasedFullQualifiedName(actionImport.getUnboundAction(), false));
- // TODO: Annotations
- writer.writeEndElement();
- }
- }
-
- private void appendSingletons(final XMLStreamWriter writer, final List<EdmSingleton> singletons)
- throws XMLStreamException {
- for (EdmSingleton singleton : singletons) {
- writer.writeStartElement(XML_SINGLETON);
- writer.writeAttribute(XML_NAME, singleton.getName());
- writer.writeAttribute(XML_ENTITY_TYPE, getAliasedFullQualifiedName(singleton.getEntityType(), false));
-
- appendNavigationPropertyBindings(writer, singleton);
- // TODO: Annotations
- writer.writeEndElement();
- }
-
- }
-
- private void appendNavigationPropertyBindings(final XMLStreamWriter writer, final EdmBindingTarget bindingTarget)
- throws XMLStreamException {
- if (bindingTarget.getNavigationPropertyBindings() != null) {
- for (EdmNavigationPropertyBinding binding : bindingTarget.getNavigationPropertyBindings()) {
- writer.writeEmptyElement(XML_NAVIGATION_PROPERTY_BINDING);
- writer.writeAttribute(XML_PATH, binding.getPath());
- writer.writeAttribute(XML_TARGET, binding.getTarget());
- }
- }
- }
-
- private void appendEntitySets(final XMLStreamWriter writer, final List<EdmEntitySet> entitySets)
- throws XMLStreamException {
- for (EdmEntitySet entitySet : entitySets) {
- writer.writeStartElement(XML_ENTITY_SET);
- writer.writeAttribute(XML_NAME, entitySet.getName());
- writer.writeAttribute(XML_ENTITY_TYPE, getAliasedFullQualifiedName(entitySet.getEntityType(), false));
-
- appendNavigationPropertyBindings(writer, entitySet);
- // TODO: Annotations
- writer.writeEndElement();
- }
- }
-
- private void appendFunctions(final XMLStreamWriter writer, final List<EdmFunction> functions)
- throws XMLStreamException {
- for (EdmFunction function : functions) {
- writer.writeStartElement(XML_FUNCTION);
- writer.writeAttribute(XML_NAME, function.getName());
- // TODO: EntitySetPath
- writer.writeAttribute(XML_IS_BOUND, "" + function.isBound());
- writer.writeAttribute(XML_IS_COMPOSABLE, "" + function.isComposable());
-
- appendOperationParameters(writer, function);
-
- appendOperationReturnType(writer, function);
-
- writer.writeEndElement();
- }
- }
-
- private void appendOperationReturnType(final XMLStreamWriter writer, final EdmOperation operation)
- throws XMLStreamException {
- EdmReturnType returnType = operation.getReturnType();
- if (returnType != null) {
- writer.writeEmptyElement(XML_RETURN_TYPE);
- String returnTypeFqnString;
- if (EdmTypeKind.PRIMITIVE.equals(returnType.getType().getKind())) {
- returnTypeFqnString = getFullQualifiedName(returnType.getType(), returnType.isCollection());
- } else {
- returnTypeFqnString = getAliasedFullQualifiedName(returnType.getType(), returnType.isCollection());
- }
- writer.writeAttribute(XML_TYPE, returnTypeFqnString);
-
- appendReturnTypeFacets(writer, returnType);
- }
- }
-
- private void appendOperationParameters(final XMLStreamWriter writer, final EdmOperation operation)
- throws XMLStreamException {
- for (String parameterName : operation.getParameterNames()) {
- EdmParameter parameter = operation.getParameter(parameterName);
- writer.writeEmptyElement(XML_PARAMETER);
- writer.writeAttribute(XML_NAME, parameterName);
- String typeFqnString;
- if (EdmTypeKind.PRIMITIVE.equals(parameter.getType().getKind())) {
- typeFqnString = getFullQualifiedName(parameter.getType(), parameter.isCollection());
- } else {
- typeFqnString = getAliasedFullQualifiedName(parameter.getType(), parameter.isCollection());
- }
- writer.writeAttribute(XML_TYPE, typeFqnString);
-
- appendParameterFacets(writer, parameter);
- }
- }
-
- private void appendActions(final XMLStreamWriter writer, final List<EdmAction> actions) throws XMLStreamException {
- for (EdmAction action : actions) {
- writer.writeStartElement(XML_ACTION);
- writer.writeAttribute(XML_NAME, action.getName());
- writer.writeAttribute(XML_IS_BOUND, "" + action.isBound());
-
- appendOperationParameters(writer, action);
-
- appendOperationReturnType(writer, action);
-
- writer.writeEndElement();
- }
- }
-
- private void appendReturnTypeFacets(final XMLStreamWriter writer, final EdmReturnType returnType)
- throws XMLStreamException {
- if (returnType.isNullable() != null) {
- writer.writeAttribute(XML_NULLABLE, "" + returnType.isNullable());
- }
- if (returnType.getMaxLength() != null) {
- writer.writeAttribute(XML_MAX_LENGTH, "" + returnType.getMaxLength());
- }
- if (returnType.getPrecision() != null) {
- writer.writeAttribute(XML_PRECISION, "" + returnType.getPrecision());
- }
- if (returnType.getScale() != null) {
- writer.writeAttribute(XML_SCALE, "" + returnType.getScale());
- }
- }
-
- private void appendParameterFacets(final XMLStreamWriter writer, final EdmParameter parameter)
- throws XMLStreamException {
- if (parameter.isNullable() != null) {
- writer.writeAttribute(XML_NULLABLE, "" + parameter.isNullable());
- }
- if (parameter.getMaxLength() != null) {
- writer.writeAttribute(XML_MAX_LENGTH, "" + parameter.getMaxLength());
- }
- if (parameter.getPrecision() != null) {
- writer.writeAttribute(XML_PRECISION, "" + parameter.getPrecision());
- }
- if (parameter.getScale() != null) {
- writer.writeAttribute(XML_SCALE, "" + parameter.getScale());
- }
- }
-
- private void appendComplexTypes(final XMLStreamWriter writer, final List<EdmComplexType> complexTypes)
- throws XMLStreamException {
- for (EdmComplexType complexType : complexTypes) {
- writer.writeStartElement(XML_COMPLEX_TYPE);
- writer.writeAttribute(XML_NAME, complexType.getName());
-
- if (complexType.getBaseType() != null) {
- writer.writeAttribute(XML_BASE_TYPE, getAliasedFullQualifiedName(complexType.getBaseType(), false));
- }
-
- if(complexType.isAbstract()) {
- writer.writeAttribute(ABSTRACT, TRUE);
- }
-
- appendProperties(writer, complexType);
-
- appendNavigationProperties(writer, complexType);
-
- writer.writeEndElement();
- }
- }
-
- private void appendEntityTypes(final XMLStreamWriter writer, final List<EdmEntityType> entityTypes)
- throws XMLStreamException {
- for (EdmEntityType entityType : entityTypes) {
- writer.writeStartElement(XML_ENTITY_TYPE);
- writer.writeAttribute(XML_NAME, entityType.getName());
-
- if (entityType.hasStream()) {
- writer.writeAttribute(XML_HAS_STREAM, "" + entityType.hasStream());
- }
-
- if (entityType.getBaseType() != null) {
- writer.writeAttribute(XML_BASE_TYPE, getAliasedFullQualifiedName(entityType.getBaseType(), false));
- }
-
- if (entityType.isAbstract()) {
- writer.writeAttribute(ABSTRACT, TRUE);
- }
-
- appendKey(writer, entityType);
-
- appendProperties(writer, entityType);
-
- appendNavigationProperties(writer, entityType);
-
- writer.writeEndElement();
- }
- }
-
- private void appendNavigationProperties(final XMLStreamWriter writer, final EdmStructuredType type)
- throws XMLStreamException {
- List<String> navigationPropertyNames = type.getNavigationPropertyNames();
- if (type.getBaseType() != null) {
- navigationPropertyNames.removeAll(type.getBaseType().getNavigationPropertyNames());
- }
- for (String navigationPropertyName : navigationPropertyNames) {
- EdmNavigationProperty navigationProperty = type.getNavigationProperty(navigationPropertyName);
-
- writer.writeStartElement(XML_NAVIGATION_PROPERTY);
- writer.writeAttribute(XML_NAME, navigationPropertyName);
- writer.writeAttribute(XML_TYPE, getAliasedFullQualifiedName(navigationProperty.getType(), navigationProperty
- .isCollection()));
- if (navigationProperty.isNullable() != null) {
- writer.writeAttribute(XML_NULLABLE, "" + navigationProperty.isNullable());
- }
-
- if (navigationProperty.getPartner() != null) {
- EdmNavigationProperty partner = navigationProperty.getPartner();
- writer.writeAttribute(XML_PARTNER, partner.getName());
- }
-
- if (navigationProperty.getReferentialConstraints() != null) {
- for (EdmReferentialConstraint constraint : navigationProperty.getReferentialConstraints()) {
- writer.writeEmptyElement("ReferentialConstraint");
- writer.writeAttribute(XML_PROPERTY, constraint.getPropertyName());
- writer.writeAttribute("ReferencedProperty", constraint.getReferencedPropertyName());
- }
- }
-
- writer.writeEndElement();
- }
- }
-
- private void appendProperties(final XMLStreamWriter writer, final EdmStructuredType type) throws XMLStreamException {
- List<String> propertyNames = type.getPropertyNames();
- if (type.getBaseType() != null) {
- propertyNames.removeAll(type.getBaseType().getPropertyNames());
- }
- for (String propertyName : propertyNames) {
- EdmProperty property = type.getStructuralProperty(propertyName);
- writer.writeEmptyElement(XML_PROPERTY);
- writer.writeAttribute(XML_NAME, propertyName);
- String fqnString;
- if (property.isPrimitive()) {
- fqnString = getFullQualifiedName(property.getType(), property.isCollection());
- } else {
- fqnString = getAliasedFullQualifiedName(property.getType(), property.isCollection());
- }
- writer.writeAttribute(XML_TYPE, fqnString);
-
- // Facets
- if (property.isNullable() != null) {
- writer.writeAttribute(XML_NULLABLE, "" + property.isNullable());
- }
-
- if (property.isUnicode() != null) {
- writer.writeAttribute(XML_UNICODE, "" + property.isUnicode());
- }
-
- if (property.getDefaultValue() != null) {
- writer.writeAttribute(XML_DEFAULT_VALUE, property.getDefaultValue());
- }
-
- if (property.getMaxLength() != null) {
- writer.writeAttribute(XML_MAX_LENGTH, "" + property.getMaxLength());
- }
-
- if (property.getPrecision() != null) {
- writer.writeAttribute(XML_PRECISION, "" + property.getPrecision());
- }
-
- if (property.getScale() != null) {
- writer.writeAttribute(XML_SCALE, "" + property.getScale());
- }
- }
- }
-
- private void appendKey(final XMLStreamWriter writer, final EdmEntityType entityType) throws XMLStreamException {
- List<EdmKeyPropertyRef> keyPropertyRefs = entityType.getKeyPropertyRefs();
- if (keyPropertyRefs != null && !keyPropertyRefs.isEmpty()) {
- // Resolve Base Type key as it is shown in derived type
- EdmEntityType baseType = entityType.getBaseType();
- if (baseType != null && baseType.getKeyPropertyRefs() != null && !(baseType.getKeyPropertyRefs().isEmpty())) {
- return;
- }
-
- writer.writeStartElement(XML_KEY);
- for (EdmKeyPropertyRef keyRef : keyPropertyRefs) {
- writer.writeEmptyElement(XML_PROPERTY_REF);
- final String keyName;
- if (keyRef.getPath() != null) {
- keyName = keyRef.getPath() + "/" + keyRef.getKeyPropertyName();
- } else {
- keyName = keyRef.getKeyPropertyName();
- }
- writer.writeAttribute(XML_NAME, keyName);
-
- if (keyRef.getAlias() != null) {
- writer.writeAttribute(XML_ALIAS, keyRef.getAlias());
- }
- }
- writer.writeEndElement();
- }
- }
-
- private void appendEnumTypes(final XMLStreamWriter writer, final List<EdmEnumType> enumTypes)
- throws XMLStreamException {
- for (EdmEnumType enumType : enumTypes) {
- writer.writeStartElement(XML_ENUM_TYPE);
- writer.writeAttribute(XML_NAME, enumType.getName());
- writer.writeAttribute(XML_IS_FLAGS, "" + enumType.isFlags());
- writer.writeAttribute(XML_UNDERLYING_TYPE, getFullQualifiedName(enumType.getUnderlyingType(), false));
-
- for (String memberName : enumType.getMemberNames()) {
- writer.writeEmptyElement(XML_MEMBER);
- writer.writeAttribute(XML_NAME, memberName);
- writer.writeAttribute(XML_VALUE, enumType.getMember(memberName).getValue());
- }
-
- writer.writeEndElement();
- }
- }
-
- private String getFullQualifiedName(final EdmType type, final boolean isCollection) {
- final String name = type.getFullQualifiedName().getFullQualifiedNameAsString();
- return isCollection ? "Collection(" + name + ")" : name;
- }
-
- private String getAliasedFullQualifiedName(final EdmType type, final boolean isCollection) {
- FullQualifiedName fqn = type.getFullQualifiedName();
- final String name;
- if (namespaceToAlias.get(fqn.getNamespace()) != null) {
- name = namespaceToAlias.get(fqn.getNamespace()) + "." + fqn.getName();
- } else {
- name = fqn.getFullQualifiedNameAsString();
- }
-
- return isCollection ? "Collection(" + name + ")" : name;
- }
-
- /**
- * Appends references, e.g., to the OData Core Vocabulary, as defined in the OData specification
- * and mentioned in its Common Schema Definition Language (CSDL) document.
- */
- private void appendReference(final XMLStreamWriter writer) throws XMLStreamException {
- for (final EdmxReference reference : serviceMetadata.getReferences()) {
- writer.writeStartElement(PREFIX_EDMX, REFERENCE, NS_EDMX);
- writer.writeAttribute(URI, reference.getUri().toASCIIString());
-
- List<EdmxReferenceInclude> includes = reference.getIncludes();
- for (EdmxReferenceInclude include : includes) {
- writer.writeStartElement(PREFIX_EDMX, INCLUDE, NS_EDMX);
- writer.writeAttribute(XML_NAMESPACE, include.getNamespace());
- if (include.getAlias() != null) {
- // Reference Aliases are ignored for now since they are not V2 compatible
- writer.writeAttribute(XML_ALIAS, include.getAlias());
- }
- writer.writeEndElement();
- }
-
- List<EdmxReferenceIncludeAnnotation> includeAnnotations = reference.getIncludeAnnotations();
- for (EdmxReferenceIncludeAnnotation includeAnnotation : includeAnnotations) {
- writer.writeStartElement(PREFIX_EDMX, INCLUDE_ANNOTATIONS, NS_EDMX);
- writer.writeAttribute(XML_TERM_NAMESPACE, includeAnnotation.getTermNamespace());
- if (includeAnnotation.getQualifier() != null) {
- writer.writeAttribute(XML_QUALIFIER, includeAnnotation.getQualifier());
- }
- if (includeAnnotation.getTargetNamespace() != null) {
- writer.writeAttribute(XML_TARGET_NAMESPACE, includeAnnotation.getTargetNamespace());
- }
- writer.writeEndElement();
- }
-
- writer.writeEndElement();
- }
- }
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/xml/ODataXmlSerializerImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/xml/ODataXmlSerializerImpl.java
deleted file mode 100644
index ac856a7..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/serializer/xml/ODataXmlSerializerImpl.java
+++ /dev/null
@@ -1,137 +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.serializer.xml;
-
-import java.io.InputStream;
-
-import javax.xml.stream.XMLOutputFactory;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamWriter;
-
-import org.apache.olingo.commons.api.data.Entity;
-import org.apache.olingo.commons.api.data.EntitySet;
-import org.apache.olingo.commons.api.data.Property;
-import org.apache.olingo.commons.api.edm.Edm;
-import org.apache.olingo.commons.api.edm.EdmComplexType;
-import org.apache.olingo.commons.api.edm.EdmEntityType;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
-import org.apache.olingo.server.api.ODataServerError;
-import org.apache.olingo.server.api.ServiceMetadata;
-import org.apache.olingo.server.api.serializer.ComplexSerializerOptions;
-import org.apache.olingo.server.api.serializer.EntityCollectionSerializerOptions;
-import org.apache.olingo.server.api.serializer.EntitySerializerOptions;
-import org.apache.olingo.server.api.serializer.ODataSerializer;
-import org.apache.olingo.server.api.serializer.PrimitiveSerializerOptions;
-import org.apache.olingo.server.api.serializer.SerializerException;
-import org.apache.olingo.server.core.serializer.utils.CircleStreamBuffer;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class ODataXmlSerializerImpl implements ODataSerializer {
-
- /** The default character set is UTF-8. */
- public static final String DEFAULT_CHARSET = "UTF-8";
-
- private static final Logger log = LoggerFactory.getLogger(ODataXmlSerializerImpl.class);
-
- @Override
- public InputStream serviceDocument(final Edm edm, final String serviceRoot) throws SerializerException {
- throw new SerializerException("Service Document not implemented for XML format",
- SerializerException.MessageKeys.NOT_IMPLEMENTED);
- }
-
- @Override
- public InputStream metadataDocument(final ServiceMetadata serviceMetadata) throws SerializerException {
- CircleStreamBuffer buffer;
- XMLStreamWriter xmlStreamWriter = null;
-
- // TODO: move stream initialization into separate method
- try {
- buffer = new CircleStreamBuffer();
- xmlStreamWriter = XMLOutputFactory.newInstance().createXMLStreamWriter(buffer.getOutputStream(), DEFAULT_CHARSET);
- MetadataDocumentXmlSerializer serializer = new MetadataDocumentXmlSerializer(serviceMetadata);
- serializer.writeMetadataDocument(xmlStreamWriter);
- xmlStreamWriter.flush();
- xmlStreamWriter.close();
-
- return buffer.getInputStream();
- } catch (final XMLStreamException e) {
- log.error(e.getMessage(), e);
- throw new SerializerException("An I/O exception occurred.", e,
- SerializerException.MessageKeys.IO_EXCEPTION);
- } finally {
- if (xmlStreamWriter != null) {
- try {
- xmlStreamWriter.close();
- } catch (XMLStreamException e) {
- throw new SerializerException("An I/O exception occurred.", e,
- SerializerException.MessageKeys.IO_EXCEPTION);
- }
- }
- }
- }
-
- @Override
- public InputStream entity(final EdmEntityType entityType, final Entity entity,
- final EntitySerializerOptions options) throws SerializerException {
- throw new SerializerException("Entity serialization not implemented for XML format",
- SerializerException.MessageKeys.NOT_IMPLEMENTED);
- }
-
- @Override
- public InputStream entityCollection(final EdmEntityType entityType, final EntitySet entitySet,
- final EntityCollectionSerializerOptions options) throws SerializerException {
- throw new SerializerException("Entityset serialization not implemented for XML format",
- SerializerException.MessageKeys.NOT_IMPLEMENTED);
- }
-
- @Override
- public InputStream error(ODataServerError error) throws SerializerException {
- throw new SerializerException("error serialization not implemented for XML format",
- SerializerException.MessageKeys.NOT_IMPLEMENTED);
- }
-
- @Override
- public InputStream primitive(final EdmPrimitiveType type, final Property property,
- final PrimitiveSerializerOptions options) throws SerializerException {
- throw new SerializerException("Serialization not implemented for XML format.",
- SerializerException.MessageKeys.NOT_IMPLEMENTED);
- }
-
- @Override
- public InputStream complex(final EdmComplexType type, final Property property,
- final ComplexSerializerOptions options) throws SerializerException {
- throw new SerializerException("Serialization not implemented for XML format.",
- SerializerException.MessageKeys.NOT_IMPLEMENTED);
- }
-
- @Override
- public InputStream primitiveCollection(final EdmPrimitiveType type, final Property property,
- final PrimitiveSerializerOptions options) throws SerializerException {
- throw new SerializerException("Serialization not implemented for XML format.",
- SerializerException.MessageKeys.NOT_IMPLEMENTED);
- }
-
- @Override
- public InputStream complexCollection(final EdmComplexType type, final Property property,
- final ComplexSerializerOptions options) throws SerializerException {
- throw new SerializerException("Serialization not implemented for XML format.",
- SerializerException.MessageKeys.NOT_IMPLEMENTED);
- }
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriHelperImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriHelperImpl.java
deleted file mode 100644
index 8bbbc3f..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriHelperImpl.java
+++ /dev/null
@@ -1,84 +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.uri;
-
-import java.util.List;
-
-import org.apache.olingo.commons.api.data.Entity;
-import org.apache.olingo.commons.api.edm.EdmEntitySet;
-import org.apache.olingo.commons.api.edm.EdmEntityType;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
-import org.apache.olingo.commons.api.edm.EdmProperty;
-import org.apache.olingo.commons.api.edm.EdmStructuredType;
-import org.apache.olingo.commons.core.Encoder;
-import org.apache.olingo.server.api.serializer.SerializerException;
-import org.apache.olingo.server.api.uri.UriHelper;
-import org.apache.olingo.server.api.uri.UriParameter;
-import org.apache.olingo.server.api.uri.queryoption.ExpandOption;
-import org.apache.olingo.server.api.uri.queryoption.SelectOption;
-import org.apache.olingo.server.core.serializer.utils.ContextURLHelper;
-
-public class UriHelperImpl implements UriHelper {
-
- @Override
- public String buildContextURLSelectList(final EdmStructuredType type,
- final ExpandOption expand, final SelectOption select) throws SerializerException {
- return ContextURLHelper.buildSelectList(type, expand, select);
- }
-
- @Override
- public String buildContextURLKeyPredicate(final List<UriParameter> keys) throws SerializerException {
- return ContextURLHelper.buildKeyPredicate(keys);
- }
-
- @Override
- public String buildCanonicalURL(final EdmEntitySet edmEntitySet, final Entity entity) throws SerializerException {
- StringBuilder result = new StringBuilder(edmEntitySet.getName());
- result.append('(');
- final EdmEntityType entityType = edmEntitySet.getEntityType();
- final List<String> keyNames = entityType.getKeyPredicateNames();
- boolean first = true;
- for (final String keyName : keyNames) {
- if (first) {
- first = false;
- } else {
- result.append(',');
- }
- if (keyNames.size() > 1) {
- result.append(Encoder.encode(keyName)).append('=');
- }
- final EdmProperty edmProperty = entityType.getStructuralProperty(keyName);
- final EdmPrimitiveType type = (EdmPrimitiveType) edmProperty.getType();
- final Object propertyValue = entity.getProperty(keyName).getValue();
- try {
- final String value = type.toUriLiteral(
- type.valueToString(propertyValue,
- edmProperty.isNullable(), edmProperty.getMaxLength(),
- edmProperty.getPrecision(), edmProperty.getScale(), edmProperty.isUnicode()));
- result.append(Encoder.encode(value));
- } catch (final EdmPrimitiveTypeException e) {
- throw new SerializerException("Wrong key value!",
- SerializerException.MessageKeys.WRONG_PROPERTY_VALUE, edmProperty.getName(), propertyValue.toString());
- }
- }
- result.append(')');
- return result.toString();
- }
-}
\ No newline at end of file
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriInfoImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriInfoImpl.java
deleted file mode 100644
index 9990da6..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriInfoImpl.java
+++ /dev/null
@@ -1,300 +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.uri;
-
-import org.apache.olingo.commons.api.ODataRuntimeException;
-import org.apache.olingo.commons.api.edm.EdmEntityType;
-import org.apache.olingo.server.api.uri.UriInfo;
-import org.apache.olingo.server.api.uri.UriInfoAll;
-import org.apache.olingo.server.api.uri.UriInfoBatch;
-import org.apache.olingo.server.api.uri.UriInfoCrossjoin;
-import org.apache.olingo.server.api.uri.UriInfoEntityId;
-import org.apache.olingo.server.api.uri.UriInfoKind;
-import org.apache.olingo.server.api.uri.UriInfoMetadata;
-import org.apache.olingo.server.api.uri.UriInfoResource;
-import org.apache.olingo.server.api.uri.UriInfoService;
-import org.apache.olingo.server.api.uri.UriResource;
-import org.apache.olingo.server.api.uri.queryoption.CountOption;
-import org.apache.olingo.server.api.uri.queryoption.CustomQueryOption;
-import org.apache.olingo.server.api.uri.queryoption.ExpandOption;
-import org.apache.olingo.server.api.uri.queryoption.FilterOption;
-import org.apache.olingo.server.api.uri.queryoption.FormatOption;
-import org.apache.olingo.server.api.uri.queryoption.IdOption;
-import org.apache.olingo.server.api.uri.queryoption.OrderByOption;
-import org.apache.olingo.server.api.uri.queryoption.SearchOption;
-import org.apache.olingo.server.api.uri.queryoption.SelectOption;
-import org.apache.olingo.server.api.uri.queryoption.SkipOption;
-import org.apache.olingo.server.api.uri.queryoption.SkipTokenOption;
-import org.apache.olingo.server.api.uri.queryoption.SystemQueryOption;
-import org.apache.olingo.server.api.uri.queryoption.SystemQueryOptionKind;
-import org.apache.olingo.server.api.uri.queryoption.TopOption;
-import org.apache.olingo.server.core.uri.queryoption.CustomQueryOptionImpl;
-import org.apache.olingo.server.core.uri.queryoption.QueryOptionImpl;
-import org.apache.olingo.server.core.uri.queryoption.SystemQueryOptionImpl;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-public class UriInfoImpl implements UriInfo {
-
- private UriInfoKind kind;
-
- private List<String> entitySetNames = new ArrayList<String>(); // for $entity
- private EdmEntityType entityTypeCast; // for $entity
-
- private List<CustomQueryOptionImpl> customQueryOptions = new ArrayList<CustomQueryOptionImpl>();
- private Map<String, String> aliasToValue = new HashMap<String, String>();
-
- Map<SystemQueryOptionKind, SystemQueryOption> systemQueryOptions =
- new HashMap<SystemQueryOptionKind, SystemQueryOption>();
-
- private String fragment;
-
- private UriResource lastResourcePart;
- private List<UriResource> pathParts = new ArrayList<UriResource>();
-
- @Override
- public UriInfoAll asUriInfoAll() {
- return this;
- }
-
- @Override
- public UriInfoBatch asUriInfoBatch() {
- return this;
- }
-
- @Override
- public UriInfoCrossjoin asUriInfoCrossjoin() {
- return this;
- }
-
- @Override
- public UriInfoEntityId asUriInfoEntityId() {
- return this;
- }
-
- @Override
- public UriInfoMetadata asUriInfoMetadata() {
- return this;
- }
-
- @Override
- public UriInfoResource asUriInfoResource() {
- return this;
- }
-
- @Override
- public List<String> getEntitySetNames() {
- return Collections.unmodifiableList(entitySetNames);
- }
-
- public void addEntitySetName(final String entitySet) {
- entitySetNames.add(entitySet);
- }
-
- @Override
- public List<UriResource> getUriResourceParts() {
- List<UriResource> returnList = new ArrayList<UriResource>();
- for (UriResource item : pathParts) {
- returnList.add(item);
- }
- return Collections.unmodifiableList(returnList);
- }
-
- public UriInfoImpl addResourcePart(final UriResourceImpl uriPathInfo) {
- pathParts.add(uriPathInfo);
- lastResourcePart = uriPathInfo;
- return this;
- }
-
- @Override
- public List<CustomQueryOption> getCustomQueryOptions() {
- List<CustomQueryOption> retList = new ArrayList<CustomQueryOption>();
- for (CustomQueryOptionImpl item : customQueryOptions) {
- retList.add(item);
- }
- return retList;
- }
-
- @Override
- public String getValueForAlias(String alias) {
- return aliasToValue.get(alias);
- }
-
- @Override
- public EdmEntityType getEntityTypeCast() {
- return entityTypeCast;
- }
-
- public UriInfoImpl setEntityTypeCast(final EdmEntityType type) {
- entityTypeCast = type;
- return this;
- }
-
- @Override
- public ExpandOption getExpandOption() {
- return (ExpandOption) systemQueryOptions.get(SystemQueryOptionKind.EXPAND);
- }
-
- @Override
- public FilterOption getFilterOption() {
- return (FilterOption) systemQueryOptions.get(SystemQueryOptionKind.FILTER);
- }
-
- @Override
- public FormatOption getFormatOption() {
- return (FormatOption) systemQueryOptions.get(SystemQueryOptionKind.FORMAT);
- }
-
- @Override
- public IdOption getIdOption() {
- return (IdOption) systemQueryOptions.get(SystemQueryOptionKind.ID);
- }
-
- @Override
- public CountOption getCountOption() {
- return (CountOption) systemQueryOptions.get(SystemQueryOptionKind.COUNT);
- }
-
- @Override
- public UriInfoKind getKind() {
- return kind;
- }
-
- public UriInfoImpl setKind(final UriInfoKind kind) {
- this.kind = kind;
- return this;
- }
-
- public UriResource getLastResourcePart() {
- return lastResourcePart;
- }
-
- @Override
- public OrderByOption getOrderByOption() {
- return (OrderByOption) systemQueryOptions.get(SystemQueryOptionKind.ORDERBY);
- }
-
- @Override
- public SearchOption getSearchOption() {
-
- return (SearchOption) systemQueryOptions.get(SystemQueryOptionKind.SEARCH);
- }
-
- @Override
- public SelectOption getSelectOption() {
- return (SelectOption) systemQueryOptions.get(SystemQueryOptionKind.SELECT);
- }
-
- @Override
- public SkipOption getSkipOption() {
- return (SkipOption) systemQueryOptions.get(SystemQueryOptionKind.SKIP);
- }
-
- @Override
- public SkipTokenOption getSkipTokenOption() {
- return (SkipTokenOption) systemQueryOptions.get(SystemQueryOptionKind.SKIPTOKEN);
- }
-
- @Override
- public TopOption getTopOption() {
- return (TopOption) systemQueryOptions.get(SystemQueryOptionKind.TOP);
- }
-
- public UriInfoImpl setQueryOptions(final List<QueryOptionImpl> list) {
-
- for (QueryOptionImpl item : list) {
- if (item instanceof SystemQueryOptionImpl) {
- setSystemQueryOption((SystemQueryOptionImpl) item);
- } else if (item instanceof CustomQueryOptionImpl) {
- addCustomQueryOption(item);
- }
- }
- return this;
- }
-
- public void addCustomQueryOption(final QueryOptionImpl item) {
- customQueryOptions.add((CustomQueryOptionImpl) item);
- if (item.getName().startsWith("@")) {
- aliasToValue.put(item.getName(), item.getText());
- }
- }
-
- /** Adds system query option.
- * @param systemOption the option to be added
- * @return this object for method chaining
- * @throws ODataRuntimeException if an unsupported option is provided
- * or an option of this kind has been added before
- */
- public UriInfoImpl setSystemQueryOption(final SystemQueryOption systemOption) {
- final SystemQueryOptionKind kind = systemOption.getKind();
- switch (kind) {
- case EXPAND:
- case FILTER:
- case FORMAT:
- case ID:
- case COUNT:
- case ORDERBY:
- case SEARCH:
- case SELECT:
- case SKIP:
- case SKIPTOKEN:
- case TOP:
- case LEVELS:
- if (systemQueryOptions.containsKey(kind)) {
- throw new ODataRuntimeException("Double System Query Option: " + systemOption.getName());
- } else {
- systemQueryOptions.put(kind, systemOption);
- }
- break;
- default:
- throw new ODataRuntimeException("Unsupported System Query Option: " + systemOption.getName());
- }
- return this;
- }
-
- @Override
- public UriInfoService asUriInfoService() {
- return this;
- }
-
- @Override
- public String getFragment() {
- return fragment;
- }
-
- public UriInfoImpl setFragment(final String fragment) {
- this.fragment = fragment;
- return this;
- }
-
- public void removeResourcePart(final int index) {
- pathParts.remove(index);
- }
-
- @Override
- public Collection<SystemQueryOption> getSystemQueryOptions() {
- return Collections.unmodifiableCollection(systemQueryOptions.values());
- }
-
-}
\ No newline at end of file
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriParameterImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriParameterImpl.java
deleted file mode 100644
index ddbcd57..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriParameterImpl.java
+++ /dev/null
@@ -1,82 +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.uri;
-
-import org.apache.olingo.server.api.uri.UriParameter;
-import org.apache.olingo.server.api.uri.queryoption.expression.Expression;
-import org.apache.olingo.server.core.uri.queryoption.expression.ExpressionImpl;
-
-public class UriParameterImpl implements UriParameter {
- private String name;
- private String text;
- private String alias;
- private Expression expression;
- private String referencedProperty;
-
- @Override
- public String getName() {
- return name;
- }
-
- public UriParameterImpl setName(final String name) {
- this.name = name;
- return this;
- }
-
- @Override
- public String getAlias() {
- return alias;
- }
-
- public UriParameterImpl setAlias(final String alias) {
- this.alias = alias;
- return this;
- }
-
- @Override
- public String getText() {
- return text;
- }
-
- public UriParameterImpl setText(final String text) {
- this.text = text;
- return this;
- }
-
- @Override
- public Expression getExpression() {
- return expression;
- }
-
- public UriParameterImpl setExpression(final ExpressionImpl expression) {
- this.expression = expression;
- return this;
- }
-
- @Override
- public String getReferencedProperty() {
- return referencedProperty;
- }
-
- public UriParameterImpl setRefencedProperty(final String referencedProperty) {
- this.referencedProperty = referencedProperty;
- return this;
- }
-
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceActionImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceActionImpl.java
deleted file mode 100644
index 4ca162c..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceActionImpl.java
+++ /dev/null
@@ -1,77 +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.uri;
-
-import org.apache.olingo.commons.api.edm.EdmAction;
-import org.apache.olingo.commons.api.edm.EdmActionImport;
-import org.apache.olingo.commons.api.edm.EdmType;
-import org.apache.olingo.server.api.uri.UriResourceAction;
-import org.apache.olingo.server.api.uri.UriResourceKind;
-
-public class UriResourceActionImpl extends UriResourceTypedImpl implements UriResourceAction {
-
- protected EdmAction action;
- protected EdmActionImport actionImport;
-
- public UriResourceActionImpl() {
- super(UriResourceKind.action);
- }
-
- @Override
- public EdmAction getAction() {
- return action;
- }
-
- public UriResourceActionImpl setAction(final EdmAction action) {
- this.action = action;
- return this;
- }
-
- @Override
- public EdmActionImport getActionImport() {
- return actionImport;
- }
-
- public UriResourceActionImpl setActionImport(final EdmActionImport actionImport) {
- this.actionImport = actionImport;
- setAction(actionImport.getUnboundAction());
- return this;
- }
-
- @Override
- public boolean isCollection() {
- return action.getReturnType().isCollection();
- }
-
- @Override
- public EdmType getType() {
- return action.getReturnType().getType();
- }
-
- @Override
- public String toString() {
- if (actionImport != null) {
- return actionImport.getName();
- } else if (action != null) {
- return action.getName();
- }
- return "";
- }
-
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceComplexPropertyImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceComplexPropertyImpl.java
deleted file mode 100644
index f7a8502..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceComplexPropertyImpl.java
+++ /dev/null
@@ -1,70 +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.uri;
-
-import org.apache.olingo.commons.api.edm.EdmComplexType;
-import org.apache.olingo.commons.api.edm.EdmProperty;
-import org.apache.olingo.commons.api.edm.EdmType;
-import org.apache.olingo.server.api.uri.UriResourceComplexProperty;
-import org.apache.olingo.server.api.uri.UriResourceKind;
-
-public class UriResourceComplexPropertyImpl extends UriResourceTypedImpl implements UriResourceComplexProperty {
-
- protected EdmProperty property;
-
- public UriResourceComplexPropertyImpl() {
- super(UriResourceKind.complexProperty);
- }
-
- @Override
- public EdmProperty getProperty() {
- return property;
- }
-
- public UriResourceComplexPropertyImpl setProperty(final EdmProperty property) {
- this.property = property;
- return this;
- }
-
- @Override
- public EdmComplexType getComplexType() {
- return (EdmComplexType) getType();
- }
-
- @Override
- public EdmComplexType getComplexTypeFilter() {
- return (EdmComplexType) typeFilter;
- }
-
- @Override
- public EdmType getType() {
- return property.getType();
- }
-
- @Override
- public boolean isCollection() {
- return property.isCollection();
- }
-
- @Override
- public String toString() {
- return property.getName();
- }
-
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceCountImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceCountImpl.java
deleted file mode 100644
index 14f43ec..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceCountImpl.java
+++ /dev/null
@@ -1,35 +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.uri;
-
-import org.apache.olingo.server.api.uri.UriResourceCount;
-import org.apache.olingo.server.api.uri.UriResourceKind;
-
-public class UriResourceCountImpl extends UriResourceImpl implements UriResourceCount {
-
- public UriResourceCountImpl() {
- super(UriResourceKind.count);
- }
-
- @Override
- public String toString() {
- return "$count";
- }
-
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceEntitySetImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceEntitySetImpl.java
deleted file mode 100644
index bf6d47b..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceEntitySetImpl.java
+++ /dev/null
@@ -1,66 +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.uri;
-
-import org.apache.olingo.commons.api.edm.EdmEntitySet;
-import org.apache.olingo.commons.api.edm.EdmEntityType;
-import org.apache.olingo.commons.api.edm.EdmType;
-import org.apache.olingo.server.api.uri.UriResourceEntitySet;
-import org.apache.olingo.server.api.uri.UriResourceKind;
-
-public class UriResourceEntitySetImpl extends UriResourceWithKeysImpl implements UriResourceEntitySet {
- protected EdmEntitySet edmEntitySet = null;
-
- public UriResourceEntitySetImpl() {
- super(UriResourceKind.entitySet);
- }
-
- @Override
- public EdmEntitySet getEntitySet() {
- return edmEntitySet;
- }
-
- public UriResourceEntitySetImpl setEntitSet(final EdmEntitySet edmES) {
- edmEntitySet = edmES;
- return this;
- }
-
- @Override
- public EdmEntityType getEntityType() {
- return edmEntitySet.getEntityType();
- }
-
- @Override
- public EdmType getType() {
- return edmEntitySet.getEntityType();
- }
-
- @Override
- public boolean isCollection() {
- if (keyPredicates == null) {
- return true;
- }
- return false;
- }
-
- @Override
- public String toString() {
- return edmEntitySet.getName();
- }
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceFunctionImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceFunctionImpl.java
deleted file mode 100644
index 8daa810..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceFunctionImpl.java
+++ /dev/null
@@ -1,111 +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.uri;
-
-import org.apache.olingo.commons.api.edm.EdmFunction;
-import org.apache.olingo.commons.api.edm.EdmFunctionImport;
-import org.apache.olingo.commons.api.edm.EdmType;
-import org.apache.olingo.server.api.uri.UriParameter;
-import org.apache.olingo.server.api.uri.UriResourceFunction;
-import org.apache.olingo.server.api.uri.UriResourceKind;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Covers Function imports and BoundFunction in URI
- */
-public class UriResourceFunctionImpl extends UriResourceWithKeysImpl implements UriResourceFunction {
-
- protected List<UriParameterImpl> parameters;
- protected EdmFunction function;
- protected EdmFunctionImport functionImport;
- private boolean isParameterListFilled = false;
-
- public UriResourceFunctionImpl() {
- super(UriResourceKind.function);
- }
-
- @Override
- public List<UriParameter> getParameters() {
- List<UriParameter> retList = new ArrayList<UriParameter>();
- for (UriParameterImpl item : parameters) {
- retList.add(item);
- }
- return retList;
- }
-
- public UriResourceFunctionImpl setParameters(final List<UriParameterImpl> parameters) {
- isParameterListFilled = true;
- this.parameters = parameters;
- return this;
- }
-
- @Override
- public EdmFunction getFunction() {
- return function;
- }
-
- public UriResourceFunctionImpl setFunction(final EdmFunction function) {
- this.function = function;
- return this;
- }
-
- @Override
- public EdmFunctionImport getFunctionImport() {
- return functionImport;
- }
-
- public UriResourceFunctionImpl setFunctionImport(final EdmFunctionImport edmFI,
- final List<UriParameterImpl> parameters) {
- functionImport = edmFI;
-
- setParameters(parameters);
-
- return this;
- }
-
- @Override
- public EdmType getType() {
- return function.getReturnType().getType();
- }
-
- @Override
- public boolean isCollection() {
- if (keyPredicates != null) {
- return false;
- }
- return function.getReturnType().isCollection();
- }
-
- @Override
- public String toString() {
- if (functionImport != null) {
- return functionImport.getName();
- } else if (function != null) {
- return function.getName();
- }
- return "";
- }
-
- public boolean isParameterListFilled() {
- return isParameterListFilled;
- }
-
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceImpl.java
deleted file mode 100644
index 9fbcbd0..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceImpl.java
+++ /dev/null
@@ -1,39 +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.uri;
-
-import org.apache.olingo.server.api.uri.UriResource;
-import org.apache.olingo.server.api.uri.UriResourceKind;
-
-/**
- * Covers Functionimports and BoundFunction in URI
- */
-public abstract class UriResourceImpl implements UriResource {
- protected UriResourceKind kind;
-
- public UriResourceImpl(final UriResourceKind kind) {
- this.kind = kind;
- }
-
- @Override
- public UriResourceKind getKind() {
- return kind;
- }
-
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceItImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceItImpl.java
deleted file mode 100644
index b28ddf8..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceItImpl.java
+++ /dev/null
@@ -1,65 +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.uri;
-
-import org.apache.olingo.commons.api.edm.EdmType;
-import org.apache.olingo.server.api.uri.UriResourceIt;
-import org.apache.olingo.server.api.uri.UriResourceKind;
-
-/**
- * Covers Functionimports and BoundFunction in URI
- */
-public class UriResourceItImpl extends UriResourceWithKeysImpl implements UriResourceIt {
-
- private EdmType type;
- private boolean isCollection;
-
- public UriResourceItImpl() {
- super(UriResourceKind.it);
- }
-
- @Override
- public EdmType getType() {
- return type;
- }
-
- public UriResourceItImpl setType(final EdmType type) {
- this.type = type;
- return this;
- }
-
- @Override
- public boolean isCollection() {
- if (keyPredicates != null) {
- return false;
- }
- return isCollection;
- }
-
- public UriResourceItImpl setCollection(final boolean isCollection) {
- this.isCollection = isCollection;
- return this;
- }
-
- @Override
- public String toString() {
- return "$it";
- }
-
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceLambdaAllImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceLambdaAllImpl.java
deleted file mode 100644
index caa8b6c..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceLambdaAllImpl.java
+++ /dev/null
@@ -1,81 +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.uri;
-
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
-import org.apache.olingo.commons.api.edm.EdmProperty;
-import org.apache.olingo.commons.api.edm.EdmType;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
-import org.apache.olingo.server.api.uri.UriResourceKind;
-import org.apache.olingo.server.api.uri.UriResourceLambdaAll;
-import org.apache.olingo.server.api.uri.queryoption.expression.Expression;
-import org.apache.olingo.server.core.uri.queryoption.expression.ExpressionImpl;
-
-public class UriResourceLambdaAllImpl extends UriResourceTypedImpl implements UriResourceLambdaAll {
-
- protected EdmProperty property;
-
- private String lambdaVariable;
-
- private ExpressionImpl expression;
-
- public UriResourceLambdaAllImpl() {
- super(UriResourceKind.lambdaAll);
- }
-
- @Override
- public EdmType getType() {
- return EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Boolean);
- }
-
- @Override
- public boolean isCollection() {
- return false;
- }
-
- @Override
- public String getLambdaVariable() {
- return lambdaVariable;
- }
-
- public UriResourceLambdaAllImpl setLamdaVariable(final String lambdaVariable) {
- this.lambdaVariable = lambdaVariable;
- return this;
- }
-
- ;
-
- @Override
- public Expression getExpression() {
- return expression;
- }
-
- public UriResourceLambdaAllImpl setExpression(final ExpressionImpl expression) {
- this.expression = expression;
- return this;
- }
-
- ;
-
- @Override
- public String toString() {
- return "all";
- }
-
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceLambdaAnyImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceLambdaAnyImpl.java
deleted file mode 100644
index 75e44a8..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceLambdaAnyImpl.java
+++ /dev/null
@@ -1,78 +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.uri;
-
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
-import org.apache.olingo.commons.api.edm.EdmProperty;
-import org.apache.olingo.commons.api.edm.EdmType;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
-import org.apache.olingo.server.api.uri.UriResourceKind;
-import org.apache.olingo.server.api.uri.UriResourceLambdaAny;
-import org.apache.olingo.server.api.uri.queryoption.expression.Expression;
-import org.apache.olingo.server.core.uri.queryoption.expression.ExpressionImpl;
-
-public class UriResourceLambdaAnyImpl extends UriResourceTypedImpl implements UriResourceLambdaAny {
-
- protected EdmProperty property;
-
- private String lambdaVariable;
-
- private ExpressionImpl expression;
-
- public UriResourceLambdaAnyImpl() {
- super(UriResourceKind.lambdaAny);
- }
-
- @Override
- public EdmType getType() {
- return EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Boolean);
- }
-
- @Override
- public boolean isCollection() {
- return false;
- }
-
- @Override
- public String getLamdaVariable() {
- return lambdaVariable;
- }
-
- public UriResourceLambdaAnyImpl setLamdaVariable(final String lambdaVariable) {
- this.lambdaVariable = lambdaVariable;
- return this;
- }
-
- ;
-
- @Override
- public Expression getExpression() {
- return expression;
- }
-
- public UriResourceLambdaAnyImpl setExpression(final ExpressionImpl expression) {
- this.expression = expression;
- return this;
- }
-
- @Override
- public String toString() {
- return "any";
- };
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceLambdaVarImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceLambdaVarImpl.java
deleted file mode 100644
index f71fe04..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceLambdaVarImpl.java
+++ /dev/null
@@ -1,70 +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.uri;
-
-import org.apache.olingo.commons.api.edm.EdmType;
-import org.apache.olingo.server.api.uri.UriResourceKind;
-import org.apache.olingo.server.api.uri.UriResourceLambdaVariable;
-
-public class UriResourceLambdaVarImpl extends UriResourceTypedImpl implements UriResourceLambdaVariable {
-
- private EdmType type;
- private boolean isCollection;
- private String variableText;
-
- public UriResourceLambdaVarImpl() {
- super(UriResourceKind.lambdaVariable);
- }
-
- @Override
- public String getVariableName() {
- return variableText;
- }
-
- public UriResourceLambdaVarImpl setVariableText(final String variableText) {
- this.variableText = variableText;
- return this;
- }
-
- @Override
- public EdmType getType() {
- return type;
- }
-
- public UriResourceLambdaVarImpl setType(final EdmType type) {
- this.type = type;
- return this;
-
- }
-
- @Override
- public boolean isCollection() {
- return isCollection;
- }
-
- public UriResourceLambdaVarImpl setCollection(final boolean isCollection) {
- this.isCollection = isCollection;
- return this;
- }
-
- @Override
- public String toString() {
- return variableText;
- }
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceNavigationPropertyImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceNavigationPropertyImpl.java
deleted file mode 100644
index 3da7aef..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceNavigationPropertyImpl.java
+++ /dev/null
@@ -1,63 +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.uri;
-
-import org.apache.olingo.commons.api.edm.EdmNavigationProperty;
-import org.apache.olingo.commons.api.edm.EdmType;
-import org.apache.olingo.server.api.uri.UriResourceKind;
-import org.apache.olingo.server.api.uri.UriResourceNavigation;
-
-public class UriResourceNavigationPropertyImpl extends UriResourceWithKeysImpl implements UriResourceNavigation {
-
- protected EdmNavigationProperty navigationProperty;
-
- public UriResourceNavigationPropertyImpl() {
- super(UriResourceKind.navigationProperty);
- }
-
- @Override
- public EdmNavigationProperty getProperty() {
- return navigationProperty;
- }
-
- public UriResourceNavigationPropertyImpl setNavigationProperty(final EdmNavigationProperty property) {
- navigationProperty = property;
- return this;
-
- }
-
- @Override
- public EdmType getType() {
- return navigationProperty.getType();
- }
-
- @Override
- public boolean isCollection() {
- if (keyPredicates != null) {
- return false;
- }
- return navigationProperty.isCollection();
- }
-
- @Override
- public String toString() {
- return navigationProperty.getName();
- }
-
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourcePrimitivePropertyImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourcePrimitivePropertyImpl.java
deleted file mode 100644
index d599b9b..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourcePrimitivePropertyImpl.java
+++ /dev/null
@@ -1,59 +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.uri;
-
-import org.apache.olingo.commons.api.edm.EdmProperty;
-import org.apache.olingo.commons.api.edm.EdmType;
-import org.apache.olingo.server.api.uri.UriResourceKind;
-import org.apache.olingo.server.api.uri.UriResourcePrimitiveProperty;
-
-public class UriResourcePrimitivePropertyImpl extends UriResourceTypedImpl implements UriResourcePrimitiveProperty {
-
- EdmProperty property;
-
- public UriResourcePrimitivePropertyImpl() {
- super(UriResourceKind.primitiveProperty);
- }
-
- @Override
- public EdmProperty getProperty() {
- return property;
- }
-
- public UriResourcePrimitivePropertyImpl setProperty(final EdmProperty property) {
- this.property = property;
- return this;
- }
-
- @Override
- public EdmType getType() {
- return property.getType();
- }
-
- @Override
- public boolean isCollection() {
- return property.isCollection();
- }
-
- @Override
- public String toString() {
- return property.getName();
- }
-
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceRefImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceRefImpl.java
deleted file mode 100644
index a0cdc3e..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceRefImpl.java
+++ /dev/null
@@ -1,36 +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.uri;
-
-import org.apache.olingo.server.api.uri.UriResourceKind;
-import org.apache.olingo.server.api.uri.UriResourceRef;
-
-public class UriResourceRefImpl extends UriResourceImpl implements UriResourceRef {
-
- public UriResourceRefImpl() {
- super(UriResourceKind.ref);
-
- }
-
- @Override
- public String toString() {
- return "$ref";
- }
-
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceRootImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceRootImpl.java
deleted file mode 100644
index 0db0a01..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceRootImpl.java
+++ /dev/null
@@ -1,62 +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.uri;
-
-import org.apache.olingo.commons.api.edm.EdmType;
-import org.apache.olingo.server.api.uri.UriResourceKind;
-import org.apache.olingo.server.api.uri.UriResourceRoot;
-
-public class UriResourceRootImpl extends UriResourceWithKeysImpl implements UriResourceRoot {
-
- private EdmType type;
- private boolean isCollection;
-
- public UriResourceRootImpl() {
- super(UriResourceKind.root);
- }
-
- @Override
- public EdmType getType() {
- return type;
- }
-
- public UriResourceRootImpl setType(final EdmType type) {
- this.type = type;
- return this;
- }
-
- @Override
- public boolean isCollection() {
- if (keyPredicates != null) {
- return false;
- }
- return isCollection;
- }
-
- public UriResourceRootImpl setCollection(final boolean isCollection) {
- this.isCollection = isCollection;
- return this;
- }
-
- @Override
- public String toString() {
- return "$root";
- }
-
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceSingletonImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceSingletonImpl.java
deleted file mode 100644
index cc9c606..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceSingletonImpl.java
+++ /dev/null
@@ -1,71 +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.uri;
-
-import org.apache.olingo.commons.api.edm.EdmEntityType;
-import org.apache.olingo.commons.api.edm.EdmSingleton;
-import org.apache.olingo.commons.api.edm.EdmType;
-import org.apache.olingo.server.api.uri.UriResourceKind;
-import org.apache.olingo.server.api.uri.UriResourceSingleton;
-
-public class UriResourceSingletonImpl extends UriResourceTypedImpl implements UriResourceSingleton {
-
- private EdmSingleton singleton;
-
- public UriResourceSingletonImpl() {
- super(UriResourceKind.singleton);
- }
-
- @Override
- public EdmSingleton getSingleton() {
- return singleton;
- }
-
- public UriResourceSingletonImpl setSingleton(final EdmSingleton singleton) {
-
- this.singleton = singleton;
- return this;
- }
-
- @Override
- public EdmEntityType getEntityTypeFilter() {
- return (EdmEntityType) typeFilter;
- }
-
- @Override
- public EdmType getType() {
- return singleton.getEntityType();
- }
-
- @Override
- public EdmEntityType getEntityType() {
- return singleton.getEntityType();
- }
-
- @Override
- public boolean isCollection() {
- return false;
- }
-
- @Override
- public String toString() {
- return singleton.getName();
- }
-
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceStartingTypeFilterImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceStartingTypeFilterImpl.java
deleted file mode 100644
index 152f44c..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceStartingTypeFilterImpl.java
+++ /dev/null
@@ -1,66 +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.uri;
-
-import org.apache.olingo.commons.api.edm.EdmType;
-import org.apache.olingo.server.api.uri.UriResourceKind;
-
-public class UriResourceStartingTypeFilterImpl extends UriResourceWithKeysImpl {
-
- private EdmType type;
- private boolean isCollection;
-
- public UriResourceStartingTypeFilterImpl() {
- super(null);
- }
-
- @Override
- public UriResourceKind getKind() {
- return kind;
- }
-
- @Override
- public EdmType getType() {
- return type;
- }
-
- public UriResourceStartingTypeFilterImpl setType(final EdmType type) {
- this.type = type;
- return this;
- }
-
- @Override
- public boolean isCollection() {
- if (keyPredicates != null) {
- return false;
- }
- return isCollection;
- }
-
- public UriResourceStartingTypeFilterImpl setCollection(final boolean isCollection) {
- this.isCollection = isCollection;
- return this;
- }
-
- @Override
- public String toString() {
- return type.getNamespace() + "." + type.getName();
- }
-
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceTypedImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceTypedImpl.java
deleted file mode 100644
index d5f01ea..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceTypedImpl.java
+++ /dev/null
@@ -1,60 +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.uri;
-
-import org.apache.olingo.commons.api.edm.EdmStructuredType;
-import org.apache.olingo.commons.api.edm.EdmType;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.server.api.uri.UriResourceKind;
-import org.apache.olingo.server.api.uri.UriResourcePartTyped;
-
-public abstract class UriResourceTypedImpl extends UriResourceImpl implements UriResourcePartTyped {
-
- protected EdmType typeFilter = null;
-
- public UriResourceTypedImpl(final UriResourceKind kind) {
- super(kind);
- }
-
- public EdmType getTypeFilter() {
- return typeFilter;
- }
-
- public UriResourceTypedImpl setTypeFilter(final EdmStructuredType typeFilter) {
- this.typeFilter = typeFilter;
- return this;
- }
-
- @Override
- public String toString(final boolean includeFilters) {
- if (includeFilters) {
- if (typeFilter != null) {
- return toString() + "/" + getFQN(typeFilter).toString();
- } else {
- return toString();
- }
- }
- return toString();
- }
-
- private FullQualifiedName getFQN(final EdmType type) {
- return new FullQualifiedName(type.getNamespace(), type.getName());
- }
-
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceValueImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceValueImpl.java
deleted file mode 100644
index 7611ecb..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceValueImpl.java
+++ /dev/null
@@ -1,36 +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.uri;
-
-import org.apache.olingo.server.api.uri.UriResourceKind;
-import org.apache.olingo.server.api.uri.UriResourceValue;
-
-public class UriResourceValueImpl extends UriResourceImpl implements UriResourceValue {
-
- public UriResourceValueImpl() {
- super(UriResourceKind.value);
-
- }
-
- @Override
- public String toString() {
- return "$value";
- }
-
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceWithKeysImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceWithKeysImpl.java
deleted file mode 100644
index 19d3639..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/UriResourceWithKeysImpl.java
+++ /dev/null
@@ -1,101 +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.uri;
-
-import org.apache.olingo.commons.api.edm.EdmType;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.server.api.uri.UriParameter;
-import org.apache.olingo.server.api.uri.UriResourceKind;
-import org.apache.olingo.server.api.uri.UriResourcePartTyped;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public abstract class UriResourceWithKeysImpl extends UriResourceImpl implements UriResourcePartTyped {
-
- protected EdmType collectionTypeFilter = null;
- protected List<UriParameterImpl> keyPredicates = null;
- protected EdmType entryTypeFilter = null;
-
- public UriResourceWithKeysImpl(final UriResourceKind kind) {
- super(kind);
- }
-
- public EdmType getTypeFilterOnCollection() {
- return collectionTypeFilter;
- }
-
- public EdmType getTypeFilterOnEntry() {
- return entryTypeFilter;
- }
-
- public List<UriParameter> getKeyPredicates() {
- List<UriParameter> retList = new ArrayList<UriParameter>();
- if (keyPredicates != null) {
- for (UriParameterImpl item : keyPredicates) {
- retList.add(item);
- }
- }
- return retList;
- }
-
- public UriResourceWithKeysImpl setKeyPredicates(final List<UriParameterImpl> list) {
- keyPredicates = list;
- return this;
- }
-
- public UriResourceWithKeysImpl setEntryTypeFilter(final EdmType entryTypeFilter) {
- this.entryTypeFilter = entryTypeFilter;
- return this;
- }
-
- public UriResourceWithKeysImpl setCollectionTypeFilter(final EdmType collectionTypeFilter) {
- this.collectionTypeFilter = collectionTypeFilter;
- return this;
- }
-
- @Override
- public String toString(final boolean includeFilters) {
-
- if (includeFilters == true) {
- String tmp = "";
- if (collectionTypeFilter != null) {
- tmp += getFQN(collectionTypeFilter).toString();
- }
-
- if (entryTypeFilter != null) {
- if (tmp.length() == 0) {
- tmp = getFQN(entryTypeFilter).toString();
- } else {
- tmp += "/()" + getFQN(entryTypeFilter).toString();
- }
- }
- if (tmp.length() != 0) {
- return toString() + "/" + tmp;
- }
- }
-
- return toString();
- }
-
- private FullQualifiedName getFQN(final EdmType type) {
- return new FullQualifiedName(type.getNamespace(), type.getName());
- }
-
-}
\ No newline at end of file
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/CheckFullContextListener.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/CheckFullContextListener.java
deleted file mode 100644
index 2b529bd..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/CheckFullContextListener.java
+++ /dev/null
@@ -1,60 +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.uri.parser;
-
-import org.antlr.v4.runtime.DiagnosticErrorListener;
-import org.antlr.v4.runtime.Parser;
-import org.antlr.v4.runtime.RecognitionException;
-import org.antlr.v4.runtime.Recognizer;
-import org.antlr.v4.runtime.atn.ATNConfigSet;
-import org.antlr.v4.runtime.dfa.DFA;
-
-import java.util.BitSet;
-
-class CheckFullContextListener extends DiagnosticErrorListener {
-
- @Override
- public void syntaxError(final Recognizer<?, ?> recognizer, final Object offendingSymbol, final int line,
- final int charPositionInLine,
- final String msg, final RecognitionException e) {
- // System.err.println("syntaxError detected");
- }
-
- @Override
- public void reportAmbiguity(final Parser recognizer, final DFA dfa, final int startIndex, final int stopIndex,
- final boolean exact,
- final BitSet ambigAlts, final ATNConfigSet configs) {
- // System.err.println("reportAmbiguity detected");
- }
-
- @Override
- public void reportAttemptingFullContext(final Parser recognizer, final DFA dfa, final int startIndex,
- final int stopIndex,
- final BitSet conflictingAlts, final ATNConfigSet configs) {
- // System.err.println("reportAttemptingFullContext detected");
- }
-
- @Override
- public void reportContextSensitivity(final Parser recognizer, final DFA dfa, final int startIndex,
- final int stopIndex, final int prediction,
- final ATNConfigSet configs) {
- // System.err.println("reportContextSensitivity detected");
- }
-
-}
\ No newline at end of file
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/Parser.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/Parser.java
deleted file mode 100644
index a22933f..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/Parser.java
+++ /dev/null
@@ -1,487 +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.uri.parser;
-
-import org.antlr.v4.runtime.ANTLRInputStream;
-import org.antlr.v4.runtime.BailErrorStrategy;
-import org.antlr.v4.runtime.CommonTokenStream;
-import org.antlr.v4.runtime.Lexer;
-import org.antlr.v4.runtime.ParserRuleContext;
-import org.antlr.v4.runtime.RecognitionException;
-import org.antlr.v4.runtime.Token;
-import org.antlr.v4.runtime.atn.PredictionMode;
-import org.antlr.v4.runtime.misc.ParseCancellationException;
-import org.apache.olingo.commons.api.ODataRuntimeException;
-import org.apache.olingo.commons.api.edm.Edm;
-import org.apache.olingo.commons.api.format.ODataFormat;
-import org.apache.olingo.server.api.uri.UriInfo;
-import org.apache.olingo.server.api.uri.UriInfoKind;
-import org.apache.olingo.server.api.uri.UriResource;
-import org.apache.olingo.server.api.uri.UriResourcePartTyped;
-import org.apache.olingo.server.api.uri.queryoption.SystemQueryOption;
-import org.apache.olingo.server.api.uri.queryoption.SystemQueryOptionKind;
-import org.apache.olingo.server.core.uri.UriInfoImpl;
-import org.apache.olingo.server.core.uri.antlr.UriLexer;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.AllEOFContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.BatchEOFContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.CrossjoinEOFContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.EntityEOFContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.ExpandItemsEOFContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.FilterExpressionEOFContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.MetadataEOFContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.OrderByEOFContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.PathSegmentEOFContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.SelectEOFContext;
-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;
-import org.apache.olingo.server.core.uri.queryoption.FilterOptionImpl;
-import org.apache.olingo.server.core.uri.queryoption.FormatOptionImpl;
-import org.apache.olingo.server.core.uri.queryoption.IdOptionImpl;
-import org.apache.olingo.server.core.uri.queryoption.OrderByOptionImpl;
-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 java.util.ArrayList;
-import java.util.List;
-
-public class Parser {
- int logLevel = 0;
-
- private enum ParserEntryRules {
- All, Batch, CrossJoin, Entity, ExpandItems, FilterExpression, Metadata, PathSegment, Orderby, Select
- };
-
- public Parser setLogLevel(final int logLevel) {
- this.logLevel = logLevel;
- return this;
- }
-
- public UriInfo parseUri(final String path, final String query, final String fragment, final Edm edm)
- throws UriParserException {
-
- UriContext context = new UriContext();
- UriParseTreeVisitor uriParseTreeVisitor = new UriParseTreeVisitor(edm, context);
-
- try {
- final RawUri uri = UriDecoder.decodeUri(path, query, fragment, 0); // -> 0 segments are before the service url
-
- // first, read the decoded path segments
- final String firstSegment = uri.pathSegmentListDecoded.isEmpty() ? "" : uri.pathSegmentListDecoded.get(0);
-
- if (firstSegment.isEmpty()) {
- ensureLastSegment(firstSegment, 0, uri.pathSegmentListDecoded.size());
- context.contextUriInfo = new UriInfoImpl().setKind(UriInfoKind.service);
- } else if (firstSegment.startsWith("$batch")) {
- ensureLastSegment(firstSegment, 1, uri.pathSegmentListDecoded.size());
- BatchEOFContext ctxBatchEOF =
- (BatchEOFContext) parseRule(uri.pathSegmentListDecoded.get(0), ParserEntryRules.Batch);
-
- uriParseTreeVisitor.visitBatchEOF(ctxBatchEOF);
- } else if (firstSegment.startsWith("$metadata")) {
- ensureLastSegment(firstSegment, 1, uri.pathSegmentListDecoded.size());
- MetadataEOFContext ctxMetadataEOF =
- (MetadataEOFContext) parseRule(uri.pathSegmentListDecoded.get(0), ParserEntryRules.Metadata);
-
- uriParseTreeVisitor.visitMetadataEOF(ctxMetadataEOF);
-
- context.contextUriInfo.setFragment(uri.fragment);
- } else if (firstSegment.startsWith("$entity")) {
-
- context.contextUriInfo = new UriInfoImpl().setKind(UriInfoKind.entityId);
- if (uri.pathSegmentListDecoded.size() > 1) {
- final String typeCastSegment = uri.pathSegmentListDecoded.get(1);
- ensureLastSegment(typeCastSegment, 2, uri.pathSegmentListDecoded.size());
- EntityEOFContext ctxEntityEOF =
- (EntityEOFContext) parseRule(typeCastSegment, ParserEntryRules.Entity);
- uriParseTreeVisitor.visitEntityEOF(ctxEntityEOF);
- }
-
- } else if (firstSegment.startsWith("$all")) {
- ensureLastSegment(firstSegment, 1, uri.pathSegmentListDecoded.size());
- AllEOFContext ctxResourcePathEOF =
- (AllEOFContext) parseRule(uri.pathSegmentListDecoded.get(0), ParserEntryRules.All);
-
- uriParseTreeVisitor.visitAllEOF(ctxResourcePathEOF);
- } else if (firstSegment.startsWith("$crossjoin")) {
- ensureLastSegment(firstSegment, 1, uri.pathSegmentListDecoded.size());
- CrossjoinEOFContext ctxResourcePathEOF =
- (CrossjoinEOFContext) parseRule(uri.pathSegmentListDecoded.get(0), ParserEntryRules.CrossJoin);
-
- uriParseTreeVisitor.visitCrossjoinEOF(ctxResourcePathEOF);
- } else {
- List<PathSegmentEOFContext> ctxPathSegments = new ArrayList<PathSegmentEOFContext>();
- for (String pathSegment : uri.pathSegmentListDecoded) {
- PathSegmentEOFContext ctxPathSegment =
- (PathSegmentEOFContext) parseRule(pathSegment, ParserEntryRules.PathSegment);
- ctxPathSegments.add(ctxPathSegment);
- }
-
- context.contextUriInfo = new UriInfoImpl().setKind(UriInfoKind.resource);
-
- for (PathSegmentEOFContext ctxPathSegment : ctxPathSegments) {
- // add checks for batch, entity, metadata, all, crossjoin
- uriParseTreeVisitor.visitPathSegmentEOF(ctxPathSegment);
- }
-
- UriResource lastSegment = context.contextUriInfo.getLastResourcePart();
- if (lastSegment instanceof UriResourcePartTyped) {
- UriResourcePartTyped typed = (UriResourcePartTyped) lastSegment;
-
- UriParseTreeVisitor.TypeInformation myType = uriParseTreeVisitor.getTypeInformation(typed);
- UriParseTreeVisitor.TypeInformation typeInfo =
- uriParseTreeVisitor.new TypeInformation(myType.type, typed.isCollection());
- context.contextTypes.push(typeInfo);
- }
- }
-
- // second, read the system query options and the custom query options
- for (RawUri.QueryOption option : uri.queryOptionListDecoded) {
- if (option.name.startsWith("$")) {
- SystemQueryOption systemOption = null;
- if (option.name.equals(SystemQueryOptionKind.FILTER.toString())) {
- FilterExpressionEOFContext ctxFilterExpression =
- (FilterExpressionEOFContext) parseRule(option.value, ParserEntryRules.FilterExpression);
-
- FilterOptionImpl filterOption =
- (FilterOptionImpl) uriParseTreeVisitor.visitFilterExpressionEOF(ctxFilterExpression);
-
- systemOption = filterOption;
-
- } else if (option.name.equals(SystemQueryOptionKind.FORMAT.toString())) {
- FormatOptionImpl formatOption = new FormatOptionImpl();
- formatOption.setName(option.name);
- formatOption.setText(option.value);
- if (option.value.equalsIgnoreCase(ODataFormat.JSON.name())
- || option.value.equalsIgnoreCase(ODataFormat.XML.name())
- || option.value.equalsIgnoreCase(ODataFormat.ATOM.name())
- || isFormatSyntaxValid(option.value)) {
- formatOption.setFormat(option.value);
- } else {
- throw new UriParserSyntaxException("Illegal value of $format option!",
- UriParserSyntaxException.MessageKeys.WRONG_VALUE_FOR_SYSTEM_QUERY_OPTION_FORMAT, option.value);
- }
- systemOption = formatOption;
-
- } else if (option.name.equals(SystemQueryOptionKind.EXPAND.toString())) {
- ExpandItemsEOFContext ctxExpandItems =
- (ExpandItemsEOFContext) parseRule(option.value, ParserEntryRules.ExpandItems);
-
- ExpandOptionImpl expandOption =
- (ExpandOptionImpl) uriParseTreeVisitor.visitExpandItemsEOF(ctxExpandItems);
-
- systemOption = expandOption;
-
- } else if (option.name.equals(SystemQueryOptionKind.ID.toString())) {
- IdOptionImpl idOption = new IdOptionImpl();
- idOption.setName(option.name);
- idOption.setText(option.value);
- idOption.setValue(option.value);
- systemOption = idOption;
- } else if (option.name.equals(SystemQueryOptionKind.LEVELS.toString())) {
- throw new UriParserSyntaxException("System query option '$levels' is allowed only inside '$expand'!",
- UriParserSyntaxException.MessageKeys.SYSTEM_QUERY_OPTION_LEVELS_NOT_ALLOWED_HERE);
- } else if (option.name.equals(SystemQueryOptionKind.ORDERBY.toString())) {
- OrderByEOFContext ctxOrderByExpression =
- (OrderByEOFContext) parseRule(option.value, ParserEntryRules.Orderby);
-
- OrderByOptionImpl orderByOption =
- (OrderByOptionImpl) uriParseTreeVisitor.visitOrderByEOF(ctxOrderByExpression);
-
- systemOption = orderByOption;
- } else if (option.name.equals(SystemQueryOptionKind.SEARCH.toString())) {
- throw new RuntimeException("System query option '$search' not implemented!");
- } else if (option.name.equals(SystemQueryOptionKind.SELECT.toString())) {
- SelectEOFContext ctxSelectEOF =
- (SelectEOFContext) parseRule(option.value, ParserEntryRules.Select);
-
- SelectOptionImpl selectOption =
- (SelectOptionImpl) uriParseTreeVisitor.visitSelectEOF(ctxSelectEOF);
-
- systemOption = selectOption;
- } else if (option.name.equals(SystemQueryOptionKind.SKIP.toString())) {
- SkipOptionImpl skipOption = new SkipOptionImpl();
- skipOption.setName(option.name);
- skipOption.setText(option.value);
- try {
- skipOption.setValue(Integer.parseInt(option.value));
- } catch (final NumberFormatException e) {
- throw new UriParserSyntaxException("Illegal value of $skip option!", e,
- UriParserSyntaxException.MessageKeys.WRONG_VALUE_FOR_SYSTEM_QUERY_OPTION,
- option.name, option.value);
- }
- systemOption = skipOption;
- } else if (option.name.equals(SystemQueryOptionKind.SKIPTOKEN.toString())) {
- SkipTokenOptionImpl skipTokenOption = new SkipTokenOptionImpl();
- skipTokenOption.setName(option.name);
- skipTokenOption.setText(option.value);
- skipTokenOption.setValue(option.value);
- systemOption = skipTokenOption;
- } else if (option.name.equals(SystemQueryOptionKind.TOP.toString())) {
- TopOptionImpl topOption = new TopOptionImpl();
- topOption.setName(option.name);
- topOption.setText(option.value);
- try {
- topOption.setValue(Integer.parseInt(option.value));
- } catch (final NumberFormatException e) {
- throw new UriParserSyntaxException("Illegal value of $top option!", e,
- UriParserSyntaxException.MessageKeys.WRONG_VALUE_FOR_SYSTEM_QUERY_OPTION,
- option.name, option.value);
- }
- systemOption = topOption;
- } else if (option.name.equals(SystemQueryOptionKind.COUNT.toString())) {
- CountOptionImpl inlineCountOption = new CountOptionImpl();
- inlineCountOption.setName(option.name);
- inlineCountOption.setText(option.value);
- if (option.value.equals("true") || option.value.equals("false")) {
- inlineCountOption.setValue(Boolean.parseBoolean(option.value));
- } else {
- throw new UriParserSyntaxException("Illegal value of $count option!",
- UriParserSyntaxException.MessageKeys.WRONG_VALUE_FOR_SYSTEM_QUERY_OPTION,
- option.name, option.value);
- }
- systemOption = inlineCountOption;
- } else {
- throw new UriParserSyntaxException("Unknown system query option!",
- UriParserSyntaxException.MessageKeys.UNKNOWN_SYSTEM_QUERY_OPTION, option.name);
- }
- try {
- context.contextUriInfo.setSystemQueryOption(systemOption);
- } catch (final ODataRuntimeException e) {
- throw new UriParserSyntaxException("Double system query option!", e,
- UriParserSyntaxException.MessageKeys.DOUBLE_SYSTEM_QUERY_OPTION, option.name);
- }
- } else {
- CustomQueryOptionImpl customOption = new CustomQueryOptionImpl();
- customOption.setName(option.name);
- customOption.setText(option.value);
- context.contextUriInfo.addCustomQueryOption(customOption);
- }
- }
-
- return context.contextUriInfo;
- } catch (ParseCancellationException e) {
- throw e.getCause() instanceof UriParserException ?
- (UriParserException) e.getCause() :
- new UriParserSyntaxException("Syntax error", e, UriParserSyntaxException.MessageKeys.SYNTAX);
- }
- }
-
- private void ensureLastSegment(final String segment, final int pos, final int size)
- throws UriParserSyntaxException {
- if (pos < size) {
- throw new UriParserSyntaxException(segment + " must be the last segment.",
- UriParserSyntaxException.MessageKeys.MUST_BE_LAST_SEGMENT, segment);
- }
- }
-
- private boolean isFormatSyntaxValid(final String value) {
- final int index = value.indexOf('/');
- return index > 0 && index < value.length() - 1 && index == value.lastIndexOf('/');
- }
-
- private ParserRuleContext parseRule(final String input, final ParserEntryRules entryPoint)
- throws UriParserSyntaxException {
- UriParserParser parser = null;
- UriLexer lexer = null;
- ParserRuleContext ret = null;
-
- // Use 2 stage approach to improve performance
- // see https://github.com/antlr/antlr4/issues/192
-
- // stage = 1
- try {
-
- // create parser
- if (logLevel > 0) {
- lexer = new UriLexer(new ANTLRInputStream(input));
- showTokens(input, lexer.getAllTokens());
- }
-
- lexer = new UriLexer(new ANTLRInputStream(input));
- parser = new UriParserParser(new CommonTokenStream(lexer));
-
- // Set error strategy
- addStage1ErrorStategy(parser);
-
- // Set error collector
- addStage1ErrorListener(parser);
-
- // user the faster LL parsing
- parser.getInterpreter().setPredictionMode(PredictionMode.SLL);
-
- // parse
- switch (entryPoint) {
- case All:
- ret = parser.allEOF();
- break;
- case Batch:
- ret = parser.batchEOF();
- break;
- case CrossJoin:
- ret = parser.crossjoinEOF();
- break;
- case Metadata:
- ret = parser.metadataEOF();
- break;
- case PathSegment:
- ret = parser.pathSegmentEOF();
- break;
- case FilterExpression:
- lexer.mode(Lexer.DEFAULT_MODE);
- ret = parser.filterExpressionEOF();
- break;
- case Orderby:
- lexer.mode(Lexer.DEFAULT_MODE);
- ret = parser.orderByEOF();
- break;
- case ExpandItems:
- lexer.mode(Lexer.DEFAULT_MODE);
- ret = parser.expandItemsEOF();
- break;
- case Entity:
- ret = parser.entityEOF();
- break;
- case Select:
- ret = parser.selectEOF();
- break;
- default:
- break;
-
- }
-
- } catch (ParseCancellationException hardException) {
- // stage = 2
- try {
-
- // create parser
- lexer = new UriLexer(new ANTLRInputStream(input));
- parser = new UriParserParser(new CommonTokenStream(lexer));
-
- // Set error strategy
- addStage2ErrorStategy(parser);
-
- // Set error collector
- addStage2ErrorListener(parser);
-
- // Use the slower SLL parsing
- parser.getInterpreter().setPredictionMode(PredictionMode.LL);
-
- // parse
- switch (entryPoint) {
- case All:
- ret = parser.allEOF();
- break;
- case Batch:
- ret = parser.batchEOF();
- break;
- case CrossJoin:
- ret = parser.crossjoinEOF();
- break;
- case Metadata:
- ret = parser.metadataEOF();
- break;
- case PathSegment:
- ret = parser.pathSegmentEOF();
- break;
- case FilterExpression:
- lexer.mode(Lexer.DEFAULT_MODE);
- ret = parser.filterExpressionEOF();
- break;
- case Orderby:
- lexer.mode(Lexer.DEFAULT_MODE);
- ret = parser.orderByEOF();
- break;
- case ExpandItems:
- lexer.mode(Lexer.DEFAULT_MODE);
- ret = parser.expandItemsEOF();
- break;
- case Entity:
- ret = parser.entityEOF();
- break;
- case Select:
- ret = parser.selectEOF();
- break;
- default:
- break;
- }
-
- } catch (final RecognitionException weakException) {
- throw new UriParserSyntaxException("Error in syntax", weakException,
- UriParserSyntaxException.MessageKeys.SYNTAX);
-
- // exceptionOnStage = 2;
- }
- } catch (final RecognitionException hardException) {
- throw new UriParserSyntaxException("Error in syntax", hardException,
- UriParserSyntaxException.MessageKeys.SYNTAX);
- }
-
- return ret;
- }
-
- protected void addStage1ErrorStategy(final UriParserParser parser) {
- // Throw exception at first syntax error
- parser.setErrorHandler(new BailErrorStrategy());
-
- }
-
- protected void addStage2ErrorStategy(final UriParserParser parser) {
- // Throw exception at first syntax error
- parser.setErrorHandler(new BailErrorStrategy());
- }
-
- protected void addStage1ErrorListener(final UriParserParser parser) {
- // No error logging to System.out or System.err, only exceptions used (depending on ErrorStrategy)
- parser.removeErrorListeners();
- parser.addErrorListener(new CheckFullContextListener());
-
- }
-
- protected void addStage2ErrorListener(final UriParserParser parser) {
- // No error logging to System.out or System.err, only exceptions used (depending on ErrorStrategy)
- parser.removeErrorListeners();
- }
-
- public void showTokens(final String input, final List<? extends Token> list) {
- boolean first = true;
- System.out.println("input: " + input);
- String nL = "\n";
- String out = "[" + nL;
- for (Token token : list) {
- if (!first) {
- out += ",";
- first = false;
- }
- int index = token.getType();
- if (index != -1) {
- out += "\"" + token.getText() + "\"" + " " + UriLexer.tokenNames[index] + nL;
- } else {
- out += "\"" + token.getText() + "\"" + " " + index + nL;
- }
- }
- out += ']';
- System.out.println("tokens: " + out);
- return;
- }
-
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/RawUri.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/RawUri.java
deleted file mode 100644
index 42e0a0f..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/RawUri.java
+++ /dev/null
@@ -1,46 +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.uri.parser;
-
-import java.util.List;
-
-public class RawUri {
- public String uri;
- public String scheme;
- public String authority;
- public String path;
- public String queryOptionString;
- public String fragment;
- public List<QueryOption> queryOptionList;
- public List<QueryOption> queryOptionListDecoded;
-
- public List<String> pathSegmentList;
- public List<String> pathSegmentListDecoded;
-
- public static class QueryOption {
- public String name;
- public String value;
-
- QueryOption(final String name, final String value) {
- this.name = name;
- this.value = value;
- }
-
- }
-}
\ No newline at end of file
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriContext.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriContext.java
deleted file mode 100644
index b99433d..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriContext.java
+++ /dev/null
@@ -1,97 +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.uri.parser;
-
-import org.apache.olingo.commons.api.edm.EdmType;
-import org.apache.olingo.server.core.uri.UriInfoImpl;
-import org.apache.olingo.server.core.uri.parser.UriParseTreeVisitor.TypeInformation;
-import org.apache.olingo.server.core.uri.queryoption.ExpandItemImpl;
-import org.apache.olingo.server.core.uri.queryoption.SelectItemImpl;
-
-import java.util.Stack;
-
-/**
- * UriContext object used for holding information for URI parsing.
- *
- */
-public class UriContext {
-
- public static class LambdaVariables {
- public boolean isCollection;
- public String name;
- public EdmType type;
- }
-
- /**
- * Hold all currently allowed lambda variables
- * As lambda functions can be nested there may be more than one allowed lambda variables at a time while parsing a
- * $filter or $orderby expressions.
- */
- public Stack<LambdaVariables> allowedLambdaVariables;
- /**
- * Used to stack type information for nested $expand, $filter query options and other cases.
- */
- public Stack<TypeInformation> contextTypes;
-
- // CHECKSTYLE:OFF (Maven checkstyle)
- /**
- * Set within method
- * {@link org.apache.olingo.server.core.uri.antlr.UriParserBaseVisitor#visitExpandItem(
- * org.apache.olingo.server.core.uri.antlr.UriParserParser.ExpandItemContext ctx)}
- * and {@link
- * org.apache.olingo.server.core.uri.antlr.UriParserBaseVisitor#visitExpandPathExtension(
- * org.apache.olingo.server.core.uri.antlr.UriParserParser.ExpandPathExtensionContext ctx)} to allow nodes
- * deeper in the expand tree at
- * {@link org.apache.olingo.server.core.uri.antlr.UriParserBaseVisitor#visitExpandPathExtension(
- * org.apache.olingo.server.core.uri.antlr.UriParserParser.ExpandPathExtensionContext ctx)}
- * appending path
- * segments to the currently processed {@link ExpandItemImpl}.
- */
- public ExpandItemImpl contextExpandItemPath;
- // CHECKSTYLE:ON (Maven checkstyle)
-
- /**
- * Set within method
- * {@link org.apache.olingo.server.core.uri.antlr.UriParserBaseVisitor#visitSelectItem(
- * org.apache.olingo.server.core.uri.antlr.UriParserParser.SelectItemContext ctx)} to allow
- * nodes
- * deeper in the expand tree at
- * {@link org.apache.olingo.server.core.uri.antlr.UriParserBaseVisitor#visitSelectSegment(
- * org.apache.olingo.server.core.uri.antlr.UriParserParser.SelectSegmentContext ctx)}
- * appending path segments to the
- * currently processed {@link SelectItemImpl}.
- */
- public SelectItemImpl contextSelectItem;
- /**
- * Stores the currently processed UriInfo objects. There is one URI Info object for the resource path
- * and one for each new first member access within $filter and $orderBy options.
- */
- public UriInfoImpl contextUriInfo;
- public boolean contextReadingFunctionParameters;
-
- public UriContext() {
-
- contextExpandItemPath = null;
- contextReadingFunctionParameters = false;
- contextSelectItem = null;
- contextTypes = new Stack<UriParseTreeVisitor.TypeInformation>();
- allowedLambdaVariables = new Stack<UriContext.LambdaVariables>();
-
- }
-}
\ No newline at end of file
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriDecoder.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriDecoder.java
deleted file mode 100644
index 8585edb..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriDecoder.java
+++ /dev/null
@@ -1,120 +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.uri.parser;
-
-import org.apache.olingo.commons.core.Decoder;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.LinkedList;
-import java.util.List;
-
-public class UriDecoder {
-
- public static RawUri decodeUri(final String path, final String query, final String fragment,
- final int skipSegments) throws UriParserSyntaxException {
- RawUri rawUri = new RawUri();
-
- rawUri.path = path;
- rawUri.queryOptionString = query;
- rawUri.fragment = fragment;
-
- rawUri.pathSegmentList = splitPath(path, skipSegments);
- rawUri.queryOptionList = splitOptions(query);
- decode(rawUri);
-
- return rawUri;
- }
-
- private static void decode(RawUri rawUri) throws UriParserSyntaxException {
- rawUri.pathSegmentListDecoded = new ArrayList<String>();
- for (String segment : rawUri.pathSegmentList) {
- rawUri.pathSegmentListDecoded.add(decode(segment));
- }
-
- rawUri.queryOptionListDecoded = new ArrayList<RawUri.QueryOption>();
- for (RawUri.QueryOption optionPair : rawUri.queryOptionList) {
- rawUri.queryOptionListDecoded.add(new RawUri.QueryOption(
- decode(optionPair.name),
- decode(optionPair.value)));
- }
- }
-
- private static List<RawUri.QueryOption> splitOptions(final String queryOptionString) {
- if (queryOptionString == null) {
- return Collections.<RawUri.QueryOption> emptyList();
- }
-
- List<RawUri.QueryOption> queryOptionList = new ArrayList<RawUri.QueryOption>();
- for (String option : split(queryOptionString, '&')) {
- if (option.length() != 0) {
- final List<String> pair = splitFirst(option, '=');
- queryOptionList.add(new RawUri.QueryOption(pair.get(0), pair.get(1)));
- }
- }
- return queryOptionList;
- }
-
- private static List<String> splitFirst(final String input, final char c) {
- int pos = input.indexOf(c, 0);
- if (pos >= 0) {
- return Arrays.asList(input.substring(0, pos), input.substring(pos + 1));
- } else {
- return Arrays.asList(input, "");
- }
- }
-
- private static List<String> splitPath(final String path, int skipSegments) {
- List<String> list = split(path, '/');
-
- // Empty path segments of the resource path are removed.
- while (list.remove("")) {
- // this place intentionally left blank
- ;
- }
-
- return skipSegments > 0 ? list.subList(skipSegments, list.size()) : list;
- }
-
- public static List<String> split(final String input, final char c) {
-
- List<String> list = new LinkedList<String>();
-
- int start = 0;
- int end = -1;
-
- while ((end = input.indexOf(c, start)) >= 0) {
- list.add(input.substring(start, end));
- start = end + 1;
- }
-
- list.add(input.substring(start));
-
- return list;
- }
-
- public static String decode(final String encoded) throws UriParserSyntaxException {
- try {
- return Decoder.decode(encoded);
- } catch (final IllegalArgumentException e) {
- throw new UriParserSyntaxException("Wrong percent encoding!", e, UriParserSyntaxException.MessageKeys.SYNTAX);
- }
- }
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriParseTreeVisitor.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriParseTreeVisitor.java
deleted file mode 100644
index 0a582dc..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriParseTreeVisitor.java
+++ /dev/null
@@ -1,2204 +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.uri.parser;
-
-import org.antlr.v4.runtime.misc.NotNull;
-import org.antlr.v4.runtime.misc.ParseCancellationException;
-import org.antlr.v4.runtime.tree.ParseTree;
-import org.apache.olingo.commons.api.edm.Edm;
-import org.apache.olingo.commons.api.edm.EdmAction;
-import org.apache.olingo.commons.api.edm.EdmActionImport;
-import org.apache.olingo.commons.api.edm.EdmComplexType;
-import org.apache.olingo.commons.api.edm.EdmElement;
-import org.apache.olingo.commons.api.edm.EdmEntityContainer;
-import org.apache.olingo.commons.api.edm.EdmEntitySet;
-import org.apache.olingo.commons.api.edm.EdmEntityType;
-import org.apache.olingo.commons.api.edm.EdmEnumType;
-import org.apache.olingo.commons.api.edm.EdmFunction;
-import org.apache.olingo.commons.api.edm.EdmFunctionImport;
-import org.apache.olingo.commons.api.edm.EdmNavigationProperty;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
-import org.apache.olingo.commons.api.edm.EdmProperty;
-import org.apache.olingo.commons.api.edm.EdmSingleton;
-import org.apache.olingo.commons.api.edm.EdmStructuredType;
-import org.apache.olingo.commons.api.edm.EdmType;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
-import org.apache.olingo.server.api.uri.UriInfoKind;
-import org.apache.olingo.server.api.uri.UriResource;
-import org.apache.olingo.server.api.uri.UriResourcePartTyped;
-import org.apache.olingo.server.api.uri.queryoption.expression.BinaryOperatorKind;
-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.uri.UriInfoImpl;
-import org.apache.olingo.server.core.uri.UriParameterImpl;
-import org.apache.olingo.server.core.uri.UriResourceActionImpl;
-import org.apache.olingo.server.core.uri.UriResourceComplexPropertyImpl;
-import org.apache.olingo.server.core.uri.UriResourceCountImpl;
-import org.apache.olingo.server.core.uri.UriResourceEntitySetImpl;
-import org.apache.olingo.server.core.uri.UriResourceFunctionImpl;
-import org.apache.olingo.server.core.uri.UriResourceImpl;
-import org.apache.olingo.server.core.uri.UriResourceItImpl;
-import org.apache.olingo.server.core.uri.UriResourceLambdaAllImpl;
-import org.apache.olingo.server.core.uri.UriResourceLambdaAnyImpl;
-import org.apache.olingo.server.core.uri.UriResourceLambdaVarImpl;
-import org.apache.olingo.server.core.uri.UriResourceNavigationPropertyImpl;
-import org.apache.olingo.server.core.uri.UriResourcePrimitivePropertyImpl;
-import org.apache.olingo.server.core.uri.UriResourceRefImpl;
-import org.apache.olingo.server.core.uri.UriResourceRootImpl;
-import org.apache.olingo.server.core.uri.UriResourceSingletonImpl;
-import org.apache.olingo.server.core.uri.UriResourceStartingTypeFilterImpl;
-import org.apache.olingo.server.core.uri.UriResourceTypedImpl;
-import org.apache.olingo.server.core.uri.UriResourceValueImpl;
-import org.apache.olingo.server.core.uri.UriResourceWithKeysImpl;
-import org.apache.olingo.server.core.uri.antlr.UriLexer;
-import org.apache.olingo.server.core.uri.antlr.UriParserBaseVisitor;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.AllEOFContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.AllExprContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.AltAddContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.AltAllContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.AltAndContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.AltAnyContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.AltComparismContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.AltEqualityContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.AltHasContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.AltMultContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.AltOrContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.AnyExprContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.BatchEOFContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.BooleanNonCaseContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.CastExprContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.CeilingMethodCallExprContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.ConcatMethodCallExprContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.ConstSegmentContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.ContainsMethodCallExprContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.CrossjoinEOFContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.DateMethodCallExprContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.DayMethodCallExprContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.EndsWithMethodCallExprContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.EntityEOFContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.EnumLitContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.ExpandCountOptionContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.ExpandItemContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.ExpandItemsContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.ExpandOptionContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.ExpandPathContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.ExpandPathExtensionContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.ExpandRefOptionContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.FilterContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.FilterExpressionEOFContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.FloorMethodCallExprContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.FractionalsecondsMethodCallExprContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.GeoDistanceMethodCallExprContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.GeoIntersectsMethodCallExprContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.GeoLengthMethodCallExprContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.HourMethodCallExprContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.IndexOfMethodCallExprContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.InlinecountContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.IsofExprContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.LengthMethodCallExprContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.LevelsContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.MaxDateTimeMethodCallExprContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.MemberExprContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.MetadataEOFContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.MinDateTimeMethodCallExprContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.MinuteMethodCallExprContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.MonthMethodCallExprContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.NameValueOptListContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.NameValuePairContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.NamespaceContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.NaninfinityContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.NowMethodCallExprContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.NullruleContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.OdataIdentifierContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.OrderByContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.OrderByEOFContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.OrderByItemContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.OrderListContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.PathSegmentContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.PathSegmentsContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.PrimitiveLiteralContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.QueryOptionContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.QueryOptionsContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.RootExprContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.RoundMethodCallExprContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.SecondMethodCallExprContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.SelectContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.SelectEOFContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.SelectItemContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.SelectSegmentContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.SkipContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.SkiptokenContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.StartsWithMethodCallExprContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.SubstringMethodCallExprContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.TimeMethodCallExprContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.ToLowerMethodCallExprContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.ToUpperMethodCallExprContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.TopContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.TotalOffsetMinutesMethodCallExprContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.TotalsecondsMethodCallExprContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.TrimMethodCallExprContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser.YearMethodCallExprContext;
-import org.apache.olingo.server.core.uri.queryoption.CountOptionImpl;
-import org.apache.olingo.server.core.uri.queryoption.ExpandItemImpl;
-import org.apache.olingo.server.core.uri.queryoption.ExpandOptionImpl;
-import org.apache.olingo.server.core.uri.queryoption.FilterOptionImpl;
-import org.apache.olingo.server.core.uri.queryoption.LevelsOptionImpl;
-import org.apache.olingo.server.core.uri.queryoption.OrderByItemImpl;
-import org.apache.olingo.server.core.uri.queryoption.OrderByOptionImpl;
-import org.apache.olingo.server.core.uri.queryoption.QueryOptionImpl;
-import org.apache.olingo.server.core.uri.queryoption.SelectItemImpl;
-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.SystemQueryOptionImpl;
-import org.apache.olingo.server.core.uri.queryoption.TopOptionImpl;
-import org.apache.olingo.server.core.uri.queryoption.expression.AliasImpl;
-import org.apache.olingo.server.core.uri.queryoption.expression.BinaryImpl;
-import org.apache.olingo.server.core.uri.queryoption.expression.EnumerationImpl;
-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.queryoption.expression.MemberImpl;
-import org.apache.olingo.server.core.uri.queryoption.expression.MethodImpl;
-import org.apache.olingo.server.core.uri.queryoption.expression.TypeLiteralImpl;
-import org.apache.olingo.server.core.uri.queryoption.expression.UnaryImpl;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-/**
- * UriVisitor
- *
- * Converts the URI parse tree the generated by ANTLR into an internal representation which maybe is given to the
- * application. While converting the tree is only validated against the EDM if necessary.
- *
- * Attention:
- * <li> This UriVisitor is at somes point more lax than the original ABNF
- * <li> It is more tolerable against additional white spaces Currently not supported
- * <li>Parsing the context of $metadata</li>
- * <li>Parsing $search</li>
- */
-public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
-
- public class TypeInformation {
-
- boolean isCollection;
-
- EdmType type;
-
- TypeInformation(final EdmType type, final boolean isCollection) {
- this.type = type;
- this.isCollection = isCollection;
- }
-
- public TypeInformation() {}
- }
-
- public UriContext context = null;
-
- public Edm edm;
-
- public EdmEntityContainer edmEntityContainer;
-
- // --- class ---
- public UriParseTreeVisitor(final Edm edm, final UriContext context) {
- this.edm = edm;
- this.context = context;
- edmEntityContainer = edm.getEntityContainer(null);
- }
-
- @Override
- protected Object aggregateResult(final Object aggregate, final Object nextResult) {
- if (aggregate != null) {
- return aggregate;
- } else {
- return nextResult;
- }
- }
-
- private FullQualifiedName getFullNameFromContext(final NamespaceContext vNS, final String odi) {
- String namespace = vNS.getText();
- namespace = namespace.substring(0, namespace.length() - 1); // vNS contains a trailing point that has to be removed
- return new FullQualifiedName(namespace, odi);
- }
-
- private UriContext.LambdaVariables getLambdaVar(final String odi) {
- for (UriContext.LambdaVariables item : context.allowedLambdaVariables) {
- if (item.name.equals(odi)) {
- return item;
- }
- }
- return null;
- }
-
- TypeInformation getTypeInformation(final UriResource lastResourcePart) {
-
- TypeInformation typeInformation = new TypeInformation();
- if (lastResourcePart instanceof UriResourceWithKeysImpl) {
- UriResourceWithKeysImpl lastPartWithKeys = (UriResourceWithKeysImpl) lastResourcePart;
-
- if (lastPartWithKeys.getTypeFilterOnEntry() != null) {
- typeInformation.type = lastPartWithKeys.getTypeFilterOnEntry();
- } else if (lastPartWithKeys.getTypeFilterOnCollection() != null) {
- typeInformation.type = lastPartWithKeys.getTypeFilterOnCollection();
- } else {
- typeInformation.type = lastPartWithKeys.getType();
- }
- typeInformation.isCollection = lastPartWithKeys.isCollection();
-
- } else if (lastResourcePart instanceof UriResourceTypedImpl) {
- UriResourceTypedImpl lastPartTyped = (UriResourceTypedImpl) lastResourcePart;
-
- if (lastPartTyped.getTypeFilter() != null) {
- typeInformation.type = lastPartTyped.getTypeFilter();
- } else {
- typeInformation.type = lastPartTyped.getType();
- }
-
- typeInformation.isCollection = lastPartTyped.isCollection();
- }
-
- return typeInformation;
- }
-
- public UriResourceTypedImpl readResourcePathSegment(final PathSegmentContext ctx) {
-
- final boolean checkFirst =
- context.contextUriInfo.getLastResourcePart() == null
- || context.contextUriInfo.getLastResourcePart() instanceof UriResourceRootImpl;
-
- String odi = ctx.vODI.getText();
-
- if (checkFirst && ctx.vNS == null) {
-
- // check EntitySet
- EdmEntitySet edmEntitySet = edmEntityContainer.getEntitySet(odi);
- if (edmEntitySet != null) {
- UriResourceEntitySetImpl uriResource = new UriResourceEntitySetImpl()
- .setEntitSet(edmEntitySet);
- context.contextUriInfo.addResourcePart(uriResource);
- return null;
- }
-
- // check Singleton
- EdmSingleton edmSingleton = edmEntityContainer.getSingleton(odi);
- if (edmSingleton != null) {
- UriResourceSingletonImpl uriResource = new UriResourceSingletonImpl()
- .setSingleton(edmSingleton);
- context.contextUriInfo.addResourcePart(uriResource);
- return null;
- }
-
- // check ActionImport
- EdmActionImport edmActionImport = edmEntityContainer.getActionImport(odi);
- if (edmActionImport != null) {
- UriResourceActionImpl uriResource = new UriResourceActionImpl()
- .setActionImport(edmActionImport);
- context.contextUriInfo.addResourcePart(uriResource);
- return null;
- }
-
- // check FunctionImport
- EdmFunctionImport edmFunctionImport = edmEntityContainer.getFunctionImport(odi);
- if (edmFunctionImport != null) {
-
- // read the URI parameters
- context.contextReadingFunctionParameters = true;
- @SuppressWarnings("unchecked")
- List<UriParameterImpl> parameters = (List<UriParameterImpl>) ctx.vlNVO.get(0).accept(this);
- context.contextReadingFunctionParameters = false;
-
- // mark parameters as consumed
- ctx.vlNVO.remove(0);
-
- UriResourceFunctionImpl uriResource = new UriResourceFunctionImpl()
- .setFunctionImport(edmFunctionImport, parameters);
-
- // collect parameter names
- List<String> names = new ArrayList<String>();
- for (UriParameterImpl item : parameters) {
- names.add(item.getName());
- }
-
- // get function from function import
- EdmFunction function = edmFunctionImport.getUnboundFunction(names);
- if (function == null) {
- String tmp = "";
- for (String name : names) {
- tmp += (tmp.length() != 0 ? "," : "") + name;
- }
- throw wrap(new UriParserSemanticException("Function of functionimport '" + edmFunctionImport.getName()
- + "' with parameters [" + tmp + "] not found",
- UriParserSemanticException.MessageKeys.FUNCTION_NOT_FOUND, edmFunctionImport.getName(), tmp));
- }
-
- uriResource.setFunction(edmFunctionImport.getUnboundFunction(names));
- context.contextUriInfo.addResourcePart(uriResource);
- return null;
- }
- }
-
- TypeInformation source = null;
- UriResource lastResourcePart = context.contextUriInfo.getLastResourcePart();
-
- if (lastResourcePart == null) {
- if (context.contextTypes.size() == 0) {
- if(checkFirst && ctx.vNS == null){
- throw wrap(new UriParserSemanticException(
- "Cannot find EntitySet, Singleton, ActionImport or FunctionImport with name '" + odi + "'.",
- UriParserSemanticException.MessageKeys.RESOURCE_NOT_FOUND, odi));
- }
- throw wrap(new UriParserSemanticException("Resource part '" + odi + "' can only applied on typed "
- + "resource parts",
- UriParserSemanticException.MessageKeys.RESOURCE_PART_ONLY_FOR_TYPED_PARTS, odi));
- }
- source = context.contextTypes.peek();
- } else {
- source = getTypeInformation(lastResourcePart);
-
- if (source.type == null) {
- throw wrap(new UriParserSemanticException("Resource part '" + odi + "' can only be applied on typed "
- + "resource parts.", UriParserSemanticException.MessageKeys.RESOURCE_PART_ONLY_FOR_TYPED_PARTS, odi));
- }
- }
-
- if (ctx.vNS == null) { // without namespace
-
- // first check for lambda variable because a newly add property should not shadow a long used lambda variable
- UriContext.LambdaVariables lVar = getLambdaVar(odi);
- if (lVar != null) {
- UriResourceLambdaVarImpl lambdaResource = new UriResourceLambdaVarImpl();
- lambdaResource.setVariableText(lVar.name);
- lambdaResource.setType(lVar.type);
- lambdaResource.setCollection(lVar.isCollection);
- context.contextUriInfo.addResourcePart(lambdaResource);
- return null;
- }
-
- if (!(source.type instanceof EdmStructuredType)) {
- throw wrap(new UriParserSemanticException("Cannot parse '" + odi
- + "'; previous path segment is not a structural type.",
- UriParserSemanticException.MessageKeys.RESOURCE_PART_MUST_BE_PRECEDED_BY_STRUCTURAL_TYPE, odi));
- }
-
- if (ctx.depth() <= 2 // path evaluation for the resource path
- && source.isCollection) {
- throw wrap(new UriParserSemanticException("Property '" + odi + "' is not allowed after collection.",
- UriParserSemanticException.MessageKeys.PROPERTY_AFTER_COLLECTION, odi));
- }
-
- EdmStructuredType structType = (EdmStructuredType) source.type;
-
- EdmElement property = structType.getProperty(odi);
- if (property == null) {
- throw wrap(new UriParserSemanticException("Property '" + odi + "' not found in type '"
- + structType.getNamespace() + "." + structType.getName() + "'",
- ctx.depth() > 2 ? // path evaluation inside an expression or for the resource path?
- UriParserSemanticException.MessageKeys.EXPRESSION_PROPERTY_NOT_IN_TYPE :
- UriParserSemanticException.MessageKeys.PROPERTY_NOT_IN_TYPE,
- structType.getFullQualifiedName().toString(), odi));
- }
-
- if (property instanceof EdmProperty) {
- if (((EdmProperty) property).isPrimitive() == true) {
- // create simple property
- UriResourcePrimitivePropertyImpl simpleResource = new UriResourcePrimitivePropertyImpl()
- .setProperty((EdmProperty) property);
- context.contextUriInfo.addResourcePart(simpleResource);
- return null;
- } else {
- // create complex property
- UriResourceComplexPropertyImpl complexResource = new UriResourceComplexPropertyImpl()
- .setProperty((EdmProperty) property);
- context.contextUriInfo.addResourcePart(complexResource);
- return null;
- }
- } else if (property instanceof EdmNavigationProperty) {
- // create navigation property
- UriResourceNavigationPropertyImpl navigationResource = new UriResourceNavigationPropertyImpl()
- .setNavigationProperty((EdmNavigationProperty) property);
- context.contextUriInfo.addResourcePart(navigationResource);
- return null;
- } else {
- throw wrap(new UriParserSemanticException("Unkown type for property '" + property + "'",
- UriParserSemanticException.MessageKeys.UNKNOWN_PROPERTY_TYPE, property.getName()));
- }
-
- } else { // with namespace
-
- FullQualifiedName fullFilterName = getFullNameFromContext(ctx.vNS, odi);
-
- // EdmType lastType = getLastType(lastTyped);
- if (source.type instanceof EdmEntityType) {
-
- EdmEntityType filterEntityType = edm.getEntityType(fullFilterName);
- if (filterEntityType != null) {
- // is entity type cast
- if (!(filterEntityType.compatibleTo(source.type))) {
- throw wrap(new UriParserSemanticException(
- "Entity typefilter not compatible to previous path segment: " + fullFilterName.toString(),
- UriParserSemanticException.MessageKeys.INCOMPATIBLE_TYPE_FILTER, fullFilterName.toString()));
- }
-
- if (lastResourcePart == null) {
- // this may be the case if a member expression within a filter starts with a typeCast
- UriResourceStartingTypeFilterImpl uriResource = new UriResourceStartingTypeFilterImpl()
- .setType(filterEntityType)
- .setCollection(source.isCollection);
- if (source.isCollection) {
- uriResource.setCollectionTypeFilter(filterEntityType);
- } else {
- uriResource.setEntryTypeFilter(filterEntityType);
- }
- context.contextUriInfo.addResourcePart(uriResource);
- return null;
- } else {
-
- // check if last segment may contain key properties
- if (lastResourcePart instanceof UriResourceWithKeysImpl) {
- UriResourceWithKeysImpl lastPartWithKeys = (UriResourceWithKeysImpl) lastResourcePart;
-
- if (lastPartWithKeys.isCollection() == false) {
- if (lastPartWithKeys.getTypeFilterOnEntry() != null) {
- throw wrap(new UriParserSemanticException("Entry typefilters are not chainable, used '"
- + getName(filterEntityType) + "' behind '"
- + getName(lastPartWithKeys.getTypeFilterOnEntry()) + "'",
- UriParserSemanticException.MessageKeys.TYPE_FILTER_NOT_CHAINABLE,
- getName(lastPartWithKeys.getTypeFilterOnEntry()), getName(filterEntityType)));
- }
- lastPartWithKeys.setEntryTypeFilter(filterEntityType);
- return null;
- } else {
- if (lastPartWithKeys.getTypeFilterOnCollection() != null) {
- throw wrap(new UriParserSemanticException("Collection typefilters are not chainable, used '"
- + getName(filterEntityType) + "' behind '"
- + getName(lastPartWithKeys.getTypeFilterOnCollection()) + "'",
- UriParserSemanticException.MessageKeys.TYPE_FILTER_NOT_CHAINABLE,
- getName(lastPartWithKeys.getTypeFilterOnCollection()), getName(filterEntityType)));
- }
- lastPartWithKeys.setCollectionTypeFilter(filterEntityType);
- return null;
- }
- } else if (lastResourcePart instanceof UriResourceTypedImpl) {
- UriResourceTypedImpl lastPartTyped = (UriResourceTypedImpl) lastResourcePart;
- if (lastPartTyped.getTypeFilter() != null) {
- throw wrap(new UriParserSemanticException("Typefilters are not chainable, used '"
- + getName(filterEntityType) + "' behind '"
- + getName(lastPartTyped.getTypeFilter()) + "'",
- UriParserSemanticException.MessageKeys.TYPE_FILTER_NOT_CHAINABLE,
- getName(lastPartTyped.getTypeFilter()), getName(filterEntityType)));
- }
-
- lastPartTyped.setTypeFilter(filterEntityType);
- return null;
- } else {
- throw wrap(new UriParserSemanticException("Path segment before '" + getName(filterEntityType)
- + "' not typed",
- UriParserSemanticException.MessageKeys.PREVIOUS_PART_NOT_TYPED, getName(filterEntityType)));
- }
- }
- }
-
- } else if (source.type instanceof EdmComplexType) {
-
- EdmComplexType filterComplexType = edm.getComplexType(fullFilterName);
-
- if (filterComplexType != null) {
-
- // is complex type cast
- if (!(filterComplexType.compatibleTo(source.type))) {
- throw wrap(new UriParserSemanticException(
- "Complex typefilter '" + getName(source.type) + "'not compatible type of previous path segment '"
- + getName(filterComplexType) + "'",
- UriParserSemanticException.MessageKeys.INCOMPATIBLE_TYPE_FILTER, getName(source.type)));
- }
-
- // is simple complex type cast
- if (lastResourcePart == null) {
- // this may be the case if a member expression within a filter starts with a typeCast
- UriResourceStartingTypeFilterImpl uriResource = new UriResourceStartingTypeFilterImpl()
- .setType(filterComplexType)
- .setCollection(source.isCollection);
-
- if (source.isCollection) {
- uriResource.setCollectionTypeFilter(filterComplexType);
- } else {
- uriResource.setEntryTypeFilter(filterComplexType);
- }
- context.contextUriInfo.addResourcePart(uriResource);
- return null;
- } else {
- if (lastResourcePart instanceof UriResourceWithKeysImpl) {
- // e.g. in case of function returning complex data or a list of complex data
- UriResourceWithKeysImpl lastPartWithKeys = (UriResourceWithKeysImpl) lastResourcePart;
-
- if (lastPartWithKeys.isCollection() == false) {
- if (lastPartWithKeys.getTypeFilterOnEntry() != null) {
- throw wrap(new UriParserSemanticException("Entry typefilters are not chainable, used '"
- + getName(filterComplexType) + "' behind '"
- + getName(lastPartWithKeys.getTypeFilterOnEntry()) + "'",
- UriParserSemanticException.MessageKeys.TYPE_FILTER_NOT_CHAINABLE,
- getName(lastPartWithKeys.getTypeFilterOnEntry()), getName(filterComplexType)));
- }
- lastPartWithKeys.setEntryTypeFilter(filterComplexType);
- return null;
- } else {
- if (lastPartWithKeys.getTypeFilterOnCollection() != null) {
- throw wrap(new UriParserSemanticException("Collection typefilters are not chainable, used '"
- + getName(filterComplexType) + "' behind '"
- + getName(lastPartWithKeys.getTypeFilterOnCollection()) + "'",
- UriParserSemanticException.MessageKeys.TYPE_FILTER_NOT_CHAINABLE,
- getName(lastPartWithKeys.getTypeFilterOnCollection()), getName(filterComplexType)));
- }
- lastPartWithKeys.setCollectionTypeFilter(filterComplexType);
- return null;
- }
-
- } else if (lastResourcePart instanceof UriResourceTypedImpl) {
- UriResourceTypedImpl lastPartTyped = (UriResourceTypedImpl) lastResourcePart;
- if (lastPartTyped.getTypeFilter() != null) {
- throw wrap(new UriParserSemanticException("Typefilters are not chainable, used '"
- + getName(filterComplexType) + "' behind '"
- + getName(lastPartTyped.getTypeFilter()) + "'",
- UriParserSemanticException.MessageKeys.TYPE_FILTER_NOT_CHAINABLE,
- getName(lastPartTyped.getTypeFilter()), getName(filterComplexType)));
- }
-
- lastPartTyped.setTypeFilter(filterComplexType);
- return null;
- } else {
- throw wrap(new UriParserSemanticException("Path segment before '" + getName(filterComplexType)
- + "' not typed",
- UriParserSemanticException.MessageKeys.PREVIOUS_PART_NOT_TYPED, getName(filterComplexType)));
- }
- }
- }
- }
-
- FullQualifiedName fullBindingTypeName = new FullQualifiedName(source.type.getNamespace(), source.type.getName());
-
- // check for action
- EdmAction action = edm.getBoundAction(fullFilterName, fullBindingTypeName, source.isCollection);
- if (action != null) {
- UriResourceActionImpl pathInfoAction = new UriResourceActionImpl();
- pathInfoAction.setAction(action);
- context.contextUriInfo.addResourcePart(pathInfoAction);
- return null;
- }
-
- // do a check for bound functions (which requires a parameter list)
- if (ctx.vlNVO.size() == 0) {
- throw wrap(new UriParserSemanticException("Expected function parameters for '" + fullBindingTypeName.toString()
- + "'",
- UriParserSemanticException.MessageKeys.FUNCTION_PARAMETERS_EXPECTED, fullBindingTypeName.toString()));
- }
-
- context.contextReadingFunctionParameters = true;
- @SuppressWarnings("unchecked")
- List<UriParameterImpl> parameters = (List<UriParameterImpl>) ctx.vlNVO.get(0).accept(this);
- context.contextReadingFunctionParameters = false;
-
- // get names of function parameters
- List<String> names = new ArrayList<String>();
- for (UriParameterImpl item : parameters) {
- names.add(item.getName());
- }
-
- EdmFunction function = edm.getBoundFunction(fullFilterName, fullBindingTypeName, source.isCollection, names);
-
- if (function != null) {
- UriResourceFunctionImpl pathInfoFunction = new UriResourceFunctionImpl()
- .setFunction(function)
- .setParameters(parameters);
- context.contextUriInfo.addResourcePart(pathInfoFunction);
-
- // mark parameters as consumed
- ctx.vlNVO.remove(0);
- return null;
- }
-
- // check for unbound function in the $filter case ( where the previous resource segment is a $it)
- function = edm.getUnboundFunction(fullFilterName, names);
-
- if (function != null) {
- UriResourceFunctionImpl pathInfoFunction = new UriResourceFunctionImpl()
- .setFunction(function)
- .setParameters(parameters);
- context.contextUriInfo.addResourcePart(pathInfoFunction);
-
- // mark parameters as consumed
- ctx.vlNVO.remove(0);
- return null;
- }
-
- throw wrap(new UriParserSemanticException("Unknown resource path segment:" + fullFilterName.toString(),
- UriParserSemanticException.MessageKeys.UNKNOWN_PART, fullFilterName.toString()));
- }
- }
-
- private String getName(final EdmType type) {
- return type.getFullQualifiedName().getFullQualifiedNameAsString();
- }
-
- @Override
- public Object visitAllEOF(final AllEOFContext ctx) {
- UriInfoImpl crossJoin = new UriInfoImpl().setKind(UriInfoKind.all);
- context.contextUriInfo = crossJoin;
- return null;
- }
-
- @Override
- public Object visitAllExpr(final AllExprContext ctx) {
- UriResourceLambdaAllImpl all = new UriResourceLambdaAllImpl();
-
- UriResource obj = context.contextUriInfo.getLastResourcePart();
- if (!(obj instanceof UriResourcePartTyped)) {
- throw wrap(new UriParserSemanticException("all only allowed on typed path segments",
- UriParserSemanticException.MessageKeys.ONLY_FOR_TYPED_PARTS, "all"));
- }
-
- UriContext.LambdaVariables var = new UriContext.LambdaVariables();
- var.name = ctx.vLV.getText();
- var.type = getTypeInformation(obj).type;
- var.isCollection = false;
-
- all.setLamdaVariable(ctx.vLV.getText());
- context.allowedLambdaVariables.push(var);
- all.setExpression((ExpressionImpl) ctx.vLE.accept(this));
- context.allowedLambdaVariables.pop();
- return all;
- }
-
- @Override
- public ExpressionImpl visitAltAdd(final AltAddContext ctx) {
- BinaryImpl binary = new BinaryImpl();
-
- int tokenIndex = ctx.vO.getType();
-
- if (tokenIndex == UriLexer.ADD) {
- binary.setOperator(BinaryOperatorKind.ADD);
- } else if (tokenIndex == UriLexer.SUB) {
- binary.setOperator(BinaryOperatorKind.SUB);
- }
-
- binary.setLeftOperand((ExpressionImpl) ctx.vE1.accept(this));
- binary.setRightOperand((ExpressionImpl) ctx.vE2.accept(this));
- return binary;
- }
-
- @Override
- public Object visitAltAll(final AltAllContext ctx) {
-
- UriInfoImpl uriInfoImplpath = new UriInfoImpl().setKind(UriInfoKind.resource);
-
- uriInfoImplpath.addResourcePart((UriResourceImpl) super.visitAltAll(ctx));
-
- EdmType startType = removeUriResourceStartingTypeFilterImpl(uriInfoImplpath);
-
- MemberImpl ret = new MemberImpl();
-
- ret.setResourcePath(uriInfoImplpath);
- if (startType != null) {
- ret.setTypeFilter(startType);
- }
-
- return ret;
- }
-
- private EdmType removeUriResourceStartingTypeFilterImpl(final UriInfoImpl uriInfoImplpath) {
-
- List<UriResource> segments = uriInfoImplpath.getUriResourceParts();
- if (segments.size() == 0) {
- return null;
- }
-
- UriResource segment = segments.get(0);
- if (segment instanceof UriResourceStartingTypeFilterImpl) {
- UriResourceStartingTypeFilterImpl startingTypeFilter = (UriResourceStartingTypeFilterImpl) segment;
-
- EdmType type = null;
- if (startingTypeFilter.getTypeFilterOnEntry() != null) {
- type = startingTypeFilter.getTypeFilterOnEntry();
- } else if (startingTypeFilter.getTypeFilterOnCollection() != null) {
- type = startingTypeFilter.getTypeFilterOnCollection();
- } else {
- type = startingTypeFilter.getType();
- }
-
- uriInfoImplpath.removeResourcePart(0);
- return type;
- }
-
- return null;
- }
-
- @Override
- public ExpressionImpl visitAltAnd(final AltAndContext ctx) {
- BinaryImpl binary = new BinaryImpl();
-
- binary.setOperator(BinaryOperatorKind.AND);
- binary.setLeftOperand((ExpressionImpl) ctx.vE1.accept(this));
- binary.setRightOperand((ExpressionImpl) ctx.vE2.accept(this));
-
- return binary;
- }
-
- @Override
- public Object visitAltAny(final AltAnyContext ctx) {
- UriInfoImpl uriInfoImplpath = new UriInfoImpl().setKind(UriInfoKind.resource);
-
- uriInfoImplpath.addResourcePart((UriResourceImpl) super.visitAltAny(ctx));
-
- EdmType startType = removeUriResourceStartingTypeFilterImpl(uriInfoImplpath);
-
- MemberImpl ret = new MemberImpl();
- ret.setResourcePath(uriInfoImplpath);
- if (startType != null) {
- ret.setTypeFilter(startType);
- }
- return ret;
- }
-
- @Override
- public Object visitBatchEOF(final BatchEOFContext ctx) {
- context.contextUriInfo = new UriInfoImpl().setKind(UriInfoKind.batch);
- return null;
- }
-
- @Override
- public ExpressionImpl visitAltComparism(final AltComparismContext ctx) {
- BinaryImpl binary = new BinaryImpl();
-
- int tokenIndex = ctx.vO.getType();
-
- if (tokenIndex == UriLexer.GT) {
- binary.setOperator(BinaryOperatorKind.GT);
- } else if (tokenIndex == UriLexer.GE) {
- binary.setOperator(BinaryOperatorKind.GE);
- } else if (tokenIndex == UriLexer.LT) {
- binary.setOperator(BinaryOperatorKind.LT);
- } else if (tokenIndex == UriLexer.LE) {
- binary.setOperator(BinaryOperatorKind.LE);
- }
-
- binary.setLeftOperand((ExpressionImpl) ctx.vE1.accept(this));
- binary.setRightOperand((ExpressionImpl) ctx.vE2.accept(this));
- return binary;
- }
-
- @Override
- public Object visitEntityEOF(final EntityEOFContext ctx) {
- String odi = ctx.vODI.getText();
- FullQualifiedName fullName = getFullNameFromContext(ctx.vNS, odi);
-
- EdmEntityType type = edm.getEntityType(fullName);
- if (type == null) {
- throw wrap(new UriParserSemanticException("Expected EntityTypeName",
- UriParserSemanticException.MessageKeys.UNKNOWN_ENTITY_TYPE, fullName.toString()));
- }
- context.contextUriInfo.setEntityTypeCast(type);
-
- // contextUriInfo = uriInfo;
- context.contextTypes.push(new TypeInformation(context.contextUriInfo.getEntityTypeCast(), true));
-
- // @SuppressWarnings("unchecked")
- // List<QueryOptionImpl> list = (List<QueryOptionImpl>) ctx.vEO.accept(this);
- // uriInfo.setQueryOptions(list);
- return null;
- }
-
- @Override
- public ExpressionImpl visitAltEquality(final AltEqualityContext ctx) {
- BinaryImpl binary = new BinaryImpl();
-
- int tokenIndex = ctx.vO.getType();
-
- if (tokenIndex == UriLexer.EQ_ALPHA) {
- binary.setOperator(BinaryOperatorKind.EQ);
- } else {
- binary.setOperator(BinaryOperatorKind.NE);
- }
- binary.setLeftOperand((ExpressionImpl) ctx.vE1.accept(this));
- binary.setRightOperand((ExpressionImpl) ctx.vE2.accept(this));
-
- return binary;
- }
-
- @Override
- public Object visitAltHas(final AltHasContext ctx) {
- BinaryImpl binary = new BinaryImpl();
-
- binary.setOperator(BinaryOperatorKind.HAS);
- binary.setLeftOperand((ExpressionImpl) ctx.vE1.accept(this));
- binary.setRightOperand((ExpressionImpl) ctx.vE2.accept(this));
-
- return binary;
- }
-
- @Override
- public Object visitMetadataEOF(final MetadataEOFContext ctx) {
- UriInfoImpl uriInfo = new UriInfoImpl().setKind(UriInfoKind.metadata);
-
- context.contextUriInfo = uriInfo;
- return null;
- }
-
- @Override
- public ExpressionImpl visitAltMult(final AltMultContext ctx) {
- BinaryImpl binary = new BinaryImpl();
-
- int tokenIndex = ctx.vO.getType();
-
- if (tokenIndex == UriLexer.MUL) {
- binary.setOperator(BinaryOperatorKind.MUL);
- } else if (tokenIndex == UriLexer.DIV) {
- binary.setOperator(BinaryOperatorKind.DIV);
- } else {
- binary.setOperator(BinaryOperatorKind.MOD);
- }
- binary.setLeftOperand((ExpressionImpl) ctx.vE1.accept(this));
- binary.setRightOperand((ExpressionImpl) ctx.vE2.accept(this));
-
- return binary;
- }
-
- @Override
- public ExpressionImpl visitAltOr(final AltOrContext ctx) {
- BinaryImpl binary = new BinaryImpl();
-
- binary.setOperator(BinaryOperatorKind.OR);
- binary.setLeftOperand((ExpressionImpl) ctx.vE1.accept(this));
- binary.setRightOperand((ExpressionImpl) ctx.vE2.accept(this));
-
- return binary;
- }
-
- @Override
- public Object visitAnyExpr(final AnyExprContext ctx) {
- UriResourceLambdaAnyImpl any = new UriResourceLambdaAnyImpl();
- if (ctx.vLV != null) {
- UriResourceImpl lastResourcePart = (UriResourceImpl) context.contextUriInfo.getLastResourcePart();
- if (!(lastResourcePart instanceof UriResourcePartTyped)) {
- throw wrap(new UriParserSemanticException("any only allowed on typed path segments",
- UriParserSemanticException.MessageKeys.ONLY_FOR_TYPED_PARTS, "any"));
- }
-
- UriContext.LambdaVariables var = new UriContext.LambdaVariables();
- var.name = ctx.vLV.getText();
- var.type = getTypeInformation(lastResourcePart).type;
- var.isCollection = false;
-
- any.setLamdaVariable(ctx.vLV.getText());
- context.allowedLambdaVariables.push(var);
- any.setExpression((ExpressionImpl) ctx.vLE.accept(this));
- context.allowedLambdaVariables.pop();
- }
- return any;
- }
-
- @Override
- public Object visitBooleanNonCase(final BooleanNonCaseContext ctx) {
- String text = ctx.getText().toLowerCase();
-
- if (text.equals("false")) {
- return new LiteralImpl().setText("false").setType(
- EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Boolean));
- }
- return new LiteralImpl().setText("true").setType(
- EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Boolean));
- }
-
- @Override
- public ExpressionImpl visitCastExpr(final CastExprContext ctx) {
- MethodImpl method = new MethodImpl();
- if (ctx.vE1 != null) {
- // is optional parameter
- ExpressionImpl onExpression = (ExpressionImpl) ctx.vE1.accept(this);
- method.addParameter(onExpression);
- }
-
- String namespace = ctx.vNS.getText();
- namespace = namespace.substring(0, namespace.length() - 1);
-
- FullQualifiedName fullName = new FullQualifiedName(namespace, ctx.vODI.getText());
- EdmType type = getType(fullName);
- method.setMethod(MethodKind.CAST);
- method.addParameter(new TypeLiteralImpl().setType(type));
- return method;
- }
-
- private EdmType getType(final FullQualifiedName fullName) {
- EdmType type = null;
-
- type = edm.getEntityType(fullName);
- if (type != null) {
- return type;
- }
-
- type = edm.getComplexType(fullName);
- if (type != null) {
- return type;
- }
-
- type = edm.getEnumType(fullName);
- if (type != null) {
- return type;
- }
-
- if (fullName.getNamespace().equals(EdmPrimitiveType.EDM_NAMESPACE)) {
- final EdmPrimitiveTypeKind typeKind = EdmPrimitiveTypeKind.valueOf(fullName.getName());
- type = EdmPrimitiveTypeFactory.getInstance(typeKind);
- if (type != null) {
- return type;
- }
- }
-
- return null;
-
- }
-
- @Override
- public ExpressionImpl visitCeilingMethodCallExpr(final CeilingMethodCallExprContext ctx) {
- return new MethodImpl()
- .setMethod(MethodKind.CEILING)
- .addParameter((ExpressionImpl) ctx.vE1.accept(this));
- }
-
- @Override
- public ExpressionImpl visitConcatMethodCallExpr(final ConcatMethodCallExprContext ctx) {
- return new MethodImpl()
- .setMethod(MethodKind.CONCAT)
- .addParameter((ExpressionImpl) ctx.vE1.accept(this))
- .addParameter((ExpressionImpl) ctx.vE2.accept(this));
- }
-
- @Override
- public Object visitConstSegment(final ConstSegmentContext ctx) {
- UriInfoImpl uriInfoResource = context.contextUriInfo;
- UriResource pathInfo = uriInfoResource.getLastResourcePart();
-
- if (ctx.vV != null) {
- if (pathInfo instanceof UriResourcePartTyped) {
- if (!((UriResourcePartTyped) pathInfo).isCollection()) {
- context.contextUriInfo.addResourcePart(new UriResourceValueImpl());
- } else {
- throw wrap(new UriParserSemanticException("$value only allowed on typed path segments",
- UriParserSemanticException.MessageKeys.ONLY_FOR_TYPED_PARTS, "$value"));
- }
- return null;
- } else {
- throw wrap(new UriParserSemanticException("$value only allowed on typed path segments",
- UriParserSemanticException.MessageKeys.ONLY_FOR_TYPED_PARTS, "$value"));
- }
-
- } else if (ctx.vC != null) {
- if (pathInfo instanceof UriResourcePartTyped) {
- if (((UriResourcePartTyped) pathInfo).isCollection()) {
- context.contextUriInfo.addResourcePart(new UriResourceCountImpl());
- } else {
- throw wrap(new UriParserSemanticException("$count only allowed on collection properties",
- UriParserSemanticException.MessageKeys.ONLY_FOR_COLLECTIONS, "$count"));
- }
- } else {
- throw wrap(new UriParserSemanticException("$count only allowed on typed properties",
- UriParserSemanticException.MessageKeys.ONLY_FOR_TYPED_PARTS, "$count"));
- }
- } else if (ctx.vR != null) {
- if (pathInfo instanceof UriResourcePartTyped) {
- EdmType type = ((UriResourcePartTyped) pathInfo).getType();
- if (type instanceof EdmEntityType) {
- context.contextUriInfo.addResourcePart(new UriResourceRefImpl());
- } else {
- throw wrap(new UriParserSemanticException("$ref only allowed on entity types",
- UriParserSemanticException.MessageKeys.ONLY_FOR_ENTITY_TYPES, "$ref"));
- }
- } else {
- throw wrap(new UriParserSemanticException("$ref only allowed on typed properties",
- UriParserSemanticException.MessageKeys.ONLY_FOR_TYPED_PROPERTIES, "$ref"));
- }
-
- } else if (ctx.vAll != null) {
- context.contextUriInfo.addResourcePart((UriResourceLambdaAllImpl) ctx.vAll.accept(this));
- } else if (ctx.vAny != null) {
- context.contextUriInfo.addResourcePart((UriResourceLambdaAnyImpl) ctx.vAny.accept(this));
- }
- return null;
- }
-
- @Override
- public ExpressionImpl visitContainsMethodCallExpr(final ContainsMethodCallExprContext ctx) {
- return new MethodImpl()
- .setMethod(MethodKind.CONTAINS)
- .addParameter((ExpressionImpl) ctx.vE1.accept(this))
- .addParameter((ExpressionImpl) ctx.vE2.accept(this));
- }
-
- @Override
- public Object visitCrossjoinEOF(final CrossjoinEOFContext ctx) {
- UriInfoImpl crossJoin = new UriInfoImpl().setKind(UriInfoKind.crossjoin);
-
- for (OdataIdentifierContext obj : ctx.vlODI) {
- crossJoin.addEntitySetName(obj.getText());
- }
-
- context.contextUriInfo = crossJoin;
- return null;
- }
-
- @Override
- public Object visitDateMethodCallExpr(final DateMethodCallExprContext ctx) {
- return new MethodImpl()
- .setMethod(MethodKind.DATE)
- .addParameter((ExpressionImpl) ctx.vE1.accept(this));
- }
-
- @Override
- public ExpressionImpl visitDayMethodCallExpr(final DayMethodCallExprContext ctx) {
- return new MethodImpl()
- .setMethod(MethodKind.DAY)
- .addParameter((ExpressionImpl) ctx.vE1.accept(this));
- }
-
- @Override
- public ExpressionImpl visitGeoDistanceMethodCallExpr(final GeoDistanceMethodCallExprContext ctx) {
- return new MethodImpl()
- .setMethod(MethodKind.GEODISTANCE)
- .addParameter((ExpressionImpl) ctx.vE1.accept(this))
- .addParameter((ExpressionImpl) ctx.vE2.accept(this));
- }
-
- @Override
- public Object visitEndsWithMethodCallExpr(final EndsWithMethodCallExprContext ctx) {
- return new MethodImpl()
- .setMethod(MethodKind.ENDSWITH)
- .addParameter((ExpressionImpl) ctx.vE1.accept(this))
- .addParameter((ExpressionImpl) ctx.vE2.accept(this));
- }
-
- @Override
- public Object visitEnumLit(final EnumLitContext ctx) {
- EnumerationImpl enum1 = new EnumerationImpl();
-
- // get type
- String odi = ctx.vODI.getText();
-
- FullQualifiedName fullName = getFullNameFromContext(ctx.vNS, odi);
- EdmEnumType edmEnumType = edm.getEnumType(fullName);
-
- enum1.setType(edmEnumType);
-
- String valueString = ctx.vValues.getText();
- valueString = valueString.substring(1, valueString.length() - 1);
-
- String[] values = valueString.split(",");
- for (String item : values) {
- enum1.addValue(item);
- }
-
- return enum1;
- }
-
- @Override
- public Object visitExpandItems(final ExpandItemsContext ctx) {
- ExpandOptionImpl expand = new ExpandOptionImpl();
- expand.setText(ctx.getText());
- for (ExpandItemContext eI : ctx.vlEI) {
- expand.addExpandItem((ExpandItemImpl) eI.accept(this));
- }
-
- return expand;
- }
-
- @Override
- public Object visitExpandItem(final ExpandItemContext ctx) {
-
- ExpandItemImpl expandItem = null;
- if (ctx.vS != null) {
- expandItem = new ExpandItemImpl().setIsStar(true);
- if (ctx.vR != null) {
- expandItem.setIsRef(true);
- } else if (ctx.vM != null) {
- LevelsOptionImpl levels = new LevelsOptionImpl().setMax();
- levels.setText(ctx.vM.getText());
- expandItem.setSystemQueryOption(levels);
- } else if (ctx.vL != null) {
- LevelsOptionImpl levels = new LevelsOptionImpl();
- String text = ctx.vL.getText();
- levels.setText(text);
- levels.setValue(Integer.parseInt(text));
- expandItem.setSystemQueryOption(levels);
- }
-
- } else if (ctx.vEP != null) {
- expandItem = (ExpandItemImpl) ctx.vEP.accept(this);
-
- if (ctx.vEPE != null) {
- ExpandItemImpl contextExpandItemPathBU = context.contextExpandItemPath;
- context.contextExpandItemPath = expandItem;
-
- @SuppressWarnings("unchecked")
- List<SystemQueryOptionImpl> list = (List<SystemQueryOptionImpl>) ctx.vEPE.accept(this);
- for (SystemQueryOptionImpl option : list) {
- expandItem.setSystemQueryOption(option);
- }
- context.contextExpandItemPath = contextExpandItemPathBU;
- }
- }
-
- return expandItem;
-
- }
-
- @Override
- public Object visitExpandPath(final ExpandPathContext ctx) {
- ExpandItemImpl expandItem = new ExpandItemImpl();
-
- // UriResourceItImpl pathInfoIT = new UriResourceItImpl();
- context.contextUriInfo.getLastResourcePart();
-
- // save context
- ExpandItemImpl contextExpandItemPathBU = context.contextExpandItemPath;
- UriInfoImpl uriInfoResourceBU = context.contextUriInfo;
-
- // set tmp context
- context.contextExpandItemPath = expandItem;
- context.contextUriInfo = new UriInfoImpl().setKind(UriInfoKind.resource);
- // contextUriInfo.addPathInfo(pathInfoIT);
-
- super.visitExpandPath(ctx);
-
- EdmType startType = removeUriResourceStartingTypeFilterImpl(context.contextUriInfo);
- expandItem.setResourcePath(context.contextUriInfo);
- if (startType != null) {
- expandItem.setTypeFilter(startType);
- }
-
- // reset context
- context.contextUriInfo = uriInfoResourceBU;
- context.contextExpandItemPath = contextExpandItemPathBU;
-
- return expandItem;
- }
-
- @Override
- public Object visitExpandPathExtension(final ExpandPathExtensionContext ctx) {
- List<SystemQueryOptionImpl> list = new ArrayList<SystemQueryOptionImpl>();
-
- EdmType targetType = null;
- boolean isColl = false;
- if (context.contextExpandItemPath == null) {
- // use the type of the last resource path segement
- UriResourceTypedImpl lastSegment = (UriResourceTypedImpl) context.contextUriInfo.getLastResourcePart();
- targetType = getTypeInformation(lastSegment).type;
- isColl = lastSegment.isCollection();
- } else {
- if (context.contextExpandItemPath.getResourcePath() == null) {
- // use the type of the last resource path segement
- UriResourceTypedImpl lastSegment = (UriResourceTypedImpl) context.contextUriInfo.getLastResourcePart();
- targetType = getTypeInformation(lastSegment).type;
- isColl = lastSegment.isCollection();
- } else {
- // use the type of the last ''expand'' path segement
- UriInfoImpl info = (UriInfoImpl) context.contextExpandItemPath.getResourcePath();
- targetType = getTypeInformation(info.getLastResourcePart()).type;
- isColl = ((UriResourcePartTyped) info.getLastResourcePart()).isCollection();
- }
- }
-
- context.contextTypes.push(new TypeInformation(targetType, isColl));
-
- if (ctx.vC != null) {
- UriInfoImpl resourcePath = (UriInfoImpl) context.contextExpandItemPath.getResourcePath();
- resourcePath.addResourcePart(new UriResourceCountImpl());
-
- for (ExpandCountOptionContext s : ctx.vlEOC) {
- list.add((SystemQueryOptionImpl) s.accept(this));
- }
- } else if (ctx.vR != null) {
- UriInfoImpl resourcePath = (UriInfoImpl) context.contextExpandItemPath.getResourcePath();
- resourcePath.addResourcePart(new UriResourceRefImpl());
-
- for (ExpandRefOptionContext s : ctx.vlEOR) {
- list.add((SystemQueryOptionImpl) s.accept(this));
- }
- } else {
- for (ExpandOptionContext s : ctx.vlEO) {
- list.add((SystemQueryOptionImpl) s.accept(this));
- }
- }
-
- context.contextTypes.pop();
- return list;
-
- }
-
- @Override
- public Object visitFilter(final FilterContext ctx) {
-
- FilterOptionImpl filter = new FilterOptionImpl().setExpression((ExpressionImpl) ctx.children.get(2).accept(this));
- return filter;
- }
-
- @Override
- public Object visitFilterExpressionEOF(final FilterExpressionEOFContext ctx) {
-
- FilterOptionImpl filter = new FilterOptionImpl().setExpression((ExpressionImpl) ctx.children.get(0).accept(this));
- return filter;
- }
-
- @Override
- public ExpressionImpl visitFloorMethodCallExpr(final FloorMethodCallExprContext ctx) {
- return new MethodImpl()
- .setMethod(MethodKind.FLOOR)
- .addParameter((ExpressionImpl) ctx.vE1.accept(this));
- }
-
- @Override
- public ExpressionImpl visitFractionalsecondsMethodCallExpr(final FractionalsecondsMethodCallExprContext ctx) {
- return new MethodImpl()
- .setMethod(MethodKind.FRACTIONALSECONDS)
- .addParameter((ExpressionImpl) ctx.vE1.accept(this));
- }
-
- @Override
- public ExpressionImpl visitGeoLengthMethodCallExpr(final GeoLengthMethodCallExprContext ctx) {
- return new MethodImpl()
- .setMethod(MethodKind.GEOLENGTH)
- .addParameter((ExpressionImpl) ctx.vE1.accept(this));
- }
-
- @Override
- public ExpressionImpl visitHourMethodCallExpr(final HourMethodCallExprContext ctx) {
- return new MethodImpl()
- .setMethod(MethodKind.HOUR)
- .addParameter((ExpressionImpl) ctx.vE1.accept(this));
- }
-
- @Override
- public ExpressionImpl visitIndexOfMethodCallExpr(final IndexOfMethodCallExprContext ctx) {
- return new MethodImpl()
- .setMethod(MethodKind.INDEXOF)
- .addParameter((ExpressionImpl) ctx.vE1.accept(this))
- .addParameter((ExpressionImpl) ctx.vE2.accept(this));
- }
-
- @Override
- public Object visitInlinecount(final InlinecountContext ctx) {
- CountOptionImpl inlineCount = new CountOptionImpl();
-
- String text = ctx.children.get(2).getText();
-
- return inlineCount.setValue(text.toLowerCase().equals("true") ? true : false).setText(text);
- }
-
- @Override
- public ExpressionImpl visitGeoIntersectsMethodCallExpr(final GeoIntersectsMethodCallExprContext ctx) {
- return new MethodImpl()
- .setMethod(MethodKind.GEOINTERSECTS)
- .addParameter((ExpressionImpl) ctx.vE1.accept(this))
- .addParameter((ExpressionImpl) ctx.vE2.accept(this));
- }
-
- @Override
- public ExpressionImpl visitIsofExpr(final IsofExprContext ctx) {
- MethodImpl method = new MethodImpl();
- if (ctx.vE1 != null) {
- ExpressionImpl onExpression = (ExpressionImpl) ctx.vE1.accept(this);
- method.addParameter(onExpression);
- }
-
- String namespace = ctx.vNS.getText();
- namespace = namespace.substring(0, namespace.length() - 1);
-
- FullQualifiedName fullName = new FullQualifiedName(namespace, ctx.vODI.getText());
- EdmType type = getType(fullName);
- method.setMethod(MethodKind.ISOF);
- method.addParameter(new TypeLiteralImpl().setType(type));
-
- return method;
- }
-
- @Override
- public ExpressionImpl visitLengthMethodCallExpr(final LengthMethodCallExprContext ctx) {
- return new MethodImpl()
- .setMethod(MethodKind.LENGTH)
- .addParameter((ExpressionImpl) ctx.vE1.accept(this));
- }
-
- @Override
- public Object visitLevels(final LevelsContext ctx) {
-
- LevelsOptionImpl levels = new LevelsOptionImpl();
-
- String text = ctx.children.get(2).getText();
-
- if (text.equals("max")) {
- levels.setMax();
- } else {
- levels.setValue(Integer.parseInt(text));
- }
- levels.setText(text);
-
- return levels;
-
- }
-
- @Override
- public ExpressionImpl visitMaxDateTimeMethodCallExpr(final MaxDateTimeMethodCallExprContext ctx) {
- return new MethodImpl()
- .setMethod(MethodKind.MAXDATETIME);
- }
-
- @Override
- public Object visitMemberExpr(final MemberExprContext ctx) {
-
- UriInfoImpl uriInfoImplpath = new UriInfoImpl().setKind(UriInfoKind.resource);
-
- if (context.contextTypes.isEmpty()) {
- throw wrap(new UriParserSemanticException("Expression '" + ctx.getText() + "' is not allowed as key value.",
- UriParserSemanticException.MessageKeys.INVALID_KEY_VALUE, ctx.getText()));
- }
- TypeInformation lastTypeInfo = context.contextTypes.peek();
-
- if (ctx.vIt != null || ctx.vIts != null) {
- UriResourceItImpl pathInfoIT = new UriResourceItImpl();
- pathInfoIT.setType(lastTypeInfo.type);
- pathInfoIT.setCollection(lastTypeInfo.isCollection);
- uriInfoImplpath.addResourcePart(pathInfoIT);
- }
-
- if (ctx.vPs != null) {
- // save the context
- UriInfoImpl backupUriInfoPath = context.contextUriInfo;
-
- // set temporary uriInfoPath
- context.contextUriInfo = uriInfoImplpath;
-
- ctx.vPs.accept(this);
-
- // reset context
- context.contextUriInfo = backupUriInfoPath;
- }
-
- if (ctx.vALL != null) {
- uriInfoImplpath.addResourcePart((UriResourceImpl) ctx.vALL.accept(this));
- }
- if (ctx.vANY != null) {
- uriInfoImplpath.addResourcePart((UriResourceImpl) ctx.vANY.accept(this));
- }
-
- EdmType startType = removeUriResourceStartingTypeFilterImpl(uriInfoImplpath);
-
- MemberImpl ret = new MemberImpl();
- ret.setResourcePath(uriInfoImplpath);
- if (startType != null) {
- ret.setTypeFilter(startType);
- }
-
- return ret;
- }
-
- @Override
- public ExpressionImpl visitMinDateTimeMethodCallExpr(final MinDateTimeMethodCallExprContext ctx) {
- return new MethodImpl()
- .setMethod(MethodKind.MINDATETIME);
- }
-
- @Override
- public ExpressionImpl visitMinuteMethodCallExpr(final MinuteMethodCallExprContext ctx) {
- return new MethodImpl()
- .setMethod(MethodKind.MINUTE)
- .addParameter((ExpressionImpl) ctx.vE1.accept(this));
- }
-
- @Override
- public ExpressionImpl visitMonthMethodCallExpr(final MonthMethodCallExprContext ctx) {
- return new MethodImpl()
- .setMethod(MethodKind.MONTH)
- .addParameter((ExpressionImpl) ctx.vE1.accept(this));
- }
-
- @Override
- public Object visitNameValueOptList(final NameValueOptListContext ctx) {
- if (ctx.vVO != null) {
-
- // is single key predicate without a name
- String valueText = ctx.vVO.getText();
- ExpressionImpl expression = null;
- try {
- expression = (ExpressionImpl) ctx.vVO.accept(this);
- } catch (final RuntimeException e) {
- throw wrap(new UriParserSemanticException("Invalid key value: " + valueText, e,
- UriParserSemanticException.MessageKeys.INVALID_KEY_VALUE, valueText));
- }
-
- // get type of last resource part
- UriResource last = context.contextUriInfo.getLastResourcePart();
- if (!(last instanceof UriResourcePartTyped)) {
- throw wrap(new UriParserSemanticException("Parameters list on untyped resource path segment not allowed",
- UriParserSemanticException.MessageKeys.PARAMETERS_LIST_ONLY_FOR_TYPED_PARTS));
- }
- EdmEntityType lastType = (EdmEntityType) ((UriResourcePartTyped) last).getType();
-
- // get list of keys for lastType
- List<String> lastKeyPredicates = lastType.getKeyPredicateNames();
-
- // If there is exactly one key defined in the EDM, then this key is the key written in the URI,
- // so fill the keylist with this key and return.
- if (lastKeyPredicates.size() == 1) {
- return Collections.singletonList(new UriParameterImpl()
- .setName(lastKeyPredicates.get(0))
- .setText(valueText)
- .setExpression(expression));
- }
-
- // There are more keys defined in the EDM, but only one is written in the URI. This is allowed only if
- // referential constraints are defined on this navigation property which can be used to fill up all
- // required keys.
- // For using referential constraints the last resource part must be a navigation property.
- if (!(context.contextUriInfo.getLastResourcePart() instanceof UriResourceNavigationPropertyImpl)) {
- throw wrap(new UriParserSemanticException("Wrong number of key properties.",
- UriParserSemanticException.MessageKeys.WRONG_NUMBER_OF_KEY_PROPERTIES,
- Integer.toString(lastKeyPredicates.size()), "1"));
- }
- UriResourceNavigationPropertyImpl lastNav = (UriResourceNavigationPropertyImpl) last;
-
- // get the partner of the navigation property
- EdmNavigationProperty partner = lastNav.getProperty().getPartner();
- if (partner == null) {
- throw wrap(new UriParserSemanticException("Wrong number of key properties.",
- UriParserSemanticException.MessageKeys.WRONG_NUMBER_OF_KEY_PROPERTIES,
- Integer.toString(lastKeyPredicates.size()), "1"));
- }
-
- // create the keylist
- List<UriParameterImpl> list = new ArrayList<UriParameterImpl>();
-
- // Find the keys not filled by referential constraints
- // and collect the other keys filled by referential constraints.
- String missedKey = null;
- for (String item : lastKeyPredicates) {
- String property = partner.getReferencingPropertyName(item);
- if (property != null) {
- list.add(new UriParameterImpl().setName(item).setRefencedProperty(property));
- } else {
- if (missedKey == null) {
- missedKey = item;
- } else {
- // two of more keys are missing
- throw wrap(new UriParserSemanticException("Not enough referential constraints defined",
- UriParserSemanticException.MessageKeys.NOT_ENOUGH_REFERENTIAL_CONSTRAINTS));
- }
- }
- }
-
- // the missing key is the one which is defined in the URI
- list.add(new UriParameterImpl().setName(missedKey).setText(valueText).setExpression(expression));
-
- return list;
- } else if (ctx.vNVL != null) {
-
- List<UriParameterImpl> list = new ArrayList<UriParameterImpl>();
-
- for (ParseTree c : ctx.vNVL.vlNVP) {
- list.add((UriParameterImpl) c.accept(this));
- }
-
- if (context.contextReadingFunctionParameters) {
- return list;
- }
-
- UriResource last = context.contextUriInfo.getLastResourcePart();
- // if the last resource part is a function
- /*
- * if (last instanceof UriResourceFunctionImpl) {
- * UriResourceFunctionImpl function = (UriResourceFunctionImpl) last;
- * if (!function.isParameterListFilled()) {
- * return list;
- * }
- * }
- */
-
- // get type of last resource part
- if (!(last instanceof UriResourcePartTyped)) {
- throw wrap(new UriParserSemanticException("Parameters list on untyped resource path segment not allowed",
- UriParserSemanticException.MessageKeys.PARAMETERS_LIST_ONLY_FOR_TYPED_PARTS));
- }
- EdmEntityType lastType = (EdmEntityType) ((UriResourcePartTyped) last).getType();
-
- // get list of keys for lastType
- List<String> lastKeyPredicates = lastType.getKeyPredicateNames();
-
- // check if all key are filled from the URI
- if (list.size() == lastKeyPredicates.size()) {
- return list;
- }
-
- // if not, check if the missing key predicates can be satisfied with help of the defined
- // referential constraints
- // for using referential constraints the last resource part must be a navigation property
- if (!(context.contextUriInfo.getLastResourcePart() instanceof UriResourceNavigationPropertyImpl)) {
- throw wrap(new UriParserSemanticException("Wrong number of key properties.",
- UriParserSemanticException.MessageKeys.WRONG_NUMBER_OF_KEY_PROPERTIES,
- Integer.toString(lastKeyPredicates.size()), Integer.toString(list.size())));
- }
- UriResourceNavigationPropertyImpl lastNav = (UriResourceNavigationPropertyImpl) last;
-
- // get the partner of the navigation property
- EdmNavigationProperty partner = lastNav.getProperty().getPartner();
- if (partner == null) {
- throw wrap(new UriParserSemanticException("Wrong number of key properties.",
- UriParserSemanticException.MessageKeys.WRONG_NUMBER_OF_KEY_PROPERTIES,
- Integer.toString(lastKeyPredicates.size()), Integer.toString(list.size())));
- }
-
- // fill missing keys from referential constraints
- for (String key : lastKeyPredicates) {
- boolean found = false;
- for (UriParameterImpl item : list) {
- if (item.getName().equals(key)) {
- found = true;
- break;
- }
- }
-
- if (!found) {
- String property = partner.getReferencingPropertyName(key);
- if (property != null) {
- // store the key name as referenced property
- list.add(0, new UriParameterImpl().setName(key).setRefencedProperty(property));
- }
- }
- }
-
- // check again if all key predicates are filled from the URI
- if (list.size() == lastKeyPredicates.size()) {
- return list;
- } else {
- throw wrap(new UriParserSemanticException("Wrong number of key properties.",
- UriParserSemanticException.MessageKeys.WRONG_NUMBER_OF_KEY_PROPERTIES,
- Integer.toString(lastKeyPredicates.size()), Integer.toString(list.size())));
- }
- } else {
- if (context.contextReadingFunctionParameters) {
- return Collections.emptyList();
- } else {
- final UriResource last = context.contextUriInfo.getLastResourcePart();
- final int number = last instanceof UriResourcePartTyped ?
- ((EdmEntityType) ((UriResourcePartTyped) last).getType()).getKeyPredicateNames().size() : 0;
- throw wrap(new UriParserSemanticException("Wrong number of key properties.",
- UriParserSemanticException.MessageKeys.WRONG_NUMBER_OF_KEY_PROPERTIES, Integer.toString(number), "0"));
- }
- }
- }
-
- @Override
- public UriParameterImpl visitNameValuePair(final NameValuePairContext ctx) {
- UriParameterImpl uriParameter = new UriParameterImpl();
- uriParameter.setName(ctx.vODI.getText());
-
- if (ctx.vCOM != null) {
- uriParameter.setText(ctx.vCOM.getText());
- uriParameter.setExpression((ExpressionImpl) ctx.vCOM.accept(this));
- } else {
- uriParameter.setAlias("@" + ctx.vALI.getText());
- }
-
- return uriParameter;
- }
-
- @Override
- public Object visitNaninfinity(final NaninfinityContext ctx) {
- return new LiteralImpl().setType(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Decimal)).
- setText(ctx.getText());
- }
-
- @Override
- public ExpressionImpl visitNowMethodCallExpr(final NowMethodCallExprContext ctx) {
- return new MethodImpl()
- .setMethod(MethodKind.NOW);
- }
-
- @Override
- public Object visitNullrule(final NullruleContext ctx) {
- return new LiteralImpl().setText("null");
- }
-
- /*
- * @Override
- * public Object visitOdataRelativeUriEOF(final OdataRelativeUriEOFContext ctx) {
- * contextUriInfo = null;
- * super.visitOdataRelativeUriEOF(ctx);
- * return contextUriInfo;
- * }
- */
- @Override
- public Object visitOrderBy(final OrderByContext ctx) {
-
- OrderByOptionImpl orderBy = new OrderByOptionImpl();
-
- for (OrderByItemContext item : ((OrderListContext) ctx.getChild(2)).vlOI) {
- OrderByItemImpl oItem = (OrderByItemImpl) item.accept(this);
- orderBy.addOrder(oItem);
- }
-
- return orderBy;
- }
-
- @Override
- public Object visitOrderByEOF(final OrderByEOFContext ctx) {
-
- OrderByOptionImpl orderBy = new OrderByOptionImpl();
-
- for (OrderByItemContext item : ((OrderListContext) ctx.getChild(0)).vlOI) {
- OrderByItemImpl oItem = (OrderByItemImpl) item.accept(this);
- orderBy.addOrder(oItem);
- }
-
- return orderBy;
- }
-
- @Override
- public Object visitOrderByItem(final OrderByItemContext ctx) {
- OrderByItemImpl oItem = new OrderByItemImpl();
- if (ctx.vD != null) {
- oItem.setDescending(true);
- }
-
- oItem.setExpression((ExpressionImpl) ctx.vC.accept(this));
- return oItem;
- }
-
- @Override
- public Object visitPathSegment(final PathSegmentContext ctx) {
- readResourcePathSegment(ctx);
- /*
- * if (contextUriInfo.getLastResourcePart() == null ||
- * contextUriInfo.getLastResourcePart() instanceof UriResourceRootImpl) {
- *
- * } else {
- * readNextPathInfoSegment(ctx);
- * }
- */
- UriResourceImpl pathInfoSegment = (UriResourceImpl) context.contextUriInfo.getLastResourcePart();
-
- if (ctx.vlNVO.size() > 0) {
- // check for keyPredicates
- if (pathInfoSegment instanceof UriResourceWithKeysImpl) {
- @SuppressWarnings("unchecked")
- List<UriParameterImpl> list = (List<UriParameterImpl>) ctx.vlNVO.get(0).accept(this);
- ((UriResourceWithKeysImpl) pathInfoSegment)
- .setKeyPredicates(list);
- } else {
- throw wrap(new UriParserSemanticException("Key properties not allowed",
- UriParserSemanticException.MessageKeys.KEY_NOT_ALLOWED));
- }
- }
-
- return pathInfoSegment;
- }
-
- @Override
- public Object visitPathSegments(final PathSegmentsContext ctx) {
- // path segment
- for (PathSegmentContext it : ctx.vlPS) {
- it.accept(this);
- }
-
- // const segment
- if (ctx.vCS != null) {
- ctx.vCS.accept(this);
- }
- return null;
- }
-
- @Override
- public Object visitPrimitiveLiteral(final PrimitiveLiteralContext ctx) {
- ParseTree child1 = ctx.children.get(0);
-
- if (child1 instanceof EnumLitContext
- || child1 instanceof BooleanNonCaseContext
- || child1 instanceof NullruleContext
- || child1 instanceof NaninfinityContext) {
- return child1.accept(this);
- }
- return new LiteralImpl().setText(ctx.getText());
- }
-
- @Override
- public Object visitQueryOptions(final QueryOptionsContext ctx) {
-
- List<QueryOptionImpl> qpList = new ArrayList<QueryOptionImpl>();
- for (QueryOptionContext entityOption : ctx.vlQO) {
- qpList.add((QueryOptionImpl) entityOption.accept(this));
- }
-
- return qpList;
- }
-
- /*
- * @Override
- * public Object visitResourcePath(final ResourcePathContext ctx) {
- * if (ctx.vAll != null) {
- * contextUriInfo = new UriInfoImpl().setKind(UriInfoKind.all);
- * } else if (ctx.vCJ != null) {
- * ctx.vCJ.accept(this);
- * } else if (ctx.vlPS != null) {
- * UriInfoImpl uriInfoPath = new UriInfoImpl().setKind(UriInfoKind.resource);
- * contextUriInfo = uriInfoPath;
- * super.visitResourcePath(ctx); // visit all children of ctx
- * }
- * return contextUriInfo;
- * }
- */
- @Override
- public Object visitRootExpr(final RootExprContext ctx) {
-
- UriResource lastResource = context.contextUriInfo.getLastResourcePart();
-
- if (!(lastResource instanceof UriResourcePartTyped)) {
- throw wrap(new UriParserSemanticException("Resource path not typed",
- UriParserSemanticException.MessageKeys.RESOURCE_PATH_NOT_TYPED));
- }
-
- UriResourcePartTyped lastType = (UriResourcePartTyped) lastResource;
-
- UriResourceRootImpl pathInfoRoot = new UriResourceRootImpl();
- pathInfoRoot.setCollection(lastType.isCollection());
- pathInfoRoot.setType(getTypeInformation(lastType).type);
-
- UriInfoImpl uriInfoImplpath = new UriInfoImpl().setKind(UriInfoKind.resource);
- uriInfoImplpath.addResourcePart(pathInfoRoot);
-
- if (ctx.vPs != null) {
- // store the context uriInfoPath
- UriInfoImpl backupUriInfoPath = context.contextUriInfo;
-
- // set temporary uriInfoPath to collect the path information of the memberExpression
- context.contextUriInfo = uriInfoImplpath;
-
- ctx.vPs.accept(this);
-
- context.contextUriInfo = backupUriInfoPath;
-
- }
- return new MemberImpl()
- .setResourcePath(uriInfoImplpath);
-
- }
-
- @Override
- public ExpressionImpl visitRoundMethodCallExpr(final RoundMethodCallExprContext ctx) {
- return new MethodImpl()
- .setMethod(MethodKind.ROUND)
- .addParameter((ExpressionImpl) ctx.vE1.accept(this));
- }
-
- @Override
- public ExpressionImpl visitSecondMethodCallExpr(final SecondMethodCallExprContext ctx) {
- return new MethodImpl()
- .setMethod(MethodKind.SECOND)
- .addParameter((ExpressionImpl) ctx.vE1.accept(this));
- }
-
- @Override
- public Object visitSelect(final SelectContext ctx) {
- List<SelectItemImpl> selectItems = new ArrayList<SelectItemImpl>();
-
- for (SelectItemContext si : ctx.vlSI) {
- selectItems.add((SelectItemImpl) si.accept(this));
- }
-
- return new SelectOptionImpl().setSelectItems(selectItems).setText(ctx.children.get(2).getText());
- }
-
- @Override
- public Object visitSelectEOF(final SelectEOFContext ctx) {
- List<SelectItemImpl> selectItems = new ArrayList<SelectItemImpl>();
-
- for (SelectItemContext si : ctx.vlSI) {
- selectItems.add((SelectItemImpl) si.accept(this));
- }
-
- return new SelectOptionImpl().setSelectItems(selectItems).setText(ctx.getText());
- }
-
- @Override
- public Object visitSelectItem(final SelectItemContext ctx) {
- SelectItemImpl selectItem = new SelectItemImpl();
-
- context.contextSelectItem = selectItem;
- for (SelectSegmentContext si : ctx.vlSS) {
- si.accept(this);
- }
- context.contextSelectItem = null;
-
- return selectItem;
- }
-
- @Override
- public Object visitSelectSegment(final SelectSegmentContext ctx) {
-
- if (ctx.vS != null) {
- if (ctx.vNS != null) {
- String namespace = ctx.vNS.getText();
- namespace = namespace.substring(0, namespace.length() - 1);
- FullQualifiedName fullName = new FullQualifiedName(namespace, "*");
- context.contextSelectItem.addAllOperationsInSchema(fullName);
- } else {
- context.contextSelectItem.setStar(true);
- }
- return null;
- }
-
- String odi = ctx.vODI.getText();
- if (ctx.vNS == null) {
-
- EdmType prevType = null;
- if (context.contextSelectItem.getResourcePath() == null) {
- prevType = context.contextTypes.peek().type;
- } else {
- UriInfoImpl uriInfo = (UriInfoImpl) context.contextSelectItem.getResourcePath();
- UriResource last = uriInfo.getLastResourcePart();
-
- prevType = getTypeInformation(last).type;
- if (prevType == null) {
- throw wrap(new UriParserSemanticException("prev segment not typed",
- UriParserSemanticException.MessageKeys.ONLY_FOR_TYPED_PARTS, "select"));
- }
- }
-
- if (!(prevType instanceof EdmStructuredType)) {
- throw wrap(new UriParserSemanticException("Previous select item is not a structural type",
- UriParserSemanticException.MessageKeys.ONLY_FOR_STRUCTURAL_TYPES, "select"));
- }
-
- EdmStructuredType structType = (EdmStructuredType) prevType;
- EdmElement element = structType.getProperty(odi);
- if (element == null) {
- throw wrap(new UriParserSemanticException("Previous select item has not property: " + odi,
- UriParserSemanticException.MessageKeys.EXPRESSION_PROPERTY_NOT_IN_TYPE, structType.getName(), odi));
- }
-
- // create new segment
- // SelectSegmentImpl newSegment = new SelectSegmentImpl().setProperty(property);
- // contextSelectItem.addSegment(newSegment);
- if (element instanceof EdmProperty) {
- EdmProperty property = (EdmProperty) element;
- if (property.isPrimitive()) {
-
- UriResourcePrimitivePropertyImpl simple = new UriResourcePrimitivePropertyImpl();
- simple.setProperty(property);
-
- UriInfoImpl uriInfo = (UriInfoImpl) context.contextSelectItem.getResourcePath();
- if (uriInfo == null) {
- uriInfo = new UriInfoImpl().setKind(UriInfoKind.resource);
- uriInfo.addResourcePart(simple);
-
- EdmType startType = removeUriResourceStartingTypeFilterImpl(uriInfo);
- if (startType != null) {
- context.contextSelectItem.setTypeFilter(startType);
- }
-
- context.contextSelectItem.setResourcePath(uriInfo);
- } else {
- uriInfo.addResourcePart(simple);
- }
- return this;
- } else {
- UriInfoImpl uriInfo = (UriInfoImpl) context.contextSelectItem.getResourcePath();
-
- UriResourceComplexPropertyImpl complex = new UriResourceComplexPropertyImpl();
- complex.setProperty(property);
-
- if (uriInfo == null) {
- uriInfo = new UriInfoImpl().setKind(UriInfoKind.resource);
- uriInfo.addResourcePart(complex);
-
- EdmType startType = removeUriResourceStartingTypeFilterImpl(uriInfo);
- if (startType != null) {
- context.contextSelectItem.setTypeFilter(startType);
- }
-
- context.contextSelectItem.setResourcePath(uriInfo);
- } else {
- uriInfo.addResourcePart(complex);
- }
- return this;
- }
- } else {
- throw wrap(new UriParserSemanticException("Only Simple and Complex properties within select allowed",
- UriParserSemanticException.MessageKeys.ONLY_SIMPLE_AND_COMPLEX_PROPERTIES_IN_SELECT));
- }
- } else {
- String namespace = ctx.vNS.getText();
- namespace = namespace.substring(0, namespace.length() - 1);
-
- FullQualifiedName fullName = new FullQualifiedName(namespace, odi);
- // contextSelectItem.addQualifiedThing(fullName);
-
- if (context.contextSelectItem.getResourcePath() == null) {
- EdmType prevType = context.contextTypes.peek().type;
-
- // check for complex type cast
- if (prevType instanceof EdmComplexType) {
- EdmComplexType ct = edm.getComplexType(fullName);
- if (ct != null) {
- if ((ct.compatibleTo(prevType))) {
- UriResourceStartingTypeFilterImpl resourcePart = new UriResourceStartingTypeFilterImpl();
- resourcePart.setCollectionTypeFilter(ct);
-
- UriInfoImpl uriInfo = new UriInfoImpl().setKind(UriInfoKind.resource);
- uriInfo.addResourcePart(resourcePart);
-
- EdmType startType = removeUriResourceStartingTypeFilterImpl(uriInfo);
- if (startType != null) {
- context.contextSelectItem.setTypeFilter(startType);
- }
-
- context.contextSelectItem.setResourcePath(uriInfo);
- return this;
- }
- }
- } else if (prevType instanceof EdmEntityType) {
- EdmEntityType et = edm.getEntityType(fullName);
- if (et != null) {
- if ((et.compatibleTo(prevType))) {
- UriResourceStartingTypeFilterImpl resourcePart = new UriResourceStartingTypeFilterImpl();
- resourcePart.setCollectionTypeFilter(et);
-
- UriInfoImpl uriInfo = new UriInfoImpl().setKind(UriInfoKind.resource);
- uriInfo.addResourcePart(resourcePart);
-
- EdmType startType = removeUriResourceStartingTypeFilterImpl(uriInfo);
- if (startType != null) {
- context.contextSelectItem.setTypeFilter(startType);
- }
-
- context.contextSelectItem.setResourcePath(uriInfo);
- return this;
- }
- }
- } else {
- throw wrap(new UriParserSemanticException("prev segment must be complex of entity type",
- UriParserSemanticException.MessageKeys.COMPLEX_PROPERTY_OF_ENTITY_TYPE_EXPECTED));
- }
-
- } else {
- UriInfoImpl uriInfo = (UriInfoImpl) context.contextSelectItem.getResourcePath();
- UriResource last = uriInfo.getLastResourcePart();
- if (!(last instanceof UriResourceTypedImpl)) {
- throw wrap(new UriParserSemanticException("prev segment typed",
- UriParserSemanticException.MessageKeys.ONLY_FOR_TYPED_PARTS, "select"));
- }
- EdmType prevType = getTypeInformation(last).type;
-
- if (prevType instanceof EdmComplexType) {
- EdmComplexType ct = edm.getComplexType(fullName);
- if (ct != null) {
- if ((ct.compatibleTo(prevType))) {
- UriResourceStartingTypeFilterImpl resourcePart = new UriResourceStartingTypeFilterImpl();
- resourcePart.setCollectionTypeFilter(ct);
-
- uriInfo.addResourcePart(resourcePart);
- return this;
- }
- }
- } else if (prevType instanceof EdmEntityType) {
- throw wrap(new UriParserSemanticException("Error",
- UriParserSemanticException.MessageKeys.NOT_FOR_ENTITY_TYPE));
- /*
- * EdmEntityType et = edm.getEntityType(fullName);
- * if (et != null) {
- * if ((et.compatibleTo((EdmStructuralType) prevType))) {
- * UriResourceStartingTypeFilterImpl resourcePart = new UriResourceStartingTypeFilterImpl();
- * resourcePart.setEntryTypeFilter(et);
- *
- * uriInfo.addResourcePart(resourcePart);
- * return this;
- * }
- * }
- */
- } else {
- throw wrap(new UriParserSemanticException("prev segment must be complex of entity type",
- UriParserSemanticException.MessageKeys.COMPLEX_PROPERTY_OF_ENTITY_TYPE_EXPECTED));
- }
- }
-
- EdmType prevType = null;
- if (context.contextSelectItem.getResourcePath() == null) {
- prevType = context.contextTypes.peek().type;
- } else {
- UriInfoImpl uriInfo = (UriInfoImpl) context.contextSelectItem.getResourcePath();
- UriResource last = uriInfo.getLastResourcePart();
- if (!(last instanceof UriResourceTypedImpl)) {
- throw wrap(new UriParserSemanticException("prev segment typed",
- UriParserSemanticException.MessageKeys.PREVIOUS_PART_TYPED));
- }
- prevType = getTypeInformation(last).type;
- }
-
- FullQualifiedName finalTypeName = new FullQualifiedName(prevType.getNamespace(), prevType.getName());
-
- // check for action
- EdmAction action = edm.getBoundAction(fullName, finalTypeName, null);
-
- if (action != null) {
- UriResourceActionImpl uriAction = new UriResourceActionImpl();
- uriAction.setAction(action);
-
- UriInfoImpl resourcePath = (UriInfoImpl) context.contextSelectItem.getResourcePath();
- resourcePath.addResourcePart(uriAction);
- }
-
- // check for function
- EdmFunction function = edm.getBoundFunction(fullName, finalTypeName, null, null);
-
- if (function != null) {
- UriResourceFunctionImpl uriFunction = new UriResourceFunctionImpl();
- uriFunction.setFunction(function);
-
- UriInfoImpl resourcePath = (UriInfoImpl) context.contextSelectItem.getResourcePath();
- resourcePath.addResourcePart(uriFunction);
- }
- }
- return null;
- }
-
- @Override
- public Object visitSkip(final SkipContext ctx) {
- SkipOptionImpl skiptoken = new SkipOptionImpl();
-
- String text = ctx.children.get(2).getText();
-
- return skiptoken.setValue(Integer.parseInt(text)).setText(text);
- }
-
- @Override
- public Object visitSkiptoken(final SkiptokenContext ctx) {
- SkipTokenOptionImpl skiptoken = new SkipTokenOptionImpl();
-
- String text = ctx.children.get(2).getText();
-
- return skiptoken.setValue(text).setText(text);
- }
-
- @Override
- public ExpressionImpl visitStartsWithMethodCallExpr(final StartsWithMethodCallExprContext ctx) {
- return new MethodImpl()
- .setMethod(MethodKind.STARTSWITH)
- .addParameter((ExpressionImpl) ctx.vE1.accept(this))
- .addParameter((ExpressionImpl) ctx.vE2.accept(this));
- }
-
- @Override
- public ExpressionImpl visitSubstringMethodCallExpr(final SubstringMethodCallExprContext ctx) {
- MethodImpl ret = new MethodImpl();
- ret.setMethod(MethodKind.SUBSTRING);
- ret.addParameter((ExpressionImpl) ctx.vE1.accept(this));
- ret.addParameter((ExpressionImpl) ctx.vE2.accept(this));
-
- if (ctx.vE3 != null) {
- ret.addParameter((ExpressionImpl) ctx.vE3.accept(this));
- }
-
- return ret;
-
- }
-
- @Override
- public ExpressionImpl visitTimeMethodCallExpr(final TimeMethodCallExprContext ctx) {
- return new MethodImpl()
- .setMethod(MethodKind.TIME)
- .addParameter((ExpressionImpl) ctx.vE1.accept(this));
- }
-
- @Override
- public Object visitTop(final TopContext ctx) {
- TopOptionImpl top = new TopOptionImpl();
-
- String text = ctx.children.get(2).getText();
-
- return top.setValue(Integer.parseInt(text)).setText(text);
- }
-
- @Override
- public ExpressionImpl visitToLowerMethodCallExpr(final ToLowerMethodCallExprContext ctx) {
- return new MethodImpl()
- .setMethod(MethodKind.TOLOWER)
- .addParameter((ExpressionImpl) ctx.vE1.accept(this));
- }
-
- @Override
- public ExpressionImpl visitTotalOffsetMinutesMethodCallExpr(final TotalOffsetMinutesMethodCallExprContext ctx) {
- return new MethodImpl()
- .setMethod(MethodKind.TOTALOFFSETMINUTES)
- .addParameter((ExpressionImpl) ctx.vE1.accept(this));
- }
-
- @Override
- public ExpressionImpl visitTotalsecondsMethodCallExpr(final TotalsecondsMethodCallExprContext ctx) {
- return new MethodImpl()
- .setMethod(MethodKind.TOTALSECONDS)
- .addParameter((ExpressionImpl) ctx.vE1.accept(this));
- }
-
- @Override
- public ExpressionImpl visitToUpperMethodCallExpr(final ToUpperMethodCallExprContext ctx) {
- return new MethodImpl()
- .setMethod(MethodKind.TOUPPER)
- .addParameter((ExpressionImpl) ctx.vE1.accept(this));
- }
-
- @Override
- public ExpressionImpl visitTrimMethodCallExpr(final TrimMethodCallExprContext ctx) {
- return new MethodImpl()
- .setMethod(MethodKind.TRIM)
- .addParameter((ExpressionImpl) ctx.vE1.accept(this));
- }
-
- @Override
- public ExpressionImpl visitYearMethodCallExpr(final YearMethodCallExprContext ctx) {
- return new MethodImpl()
- .setMethod(MethodKind.YEAR)
- .addParameter((ExpressionImpl) ctx.vE1.accept(this));
- }
-
- private ParseCancellationException wrap(final UriParserException uriParserException) {
- return new ParseCancellationException(uriParserException);
- }
-
- @Override
- public ExpressionImpl visitAltUnary(@NotNull UriParserParser.AltUnaryContext ctx) {
- UnaryImpl unary = new UnaryImpl();
- unary.setOperator(ctx.unary().NOT() == null? UnaryOperatorKind.MINUS: UnaryOperatorKind.NOT);
- unary.setOperand((ExpressionImpl) ctx.commonExpr().accept(this));
- return unary;
- }
-
- @Override
- public ExpressionImpl visitAltAlias(@NotNull UriParserParser.AltAliasContext ctx) {
- AliasImpl alias = new AliasImpl();
- alias.setParameter("@"+ctx.odataIdentifier().getChild(0).getText());
- return alias;
- }
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriParserException.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriParserException.java
deleted file mode 100644
index 31804a4..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriParserException.java
+++ /dev/null
@@ -1,40 +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.uri.parser;
-
-import org.apache.olingo.server.api.ODataTranslatedException;
-
-abstract public class UriParserException extends ODataTranslatedException {
-
- private static final long serialVersionUID = -6438700016830955949L;
-
- public UriParserException(String developmentMessage, MessageKey messageKey, String... parameters) {
- super(developmentMessage, messageKey, parameters);
- }
-
- public UriParserException(String developmentMessage, Throwable cause, MessageKey messageKey,
- String... parameters) {
- super(developmentMessage, cause, messageKey, parameters);
- }
-
- @Override
- protected String getBundleName() {
- return DEFAULT_SERVER_BUNDLE_NAME;
- }
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriParserSemanticException.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriParserSemanticException.java
deleted file mode 100644
index 77f975b..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriParserSemanticException.java
+++ /dev/null
@@ -1,71 +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.uri.parser;
-
-/** Exception thrown during URI parsing in cases where an URI part is invalid according to the Entity Data Model. */
-public class UriParserSemanticException extends UriParserException {
-
- private static final long serialVersionUID = 3850285860949809622L;
-
- public static enum MessageKeys implements MessageKey {
- /** parameters: function-import name, function parameters */ FUNCTION_NOT_FOUND,
- /** parameter: resource part */ RESOURCE_PART_ONLY_FOR_TYPED_PARTS,
- /** parameter: resource part */ RESOURCE_PART_MUST_BE_PRECEDED_BY_STRUCTURAL_TYPE,
- /** parameter: property name */ PROPERTY_AFTER_COLLECTION,
- /** parameters: type name, property name */ PROPERTY_NOT_IN_TYPE,
- /** parameters: type name, property name */ EXPRESSION_PROPERTY_NOT_IN_TYPE,
- /** parameter: property name */ UNKNOWN_PROPERTY_TYPE,
- /** parameter: type filter */ INCOMPATIBLE_TYPE_FILTER,
- /** parameters: previous type filter, last type filter */ TYPE_FILTER_NOT_CHAINABLE,
- /** parameter: type filter */ PREVIOUS_PART_NOT_TYPED,
- /** parameter: type */ FUNCTION_PARAMETERS_EXPECTED,
- /** parameter: resource part */ UNKNOWN_PART,
- /** parameter: expression */ ONLY_FOR_TYPED_PARTS,
- /** parameter: entity type name */ UNKNOWN_ENTITY_TYPE,
- /** parameter: expression */ ONLY_FOR_COLLECTIONS,
- /** parameter: expression */ ONLY_FOR_ENTITY_TYPES,
- /** parameter: expression */ ONLY_FOR_STRUCTURAL_TYPES,
- /** parameter: expression */ ONLY_FOR_TYPED_PROPERTIES,
- /** parameter: value */ INVALID_KEY_VALUE,
- PARAMETERS_LIST_ONLY_FOR_TYPED_PARTS,
- /** parameters: expected number, actual number */ WRONG_NUMBER_OF_KEY_PROPERTIES,
- NOT_ENOUGH_REFERENTIAL_CONSTRAINTS,
- KEY_NOT_ALLOWED,
- RESOURCE_PATH_NOT_TYPED,
- ONLY_SIMPLE_AND_COMPLEX_PROPERTIES_IN_SELECT,
- COMPLEX_PROPERTY_OF_ENTITY_TYPE_EXPECTED,
- NOT_FOR_ENTITY_TYPE,
- PREVIOUS_PART_TYPED,
- /** parameter: resource_name */ RESOURCE_NOT_FOUND;
-
- @Override
- public String getKey() {
- return name();
- }
- }
-
- public UriParserSemanticException(String developmentMessage, MessageKey messageKey, String... parameters) {
- super(developmentMessage, messageKey, parameters);
- }
-
- public UriParserSemanticException(String developmentMessage, Throwable cause, MessageKey messageKey,
- String... parameters) {
- super(developmentMessage, cause, messageKey, parameters);
- }
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriParserSyntaxException.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriParserSyntaxException.java
deleted file mode 100644
index 1d4ce0a..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/parser/UriParserSyntaxException.java
+++ /dev/null
@@ -1,49 +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.uri.parser;
-
-/** Exception thrown during URI parsing in cases where the URI violates the URI construction rules. */
-public class UriParserSyntaxException extends UriParserException {
-
- private static final long serialVersionUID = 5887744747812478226L;
-
- public static enum MessageKeys implements MessageKey {
- /** parameter: segment */ MUST_BE_LAST_SEGMENT,
- /** parameter: query-option name */ UNKNOWN_SYSTEM_QUERY_OPTION,
- /** parameter: query-option name */ DOUBLE_SYSTEM_QUERY_OPTION,
- /** parameters: query-option name, query-option value */ WRONG_VALUE_FOR_SYSTEM_QUERY_OPTION,
- /** parameter: $format option value */ WRONG_VALUE_FOR_SYSTEM_QUERY_OPTION_FORMAT,
- SYSTEM_QUERY_OPTION_LEVELS_NOT_ALLOWED_HERE,
- SYNTAX;
-
- @Override
- public String getKey() {
- return name();
- }
- }
-
- public UriParserSyntaxException(String developmentMessage, MessageKey messageKey, String... parameters) {
- super(developmentMessage, messageKey, parameters);
- }
-
- public UriParserSyntaxException(String developmentMessage, Throwable cause, MessageKey messageKey,
- String... parameters) {
- super(developmentMessage, cause, messageKey, parameters);
- }
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/AliasQueryOptionImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/AliasQueryOptionImpl.java
deleted file mode 100644
index fd971a2..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/AliasQueryOptionImpl.java
+++ /dev/null
@@ -1,38 +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.uri.queryoption;
-
-import org.apache.olingo.server.api.uri.queryoption.AliasQueryOption;
-import org.apache.olingo.server.core.uri.queryoption.expression.ExpressionImpl;
-
-public class AliasQueryOptionImpl extends QueryOptionImpl implements AliasQueryOption {
-
- private ExpressionImpl aliasValue;
-
- @Override
- public ExpressionImpl getValue() {
- return aliasValue;
- }
-
- public AliasQueryOptionImpl setAliasValue(final ExpressionImpl aliasValue) {
- this.aliasValue = aliasValue;
- return this;
- }
-
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/CountOptionImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/CountOptionImpl.java
deleted file mode 100644
index fa35d2e..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/CountOptionImpl.java
+++ /dev/null
@@ -1,42 +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.uri.queryoption;
-
-import org.apache.olingo.server.api.uri.queryoption.CountOption;
-import org.apache.olingo.server.api.uri.queryoption.SystemQueryOptionKind;
-
-public class CountOptionImpl extends SystemQueryOptionImpl implements CountOption {
-
- private boolean count;
-
- public CountOptionImpl() {
- setKind(SystemQueryOptionKind.COUNT);
- }
-
- @Override
- public boolean getValue() {
- return count;
- }
-
- public CountOptionImpl setValue(final boolean count) {
- this.count = count;
- return this;
- }
-
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/CustomQueryOptionImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/CustomQueryOptionImpl.java
deleted file mode 100644
index f5ae251..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/CustomQueryOptionImpl.java
+++ /dev/null
@@ -1,25 +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.uri.queryoption;
-
-import org.apache.olingo.server.api.uri.queryoption.CustomQueryOption;
-
-public class CustomQueryOptionImpl extends QueryOptionImpl implements CustomQueryOption {
-
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/ExpandItemImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/ExpandItemImpl.java
deleted file mode 100644
index f5b10e3..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/ExpandItemImpl.java
+++ /dev/null
@@ -1,173 +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.uri.queryoption;
-
-import org.apache.olingo.commons.api.edm.EdmType;
-import org.apache.olingo.server.api.uri.UriInfoResource;
-import org.apache.olingo.server.api.uri.queryoption.CountOption;
-import org.apache.olingo.server.api.uri.queryoption.ExpandItem;
-import org.apache.olingo.server.api.uri.queryoption.ExpandOption;
-import org.apache.olingo.server.api.uri.queryoption.FilterOption;
-import org.apache.olingo.server.api.uri.queryoption.LevelsExpandOption;
-import org.apache.olingo.server.api.uri.queryoption.OrderByOption;
-import org.apache.olingo.server.api.uri.queryoption.SearchOption;
-import org.apache.olingo.server.api.uri.queryoption.SelectOption;
-import org.apache.olingo.server.api.uri.queryoption.SkipOption;
-import org.apache.olingo.server.api.uri.queryoption.SystemQueryOptionKind;
-import org.apache.olingo.server.api.uri.queryoption.TopOption;
-
-import java.util.List;
-
-public class ExpandItemImpl implements ExpandItem {
- private LevelsExpandOption levelsExpandOption;
- private FilterOption filterOption;
- private SearchOption searchOption;
- private OrderByOption orderByOption;
- private SkipOption skipOption;
- private TopOption topOption;
- private CountOption inlineCountOption;
- private SelectOption selectOption;
- private ExpandOption expandOption;
-
- private UriInfoResource resourceInfo;
-
- private boolean isStar;
-
- private boolean isRef;
- private EdmType startTypeFilter;
-
- public ExpandItemImpl setSystemQueryOption(final SystemQueryOptionImpl sysItem) {
-
- if (sysItem.getKind() == SystemQueryOptionKind.EXPAND) {
- expandOption = (ExpandOptionImpl) sysItem;
- } else if (sysItem.getKind() == SystemQueryOptionKind.FILTER) {
- filterOption = (FilterOptionImpl) sysItem;
- } else if (sysItem.getKind() == SystemQueryOptionKind.COUNT) {
- inlineCountOption = (CountOptionImpl) sysItem;
- } else if (sysItem.getKind() == SystemQueryOptionKind.ORDERBY) {
- orderByOption = (OrderByOptionImpl) sysItem;
- } else if (sysItem.getKind() == SystemQueryOptionKind.SEARCH) {
- searchOption = (SearchOptionImpl) sysItem;
- } else if (sysItem.getKind() == SystemQueryOptionKind.SELECT) {
- selectOption = (SelectOptionImpl) sysItem;
- } else if (sysItem.getKind() == SystemQueryOptionKind.SKIP) {
- skipOption = (SkipOptionImpl) sysItem;
- } else if (sysItem.getKind() == SystemQueryOptionKind.TOP) {
- topOption = (TopOptionImpl) sysItem;
- } else if (sysItem.getKind() == SystemQueryOptionKind.LEVELS) {
- levelsExpandOption = (LevelsExpandOption) sysItem;
- }
- return this;
- }
-
- public ExpandItemImpl setSystemQueryOptions(final List<SystemQueryOptionImpl> list) {
-
- for (SystemQueryOptionImpl item : list) {
- setSystemQueryOption(item);
- }
- return this;
- }
-
- @Override
- public LevelsExpandOption getLevelsOption() {
- return levelsExpandOption;
- }
-
- @Override
- public FilterOption getFilterOption() {
- return filterOption;
- }
-
- @Override
- public SearchOption getSearchOption() {
- return searchOption;
- }
-
- @Override
- public OrderByOption getOrderByOption() {
- return orderByOption;
- }
-
- @Override
- public SkipOption getSkipOption() {
- return skipOption;
- }
-
- @Override
- public TopOption getTopOption() {
- return topOption;
- }
-
- @Override
- public CountOption getCountOption() {
- return inlineCountOption;
- }
-
- @Override
- public SelectOption getSelectOption() {
-
- return selectOption;
- }
-
- @Override
- public ExpandOption getExpandOption() {
- return expandOption;
- }
-
- public ExpandItemImpl setResourcePath(final UriInfoResource resourceInfo) {
- this.resourceInfo = resourceInfo;
- return this;
- }
-
- @Override
- public UriInfoResource getResourcePath() {
-
- return resourceInfo;
- }
-
- @Override
- public boolean isStar() {
- return isStar;
- }
-
- public ExpandItemImpl setIsStar(final boolean isStar) {
- this.isStar = isStar;
- return this;
- }
-
- @Override
- public boolean isRef() {
- return isRef;
- }
-
- public ExpandItemImpl setIsRef(final boolean isRef) {
- this.isRef = isRef;
- return this;
- }
-
- @Override
- public EdmType getStartTypeFilter() {
- return startTypeFilter;
- }
-
- public ExpandItemImpl setTypeFilter(final EdmType startTypeFilter) {
- this.startTypeFilter = startTypeFilter;
- return this;
- }
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/ExpandOptionImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/ExpandOptionImpl.java
deleted file mode 100644
index 33dbef5..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/ExpandOptionImpl.java
+++ /dev/null
@@ -1,49 +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.uri.queryoption;
-
-import org.apache.olingo.server.api.uri.queryoption.ExpandItem;
-import org.apache.olingo.server.api.uri.queryoption.ExpandOption;
-import org.apache.olingo.server.api.uri.queryoption.SystemQueryOptionKind;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class ExpandOptionImpl extends SystemQueryOptionImpl implements ExpandOption {
-
- List<ExpandItemImpl> expandItems = new ArrayList<ExpandItemImpl>();
-
- public ExpandOptionImpl() {
- setKind(SystemQueryOptionKind.EXPAND);
- }
-
- public void addExpandItem(final ExpandItemImpl expandItem) {
- expandItems.add(expandItem);
- }
-
- @Override
- public List<ExpandItem> getExpandItems() {
- List<ExpandItem> retList = new ArrayList<ExpandItem>();
- for (ExpandItemImpl item : expandItems) {
- retList.add(item);
- }
- return retList;
- }
-
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/FilterOptionImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/FilterOptionImpl.java
deleted file mode 100644
index 8f0b0be..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/FilterOptionImpl.java
+++ /dev/null
@@ -1,43 +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.uri.queryoption;
-
-import org.apache.olingo.server.api.uri.queryoption.FilterOption;
-import org.apache.olingo.server.api.uri.queryoption.SystemQueryOptionKind;
-import org.apache.olingo.server.core.uri.queryoption.expression.ExpressionImpl;
-
-public class FilterOptionImpl extends SystemQueryOptionImpl implements FilterOption {
-
- private ExpressionImpl expression;
-
- public FilterOptionImpl() {
- setKind(SystemQueryOptionKind.FILTER);
- }
-
- public FilterOptionImpl setExpression(final ExpressionImpl expression) {
- this.expression = expression;
- return this;
- }
-
- @Override
- public ExpressionImpl getExpression() {
- return expression;
- }
-
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/FormatOptionImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/FormatOptionImpl.java
deleted file mode 100644
index a0baad7..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/FormatOptionImpl.java
+++ /dev/null
@@ -1,41 +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.uri.queryoption;
-
-import org.apache.olingo.server.api.uri.queryoption.FormatOption;
-import org.apache.olingo.server.api.uri.queryoption.SystemQueryOptionKind;
-
-public class FormatOptionImpl extends SystemQueryOptionImpl implements FormatOption {
- private String value;
-
- public FormatOptionImpl() {
- setKind(SystemQueryOptionKind.FORMAT);
- }
-
- public FormatOptionImpl setFormat(final String value) {
- this.value = value;
- return this;
- }
-
- @Override
- public String getFormat() {
- return value;
- }
-
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/IdOptionImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/IdOptionImpl.java
deleted file mode 100644
index f7df825..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/IdOptionImpl.java
+++ /dev/null
@@ -1,40 +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.uri.queryoption;
-
-import org.apache.olingo.server.api.uri.queryoption.IdOption;
-import org.apache.olingo.server.api.uri.queryoption.SystemQueryOptionKind;
-
-public class IdOptionImpl extends SystemQueryOptionImpl implements IdOption {
- private String value;
-
- public IdOptionImpl() {
- setKind(SystemQueryOptionKind.ID);
- }
-
- public IdOptionImpl setValue(final String value) {
- this.value = value;
- return this;
- }
-
- @Override
- public String getValue() {
- return value;
- }
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/LevelsOptionImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/LevelsOptionImpl.java
deleted file mode 100644
index dc17fdc..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/LevelsOptionImpl.java
+++ /dev/null
@@ -1,53 +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.uri.queryoption;
-
-import org.apache.olingo.server.api.uri.queryoption.LevelsExpandOption;
-import org.apache.olingo.server.api.uri.queryoption.SystemQueryOptionKind;
-
-public class LevelsOptionImpl extends SystemQueryOptionImpl implements LevelsExpandOption {
- private boolean isMax;
- private int value;
-
- public LevelsOptionImpl() {
- setKind(SystemQueryOptionKind.LEVELS);
- }
-
- public LevelsOptionImpl setValue(final int value) {
- this.value = value;
- return this;
- }
-
- @Override
- public boolean isMax() {
- return isMax;
- }
-
- public LevelsOptionImpl setMax() {
- isMax = true;
- return this;
-
- }
-
- @Override
- public int getValue() {
- return value;
- }
-
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/OrderByItemImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/OrderByItemImpl.java
deleted file mode 100644
index aac33f0..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/OrderByItemImpl.java
+++ /dev/null
@@ -1,49 +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.uri.queryoption;
-
-import org.apache.olingo.server.api.uri.queryoption.OrderByItem;
-import org.apache.olingo.server.core.uri.queryoption.expression.ExpressionImpl;
-
-public class OrderByItemImpl implements OrderByItem {
-
- private ExpressionImpl expression;
- private boolean descending = false; // default sort order is ascending
-
- @Override
- public boolean isDescending() {
- return descending;
- }
-
- public OrderByItem setDescending(final boolean descending) {
- this.descending = descending;
- return this;
- }
-
- @Override
- public ExpressionImpl getExpression() {
- return expression;
- }
-
- public OrderByItem setExpression(final ExpressionImpl expression) {
- this.expression = expression;
- return this;
- }
-
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/OrderByOptionImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/OrderByOptionImpl.java
deleted file mode 100644
index c7f5c9f..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/OrderByOptionImpl.java
+++ /dev/null
@@ -1,50 +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.uri.queryoption;
-
-import org.apache.olingo.server.api.uri.queryoption.OrderByItem;
-import org.apache.olingo.server.api.uri.queryoption.OrderByOption;
-import org.apache.olingo.server.api.uri.queryoption.SystemQueryOptionKind;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class OrderByOptionImpl extends SystemQueryOptionImpl implements OrderByOption {
-
- private List<OrderByItemImpl> orders = new ArrayList<OrderByItemImpl>();
-
- public OrderByOptionImpl() {
- setKind(SystemQueryOptionKind.ORDERBY);
- }
-
- @Override
- public List<OrderByItem> getOrders() {
- List<OrderByItem> retList = new ArrayList<OrderByItem>();
- for (OrderByItemImpl item : orders) {
- retList.add(item);
- }
- return retList;
- }
-
- public OrderByOptionImpl addOrder(final OrderByItemImpl order) {
- orders.add(order);
- return this;
- }
-
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/QueryOptionImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/QueryOptionImpl.java
deleted file mode 100644
index 1239cc6..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/QueryOptionImpl.java
+++ /dev/null
@@ -1,47 +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.uri.queryoption;
-
-import org.apache.olingo.server.api.uri.queryoption.QueryOption;
-
-public class QueryOptionImpl implements QueryOption {
- private String name;
- private String text;
-
- @Override
- public String getName() {
- return name;
- }
-
- public QueryOptionImpl setName(final String name) {
- this.name = name;
- return this;
- }
-
- @Override
- public String getText() {
- return text;
- }
-
- public QueryOptionImpl setText(final String value) {
- text = value;
- return this;
- }
-
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/SearchOptionImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/SearchOptionImpl.java
deleted file mode 100644
index 130ef27..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/SearchOptionImpl.java
+++ /dev/null
@@ -1,37 +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.uri.queryoption;
-
-import org.apache.olingo.server.api.uri.queryoption.SearchOption;
-import org.apache.olingo.server.api.uri.queryoption.SystemQueryOptionKind;
-import org.apache.olingo.server.api.uri.queryoption.search.SearchExpression;
-
-// TODO planned: support $search
-public class SearchOptionImpl extends SystemQueryOptionImpl implements SearchOption {
-
- public SearchOptionImpl() {
- setKind(SystemQueryOptionKind.SEARCH);
- }
-
- @Override
- public SearchExpression getSearchExpression() {
- return null;
- }
-
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/SelectItemImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/SelectItemImpl.java
deleted file mode 100644
index 13d6436..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/SelectItemImpl.java
+++ /dev/null
@@ -1,84 +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.uri.queryoption;
-
-import org.apache.olingo.commons.api.edm.EdmType;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.server.api.uri.UriInfoResource;
-import org.apache.olingo.server.api.uri.queryoption.SelectItem;
-
-public class SelectItemImpl implements SelectItem {
-
- private UriInfoResource path;
-
- private boolean isStar;
- private FullQualifiedName addOperationsInSchemaNameSpace;
-
- private EdmType startTypeFilter;
-
- @Override
- public UriInfoResource getResourcePath() {
-
- return path;
- }
-
- public SelectItemImpl setResourcePath(final UriInfoResource path) {
- this.path = path;
- return this;
- }
-
- @Override
- public boolean isStar() {
- return isStar;
- }
-
- public SelectItemImpl setStar(final boolean isStar) {
- this.isStar = isStar;
- return this;
- }
-
- @Override
- public boolean isAllOperationsInSchema() {
- if (addOperationsInSchemaNameSpace == null) {
- return false;
- } else {
- return true;
- }
- }
-
- @Override
- public FullQualifiedName getAllOperationsInSchemaNameSpace() {
- return addOperationsInSchemaNameSpace;
- }
-
- public void addAllOperationsInSchema(final FullQualifiedName addOperationsInSchemaNameSpace) {
- this.addOperationsInSchemaNameSpace = addOperationsInSchemaNameSpace;
- }
-
- @Override
- public EdmType getStartTypeFilter() {
- return startTypeFilter;
- }
-
- public SelectItemImpl setTypeFilter(final EdmType startTypeFilter) {
- this.startTypeFilter = startTypeFilter;
- return this;
- }
-
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/SelectOptionImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/SelectOptionImpl.java
deleted file mode 100644
index 393322f..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/SelectOptionImpl.java
+++ /dev/null
@@ -1,50 +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.uri.queryoption;
-
-import org.apache.olingo.server.api.uri.queryoption.SelectItem;
-import org.apache.olingo.server.api.uri.queryoption.SelectOption;
-import org.apache.olingo.server.api.uri.queryoption.SystemQueryOptionKind;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class SelectOptionImpl extends SystemQueryOptionImpl implements SelectOption {
-
- private List<SelectItemImpl> selectItems;
-
- public SelectOptionImpl() {
- setKind(SystemQueryOptionKind.SELECT);
- }
-
- public SelectOptionImpl setSelectItems(final List<SelectItemImpl> selectItems) {
- this.selectItems = selectItems;
- return this;
- }
-
- @Override
- public List<SelectItem> getSelectItems() {
- List<SelectItem> retList = new ArrayList<SelectItem>();
- for (SelectItemImpl item : selectItems) {
- retList.add(item);
- }
- return retList;
- }
-
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/SkipOptionImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/SkipOptionImpl.java
deleted file mode 100644
index 84549e4..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/SkipOptionImpl.java
+++ /dev/null
@@ -1,41 +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.uri.queryoption;
-
-import org.apache.olingo.server.api.uri.queryoption.SkipOption;
-import org.apache.olingo.server.api.uri.queryoption.SystemQueryOptionKind;
-
-public class SkipOptionImpl extends SystemQueryOptionImpl implements SkipOption {
- private int value;
-
- public SkipOptionImpl() {
- setKind(SystemQueryOptionKind.SKIP);
- }
-
- @Override
- public int getValue() {
- return value;
- }
-
- public SkipOptionImpl setValue(final int value) {
- this.value = value;
- return this;
- }
-
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/SkipTokenOptionImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/SkipTokenOptionImpl.java
deleted file mode 100644
index f65115c..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/SkipTokenOptionImpl.java
+++ /dev/null
@@ -1,41 +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.uri.queryoption;
-
-import org.apache.olingo.server.api.uri.queryoption.SkipTokenOption;
-import org.apache.olingo.server.api.uri.queryoption.SystemQueryOptionKind;
-
-public class SkipTokenOptionImpl extends SystemQueryOptionImpl implements SkipTokenOption {
- private String skipTokenValue;
-
- public SkipTokenOptionImpl() {
- setKind(SystemQueryOptionKind.SKIPTOKEN);
- }
-
- @Override
- public String getValue() {
- return skipTokenValue;
- }
-
- public SkipTokenOptionImpl setValue(final String skipTokenValue) {
- this.skipTokenValue = skipTokenValue;
- return this;
- }
-
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/SystemQueryOptionImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/SystemQueryOptionImpl.java
deleted file mode 100644
index 99d94fd..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/SystemQueryOptionImpl.java
+++ /dev/null
@@ -1,42 +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.uri.queryoption;
-
-import org.apache.olingo.server.api.uri.queryoption.SystemQueryOption;
-import org.apache.olingo.server.api.uri.queryoption.SystemQueryOptionKind;
-
-public class SystemQueryOptionImpl extends QueryOptionImpl implements SystemQueryOption {
-
- private SystemQueryOptionKind kind;
-
- @Override
- public SystemQueryOptionKind getKind() {
- return kind;
- }
-
- void setKind(final SystemQueryOptionKind kind) {
- this.kind = kind;
- }
-
- @Override
- public String getName() {
- return kind.toString();
- }
-
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/TopOptionImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/TopOptionImpl.java
deleted file mode 100644
index aa33120..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/TopOptionImpl.java
+++ /dev/null
@@ -1,41 +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.uri.queryoption;
-
-import org.apache.olingo.server.api.uri.queryoption.SystemQueryOptionKind;
-import org.apache.olingo.server.api.uri.queryoption.TopOption;
-
-public class TopOptionImpl extends SystemQueryOptionImpl implements TopOption {
- private int value;
-
- public TopOptionImpl() {
- setKind(SystemQueryOptionKind.TOP);
- }
-
- @Override
- public int getValue() {
- return value;
- }
-
- public TopOptionImpl setValue(final int value) {
- this.value = value;
- return this;
- }
-
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/expression/AliasImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/expression/AliasImpl.java
deleted file mode 100644
index 09af93f..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/expression/AliasImpl.java
+++ /dev/null
@@ -1,44 +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.uri.queryoption.expression;
-
-import org.apache.olingo.server.api.ODataApplicationException;
-import org.apache.olingo.server.api.uri.queryoption.expression.Alias;
-import org.apache.olingo.server.api.uri.queryoption.expression.ExpressionVisitException;
-import org.apache.olingo.server.api.uri.queryoption.expression.ExpressionVisitor;
-
-public class AliasImpl extends ExpressionImpl implements Alias {
-
- private String parameterName;
-
- @Override
- public String getParameterName() {
- return parameterName;
- }
-
- public void setParameter(final String ParameterName) {
- parameterName = ParameterName;
- }
-
- @Override
- public <T> T accept(final ExpressionVisitor<T> visitor) throws ExpressionVisitException, ODataApplicationException {
- return visitor.visitAlias(parameterName);
- }
-
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/expression/BinaryImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/expression/BinaryImpl.java
deleted file mode 100644
index a28f92c..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/expression/BinaryImpl.java
+++ /dev/null
@@ -1,70 +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.uri.queryoption.expression;
-
-import org.apache.olingo.server.api.ODataApplicationException;
-import org.apache.olingo.server.api.uri.queryoption.expression.Binary;
-import org.apache.olingo.server.api.uri.queryoption.expression.BinaryOperatorKind;
-import org.apache.olingo.server.api.uri.queryoption.expression.Expression;
-import org.apache.olingo.server.api.uri.queryoption.expression.ExpressionVisitException;
-import org.apache.olingo.server.api.uri.queryoption.expression.ExpressionVisitor;
-
-public class BinaryImpl extends ExpressionImpl implements Binary {
-
- private BinaryOperatorKind operator;
- private ExpressionImpl left;
- private ExpressionImpl right;
-
- @Override
- public BinaryOperatorKind getOperator() {
- return operator;
- }
-
- public Binary setOperator(final BinaryOperatorKind operator) {
- this.operator = operator;
- return this;
- }
-
- @Override
- public Expression getLeftOperand() {
- return left;
- }
-
- public void setLeftOperand(final ExpressionImpl operand) {
- left = operand;
- }
-
- @Override
- public Expression getRightOperand() {
- return right;
- }
-
- public void setRightOperand(final ExpressionImpl operand) {
- right = operand;
-
- }
-
- @Override
- public <T> T accept(final ExpressionVisitor<T> visitor) throws ExpressionVisitException, ODataApplicationException {
- T left = this.left.accept(visitor);
- T right = this.right.accept(visitor);
- return visitor.visitBinaryOperator(operator, left, right);
- }
-
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/expression/EnumerationImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/expression/EnumerationImpl.java
deleted file mode 100644
index 5c6250a..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/expression/EnumerationImpl.java
+++ /dev/null
@@ -1,60 +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.uri.queryoption.expression;
-
-import org.apache.olingo.commons.api.edm.EdmEnumType;
-import org.apache.olingo.server.api.ODataApplicationException;
-import org.apache.olingo.server.api.uri.queryoption.expression.Enumeration;
-import org.apache.olingo.server.api.uri.queryoption.expression.ExpressionVisitException;
-import org.apache.olingo.server.api.uri.queryoption.expression.ExpressionVisitor;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class EnumerationImpl extends ExpressionImpl implements Enumeration {
-
- private EdmEnumType type;
- private List<String> values = new ArrayList<String>();
-
- @Override
- public List<String> getValues() {
- return values;
- }
-
- public EnumerationImpl addValue(final String enumValue) {
- values.add(enumValue);
- return this;
- }
-
- @Override
- public EdmEnumType getType() {
- return type;
- }
-
- public EnumerationImpl setType(final EdmEnumType type) {
- this.type = type;
- return this;
- }
-
- @Override
- public <T> T accept(final ExpressionVisitor<T> visitor) throws ExpressionVisitException, ODataApplicationException {
- return visitor.visitEnum(type, values);
- }
-
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/expression/ExpressionImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/expression/ExpressionImpl.java
deleted file mode 100644
index f1d3e9e..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/expression/ExpressionImpl.java
+++ /dev/null
@@ -1,25 +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.uri.queryoption.expression;
-
-import org.apache.olingo.server.api.uri.queryoption.expression.Expression;
-
-public abstract class ExpressionImpl implements Expression {
-
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/expression/LambdaRefImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/expression/LambdaRefImpl.java
deleted file mode 100644
index 8198204..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/expression/LambdaRefImpl.java
+++ /dev/null
@@ -1,45 +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.uri.queryoption.expression;
-
-import org.apache.olingo.server.api.ODataApplicationException;
-import org.apache.olingo.server.api.uri.queryoption.expression.ExpressionVisitException;
-import org.apache.olingo.server.api.uri.queryoption.expression.ExpressionVisitor;
-import org.apache.olingo.server.api.uri.queryoption.expression.LambdaRef;
-
-public class LambdaRefImpl extends ExpressionImpl implements LambdaRef {
-
- private String variableText;
-
- @Override
- public String getVariableName() {
- return variableText;
- }
-
- public LambdaRefImpl setVariableText(final String text) {
- variableText = text;
- return this;
- }
-
- @Override
- public <T> T accept(final ExpressionVisitor<T> visitor) throws ExpressionVisitException, ODataApplicationException {
- return visitor.visitLambdaReference(variableText);
- }
-
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/expression/LiteralImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/expression/LiteralImpl.java
deleted file mode 100644
index d9db0d4..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/expression/LiteralImpl.java
+++ /dev/null
@@ -1,57 +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.uri.queryoption.expression;
-
-import org.apache.olingo.commons.api.edm.EdmType;
-import org.apache.olingo.server.api.ODataApplicationException;
-import org.apache.olingo.server.api.uri.queryoption.expression.ExpressionVisitException;
-import org.apache.olingo.server.api.uri.queryoption.expression.ExpressionVisitor;
-import org.apache.olingo.server.api.uri.queryoption.expression.Literal;
-
-public class LiteralImpl extends ExpressionImpl implements Literal {
-
- private String text;
- private EdmType type;
-
- @Override
- public String getText() {
- return text;
- }
-
- public LiteralImpl setText(final String text) {
- this.text = text;
- return this;
- }
-
- @Override
- public EdmType getType() {
- return type;
- }
-
- public LiteralImpl setType(final EdmType type) {
- this.type = type;
- return this;
- }
-
- @Override
- public <T> T accept(final ExpressionVisitor<T> visitor) throws ExpressionVisitException, ODataApplicationException {
- return visitor.visitLiteral(text);
- }
-
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/expression/MemberImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/expression/MemberImpl.java
deleted file mode 100644
index 8940bcf..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/expression/MemberImpl.java
+++ /dev/null
@@ -1,98 +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.uri.queryoption.expression;
-
-import org.apache.olingo.commons.api.edm.EdmType;
-import org.apache.olingo.server.api.ODataApplicationException;
-import org.apache.olingo.server.api.uri.UriInfoResource;
-import org.apache.olingo.server.api.uri.queryoption.expression.ExpressionVisitException;
-import org.apache.olingo.server.api.uri.queryoption.expression.ExpressionVisitor;
-import org.apache.olingo.server.api.uri.queryoption.expression.Member;
-import org.apache.olingo.server.core.uri.UriInfoImpl;
-import org.apache.olingo.server.core.uri.UriResourceImpl;
-import org.apache.olingo.server.core.uri.UriResourceTypedImpl;
-import org.apache.olingo.server.core.uri.UriResourceWithKeysImpl;
-
-public class MemberImpl extends ExpressionImpl implements Member {
-
- private UriInfoResource path;
- private EdmType startTypeFilter;
-
- @Override
- public UriInfoResource getResourcePath() {
- return path;
- }
-
- public Member setResourcePath(final UriInfoResource pathSegments) {
- path = pathSegments;
- return this;
- }
-
- @Override
- public <T> T accept(final ExpressionVisitor<T> visitor) throws ExpressionVisitException, ODataApplicationException {
- return visitor.visitMember(path);
- }
-
- @Override
- public EdmType getType() {
- UriInfoImpl uriInfo = (UriInfoImpl) path;
- UriResourceImpl lastResourcePart = (UriResourceImpl) uriInfo.getLastResourcePart();
-
- if (lastResourcePart instanceof UriResourceWithKeysImpl) {
- UriResourceWithKeysImpl lastKeyPred = (UriResourceWithKeysImpl) lastResourcePart;
- if (lastKeyPred.getTypeFilterOnEntry() != null) {
- return lastKeyPred.getTypeFilterOnEntry();
- } else if (lastKeyPred.getTypeFilterOnCollection() != null) {
- return lastKeyPred.getTypeFilterOnCollection();
- }
- return lastKeyPred.getType();
- } else if (lastResourcePart instanceof UriResourceTypedImpl) {
- UriResourceTypedImpl lastTyped = (UriResourceTypedImpl) lastResourcePart;
- EdmType type = lastTyped.getTypeFilter();
- if (type != null) {
- return type;
- }
- return lastTyped.getType();
- } else {
- return null;
- }
- }
-
- @Override
- public boolean isCollection() {
- UriInfoImpl uriInfo = (UriInfoImpl) path;
- UriResourceImpl lastResourcePart = (UriResourceImpl) uriInfo.getLastResourcePart();
- if (lastResourcePart instanceof UriResourceTypedImpl) {
- UriResourceTypedImpl lastTyped = (UriResourceTypedImpl) lastResourcePart;
- return lastTyped.isCollection();
- }
- return false;
- }
-
- @Override
- public EdmType getStartTypeFilter() {
- return startTypeFilter;
- }
-
- public MemberImpl setTypeFilter(final EdmType startTypeFilter) {
- this.startTypeFilter = startTypeFilter;
- return this;
- }
-
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/expression/MethodImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/expression/MethodImpl.java
deleted file mode 100644
index cd00904..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/expression/MethodImpl.java
+++ /dev/null
@@ -1,69 +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.uri.queryoption.expression;
-
-import org.apache.olingo.server.api.ODataApplicationException;
-import org.apache.olingo.server.api.uri.queryoption.expression.Expression;
-import org.apache.olingo.server.api.uri.queryoption.expression.ExpressionVisitException;
-import org.apache.olingo.server.api.uri.queryoption.expression.ExpressionVisitor;
-import org.apache.olingo.server.api.uri.queryoption.expression.Method;
-import org.apache.olingo.server.api.uri.queryoption.expression.MethodKind;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class MethodImpl extends ExpressionImpl implements Method {
-
- private MethodKind method;
- private List<ExpressionImpl> parameters = new ArrayList<ExpressionImpl>();
-
- @Override
- public MethodKind getMethod() {
- return method;
- }
-
- public MethodImpl setMethod(final MethodKind methodCalls) {
- method = methodCalls;
- return this;
- }
-
- @Override
- public List<Expression> getParameters() {
- List<Expression> list = new ArrayList<Expression>();
- for (ExpressionImpl item : parameters) {
- list.add(item);
- }
- return list;
- }
-
- public MethodImpl addParameter(final ExpressionImpl readCommonExpression) {
- parameters.add(readCommonExpression);
- return this;
- }
-
- @Override
- public <T> T accept(final ExpressionVisitor<T> visitor) throws ExpressionVisitException, ODataApplicationException {
- List<T> userParameters = new ArrayList<T>();
- for (ExpressionImpl parameter : parameters) {
- userParameters.add(parameter.accept(visitor));
- }
- return visitor.visitMethodCall(method, userParameters);
- }
-
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/expression/TypeLiteralImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/expression/TypeLiteralImpl.java
deleted file mode 100644
index f5f6f06..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/expression/TypeLiteralImpl.java
+++ /dev/null
@@ -1,46 +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.uri.queryoption.expression;
-
-import org.apache.olingo.commons.api.edm.EdmType;
-import org.apache.olingo.server.api.ODataApplicationException;
-import org.apache.olingo.server.api.uri.queryoption.expression.ExpressionVisitException;
-import org.apache.olingo.server.api.uri.queryoption.expression.ExpressionVisitor;
-import org.apache.olingo.server.api.uri.queryoption.expression.TypeLiteral;
-
-public class TypeLiteralImpl extends ExpressionImpl implements TypeLiteral {
-
- private EdmType type;
-
- @Override
- public EdmType getType() {
- return type;
- }
-
- public TypeLiteralImpl setType(final EdmType type) {
- this.type = type;
- return this;
- }
-
- @Override
- public <T> T accept(final ExpressionVisitor<T> visitor) throws ExpressionVisitException, ODataApplicationException {
- return visitor.visitTypeLiteral(type);
- }
-
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/expression/UnaryImpl.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/expression/UnaryImpl.java
deleted file mode 100644
index 796191f..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/queryoption/expression/UnaryImpl.java
+++ /dev/null
@@ -1,57 +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.uri.queryoption.expression;
-
-import org.apache.olingo.server.api.ODataApplicationException;
-import org.apache.olingo.server.api.uri.queryoption.expression.Expression;
-import org.apache.olingo.server.api.uri.queryoption.expression.ExpressionVisitException;
-import org.apache.olingo.server.api.uri.queryoption.expression.ExpressionVisitor;
-import org.apache.olingo.server.api.uri.queryoption.expression.Unary;
-import org.apache.olingo.server.api.uri.queryoption.expression.UnaryOperatorKind;
-
-public class UnaryImpl extends ExpressionImpl implements Unary {
-
- private UnaryOperatorKind operator;
- private ExpressionImpl expression;
-
- @Override
- public UnaryOperatorKind getOperator() {
- return operator;
- }
-
- public void setOperator(final UnaryOperatorKind operator) {
- this.operator = operator;
- }
-
- @Override
- public Expression getOperand() {
- return expression;
- }
-
- public void setOperand(final ExpressionImpl expression) {
- this.expression = expression;
- }
-
- @Override
- public <T> T accept(final ExpressionVisitor<T> visitor) throws ExpressionVisitException, ODataApplicationException {
- T operand = expression.accept(visitor);
- return visitor.visitUnaryOperator(operator, operand);
- }
-
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/validator/UriValidationException.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/validator/UriValidationException.java
deleted file mode 100644
index 9bba0c5..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/validator/UriValidationException.java
+++ /dev/null
@@ -1,76 +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.uri.validator;
-
-import org.apache.olingo.server.api.ODataTranslatedException;
-
-public class UriValidationException extends ODataTranslatedException {
-
- private static final long serialVersionUID = -3179078078053564742L;
-
- public static enum MessageKeys implements MessageKey {
- /** parameter: unsupported query option */
- UNSUPPORTED_QUERY_OPTION,
- /** parameter: unsupported uri kind */
- UNSUPPORTED_URI_KIND,
- /** parameter: unsupported uri resource kind */
- UNSUPPORTED_URI_RESOURCE_KIND,
- /** parameter: unsupported function return type */
- UNSUPPORTED_FUNCTION_RETURN_TYPE,
- /** parameter: unsupported action return type */
- UNSUPPORTED_ACTION_RETURN_TYPE,
- /** parameter: unsupported http method */
- UNSUPPORTED_HTTP_METHOD,
- /** parameter: system query option */
- SYSTEM_QUERY_OPTION_NOT_ALLOWED,
- /** parameters: system query option, http method */
- SYSTEM_QUERY_OPTION_NOT_ALLOWED_FOR_HTTP_METHOD,
- /** parameter: invalid key property */
- INVALID_KEY_PROPERTY,
- /** parameter: key property */
- DOUBLE_KEY_PROPERTY,
- /** parameter: untyped segment name */
- LAST_SEGMENT_NOT_TYPED,
- /** parameter: untyped segment name */
- SECOND_LAST_SEGMENT_NOT_TYPED,
- /** parameter: unallowed kind before $value */
- UNALLOWED_KIND_BEFORE_VALUE,
- /** parameter: unallowed kind before $count */
- UNALLOWED_KIND_BEFORE_COUNT;
-
- @Override
- public String getKey() {
- return name();
- }
- }
-
- public UriValidationException(String developmentMessage, MessageKey messageKey, String... parameters) {
- super(developmentMessage, messageKey, parameters);
- }
-
- public UriValidationException(String developmentMessage, Throwable cause, MessageKey messageKey,
- String... parameters) {
- super(developmentMessage, cause, messageKey, parameters);
- }
-
- @Override
- protected String getBundleName() {
- return DEFAULT_SERVER_BUNDLE_NAME;
- }
-}
diff --git a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/validator/UriValidator.java b/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/validator/UriValidator.java
deleted file mode 100644
index 5db1d11..0000000
--- a/lib/server-core/src/main/java/org/apache/olingo/server/core/uri/validator/UriValidator.java
+++ /dev/null
@@ -1,694 +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.uri.validator;
-
-import java.util.HashMap;
-import java.util.List;
-
-import org.apache.olingo.commons.api.edm.EdmAction;
-import org.apache.olingo.commons.api.edm.EdmActionImport;
-import org.apache.olingo.commons.api.edm.EdmEntityType;
-import org.apache.olingo.commons.api.edm.EdmFunction;
-import org.apache.olingo.commons.api.edm.EdmFunctionImport;
-import org.apache.olingo.commons.api.edm.EdmKeyPropertyRef;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
-import org.apache.olingo.commons.api.edm.EdmProperty;
-import org.apache.olingo.commons.api.edm.EdmReturnType;
-import org.apache.olingo.commons.api.edm.EdmSingleton;
-import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
-import org.apache.olingo.commons.api.http.HttpMethod;
-import org.apache.olingo.server.api.uri.UriInfo;
-import org.apache.olingo.server.api.uri.UriParameter;
-import org.apache.olingo.server.api.uri.UriResource;
-import org.apache.olingo.server.api.uri.UriResourceAction;
-import org.apache.olingo.server.api.uri.UriResourceEntitySet;
-import org.apache.olingo.server.api.uri.UriResourceFunction;
-import org.apache.olingo.server.api.uri.UriResourceKind;
-import org.apache.olingo.server.api.uri.UriResourceNavigation;
-import org.apache.olingo.server.api.uri.UriResourcePartTyped;
-import org.apache.olingo.server.api.uri.UriResourceProperty;
-import org.apache.olingo.server.api.uri.UriResourceSingleton;
-import org.apache.olingo.server.api.uri.queryoption.SystemQueryOption;
-import org.apache.olingo.server.api.uri.queryoption.SystemQueryOptionKind;
-
-public class UriValidator {
-
- //@formatter:off (Eclipse formatter)
- //CHECKSTYLE:OFF (Maven checkstyle)
- private boolean[][] decisionMatrix =
- {
- /* 0-FILTER 1-FORMAT 2-EXPAND 3-ID 4-COUNT 5-ORDERBY 6-SEARCH 7-SELECT 8-SKIP 9-SKIPTOKEN 10-LEVELS 11-TOP */
- /* all 0 */ { true , true , true , false, true , true , true , true , true , true , true , false },
- /* batch 1 */ { false, false, false, false, false, false, false, false, false, false, false, false },
- /* crossjoin 2 */ { true , true , true , false, true , true , true , true , true , true , true , true },
- /* entityId 3 */ { false, true , true , true , false, false, false, true , false, false, true , false },
- /* metadata 4 */ { false, true , false, false, false, false, false, false, false, false, false, false },
- /* resource 5 */ { false, true , false, false, false, false, false, false, false, false, false, false },
- /* service 6 */ { false, true , false, false, false, false, false, false, false, false, false, false },
- /* entitySet 7 */ { true , true , true , false, true , true , true , true , true , true , true , true },
- /* entitySetCount 8 */ { true, false, false, false, false, false, true, false, false, false, false, false },
- /* entity 9 */ { false, true , true , false, false, false, false, true , false, false, true , false },
- /* mediaStream 10 */ { false, true , false, false, false, false, false, false, false, false, false, false },
- /* references 11 */ { true , true , false, false, false, true , true , false, true , true , false, true },
- /* reference 12 */ { false, true , false, false, false, false, false, false, false, false, false, false },
- /* propertyComplex 13 */ { false, true , true , false, false, false, false, true , false, false, true , false },
- /* propertyComplexCollection 14 */ { true , true , true , false, true , true , false, false, true , true , true , true },
- /* propertyComplexCollectionCount 15 */ { true, false, false, false, false, false, true, false, false, false, false, false },
- /* propertyPrimitive 16 */ { false, true , false, false, false, false, false, false, false, false, false, false },
- /* propertyPrimitiveCollection 17 */ { true , true , false, false, false, true , false, false, true , true , false, true },
- /* propertyPrimitiveCollectionCount 18 */ { true, false, false, false, false, false, true, false, false, false, false, false },
- /* propertyPrimitiveValue 19 */ { false, true , false, false, false, false, false, false, false, false, false, false },
- };
-
- private boolean[][] decisionMatrixForHttpMethod =
- {
- /* 0-FILTER 1-FORMAT 2-EXPAND 3-ID 4-COUNT 5-ORDERBY 6-SEARCH 7-SELECT 8-SKIP 9-SKIPTOKEN 10-LEVELS 11-TOP */
- /* GET 0 */ { true , true , true , true, true , true , true , true , true , true , true , true },
- /* POST 0 */ { true , false , true , false, false , true , false , true , false , false , true , false },
- /* PUT 0 */ { false , false , false , false, false , false , false , false , false , false , false , false },
- /* DELETE 0 */ { false , false , false , false, false , false, false , false, false , false , false, false },
- /* PATCH 0 */ { false , false , false , false, false , false , false , false , false , false , false , false },
- };
-
- //CHECKSTYLE:ON
- //@formatter:on
-
- private enum RowIndexForUriType {
- all(0),
- batch(1),
- crossjoin(2),
- entityId(3),
- metadata(4),
- resource(5),
- service(6),
- entitySet(7),
- entitySetCount(8),
- entity(9),
- mediaStream(10),
- references(11),
- reference(12),
- propertyComplex(13),
- propertyComplexCollection(14),
- propertyComplexCollectionCount(15),
- propertyPrimitive(16),
- propertyPrimitiveCollection(17),
- propertyPrimitiveCollectionCount(18),
- propertyPrimitiveValue(19);
-
- private int idx;
-
- RowIndexForUriType(final int i) {
- idx = i;
- }
-
- public int getIndex() {
- return idx;
- }
- }
-
- private enum ColumnIndex {
- filter(0),
- format(1),
- expand(2),
- id(3),
- count(4),
- orderby(5),
- search(6),
- select(7),
- skip(8),
- skiptoken(9),
- levels(10),
- top(11);
-
- private int idx;
-
- ColumnIndex(final int i) {
- idx = i;
- }
-
- public int getIndex() {
- return idx;
- }
-
- }
-
- private enum RowIndexForHttpMethod {
- GET(0),
- POST(1),
- PUT(2),
- DELETE(3),
- PATCH(4);
-
- private int idx;
-
- RowIndexForHttpMethod(final int i) {
- idx = i;
- }
-
- public int getIndex() {
- return idx;
- }
-
- }
-
- public UriValidator() {
- super();
- }
-
- public void validate(final UriInfo uriInfo, final HttpMethod httpMethod) throws UriValidationException {
- validateForHttpMethod(uriInfo, httpMethod);
- validateQueryOptions(uriInfo);
- validateKeyPredicates(uriInfo);
- validatePropertyOperations(uriInfo, httpMethod);
- }
-
- private ColumnIndex colIndex(final SystemQueryOptionKind queryOptionKind) throws UriValidationException {
- ColumnIndex idx;
- switch (queryOptionKind) {
- case FILTER:
- idx = ColumnIndex.filter;
- break;
- case FORMAT:
- idx = ColumnIndex.format;
- break;
- case EXPAND:
- idx = ColumnIndex.expand;
- break;
- case ID:
- idx = ColumnIndex.id;
- break;
- case COUNT:
- idx = ColumnIndex.count;
- break;
- case ORDERBY:
- idx = ColumnIndex.orderby;
- break;
- case SEARCH:
- idx = ColumnIndex.search;
- break;
- case SELECT:
- idx = ColumnIndex.select;
- break;
- case SKIP:
- idx = ColumnIndex.skip;
- break;
- case SKIPTOKEN:
- idx = ColumnIndex.skiptoken;
- break;
- case LEVELS:
- idx = ColumnIndex.levels;
- break;
- case TOP:
- idx = ColumnIndex.top;
- break;
- default:
- throw new UriValidationException("Unsupported option: " + queryOptionKind.toString(),
- UriValidationException.MessageKeys.UNSUPPORTED_QUERY_OPTION, queryOptionKind.toString());
- }
-
- return idx;
- }
-
- private RowIndexForUriType rowIndexForUriType(final UriInfo uriInfo) throws UriValidationException {
- RowIndexForUriType idx;
-
- switch (uriInfo.getKind()) {
- case all:
- idx = RowIndexForUriType.all;
- break;
- case batch:
- idx = RowIndexForUriType.batch;
- break;
- case crossjoin:
- idx = RowIndexForUriType.crossjoin;
- break;
- case entityId:
- idx = RowIndexForUriType.entityId;
- break;
- case metadata:
- idx = RowIndexForUriType.metadata;
- break;
- case resource:
- idx = rowIndexForResourceKind(uriInfo);
- break;
- case service:
- idx = RowIndexForUriType.service;
- break;
- default:
- throw new UriValidationException("Unsupported uriInfo kind: " + uriInfo.getKind(),
- UriValidationException.MessageKeys.UNSUPPORTED_URI_KIND, uriInfo.getKind().toString());
- }
-
- return idx;
- }
-
- private RowIndexForUriType rowIndexForResourceKind(final UriInfo uriInfo) throws UriValidationException {
- RowIndexForUriType idx;
-
- int lastPathSegmentIndex = uriInfo.getUriResourceParts().size() - 1;
- UriResource lastPathSegment = uriInfo.getUriResourceParts().get(lastPathSegmentIndex);
-
- switch (lastPathSegment.getKind()) {
- case count:
- idx = rowIndexForCount(uriInfo);
- break;
- case action:
- idx = rowIndexForAction(lastPathSegment);
- break;
- case complexProperty:
- idx = rowIndexForComplexProperty(lastPathSegment);
- break;
- case entitySet:
- idx = rowIndexForEntitySet(lastPathSegment);
- break;
- case function:
- idx = rowIndexForFunction(lastPathSegment);
- break;
- case navigationProperty:
- idx =
- ((UriResourceNavigation) lastPathSegment).isCollection() ? RowIndexForUriType.entitySet
- : RowIndexForUriType.entity;
- break;
- case primitiveProperty:
- idx = rowIndexForPrimitiveProperty(lastPathSegment);
- break;
- case ref:
- idx = rowIndexForRef(uriInfo, lastPathSegment);
- break;
- case root:
- idx = RowIndexForUriType.service;
- break;
- case singleton:
- idx = RowIndexForUriType.entity;
- break;
- case value:
- idx = rowIndexForValue(uriInfo);
- break;
- default:
- throw new UriValidationException("Unsupported uriResource kind: " + lastPathSegment.getKind(),
- UriValidationException.MessageKeys.UNSUPPORTED_URI_RESOURCE_KIND, lastPathSegment.getKind().toString());
- }
-
- return idx;
- }
-
- private RowIndexForUriType rowIndexForValue(final UriInfo uriInfo) throws UriValidationException {
- RowIndexForUriType idx;
- int secondLastPathSegmentIndex = uriInfo.getUriResourceParts().size() - 2;
- UriResource secondLastPathSegment = uriInfo.getUriResourceParts().get(secondLastPathSegmentIndex);
-
- switch (secondLastPathSegment.getKind()) {
- case primitiveProperty:
- idx = RowIndexForUriType.propertyPrimitiveValue;
- break;
- case entitySet:
- idx = RowIndexForUriType.mediaStream;
- break;
- case function:
- UriResourceFunction uriFunction = (UriResourceFunction) secondLastPathSegment;
-
- EdmFunction function;
- EdmFunctionImport functionImport = uriFunction.getFunctionImport();
- if (functionImport != null) {
- List<EdmFunction> functions = functionImport.getUnboundFunctions();
- function = functions.get(0);
- } else {
- function = uriFunction.getFunction();
- }
-
- EdmTypeKind functionReturnTypeKind = function.getReturnType().getType().getKind();
- boolean isFunctionCollection = function.getReturnType().isCollection();
- idx = determineReturnType(functionReturnTypeKind, isFunctionCollection);
- break;
- case action:
- UriResourceAction uriAction = (UriResourceAction) secondLastPathSegment;
- EdmActionImport actionImport = uriAction.getActionImport();
-
- EdmAction action;
- if (actionImport != null) {
- action = actionImport.getUnboundAction();
- } else {
- action = uriAction.getAction();
- }
-
- EdmTypeKind actionReturnTypeKind = action.getReturnType().getType().getKind();
- boolean isActionCollection = action.getReturnType().isCollection();
- idx = determineReturnType(actionReturnTypeKind, isActionCollection);
-
- break;
- case navigationProperty:
- UriResourceNavigation uriNavigation = (UriResourceNavigation) secondLastPathSegment;
-
- if (uriNavigation.isCollection()) {
- idx = RowIndexForUriType.entitySet;
- } else {
- idx = RowIndexForUriType.entity;
- }
- break;
- case singleton:
- UriResourceSingleton uriSingleton = (UriResourceSingleton) secondLastPathSegment;
- EdmSingleton singleton = uriSingleton.getSingleton();
- EdmTypeKind singletonReturnTypeKind = singleton.getEntityType().getKind();
- idx = determineReturnType(singletonReturnTypeKind, false);
- break;
- default:
- throw new UriValidationException("Unexpected kind in path segment before $value: "
- + secondLastPathSegment.getKind(), UriValidationException.MessageKeys.UNALLOWED_KIND_BEFORE_VALUE,
- secondLastPathSegment.toString());
- }
- return idx;
- }
-
- private RowIndexForUriType determineReturnType(final EdmTypeKind functionReturnTypeKind,
- final boolean isCollection) throws UriValidationException {
- RowIndexForUriType idx;
- switch (functionReturnTypeKind) {
- case COMPLEX:
- idx = isCollection ? RowIndexForUriType.propertyComplexCollection : RowIndexForUriType.propertyComplex;
- break;
- case ENTITY:
- idx = isCollection ? RowIndexForUriType.entitySet : RowIndexForUriType.entity;
- break;
- case PRIMITIVE:
- case ENUM:
- case DEFINITION:
- idx = isCollection ? RowIndexForUriType.propertyPrimitiveCollection : RowIndexForUriType.propertyPrimitive;
- break;
- default:
- throw new UriValidationException("Unsupported function return type: " + functionReturnTypeKind,
- UriValidationException.MessageKeys.UNSUPPORTED_FUNCTION_RETURN_TYPE, functionReturnTypeKind.toString());
- }
- return idx;
- }
-
- private RowIndexForUriType rowIndexForRef(final UriInfo uriInfo, final UriResource lastPathSegment)
- throws UriValidationException {
- RowIndexForUriType idx;
- int secondLastPathSegmentIndex = uriInfo.getUriResourceParts().size() - 2;
- UriResource secondLastPathSegment = uriInfo.getUriResourceParts().get(secondLastPathSegmentIndex);
-
- if (secondLastPathSegment instanceof UriResourcePartTyped) {
- idx =
- ((UriResourcePartTyped) secondLastPathSegment).isCollection() ? RowIndexForUriType.references
- : RowIndexForUriType.reference;
- } else {
- throw new UriValidationException("secondLastPathSegment not a class of UriResourcePartTyped: "
- + lastPathSegment.getClass(), UriValidationException.MessageKeys.LAST_SEGMENT_NOT_TYPED, lastPathSegment
- .toString());
- }
-
- return idx;
- }
-
- private RowIndexForUriType rowIndexForPrimitiveProperty(final UriResource lastPathSegment)
- throws UriValidationException {
- RowIndexForUriType idx;
- if (lastPathSegment instanceof UriResourcePartTyped) {
- idx =
- ((UriResourcePartTyped) lastPathSegment).isCollection() ? RowIndexForUriType.propertyPrimitiveCollection
- : RowIndexForUriType.propertyPrimitive;
- } else {
- throw new UriValidationException("lastPathSegment not a class of UriResourcePartTyped: "
- + lastPathSegment.getClass(), UriValidationException.MessageKeys.LAST_SEGMENT_NOT_TYPED, lastPathSegment
- .toString());
- }
- return idx;
- }
-
- private RowIndexForUriType rowIndexForFunction(final UriResource lastPathSegment) throws UriValidationException {
- RowIndexForUriType idx;
- UriResourceFunction urf = (UriResourceFunction) lastPathSegment;
- EdmReturnType rt = urf.getFunction().getReturnType();
- switch (rt.getType().getKind()) {
- case ENTITY:
- if (((EdmEntityType) rt.getType()).hasStream()) {
- idx = RowIndexForUriType.mediaStream;
- } else {
- idx = rt.isCollection() ? RowIndexForUriType.entitySet : RowIndexForUriType.entity;
- }
- break;
- case PRIMITIVE:
- idx = rt.isCollection() ? RowIndexForUriType.propertyPrimitiveCollection : RowIndexForUriType.propertyPrimitive;
- break;
- case COMPLEX:
- idx = rt.isCollection() ? RowIndexForUriType.propertyComplexCollection : RowIndexForUriType.propertyComplex;
- break;
- default:
- throw new UriValidationException("Unsupported function return type: " + rt.getType().getKind(),
- UriValidationException.MessageKeys.UNSUPPORTED_FUNCTION_RETURN_TYPE,
- rt.getType().getKind().toString());
- }
-
- return idx;
- }
-
- private RowIndexForUriType rowIndexForEntitySet(final UriResource lastPathSegment) throws UriValidationException {
- RowIndexForUriType idx;
- if (lastPathSegment instanceof UriResourcePartTyped) {
- idx =
- ((UriResourcePartTyped) lastPathSegment).isCollection() ? RowIndexForUriType.entitySet
- : RowIndexForUriType.entity;
- } else {
- throw new UriValidationException("lastPathSegment not a class of UriResourcePartTyped: "
- + lastPathSegment.getClass(), UriValidationException.MessageKeys.LAST_SEGMENT_NOT_TYPED, lastPathSegment
- .toString());
- }
- return idx;
- }
-
- private RowIndexForUriType rowIndexForComplexProperty(final UriResource lastPathSegment)
- throws UriValidationException {
- RowIndexForUriType idx;
- if (lastPathSegment instanceof UriResourcePartTyped) {
- idx =
- ((UriResourcePartTyped) lastPathSegment).isCollection() ? RowIndexForUriType.propertyComplexCollection
- : RowIndexForUriType.propertyComplex;
- } else {
- throw new UriValidationException("lastPathSegment not a class of UriResourcePartTyped: "
- + lastPathSegment.getClass(), UriValidationException.MessageKeys.LAST_SEGMENT_NOT_TYPED, lastPathSegment
- .toString());
- }
- return idx;
- }
-
- private RowIndexForUriType rowIndexForAction(final UriResource lastPathSegment) throws UriValidationException {
- RowIndexForUriType idx;
- UriResourceAction ura = (UriResourceAction) lastPathSegment;
- EdmReturnType rt = ura.getAction().getReturnType();
- switch (rt.getType().getKind()) {
- case ENTITY:
- if (((EdmEntityType) rt.getType()).hasStream()) {
- idx = RowIndexForUriType.mediaStream;
- } else {
- idx = rt.isCollection() ? RowIndexForUriType.entitySet : RowIndexForUriType.entity;
- }
- break;
- case PRIMITIVE:
- idx = rt.isCollection() ? RowIndexForUriType.propertyPrimitiveCollection : RowIndexForUriType.propertyPrimitive;
- break;
- case COMPLEX:
- idx = rt.isCollection() ? RowIndexForUriType.propertyComplexCollection : RowIndexForUriType.propertyComplex;
- break;
- default:
- throw new UriValidationException("Unsupported action return type: " + rt.getType().getKind(),
- UriValidationException.MessageKeys.UNSUPPORTED_ACTION_RETURN_TYPE, rt.getType().getKind().toString());
- }
-
- return idx;
- }
-
- private RowIndexForUriType rowIndexForCount(final UriInfo uriInfo) throws UriValidationException {
-
- RowIndexForUriType idx;
- int secondLastPathSegmentIndex = uriInfo.getUriResourceParts().size() - 2;
- UriResource secondLastPathSegment = uriInfo.getUriResourceParts().get(secondLastPathSegmentIndex);
- switch (secondLastPathSegment.getKind()) {
- case entitySet:
- case navigationProperty:
- idx = RowIndexForUriType.entitySetCount;
- break;
- case complexProperty:
- idx = RowIndexForUriType.propertyComplexCollectionCount;
- break;
- case primitiveProperty:
- idx = RowIndexForUriType.propertyPrimitiveCollectionCount;
- break;
- case function:
- UriResourceFunction uriFunction = (UriResourceFunction) secondLastPathSegment;
-
- EdmFunction function;
- List<EdmFunction> functions;
- EdmFunctionImport functionImport = uriFunction.getFunctionImport();
- if (functionImport != null) {
- functions = functionImport.getUnboundFunctions();
- function = functions.get(0);
- } else {
- function = uriFunction.getFunction();
- }
-
- EdmTypeKind functionReturnTypeKind = function.getReturnType().getType().getKind();
- boolean isCollection = function.getReturnType().isCollection();
- idx = determineReturnType(functionReturnTypeKind, isCollection);
- break;
- default:
- throw new UriValidationException("Illegal path part kind before $count: " + secondLastPathSegment.getKind(),
- UriValidationException.MessageKeys.UNALLOWED_KIND_BEFORE_COUNT, secondLastPathSegment.toString());
- }
-
- return idx;
- }
-
- private void validateQueryOptions(final UriInfo uriInfo) throws UriValidationException {
- RowIndexForUriType row = rowIndexForUriType(uriInfo);
-
- for (SystemQueryOption option : uriInfo.getSystemQueryOptions()) {
- ColumnIndex col = colIndex(option.getKind());
-
- if (!decisionMatrix[row.getIndex()][col.getIndex()]) {
- throw new UriValidationException("System query option not allowed: " + option.getName(),
- UriValidationException.MessageKeys.SYSTEM_QUERY_OPTION_NOT_ALLOWED, option.getName());
- }
- }
-
- }
-
- private void validateForHttpMethod(final UriInfo uriInfo, final HttpMethod httpMethod) throws UriValidationException {
- RowIndexForHttpMethod row = rowIndexForHttpMethod(httpMethod);
-
- for (SystemQueryOption option : uriInfo.getSystemQueryOptions()) {
- ColumnIndex col = colIndex(option.getKind());
- if (!decisionMatrixForHttpMethod[row.getIndex()][col.getIndex()]) {
- throw new UriValidationException("System query option " + option.getName() + " not allowed for method "
- + httpMethod, UriValidationException.MessageKeys.SYSTEM_QUERY_OPTION_NOT_ALLOWED_FOR_HTTP_METHOD, option
- .getName(), httpMethod.toString());
- }
- }
-
- }
-
- private RowIndexForHttpMethod rowIndexForHttpMethod(final HttpMethod httpMethod) throws UriValidationException {
- RowIndexForHttpMethod idx;
-
- switch (httpMethod) {
- case GET:
- idx = RowIndexForHttpMethod.GET;
- break;
- case POST:
- idx = RowIndexForHttpMethod.POST;
- break;
- case PUT:
- idx = RowIndexForHttpMethod.PUT;
- break;
- case DELETE:
- idx = RowIndexForHttpMethod.DELETE;
- break;
- case PATCH:
- idx = RowIndexForHttpMethod.PATCH;
- break;
- default:
- throw new UriValidationException("HTTP method not supported: " + httpMethod,
- UriValidationException.MessageKeys.UNSUPPORTED_HTTP_METHOD, httpMethod.toString());
- }
-
- return idx;
- }
-
- private void validateKeyPredicates(final UriInfo uriInfo) throws UriValidationException {
- for (UriResource pathSegment : uriInfo.getUriResourceParts()) {
- if (pathSegment.getKind() == UriResourceKind.entitySet) {
- UriResourceEntitySet pathEntitySet = (UriResourceEntitySet) pathSegment;
- List<UriParameter> keyPredicates = pathEntitySet.getKeyPredicates();
-
- if (keyPredicates != null) {
-
- final List<String> keyPredicateNames = pathEntitySet.getEntityType().getKeyPredicateNames();
- HashMap<String, EdmKeyPropertyRef> edmKeys = new HashMap<String, EdmKeyPropertyRef>();
- for (EdmKeyPropertyRef key : pathEntitySet.getEntityType().getKeyPropertyRefs()) {
- edmKeys.put(key.getKeyPropertyName(), key);
- final String alias = key.getAlias();
- if (alias != null) {
- edmKeys.put(alias, key);
- }
- }
-
- for (UriParameter keyPredicate : keyPredicates) {
- final String name = keyPredicate.getName();
- final String alias = keyPredicate.getAlias();
- final String value = alias == null ?
- keyPredicate.getText() :
- uriInfo.getValueForAlias(alias);
-
- EdmKeyPropertyRef edmKey = edmKeys.get(name);
- if (edmKey == null) {
- if (keyPredicateNames.contains(name)) {
- throw new UriValidationException("Double key property: " + name,
- UriValidationException.MessageKeys.DOUBLE_KEY_PROPERTY, name);
- } else {
- throw new UriValidationException("Unknown key property: " + name,
- UriValidationException.MessageKeys.INVALID_KEY_PROPERTY, name);
- }
- }
-
- final EdmProperty property = edmKey.getProperty();
- final EdmPrimitiveType edmPrimitiveType = (EdmPrimitiveType) property.getType();
- try {
- if (!edmPrimitiveType.validate(edmPrimitiveType.fromUriLiteral(value),
- property.isNullable(), property.getMaxLength(),
- property.getPrecision(), property.getScale(), property.isUnicode())) {
- // TODO: Check exception here
- throw new UriValidationException("PrimitiveTypeException",
- UriValidationException.MessageKeys.INVALID_KEY_PROPERTY, name);
- }
- } catch (EdmPrimitiveTypeException e) {
- // TODO: Check exception here
- throw new UriValidationException("PrimitiveTypeException", e,
- UriValidationException.MessageKeys.INVALID_KEY_PROPERTY, name);
- }
-
- edmKeys.remove(name);
- edmKeys.remove(alias);
- }
- }
- }
- }
- }
-
- private void validatePropertyOperations(final UriInfo uriInfo, final HttpMethod method)
- throws UriValidationException {
- final List<UriResource> parts = uriInfo.getUriResourceParts();
- final UriResource last = parts.size() > 0 ? parts.get(parts.size() - 1) : null;
- final UriResource previous = parts.size() > 1 ? parts.get(parts.size() - 2) : null;
- if (last != null
- && (last.getKind() == UriResourceKind.primitiveProperty
- || last.getKind() == UriResourceKind.complexProperty
- || last.getKind() == UriResourceKind.value && previous.getKind() == UriResourceKind.primitiveProperty)) {
- final EdmProperty property = ((UriResourceProperty)
- (last.getKind() == UriResourceKind.value ? previous : last)).getProperty();
- if (method == HttpMethod.PATCH && property.isCollection()) {
- throw new UriValidationException("Attempt to patch collection property.",
- UriValidationException.MessageKeys.UNSUPPORTED_HTTP_METHOD, method.toString());
- }
- if (method == HttpMethod.DELETE && property.isNullable() != null && !property.isNullable()) {
- throw new UriValidationException("Attempt to delete non-nullable property.",
- UriValidationException.MessageKeys.UNSUPPORTED_HTTP_METHOD, method.toString());
- }
- }
- }
-}
diff --git a/lib/server-core/src/main/resources/server-core-exceptions-i18n.properties b/lib/server-core/src/main/resources/server-core-exceptions-i18n.properties
deleted file mode 100644
index 98259b6..0000000
--- a/lib/server-core/src/main/resources/server-core-exceptions-i18n.properties
+++ /dev/null
@@ -1,140 +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.
-#-------------------------------------------------------------------------------
-# Basic Apache Olingo exception messages
-#
-ODataHandlerException.AMBIGUOUS_XHTTP_METHOD=x-http-method header '%1$s' and x-http-method-override header '%2$s' are not the same.
-ODataHandlerException.INVALID_HTTP_METHOD=Invalid HTTP method given: '%1$s'.
-ODataHandlerException.HTTP_METHOD_NOT_ALLOWED=HTTP method '%1$s' not allowed for this resource.
-ODataHandlerException.PROCESSOR_NOT_IMPLEMENTED=No processor for interface '%1$s' registered.
-ODataHandlerException.FUNCTIONALITY_NOT_IMPLEMENTED=The requested functionality has not been implemented (yet).
-ODataHandlerException.ODATA_VERSION_NOT_SUPPORTED=OData version '%1$s' is not supported.
-ODataHandlerException.UNSUPPORTED_CONTENT_TYPE=The content type '%1$s' is not supported for this request.
-
-UriParserSyntaxException.MUST_BE_LAST_SEGMENT=The segment '%1$s' must be the last segment.
-UriParserSyntaxException.UNKNOWN_SYSTEM_QUERY_OPTION=The system query option '%1$s' is not defined.
-UriParserSyntaxException.DOUBLE_SYSTEM_QUERY_OPTION=The system query option '%1$s' can be specified only once.
-UriParserSyntaxException.WRONG_VALUE_FOR_SYSTEM_QUERY_OPTION=The system query option '%1$s' has the not-allowed value '%2$s'.
-UriParserSyntaxException.WRONG_VALUE_FOR_SYSTEM_QUERY_OPTION_FORMAT=The system query option '$format' must be either 'json', 'xml', 'atom', or a valid content type; the value '%1$s' is neither.
-UriParserSyntaxException.SYSTEM_QUERY_OPTION_LEVELS_NOT_ALLOWED_HERE=The system query option '$levels' is not allowed here.
-UriParserSyntaxException.SYNTAX=The URI is malformed.
-
-UriParserSemanticException.FUNCTION_NOT_FOUND=The function import '%1$s' has no function with parameters '%2$s'.
-UriParserSemanticException.RESOURCE_PART_ONLY_FOR_TYPED_PARTS='%1$s' is only allowed for typed parts.
-UriParserSemanticException.RESOURCE_PART_MUST_BE_PRECEDED_BY_STRUCTURAL_TYPE=The resource part '%1$s' must be preceded by a structural type.
-UriParserSemanticException.PROPERTY_AFTER_COLLECTION=The property '%1$s' must not follow a collection.
-UriParserSemanticException.PROPERTY_NOT_IN_TYPE=The type '%1$s' has no property '%2$s'.
-UriParserSemanticException.EXPRESSION_PROPERTY_NOT_IN_TYPE=The property '%2$s', used in a query expression, is not defined in type '%1$s'.
-UriParserSemanticException.UNKNOWN_PROPERTY_TYPE=The type of the property '%1$s' is unknown.
-UriParserSemanticException.INCOMPATIBLE_TYPE_FILTER=The type filter '%1$s' is incompatible.
-UriParserSemanticException.TYPE_FILTER_NOT_CHAINABLE=The type filter '%2$s' can not be chained with '%1$s'.
-UriParserSemanticException.PREVIOUS_PART_NOT_TYPED=The previous part of the type filter '%1$s' is not typed.
-UriParserSemanticException.FUNCTION_PARAMETERS_EXPECTED=Function parameters expected for type '%1$s'.
-UriParserSemanticException.UNKNOWN_PART=The part '%1$s' is not defined.
-UriParserSemanticException.ONLY_FOR_TYPED_PARTS='%1$s' is only allowed for typed parts.
-UriParserSemanticException.UNKNOWN_ENTITY_TYPE=The entity type '%1$s' is not defined.
-UriParserSemanticException.ONLY_FOR_COLLECTIONS='%1$s' is only allowed for collections.
-UriParserSemanticException.ONLY_FOR_ENTITY_TYPES='%1$s' is only allowed for entity types.
-UriParserSemanticException.ONLY_FOR_STRUCTURAL_TYPES='%1$s' is only allowed for structural types.
-UriParserSemanticException.ONLY_FOR_TYPED_PROPERTIES='%1$s' is only allowed for typed properties.
-UriParserSemanticException.INVALID_KEY_VALUE=The key value '%1$s' is invalid.
-UriParserSemanticException.PARAMETERS_LIST_ONLY_FOR_TYPED_PARTS=A list of parameters is only allowed for typed parts.
-UriParserSemanticException.WRONG_NUMBER_OF_KEY_PROPERTIES=There are %2$s key properties instead of the expected %1$s.
-UriParserSemanticException.NOT_ENOUGH_REFERENTIAL_CONSTRAINTS=There are not enough referential constraints.
-UriParserSemanticException.KEY_NOT_ALLOWED=A key is not allowed.
-UriParserSemanticException.RESOURCE_PATH_NOT_TYPED=The resource path is not typed.
-UriParserSemanticException.ONLY_SIMPLE_AND_COMPLEX_PROPERTIES_IN_SELECT=Only simple and complex properties are allowed in selection.
-UriParserSemanticException.COMPLEX_PROPERTY_OF_ENTITY_TYPE_EXPECTED=A complex property of an entity type is expected.
-UriParserSemanticException.NOT_FOR_ENTITY_TYPE=Not allowed for entity type.
-UriParserSemanticException.PREVIOUS_PART_TYPED=The previous part is typed.
-UriParserSemanticException.RESOURCE_NOT_FOUND=Cannot find EntitySet, Singleton, ActionImport or FunctionImport with name '%1$s'.
-
-UriValidationException.UNSUPPORTED_QUERY_OPTION=The query option '%1$s' is not supported.
-UriValidationException.UNSUPPORTED_URI_KIND=The URI kind '%1$s' is not supported.
-UriValidationException.UNSUPPORTED_URI_RESOURCE_KIND=The URI resource kind '%1$s' is not supported.
-UriValidationException.UNSUPPORTED_FUNCTION_RETURN_TYPE=The function return type '%1$s' is not supported.
-UriValidationException.UNSUPPORTED_ACTION_RETURN_TYPE=The action return type '%1$s' is not supported.
-UriValidationException.UNSUPPORTED_HTTP_METHOD=The HTTP method '%1$s' is not supported.
-UriValidationException.SYSTEM_QUERY_OPTION_NOT_ALLOWED=The system query option '%1$s' is not allowed.
-UriValidationException.SYSTEM_QUERY_OPTION_NOT_ALLOWED_FOR_HTTP_METHOD=The system query option '%1$s' is not allowed for HTTP method '%2$s'.
-UriValidationException.INVALID_KEY_PROPERTY=The key property '%1$s' is invalid.
-UriValidationException.DOUBLE_KEY_PROPERTY=The key property '%1$s' has been specified twice.
-UriValidationException.LAST_SEGMENT_NOT_TYPED=The last segment '%1$s' is not typed.
-UriValidationException.SECOND_LAST_SEGMENT_NOT_TYPED=The second last segment '%1$s' is not typed.
-UriValidationException.UNALLOWED_KIND_BEFORE_VALUE=The kind '%1$s' is not allowed before '$value'.
-UriValidationException.UNALLOWED_KIND_BEFORE_COUNT=The kind '%1$s' is not allowed before '$count'.
-
-ContentNegotiatorException.WRONG_CHARSET_IN_HEADER=The HTTP header '%1$s' with value '%2$s' contains an invalid character-set specification.
-ContentNegotiatorException.UNSUPPORTED_CONTENT_TYPES=The content-type range '%1$s' is not supported.
-ContentNegotiatorException.UNSUPPORTED_CONTENT_TYPE=The content type '%1$s' is not supported.
-ContentNegotiatorException.NO_CONTENT_TYPE_SUPPORTED=No content type has been specified as supported.
-ContentNegotiatorException.UNSUPPORTED_FORMAT_OPTION=The $format option '%1$s' is not supported.
-
-SerializerException.NOT_IMPLEMENTED=The requested serialization method has not been implemented yet.
-SerializerException.UNSUPPORTED_FORMAT=The format '%1$s' is not supported.
-SerializerException.JSON_METADATA=The metadata document cannot be provided in JSON format.
-SerializerException.IO_EXCEPTION=An I/O exception occurred.
-SerializerException.NULL_INPUT=The input 'null' is not allowed here.
-SerializerException.NO_CONTEXT_URL=No context URL has been provided.
-SerializerException.UNSUPPORTED_PROPERTY_TYPE=The type of the property '%1$s' is not yet supported.
-SerializerException.INCONSISTENT_PROPERTY_TYPE=An inconsistency has been detected in the type definition of property '%1$s'.
-SerializerException.MISSING_PROPERTY=The non-nullable property '%1$s' is missing.
-SerializerException.WRONG_PROPERTY_VALUE=The value '%2$s' is not valid for property '%1$s'.
-SerializerException.WRONG_PRIMITIVE_VALUE=The value '%2$s' is not valid for the primitive type '%1$s' and the given facets.
-
-DeserializerException.NOT_IMPLEMENTED=The requested deserialization method has not been implemented yet.
-DeserializerException.IO_EXCEPTION=An I/O exception occurred.
-DeserializerException.UNSUPPORTED_FORMAT=The format '%1$s' is not supported.
-DeserializerException.JSON_SYNTAX_EXCEPTION=The syntax of the JSON document is not valid.
-DeserializerException.INVALID_NULL_PROPERTY=The property '%1$s' must not be null.
-DeserializerException.UNKOWN_CONTENT='%1$s' can not be mapped as a property or an annotation.
-DeserializerException.INVALID_VALUE_FOR_PROPERTY=Invalid value for property '%1$s'.
-DeserializerException.INVALID_TYPE_FOR_PROPERTY=Invalid JSON type for property '%1$s'.
-DeserializerException.VALUE_ARRAY_NOT_PRESENT=Cannot find the value array. A collection needs at least an empty array.
-DeserializerException.VALUE_TAG_MUST_BE_AN_ARRAY=Invalid JSON type for the value tag. Must be an Array.
-DeserializerException.INVALID_ENTITY=Invalid JSON type for an entity. Must be a JSON object.
-DeserializerException.INVALID_VALUE_FOR_NAVIGATION_PROPERTY=Invalid value for navigation property '%1$s'. Must be an array for collections or for an entity either null or an object.
-DeserializerException.DUPLICATE_PROPERTY="Edm Properties must not appear twice within the same object."
-DeserializerException.DUPLICATE_JSON_PROPERTY="JSON properties must not appear twice within the same object."
-DeserializerException.UNKNOWN_PRIMITIVE_TYPE=Unknown primitive type '%1$s' for property '%2$s';
-DeserializerException.NAVIGATION_PROPERTY_NOT_FOUND=Can`t find navigation property with name: '%1$s'.
-DeserializerException.INVALID_ANNOTATION_TYPE=The annotation '%1$s' has the wrong JSON type.
-
-BatchDeserializerException.INVALID_BOUNDARY=Invalid boundary at line '%1$s'.
-BatchDeserializerException.INVALID_CHANGESET_METHOD=Invalid method: a ChangeSet cannot contain retrieve requests at line '%1$s'.
-BatchDeserializerException.INVALID_CONTENT=Retrieve requests must not contain any body content '%1$s'.
-BatchDeserializerException.INVALID_CONTENT_LENGTH=Invalid content length: content length have to be an integer and positive at line '%1$s'.
-BatchDeserializerException.INVALID_CONTENT_TRANSFER_ENCODING=The Content-Transfer-Encoding should be binary: line '%1$s'.
-BatchDeserializerException.INVALID_CONTENT_TYPE=Content-Type should be '%1$s'.
-BatchDeserializerException.INVALID_HEADER=Invalid header: '%1$s' at line '%2$s'.
-BatchDeserializerException.INVALID_HTTP_VERSION=Invalid HTTP version: The version have to be HTTP/1.1 at line '%1$s'.
-BatchDeserializerException.INVALID_METHOD=Invalid HTTP method at line '%1$s'.
-BatchDeserializerException.INVALID_QUERY_OPERATION_METHOD=Invalid method: a query operation can only contain retrieve requests at line '%1$s'.
-BatchDeserializerException.INVALID_STATUS_LINE=Invalid HTTP status line at line '%1$s'.
-BatchDeserializerException.INVALID_URI=Invalid URI at line '%1$s'.
-BatchDeserializerException.FORBIDDEN_HEADER=Forbidden header at line '%1$s'.
-BatchDeserializerException.MISSING_BLANK_LINE=Missing blank line at line '%1$s'.
-BatchDeserializerException.MISSING_BOUNDARY_DELIMITER=Missing boundary delimiter at line '%1$s'.
-BatchDeserializerException.MISSING_CLOSE_DELIMITER=Missing close delimiter at line '%1$s'.
-BatchDeserializerException.MISSING_CONTENT_ID=Missing content-id at line '%1$s'.
-BatchDeserializerException.MISSING_CONTENT_TRANSFER_ENCODING=Missing content transfer encoding at line '%1$s'.
-BatchDeserializerException.MISSING_CONTENT_TYPE=Missing content-type at line '%1$s'.
-BatchDeserializerException.MISSING_MANDATORY_HEADER=Missing mandatory header at line '%1$s'.
-BatchDeserializerException.INVALID_BASE_URI=The base URI do not match the service base URI at line '%1$s'.
-
-BatchSerializerExecption.MISSING_CONTENT_ID=Each request within a change set required exactly one content id.
\ No newline at end of file
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/ContentNegotiatorTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/ContentNegotiatorTest.java
deleted file mode 100644
index 972432d..0000000
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/ContentNegotiatorTest.java
+++ /dev/null
@@ -1,212 +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;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.fail;
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.anyListOf;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
-import org.apache.olingo.commons.api.format.ContentType;
-import org.apache.olingo.commons.api.format.ODataFormat;
-import org.apache.olingo.commons.api.http.HttpContentType;
-import org.apache.olingo.commons.api.http.HttpHeader;
-import org.apache.olingo.server.api.ODataRequest;
-import org.apache.olingo.server.api.serializer.CustomContentTypeSupport;
-import org.apache.olingo.server.api.serializer.RepresentationType;
-import org.apache.olingo.server.api.uri.queryoption.FormatOption;
-import org.junit.Test;
-
-public class ContentNegotiatorTest {
-
- static final private String ACCEPT_CASE_MIN = "application/json;odata.metadata=minimal";
- static final private String ACCEPT_CASE_MIN_UTF8 = "application/json;charset=UTF-8;odata.metadata=minimal";
- static final private String ACCEPT_CASE_FULL = "application/json;odata.metadata=full";
- static final private String ACCEPT_CASE_NONE = "application/json;odata.metadata=none";
- static final private String ACCEPT_CASE_JSONQ = "application/json;q=0.2";
- static final private String ACCEPT_CASE_XML = HttpContentType.APPLICATION_XML;
- static final private String ACCEPT_CASE_WILDCARD1 = HttpContentType.WILDCARD;
- static final private String ACCEPT_CASE_WILDCARD2 = "application/*";
-
- //@formatter:off (Eclipse formatter)
- //CHECKSTYLE:OFF (Maven checkstyle)
-
- String[][] casesServiceDocument = {
- /* expected $format accept modified content types */
- { ACCEPT_CASE_MIN, null, null, null },
- { ACCEPT_CASE_MIN, "json", null, null },
- { ACCEPT_CASE_MIN, "json", ACCEPT_CASE_JSONQ, null },
- { ACCEPT_CASE_NONE, ACCEPT_CASE_NONE, null, null },
- { "a/a", "a/a", null, "a/a" },
- { ACCEPT_CASE_MIN, null, ACCEPT_CASE_JSONQ, null },
- { ACCEPT_CASE_MIN, null, ACCEPT_CASE_WILDCARD1, null },
- { ACCEPT_CASE_MIN, null, ACCEPT_CASE_WILDCARD2, null },
- { ACCEPT_CASE_MIN, null, null, ACCEPT_CASE_MIN },
- { "a/a", "a/a", null, "a/a,b/b" },
- { "a/a;x=y", "a/a", ACCEPT_CASE_WILDCARD1, "a/a;x=y" },
- { "a/a;v=w;x=y", null, "a/a;x=y", "a/a;b=c,a/a;v=w;x=y" },
- { "a/a;v=w;x=y", "a/a;x=y", null, "a/a;b=c,a/a;v=w;x=y" },
- { ACCEPT_CASE_MIN, "json", ACCEPT_CASE_MIN, null },
- { ACCEPT_CASE_FULL, null, ACCEPT_CASE_FULL, ACCEPT_CASE_FULL },
- { ACCEPT_CASE_MIN_UTF8, null, ACCEPT_CASE_MIN_UTF8, null }
- };
-
- String[][] casesMetadata = {
- /* expected $format accept modified content types */
- { ACCEPT_CASE_XML, null, null, null },
- { ACCEPT_CASE_XML, "xml", null, null },
- { ACCEPT_CASE_XML, "xml", ACCEPT_CASE_XML, null },
- { "a/a", "a/a", null, "a/a" },
- { ACCEPT_CASE_XML, null, ACCEPT_CASE_XML, null },
- { ACCEPT_CASE_XML, null, ACCEPT_CASE_WILDCARD1, null },
- { ACCEPT_CASE_XML, null, ACCEPT_CASE_WILDCARD2, null },
- { "a/a", "a/a", null, "a/a,b/b" },
- { "a/a;x=y", "a/a", ACCEPT_CASE_WILDCARD1, "a/a;x=y" }
- };
-
- String[][] casesFail = {
- /* expected $format accept modified content types */
- { null, "xxx/yyy", null, null },
- { null, "a/a", null, "b/b" },
- { null, "a/a;x=y", null, "a/a;v=w" },
- { null, null, "a/a;x=y", "a/a;v=w" },
- { null, "atom", null, null }, // not yet supported
- { null, null, ACCEPT_CASE_FULL, null }, // not yet supported
- { null, "a/b;charset=ISO-8859-1", null, "a/b" },
- { null, null, "a/b;charset=ISO-8859-1", "a/b" },
- { null, null, null, "text/plain" }
- };
- //CHECKSTYLE:ON
- //@formatter:on
-
- @Test
- public void serviceDocumentSingleCase() throws Exception {
- testContentNegotiation(
- new String[] { ACCEPT_CASE_MIN_UTF8, null, ACCEPT_CASE_MIN_UTF8, null },
- RepresentationType.SERVICE);
- }
-
- @Test
- public void serviceDocument() throws Exception {
- for (String[] useCase : casesServiceDocument) {
- testContentNegotiation(useCase, RepresentationType.SERVICE);
- }
- }
-
- @Test
- public void metadataSingleCase() throws Exception {
- testContentNegotiation(new String[] { ACCEPT_CASE_XML, null, null, null }, RepresentationType.METADATA);
- }
-
- @Test(expected = ContentNegotiatorException.class)
- public void metadataJsonFail() throws Exception {
- testContentNegotiation(new String[] { null, "json", null, null }, RepresentationType.METADATA);
- }
-
- @Test
- public void metadata() throws Exception {
- for (String[] useCase : casesMetadata) {
- testContentNegotiation(useCase, RepresentationType.METADATA);
- }
- }
-
- @Test
- public void entityCollectionFail() throws Exception {
- for (String[] useCase : casesFail) {
- try {
- testContentNegotiation(useCase, RepresentationType.COLLECTION_ENTITY);
- fail("Exception expected for '" + useCase[1] + '|' + useCase[2] + '|' + useCase[3] + "'!");
- } catch (final ContentNegotiatorException e) {}
- }
- }
-
- @Test
- public void checkSupport() throws Exception {
- ContentNegotiator.checkSupport(ODataFormat.JSON.getContentType(ODataServiceVersion.V40), null,
- RepresentationType.ENTITY);
- ContentNegotiator.checkSupport(ContentType.TEXT_PLAIN, null, RepresentationType.VALUE);
- try {
- ContentNegotiator.checkSupport(ContentType.APPLICATION_SVG_XML, null, RepresentationType.ENTITY);
- fail("Exception expected.");
- } catch (final ContentNegotiatorException e) {
- assertEquals(ContentNegotiatorException.MessageKeys.UNSUPPORTED_CONTENT_TYPE, e.getMessageKey());
- }
-
- ContentNegotiator.checkSupport(ContentType.create("a/b"), createCustomContentTypeSupport("a/b"),
- RepresentationType.ENTITY);
- ContentNegotiator.checkSupport(ContentType.create("a/b", "c=d"), createCustomContentTypeSupport("a/b"),
- RepresentationType.ENTITY);
- try {
- ContentNegotiator.checkSupport(ContentType.create("a/b"), createCustomContentTypeSupport("a/b;c=d"),
- RepresentationType.ENTITY);
- fail("Exception expected.");
- } catch (final ContentNegotiatorException e) {
- assertEquals(ContentNegotiatorException.MessageKeys.UNSUPPORTED_CONTENT_TYPE, e.getMessageKey());
- }
- }
-
- private void testContentNegotiation(final String[] useCase, final RepresentationType representationType)
- throws ContentNegotiatorException {
-
- FormatOption formatOption = null;
- if (useCase[1] != null) {
- formatOption = mock(FormatOption.class);
- when(formatOption.getFormat()).thenReturn(useCase[1]);
- }
-
- ODataRequest request = new ODataRequest();
- if (useCase[2] != null) {
- request.addHeader(HttpHeader.ACCEPT, Arrays.asList(useCase[2]));
- }
-
- final CustomContentTypeSupport customContentTypeSupport = useCase[3] == null ? null :
- createCustomContentTypeSupport(useCase[3]);
-
- final ContentType requestedContentType = ContentNegotiator.doContentNegotiation(
- formatOption, request, customContentTypeSupport, representationType);
-
- assertNotNull(requestedContentType);
- if (useCase[0] != null) {
- assertEquals(ContentType.create(useCase[0]), requestedContentType);
- }
- }
-
- private CustomContentTypeSupport createCustomContentTypeSupport(final String contentTypeString) {
- final String[] contentTypes = contentTypeString.split(",");
-
- List<ContentType> types = new ArrayList<ContentType>();
- for (int i = 0; i < contentTypes.length; i++) {
- types.add(ContentType.create(contentTypes[i]));
- }
-
- CustomContentTypeSupport customContentTypeSupport = mock(CustomContentTypeSupport.class);
- when(customContentTypeSupport.modifySupportedContentTypes(
- anyListOf(ContentType.class), any(RepresentationType.class)))
- .thenReturn(types);
- return customContentTypeSupport;
- }
-}
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/ODataHttpHandlerImplTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/ODataHttpHandlerImplTest.java
deleted file mode 100644
index 8200c32..0000000
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/ODataHttpHandlerImplTest.java
+++ /dev/null
@@ -1,169 +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;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-import javax.servlet.http.HttpServletRequest;
-
-import org.apache.olingo.commons.api.http.HttpMethod;
-import org.apache.olingo.server.api.ODataRequest;
-import org.apache.olingo.server.api.ODataTranslatedException;
-import org.junit.Test;
-
-public class ODataHttpHandlerImplTest {
-
- @Test
- public void extractMethod() throws Exception {
- String[][] mm = {
- { "GET", null, null, "GET" },
- { "GET", "xxx", "yyy", "GET" },
- { "PUT", "xxx", "yyy", "PUT" },
- { "DELETE", "xxx", "yyy", "DELETE" },
- { "PATCH", "xxx", "yyy", "PATCH" },
-
- { "POST", null, null, "POST" },
- { "POST", null, "GET", "GET" },
- { "POST", null, "PATCH", "PATCH" },
-
- { "POST", "GET", null, "GET" },
- { "POST", "PATCH", null, "PATCH" },
-
- { "POST", "GET", "GET", "GET" },
- };
-
- for (String[] m : mm) {
-
- HttpServletRequest hr = mock(HttpServletRequest.class);
-
- when(hr.getMethod()).thenReturn(m[0]);
- when(hr.getHeader("X-HTTP-Method")).thenReturn(m[1]);
- when(hr.getHeader("X-HTTP-Method-Override")).thenReturn(m[2]);
-
- ODataRequest odr = new ODataRequest();
- ODataHttpHandlerImpl.extractMethod(odr, hr);
-
- assertEquals(HttpMethod.valueOf(m[3]), odr.getMethod());
- }
- }
-
- @Test
- public void extractMethodFail() throws Exception {
- String[][] mm = {
- { "POST", "bla", null },
- { "POST", "PUT", "PATCH" },
- { "OPTIONS", null, null },
- { "HEAD", null, null },
- };
-
- for (String[] m : mm) {
-
- HttpServletRequest hr = mock(HttpServletRequest.class);
-
- when(hr.getMethod()).thenReturn(m[0]);
- when(hr.getHeader("X-HTTP-Method")).thenReturn(m[1]);
- when(hr.getHeader("X-HTTP-Method-Override")).thenReturn(m[2]);
-
- ODataRequest odr = new ODataRequest();
- try {
- ODataHttpHandlerImpl.extractMethod(odr, hr);
- fail();
- } catch (ODataTranslatedException e) {}
- }
- }
-
- @Test
- public void extractUri() {
-
- //@formatter:off (Eclipse formatter)
- //CHECKSTYLE:OFF (Maven checkstyle)
- String [][] uris = {
- /* 0: host 1: cp 2: sp 3: sr 4: od 5: qp 6: spl */
- { "http://localhost", "", "", "", "", "", "0"},
- { "http://localhost", "", "", "", "/", "", "0"},
- { "http://localhost", "", "", "", "/od", "", "0"},
- { "http://localhost", "", "", "", "/od/", "", "0"},
-
- { "http://localhost", "/cp", "", "", "", "", "0"},
- { "http://localhost", "/cp", "", "", "/", "", "0"},
- { "http://localhost", "/cp", "", "", "/od", "", "0"},
- { "http://localhost", "", "/sp", "", "", "", "0"},
- { "http://localhost", "", "/sp", "", "/", "", "0"},
- { "http://localhost", "", "/sp", "", "/od", "", "0"},
- { "http://localhost", "", "", "/sr", "", "", "1"},
- { "http://localhost", "", "", "/sr", "/", "", "1"},
- { "http://localhost", "", "", "/sr", "/od", "", "1"},
- { "http://localhost", "", "", "/sr/sr", "", "", "2"},
- { "http://localhost", "", "", "/sr/sr", "/", "", "2"},
- { "http://localhost", "", "", "/sr/sr", "/od", "", "2"},
-
- { "http://localhost", "/cp", "/sp", "", "", "", "0"},
- { "http://localhost", "/cp", "/sp", "", "/", "", "0"},
- { "http://localhost", "/cp", "/sp", "", "/od", "", "0"},
- { "http://localhost", "/cp", "", "/sr", "/", "", "1"},
- { "http://localhost", "/cp", "", "/sr", "/od", "", "1"},
- { "http://localhost", "", "/sp", "/sr", "", "", "1"},
- { "http://localhost", "", "/sp", "/sr", "/", "", "1"},
- { "http://localhost", "", "/sp", "/sr", "/od", "", "1"},
- { "http://localhost", "/cp", "/sp", "/sr", "", "", "1"},
- { "http://localhost", "/cp", "/sp", "/sr", "/", "", "1"},
- { "http://localhost", "/cp", "/sp", "/sr", "/od", "", "1"},
-
- { "http://localhost", "", "", "", "", "qp", "0"},
- { "http://localhost", "", "", "", "/", "qp", "0"},
- { "http://localhost", "/cp", "/sp", "/sr", "/od", "qp", "1"},
-
- { "http://localhost:8080", "/c%20p", "/s%20p", "/s%20r", "/o%20d", "p+q", "1"},
- };
- //@formatter:on
- // CHECKSTYLE:on
-
- for (String[] p : uris) {
- HttpServletRequest hr = mock(HttpServletRequest.class);
-
- String requestUrl = p[0] + p[1] + p[2] + p[3] + p[4];
- String requestUri = p[1] + p[2] + p[3] + p[4];
- String queryString = p[5].isEmpty() ? null : p[5];
-
- when(hr.getRequestURL()).thenReturn(new StringBuffer(requestUrl));
- when(hr.getRequestURI()).thenReturn(requestUri);
- when(hr.getQueryString()).thenReturn(queryString);
- when(hr.getContextPath()).thenReturn(p[1]);
- when(hr.getServletPath()).thenReturn(p[2]);
-
- ODataRequest odr = new ODataRequest();
- ODataHttpHandlerImpl.extractUri(odr, hr, Integer.parseInt(p[6]));
-
- String rawBaseUri = p[0] + p[1] + p[2] + p[3];
- String rawODataPath = p[4];
- String rawQueryPath = "".equals(p[5]) ? null : p[5];
- String rawRequestUri = requestUrl + (queryString == null ? "" : "?" + queryString);
- String rawServiceResolutionUri = "".equals(p[3]) ? null : p[3];
-
- assertEquals(rawBaseUri, odr.getRawBaseUri());
- assertEquals(rawODataPath, odr.getRawODataPath());
- assertEquals(rawQueryPath, odr.getRawQueryPath());
- assertEquals(rawRequestUri, odr.getRawRequestUri());
- assertEquals(rawServiceResolutionUri, odr.getRawServiceResolutionUri());
- }
- }
-}
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/TranslatedExceptionSubclassesTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/TranslatedExceptionSubclassesTest.java
deleted file mode 100644
index 5460d9f..0000000
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/TranslatedExceptionSubclassesTest.java
+++ /dev/null
@@ -1,103 +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;
-
-import org.apache.olingo.server.api.ODataTranslatedException;
-import org.apache.olingo.server.api.serializer.SerializerException;
-import org.apache.olingo.server.core.uri.parser.UriParserSemanticException;
-import org.apache.olingo.server.core.uri.parser.UriParserSyntaxException;
-import org.apache.olingo.server.core.uri.validator.UriValidationException;
-import org.junit.Assert;
-import org.junit.Test;
-
-import java.io.IOException;
-import java.lang.reflect.Constructor;
-import java.util.Formatter;
-import java.util.Locale;
-import java.util.Properties;
-import java.util.UUID;
-
-/**
- * Generic test for all exceptions which inherit from ODataTranslatedException
- * if their MessageKeys are available in the resource bundle and the parameters are replaced.
- */
-public class TranslatedExceptionSubclassesTest {
-
- private final Properties properties;
-
- public TranslatedExceptionSubclassesTest() throws IOException {
- properties = new Properties();
- properties.load(Thread.currentThread().getContextClassLoader()
- .getResourceAsStream("server-core-exceptions-i18n.properties"));
- Locale.setDefault(Locale.ENGLISH);
- }
-
- @Test
- public void messageKeysValid() throws Exception {
- testException(ODataHandlerException.class, ODataHandlerException.MessageKeys.values());
- testException(UriParserSemanticException.class, UriParserSemanticException.MessageKeys.values());
- testException(UriParserSyntaxException.class, UriParserSyntaxException.MessageKeys.values());
- testException(ContentNegotiatorException.class, ContentNegotiatorException.MessageKeys.values());
- testException(SerializerException.class, SerializerException.MessageKeys.values());
- testException(UriValidationException.class, UriValidationException.MessageKeys.values());
- testException(UriParserSyntaxException.class, UriParserSyntaxException.MessageKeys.values());
- }
-
- private void testException(final Class<? extends ODataTranslatedException> clazz,
- final ODataTranslatedException.MessageKey[] messageKeys) throws Exception {
-
- for (ODataTranslatedException.MessageKey messageKey : messageKeys) {
- String propKey = clazz.getSimpleName() + "." + messageKey.toString();
- String value = properties.getProperty(propKey);
- Assert.assertNotNull("No value found for message key '" + propKey + "'", value);
- //
- int paraCount = countParameters(value);
- Constructor<? extends ODataTranslatedException> ctor =
- clazz.getConstructor(String.class, ODataTranslatedException.MessageKey.class, String[].class);
- String[] paras = new String[paraCount];
- for (int i = 0; i < paras.length; i++) {
- paras[i] = "470" + i;
- }
- String developerMessage = UUID.randomUUID().toString();
- ODataTranslatedException e = ctor.newInstance(developerMessage, messageKey, paras);
- try {
- throw e;
- } catch (ODataTranslatedException translatedException) {
- Formatter formatter = new Formatter();
- String formattedValue = formatter.format(value, (Object[]) paras).toString();
- formatter.close();
- Assert.assertEquals(formattedValue, translatedException.getTranslatedMessage(null).getMessage());
- Assert.assertEquals(formattedValue, translatedException.getLocalizedMessage());
- Assert.assertEquals(developerMessage, translatedException.getMessage());
- }
- }
- }
-
-
- private int countParameters(String value) {
- char[] chars = value.toCharArray();
- int count = 0;
- for (char aChar : chars) {
- if(aChar == '%') {
- count++;
- }
- }
- return count;
- }
-}
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/batchhandler/MockedBatchHandlerTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/batchhandler/MockedBatchHandlerTest.java
deleted file mode 100644
index 86c336e..0000000
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/batchhandler/MockedBatchHandlerTest.java
+++ /dev/null
@@ -1,670 +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.batchhandler;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-import java.io.ByteArrayInputStream;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
-
-import org.apache.olingo.commons.api.http.HttpContentType;
-import org.apache.olingo.commons.api.http.HttpHeader;
-import org.apache.olingo.commons.api.http.HttpMethod;
-import org.apache.olingo.commons.api.http.HttpStatusCode;
-import org.apache.olingo.server.api.OData;
-import org.apache.olingo.server.api.ODataRequest;
-import org.apache.olingo.server.api.ODataResponse;
-import org.apache.olingo.server.api.ServiceMetadata;
-import org.apache.olingo.server.api.batch.BatchFacade;
-import org.apache.olingo.server.api.batch.exception.BatchDeserializerException;
-import org.apache.olingo.server.api.batch.exception.BatchSerializerException;
-import org.apache.olingo.server.api.deserializer.batch.BatchOptions;
-import org.apache.olingo.server.api.deserializer.batch.BatchRequestPart;
-import org.apache.olingo.server.api.deserializer.batch.ODataResponsePart;
-import org.apache.olingo.server.api.processor.BatchProcessor;
-import org.apache.olingo.server.core.ODataHandler;
-import org.apache.olingo.server.core.deserializer.batch.BatchParserCommon;
-import org.apache.olingo.server.core.deserializer.batch.BufferedReaderIncludingLineEndings;
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.invocation.InvocationOnMock;
-import org.mockito.stubbing.Answer;
-
-public class MockedBatchHandlerTest {
-
- private static final String BATCH_CONTENT_TYPE = "multipart/mixed;boundary=batch_12345";
- private static final String BATCH_ODATA_PATH = "/$batch";
- private static final String BATCH_REQUEST_URI = "http://localhost:8080/odata/$batch";
- private static final String BASE_URI = "http://localhost:8080/odata";
- private static final String CRLF = "\r\n";
- private ODataHandler oDataHandler;
- private BatchHandler batchHandler;
- private int entityCounter = 1;
-
- @Before
- public void setup() {
- final BatchProcessor batchProcessor = new BatchTestProcessorImpl();
- batchProcessor.init(OData.newInstance(), null);
-
- entityCounter = 1;
- oDataHandler = mock(ODataHandler.class);
- batchHandler = new BatchHandler(oDataHandler, batchProcessor);
- }
-
- @Test
- public void test() throws Exception {
- final String content = "--batch_12345" + CRLF
- + "Content-Type: multipart/mixed; boundary=changeset_12345" + CRLF
- + CRLF
- + "--changeset_12345" + CRLF
- + "Content-Type: application/http" + CRLF
- + "Content-Transfer-Encoding: binary" + CRLF
- + "Content-Id: 3" + CRLF
- + CRLF
- + "PUT ESAllPrim(1) HTTP/1.1" + CRLF
- + "Content-Type: application/json;odata=verbose" + CRLF
- + CRLF
- + CRLF
- + "--changeset_12345" + CRLF
- + "Content-Type: application/http" + CRLF
- + "Content-Transfer-Encoding: binary" + CRLF
- + "Content-Id: 4" + CRLF
- + CRLF
- + "PUT $3/PropertyInt32 HTTP/1.1" + CRLF
- + "Content-Type: application/json;odata=verbose" + CRLF
- + CRLF
- + CRLF
- + "--changeset_12345" + CRLF
- + "Content-Type: application/http" + CRLF
- + "Content-Transfer-Encoding: binary" + CRLF
- + "Content-Id: 1" + CRLF
- + CRLF
- + "POST ESAllPrim HTTP/1.1" + CRLF
- + "Content-Type: application/json;odata=verbose" + CRLF
- + CRLF
- + CRLF
- + "--changeset_12345" + CRLF
- + "Content-Type: application/http" + CRLF
- + "Content-Transfer-Encoding: binary" + CRLF
- + "Content-Id: 5" + CRLF
- + CRLF
- + "POST http://localhost:8080/odata/$1/NavPropertyETTwoPrimMany HTTP/1.1" + CRLF
- + "Content-Type: application/json;odata=verbose" + CRLF
- + CRLF
- + CRLF
- + "--changeset_12345" + CRLF
- + "Content-Type: application/http" + CRLF
- + "Content-Transfer-Encoding: binary" + CRLF
- + "Content-Id: 2" + CRLF
- + CRLF
- + "POST $1/NavPropertyETTwoPrimMany HTTP/1.1" + CRLF
- + "Content-Type: application/json;odata=verbose" + CRLF
- + CRLF
- + CRLF
- + "--changeset_12345" + CRLF
- + "Content-Type: application/http" + CRLF
- + "Content-Transfer-Encoding: binary" + CRLF
- + "Content-Id: 6" + CRLF
- + CRLF
- + "PUT ESAllPrim(1) HTTP/1.1" + CRLF
- + "Content-Type: application/json;odata=verbose" + CRLF
- + CRLF
- + CRLF
- + "--changeset_12345--" + CRLF
- + CRLF
- + "--batch_12345--";
- final Map<String, List<String>> header = getMimeHeader();
- final ODataResponse response = new ODataResponse();
- final ODataRequest request = buildODataRequest(content, header);
-
- batchHandler.process(request, response, true);
-
- BufferedReaderIncludingLineEndings reader =
- new BufferedReaderIncludingLineEndings(new InputStreamReader(response.getContent()));
-
- final List<String> responseContent = reader.toList();
- reader.close();
-
- int line = 0;
- assertEquals(62, responseContent.size());
-
- // Check change set
- assertTrue(responseContent.get(line++).contains("--batch_"));
- assertTrue(responseContent.get(line++).contains("Content-Type: multipart/mixed; boundary=changeset_"));
-
- for (int i = 0; i < 6; i++) {
- String contentId = checkChangeSetPartHeader(responseContent, line);
- line += 6;
-
- if ("1".equals(contentId)) {
- assertEquals("HTTP/1.1 201 Created" + CRLF, responseContent.get(line++));
- assertEquals("Location: " + BASE_URI + "/ESAllPrim(1)" + CRLF, responseContent.get(line++));
- assertEquals("Content-Length: 0" + CRLF, responseContent.get(line++));
- } else if ("2".equals(contentId)) {
- assertEquals("HTTP/1.1 201 Created" + CRLF, responseContent.get(line++));
- assertEquals("Location: " + BASE_URI + "/ESTwoPrim(3)" + CRLF, responseContent.get(line++));
- assertEquals("Content-Length: 0" + CRLF, responseContent.get(line++));
- } else if ("3".equals(contentId)) {
- assertEquals("HTTP/1.1 200 OK" + CRLF, responseContent.get(line++));
- assertEquals("Content-Length: 0" + CRLF, responseContent.get(line++));
- } else if ("4".equals(contentId)) {
- assertEquals("HTTP/1.1 200 OK" + CRLF, responseContent.get(line++));
- assertEquals("Content-Length: 0" + CRLF, responseContent.get(line++));
- } else if ("5".equals(contentId)) {
- assertEquals("HTTP/1.1 201 Created" + CRLF, responseContent.get(line++));
- assertEquals("Location: " + BASE_URI + "/ESTwoPrim(2)" + CRLF, responseContent.get(line++));
- assertEquals("Content-Length: 0" + CRLF, responseContent.get(line++));
- } else if ("6".equals(contentId)) {
- assertEquals("HTTP/1.1 200 OK" + CRLF, responseContent.get(line++));
- assertEquals("Content-Length: 0" + CRLF, responseContent.get(line++));
- } else {
- fail();
- }
- assertEquals(CRLF, responseContent.get(line++));
- }
-
- // Close body part (change set)
- assertEquals(CRLF, responseContent.get(line++));
- assertTrue(responseContent.get(line++).contains("--changeset_"));
-
- // Close batch
- assertTrue(responseContent.get(line++).contains("--batch_"));
- assertEquals(62, line);
- }
-
- @Test
- public void testGetRequest() throws Exception {
- final String content = ""
- + "--batch_12345" + CRLF
- + "Content-Type: application/http" + CRLF
- + "Content-Transfer-Encoding: binary" + CRLF
- + CRLF
- + "GET ESAllPrim(0) HTTP/1.1" + CRLF
- + CRLF
- + CRLF
- + "--batch_12345--";
-
- final Map<String, List<String>> header = getMimeHeader();
- final ODataResponse response = new ODataResponse();
- final ODataRequest request = buildODataRequest(content, header);
-
- batchHandler.process(request, response, true);
-
- BufferedReaderIncludingLineEndings reader =
- new BufferedReaderIncludingLineEndings(new InputStreamReader(response.getContent()));
-
- final List<String> responseContent = reader.toList();
- int line = 0;
-
- assertEquals(9, responseContent.size());
- assertTrue(responseContent.get(line++).contains("--batch_"));
- assertEquals("Content-Type: application/http" + CRLF, responseContent.get(line++));
- assertEquals("Content-Transfer-Encoding: binary" + CRLF, responseContent.get(line++));
- assertEquals(CRLF, responseContent.get(line++));
- assertEquals("HTTP/1.1 200 OK" + CRLF, responseContent.get(line++));
- assertEquals("Content-Length: 0" + CRLF, responseContent.get(line++));
- assertEquals(CRLF, responseContent.get(line++));
- assertEquals(CRLF, responseContent.get(line++));
- assertTrue(responseContent.get(line++).contains("--batch_"));
-
- assertEquals(9, line);
-
- reader.close();
- }
-
- @Test
- public void testMultipleChangeSets() throws Exception {
- final String content = ""
- + "--batch_12345" + CRLF
- + "Content-Type: multipart/mixed; boundary=changeset_12345" + CRLF
- + CRLF
- + "--changeset_12345" + CRLF
- + "Content-Type: application/http" + CRLF
- + "Content-Transfer-Encoding: binary" + CRLF
- + "Content-Id: 1" + CRLF
- + CRLF
- + "PUT ESAllPrim(1) HTTP/1.1" + CRLF
- + "Content-Type: application/json;odata=verbose" + CRLF
- + CRLF
- + CRLF
- + "--changeset_12345" + CRLF
- + "Content-Type: application/http" + CRLF
- + "Content-Transfer-Encoding: binary" + CRLF
- + "Content-Id: 2" + CRLF
- + CRLF
- + "POST $1/NavPropertyETTwoPrimMany HTTP/1.1" + CRLF
- + "Content-Type: application/json;odata=verbose" + CRLF
- + CRLF
- + CRLF
- + "--changeset_12345--" + CRLF
-
- + "--batch_12345" + CRLF
- + "Content-Type: multipart/mixed; boundary=changeset_54321" + CRLF
- + CRLF
- + "--changeset_54321" + CRLF
- + "Content-Type: application/http" + CRLF
- + "Content-Transfer-Encoding: binary" + CRLF
- + "Content-Id: 1" + CRLF
- + CRLF
- + "PUT http://localhost:8080/odata/ESAllPrim(2) HTTP/1.1" + CRLF
- + "Content-Type: application/json;odata=verbose" + CRLF
- + CRLF
- + CRLF
- + "--changeset_54321" + CRLF
- + "Content-Type: application/http" + CRLF
- + "Content-Transfer-Encoding: binary" + CRLF
- + "Content-Id: 2" + CRLF
- + CRLF
- + "POST $1/NavPropertyETTwoPrimMany HTTP/1.1" + CRLF
- + "Content-Type: application/json;odata=verbose" + CRLF
- + CRLF
- + CRLF
- + "--changeset_54321--" + CRLF
-
- + CRLF
- + "--batch_12345--";
- final Map<String, List<String>> header = getMimeHeader();
- final ODataResponse response = new ODataResponse();
- final ODataRequest request = buildODataRequest(content, header);
-
- batchHandler.process(request, response, true);
-
- BufferedReaderIncludingLineEndings reader =
- new BufferedReaderIncludingLineEndings(new InputStreamReader(response.getContent()));
-
- final List<String> responseContent = reader.toList();
- reader.close();
-
- int line = 0;
- assertEquals(47, responseContent.size());
-
- // Check first change set
- assertTrue(responseContent.get(line++).contains("--batch_"));
- assertTrue(responseContent.get(line++).contains("Content-Type: multipart/mixed; boundary=changeset_"));
-
- for (int i = 0; i < 2; i++) {
- String contentId = checkChangeSetPartHeader(responseContent, line);
- line += 6;
-
- if ("1".equals(contentId)) {
- assertEquals("HTTP/1.1 200 OK" + CRLF, responseContent.get(line++));
- assertEquals("Content-Length: 0" + CRLF, responseContent.get(line++));
- } else if ("2".equals(contentId)) {
- assertEquals("HTTP/1.1 201 Created" + CRLF, responseContent.get(line++));
- assertEquals("Location: " + BASE_URI + "/ESTwoPrim(1)" + CRLF, responseContent.get(line++));
- assertEquals("Content-Length: 0" + CRLF, responseContent.get(line++));
- } else {
- fail();
- }
-
- assertEquals(CRLF, responseContent.get(line++));
- }
- // Close body part (1st change set)
- assertEquals(CRLF, responseContent.get(line++));
- assertTrue(responseContent.get(line++).contains("--changeset_"));
-
- // Check second change set
- assertTrue(responseContent.get(line++).contains("--batch_"));
- assertTrue(responseContent.get(line++).contains("Content-Type: multipart/mixed; boundary=changeset_"));
-
- for (int i = 0; i < 2; i++) {
- String contentId = checkChangeSetPartHeader(responseContent, line);
- line += 6;
-
- if ("1".equals(contentId)) {
- assertEquals("HTTP/1.1 200 OK" + CRLF, responseContent.get(line++));
- assertEquals("Content-Length: 0" + CRLF, responseContent.get(line++));
- } else if ("2".equals(contentId)) {
- assertEquals("HTTP/1.1 201 Created" + CRLF, responseContent.get(line++));
- assertEquals("Location: " + BASE_URI + "/ESTwoPrim(2)" + CRLF, responseContent.get(line++));
- assertEquals("Content-Length: 0" + CRLF, responseContent.get(line++));
- } else {
- fail();
- }
-
- assertEquals(CRLF, responseContent.get(line++));
- }
- // Close body part (2nd change set)
- assertEquals(CRLF, responseContent.get(line++));
- assertTrue(responseContent.get(line++).contains("--changeset_"));
-
- // Close batch
- assertTrue(responseContent.get(line++).contains("--batch_"));
-
- assertEquals(47, line);
- }
-
- @Test
- public void testMineBodyPartTransitiv() throws Exception {
- final String content = ""
- + "--batch_12345" + CRLF
- + "Content-Type: multipart/mixed; boundary=changeset_12345" + CRLF
- + CRLF
- + "--changeset_12345" + CRLF
- + "Content-Type: application/http" + CRLF
- + "Content-Transfer-Encoding: binary" + CRLF
- + "Content-Id: 1" + CRLF
- + CRLF
- + "PUT ESAllPrim(1) HTTP/1.1" + CRLF
- + "Content-Type: application/json;odata=verbose" + CRLF
- + CRLF
- + CRLF
- + "--changeset_12345" + CRLF
- + "Content-Type: application/http" + CRLF
- + "Content-Transfer-Encoding: binary" + CRLF
- + "Content-Id: 2" + CRLF
- + CRLF
- + "POST $1/NavPropertyETTwoPrimMany HTTP/1.1" + CRLF
- + "Content-Type: application/json;odata=verbose" + CRLF
- + CRLF
- + CRLF
- + "--changeset_12345" + CRLF
- + "Content-Type: application/http" + CRLF
- + "Content-Transfer-Encoding: binary" + CRLF
- + "Content-Id: 3" + CRLF
- + CRLF
- + "POST $2/NavPropertyETAllPrimMany HTTP/1.1" + CRLF
- + "Content-Type: application/json;odata=verbose" + CRLF
- + CRLF
- + CRLF
- + "--changeset_12345" + CRLF
- + "Content-Type: application/http" + CRLF
- + "Content-Transfer-Encoding: binary" + CRLF
- + "Content-Id: 4" + CRLF
- + CRLF
- + "POST $3/NavPropertyETTwoPrimOne HTTP/1.1" + CRLF
- + "Content-Type: application/json;odata=verbose" + CRLF
- + CRLF
- + CRLF
- + "--changeset_12345--" + CRLF
-
- + CRLF
- + "--batch_12345--";
-
- final Map<String, List<String>> header = getMimeHeader();
- final ODataResponse response = new ODataResponse();
- final ODataRequest request = buildODataRequest(content, header);
-
- batchHandler.process(request, response, true);
-
- BufferedReaderIncludingLineEndings reader =
- new BufferedReaderIncludingLineEndings(new InputStreamReader(response.getContent()));
-
- final List<String> responseContent = reader.toList();
- reader.close();
-
- int line = 0;
- assertEquals(44, responseContent.size());
-
- // Check change set
- assertTrue(responseContent.get(line++).contains("--batch_"));
- assertTrue(responseContent.get(line++).contains("Content-Type: multipart/mixed; boundary=changeset_"));
-
- for (int i = 0; i < 4; i++) {
- String contentId = checkChangeSetPartHeader(responseContent, line);
- line += 6;
-
- if ("1".equals(contentId)) {
- assertEquals("HTTP/1.1 200 OK" + CRLF, responseContent.get(line++));
- assertEquals("Content-Length: 0" + CRLF, responseContent.get(line++));
- } else if ("2".equals(contentId)) {
- assertEquals("HTTP/1.1 201 Created" + CRLF, responseContent.get(line++));
- assertEquals("Location: " + BASE_URI + "/ESTwoPrim(1)" + CRLF, responseContent.get(line++));
- assertEquals("Content-Length: 0" + CRLF, responseContent.get(line++));
- } else if ("3".equals(contentId)) {
- assertEquals("HTTP/1.1 201 Created" + CRLF, responseContent.get(line++));
- assertEquals("Location: " + BASE_URI + "/ESAllPrim(2)" + CRLF, responseContent.get(line++));
- assertEquals("Content-Length: 0" + CRLF, responseContent.get(line++));
- } else if ("4".equals(contentId)) {
- assertEquals("HTTP/1.1 201 Created" + CRLF, responseContent.get(line++));
- assertEquals("Location: " + BASE_URI + "/ESTwoPrim(3)" + CRLF, responseContent.get(line++));
- assertEquals("Content-Length: 0" + CRLF, responseContent.get(line++));
- } else {
- fail();
- }
-
- assertEquals(CRLF, responseContent.get(line++));
- }
-
- // Close body part (change set)
- assertEquals(CRLF, responseContent.get(line++));
- assertTrue(responseContent.get(line++).contains("--changeset_"));
-
- // Close batch
- assertTrue(responseContent.get(line++).contains("--batch_"));
- assertEquals(44, line);
- }
-
- @Test(expected = BatchDeserializerException.class)
- public void testInvalidMethod() throws Exception {
- final String content = ""
- + "--batch_12345" + CRLF
- + "Content-Type: multipart/mixed; boundary=changeset_12345" + CRLF
- + CRLF
- + "--changeset_12345" + CRLF
- + "Content-Type: application/http" + CRLF
- + "Content-Transfer-Encoding: binary" + CRLF
- + "Content-Id: 1" + CRLF
- + CRLF
- + "PUT ESAllPrim(1) HTTP/1.1" + CRLF
- + "Content-Type: application/json;odata=verbose" + CRLF
- + CRLF
- + CRLF
- + "--changeset_12345--" + CRLF
- + CRLF
- + "--batch_12345--";
-
- final Map<String, List<String>> header = getMimeHeader();
- final ODataResponse response = new ODataResponse();
- final ODataRequest request = buildODataRequest(content, header);
- request.setMethod(HttpMethod.GET);
-
- batchHandler.process(request, response, true);
- }
-
- @Test(expected = BatchDeserializerException.class)
- public void testInvalidContentType() throws Exception {
- final String content = ""
- + "--batch_12345" + CRLF
- + "Content-Type: multipart/mixed; boundary=changeset_12345" + CRLF
- + CRLF
- + "--changeset_12345" + CRLF
- + "Content-Type: application/http" + CRLF
- + "Content-Transfer-Encoding: binary" + CRLF
- + "Content-Id: 1" + CRLF
- + CRLF
- + "PUT ESAllPrim(1) HTTP/1.1" + CRLF
- + "Content-Type: application/json;odata=verbose" + CRLF
- + CRLF
- + CRLF
- + "--changeset_12345--" + CRLF
- + CRLF
- + "--batch_12345--";
-
- final Map<String, List<String>> header = new HashMap<String, List<String>>();
- header.put(HttpHeader.CONTENT_TYPE, Arrays.asList(new String[] { "application/http" }));
- final ODataResponse response = new ODataResponse();
- final ODataRequest request = buildODataRequest(content, header);
-
- batchHandler.process(request, response, true);
- }
-
- /*
- * Helper methods
- */
- private String checkChangeSetPartHeader(final List<String> response, int line) {
- assertEquals(CRLF, response.get(line++));
- assertTrue(response.get(line++).contains("--changeset_"));
- assertEquals("Content-Type: application/http" + CRLF, response.get(line++));
- assertEquals("Content-Transfer-Encoding: binary" + CRLF, response.get(line++));
-
- assertTrue(response.get(line).contains("Content-Id:"));
- String contentId = response.get(line).split(":")[1].trim();
- line++;
-
- assertEquals(CRLF, response.get(line++));
-
- return contentId;
- }
-
- private Map<String, List<String>> getMimeHeader() {
- final Map<String, List<String>> header = new HashMap<String, List<String>>();
- header.put(HttpHeader.CONTENT_TYPE, Arrays.asList(new String[] { BATCH_CONTENT_TYPE }));
-
- return header;
- }
-
- private ODataRequest buildODataRequest(final String content, final Map<String, List<String>> header)
- throws Exception {
- final ODataRequest request = new ODataRequest();
-
- for (final String key : header.keySet()) {
- request.addHeader(key, header.get(key));
- }
-
- request.setMethod(HttpMethod.POST);
- request.setRawBaseUri(BASE_URI);
- request.setRawODataPath(BATCH_ODATA_PATH);
- request.setRawQueryPath("");
- request.setRawRequestUri(BATCH_REQUEST_URI);
- request.setRawServiceResolutionUri("");
-
- request.setBody(new ByteArrayInputStream(content.getBytes("UTF-8")));
-
- return request;
- }
-
- /**
- * Batch processor
- */
- private class BatchTestProcessorImpl implements BatchProcessor {
-
- private OData odata;
-
- @Override
- public void init(OData odata, ServiceMetadata serviceMetadata) {
- this.odata = odata;
- }
-
- @Override
- public ODataResponsePart processChangeSet(BatchFacade fascade, List<ODataRequest> requests) {
- List<ODataResponse> responses = new ArrayList<ODataResponse>();
-
- for (ODataRequest request : requests) {
- try {
- responses.add(fascade.handleODataRequest(request));
- } catch (Exception e) {
- fail();
- }
- }
-
- return new ODataResponsePart(responses, true);
- }
-
- @Override
- public void processBatch(BatchFacade fascade, ODataRequest request, ODataResponse response)
- throws BatchDeserializerException, BatchSerializerException {
- final String boundary = getBoundary(request.getHeader(HttpHeader.CONTENT_TYPE));
- final BatchOptions options = BatchOptions.with().isStrict(true).rawBaseUri(BASE_URI).build();
- final List<BatchRequestPart> parts =
- odata.createFixedFormatDeserializer().parseBatchRequest(request.getBody(), boundary, options);
- final List<ODataResponsePart> responseParts = new ArrayList<ODataResponsePart>();
-
- for (BatchRequestPart part : parts) {
- for (final ODataRequest oDataRequest : part.getRequests()) {
- // Mock the processor for a given requests
- when(oDataHandler.process(oDataRequest)).then(new Answer<ODataResponse>() {
- @Override
- public ODataResponse answer(InvocationOnMock invocation) throws Throwable {
- Object[] arguments = invocation.getArguments();
-
- return buildResponse((ODataRequest) arguments[0]);
- }
- });
- }
-
- responseParts.add(fascade.handleBatchRequest(part));
- }
-
- final String responeBoundary = "batch_" + UUID.randomUUID().toString();
- final InputStream responseStream =
- odata.createFixedFormatSerializer().batchResponse(responseParts, responeBoundary);
-
- response.setStatusCode(HttpStatusCode.ACCEPTED.getStatusCode());
- response.setHeader(HttpHeader.CONTENT_TYPE, HttpContentType.MULTIPART_MIXED + ";boundary=" + responeBoundary);
- response.setContent(responseStream);
- }
-
- private String getBoundary(String contentType) throws BatchDeserializerException {
- return BatchParserCommon.getBoundary(contentType, 0);
- }
- }
-
- private ODataResponse buildResponse(ODataRequest request) {
- final ODataResponse oDataResponse = new ODataResponse();
-
- if (request.getMethod() == HttpMethod.POST) {
- oDataResponse.setStatusCode(HttpStatusCode.CREATED.getStatusCode());
- oDataResponse.setHeader(HttpHeader.LOCATION, createResourceUri(request));
- } else {
- oDataResponse.setStatusCode(HttpStatusCode.OK.getStatusCode());
- }
-
- final String contentId = request.getHeader(BatchParserCommon.HTTP_CONTENT_ID);
- if (contentId != null) {
- oDataResponse.setHeader(BatchParserCommon.HTTP_CONTENT_ID, contentId);
- }
-
- return oDataResponse;
- }
-
- private String createResourceUri(final ODataRequest request) {
- final String parts[] = request.getRawODataPath().split("/");
- String oDataPath = "";
-
- if (parts.length == 2) {
- // Entity Collection
- oDataPath = parts[1];
- } else {
- // Navigation property
-
- final String navProperty = parts[parts.length - 1];
- if (navProperty.equals("NavPropertyETTwoPrimMany")) {
- oDataPath = "ESTwoPrim";
- } else if (navProperty.equals("NavPropertyETAllPrimMany")) {
- oDataPath = "ESAllPrim";
- } else if (navProperty.equals("NavPropertyETTwoPrimOne")) {
- oDataPath = "ESTwoPrim";
- }
- }
-
- return BASE_URI + "/" + oDataPath + "(" + entityCounter++ + ")";
- }
-}
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/deserializer/FixedFormatDeserializerTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/deserializer/FixedFormatDeserializerTest.java
deleted file mode 100644
index 27f6a5d..0000000
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/deserializer/FixedFormatDeserializerTest.java
+++ /dev/null
@@ -1,53 +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.deserializer;
-
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
-
-import org.apache.commons.io.IOUtils;
-import org.apache.olingo.server.api.OData;
-import org.apache.olingo.server.api.deserializer.FixedFormatDeserializer;
-import org.apache.olingo.server.api.serializer.SerializerException;
-import org.junit.Test;
-
-public class FixedFormatDeserializerTest {
-
- private final FixedFormatDeserializer deserializer;
-
- public FixedFormatDeserializerTest() throws SerializerException {
- deserializer = OData.newInstance().createFixedFormatDeserializer();
- }
-
- @Test
- public void binary() throws Exception {
- assertArrayEquals(new byte [] { 0x41, 0x42, 0x43 },
- deserializer.binary(IOUtils.toInputStream("ABC")));
- }
-
- @Test
- public void binaryLong() throws Exception {
- assertEquals(4 * 3 * 26,
- deserializer.binary(IOUtils.toInputStream(
- "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ"
- + "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ"
- + "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ"
- + "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ")).length);
- }
-}
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/deserializer/batch/BatchParserCommonTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/deserializer/batch/BatchParserCommonTest.java
deleted file mode 100644
index 294283f..0000000
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/deserializer/batch/BatchParserCommonTest.java
+++ /dev/null
@@ -1,229 +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.deserializer.batch;
-
-import static org.junit.Assert.*;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.olingo.commons.api.http.HttpHeader;
-import org.apache.olingo.server.core.deserializer.batch.BatchParserCommon;
-import org.apache.olingo.server.core.deserializer.batch.Header;
-import org.apache.olingo.server.core.deserializer.batch.Line;
-import org.junit.Test;
-
-public class BatchParserCommonTest {
-
- private static final String CRLF = "\r\n";
-
- @Test
- public void testMultipleHeader() throws Exception {
- String[] messageRaw = new String[] {
- "Content-Id: 1" + CRLF,
- "Content-Id: 2" + CRLF,
- "content-type: Application/http" + CRLF,
- "content-transfer-encoding: Binary" + CRLF
- };
- List<Line> message = toLineList(messageRaw);
-
- final Header header = BatchParserCommon.consumeHeaders(message);
- assertNotNull(header);
-
- final List<String> contentIdHeaders = header.getHeaders(BatchParserCommon.HTTP_CONTENT_ID);
- assertNotNull(contentIdHeaders);
- assertEquals(2, contentIdHeaders.size());
- assertEquals("1", contentIdHeaders.get(0));
- assertEquals("2", contentIdHeaders.get(1));
- }
-
- @Test
- public void testMultipleHeaderSameValue() throws Exception {
- String[] messageRaw = new String[] {
- "Content-Id: 1" + CRLF,
- "Content-Id: 1" + CRLF,
- "content-type: Application/http" + CRLF,
- "content-transfer-encoding: Binary" + CRLF
- };
- List<Line> message = toLineList(messageRaw);
-
- final Header header = BatchParserCommon.consumeHeaders(message);
- assertNotNull(header);
-
- final List<String> contentIdHeaders = header.getHeaders(BatchParserCommon.HTTP_CONTENT_ID);
- assertNotNull(contentIdHeaders);
- assertEquals(1, contentIdHeaders.size());
- assertEquals("1", contentIdHeaders.get(0));
- }
-
- @Test
- public void testHeaderSperatedByComma() throws Exception {
- String[] messageRaw = new String[] {
- "Content-Id: 1" + CRLF,
- "Upgrade: HTTP/2.0, SHTTP/1.3, IRC/6.9, RTA/x11" + CRLF,
- "content-type: Application/http" + CRLF,
- "content-transfer-encoding: Binary" + CRLF
- };
- List<Line> message = toLineList(messageRaw);
-
- final Header header = BatchParserCommon.consumeHeaders(message);
- assertNotNull(header);
-
- final List<String> upgradeHeader = header.getHeaders("upgrade");
- assertNotNull(upgradeHeader);
- assertEquals(4, upgradeHeader.size());
- assertEquals("HTTP/2.0", upgradeHeader.get(0));
- assertEquals("SHTTP/1.3", upgradeHeader.get(1));
- assertEquals("IRC/6.9", upgradeHeader.get(2));
- assertEquals("RTA/x11", upgradeHeader.get(3));
- }
-
- @Test
- public void testMultipleAcceptHeader() throws Exception {
- String[] messageRaw = new String[] {
- "Accept: application/atomsvc+xml;q=0.8, application/json;odata=verbose;q=0.5, */*;q=0.1" + CRLF,
- "Accept: text/plain;q=0.3" + CRLF,
- "Accept-Language:en-US,en;q=0.7,en-UK;q=0.9" + CRLF,
- "content-type: Application/http" + CRLF,
- "content-transfer-encoding: Binary" + CRLF
- };
- List<Line> message = toLineList(messageRaw);
-
- final Header header = BatchParserCommon.consumeHeaders(message);
- assertNotNull(header);
-
- final List<String> acceptHeader = header.getHeaders(HttpHeader.ACCEPT);
- assertNotNull(acceptHeader);
- assertEquals(4, acceptHeader.size());
- }
-
- @Test
- public void testMultipleAcceptHeaderSameValue() throws Exception {
- String[] messageRaw = new String[] {
- "Accept: application/atomsvc+xml;q=0.8, application/json;odata=verbose;q=0.5, */*;q=0.1" + CRLF,
- "Accept: application/atomsvc+xml;q=0.8" + CRLF,
- "Accept-Language:en-US,en;q=0.7,en-UK;q=0.9" + CRLF,
- "content-type: Application/http" + CRLF,
- "content-transfer-encoding: Binary" + CRLF
- };
- List<Line> message = toLineList(messageRaw);
-
- final Header header = BatchParserCommon.consumeHeaders(message);
- assertNotNull(header);
-
- final List<String> acceptHeader = header.getHeaders(HttpHeader.ACCEPT);
- assertNotNull(acceptHeader);
- assertEquals(3, acceptHeader.size());
- }
-
- @Test
- public void testMultipleAccepLanguagetHeader() throws Exception {
- String[] messageRaw = new String[] {
- "Accept-Language:en-US,en;q=0.7,en-UK;q=0.9" + CRLF,
- "Accept-Language: de-DE;q=0.3" + CRLF,
- "content-type: Application/http" + CRLF,
- "content-transfer-encoding: Binary" + CRLF
- };
- List<Line> message = toLineList(messageRaw);
-
- final Header header = BatchParserCommon.consumeHeaders(message);
- assertNotNull(header);
-
- final List<String> acceptLanguageHeader = header.getHeaders(HttpHeader.ACCEPT_LANGUAGE);
- assertNotNull(acceptLanguageHeader);
- assertEquals(4, acceptLanguageHeader.size());
- }
-
- @Test
- public void testMultipleAccepLanguagetHeaderSameValue() throws Exception {
- String[] messageRaw = new String[] {
- "Accept-Language:en-US,en;q=0.7,en-UK;q=0.9" + CRLF,
- "Accept-Language:en-US,en;q=0.7" + CRLF,
- "content-type: Application/http" + CRLF,
- "content-transfer-encoding: Binary" + CRLF
- };
- List<Line> message = toLineList(messageRaw);
-
- final Header header = BatchParserCommon.consumeHeaders(message);
- assertNotNull(header);
-
- final List<String> acceptLanguageHeader = header.getHeaders(HttpHeader.ACCEPT_LANGUAGE);
- assertNotNull(acceptLanguageHeader);
- assertEquals(3, acceptLanguageHeader.size());
- }
-
- @Test
- public void testRemoveEndingCRLF() {
- String line = "Test\r\n";
- assertEquals("Test", BatchParserCommon.removeEndingCRLF(new Line(line,1)).toString());
- }
-
- @Test
- public void testRemoveLastEndingCRLF() {
- String line = "Test\r\n\r\n";
- assertEquals("Test\r\n", BatchParserCommon.removeEndingCRLF(new Line(line,1)).toString());
- }
-
- @Test
- public void testRemoveEndingCRLFWithWS() {
- String line = "Test\r\n ";
- assertEquals("Test", BatchParserCommon.removeEndingCRLF(new Line(line,1)).toString());
- }
-
- @Test
- public void testRemoveEndingCRLFNothingToRemove() {
- String line = "Hallo\r\nBla";
- assertEquals("Hallo\r\nBla", BatchParserCommon.removeEndingCRLF(new Line(line,1)).toString());
- }
-
- @Test
- public void testRemoveEndingCRLFAll() {
- String line = "\r\n";
- assertEquals("", BatchParserCommon.removeEndingCRLF(new Line(line,1)).toString());
- }
-
- @Test
- public void testRemoveEndingCRLFSpace() {
- String line = "\r\n ";
- assertEquals("", BatchParserCommon.removeEndingCRLF(new Line(line,1)).toString());
- }
-
- @Test
- public void testRemoveLastEndingCRLFWithWS() {
- String line = "Test \r\n";
- assertEquals("Test ", BatchParserCommon.removeEndingCRLF(new Line(line,1)).toString());
- }
-
- @Test
- public void testRemoveLastEndingCRLFWithWSLong() {
- String line = "Test \r\nTest2 \r\n";
- assertEquals("Test \r\nTest2 ", BatchParserCommon.removeEndingCRLF(new Line(line,1)).toString());
- }
-
- private List<Line> toLineList(String[] messageRaw) {
- final List<Line> lineList = new ArrayList<Line>();
- int counter = 1;
-
- for(final String currentLine : messageRaw) {
- lineList.add(new Line(currentLine, counter++));
- }
-
- return lineList;
- }
-}
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/deserializer/batch/BatchRequestParserTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/deserializer/batch/BatchRequestParserTest.java
deleted file mode 100644
index 6282742..0000000
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/deserializer/batch/BatchRequestParserTest.java
+++ /dev/null
@@ -1,1291 +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.deserializer.batch;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.List;
-
-import org.apache.commons.io.IOUtils;
-import org.apache.olingo.commons.api.http.HttpHeader;
-import org.apache.olingo.commons.api.http.HttpMethod;
-import org.apache.olingo.server.api.ODataRequest;
-import org.apache.olingo.server.api.batch.exception.BatchDeserializerException;
-import org.apache.olingo.server.api.batch.exception.BatchDeserializerException.MessageKeys;
-import org.apache.olingo.server.api.deserializer.batch.BatchOptions;
-import org.apache.olingo.server.api.deserializer.batch.BatchRequestPart;
-import org.apache.olingo.server.core.deserializer.batch.BatchParser;
-import org.apache.olingo.server.core.deserializer.batch.BatchParserCommon;
-import org.junit.Test;
-
-public class BatchRequestParserTest {
-
- private static final String SERVICE_ROOT = "http://localhost/odata";
- private static final String CRLF = "\r\n";
- private static final String BOUNDARY = "batch_8194-cf13-1f56";
- private static final String MIME_HEADERS = "Content-Type: application/http" + CRLF
- + "Content-Transfer-Encoding: binary" + CRLF;
- private static final String GET_REQUEST = ""
- + MIME_HEADERS
- + CRLF
- + "GET Employees('1')/EmployeeName HTTP/1.1" + CRLF
- + CRLF
- + CRLF;
-
- @Test
- public void test() throws Exception {
- final InputStream in = readFile("/batchWithPost.batch");
- final List<BatchRequestPart> batchRequestParts = parse(in);
-
- assertNotNull(batchRequestParts);
- assertFalse(batchRequestParts.isEmpty());
-
- for (BatchRequestPart object : batchRequestParts) {
- if (!object.isChangeSet()) {
- assertEquals(1, object.getRequests().size());
- ODataRequest retrieveRequest = object.getRequests().get(0);
- assertEquals(HttpMethod.GET, retrieveRequest.getMethod());
-
- if (retrieveRequest.getHeaders(HttpHeader.ACCEPT_LANGUAGE) != null) {
- assertEquals(3, retrieveRequest.getHeaders(HttpHeader.ACCEPT_LANGUAGE).size());
- }
-
- assertEquals(SERVICE_ROOT, retrieveRequest.getRawBaseUri());
- assertEquals("/Employees('2')/EmployeeName", retrieveRequest.getRawODataPath());
- assertEquals("http://localhost/odata/Employees('2')/EmployeeName?$format=json", retrieveRequest
- .getRawRequestUri());
- assertEquals("$format=json", retrieveRequest.getRawQueryPath());
- } else {
- List<ODataRequest> requests = object.getRequests();
- for (ODataRequest request : requests) {
-
- assertEquals(HttpMethod.PUT, request.getMethod());
- assertEquals("100000", request.getHeader(HttpHeader.CONTENT_LENGTH));
- assertEquals("application/json;odata=verbose", request.getHeader(HttpHeader.CONTENT_TYPE));
-
- List<String> acceptHeader = request.getHeaders(HttpHeader.ACCEPT);
- assertEquals(3, request.getHeaders(HttpHeader.ACCEPT).size());
- assertEquals("application/atomsvc+xml;q=0.8", acceptHeader.get(0));
- assertEquals("*/*;q=0.1", acceptHeader.get(2));
-
- assertEquals("http://localhost/odata/Employees('2')/EmployeeName", request.getRawRequestUri());
- assertEquals("http://localhost/odata", request.getRawBaseUri());
- assertEquals("/Employees('2')/EmployeeName", request.getRawODataPath());
- assertEquals("", request.getRawQueryPath()); // No query parameter
- }
- }
- }
- }
-
- @Test
- public void testImageInContent() throws Exception {
- final InputStream contentInputStream = readFile("/batchWithContent.batch");
- final String content = IOUtils.toString(contentInputStream);
- final String batch = ""
- + "--batch_8194-cf13-1f56" + CRLF
- + MIME_HEADERS
- + CRLF
- + "GET Employees?$filter=Age%20gt%2040 HTTP/1.1" + CRLF
- + "Accept: application/atomsvc+xml;q=0.8, application/json;odata=verbose;q=0.5, */*;q=0.1" + CRLF
- + "MaxDataServiceVersion: 2.0" + CRLF
- + CRLF
- + CRLF
- + "--batch_8194-cf13-1f56" + CRLF
- + "Content-Type: multipart/mixed; boundary=changeset_f980-1cb6-94dd" + CRLF
- + CRLF
- + "--changeset_f980-1cb6-94dd" + CRLF
- + "content-type: Application/http" + CRLF
- + "content-transfer-encoding: Binary" + CRLF
- + "Content-ID: 1" + CRLF
- + CRLF
- + "POST Employees HTTP/1.1" + CRLF
- + "Content-length: 100000" + CRLF
- + "Content-type: application/octet-stream" + CRLF
- + CRLF
- + content
- + CRLF
- + "--changeset_f980-1cb6-94dd--" + CRLF
- + "--batch_8194-cf13-1f56--";
- final List<BatchRequestPart> BatchRequestParts = parse(batch);
-
- for (BatchRequestPart part : BatchRequestParts) {
- if (!part.isChangeSet()) {
- assertEquals(1, part.getRequests().size());
- final ODataRequest retrieveRequest = part.getRequests().get(0);
-
- assertEquals(HttpMethod.GET, retrieveRequest.getMethod());
- assertEquals("http://localhost/odata/Employees?$filter=Age%20gt%2040", retrieveRequest.getRawRequestUri());
- assertEquals("http://localhost/odata", retrieveRequest.getRawBaseUri());
- assertEquals("/Employees", retrieveRequest.getRawODataPath());
- assertEquals("$filter=Age%20gt%2040", retrieveRequest.getRawQueryPath());
- } else {
- final List<ODataRequest> requests = part.getRequests();
- for (ODataRequest request : requests) {
- assertEquals(HttpMethod.POST, request.getMethod());
- assertEquals("100000", request.getHeader(HttpHeader.CONTENT_LENGTH));
- assertEquals("1", request.getHeader(BatchParserCommon.HTTP_CONTENT_ID));
- assertEquals("application/octet-stream", request.getHeader(HttpHeader.CONTENT_TYPE));
-
- final InputStream body = request.getBody();
- assertEquals(content, IOUtils.toString(body));
- }
- }
- }
- }
-
- @Test
- public void testPostWithoutBody() throws Exception {
- final String batch = CRLF
- + "--batch_8194-cf13-1f56" + CRLF
- + "Content-Type: multipart/mixed; boundary=changeset_f980-1cb6-94dd" + CRLF
- + CRLF
- + "--changeset_f980-1cb6-94dd" + CRLF
- + MIME_HEADERS
- + "Content-ID: changeRequest1" + CRLF
- + CRLF
- + "POST Employees('2') HTTP/1.1" + CRLF
- + "Content-Length: 100" + CRLF
- + "Content-Type: application/octet-stream" + CRLF
- + CRLF
- + CRLF
- + "--changeset_f980-1cb6-94dd--" + CRLF
- + CRLF
- + "--batch_8194-cf13-1f56--";
- final List<BatchRequestPart> batchRequestParts = parse(batch);
-
- for (BatchRequestPart object : batchRequestParts) {
- if (object.isChangeSet()) {
- final List<ODataRequest> requests = object.getRequests();
-
- for (ODataRequest request : requests) {
- assertEquals(HttpMethod.POST, request.getMethod());
- assertEquals("100", request.getHeader(HttpHeader.CONTENT_LENGTH));
- assertEquals("application/octet-stream", request.getHeader(HttpHeader.CONTENT_TYPE));
- assertNotNull(request.getBody());
- }
- }
- }
- }
-
- @Test
- public void testAbsoluteUri() throws Exception {
- final String batch = ""
- + "--batch_8194-cf13-1f56" + CRLF
- + MIME_HEADERS
- + CRLF
- + "GET http://localhost/odata/Employees('1')/EmployeeName?$top=1 HTTP/1.1" + CRLF
- + CRLF
- + CRLF
- + "--batch_8194-cf13-1f56--";
-
- final List<BatchRequestPart> batchRequestParts = parse(batch);
-
- assertEquals(1, batchRequestParts.size());
- final BatchRequestPart part = batchRequestParts.get(0);
-
- assertEquals(1, part.getRequests().size());
- final ODataRequest request = part.getRequests().get(0);
-
- assertEquals("/Employees('1')/EmployeeName", request.getRawODataPath());
- assertEquals("$top=1", request.getRawQueryPath());
- assertEquals("http://localhost/odata/Employees('1')/EmployeeName?$top=1", request.getRawRequestUri());
- assertEquals("http://localhost/odata", request.getRawBaseUri());
- }
-
- @Test
- public void testBoundaryParameterWithQuotas() throws Exception {
- final String contentType = "multipart/mixed; boundary=\"batch_1.2+34:2j)0?\"";
- final String boundary = BatchParserCommon.getBoundary(contentType, 0);
- final String batch = ""
- + "--batch_1.2+34:2j)0?" + CRLF
- + GET_REQUEST
- + "--batch_1.2+34:2j)0?--";
- final BatchParser parser = new BatchParser();
- final BatchOptions batchOptions = BatchOptions.with().isStrict(true).rawBaseUri(SERVICE_ROOT).build();
- final List<BatchRequestPart> batchRequestParts =
- parser.parseBatchRequest(IOUtils.toInputStream(batch), boundary, batchOptions);
-
- assertNotNull(batchRequestParts);
- assertFalse(batchRequestParts.isEmpty());
- }
-
- @Test
- public void testBatchWithInvalidContentType() throws Exception {
- final String invalidContentType = "multipart;boundary=batch_1740-bb84-2f7f";
-
- try {
- BatchParserCommon.getBoundary(invalidContentType, 0);
- fail();
- } catch (BatchDeserializerException e) {
- assertMessageKey(e, BatchDeserializerException.MessageKeys.INVALID_CONTENT_TYPE);
- }
- }
-
- @Test
- public void testContentTypeCharset() throws Exception {
- final String contentType = "multipart/mixed; charset=UTF-8;boundary=batch_14d1-b293-b99a";
- final String boundary = BatchParserCommon.getBoundary(contentType, 0);
-
- assertEquals("batch_14d1-b293-b99a", boundary);
- }
-
- @Test
- public void testBatchWithoutBoundaryParameter() throws Exception {
- final String invalidContentType = "multipart/mixed";
-
- try {
- BatchParserCommon.getBoundary(invalidContentType, 0);
- fail();
- } catch (BatchDeserializerException e) {
- assertMessageKey(e, BatchDeserializerException.MessageKeys.INVALID_CONTENT_TYPE);
- }
- }
-
- @Test
- public void testBoundaryParameterWithoutQuota() throws Exception {
- final String invalidContentType = "multipart/mixed;boundary=batch_1740-bb:84-2f7f";
-
- try {
- BatchParserCommon.getBoundary(invalidContentType, 0);
- fail();
- } catch (BatchDeserializerException e) {
- assertMessageKey(e, BatchDeserializerException.MessageKeys.INVALID_BOUNDARY);
- }
- }
-
- @Test
- public void testWrongBoundaryString() throws Exception {
- final String batch = ""
- + "--batch_8194-cf13-1f5" + CRLF
- + GET_REQUEST
- + "--batch_8194-cf13-1f56--";
-
- final List<BatchRequestPart> parts = parse(batch);
- assertEquals(0, parts.size());
- }
-
- @Test
- public void testMissingHttpVersion() throws Exception {
- final String batch = ""
- + "--batch_8194-cf13-1f56" + CRLF
- + "Content-Type: application/http" + CRLF
- + "Content-Transfer-Encoding:binary" + CRLF
- + CRLF
- + "GET Employees?$format=json" + CRLF
- + "Host: localhost:8080" + CRLF
- + CRLF
- + CRLF
- + "--batch_8194-cf13-1f56--";
-
- parseInvalidBatchBody(batch, BatchDeserializerException.MessageKeys.INVALID_STATUS_LINE);
- }
-
- @Test
- public void testMissingHttpVersion2() throws Exception {
- final String batch = ""
- + "--batch_8194-cf13-1f56" + CRLF
- + "Content-Type: application/http" + CRLF
- + "Content-Transfer-Encoding:binary" + CRLF
- + CRLF
- + "GET Employees?$format=json " + CRLF
- + "Host: localhost:8080" + CRLF
- + CRLF
- + CRLF
- + "--batch_8194-cf13-1f56--";
-
- parseInvalidBatchBody(batch, BatchDeserializerException.MessageKeys.INVALID_HTTP_VERSION);
- }
-
- @Test
- public void testMissingHttpVersion3() throws Exception {
- final String batch = ""
- + "--batch_8194-cf13-1f56" + CRLF
- + "Content-Type: application/http" + CRLF
- + "Content-Transfer-Encoding:binary" + CRLF
- + CRLF
- + "GET Employees?$format=json SMTP:3.1" + CRLF
- + "Host: localhost:8080" + CRLF
- + CRLF
- + CRLF
- + "--batch_8194-cf13-1f56--";
-
- parseInvalidBatchBody(batch, BatchDeserializerException.MessageKeys.INVALID_HTTP_VERSION);
- }
-
- @Test
- public void testBoundaryWithoutHyphen() throws Exception {
- final String batch = ""
- + "--batch_8194-cf13-1f56" + CRLF
- + GET_REQUEST
- + "batch_8194-cf13-1f56" + CRLF
- + GET_REQUEST
- + "--batch_8194-cf13-1f56--";
-
- parseInvalidBatchBody(batch, BatchDeserializerException.MessageKeys.INVALID_CONTENT);
- }
-
- @Test
- public void testNoBoundaryString() throws Exception {
- final String batch = ""
- + "--batch_8194-cf13-1f56" + CRLF
- + GET_REQUEST
- // + no boundary string
- + GET_REQUEST
- + "--batch_8194-cf13-1f56--";
-
- parseInvalidBatchBody(batch, BatchDeserializerException.MessageKeys.INVALID_CONTENT);
- }
-
- @Test
- public void testBatchBoundaryEqualsChangeSetBoundary() throws Exception {
- final String batch = ""
- + "--batch_8194-cf13-1f56" + CRLF
- + "Content-Type: multipart/mixed;boundary=batch_8194-cf13-1f56" + CRLF
- + CRLF
- + "--batch_8194-cf13-1f56" + CRLF
- + MIME_HEADERS
- + CRLF
- + "PUT Employees('2')/EmployeeName HTTP/1.1" + CRLF
- + "Accept: application/atomsvc+xml;q=0.8, application/json;odata=verbose;q=0.5, */*;q=0.1" + CRLF
- + "Content-Type: application/json;odata=verbose" + CRLF
- + "MaxDataServiceVersion: 2.0" + CRLF
- + CRLF
- + "{\"EmployeeName\":\"Frederic Fall MODIFIED\"}" + CRLF
- + CRLF
- + "--batch_8194-cf13-1f56--"
- + CRLF
- + "--batch_8194-cf13-1f56--";
-
- parseInvalidBatchBody(batch, BatchDeserializerException.MessageKeys.MISSING_BLANK_LINE);
- }
-
- @Test
- public void testNoContentType() throws Exception {
- final String batch = ""
- + "--batch_8194-cf13-1f56" + CRLF
- + "Content-Transfer-Encoding: binary" + CRLF
- + CRLF
- + "GET Employees('1')/EmployeeName HTTP/1.1" + CRLF
- + CRLF
- + "--batch_8194-cf13-1f56--";
-
- parseInvalidBatchBody(batch, BatchDeserializerException.MessageKeys.MISSING_CONTENT_TYPE);
- }
-
- @Test
- public void testMimeHeaderContentType() throws Exception {
- final String batch = "--batch_8194-cf13-1f56" + CRLF
- + "Content-Type: text/plain" + CRLF
- + "Content-Transfer-Encoding: binary" + CRLF
- + CRLF
- + "GET Employees('1')/EmployeeName HTTP/1.1" + CRLF
- + CRLF
- + CRLF
- + "--batch_8194-cf13-1f56--";
-
- parseInvalidBatchBody(batch, BatchDeserializerException.MessageKeys.INVALID_CONTENT_TYPE);
- }
-
- @Test
- public void testMimeHeaderEncoding() throws Exception {
- String batch = ""
- + "--batch_8194-cf13-1f56" + CRLF
- + "Content-Type: application/http" + CRLF
- + "Content-Transfer-Encoding: 8bit" + CRLF
- + CRLF
- + "GET Employees('1')/EmployeeName HTTP/1.1" + CRLF
- + CRLF
- + CRLF
- + "--batch_8194-cf13-1f56--";
-
- parseInvalidBatchBody(batch, BatchDeserializerException.MessageKeys.INVALID_CONTENT_TRANSFER_ENCODING);
- }
-
- @Test
- public void testGetRequestMissingCRLF() throws Exception {
- final String batch = ""
- + "--batch_8194-cf13-1f56" + CRLF
- + MIME_HEADERS
- + "Content-ID: 1" + CRLF
- + CRLF
- + "GET Employees('1')/EmployeeName HTTP/1.1" + CRLF
- // + CRLF // Belongs to the GET request
- + CRLF // Belongs to the
- + "--batch_8194-cf13-1f56--";
-
- parseInvalidBatchBody(batch, BatchDeserializerException.MessageKeys.MISSING_BLANK_LINE);
- }
-
- @Test
- public void testInvalidMethodForBatch() throws Exception {
- final String batch = "--batch_8194-cf13-1f56" + CRLF
- + MIME_HEADERS
- + CRLF
- + "POST Employees('1')/EmployeeName HTTP/1.1" + CRLF
- + CRLF
- + CRLF
- + "--batch_8194-cf13-1f56--";
-
- parseInvalidBatchBody(batch, BatchDeserializerException.MessageKeys.INVALID_QUERY_OPERATION_METHOD);
- }
-
- @Test
- public void testNoBoundaryFound() throws Exception {
- final String batch = "batch_8194-cf13-1f56" + CRLF
- + MIME_HEADERS
- + CRLF
- + "POST Employees('1')/EmployeeName HTTP/1.1" + CRLF
- + CRLF;
-
- parseInvalidBatchBody(batch, BatchDeserializerException.MessageKeys.MISSING_CLOSE_DELIMITER);
- }
-
- @Test
- public void testEmptyRequest() throws Exception {
- final String batch = ""
- + "--batch_8194-cf13-1f56--";
-
- final List<BatchRequestPart> parts = parse(batch);
- assertEquals(0, parts.size());
- }
-
- @Test
- public void testBadRequest() throws Exception {
- final String batch = "This is a bad request. There is no syntax and also no semantic";
-
- parseInvalidBatchBody(batch, BatchDeserializerException.MessageKeys.MISSING_CLOSE_DELIMITER);
- }
-
- @Test
- public void testNoMethod() throws Exception {
- final String batch = "--batch_8194-cf13-1f56" + CRLF
- + MIME_HEADERS
- + CRLF
- + /* GET */"Employees('1')/EmployeeName HTTP/1.1" + CRLF
- + CRLF
- + CRLF
- + "--batch_8194-cf13-1f56--";
-
- parseInvalidBatchBody(batch, BatchDeserializerException.MessageKeys.INVALID_STATUS_LINE);
- }
-
- @Test
- public void testInvalidMethodForChangeset() throws Exception {
- final String batch = ""
- + "--batch_8194-cf13-1f56" + CRLF
- + "Content-Type: multipart/mixed; boundary=changeset_f980-1cb6-94dd" + CRLF
- + CRLF
- + "--changeset_f980-1cb6-94dd" + CRLF
- + MIME_HEADERS
- + "Content-Id: 1" + CRLF
- + CRLF
- + "GET Employees('2')/EmployeeName HTTP/1.1" + CRLF
- + "Content-Type: application/json;odata=verbose" + CRLF
- + "MaxDataServiceVersion: 2.0" + CRLF
- + CRLF
- + CRLF
- + "--changeset_f980-1cb6-94dd--"
- + CRLF
- + "--batch_8194-cf13-1f56--";
-
- parseInvalidBatchBody(batch, BatchDeserializerException.MessageKeys.INVALID_CHANGESET_METHOD);
- }
-
- @Test
- public void testInvalidChangeSetBoundary() throws Exception {
- final String batch = "--batch_8194-cf13-1f56" + CRLF
- + "Content-Type: multipart/mixed;boundary=changeset_f980-1cb6-94dd" + CRLF
- + CRLF
- + "--changeset_f980-1cb6-94d"/* +"d" */+ CRLF
- + MIME_HEADERS
- + CRLF
- + "POST Employees('2') HTTP/1.1" + CRLF
- + "Content-Type: application/json;odata=verbose" + CRLF
- + "MaxDataServiceVersion: 2.0" + CRLF
- + CRLF
- + "--changeset_f980-1cb6-94dd--" + CRLF
- + CRLF
- + "--batch_8194-cf13-1f56--";
-
- final List<BatchRequestPart> parts = parse(batch);
- assertEquals(1, parts.size());
-
- final BatchRequestPart part = parts.get(0);
- assertTrue(part.isChangeSet());
- assertEquals(0, part.getRequests().size());
- }
-
- @Test
- public void testNestedChangeset() throws Exception {
- final String batch = ""
- + "--batch_8194-cf13-1f56" + CRLF
- + "Content-Type: multipart/mixed;boundary=changeset_f980-1cb6-94dd" + CRLF
- + CRLF
- + "--changeset_f980-1cb6-94dd" + CRLF
- + "Content-Transfer-Encoding: binary" + CRLF
- + "Content-Type: multipart/mixed;boundary=changeset_f980-1cb6-94dd2" + CRLF
- + CRLF
- + "--changeset_f980-1cb6-94dd2" + CRLF
- + MIME_HEADERS
- + "Content-Id: 1" + CRLF
- + CRLF
- + "POST Employees('2') HTTP/1.1" + CRLF
- + "Content-Type: application/json;odata=verbose" + CRLF + "MaxDataServiceVersion: 2.0" + CRLF
- + "Content-Id: 2"
- + CRLF
- + "--changeset_f980-1cb6-94dd--" + CRLF
- + CRLF
- + "--changeset_f980-1cb6-94dd--" + CRLF
- + CRLF
- + "--batch_8194-cf13-1f56--";
-
- parseInvalidBatchBody(batch, BatchDeserializerException.MessageKeys.INVALID_CONTENT_TYPE);
- }
-
- @Test
- public void testMissingContentTransferEncoding() throws Exception {
- final String batch = "--batch_8194-cf13-1f56" + CRLF
- + "Content-Type: multipart/mixed;boundary=changeset_f980-1cb6-94dd" + CRLF
- + CRLF
- + "--changeset_f980-1cb6-94dd" + CRLF
- + "Content-Id: 1" + CRLF
- + "Content-Type: application/http" + CRLF
- // + "Content-Transfer-Encoding: binary" + CRLF
- + CRLF
- + "POST Employees('2') HTTP/1.1" + CRLF
- + "Content-Type: application/json;odata=verbose" + CRLF
- + "MaxDataServiceVersion: 2.0" + CRLF
- + CRLF
- + CRLF
- + "--changeset_f980-1cb6-94dd--" + CRLF
- + "--batch_8194-cf13-1f56--";
-
- parseInvalidBatchBody(batch, BatchDeserializerException.MessageKeys.MISSING_CONTENT_TRANSFER_ENCODING);
- }
-
- @Test
- public void testMissingContentType() throws Exception {
- final String batch = "--batch_8194-cf13-1f56" + CRLF
- + "Content-Type: multipart/mixed;boundary=changeset_f980-1cb6-94dd" + CRLF
- + CRLF
- + "--changeset_f980-1cb6-94dd" + CRLF
- + "Content-Id: 1"
- // + "Content-Type: application/http" + CRLF
- + "Content-Transfer-Encoding: binary" + CRLF
- + CRLF
- + "POST Employees('2') HTTP/1.1" + CRLF
- + "Content-Type: application/json;odata=verbose" + CRLF
- + "MaxDataServiceVersion: 2.0" + CRLF
- + CRLF
- + CRLF
- + "--changeset_f980-1cb6-94dd--" + CRLF
- + "--batch_8194-cf13-1f56--";
-
- parseInvalidBatchBody(batch, BatchDeserializerException.MessageKeys.MISSING_CONTENT_TYPE);
- }
-
- @Test
- public void testNoCloseDelimiter() throws Exception {
- final String batch = ""
- + "--batch_8194-cf13-1f56" + CRLF
- + GET_REQUEST;
-
- parseInvalidBatchBody(batch, BatchDeserializerException.MessageKeys.MISSING_CLOSE_DELIMITER);
- }
-
- @Test
- public void testNoCloseDelimiter2() throws Exception {
- final String batch = ""
- + "--batch_8194-cf13-1f56" + CRLF
- + MIME_HEADERS
- + CRLF
- + "GET Employees('1')/EmployeeName HTTP/1.1" + CRLF;
-
- parseInvalidBatchBody(batch, BatchDeserializerException.MessageKeys.MISSING_CLOSE_DELIMITER);
- }
-
- @Test
- public void testUriWithAbsolutePath() throws Exception {
- final String batch = ""
- + "--batch_8194-cf13-1f56" + CRLF
- + MIME_HEADERS
- + CRLF
- + "GET /odata/Employees('1')/EmployeeName HTTP/1.1" + CRLF
- + "Host: http://localhost" + CRLF
- + CRLF
- + CRLF
- + "--batch_8194-cf13-1f56--";
-
- parseInvalidBatchBody(batch, BatchDeserializerException.MessageKeys.INVALID_URI);
- }
-
- @Test
- public void testUriWithAbsolutePathMissingHostHeader() throws Exception {
- final String batch = ""
- + "--batch_8194-cf13-1f56" + CRLF
- + MIME_HEADERS
- + CRLF
- + "GET /odata/Employees('1')/EmployeeName HTTP/1.1" + CRLF
- + CRLF
- + CRLF
- + "--batch_8194-cf13-1f56--";
-
- parseInvalidBatchBody(batch, MessageKeys.INVALID_URI);
- }
-
- @Test
- public void testUriWithAbsolutePathOtherHost() throws Exception {
- final String batch = ""
- + "--batch_8194-cf13-1f56" + CRLF
- + MIME_HEADERS
- + CRLF
- + "GET /odata/Employees('1')/EmployeeName HTTP/1.1" + CRLF
- + "Host: http://localhost2" + CRLF
- + CRLF
- + CRLF
- + "--batch_8194-cf13-1f56--";
-
- parseInvalidBatchBody(batch, MessageKeys.INVALID_URI);
- }
-
- @Test
- public void testUriWithAbsolutePathWrongPath() throws Exception {
- final String batch = ""
- + "--batch_8194-cf13-1f56" + CRLF
- + MIME_HEADERS
- + CRLF
- + "GET /myservice/Employees('1')/EmployeeName HTTP/1.1" + CRLF
- + "Host: http://localhost" + CRLF
- + CRLF
- + CRLF
- + "--batch_8194-cf13-1f56--";
-
- parseInvalidBatchBody(batch, MessageKeys.INVALID_URI);
- }
-
- @Test
- public void testNoCloseDelimiter3() throws Exception {
- final String batch = "--batch_8194-cf13-1f56" + CRLF + GET_REQUEST + "--batch_8194-cf13-1f56-"/* no hyphen */;
-
- parseInvalidBatchBody(batch, BatchDeserializerException.MessageKeys.MISSING_CLOSE_DELIMITER);
- }
-
- @Test
- public void testNegativeContentLengthChangeSet() throws Exception {
- final String batch = ""
- + "--batch_8194-cf13-1f56" + CRLF
- + "Content-Type: multipart/mixed; boundary=changeset_f980-1cb6-94dd" + CRLF
- + CRLF
- + "--changeset_f980-1cb6-94dd" + CRLF
- + MIME_HEADERS
- + "Content-ID: 1" + CRLF
- + "Content-Length: -2" + CRLF
- + CRLF
- + "PUT EmployeeName HTTP/1.1" + CRLF
- + "Content-Type: application/json;odata=verbose" + CRLF
- + "Content-Id: 1" + CRLF
- + CRLF
- + "{\"EmployeeName\":\"Peter Fall\"}" + CRLF
- + "--changeset_f980-1cb6-94dd--" + CRLF
- + CRLF
- + "--batch_8194-cf13-1f56--";
-
- parse(batch);
- }
-
- @Test
- public void testNegativeContentLengthRequest() throws Exception {
- final String batch = ""
- + "--batch_8194-cf13-1f56" + CRLF
- + "Content-Type: multipart/mixed; boundary=changeset_f980-1cb6-94dd" + CRLF
- + CRLF
- + "--changeset_f980-1cb6-94dd" + CRLF
- + MIME_HEADERS
- + "Content-ID: 1" + CRLF
- + CRLF
- + "PUT EmployeeName HTTP/1.1" + CRLF
- + "Content-Type: application/json;odata=verbose" + CRLF
- + "Content-Id: 1" + CRLF
- + "Content-Length: 2" + CRLF
- + CRLF
- + "{\"EmployeeName\":\"Peter Fall\"}" + CRLF
- + "--changeset_f980-1cb6-94dd--" + CRLF
- + CRLF
- + "--batch_8194-cf13-1f56--";
-
- parse(batch);
- }
-
- @Test
- public void testContentLengthGreatherThanBodyLength() throws Exception {
- final String batch = ""
- + "--batch_8194-cf13-1f56" + CRLF
- + "Content-Type: multipart/mixed; boundary=changeset_f980-1cb6-94dd" + CRLF
- + CRLF
- + "--changeset_f980-1cb6-94dd" + CRLF
- + MIME_HEADERS
- + "Content-ID: 1" + CRLF
- + CRLF
- + "PUT Employee/Name HTTP/1.1" + CRLF
- + "Content-Type: application/json;odata=verbose" + CRLF
- + "Content-Length: 100000" + CRLF
- + CRLF
- + "{\"EmployeeName\":\"Peter Fall\"}" + CRLF
- + "--changeset_f980-1cb6-94dd--" + CRLF
- + CRLF
- + "--batch_8194-cf13-1f56--";
- final List<BatchRequestPart> batchRequestParts = parse(batch);
-
- assertNotNull(batchRequestParts);
-
- for (BatchRequestPart multipart : batchRequestParts) {
- if (multipart.isChangeSet()) {
- assertEquals(1, multipart.getRequests().size());
-
- final ODataRequest request = multipart.getRequests().get(0);
- assertEquals("{\"EmployeeName\":\"Peter Fall\"}", IOUtils.toString(request.getBody()));
- }
- }
- }
-
- @Test
- public void testContentLengthSmallerThanBodyLength() throws Exception {
- final String batch = ""
- + "--batch_8194-cf13-1f56" + CRLF
- + "Content-Type: multipart/mixed; boundary=changeset_f980-1cb6-94dd" + CRLF
- + CRLF
- + "--changeset_f980-1cb6-94dd" + CRLF
- + MIME_HEADERS
- + "Content-ID: 1" + CRLF
- + CRLF
- + "PUT EmployeeName HTTP/1.1" + CRLF
- + "Content-Type: application/json;odata=verbose" + CRLF
- + "Content-Length: 10" + CRLF
- + CRLF
- + "{\"EmployeeName\":\"Peter Fall\"}" + CRLF
- + "--changeset_f980-1cb6-94dd--" + CRLF
- + CRLF
- + "--batch_8194-cf13-1f56--";
- final List<BatchRequestPart> batchRequestParts = parse(batch);
-
- assertNotNull(batchRequestParts);
-
- for (BatchRequestPart multipart : batchRequestParts) {
- if (multipart.isChangeSet()) {
- assertEquals(1, multipart.getRequests().size());
-
- final ODataRequest request = multipart.getRequests().get(0);
- assertEquals("{\"Employee", IOUtils.toString(request.getBody()));
- }
- }
- }
-
- @Test
- public void testNonNumericContentLength() throws Exception {
- final String batch = ""
- + "--batch_8194-cf13-1f56" + CRLF
- + "Content-Type: multipart/mixed; boundary=changeset_f980-1cb6-94dd" + CRLF
- + CRLF
- + "--changeset_f980-1cb6-94dd" + CRLF
- + MIME_HEADERS
- + "Content-ID: 1" + CRLF
- + CRLF
- + "PUT EmployeeName HTTP/1.1" + CRLF
- + "Content-Type: application/json;odata=verbose" + CRLF
- + "Content-Length: 10abc" + CRLF
- + CRLF
- + "{\"EmployeeName\":\"Peter Fall\"}" + CRLF
- + "--changeset_f980-1cb6-94dd--" + CRLF
- + CRLF
- + "--batch_8194-cf13-1f56--";
-
- parseInvalidBatchBody(batch, BatchDeserializerException.MessageKeys.INVALID_HEADER);
- }
-
- @Test
- public void testNonStrictParser() throws Exception {
- final String batch = ""
- + "--batch_8194-cf13-1f56" + CRLF
- + "Content-Type: multipart/mixed;boundary=changeset_8194-cf13-1f56" + CRLF
- + "--changeset_8194-cf13-1f56" + CRLF
- + MIME_HEADERS
- + "Content-ID: myRequest" + CRLF
- + "PUT Employees('2')/EmployeeName HTTP/1.1" + CRLF
- + "Accept: application/atomsvc+xml;q=0.8, application/json;odata=verbose;q=0.5, */*;q=0.1" + CRLF
- + "Content-Type: application/json;odata=verbose" + CRLF
- + "MaxDataServiceVersion: 2.0" + CRLF
- + "{\"EmployeeName\":\"Frederic Fall MODIFIED\"}" + CRLF
- + "--changeset_8194-cf13-1f56--" + CRLF
- + "--batch_8194-cf13-1f56--";
-
- final List<BatchRequestPart> requests = parse(batch, false);
-
- assertNotNull(requests);
- assertEquals(1, requests.size());
-
- final BatchRequestPart part = requests.get(0);
- assertTrue(part.isChangeSet());
- assertNotNull(part.getRequests());
- assertEquals(1, part.getRequests().size());
-
- final ODataRequest changeRequest = part.getRequests().get(0);
- assertEquals("{\"EmployeeName\":\"Frederic Fall MODIFIED\"}",
- IOUtils.toString(changeRequest.getBody()));
- assertEquals("application/json;odata=verbose", changeRequest.getHeader(HttpHeader.CONTENT_TYPE));
- assertEquals(HttpMethod.PUT, changeRequest.getMethod());
- }
-
- @Test
- public void testNonStrictParserMoreCRLF() throws Exception {
- final String batch = ""
- + "--batch_8194-cf13-1f56" + CRLF
- + "Content-Type: multipart/mixed;boundary=changeset_8194-cf13-1f56" + CRLF
- + "--changeset_8194-cf13-1f56" + CRLF
- + MIME_HEADERS
- + CRLF
- + CRLF // Only one CRLF allowed
- + "PUT Employees('2')/EmployeeName HTTP/1.1" + CRLF
- + "Accept: application/atomsvc+xml;q=0.8, application/json;odata=verbose;q=0.5, */*;q=0.1" + CRLF
- + "Content-Type: application/json;odata=verbose" + CRLF
- + "MaxDataServiceVersion: 2.0" + CRLF
- + "{\"EmployeeName\":\"Frederic Fall MODIFIED\"}" + CRLF
- + "--changeset_8194-cf13-1f56--" + CRLF
- + "--batch_8194-cf13-1f56--";
-
- parseInvalidBatchBody(batch, BatchDeserializerException.MessageKeys.INVALID_STATUS_LINE, false);
- }
-
- @Test
- public void testContentId() throws Exception {
- final String batch = ""
- + "--batch_8194-cf13-1f56" + CRLF
- + MIME_HEADERS
- + CRLF
- + "GET Employees HTTP/1.1" + CRLF
- + "accept: */*,application/atom+xml,application/atomsvc+xml,application/xml" + CRLF
- + "Content-Id: BBB" + CRLF
- + CRLF + CRLF
- + "--batch_8194-cf13-1f56" + CRLF
- + "Content-Type: multipart/mixed; boundary=changeset_f980-1cb6-94dd" + CRLF
- + CRLF
- + "--changeset_f980-1cb6-94dd" + CRLF
- + MIME_HEADERS
- + "Content-Id: 1" + CRLF
- + CRLF
- + "POST Employees HTTP/1.1" + CRLF
- + "Content-type: application/octet-stream" + CRLF
- + CRLF
- + "/9j/4AAQSkZJRgABAQEBLAEsAAD/4RM0RXhpZgAATU0AKgAAAAgABwESAAMAAAABAAEAAAEaAAUAAAABAAAAYgEbAAUAAAA" + CRLF
- + CRLF
- + "--changeset_f980-1cb6-94dd" + CRLF
- + MIME_HEADERS
- + CRLF
- + "PUT $1/EmployeeName HTTP/1.1" + CRLF
- + "Content-Type: application/json;odata=verbose" + CRLF
- + "Content-Id: 2" + CRLF
- + CRLF
- + "{\"EmployeeName\":\"Peter Fall\"}" + CRLF
- + "--changeset_f980-1cb6-94dd--" + CRLF
- + CRLF
- + "--batch_8194-cf13-1f56--";
-
- final List<BatchRequestPart> batchRequestParts = parse(batch);
- assertNotNull(batchRequestParts);
-
- for (BatchRequestPart multipart : batchRequestParts) {
- if (!multipart.isChangeSet()) {
- assertEquals(1, multipart.getRequests().size());
- final ODataRequest retrieveRequest = multipart.getRequests().get(0);
-
- assertEquals("BBB", retrieveRequest.getHeader(BatchParserCommon.HTTP_CONTENT_ID));
- } else {
- for (ODataRequest request : multipart.getRequests()) {
- if (HttpMethod.POST.equals(request.getMethod())) {
- assertEquals("1", request.getHeader(BatchParserCommon.HTTP_CONTENT_ID));
- } else if (HttpMethod.PUT.equals(request.getMethod())) {
- assertEquals("2", request.getHeader(BatchParserCommon.HTTP_CONTENT_ID));
- assertEquals("/$1/EmployeeName", request.getRawODataPath());
- assertEquals("http://localhost/odata/$1/EmployeeName", request.getRawRequestUri());
- }
- }
- }
- }
- }
-
- @Test
- public void testNoContentId() throws Exception {
- final String batch = ""
- + "--batch_8194-cf13-1f56" + CRLF
- + MIME_HEADERS
- + CRLF
- + "GET Employees HTTP/1.1" + CRLF
- + "accept: */*,application/atom+xml,application/atomsvc+xml,application/xml" + CRLF
- + CRLF + CRLF
- + "--batch_8194-cf13-1f56" + CRLF
- + "Content-Type: multipart/mixed; boundary=changeset_f980-1cb6-94dd" + CRLF
- + CRLF
- + "--changeset_f980-1cb6-94dd" + CRLF
- + MIME_HEADERS
- + "Content-Id: 1" + CRLF
- + CRLF
- + "POST Employees HTTP/1.1" + CRLF
- + "Content-type: application/octet-stream" + CRLF
- + CRLF
- + "/9j/4AAQSkZJRgABAQEBLAEsAAD/4RM0RXhpZgAATU0AKgAAAAgABwESAAMAAAABAAEAAAEaAAUAAAABAAAAYgEbAAUAAAA" + CRLF
- + CRLF
- + "--changeset_f980-1cb6-94dd" + CRLF
- + MIME_HEADERS
- + "Content-Id: 1" + CRLF
- + CRLF
- + "PUT $1/EmployeeName HTTP/1.1" + CRLF
- + "Content-Type: application/json;odata=verbose" + CRLF
- + CRLF
- + "{\"EmployeeName\":\"Peter Fall\"}" + CRLF
- + "--changeset_f980-1cb6-94dd--" + CRLF
- + CRLF
- + "--batch_8194-cf13-1f56--";
-
- parse(batch);
- }
-
- @Test
- public void testPreamble() throws Exception {
- final String batch = ""
- + "This is a preamble and must be ignored" + CRLF
- + CRLF
- + CRLF
- + "----1242" + CRLF
- + "--batch_8194-cf13-1f56" + CRLF
- + MIME_HEADERS
- + CRLF
- + "GET Employees HTTP/1.1" + CRLF
- + "accept: */*,application/atom+xml,application/atomsvc+xml,application/xml" + CRLF
- + "Content-Id: BBB" + CRLF
- + CRLF
- + CRLF
- + "--batch_8194-cf13-1f56" + CRLF
- + "Content-Type: multipart/mixed; boundary=changeset_f980-1cb6-94dd" + CRLF
- + CRLF
- + "This is a preamble and must be ignored" + CRLF
- + CRLF
- + CRLF
- + "----1242" + CRLF
- + "--changeset_f980-1cb6-94dd" + CRLF
- + MIME_HEADERS
- + "Content-Id: 1" + CRLF
- + CRLF
- + "POST Employees HTTP/1.1" + CRLF
- + "Content-type: application/octet-stream" + CRLF
- + CRLF
- + "/9j/4AAQSkZJRgABAQEBLAEsAAD/4RM0RXhpZgAATU0AKgAAAAgABwESAAMAAAABAAEAAAEaAAUAAAABAAAAYgEbAAUAAAA" + CRLF
- + CRLF
- + "--changeset_f980-1cb6-94dd" + CRLF
- + MIME_HEADERS
- + "Content-ID: 2" + CRLF
- + CRLF
- + "PUT $1/EmployeeName HTTP/1.1" + CRLF
- + "Content-Type: application/json;odata=verbose" + CRLF
- + CRLF
- + "{\"EmployeeName\":\"Peter Fall\"}" + CRLF
- + "--changeset_f980-1cb6-94dd--" + CRLF
- + CRLF
- + "--batch_8194-cf13-1f56--";
- final List<BatchRequestPart> batchRequestParts = parse(batch);
-
- assertNotNull(batchRequestParts);
- assertEquals(2, batchRequestParts.size());
-
- final BatchRequestPart getRequestPart = batchRequestParts.get(0);
- assertEquals(1, getRequestPart.getRequests().size());
-
- final ODataRequest getRequest = getRequestPart.getRequests().get(0);
- assertEquals(HttpMethod.GET, getRequest.getMethod());
-
- final BatchRequestPart changeSetPart = batchRequestParts.get(1);
- assertEquals(2, changeSetPart.getRequests().size());
- assertEquals("/9j/4AAQSkZJRgABAQEBLAEsAAD/4RM0RXhpZgAATU0AKgAAAAgABwESAAMAAAABAAEAAAEaAAUAAAABAAAAYgEbAAUAAAA"
- + CRLF,
- IOUtils.toString(changeSetPart.getRequests().get(0).getBody()));
- assertEquals("{\"EmployeeName\":\"Peter Fall\"}",
- IOUtils.toString(changeSetPart.getRequests().get(1).getBody()));
- }
-
- @Test
- public void testContentTypeCaseInsensitive() throws Exception {
- final String batch = ""
- + "--batch_8194-cf13-1f56" + CRLF
- + "Content-Type: muLTiParT/mixed; boundary=changeset_f980-1cb6-94dd" + CRLF
- + CRLF
- + "--changeset_f980-1cb6-94dd" + CRLF
- + MIME_HEADERS
- + "Content-ID: 1" + CRLF
- + "Content-Length: 200" + CRLF
- + CRLF
- + "PUT EmployeeName HTTP/1.1" + CRLF
- + "Content-Type: application/json;odata=verbose" + CRLF
- + CRLF
- + "{\"EmployeeName\":\"Peter Fall\"}" + CRLF
- + "--changeset_f980-1cb6-94dd--" + CRLF
- + CRLF
- + "--batch_8194-cf13-1f56--";
-
- parse(batch);
- }
-
- @Test
- public void testContentTypeBoundaryCaseInsensitive() throws Exception {
- final String batch = ""
- + "--batch_8194-cf13-1f56" + CRLF
- + "Content-Type: multipart/mixed; bOunDaRy=changeset_f980-1cb6-94dd" + CRLF
- + CRLF
- + "--changeset_f980-1cb6-94dd" + CRLF
- + MIME_HEADERS
- + "Content-ID: 1" + CRLF
- + CRLF
- + "PUT EmployeeName HTTP/1.1" + CRLF
- + "Content-Type: application/json;odata=verbose" + CRLF
- + CRLF
- + "{\"EmployeeName\":\"Peter Fall\"}" + CRLF
- + "--changeset_f980-1cb6-94dd--" + CRLF
- + CRLF
- + "--batch_8194-cf13-1f56--";
- final List<BatchRequestPart> batchRequestParts = parse(batch);
-
- assertNotNull(batchRequestParts);
- assertEquals(1, batchRequestParts.size());
- assertTrue(batchRequestParts.get(0).isChangeSet());
- assertEquals(1, batchRequestParts.get(0).getRequests().size());
- }
-
- @Test
- public void testEpilog() throws Exception {
- String batch = ""
- + "--batch_8194-cf13-1f56" + CRLF
- + MIME_HEADERS
- + CRLF
- + "GET Employees HTTP/1.1" + CRLF
- + "accept: */*,application/atom+xml,application/atomsvc+xml,application/xml" + CRLF
- + "Content-Id: BBB" + CRLF
- + CRLF
- + CRLF
- + "--batch_8194-cf13-1f56" + CRLF
- + "Content-Type: multipart/mixed; boundary=changeset_f980-1cb6-94dd" + CRLF
- + CRLF
- + "--changeset_f980-1cb6-94dd" + CRLF
- + MIME_HEADERS
- + "Content-Id: 1" + CRLF
- + CRLF
- + "POST Employees HTTP/1.1" + CRLF
- + "Content-type: application/octet-stream" + CRLF
- + CRLF
- + "/9j/4AAQSkZJRgABAQEBLAEsAAD/4RM0RXhpZgAATU0AKgAAAAgABwESAAMAAAABAAEAAAEaAAUAAAABAAAAYgEbAAUAAAA" + CRLF
- + CRLF
- + "--changeset_f980-1cb6-94dd" + CRLF
- + MIME_HEADERS
- + "Content-ID: 2" + CRLF
- + CRLF
- + "PUT $1/EmployeeName HTTP/1.1" + CRLF
- + "Content-Type: application/json;odata=verbose" + CRLF
- + CRLF
- + "{\"EmployeeName\":\"Peter Fall\"}" + CRLF
- + "--changeset_f980-1cb6-94dd--" + CRLF
- + CRLF
- + "This is an epilog and must be ignored" + CRLF
- + CRLF
- + CRLF
- + "----1242"
- + CRLF
- + "--batch_8194-cf13-1f56--"
- + CRLF
- + "This is an epilog and must be ignored" + CRLF
- + CRLF
- + CRLF
- + "----1242";
- final List<BatchRequestPart> batchRequestParts = parse(batch);
-
- assertNotNull(batchRequestParts);
- assertEquals(2, batchRequestParts.size());
-
- BatchRequestPart getRequestPart = batchRequestParts.get(0);
- assertEquals(1, getRequestPart.getRequests().size());
- ODataRequest getRequest = getRequestPart.getRequests().get(0);
- assertEquals(HttpMethod.GET, getRequest.getMethod());
-
- BatchRequestPart changeSetPart = batchRequestParts.get(1);
- assertEquals(2, changeSetPart.getRequests().size());
- assertEquals("/9j/4AAQSkZJRgABAQEBLAEsAAD/4RM0RXhpZgAATU0AKgAAAAgABwESAAMAAAABAAEAAAEaAAUAAAABAAAAYgEbAAUAAAA"
- + CRLF,
- IOUtils.toString(changeSetPart.getRequests().get(0).getBody()));
- assertEquals("{\"EmployeeName\":\"Peter Fall\"}",
- IOUtils.toString(changeSetPart.getRequests().get(1).getBody()));
- }
-
- @Test
- public void testLargeBatch() throws Exception {
- final InputStream in = readFile("/batchLarge.batch");
- parse(in);
- }
-
- @Test
- public void testForddenHeaderAuthorisation() throws Exception {
- final String batch = ""
- + "--batch_8194-cf13-1f56" + CRLF
- + MIME_HEADERS
- + CRLF
- + "GET Employees('1')/EmployeeName HTTP/1.1" + CRLF
- + "Authorization: Basic QWxhZdsdsddsduIHNlc2FtZQ==" + CRLF
- + CRLF
- + CRLF
- + "--batch_8194-cf13-1f56--";
-
- parseInvalidBatchBody(batch, MessageKeys.FORBIDDEN_HEADER);
- }
-
- @Test
- public void testForddenHeaderExpect() throws Exception {
- final String batch = ""
- + "--batch_8194-cf13-1f56" + CRLF
- + MIME_HEADERS
- + CRLF
- + "GET Employees('1')/EmployeeName HTTP/1.1" + CRLF
- + "Expect: 100-continue" + CRLF
- + CRLF
- + CRLF
- + "--batch_8194-cf13-1f56--";
-
- parseInvalidBatchBody(batch, MessageKeys.FORBIDDEN_HEADER);
- }
-
- @Test
- public void testForddenHeaderFrom() throws Exception {
- final String batch = ""
- + "--batch_8194-cf13-1f56" + CRLF
- + MIME_HEADERS
- + CRLF
- + "GET Employees('1')/EmployeeName HTTP/1.1" + CRLF
- + "From: test@test.com" + CRLF
- + CRLF
- + CRLF
- + "--batch_8194-cf13-1f56--";
-
- parseInvalidBatchBody(batch, MessageKeys.FORBIDDEN_HEADER);
- }
-
- @Test
- public void testForddenHeaderRange() throws Exception {
- final String batch = ""
- + "--batch_8194-cf13-1f56" + CRLF
- + MIME_HEADERS
- + CRLF
- + "GET Employees('1')/EmployeeName HTTP/1.1" + CRLF
- + "Range: 200-256" + CRLF
- + CRLF
- + CRLF
- + "--batch_8194-cf13-1f56--";
-
- parseInvalidBatchBody(batch, MessageKeys.FORBIDDEN_HEADER);
- }
-
- @Test
- public void testForddenHeaderMaxForwards() throws Exception {
- final String batch = ""
- + "--batch_8194-cf13-1f56" + CRLF
- + MIME_HEADERS
- + CRLF
- + "GET Employees('1')/EmployeeName HTTP/1.1" + CRLF
- + "Max-Forwards: 3" + CRLF
- + CRLF
- + CRLF
- + "--batch_8194-cf13-1f56--";
-
- parseInvalidBatchBody(batch, MessageKeys.FORBIDDEN_HEADER);
- }
-
- @Test
- public void testForddenHeaderTE() throws Exception {
- final String batch = ""
- + "--batch_8194-cf13-1f56" + CRLF
- + MIME_HEADERS
- + CRLF
- + "GET Employees('1')/EmployeeName HTTP/1.1" + CRLF
- + "TE: deflate" + CRLF
- + CRLF
- + CRLF
- + "--batch_8194-cf13-1f56--";
-
- parseInvalidBatchBody(batch, MessageKeys.FORBIDDEN_HEADER);
- }
-
- private List<BatchRequestPart> parse(final InputStream in, final boolean isStrict) throws Exception {
- final BatchParser parser = new BatchParser();
- final BatchOptions options = BatchOptions.with().isStrict(isStrict).rawBaseUri(SERVICE_ROOT).build();
- final List<BatchRequestPart> batchRequestParts =
- parser.parseBatchRequest(in, BOUNDARY, options);
-
- assertNotNull(batchRequestParts);
-
- return batchRequestParts;
- }
-
- private List<BatchRequestPart> parse(final InputStream in) throws Exception {
- return parse(in, true);
- }
-
- private List<BatchRequestPart> parse(final String batch) throws Exception {
- return parse(batch, true);
- }
-
- private List<BatchRequestPart> parse(final String batch, final boolean isStrict) throws Exception {
- return parse(IOUtils.toInputStream(batch), isStrict);
- }
-
- private void parseInvalidBatchBody(final String batch, final MessageKeys key, final boolean isStrict)
- throws Exception {
- final BatchParser parser = new BatchParser();
- final BatchOptions options = BatchOptions.with().isStrict(isStrict).rawBaseUri(SERVICE_ROOT).build();
- try {
- parser.parseBatchRequest(IOUtils.toInputStream(batch), BOUNDARY, options);
- fail("No exception thrown. Expect: " + key.toString());
- } catch (BatchDeserializerException e) {
- assertMessageKey(e, key);
- }
- }
-
- private void parseInvalidBatchBody(final String batch, final MessageKeys key) throws Exception {
- parseInvalidBatchBody(batch, key, true);
- }
-
- private void assertMessageKey(final BatchDeserializerException e, final MessageKeys key) {
- assertEquals(key, e.getMessageKey());
- }
-
- private InputStream readFile(final String fileName) throws Exception {
- final InputStream in = ClassLoader.class.getResourceAsStream(fileName);
- if (in == null) {
- throw new IOException("Requested file '" + fileName + "' was not found.");
- }
- return in;
- }
-}
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/deserializer/batch/BufferedReaderIncludingLineEndingsTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/deserializer/batch/BufferedReaderIncludingLineEndingsTest.java
deleted file mode 100644
index efc3714..0000000
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/deserializer/batch/BufferedReaderIncludingLineEndingsTest.java
+++ /dev/null
@@ -1,481 +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.deserializer.batch;
-
-import static org.junit.Assert.*;
-
-import java.io.ByteArrayInputStream;
-import java.io.InputStreamReader;
-import java.util.List;
-
-import org.apache.olingo.server.core.deserializer.batch.BufferedReaderIncludingLineEndings;
-import org.apache.olingo.server.core.deserializer.batch.Line;
-import org.junit.Test;
-
-public class BufferedReaderIncludingLineEndingsTest {
-
-
- private static final String TEXT_COMBINED = "Test\r" +
- "Test2\r\n" +
- "Test3\n" +
- "Test4\r" +
- "\r" +
- "\r\n" +
- "\r\n" +
- "Test5\n" +
- "Test6\r\n" +
- "Test7\n" +
- "\n";
-
- private static final String TEXT_SMALL = "Test\r" +
- "123";
- private static final String TEXT_EMPTY = "";
-
- @Test
- public void testSimpleText() throws Exception {
- final String TEXT = "Test";
- BufferedReaderIncludingLineEndings reader = create(TEXT);
-
- assertEquals(TEXT, reader.readLine());
- assertNull(reader.readLine());
- assertNull(reader.readLine());
- reader.close();
- }
-
- @Test
- public void testNoText() throws Exception {
- final String TEXT = "";
- BufferedReaderIncludingLineEndings reader = create(TEXT);
-
- assertNull(reader.readLine());
- assertNull(reader.readLine());
- reader.close();
- }
-
- @Test
- public void testNoBytes() throws Exception {
- BufferedReaderIncludingLineEndings reader =
- new BufferedReaderIncludingLineEndings(new InputStreamReader(new ByteArrayInputStream(new byte[0])));
-
- assertNull(reader.readLine());
- assertNull(reader.readLine());
- reader.close();
- }
-
- @Test
- public void testCRLF() throws Exception {
- final String TEXT = "Test\r\n" +
- "Test2";
-
- BufferedReaderIncludingLineEndings reader = create(TEXT);
-
- assertEquals("Test\r\n", reader.readLine());
- assertEquals("Test2", reader.readLine());
- assertNull(reader.readLine());
- assertNull(reader.readLine());
- reader.close();
- }
-
- @Test
- public void testLF() throws Exception {
- final String TEXT = "Test\n" +
- "Test2";
-
- BufferedReaderIncludingLineEndings reader = create(TEXT);
-
- assertEquals("Test\n", reader.readLine());
- assertEquals("Test2", reader.readLine());
- assertNull(reader.readLine());
- assertNull(reader.readLine());
- reader.close();
- }
-
- @Test
- public void testCR() throws Exception {
- final String TEXT = "Test\r" +
- "Test2";
-
- BufferedReaderIncludingLineEndings reader = create(TEXT);
-
- assertEquals("Test\r", reader.readLine());
- assertEquals("Test2", reader.readLine());
- assertNull(reader.readLine());
- assertNull(reader.readLine());
- reader.close();
- }
-
- @Test
- public void testCombined() throws Exception {
- BufferedReaderIncludingLineEndings reader = create(TEXT_COMBINED);
-
- assertEquals("Test\r", reader.readLine());
- assertEquals("Test2\r\n", reader.readLine());
- assertEquals("Test3\n", reader.readLine());
- assertEquals("Test4\r", reader.readLine());
- assertEquals("\r", reader.readLine());
- assertEquals("\r\n", reader.readLine());
- assertEquals("\r\n", reader.readLine());
- assertEquals("Test5\n", reader.readLine());
- assertEquals("Test6\r\n", reader.readLine());
- assertEquals("Test7\n", reader.readLine());
- assertEquals("\n", reader.readLine());
- assertNull(reader.readLine());
- assertNull(reader.readLine());
- reader.close();
- }
-
- @Test
- public void testCombinedBufferSizeTwo() throws Exception {
- BufferedReaderIncludingLineEndings reader = create(TEXT_COMBINED, 2);
-
- assertEquals("Test\r", reader.readLine());
- assertEquals("Test2\r\n", reader.readLine());
- assertEquals("Test3\n", reader.readLine());
- assertEquals("Test4\r", reader.readLine());
- assertEquals("\r", reader.readLine());
- assertEquals("\r\n", reader.readLine());
- assertEquals("\r\n", reader.readLine());
- assertEquals("Test5\n", reader.readLine());
- assertEquals("Test6\r\n", reader.readLine());
- assertEquals("Test7\n", reader.readLine());
- assertEquals("\n", reader.readLine());
- assertNull(reader.readLine());
- assertNull(reader.readLine());
- reader.close();
- }
-
- @Test
- public void testCombinedBufferSizeOne() throws Exception {
- final String TEXT = "Test\r" +
- "Test2\r\n" +
- "Test3\n" +
- "Test4\r" +
- "\r" +
- "\r\n" +
- "\r\n" +
- "Test5\n" +
- "Test6\r\n" +
- "Test7\n" +
- "\r\n";
-
- BufferedReaderIncludingLineEndings reader = create(TEXT, 1);
-
- assertEquals("Test\r", reader.readLine());
- assertEquals("Test2\r\n", reader.readLine());
- assertEquals("Test3\n", reader.readLine());
- assertEquals("Test4\r", reader.readLine());
- assertEquals("\r", reader.readLine());
- assertEquals("\r\n", reader.readLine());
- assertEquals("\r\n", reader.readLine());
- assertEquals("Test5\n", reader.readLine());
- assertEquals("Test6\r\n", reader.readLine());
- assertEquals("Test7\n", reader.readLine());
- assertEquals("\r\n", reader.readLine());
- assertNull(reader.readLine());
- assertNull(reader.readLine());
-
- reader.close();
- }
-
- @Test
- public void testDoubleLF() throws Exception {
- final String TEXT = "Test\r" +
- "\r";
-
- BufferedReaderIncludingLineEndings reader = create(TEXT, 1);
-
- assertEquals("Test\r", reader.readLine());
- assertEquals("\r", reader.readLine());
- reader.close();
- }
-
- @Test
- public void testSkipSimple() throws Exception {
- BufferedReaderIncludingLineEndings reader = create(TEXT_SMALL);
-
- assertEquals(5, reader.skip(5)); // Test\r
- assertEquals("123", reader.readLine());
- assertNull(reader.readLine());
- assertNull(reader.readLine());
- reader.close();
- }
-
- @Test
- public void testSkipBufferOne() throws Exception {
- BufferedReaderIncludingLineEndings reader = create(TEXT_SMALL, 1);
-
- assertEquals(5, reader.skip(5)); // Test\r
- assertEquals("123", reader.readLine());
- assertNull(reader.readLine());
- assertNull(reader.readLine());
- reader.close();
- }
-
- @Test
- public void testReadThanSkip() throws Exception {
- final String TEXT = "Test\r" +
- "\r" +
- "123";
-
- BufferedReaderIncludingLineEndings reader = create(TEXT);
-
- assertEquals("Test\r", reader.readLine());
- assertEquals(1, reader.skip(1)); // Test\r
- assertEquals("123", reader.readLine());
- assertNull(reader.readLine());
- assertNull(reader.readLine());
- reader.close();
- }
-
- @Test
- public void testReadMoreBufferCapacityThanCharacterAvailable() throws Exception {
- final String TEXT = "Foo";
- char[] buffer = new char[20];
-
- BufferedReaderIncludingLineEndings reader = create(TEXT);
- assertEquals(3, reader.read(buffer, 0, 20));
- assertEquals(-1, reader.read(buffer, 0, 20));
- reader.close();
-
- BufferedReaderIncludingLineEndings readerBufferOne = create(TEXT, 1);
- assertEquals(3, readerBufferOne.read(buffer, 0, 20));
- assertEquals(-1, readerBufferOne.read(buffer, 0, 20));
- readerBufferOne.close();
- }
-
- @Test
- public void testSkipZero() throws Exception {
- final String TEXT = "Test\r" +
- "123\r\n";
-
- BufferedReaderIncludingLineEndings reader = create(TEXT);
-
- assertEquals(0, reader.skip(0)); // Test\r
- assertEquals("Test\r", reader.readLine());
- assertEquals("123\r\n", reader.readLine());
- assertNull(reader.readLine());
- assertNull(reader.readLine());
- reader.close();
- }
-
- @Test
- public void testSkipToMuch() throws Exception {
- BufferedReaderIncludingLineEndings reader = create(TEXT_SMALL);
-
- assertEquals(8, reader.skip(10)); // Test\r
- assertEquals(null, reader.readLine());
- reader.close();
- }
-
- @Test
- public void testReadBufferOne() throws Exception {
- BufferedReaderIncludingLineEndings reader = create(TEXT_SMALL, 1);
-
- assertEquals('T', reader.read());
- assertEquals('e', reader.read());
- assertEquals('s', reader.read());
- assertEquals('t', reader.read());
- assertEquals('\r', reader.read());
- assertEquals('1', reader.read());
- assertEquals('2', reader.read());
- assertEquals('3', reader.read());
- assertEquals(-1, reader.read());
- assertEquals(-1, reader.read());
- }
-
- @Test
- public void testReadZeroBytes() throws Exception {
- BufferedReaderIncludingLineEndings reader = create(TEXT_SMALL, 1);
-
- char[] buffer = new char[3];
- assertEquals(0, reader.read(buffer, 0, 0));
- assertEquals('T', reader.read());
- assertEquals(0, reader.read(buffer, 0, 0));
- assertEquals("est\r", reader.readLine());
- assertEquals("123", reader.readLine());
-
- reader.close();
- }
-
- @Test
- public void testRead() throws Exception {
- BufferedReaderIncludingLineEndings reader = create(TEXT_SMALL);
-
- assertEquals('T', reader.read());
- assertEquals('e', reader.read());
- assertEquals('s', reader.read());
- assertEquals('t', reader.read());
- assertEquals('\r', reader.read());
- assertEquals('1', reader.read());
- assertEquals('2', reader.read());
- assertEquals('3', reader.read());
- assertEquals(-1, reader.read());
- assertEquals(-1, reader.read());
- }
-
- @Test(expected = IndexOutOfBoundsException.class)
- public void testFailReadBufferAndOffsetBiggerThanBuffer() throws Exception {
- BufferedReaderIncludingLineEndings reader = create("");
-
- final char[] buffer = new char[3];
- reader.read(buffer, 1, 3);
- }
-
- @Test(expected = IndexOutOfBoundsException.class)
- public void testFailLengthNegative() throws Exception {
- final char[] buffer = new char[3];
- BufferedReaderIncludingLineEndings reader = create("123");
-
- reader.read(buffer, 1, -2);
- reader.close();
- }
-
- @Test(expected = IndexOutOfBoundsException.class)
- public void testFailOffsetNegative() throws Exception {
- final char[] buffer = new char[3];
- BufferedReaderIncludingLineEndings reader = create("123");
-
- reader.read(buffer, -1, 2);
- reader.close();
- }
-
- @Test
- public void testReadAndReadLine() throws Exception {
- final String TEXT = "Test\r" +
- "bar\n" +
- "123\r\n" +
- "foo";
-
- BufferedReaderIncludingLineEndings reader = create(TEXT);
-
- assertEquals('T', reader.read());
- assertEquals('e', reader.read());
- assertEquals('s', reader.read());
- assertEquals('t', reader.read());
- assertEquals("\r", reader.readLine());
- assertEquals("bar\n", reader.readLine());
- assertEquals('1', reader.read());
- assertEquals('2', reader.read());
- assertEquals("3\r\n", reader.readLine());
- assertEquals("foo", reader.readLine());
- assertEquals(null, reader.readLine());
- assertEquals(-1, reader.read());
- }
-
- @Test
- public void testLineEqualsAndHashCode() {
- Line l1 = new Line("The first line", 1);
- Line l2 = new Line("The first line", 1);
- Line l3 = new Line("The second line", 2);
-
- assertEquals(l1, l2);
- assertFalse(l1.equals(l3));
- assertTrue(l1.hashCode() != l3.hashCode());
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void testSkipNegative() throws Exception {
- BufferedReaderIncludingLineEndings reader = create("123");
- reader.skip(-1);
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void testFailBufferSizeZero() throws Exception {
- BufferedReaderIncludingLineEndings reader = create(TEXT_EMPTY, 0);
- reader.close();
- }
-
- @Test(expected = NullPointerException.class)
- public void testInputStreamIsNull() throws Exception {
- // Same behaviour like BufferedReader
- BufferedReaderIncludingLineEndings reader = new BufferedReaderIncludingLineEndings(null);
- reader.close();
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void testFailBufferSizeNegative() throws Exception {
- BufferedReaderIncludingLineEndings reader = create(TEXT_EMPTY, -1);
- reader.close();
- }
-
- @Test
- public void testMarkSupoorted() throws Exception {
- BufferedReaderIncludingLineEndings reader = create(TEXT_EMPTY);
-
- assertEquals(false, reader.markSupported());
- reader.close();
- }
-
- @Test(expected = Exception.class)
- public void testFailMark() throws Exception {
- BufferedReaderIncludingLineEndings reader = create("123");
-
- reader.mark(1);
- }
-
- @Test(expected = Exception.class)
- public void testFailReset() throws Exception {
- BufferedReaderIncludingLineEndings reader = create("123");
-
- reader.reset();
- }
-
- @Test
- public void testReady() throws Exception {
- BufferedReaderIncludingLineEndings reader = create("123\r123");
- assertEquals(false, reader.ready());
- assertEquals("123\r", reader.readLine());
- assertEquals(true, reader.ready());
- assertEquals("123", reader.readLine());
- assertEquals(false, reader.ready());
-
- reader.close();
- }
-
- @Test
- public void testToList() throws Exception {
- BufferedReaderIncludingLineEndings reader = create(TEXT_COMBINED);
- List<Line> stringList = reader.toLineList();
-
- assertEquals(11, stringList.size());
- assertEquals("Test\r", stringList.get(0).toString());
- assertEquals("Test2\r\n", stringList.get(1).toString());
- assertEquals("Test3\n", stringList.get(2).toString());
- assertEquals("Test4\r", stringList.get(3).toString());
- assertEquals("\r", stringList.get(4).toString());
- assertEquals("\r\n", stringList.get(5).toString());
- assertEquals("\r\n", stringList.get(6).toString());
- assertEquals("Test5\n", stringList.get(7).toString());
- assertEquals("Test6\r\n", stringList.get(8).toString());
- assertEquals("Test7\n", stringList.get(9).toString());
- assertEquals("\n", stringList.get(10).toString());
- reader.close();
- }
-
- private BufferedReaderIncludingLineEndings create(final String inputString) throws Exception {
- return new BufferedReaderIncludingLineEndings(new InputStreamReader(new ByteArrayInputStream(inputString
- .getBytes("UTF-8"))));
- }
-
- private BufferedReaderIncludingLineEndings create(final String inputString, int bufferSize) throws Exception {
- return new BufferedReaderIncludingLineEndings(new InputStreamReader(new ByteArrayInputStream(inputString
- .getBytes("UTF-8"))), bufferSize);
- }
-
-}
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/deserializer/batch/HeaderTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/deserializer/batch/HeaderTest.java
deleted file mode 100644
index 282251e..0000000
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/deserializer/batch/HeaderTest.java
+++ /dev/null
@@ -1,171 +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.deserializer.batch;
-
-import static org.junit.Assert.*;
-
-import java.util.Arrays;
-import java.util.List;
-
-import org.apache.olingo.commons.api.http.HttpContentType;
-import org.apache.olingo.commons.api.http.HttpHeader;
-import org.apache.olingo.server.core.deserializer.batch.BatchParserCommon;
-import org.apache.olingo.server.core.deserializer.batch.Header;
-import org.junit.Test;
-
-public class HeaderTest {
-
- @Test
- public void test() {
- Header header = new Header(1);
- header.addHeader(HttpHeader.CONTENT_TYPE, HttpContentType.MULTIPART_MIXED, 1);
-
- assertEquals(HttpContentType.MULTIPART_MIXED, header.getHeader(HttpHeader.CONTENT_TYPE));
- assertEquals(1, header.getHeaders(HttpHeader.CONTENT_TYPE).size());
- assertEquals(HttpContentType.MULTIPART_MIXED, header.getHeaders(HttpHeader.CONTENT_TYPE).get(0));
- }
-
- @Test
- public void testNotAvailable() {
- Header header = new Header(1);
-
- assertNull(header.getHeader(HttpHeader.CONTENT_TYPE));
- assertEquals(0, header.getHeaders(HttpHeader.CONTENT_TYPE).size());
- assertEquals("", header.getHeaderNotNull(HttpHeader.CONTENT_TYPE));
- }
-
- @Test
- public void testCaseInsensitive() {
- Header header = new Header(1);
- header.addHeader(HttpHeader.CONTENT_TYPE, HttpContentType.MULTIPART_MIXED, 1);
-
- assertEquals(HttpContentType.MULTIPART_MIXED, header.getHeader("cOnTenT-TyPE"));
- assertEquals(1, header.getHeaders("cOnTenT-TyPE").size());
- assertEquals(HttpContentType.MULTIPART_MIXED, header.getHeaders("cOnTenT-TyPE").get(0));
- }
-
- @Test
- public void testDuplicatedAdd() {
- Header header = new Header(1);
- header.addHeader(HttpHeader.CONTENT_TYPE, HttpContentType.MULTIPART_MIXED, 1);
- header.addHeader(HttpHeader.CONTENT_TYPE, HttpContentType.MULTIPART_MIXED, 2);
-
- assertEquals(HttpContentType.MULTIPART_MIXED, header.getHeader(HttpHeader.CONTENT_TYPE));
- assertEquals(1, header.getHeaders(HttpHeader.CONTENT_TYPE).size());
- assertEquals(HttpContentType.MULTIPART_MIXED, header.getHeaders(HttpHeader.CONTENT_TYPE).get(0));
- }
-
- @Test
- public void testMatcher() {
- Header header = new Header(1);
- header.addHeader(HttpHeader.CONTENT_TYPE, HttpContentType.MULTIPART_MIXED + ";boundary=123", 1);
-
- assertTrue(header.isHeaderMatching(HttpHeader.CONTENT_TYPE, BatchParserCommon.PATTERN_MULTIPART_BOUNDARY));
- }
-
- @Test
- public void testFieldName() {
- Header header = new Header(0);
- header.addHeader("MyFieldNamE", "myValue", 1);
-
- assertEquals("MyFieldNamE", header.getHeaderField("myfieldname").getFieldName());
- assertEquals("MyFieldNamE", header.toSingleMap().keySet().toArray(new String[0])[0]);
- assertEquals("MyFieldNamE", header.toMultiMap().keySet().toArray(new String[0])[0]);
-
- assertEquals("myValue", header.toMultiMap().get("MyFieldNamE").get(0));
- assertEquals("myValue", header.toSingleMap().get("MyFieldNamE"));
- }
-
- @Test
- public void testDeepCopy() {
- Header header = new Header(1);
- header.addHeader(HttpHeader.CONTENT_TYPE, HttpContentType.MULTIPART_MIXED + ";boundary=123", 1);
-
- Header copy = header.clone();
- assertEquals(header.getHeaders(HttpHeader.CONTENT_TYPE), copy.getHeaders(HttpHeader.CONTENT_TYPE));
- assertEquals(header.getHeader(HttpHeader.CONTENT_TYPE), copy.getHeader(HttpHeader.CONTENT_TYPE));
- assertEquals(header.getHeaderField(HttpHeader.CONTENT_TYPE), copy.getHeaderField(HttpHeader.CONTENT_TYPE));
-
- assertTrue(header.getHeaders(HttpHeader.CONTENT_TYPE) != copy.getHeaders(HttpHeader.CONTENT_TYPE));
- assertTrue(header.getHeaderField(HttpHeader.CONTENT_TYPE) != copy.getHeaderField(HttpHeader.CONTENT_TYPE));
- }
-
- @Test
- public void testMatcherNoHeader() {
- Header header = new Header(1);
-
- assertFalse(header.isHeaderMatching(HttpHeader.CONTENT_TYPE, BatchParserCommon.PATTERN_MULTIPART_BOUNDARY));
- }
-
- @Test
- public void testDuplicatedAddList() {
- Header header = new Header(1);
- header.addHeader(HttpHeader.CONTENT_TYPE, HttpContentType.MULTIPART_MIXED, 1);
- header.addHeader(HttpHeader.CONTENT_TYPE, Arrays.asList(new String[] { HttpContentType.MULTIPART_MIXED,
- HttpContentType.APPLICATION_ATOM_SVC }), 2);
-
- assertEquals(HttpContentType.MULTIPART_MIXED + ", " + HttpContentType.APPLICATION_ATOM_SVC, header
- .getHeader(HttpHeader.CONTENT_TYPE));
- assertEquals(2, header.getHeaders(HttpHeader.CONTENT_TYPE).size());
- assertEquals(HttpContentType.MULTIPART_MIXED, header.getHeaders(HttpHeader.CONTENT_TYPE).get(0));
- assertEquals(HttpContentType.APPLICATION_ATOM_SVC, header.getHeaders(HttpHeader.CONTENT_TYPE).get(1));
- }
-
- @Test
- public void testRemove() {
- Header header = new Header(1);
- header.addHeader(HttpHeader.CONTENT_TYPE, HttpContentType.MULTIPART_MIXED, 1);
- header.removeHeader(HttpHeader.CONTENT_TYPE);
-
- assertNull(header.getHeader(HttpHeader.CONTENT_TYPE));
- assertEquals(0, header.getHeaders(HttpHeader.CONTENT_TYPE).size());
- }
-
- @Test
- public void testMultipleValues() {
- Header header = new Header(1);
- header.addHeader(HttpHeader.CONTENT_TYPE, HttpContentType.MULTIPART_MIXED, 1);
- header.addHeader(HttpHeader.CONTENT_TYPE, HttpContentType.APPLICATION_ATOM_SVC, 2);
- header.addHeader(HttpHeader.CONTENT_TYPE, HttpContentType.APPLICATION_ATOM_XML, 3);
-
- final String fullHeaderString =
- HttpContentType.MULTIPART_MIXED + ", " + HttpContentType.APPLICATION_ATOM_SVC + ", "
- + HttpContentType.APPLICATION_ATOM_XML;
-
- assertEquals(fullHeaderString, header.getHeader(HttpHeader.CONTENT_TYPE));
- assertEquals(3, header.getHeaders(HttpHeader.CONTENT_TYPE).size());
- assertEquals(HttpContentType.MULTIPART_MIXED, header.getHeaders(HttpHeader.CONTENT_TYPE).get(0));
- assertEquals(HttpContentType.APPLICATION_ATOM_SVC, header.getHeaders(HttpHeader.CONTENT_TYPE).get(1));
- assertEquals(HttpContentType.APPLICATION_ATOM_XML, header.getHeaders(HttpHeader.CONTENT_TYPE).get(2));
- }
-
- @Test
- public void testSplitValues() {
- final String values = "abc, def,123,77, 99, ysd";
- List<String> splittedValues = Header.splitValuesByComma(values);
-
- assertEquals(6, splittedValues.size());
- assertEquals("abc", splittedValues.get(0));
- assertEquals("def", splittedValues.get(1));
- assertEquals("123", splittedValues.get(2));
- assertEquals("77", splittedValues.get(3));
- assertEquals("99", splittedValues.get(4));
- assertEquals("ysd", splittedValues.get(5));
- }
-}
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/deserializer/batch/HttpRequestStatusLineTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/deserializer/batch/HttpRequestStatusLineTest.java
deleted file mode 100644
index 5ea7cc8..0000000
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/deserializer/batch/HttpRequestStatusLineTest.java
+++ /dev/null
@@ -1,108 +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.deserializer.batch;
-
-import static org.junit.Assert.*;
-
-import org.apache.olingo.commons.api.http.HttpMethod;
-import org.apache.olingo.server.api.batch.exception.BatchDeserializerException;
-import org.apache.olingo.server.api.batch.exception.BatchDeserializerException.MessageKeys;
-import org.junit.Test;
-
-public class HttpRequestStatusLineTest {
-
- private static final String HTTP_VERSION = "HTTP/1.1";
- private static final String SPACE = " ";
- private String baseUri = "http://localhost/odata";
- private String serviceResolutionUri = "";
-
- @Test
- public void testAbsolute() throws BatchDeserializerException {
- final HttpRequestStatusLine line = parse("http://localhost/odata/Employee?$top=2");
- assertEquals("$top=2", line.getRawQueryPath());
- assertEquals("/Employee", line.getRawODataPath());
- assertEquals("http://localhost/odata/Employee?$top=2", line.getRawRequestUri());
- assertEquals(baseUri, line.getRawBaseUri());
- assertEquals(serviceResolutionUri, line.getRawServiceResolutionUri());
- }
-
- @Test
- public void testAbsoluteWithRelativePath() throws BatchDeserializerException {
- final HttpRequestStatusLine line = parse("http://localhost/odata/../../Employee?$top=2");
- assertEquals("/../../Employee", line.getRawODataPath());
- assertEquals("$top=2", line.getRawQueryPath());
- assertEquals("http://localhost/odata/../../Employee?$top=2", line.getRawRequestUri());
- assertEquals(baseUri, line.getRawBaseUri());
- assertEquals(serviceResolutionUri, line.getRawServiceResolutionUri());
- }
-
- @Test
- public void testRelativeWithDots() throws BatchDeserializerException {
- final HttpRequestStatusLine line = parse("../../Employee?$top=2");
- assertEquals("/../../Employee", line.getRawODataPath());
- assertEquals("$top=2", line.getRawQueryPath());
- assertEquals("http://localhost/odata/../../Employee?$top=2", line.getRawRequestUri());
- assertEquals(baseUri, line.getRawBaseUri());
- assertEquals(serviceResolutionUri, line.getRawServiceResolutionUri());
- }
-
- @Test
- public void testRelative() throws BatchDeserializerException {
- final HttpRequestStatusLine line = parse("Employee?$top=2");
- assertEquals("$top=2", line.getRawQueryPath());
- assertEquals("/Employee", line.getRawODataPath());
- assertEquals("http://localhost/odata/Employee?$top=2", line.getRawRequestUri());
- assertEquals(baseUri, line.getRawBaseUri());
- assertEquals(serviceResolutionUri, line.getRawServiceResolutionUri());
- }
-
- @Test
- public void testRelativeMultipleSegements() throws BatchDeserializerException {
- final HttpRequestStatusLine line = parse("Employee/Manager/EmployeeName?$top=2");
- assertEquals("$top=2", line.getRawQueryPath());
- assertEquals("/Employee/Manager/EmployeeName", line.getRawODataPath());
- assertEquals("http://localhost/odata/Employee/Manager/EmployeeName?$top=2", line.getRawRequestUri());
- assertEquals(baseUri, line.getRawBaseUri());
- assertEquals(serviceResolutionUri, line.getRawServiceResolutionUri());
- }
-
- @Test
- public void testOtherBaseUri() throws BatchDeserializerException {
- parseFail("http://otherhost/odata/Employee?$top=2", MessageKeys.INVALID_BASE_URI);
- }
-
- @Test
- public void testInvalidRelative() throws BatchDeserializerException {
- parseFail("/Employee?$top=2", MessageKeys.INVALID_URI);
- }
-
- HttpRequestStatusLine parse(final String uri) throws BatchDeserializerException {
- Line statusline = new Line(HttpMethod.GET.toString().toUpperCase() + SPACE + uri + SPACE + HTTP_VERSION, 0);
- return new HttpRequestStatusLine(statusline, baseUri, serviceResolutionUri);
- }
-
- void parseFail(final String uri, MessageKeys messageKey) {
- try {
- parse(uri);
- fail("Expceted exception");
- } catch (BatchDeserializerException e) {
- assertEquals(messageKey, e.getMessageKey());
- }
- }
-}
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/deserializer/json/ODataJsonDeserializerBasicTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/deserializer/json/ODataJsonDeserializerBasicTest.java
deleted file mode 100644
index f3e22ef..0000000
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/deserializer/json/ODataJsonDeserializerBasicTest.java
+++ /dev/null
@@ -1,44 +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.deserializer.json;
-
-import static org.junit.Assert.assertNotNull;
-
-import org.apache.olingo.commons.api.format.ODataFormat;
-import org.apache.olingo.server.api.OData;
-import org.apache.olingo.server.api.deserializer.ODataDeserializer;
-import org.junit.Test;
-
-public class ODataJsonDeserializerBasicTest {
-
- @Test
- public void checkSupportedJsonFormats() throws Exception {
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
- assertNotNull(deserializer);
- deserializer = null;
-
- deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON_NO_METADATA);
- assertNotNull(deserializer);
- deserializer = null;
-
- deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON_FULL_METADATA);
- assertNotNull(deserializer);
- deserializer = null;
- }
-}
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmActionImplTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmActionImplTest.java
deleted file mode 100644
index f48f05c..0000000
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmActionImplTest.java
+++ /dev/null
@@ -1,156 +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.edm.provider;
-
-import org.apache.olingo.commons.api.edm.EdmAction;
-import org.apache.olingo.commons.api.edm.EdmEntitySet;
-import org.apache.olingo.commons.api.edm.EdmException;
-import org.apache.olingo.commons.api.edm.EdmParameter;
-import org.apache.olingo.commons.api.edm.EdmSingleton;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
-import org.apache.olingo.server.api.edm.provider.Action;
-import org.apache.olingo.server.api.edm.provider.EntitySetPath;
-import org.apache.olingo.server.api.edm.provider.Parameter;
-import org.apache.olingo.server.api.edm.provider.ReturnType;
-import org.junit.Before;
-import org.junit.Test;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-public class EdmActionImplTest {
-
- private EdmAction actionImpl1;
- private EdmAction actionImpl2;
- private EdmAction actionImpl3;
-
- @Before
- public void setup() {
- EdmProviderImpl provider = mock(EdmProviderImpl.class);
- List<Parameter> parameters = new ArrayList<Parameter>();
- parameters.add(new Parameter().setName("Id").setType(new FullQualifiedName("namespace", "name")));
- FullQualifiedName action1Name = new FullQualifiedName("namespace", "action1");
- Action action1 = new Action().setName("action1").setBound(true).setParameters(parameters);
- actionImpl1 = EdmActionImpl.getInstance(provider, action1Name, action1);
-
- FullQualifiedName action2Name = new FullQualifiedName("namespace", "action2");
- FullQualifiedName returnTypeName = new FullQualifiedName("Edm", "String");
- ReturnType returnType = new ReturnType().setType(returnTypeName);
- Action action2 = new Action().setName("action2").setParameters(parameters).setReturnType(returnType);
- actionImpl2 = EdmActionImpl.getInstance(provider, action2Name, action2);
-
- FullQualifiedName action3Name = new FullQualifiedName("namespace", "action3");
- EntitySetPath entitySetPath = new EntitySetPath().setBindingParameter("Id").setPath("path");
- Action action3 =
- new Action().setName("action3").setParameters(parameters).setReturnType(returnType).setEntitySetPath(
- entitySetPath);
- actionImpl3 = EdmActionImpl.getInstance(provider, action3Name, action3);
- }
-
- @Test
- public void action1BasicMethodCalls() {
- assertTrue(actionImpl1.isBound());
- assertEquals(EdmTypeKind.ACTION, actionImpl1.getKind());
- assertNull(actionImpl1.getReturnType());
- // assertEquals("returnName", actionImpl1.getReturnType().getType().getName());
- assertNotNull(actionImpl1.getParameterNames());
-
- for (String name : actionImpl1.getParameterNames()) {
- EdmParameter parameter = actionImpl1.getParameter(name);
- assertNotNull(parameter);
- assertEquals(name, parameter.getName());
- }
-
- assertNull(actionImpl1.getReturnedEntitySet(null));
- assertNull(actionImpl1.getReturnedEntitySet(mock(EdmEntitySet.class)));
- }
-
- @Test
- public void action2BasicMethodCalls() {
- assertFalse(actionImpl2.isBound());
- assertEquals(EdmTypeKind.ACTION, actionImpl2.getKind());
- assertEquals("String", actionImpl2.getReturnType().getType().getName());
- assertNotNull(actionImpl2.getParameterNames());
-
- for (String name : actionImpl2.getParameterNames()) {
- EdmParameter parameter = actionImpl2.getParameter(name);
- assertNotNull(parameter);
- assertEquals(name, parameter.getName());
- }
-
- assertNull(actionImpl2.getReturnedEntitySet(null));
- assertNull(actionImpl2.getReturnedEntitySet(mock(EdmEntitySet.class)));
- }
-
- @Test
- public void action3BasicMethodCalls() {
- assertFalse(actionImpl3.isBound());
- assertEquals(EdmTypeKind.ACTION, actionImpl3.getKind());
- assertEquals("String", actionImpl3.getReturnType().getType().getName());
- assertNotNull(actionImpl3.getParameterNames());
-
- for (String name : actionImpl3.getParameterNames()) {
- EdmParameter parameter = actionImpl3.getParameter(name);
- assertNotNull(parameter);
- assertEquals(name, parameter.getName());
- }
-
- actionImpl3.getReturnedEntitySet(null);
- }
-
- @Test
- public void action3getReturnedEntitySetWithEntitySet() {
- EdmEntitySet set = mock(EdmEntitySet.class);
- when(set.getRelatedBindingTarget("path")).thenReturn(set);
-
- EdmEntitySet returnedEntitySet = actionImpl3.getReturnedEntitySet(set);
-
- assertEquals(set, returnedEntitySet);
- }
-
- @Test(expected = EdmException.class)
- public void action3getReturnedEntitySetWithNullReturn() {
- EdmEntitySet set = mock(EdmEntitySet.class);
- when(set.getRelatedBindingTarget("path")).thenReturn(null);
-
- actionImpl3.getReturnedEntitySet(set);
- fail();
- }
-
- @Test(expected = EdmException.class)
- public void action3getReturnedEntitySetWithSingleton() {
- EdmSingleton singleton = mock(EdmSingleton.class);
- EdmEntitySet set = mock(EdmEntitySet.class);
- when(set.getRelatedBindingTarget("path")).thenReturn(singleton);
-
- actionImpl3.getReturnedEntitySet(set);
- fail();
- }
-
-}
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmActionImportImplTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmActionImportImplTest.java
deleted file mode 100644
index 1b4f82c..0000000
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmActionImportImplTest.java
+++ /dev/null
@@ -1,103 +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.edm.provider;
-
-import org.apache.olingo.commons.api.edm.EdmAction;
-import org.apache.olingo.commons.api.edm.EdmActionImport;
-import org.apache.olingo.commons.api.edm.EdmEntityContainer;
-import org.apache.olingo.commons.api.edm.EdmEntitySet;
-import org.apache.olingo.commons.api.edm.EdmException;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.api.edm.Target;
-import org.apache.olingo.server.api.edm.provider.ActionImport;
-import org.junit.Before;
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-public class EdmActionImportImplTest {
-
- EdmEntityContainer container;
-
- EdmActionImport actionImport;
-
- private EdmAction action;
-
- private EdmEntitySet entitySet;
-
- @Before
- public void setup() {
- FullQualifiedName actionFqn = new FullQualifiedName("namespace", "actionName");
- FullQualifiedName entityContainerFqn = new FullQualifiedName("namespace", "containerName");
- Target target = new Target().setEntityContainer(entityContainerFqn).setTargetName("entitySetName");
- ActionImport providerActionImport =
- new ActionImport().setName("actionImportName").setAction(actionFqn).setEntitySet(target);
-
- EdmProviderImpl edm = mock(EdmProviderImpl.class);
- container = mock(EdmEntityContainer.class);
- when(edm.getEntityContainer(entityContainerFqn)).thenReturn(container);
- action = mock(EdmAction.class);
- when(edm.getUnboundAction(actionFqn)).thenReturn(action);
-
- entitySet = mock(EdmEntitySet.class);
- when(container.getEntitySet("entitySetName")).thenReturn(entitySet);
- actionImport = new EdmActionImportImpl(edm, container, providerActionImport);
- }
-
- @Test
- public void simpleActionTest() {
- assertEquals("actionImportName", actionImport.getName());
- assertTrue(container == actionImport.getEntityContainer());
- assertTrue(action == actionImport.getUnboundAction());
- }
-
- @Test
- public void getReturnedEntitySet() {
- EdmEntitySet returnedEntitySet = actionImport.getReturnedEntitySet();
- assertNotNull(returnedEntitySet);
- assertTrue(returnedEntitySet == entitySet);
-
- // Chaching
- assertTrue(returnedEntitySet == actionImport.getReturnedEntitySet());
- }
-
- @Test(expected = EdmException.class)
- public void getReturnedEntitySetNonExistingContainer() {
- Target target = new Target();
- ActionImport providerActionImport = new ActionImport().setName("actionImportName").setEntitySet(target);
- EdmActionImport actionImport =
- new EdmActionImportImpl(mock(EdmProviderImpl.class), container, providerActionImport);
- actionImport.getReturnedEntitySet();
- }
-
- @Test(expected = EdmException.class)
- public void getReturnedEntitySetNonExistingEntitySet() {
- Target target = new Target();
- ActionImport providerActionImport = new ActionImport().setName("actionImportName").setEntitySet(target);
- EdmProviderImpl edm = mock(EdmProviderImpl.class);
- when(edm.getEntityContainer(null)).thenReturn(container);
- EdmActionImport actionImport = new EdmActionImportImpl(edm, container, providerActionImport);
- actionImport.getReturnedEntitySet();
- }
-
-}
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmComplexTypeImplTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmComplexTypeImplTest.java
deleted file mode 100644
index 8a66230..0000000
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmComplexTypeImplTest.java
+++ /dev/null
@@ -1,166 +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.edm.provider;
-
-import org.apache.olingo.commons.api.edm.EdmComplexType;
-import org.apache.olingo.commons.api.edm.EdmElement;
-import org.apache.olingo.commons.api.edm.EdmException;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-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.NavigationProperty;
-import org.apache.olingo.server.api.edm.provider.Property;
-import org.junit.Before;
-import org.junit.Test;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-public class EdmComplexTypeImplTest {
-
- private EdmComplexType baseType;
-
- private EdmComplexType type;
-
- @Before
- public void setupTypes() throws Exception {
- EdmProvider provider = mock(EdmProvider.class);
- EdmProviderImpl edm = new EdmProviderImpl(provider);
-
- FullQualifiedName baseName = new FullQualifiedName("namespace", "BaseTypeName");
- ComplexType baseComplexType = new ComplexType();
- List<Property> baseProperties = new ArrayList<Property>();
- baseProperties.add(new Property().setName("prop1").setType(EdmPrimitiveTypeKind.String.getFullQualifiedName()));
- List<NavigationProperty> baseNavigationProperties = new ArrayList<NavigationProperty>();
- baseNavigationProperties.add(new NavigationProperty().setName("nav1"));
- baseComplexType.setName("BaseTypeName").setAbstract(false).setOpenType(false).setProperties(baseProperties)
- .setNavigationProperties(baseNavigationProperties);
- when(provider.getComplexType(baseName)).thenReturn(baseComplexType);
-
- baseType = EdmComplexTypeImpl.getInstance(edm, baseName, baseComplexType);
-
- FullQualifiedName name = new FullQualifiedName("namespace", "typeName");
- ComplexType complexType = new ComplexType().setBaseType(baseName);
- List<Property> properties = new ArrayList<Property>();
- properties.add(new Property().setName("prop2").setType(EdmPrimitiveTypeKind.String.getFullQualifiedName()));
- List<NavigationProperty> navigationProperties = new ArrayList<NavigationProperty>();
- navigationProperties.add(new NavigationProperty().setName("nav2"));
- complexType.setName("BaseTypeName").setAbstract(false).setOpenType(false).setProperties(properties)
- .setNavigationProperties(navigationProperties);
- when(provider.getComplexType(name)).thenReturn(complexType);
-
- type = EdmComplexTypeImpl.getInstance(edm, name, complexType);
- }
-
- @Test
- public void noPropertiesAndNoNavPropertiesMustNotResultInException() {
- EdmProviderImpl edm = mock(EdmProviderImpl.class);
- ComplexType complexType = new ComplexType().setName("n");
- EdmComplexTypeImpl.getInstance(edm, new FullQualifiedName("n", "n"), complexType);
- }
-
- @Test
- public void typeMustBeCompatibletoBasetype() {
- assertTrue(type.compatibleTo(baseType));
- }
-
- @Test
- public void baseTypeMustNotBeCompatibleToType() {
- assertFalse(baseType.compatibleTo(type));
- }
-
- @Test(expected = EdmException.class)
- public void nullForCompatibleTypeMustResultInEdmException() {
- assertFalse(type.compatibleTo(null));
- }
-
- @Test
- public void getBaseType() {
- assertNull(baseType.getBaseType());
- assertNotNull(type.getBaseType());
- }
-
- @Test
- public void propertiesBehaviour() {
- List<String> propertyNames = baseType.getPropertyNames();
- assertEquals(1, propertyNames.size());
- assertEquals("prop1", baseType.getProperty("prop1").getName());
- }
-
- @Test
- public void propertiesBehaviourWithBaseType() {
- List<String> propertyNames = type.getPropertyNames();
- assertEquals(2, propertyNames.size());
- assertEquals("prop1", type.getProperty("prop1").getName());
- assertEquals("prop2", type.getProperty("prop2").getName());
- }
-
- @Test
- public void navigationPropertiesBehaviour() {
- List<String> navigationPropertyNames = baseType.getNavigationPropertyNames();
- assertEquals(1, navigationPropertyNames.size());
- assertEquals("nav1", baseType.getProperty("nav1").getName());
- }
-
- @Test
- public void navigationPropertiesBehaviourWithBaseType() {
- List<String> navigationPropertyNames = type.getNavigationPropertyNames();
- assertEquals(2, navigationPropertyNames.size());
- assertEquals("nav1", type.getProperty("nav1").getName());
- assertEquals("nav2", type.getProperty("nav2").getName());
- }
-
- @Test
- public void propertyCaching() {
- EdmElement property = type.getProperty("prop1");
- assertTrue(property == type.getProperty("prop1"));
-
- property = type.getProperty("prop2");
- assertTrue(property == type.getProperty("prop2"));
-
- property = type.getProperty("nav1");
- assertTrue(property == type.getProperty("nav1"));
-
- property = type.getProperty("nav2");
- assertTrue(property == type.getProperty("nav2"));
- }
-
- @Test(expected = EdmException.class)
- public void nonExistingBaseType() throws Exception {
- EdmProvider provider = mock(EdmProvider.class);
- EdmProviderImpl edm = new EdmProviderImpl(provider);
- FullQualifiedName typeWithNonexistingBaseTypeName = new FullQualifiedName("namespace", "typeName");
- ComplexType complexTypeForNonexistingBaseType =
- new ComplexType().setBaseType(new FullQualifiedName("wrong", "wrong"));
- complexTypeForNonexistingBaseType.setName("typeName");
- when(provider.getComplexType(typeWithNonexistingBaseTypeName)).thenReturn(complexTypeForNonexistingBaseType);
- EdmComplexTypeImpl instance =
- EdmComplexTypeImpl.getInstance(edm, typeWithNonexistingBaseTypeName, complexTypeForNonexistingBaseType);
- instance.getBaseType();
- }
-}
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmEntityContainerImplTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmEntityContainerImplTest.java
deleted file mode 100644
index 0889106..0000000
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmEntityContainerImplTest.java
+++ /dev/null
@@ -1,339 +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.edm.provider;
-
-import org.apache.olingo.commons.api.ODataException;
-import org.apache.olingo.commons.api.edm.EdmActionImport;
-import org.apache.olingo.commons.api.edm.EdmEntityContainer;
-import org.apache.olingo.commons.api.edm.EdmEntitySet;
-import org.apache.olingo.commons.api.edm.EdmException;
-import org.apache.olingo.commons.api.edm.EdmFunctionImport;
-import org.apache.olingo.commons.api.edm.EdmSingleton;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.server.api.edm.provider.ActionImport;
-import org.apache.olingo.server.api.edm.provider.EdmProvider;
-import org.apache.olingo.server.api.edm.provider.EntityContainer;
-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.FunctionImport;
-import org.apache.olingo.server.api.edm.provider.Singleton;
-import org.junit.Before;
-import org.junit.Test;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-public class EdmEntityContainerImplTest {
-
- EdmEntityContainer container;
-
- @Before
- public void setup() {
- EdmProvider provider = new CustomProvider();
- EdmProviderImpl edm = new EdmProviderImpl(provider);
- EntityContainerInfo entityContainerInfo =
- new EntityContainerInfo().setContainerName(new FullQualifiedName("space", "name"));
- container = new EdmEntityContainerImpl(edm, provider, entityContainerInfo);
- }
-
- @Test
- public void getAllEntitySetInitial() {
- List<EdmEntitySet> entitySets = container.getEntitySets();
- assertNotNull(entitySets);
- assertEquals(2, entitySets.size());
- }
-
- @Test
- public void getAllEntitySetsAfterOneWasAlreadyLoaded() {
- EdmEntitySet entitySet = container.getEntitySet("entitySetName");
- List<EdmEntitySet> entitySets = container.getEntitySets();
- assertNotNull(entitySets);
- assertEquals(2, entitySets.size());
- boolean contained = false;
- for (EdmEntitySet es : entitySets) {
- // Already loaded entity set must be the same
- if (es.getName().equals("entitySetName")) {
- assertTrue(entitySet == es);
- contained = true;
- }
- }
- if (!contained) {
- fail("Should have found entity set in this list.");
- }
- }
-
- @Test
- public void getAllSingletonsInitial() {
- List<EdmSingleton> singletons = container.getSingletons();
- assertNotNull(singletons);
- assertEquals(2, singletons.size());
- }
-
- @Test
- public void getAllSingletonsAfterOneWasAlreadyLoaded() {
- EdmSingleton singleton = container.getSingleton("singletonName");
- List<EdmSingleton> singletons = container.getSingletons();
- assertNotNull(singletons);
- assertEquals(2, singletons.size());
- boolean contained = false;
- for (EdmSingleton s : singletons) {
- // Already loaded singleton must be the same
- if (s.getName().equals("singletonName")) {
- assertTrue(singleton == s);
- contained = true;
- }
- }
- if (!contained) {
- fail("Should have found singleton in this list.");
- }
- }
-
- @Test
- public void getAllActionImportsInitial() {
- List<EdmActionImport> actionImports = container.getActionImports();
- assertNotNull(actionImports);
- assertEquals(2, actionImports.size());
- }
-
- @Test
- public void getAllActionImportsAfterOneWasAlreadyLoaded() {
- EdmActionImport actionImport = container.getActionImport("actionImportName");
- List<EdmActionImport> actionImports = container.getActionImports();
- assertNotNull(actionImports);
- assertEquals(2, actionImports.size());
- boolean contained = false;
- for (EdmActionImport ai : actionImports) {
- // Already loaded action import must be the same
- if (ai.getName().equals("actionImportName")) {
- assertTrue(actionImport == ai);
- contained = true;
- }
- }
- if (!contained) {
- fail("Should have found action import in this list.");
- }
- }
-
- @Test
- public void getAllFunctionImportsInitial() {
- List<EdmFunctionImport> functionImports = container.getFunctionImports();
- assertNotNull(functionImports);
- assertEquals(2, functionImports.size());
- }
-
- @Test
- public void getAllFunctionImportsAfterOneWasAlreadyLoaded() {
- EdmFunctionImport functionImport = container.getFunctionImport("functionImportName");
- List<EdmFunctionImport> functionImports = container.getFunctionImports();
- assertNotNull(functionImports);
- assertEquals(2, functionImports.size());
- boolean contained = false;
- for (EdmFunctionImport fi : functionImports) {
- // Already loaded function import must be the same
- if (fi.getName().equals("functionImportName")) {
- assertTrue(functionImport == fi);
- contained = true;
- }
- }
- if (!contained) {
- fail("Should have found function import in this list.");
- }
- }
-
- @Test
- public void checkEdmExceptionConversion() throws Exception {
- EdmProvider provider = mock(EdmProvider.class);
- FullQualifiedName containerName = new FullQualifiedName("space", "name");
- when(provider.getEntitySet(containerName, null)).thenThrow(new ODataException("msg"));
- when(provider.getSingleton(containerName, null)).thenThrow(new ODataException("msg"));
- when(provider.getFunctionImport(containerName, null)).thenThrow(new ODataException("msg"));
- when(provider.getActionImport(containerName, null)).thenThrow(new ODataException("msg"));
- EdmProviderImpl edm = new EdmProviderImpl(provider);
- EntityContainerInfo entityContainerInfo =
- new EntityContainerInfo().setContainerName(containerName);
- EdmEntityContainer container = new EdmEntityContainerImpl(edm, provider, entityContainerInfo);
- boolean thrown = false;
- try {
- container.getEntitySet(null);
- } catch (EdmException e) {
- thrown = true;
- }
- if (!thrown) {
- fail("Expected EdmException not thrown");
- }
- try {
- container.getSingleton(null);
- } catch (EdmException e) {
- thrown = true;
- }
- if (!thrown) {
- fail("Expected EdmException not thrown");
- }
- try {
- container.getActionImport(null);
- } catch (EdmException e) {
- thrown = true;
- }
- if (!thrown) {
- fail("Expected EdmException not thrown");
- }
- try {
- container.getFunctionImport(null);
- } catch (EdmException e) {
- thrown = true;
- }
- if (!thrown) {
- fail("Expected EdmException not thrown");
- }
- }
-
- @Test
- public void simpleContainerGetter() {
- assertEquals("name", container.getName());
- assertEquals("space", container.getNamespace());
- }
-
- @Test
- public void getExistingFunctionImport() {
- EdmFunctionImport functionImport = container.getFunctionImport("functionImportName");
- assertNotNull(functionImport);
- assertEquals("functionImportName", functionImport.getName());
- // Caching
- assertTrue(functionImport == container.getFunctionImport("functionImportName"));
- }
-
- @Test
- public void getNonExistingFunctionImport() {
- assertNull(container.getFunctionImport(null));
- }
-
- @Test
- public void getExistingActionImport() {
- EdmActionImport actionImport = container.getActionImport("actionImportName");
- assertNotNull(actionImport);
- assertEquals("actionImportName", actionImport.getName());
- // Caching
- assertTrue(actionImport == container.getActionImport("actionImportName"));
- }
-
- @Test
- public void getNonExistingActionImport() {
- assertNull(container.getActionImport(null));
- }
-
- @Test
- public void getExistingSingleton() {
- EdmSingleton singleton = container.getSingleton("singletonName");
- assertNotNull(singleton);
- assertEquals("singletonName", singleton.getName());
- // Caching
- assertTrue(singleton == container.getSingleton("singletonName"));
- }
-
- @Test
- public void getNonExistingSingleton() {
- assertNull(container.getSingleton(null));
- }
-
- @Test
- public void getExistingEntitySet() {
- EdmEntitySet entitySet = container.getEntitySet("entitySetName");
- assertNotNull(entitySet);
- assertEquals("entitySetName", entitySet.getName());
- // Caching
- assertTrue(entitySet == container.getEntitySet("entitySetName"));
- }
-
- @Test
- public void getNonExistingEntitySet() {
- assertNull(container.getEntitySet(null));
- }
-
- private class CustomProvider extends EdmProvider {
- @Override
- public EntitySet getEntitySet(final FullQualifiedName entityContainer, final String entitySetName)
- throws ODataException {
- if (entitySetName != null) {
- return new EntitySet().setName("entitySetName");
- }
- return null;
- }
-
- @Override
- public Singleton getSingleton(final FullQualifiedName entityContainer, final String singletonName)
- throws ODataException {
- if (singletonName != null) {
- return new Singleton().setName("singletonName");
- }
- return null;
- }
-
- @Override
- public ActionImport getActionImport(final FullQualifiedName entityContainer, final String actionImportName)
- throws ODataException {
- if (actionImportName != null) {
- return new ActionImport().setName("actionImportName");
- }
- return null;
- }
-
- @Override
- public FunctionImport getFunctionImport(final FullQualifiedName entityContainer, final String functionImportName)
- throws ODataException {
- if (functionImportName != null) {
- return new FunctionImport().setName("functionImportName");
- }
- return null;
- }
-
- @Override
- public EntityContainer getEntityContainer() throws ODataException {
- EntityContainer container = new EntityContainer();
- List<EntitySet> entitySets = new ArrayList<EntitySet>();
- entitySets.add(new EntitySet().setName("entitySetName"));
- entitySets.add(new EntitySet().setName("entitySetName2"));
- container.setEntitySets(entitySets);
-
- List<Singleton> singletons = new ArrayList<Singleton>();
- singletons.add(new Singleton().setName("singletonName"));
- singletons.add(new Singleton().setName("singletonName2"));
- container.setSingletons(singletons);
-
- List<ActionImport> actionImports = new ArrayList<ActionImport>();
- actionImports.add(new ActionImport().setName("actionImportName"));
- actionImports.add(new ActionImport().setName("actionImportName2"));
- container.setActionImports(actionImports);
-
- List<FunctionImport> functionImports = new ArrayList<FunctionImport>();
- functionImports.add(new FunctionImport().setName("functionImportName"));
- functionImports.add(new FunctionImport().setName("functionImportName2"));
- container.setFunctionImports(functionImports);
-
- return container;
- }
- }
-}
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmEntitySetImplTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmEntitySetImplTest.java
deleted file mode 100644
index 539e486..0000000
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmEntitySetImplTest.java
+++ /dev/null
@@ -1,81 +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.edm.provider;
-
-import org.apache.olingo.commons.api.edm.EdmBindingTarget;
-import org.apache.olingo.commons.api.edm.EdmEntityContainer;
-import org.apache.olingo.commons.api.edm.EdmEntitySet;
-import org.apache.olingo.commons.api.edm.EdmEntityType;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.api.edm.Target;
-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.NavigationPropertyBinding;
-import org.apache.olingo.server.api.edm.provider.PropertyRef;
-import org.junit.Test;
-
-import java.util.Arrays;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-public class EdmEntitySetImplTest {
-
- @Test
- public void entitySet() throws Exception {
- EdmProvider provider = mock(EdmProvider.class);
- EdmProviderImpl edm = new EdmProviderImpl(provider);
-
- final FullQualifiedName typeName = new FullQualifiedName("ns", "entityType");
- final EntityType entityTypeProvider = new EntityType()
- .setName(typeName.getName())
- .setKey(Arrays.asList(new PropertyRef().setPropertyName("Id")));
- when(provider.getEntityType(typeName)).thenReturn(entityTypeProvider);
-
- final FullQualifiedName containerName = new FullQualifiedName("ns", "container");
- final EntityContainerInfo containerInfo = new EntityContainerInfo().setContainerName(containerName);
- when(provider.getEntityContainerInfo(containerName)).thenReturn(containerInfo);
- final EdmEntityContainer entityContainer = new EdmEntityContainerImpl(edm, provider, containerInfo);
-
- final String entitySetName = "entitySet";
- final EntitySet entitySetProvider = new EntitySet()
- .setName(entitySetName)
- .setType(typeName)
- .setIncludeInServiceDocument(true)
- .setNavigationPropertyBindings(Arrays.asList(
- new NavigationPropertyBinding().setPath("path")
- .setTarget(new Target().setEntityContainer(containerName).setTargetName(entitySetName))));
- when(provider.getEntitySet(containerName, entitySetName)).thenReturn(entitySetProvider);
-
- final EdmEntitySet entitySet = new EdmEntitySetImpl(edm, entityContainer, entitySetProvider);
- assertEquals(entitySetName, entityContainer.getEntitySet(entitySetName).getName());
- assertEquals(entitySetName, entitySet.getName());
- final EdmEntityType entityType = entitySet.getEntityType();
- assertEquals(typeName.getNamespace(), entityType.getNamespace());
- assertEquals(typeName.getName(), entityType.getName());
- assertEquals(entityContainer, entitySet.getEntityContainer());
- assertNull(entitySet.getRelatedBindingTarget(null));
- final EdmBindingTarget target = entitySet.getRelatedBindingTarget("path");
- assertEquals(entitySetName, target.getName());
- }
-}
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmEntityTypeImplTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmEntityTypeImplTest.java
deleted file mode 100644
index 42af891..0000000
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmEntityTypeImplTest.java
+++ /dev/null
@@ -1,383 +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.edm.provider;
-
-import org.apache.olingo.commons.api.edm.EdmComplexType;
-import org.apache.olingo.commons.api.edm.EdmElement;
-import org.apache.olingo.commons.api.edm.EdmEntityType;
-import org.apache.olingo.commons.api.edm.EdmException;
-import org.apache.olingo.commons.api.edm.EdmKeyPropertyRef;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
-import org.apache.olingo.commons.api.edm.EdmProperty;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-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.EntityType;
-import org.apache.olingo.server.api.edm.provider.NavigationProperty;
-import org.apache.olingo.server.api.edm.provider.Property;
-import org.apache.olingo.server.api.edm.provider.PropertyRef;
-import org.junit.Before;
-import org.junit.Test;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-public class EdmEntityTypeImplTest {
-
- private EdmEntityType baseType;
-
- private EdmEntityType typeWithBaseType;
-
- private EdmEntityType typeWithComplexKey;
-
- @Before
- public void setupTypes() throws Exception {
- EdmProvider provider = mock(EdmProvider.class);
- EdmProviderImpl edm = new EdmProviderImpl(provider);
-
- FullQualifiedName baseName = new FullQualifiedName("namespace", "BaseTypeName");
- EntityType baseType = new EntityType();
- baseType.setName(baseName.getName());
- List<Property> properties = new ArrayList<Property>();
- properties.add(new Property().setName("Id").setType(EdmPrimitiveTypeKind.String.getFullQualifiedName()));
- properties.add(new Property().setName("Name").setType(EdmPrimitiveTypeKind.String.getFullQualifiedName()));
- baseType.setProperties(properties);
- List<PropertyRef> key = new ArrayList<PropertyRef>();
- key.add(new PropertyRef().setPropertyName("Id"));
- baseType.setKey(key);
- List<NavigationProperty> navigationProperties = new ArrayList<NavigationProperty>();
- navigationProperties.add(new NavigationProperty().setName("nav1"));
- baseType.setNavigationProperties(navigationProperties);
- when(provider.getEntityType(baseName)).thenReturn(baseType);
-
- this.baseType = EdmEntityTypeImpl.getInstance(edm, baseName, baseType);
-
- FullQualifiedName typeName = new FullQualifiedName("namespace", "typeName");
- EntityType type = new EntityType();
- type.setName(typeName.getName());
- type.setBaseType(baseName);
- List<Property> typeProperties = new ArrayList<Property>();
- typeProperties.add(new Property().setName("address").setType(EdmPrimitiveTypeKind.String.getFullQualifiedName()));
- typeProperties.add(new Property().setName("email").setType(EdmPrimitiveTypeKind.String.getFullQualifiedName()));
- type.setProperties(typeProperties);
- List<NavigationProperty> typeNavigationProperties = new ArrayList<NavigationProperty>();
- typeNavigationProperties.add(new NavigationProperty().setName("nav2"));
- type.setNavigationProperties(typeNavigationProperties);
- when(provider.getEntityType(typeName)).thenReturn(type);
-
- typeWithBaseType = EdmEntityTypeImpl.getInstance(edm, typeName, type);
-
- FullQualifiedName typeWithComplexKeyName = new FullQualifiedName("namespace", "typeName");
- EntityType typeWithComplexKeyProvider = new EntityType();
- typeWithComplexKeyProvider.setName(typeWithComplexKeyName.getName());
- List<Property> typeWithComplexKeyProperties = new ArrayList<Property>();
- typeWithComplexKeyProperties.add(new Property().setName("Id").setType(
- EdmPrimitiveTypeKind.String.getFullQualifiedName()));
-
- List<Property> complexTypeProperties = new ArrayList<Property>();
- complexTypeProperties.add(new Property().setName("ComplexPropName").setType(
- EdmPrimitiveTypeKind.String.getFullQualifiedName()));
- FullQualifiedName complexTypeName = new FullQualifiedName("namespace", "complexTypeName");
- when(provider.getComplexType(complexTypeName)).thenReturn(
- new ComplexType().setName("complexTypeName").setProperties(complexTypeProperties));
-
- typeWithComplexKeyProperties.add(new Property().setName("Comp").setType(complexTypeName));
- typeWithComplexKeyProvider.setProperties(typeWithComplexKeyProperties);
- List<PropertyRef> keyForTypeWithComplexKey = new ArrayList<PropertyRef>();
- keyForTypeWithComplexKey.add(new PropertyRef().setPropertyName("Id"));
- keyForTypeWithComplexKey.add(new PropertyRef().setPropertyName("ComplexPropName").setAlias("alias").setPath(
- "Comp/ComplexPropName"));
- typeWithComplexKeyProvider.setKey(keyForTypeWithComplexKey);
- when(provider.getEntityType(typeWithComplexKeyName)).thenReturn(typeWithComplexKeyProvider);
-
- typeWithComplexKey = EdmEntityTypeImpl.getInstance(edm, typeWithComplexKeyName, typeWithComplexKeyProvider);
- }
-
- @Test
- public void testAbstractBaseTypeWithoutKey() throws Exception {
- EdmProvider provider = mock(EdmProvider.class);
- EdmProviderImpl edm = new EdmProviderImpl(provider);
-
- FullQualifiedName baseName = new FullQualifiedName("namespace", "BaseTypeName");
- EntityType baseType = new EntityType();
- baseType.setName(baseName.getName());
- List<Property> properties = new ArrayList<Property>();
- properties.add(new Property().setName("Id").setType(EdmPrimitiveTypeKind.String.getFullQualifiedName()));
- properties.add(new Property().setName("Name").setType(EdmPrimitiveTypeKind.String.getFullQualifiedName()));
- baseType.setProperties(properties);
- List<NavigationProperty> navigationProperties = new ArrayList<NavigationProperty>();
- navigationProperties.add(new NavigationProperty().setName("nav1"));
- baseType.setNavigationProperties(navigationProperties);
- when(provider.getEntityType(baseName)).thenReturn(baseType);
- baseType.setAbstract(true);
- EdmEntityType edmAbstarctBaseType = EdmEntityTypeImpl.getInstance(edm, baseName, baseType);
-
- assertEquals(2, edmAbstarctBaseType.getPropertyNames().size());
- assertEquals("Id", edmAbstarctBaseType.getPropertyNames().get(0));
- assertEquals("Name", edmAbstarctBaseType.getPropertyNames().get(1));
-
- FullQualifiedName typeName = new FullQualifiedName("namespace", "typeName");
- EntityType type = new EntityType();
- type.setName(typeName.getName());
- type.setBaseType(baseName);
- List<Property> typeProperties = new ArrayList<Property>();
- typeProperties.add(new Property().setName("address").setType(EdmPrimitiveTypeKind.String.getFullQualifiedName()));
- typeProperties.add(new Property().setName("email").setType(EdmPrimitiveTypeKind.String.getFullQualifiedName()));
- type.setProperties(typeProperties);
- List<PropertyRef> key = new ArrayList<PropertyRef>();
- key.add(new PropertyRef().setPropertyName("email"));
- type.setKey(key);
- List<NavigationProperty> typeNavigationProperties = new ArrayList<NavigationProperty>();
- typeNavigationProperties.add(new NavigationProperty().setName("nav2"));
- type.setNavigationProperties(typeNavigationProperties);
- when(provider.getEntityType(typeName)).thenReturn(type);
-
- EdmEntityType edmType = EdmEntityTypeImpl.getInstance(edm, typeName, type);
-
- assertNotNull(edmType.getBaseType());
- assertEquals(2, edmAbstarctBaseType.getPropertyNames().size());
-
- assertEquals(1, edmType.getKeyPropertyRefs().size());
- assertEquals("email", edmType.getKeyPredicateNames().get(0));
-
- assertEquals(4, edmType.getPropertyNames().size());
- assertEquals("Id", edmType.getPropertyNames().get(0));
- assertEquals("Name", edmType.getPropertyNames().get(1));
- assertEquals("address", edmType.getPropertyNames().get(2));
- assertEquals("email", edmType.getPropertyNames().get(3));
-
- assertEquals(2, edmType.getNavigationPropertyNames().size());
- assertEquals("nav1", edmType.getNavigationPropertyNames().get(0));
- assertEquals("nav2", edmType.getNavigationPropertyNames().get(1));
- }
-
- @Test
- public void testAbstractBaseTypeWithtKey() throws Exception {
- EdmProvider provider = mock(EdmProvider.class);
- EdmProviderImpl edm = new EdmProviderImpl(provider);
-
- FullQualifiedName baseName = new FullQualifiedName("namespace", "BaseTypeName");
- EntityType baseType = new EntityType();
- baseType.setName(baseName.getName());
- List<Property> properties = new ArrayList<Property>();
- properties.add(new Property().setName("Id").setType(EdmPrimitiveTypeKind.String.getFullQualifiedName()));
- properties.add(new Property().setName("Name").setType(EdmPrimitiveTypeKind.String.getFullQualifiedName()));
- baseType.setProperties(properties);
- List<PropertyRef> key = new ArrayList<PropertyRef>();
- key.add(new PropertyRef().setPropertyName("Id"));
- baseType.setKey(key);
- List<NavigationProperty> navigationProperties = new ArrayList<NavigationProperty>();
- navigationProperties.add(new NavigationProperty().setName("nav1"));
- baseType.setNavigationProperties(navigationProperties);
- when(provider.getEntityType(baseName)).thenReturn(baseType);
- baseType.setAbstract(true);
- EdmEntityType edmAbstarctBaseType = EdmEntityTypeImpl.getInstance(edm, baseName, baseType);
-
- FullQualifiedName typeName = new FullQualifiedName("namespace", "typeName");
- EntityType type = new EntityType();
- type.setName(typeName.getName());
- type.setBaseType(baseName);
- List<Property> typeProperties = new ArrayList<Property>();
- typeProperties.add(new Property().setName("address").setType(EdmPrimitiveTypeKind.String.getFullQualifiedName()));
- typeProperties.add(new Property().setName("email").setType(EdmPrimitiveTypeKind.String.getFullQualifiedName()));
- type.setProperties(typeProperties);
- List<NavigationProperty> typeNavigationProperties = new ArrayList<NavigationProperty>();
- typeNavigationProperties.add(new NavigationProperty().setName("nav2"));
- type.setNavigationProperties(typeNavigationProperties);
- when(provider.getEntityType(typeName)).thenReturn(type);
- EdmEntityType edmType = EdmEntityTypeImpl.getInstance(edm, typeName, type);
-
- assertNotNull(edmType.getBaseType());
- assertEquals(2, edmAbstarctBaseType.getPropertyNames().size());
-
- assertEquals(1, edmType.getKeyPropertyRefs().size());
- assertEquals("Id", edmType.getKeyPredicateNames().get(0));
-
- assertEquals(4, edmType.getPropertyNames().size());
- assertEquals("Id", edmType.getPropertyNames().get(0));
- assertEquals("Name", edmType.getPropertyNames().get(1));
- assertEquals("address", edmType.getPropertyNames().get(2));
- assertEquals("email", edmType.getPropertyNames().get(3));
-
- assertEquals(2, edmType.getNavigationPropertyNames().size());
- assertEquals("nav1", edmType.getNavigationPropertyNames().get(0));
- assertEquals("nav2", edmType.getNavigationPropertyNames().get(1));
- }
-
- @Test
- public void hasStream() {
- assertFalse(typeWithBaseType.hasStream());
- }
-
- @Test
- public void complexKeyWithAlias() {
- List<String> keyPredicateNames = typeWithComplexKey.getKeyPredicateNames();
- assertEquals(2, keyPredicateNames.size());
- assertEquals("Id", keyPredicateNames.get(0));
- assertEquals("alias", keyPredicateNames.get(1));
-
- EdmKeyPropertyRef keyPropertyRef = typeWithComplexKey.getKeyPropertyRef("Id");
- assertNotNull(keyPropertyRef);
- assertEquals("Id", keyPropertyRef.getKeyPropertyName());
- assertNull(keyPropertyRef.getAlias());
- EdmProperty keyProperty = keyPropertyRef.getProperty();
- assertNotNull(keyProperty);
- assertEquals(typeWithComplexKey.getProperty("Id"), keyProperty);
-
- keyPropertyRef = typeWithComplexKey.getKeyPropertyRef("alias");
- assertNotNull(keyPropertyRef);
- assertEquals("ComplexPropName", keyPropertyRef.getKeyPropertyName());
- assertEquals("alias", keyPropertyRef.getAlias());
- assertEquals("Comp/ComplexPropName", keyPropertyRef.getPath());
-
- keyProperty = keyPropertyRef.getProperty();
- assertNotNull(keyProperty);
- EdmElement complexProperty = typeWithComplexKey.getProperty("Comp");
- EdmComplexType complexType = (EdmComplexType) complexProperty.getType();
- assertNotNull(complexType);
- assertEquals(complexType.getProperty("ComplexPropName"), keyProperty);
- }
-
- @Test
- public void keyBehaviour() {
- List<String> keyPredicateNames = baseType.getKeyPredicateNames();
- assertEquals(1, keyPredicateNames.size());
- assertEquals("Id", keyPredicateNames.get(0));
-
- EdmKeyPropertyRef keyPropertyRef = baseType.getKeyPropertyRef("Id");
- assertNotNull(keyPropertyRef);
- assertEquals("Id", keyPropertyRef.getKeyPropertyName());
- assertNull(keyPropertyRef.getAlias());
-
- EdmProperty keyProperty = keyPropertyRef.getProperty();
- assertNotNull(keyProperty);
- assertEquals(baseType.getProperty("Id"), keyProperty);
-
- List<EdmKeyPropertyRef> keyPropertyRefs = baseType.getKeyPropertyRefs();
- assertNotNull(keyPropertyRefs);
- assertEquals(1, keyPropertyRefs.size());
- assertEquals("Id", keyPropertyRefs.get(0).getKeyPropertyName());
- }
-
- @Test
- public void keyBehaviourWithBasetype() {
- List<String> keyPredicateNames = typeWithBaseType.getKeyPredicateNames();
- assertEquals(1, keyPredicateNames.size());
- assertEquals("Id", keyPredicateNames.get(0));
-
- EdmKeyPropertyRef keyPropertyRef = typeWithBaseType.getKeyPropertyRef("Id");
- assertNotNull(keyPropertyRef);
- assertEquals("Id", keyPropertyRef.getKeyPropertyName());
- assertNull(keyPropertyRef.getAlias());
-
- List<EdmKeyPropertyRef> keyPropertyRefs = typeWithBaseType.getKeyPropertyRefs();
- assertNotNull(keyPropertyRefs);
- assertEquals(1, keyPropertyRefs.size());
- assertEquals("Id", keyPropertyRefs.get(0).getKeyPropertyName());
- assertTrue(keyPropertyRefs == typeWithBaseType.getKeyPropertyRefs());
- }
-
- @Test
- public void getBaseType() {
- assertNull(baseType.getBaseType());
- assertNotNull(typeWithBaseType.getBaseType());
- }
-
- @Test
- public void propertiesBehaviour() {
- List<String> propertyNames = baseType.getPropertyNames();
- assertEquals(2, propertyNames.size());
- assertEquals("Id", baseType.getProperty("Id").getName());
- assertEquals("Name", baseType.getProperty("Name").getName());
- }
-
- @Test
- public void propertiesBehaviourWithBaseType() {
- List<String> propertyNames = typeWithBaseType.getPropertyNames();
- assertEquals(4, propertyNames.size());
- assertEquals("Id", typeWithBaseType.getProperty("Id").getName());
- assertEquals("Name", typeWithBaseType.getProperty("Name").getName());
- assertEquals("address", typeWithBaseType.getProperty("address").getName());
- assertEquals("email", typeWithBaseType.getProperty("email").getName());
- }
-
- @Test
- public void navigationPropertiesBehaviour() {
- List<String> navigationPropertyNames = baseType.getNavigationPropertyNames();
- assertEquals(1, navigationPropertyNames.size());
- assertEquals("nav1", baseType.getProperty("nav1").getName());
- }
-
- @Test
- public void navigationPropertiesBehaviourWithBaseType() {
- List<String> navigationPropertyNames = typeWithBaseType.getNavigationPropertyNames();
- assertEquals(2, navigationPropertyNames.size());
- assertEquals("nav1", typeWithBaseType.getProperty("nav1").getName());
- assertEquals("nav2", typeWithBaseType.getProperty("nav2").getName());
- }
-
- @Test
- public void propertyCaching() {
- EdmElement property = typeWithBaseType.getProperty("Id");
- assertTrue(property == typeWithBaseType.getProperty("Id"));
-
- property = typeWithBaseType.getProperty("address");
- assertTrue(property == typeWithBaseType.getProperty("address"));
-
- property = typeWithBaseType.getProperty("nav1");
- assertTrue(property == typeWithBaseType.getProperty("nav1"));
-
- property = typeWithBaseType.getProperty("nav2");
- assertTrue(property == typeWithBaseType.getProperty("nav2"));
- }
-
- @Test
- public void abstractTypeDoesNotNeedKey() {
- EdmProviderImpl edm = mock(EdmProviderImpl.class);
- EntityType entityType = new EntityType().setName("n").setAbstract(true);
- EdmEntityTypeImpl.getInstance(edm, new FullQualifiedName("n", "n"), entityType);
- }
-
- @Test(expected = EdmException.class)
- public void invalidBaseType() {
- EdmProviderImpl edm = mock(EdmProviderImpl.class);
- EntityType entityType = new EntityType().setName("n").setBaseType(new FullQualifiedName("wrong", "wrong"));
- EdmEntityTypeImpl instance = EdmEntityTypeImpl.getInstance(edm, new FullQualifiedName("n", "n"), entityType);
- instance.getBaseType();
- }
-
- @Test
- public void abstractTypeWithAbstractBaseTypeDoesNotNeedKey() throws Exception {
- EdmProvider provider = mock(EdmProvider.class);
- EdmProviderImpl edm = new EdmProviderImpl(provider);
- FullQualifiedName baseName = new FullQualifiedName("n", "base");
- when(provider.getEntityType(baseName)).thenReturn(new EntityType().setName("base").setAbstract(true));
- EntityType entityType = new EntityType().setName("n").setAbstract(true).setBaseType(baseName);
- EdmEntityTypeImpl.getInstance(edm, new FullQualifiedName("n", "n"), entityType);
- }
-
-}
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmEnumTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmEnumTest.java
deleted file mode 100644
index 091a55b..0000000
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmEnumTest.java
+++ /dev/null
@@ -1,236 +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.edm.provider;
-
-import org.apache.olingo.commons.api.edm.EdmEnumType;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
-import org.apache.olingo.server.api.edm.provider.EnumMember;
-import org.apache.olingo.server.api.edm.provider.EnumType;
-import org.junit.Test;
-
-import java.util.Arrays;
-import java.util.List;
-
-import static org.hamcrest.CoreMatchers.containsString;
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-import static org.mockito.Mockito.mock;
-
-public class EdmEnumTest {
-
- private final EdmEnumType instance;
- private final EdmEnumType nonFlagsInstance;
-
- public EdmEnumTest() {
- final List<EnumMember> memberList = Arrays.asList(
- new EnumMember().setName("first").setValue("1"),
- new EnumMember().setName("second").setValue("64"));
-
- final FullQualifiedName enumName = new FullQualifiedName("namespace", "name");
-
- instance = new EdmEnumTypeImpl(mock(EdmProviderImpl.class), enumName,
- new EnumType().setName("name").setMembers(memberList).setFlags(true)
- .setUnderlyingType(EdmPrimitiveTypeKind.SByte.getFullQualifiedName()));
-
- nonFlagsInstance = new EdmEnumTypeImpl(mock(EdmProviderImpl.class), enumName,
- new EnumType().setName("name").setMembers(memberList).setFlags(false)
- .setUnderlyingType(EdmPrimitiveTypeKind.SByte.getFullQualifiedName()));
- }
-
- @Test
- public void nameSpace() throws Exception {
- assertEquals("namespace", instance.getNamespace());
- }
-
- @Test
- public void name() throws Exception {
- assertEquals("name", instance.getName());
- }
-
- @Test
- public void kind() throws Exception {
- assertEquals(EdmTypeKind.ENUM, instance.getKind());
- }
-
- @Test
- public void compatibility() {
- assertTrue(instance.isCompatible(instance));
- assertFalse(instance.isCompatible(instance.getUnderlyingType()));
- }
-
- @Test
- public void defaultType() throws Exception {
- assertEquals(Byte.class, instance.getDefaultType());
- }
-
- @Test
- public void members() throws Exception {
- assertArrayEquals(new String[] { "first", "second" }, instance.getMemberNames().toArray());
- assertEquals("64", instance.getMember("second").getValue());
- assertNull(instance.getMember("notExisting"));
- }
-
- @Test
- public void underlyingType() throws Exception {
- assertEquals(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.SByte), instance.getUnderlyingType());
- }
-
- @Test
- public void validate() throws Exception {
- assertTrue(instance.validate(null, null, null, null, null, null));
- assertTrue(instance.validate(null, true, null, null, null, null));
- assertFalse(instance.validate(null, false, null, null, null, null));
- assertFalse(instance.validate("", null, null, null, null, null));
- assertFalse(instance.validate("something", null, null, null, null, null));
-
- assertTrue(instance.validate("second", null, null, null, null, null));
- assertTrue(instance.validate("first,second", null, null, null, null, null));
- assertTrue(instance.validate("64", null, null, null, null, null));
- assertTrue(instance.validate("1,64", null, null, null, null, null));
- }
-
- @Test
- public void toUriLiteral() throws Exception {
- assertNull(instance.toUriLiteral(null));
- assertEquals("namespace.name'first'", instance.toUriLiteral("first"));
- }
-
- @Test
- public void fromUriLiteral() throws Exception {
- assertNull(instance.fromUriLiteral(null));
- assertEquals("first", instance.fromUriLiteral("namespace.name'first'"));
-
- expectErrorInFromUriLiteral(instance, "");
- expectErrorInFromUriLiteral(instance, "name'first'");
- expectErrorInFromUriLiteral(instance, "namespace.name'first");
- expectErrorInFromUriLiteral(instance, "namespace.namespace'first");
- }
-
- @Test
- public void valueToString() throws Exception {
- assertNull(instance.valueToString(null, null, null, null, null, null));
- assertNull(instance.valueToString(null, true, null, null, null, null));
- assertEquals("first", instance.valueToString(1, null, null, null, null, null));
- assertEquals("first", instance.valueToString((byte) 1, null, null, null, null, null));
- assertEquals("first", instance.valueToString((short) 1, null, null, null, null, null));
- assertEquals("second", instance.valueToString(Integer.valueOf(64), null, null, null, null, null));
- assertEquals("second", instance.valueToString(64L, null, null, null, null, null));
- assertEquals("first,second", instance.valueToString(65, null, null, null, null, null));
-
- expectNullErrorInValueToString(instance);
- expectContentErrorInValueToString(instance, 3);
- expectTypeErrorInValueToString(instance, 1.0);
- }
-
- @Test
- public void valueOfString() throws Exception {
- assertNull(instance.valueOfString(null, null, null, null, null, null, Byte.class));
- assertNull(instance.valueOfString(null, true, null, null, null, null, Byte.class));
- assertEquals(Short.valueOf((short) 1), instance.valueOfString("1", null, null, null, null, null, Short.class));
- assertEquals(Integer.valueOf(1), instance.valueOfString("1", null, null, null, null, null, Integer.class));
- assertEquals(Long.valueOf(64L), instance.valueOfString("64", null, null, null, null, null, Long.class));
- assertEquals(Long.valueOf(1), instance.valueOfString("first", null, null, null, null, null, Long.class));
- assertEquals(Byte.valueOf((byte) 65), instance.valueOfString("first,64", null, null, null, null, null, Byte.class));
- assertEquals(Integer.valueOf(1), instance.valueOfString("1,1,first", null, null, null, null, null, Integer.class));
-
- assertEquals(Integer.valueOf(1), nonFlagsInstance.valueOfString("1", null, null, null, null, null, Integer.class));
- expectContentErrorInValueOfString(nonFlagsInstance, "1,64");
-
- expectNullErrorInValueOfString(instance);
- expectContentErrorInValueOfString(instance, "2");
- expectContentErrorInValueOfString(instance, "1,");
- expectContentErrorInValueOfString(instance, ",1");
- expectTypeErrorInValueOfString(instance, "1");
- }
-
- protected void expectErrorInFromUriLiteral(final EdmPrimitiveType instance, final String value) {
- try {
- instance.fromUriLiteral(value);
- fail("Expected exception not thrown");
- } catch (final EdmPrimitiveTypeException e) {
- assertNotNull(e.getLocalizedMessage());
- assertThat(e.getLocalizedMessage(), containsString("' has illegal content."));
- }
- }
-
- private void expectErrorInValueToString(final EdmPrimitiveType instance,
- final Object value, final Boolean isNullable, final Integer maxLength,
- final Integer precision, final Integer scale, final Boolean isUnicode,
- final String message) {
- try {
- instance.valueToString(value, isNullable, maxLength, precision, scale, isUnicode);
- fail("Expected exception not thrown");
- } catch (final EdmPrimitiveTypeException e) {
- assertNotNull(e.getLocalizedMessage());
- assertThat(e.getLocalizedMessage(), containsString(message));
- }
- }
-
- protected void expectNullErrorInValueToString(final EdmPrimitiveType instance) {
- expectErrorInValueToString(instance, null, false, null, null, null, null, "The value NULL is not allowed.");
- }
-
- protected void expectTypeErrorInValueToString(final EdmPrimitiveType instance, final Object value) {
- expectErrorInValueToString(instance, value, null, null, null, null, null, "value type");
- }
-
- protected void expectContentErrorInValueToString(final EdmPrimitiveType instance, final Object value) {
- expectErrorInValueToString(instance, value, null, null, null, null, null, "' is not valid.");
- }
-
- private void expectErrorInValueOfString(final EdmPrimitiveType instance,
- final String value, final Boolean isNullable, final Integer maxLength, final Integer precision,
- final Integer scale, final Boolean isUnicode, final Class<?> returnType,
- final String message) {
-
- try {
- instance.valueOfString(value, isNullable, maxLength, precision, scale, isUnicode, returnType);
- fail("Expected exception not thrown");
- } catch (final EdmPrimitiveTypeException e) {
- assertNotNull(e.getLocalizedMessage());
- assertThat(e.getLocalizedMessage(), containsString(message));
- }
- }
-
- protected void expectTypeErrorInValueOfString(final EdmPrimitiveType instance, final String value) {
- expectErrorInValueOfString(instance, value, null, null, null, null, null, Class.class,
- "The value type class java.lang.Class is not supported.");
- }
-
- protected void expectContentErrorInValueOfString(final EdmPrimitiveType instance, final String value) {
- expectErrorInValueOfString(instance, value, null, null, null, null, null, instance.getDefaultType(),
- "illegal content");
- }
-
- protected void expectNullErrorInValueOfString(final EdmPrimitiveType instance) {
- expectErrorInValueOfString(instance, null, false, null, null, null, null, instance.getDefaultType(),
- "The literal 'null' is not allowed.");
- }
-}
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmFunctionImplTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmFunctionImplTest.java
deleted file mode 100644
index 30a6394..0000000
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmFunctionImplTest.java
+++ /dev/null
@@ -1,75 +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.edm.provider;
-
-import org.apache.olingo.commons.api.edm.EdmException;
-import org.apache.olingo.commons.api.edm.EdmFunction;
-import org.apache.olingo.commons.api.edm.EdmReturnType;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.server.api.edm.provider.Function;
-import org.apache.olingo.server.api.edm.provider.ReturnType;
-import org.junit.Before;
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-import static org.mockito.Mockito.mock;
-
-public class EdmFunctionImplTest {
-
- private EdmFunction functionImpl1;
- private EdmFunction functionImpl2;
-
- @Before
- public void setupFunctions() {
- EdmProviderImpl provider = mock(EdmProviderImpl.class);
-
- Function function1 = new Function().setReturnType(new ReturnType().setType(new FullQualifiedName("Edm", "String")));
- functionImpl1 = EdmFunctionImpl.getInstance(provider, new FullQualifiedName("namespace", "name"), function1);
- Function function2 = new Function().setComposable(true);
- functionImpl2 = EdmFunctionImpl.getInstance(provider, new FullQualifiedName("namespace", "name"), function2);
- }
-
- @Test
- public void isComposableDefaultFalse() {
- assertFalse(functionImpl1.isComposable());
- }
-
- @Test
- public void isComposableSetToTrue() {
- assertTrue(functionImpl2.isComposable());
- }
-
- @Test
- public void existingReturnTypeGetsReturned() {
- EdmReturnType returnType = functionImpl1.getReturnType();
- assertNotNull(returnType);
- assertEquals("String", returnType.getType().getName());
- }
-
- @Test(expected = EdmException.class)
- public void nonExistingReturnTypeResultsInException() {
- functionImpl2.getReturnType();
- fail();
- }
-
-}
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmFunctionImportImplTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmFunctionImportImplTest.java
deleted file mode 100644
index a653ccb..0000000
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmFunctionImportImplTest.java
+++ /dev/null
@@ -1,85 +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.edm.provider;
-
-import org.apache.olingo.commons.api.edm.EdmEntityContainer;
-import org.apache.olingo.commons.api.edm.EdmFunction;
-import org.apache.olingo.commons.api.edm.EdmFunctionImport;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
-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.Function;
-import org.apache.olingo.server.api.edm.provider.FunctionImport;
-import org.apache.olingo.server.api.edm.provider.Parameter;
-import org.apache.olingo.server.api.edm.provider.ReturnType;
-import org.junit.Test;
-
-import java.util.Arrays;
-import java.util.Collections;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNull;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-public class EdmFunctionImportImplTest {
-
- @Test
- public void functionImport() throws Exception {
- EdmProvider provider = mock(EdmProvider.class);
- EdmProviderImpl edm = new EdmProviderImpl(provider);
-
- final FullQualifiedName functionName = new FullQualifiedName("ns", "function");
- final Function functionProvider = new Function()
- .setName(functionName.getName())
- .setParameters(Collections.<Parameter> emptyList())
- .setBound(false)
- .setComposable(false)
- .setReturnType(new ReturnType().setType(EdmPrimitiveTypeKind.Boolean.getFullQualifiedName()));
- when(provider.getFunctions(functionName)).thenReturn(Arrays.asList(functionProvider));
-
- final FullQualifiedName containerName = new FullQualifiedName("ns", "container");
- final EntityContainerInfo containerInfo = new EntityContainerInfo().setContainerName(containerName);
- when(provider.getEntityContainerInfo(containerName)).thenReturn(containerInfo);
- final EdmEntityContainer entityContainer = new EdmEntityContainerImpl(edm, provider, containerInfo);
-
- final String functionImportName = "functionImport";
- final FunctionImport functionImportProvider = new FunctionImport()
- .setName(functionImportName)
- .setFunction(functionName)
- .setIncludeInServiceDocument(true);
- when(provider.getFunctionImport(containerName, functionImportName)).thenReturn(functionImportProvider);
-
- final EdmFunctionImport functionImport = new EdmFunctionImportImpl(edm, entityContainer, functionImportProvider);
- assertEquals(functionImportName, entityContainer.getFunctionImport(functionImportName).getName());
- assertEquals("functionImport", functionImport.getName());
- final EdmFunction function = functionImport.getUnboundFunction(Collections.<String> emptyList());
- assertEquals(functionName.getNamespace(), function.getNamespace());
- assertEquals(functionName.getName(), function.getName());
- assertFalse(function.isBound());
- assertFalse(function.isComposable());
- assertEquals(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Boolean),
- function.getReturnType().getType());
- assertEquals(entityContainer, functionImport.getEntityContainer());
- assertNull(functionImport.getReturnedEntitySet());
- }
-}
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmKeyPropertyRefImplTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmKeyPropertyRefImplTest.java
deleted file mode 100644
index 2bb62e9..0000000
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmKeyPropertyRefImplTest.java
+++ /dev/null
@@ -1,142 +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.edm.provider;
-
-import org.apache.olingo.commons.api.edm.EdmComplexType;
-import org.apache.olingo.commons.api.edm.EdmElement;
-import org.apache.olingo.commons.api.edm.EdmEntityType;
-import org.apache.olingo.commons.api.edm.EdmException;
-import org.apache.olingo.commons.api.edm.EdmKeyPropertyRef;
-import org.apache.olingo.commons.api.edm.EdmProperty;
-import org.apache.olingo.server.api.edm.provider.PropertyRef;
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-public class EdmKeyPropertyRefImplTest {
-
- @Test
- public void noAlias() {
- PropertyRef providerRef = new PropertyRef().setPropertyName("Id");
- EdmEntityType etMock = mock(EdmEntityType.class);
- EdmProperty keyPropertyMock = mock(EdmProperty.class);
- when(etMock.getStructuralProperty("Id")).thenReturn(keyPropertyMock);
- EdmKeyPropertyRef ref = new EdmKeyPropertyRefImpl(etMock, providerRef);
- assertEquals("Id", ref.getKeyPropertyName());
- assertNull(ref.getAlias());
- assertNull(ref.getPath());
-
- EdmProperty property = ref.getProperty();
- assertNotNull(property);
- assertTrue(property == keyPropertyMock);
- assertTrue(property == ref.getProperty());
- }
-
- @Test
- public void aliasForPropertyInComplexPropertyOneLevel() {
- PropertyRef providerRef = new PropertyRef().setPropertyName("Id").setAlias("alias").setPath("comp/Id");
- EdmEntityType etMock = mock(EdmEntityType.class);
- EdmProperty keyPropertyMock = mock(EdmProperty.class);
- EdmProperty compMock = mock(EdmProperty.class);
- EdmComplexType compTypeMock = mock(EdmComplexType.class);
- when(compTypeMock.getStructuralProperty("Id")).thenReturn(keyPropertyMock);
- when(compMock.getType()).thenReturn(compTypeMock);
- when(etMock.getStructuralProperty("comp")).thenReturn(compMock);
- EdmKeyPropertyRef ref = new EdmKeyPropertyRefImpl(etMock, providerRef);
- assertEquals("alias", ref.getAlias());
- assertEquals("comp/Id", ref.getPath());
-
- EdmProperty property = ref.getProperty();
- assertNotNull(property);
- assertTrue(property == keyPropertyMock);
- }
-
- @Test(expected = EdmException.class)
- public void aliasForPropertyInComplexPropertyButWrongPath() {
- PropertyRef providerRef = new PropertyRef().setPropertyName("Id").setAlias("alias").setPath("comp/wrong");
- EdmEntityType etMock = mock(EdmEntityType.class);
- EdmProperty keyPropertyMock = mock(EdmProperty.class);
- EdmElement compMock = mock(EdmProperty.class);
- EdmComplexType compTypeMock = mock(EdmComplexType.class);
- when(compTypeMock.getProperty("Id")).thenReturn(keyPropertyMock);
- when(compMock.getType()).thenReturn(compTypeMock);
- when(etMock.getProperty("comp")).thenReturn(compMock);
- new EdmKeyPropertyRefImpl(etMock, providerRef).getProperty();
- }
-
- @Test(expected = EdmException.class)
- public void aliasForPropertyInComplexPropertyButWrongPath2() {
- PropertyRef providerRef = new PropertyRef().setPropertyName("Id").setAlias("alias").setPath("wrong/Id");
- EdmEntityType etMock = mock(EdmEntityType.class);
- EdmProperty keyPropertyMock = mock(EdmProperty.class);
- EdmElement compMock = mock(EdmProperty.class);
- EdmComplexType compTypeMock = mock(EdmComplexType.class);
- when(compTypeMock.getProperty("Id")).thenReturn(keyPropertyMock);
- when(compMock.getType()).thenReturn(compTypeMock);
- when(etMock.getProperty("comp")).thenReturn(compMock);
- new EdmKeyPropertyRefImpl(etMock, providerRef).getProperty();
- }
-
- @Test
- public void aliasForPropertyInComplexPropertyTwoLevels() {
- PropertyRef providerRef = new PropertyRef().setPropertyName("Id").setAlias("alias").setPath("comp/comp2/Id");
- EdmEntityType etMock = mock(EdmEntityType.class);
- EdmProperty keyPropertyMock = mock(EdmProperty.class);
- EdmProperty compMock = mock(EdmProperty.class);
- EdmComplexType compTypeMock = mock(EdmComplexType.class);
- EdmProperty comp2Mock = mock(EdmProperty.class);
- EdmComplexType comp2TypeMock = mock(EdmComplexType.class);
- when(comp2TypeMock.getStructuralProperty("Id")).thenReturn(keyPropertyMock);
- when(comp2Mock.getType()).thenReturn(comp2TypeMock);
- when(compTypeMock.getStructuralProperty("comp2")).thenReturn(comp2Mock);
- when(compMock.getType()).thenReturn(compTypeMock);
- when(etMock.getStructuralProperty("comp")).thenReturn(compMock);
- EdmKeyPropertyRef ref = new EdmKeyPropertyRefImpl(etMock, providerRef);
-
- EdmProperty property = ref.getProperty();
- assertNotNull(property);
- assertTrue(property == keyPropertyMock);
- }
-
- @Test(expected = EdmException.class)
- public void oneKeyNoAliasButInvalidProperty() {
- PropertyRef providerRef = new PropertyRef().setPropertyName("Id");
- EdmKeyPropertyRef ref = new EdmKeyPropertyRefImpl(mock(EdmEntityType.class), providerRef);
- ref.getProperty();
- }
-
- @Test(expected = EdmException.class)
- public void aliasButNoPath() {
- PropertyRef providerRef = new PropertyRef().setPropertyName("Id").setAlias("alias");
- EdmKeyPropertyRef ref = new EdmKeyPropertyRefImpl(mock(EdmEntityType.class), providerRef);
- ref.getProperty();
- }
-
- @Test(expected = EdmException.class)
- public void aliasButEmptyPath() {
- PropertyRef providerRef = new PropertyRef().setPropertyName("Id").setAlias("alias").setPath("");
- EdmKeyPropertyRef ref = new EdmKeyPropertyRefImpl(mock(EdmEntityType.class), providerRef);
- ref.getProperty();
- }
-}
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmMemberImplTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmMemberImplTest.java
deleted file mode 100644
index 210ffbb..0000000
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmMemberImplTest.java
+++ /dev/null
@@ -1,39 +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.edm.provider;
-
-import org.apache.olingo.server.api.edm.provider.EnumMember;
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-import static org.mockito.Mockito.mock;
-
-public class EdmMemberImplTest {
-
- @Test
- public void enumMember() {
- final EnumMember member = new EnumMember().setName("name").setValue("value");
- final EdmMemberImpl memberImpl =
- new EdmMemberImpl(mock(EdmProviderImpl.class), null, member.getName(), member.getValue());
-
- assertEquals("name", memberImpl.getName());
- assertEquals("value", memberImpl.getValue());
- }
-
-}
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmNamedImplTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmNamedImplTest.java
deleted file mode 100644
index e5f364f..0000000
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmNamedImplTest.java
+++ /dev/null
@@ -1,42 +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.edm.provider;
-
-import org.apache.olingo.commons.api.edm.EdmNamed;
-import org.apache.olingo.commons.core.edm.EdmNamedImpl;
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-
-public class EdmNamedImplTest {
-
- @Test
- public void getNameTest() {
- EdmNamed obj = new EdmNamedImplTester("Name");
- assertEquals("Name", obj.getName());
- }
-
- private class EdmNamedImplTester extends EdmNamedImpl {
-
- public EdmNamedImplTester(final String name) {
- super(null, name);
- }
- }
-
-}
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmNavigationPropertyImplTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmNavigationPropertyImplTest.java
deleted file mode 100644
index b0f6e78..0000000
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmNavigationPropertyImplTest.java
+++ /dev/null
@@ -1,144 +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.edm.provider;
-
-import org.apache.olingo.commons.api.edm.EdmException;
-import org.apache.olingo.commons.api.edm.EdmNavigationProperty;
-import org.apache.olingo.commons.api.edm.EdmType;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
-import org.apache.olingo.server.api.edm.provider.EdmProvider;
-import org.apache.olingo.server.api.edm.provider.EntityType;
-import org.apache.olingo.server.api.edm.provider.NavigationProperty;
-import org.apache.olingo.server.api.edm.provider.PropertyRef;
-import org.apache.olingo.server.api.edm.provider.ReferentialConstraint;
-import org.junit.Test;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-public class EdmNavigationPropertyImplTest {
-
- @Test
- public void navigationProperty() throws Exception {
- EdmProvider provider = mock(EdmProvider.class);
- EdmProviderImpl edm = new EdmProviderImpl(provider);
- final FullQualifiedName entityTypeName = new FullQualifiedName("ns", "entity");
- EntityType entityTypeProvider = new EntityType();
- entityTypeProvider.setKey(Collections.<PropertyRef> emptyList());
- when(provider.getEntityType(entityTypeName)).thenReturn(entityTypeProvider);
- NavigationProperty propertyProvider = new NavigationProperty();
- propertyProvider.setType(entityTypeName);
- propertyProvider.setNullable(false);
- EdmNavigationProperty property = new EdmNavigationPropertyImpl(edm, entityTypeName, propertyProvider);
- assertFalse(property.isCollection());
- assertFalse(property.isNullable());
- EdmType type = property.getType();
- assertEquals(EdmTypeKind.ENTITY, type.getKind());
- assertEquals("ns", type.getNamespace());
- assertEquals("entity", type.getName());
- assertNull(property.getReferencingPropertyName("referencedPropertyName"));
- assertNull(property.getPartner());
-
- // Test caching
- EdmType cachedType = property.getType();
- assertTrue(type == cachedType);
- }
-
- @Test
- public void navigationPropertyWithReferntialConstraint() throws Exception {
- EdmProvider provider = mock(EdmProvider.class);
- EdmProviderImpl edm = new EdmProviderImpl(provider);
- final FullQualifiedName entityTypeName = new FullQualifiedName("ns", "entity");
- EntityType entityTypeProvider = new EntityType();
- entityTypeProvider.setKey(Collections.<PropertyRef> emptyList());
- when(provider.getEntityType(entityTypeName)).thenReturn(entityTypeProvider);
- NavigationProperty propertyProvider = new NavigationProperty();
- propertyProvider.setType(entityTypeName);
- propertyProvider.setNullable(false);
- List<ReferentialConstraint> referentialConstraints = new ArrayList<ReferentialConstraint>();
- referentialConstraints.add(new ReferentialConstraint().setProperty("property").setReferencedProperty(
- "referencedProperty"));
- propertyProvider.setReferentialConstraints(referentialConstraints);
- EdmNavigationProperty property = new EdmNavigationPropertyImpl(edm, entityTypeName, propertyProvider);
- assertEquals("property", property.getReferencingPropertyName("referencedProperty"));
- assertNull(property.getReferencingPropertyName("wrong"));
- }
-
- @Test
- public void navigationPropertyWithPartner() throws Exception {
- EdmProvider provider = mock(EdmProvider.class);
- EdmProviderImpl edm = new EdmProviderImpl(provider);
- final FullQualifiedName entityTypeName = new FullQualifiedName("ns", "entity");
- EntityType entityTypeProvider = new EntityType();
- entityTypeProvider.setKey(Collections.<PropertyRef> emptyList());
-
- List<NavigationProperty> navigationProperties = new ArrayList<NavigationProperty>();
- navigationProperties.add(new NavigationProperty().setName("partnerName").setType(entityTypeName));
- entityTypeProvider.setNavigationProperties(navigationProperties);
- when(provider.getEntityType(entityTypeName)).thenReturn(entityTypeProvider);
- NavigationProperty propertyProvider = new NavigationProperty();
- propertyProvider.setType(entityTypeName);
- propertyProvider.setNullable(false);
- propertyProvider.setPartner("partnerName");
- EdmNavigationProperty property = new EdmNavigationPropertyImpl(edm, entityTypeName, propertyProvider);
- EdmNavigationProperty partner = property.getPartner();
- assertNotNull(partner);
-
- // Caching
- assertTrue(partner == property.getPartner());
- }
-
- @Test(expected = EdmException.class)
- public void navigationPropertyWithNonexistentPartner() throws Exception {
- EdmProvider provider = mock(EdmProvider.class);
- EdmProviderImpl edm = new EdmProviderImpl(provider);
- final FullQualifiedName entityTypeName = new FullQualifiedName("ns", "entity");
- EntityType entityTypeProvider = new EntityType();
- entityTypeProvider.setKey(Collections.<PropertyRef> emptyList());
-
- List<NavigationProperty> navigationProperties = new ArrayList<NavigationProperty>();
- navigationProperties.add(new NavigationProperty().setName("partnerName").setType(entityTypeName));
- entityTypeProvider.setNavigationProperties(navigationProperties);
- when(provider.getEntityType(entityTypeName)).thenReturn(entityTypeProvider);
- NavigationProperty propertyProvider = new NavigationProperty();
- propertyProvider.setType(entityTypeName);
- propertyProvider.setNullable(false);
- propertyProvider.setPartner("wrong");
- EdmNavigationProperty property = new EdmNavigationPropertyImpl(edm, entityTypeName, propertyProvider);
- property.getPartner();
- }
-
- @Test(expected = EdmException.class)
- public void navigationPropertyWithNonExistentType() throws Exception {
- EdmProviderImpl edm = mock(EdmProviderImpl.class);
- NavigationProperty propertyProvider = new NavigationProperty();
- EdmNavigationProperty property = new EdmNavigationPropertyImpl(edm, null, propertyProvider);
- property.getType();
- }
-}
\ No newline at end of file
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmParameterImplTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmParameterImplTest.java
deleted file mode 100644
index b06c693..0000000
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmParameterImplTest.java
+++ /dev/null
@@ -1,140 +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.edm.provider;
-
-import org.apache.olingo.commons.api.edm.EdmException;
-import org.apache.olingo.commons.api.edm.EdmParameter;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
-import org.apache.olingo.commons.api.edm.EdmType;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
-import org.apache.olingo.server.api.edm.provider.ComplexType;
-import org.apache.olingo.server.api.edm.provider.EdmProvider;
-import org.apache.olingo.server.api.edm.provider.EnumType;
-import org.apache.olingo.server.api.edm.provider.Parameter;
-import org.apache.olingo.server.api.edm.provider.TypeDefinition;
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNull;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-public class EdmParameterImplTest {
-
- @Test
- public void getTypeReturnsPrimitiveType() {
- EdmProviderImpl edm = new EdmProviderImpl(mock(EdmProvider.class));
- Parameter parameterProvider = new Parameter();
- parameterProvider.setType(EdmPrimitiveTypeKind.Binary.getFullQualifiedName());
- final EdmParameter parameter = new EdmParameterImpl(edm, parameterProvider);
- final EdmType type = parameter.getType();
- assertEquals(EdmTypeKind.PRIMITIVE, type.getKind());
- assertEquals(EdmPrimitiveType.EDM_NAMESPACE, type.getNamespace());
- assertEquals(EdmPrimitiveTypeKind.Binary.toString(), type.getName());
- }
-
- @Test
- public void getTypeReturnsComplexType() throws Exception {
- EdmProvider provider = mock(EdmProvider.class);
- EdmProviderImpl edm = new EdmProviderImpl(provider);
- final FullQualifiedName complexTypeName = new FullQualifiedName("ns", "complex");
- ComplexType complexTypeProvider = new ComplexType();
- when(provider.getComplexType(complexTypeName)).thenReturn(complexTypeProvider);
- Parameter parameterProvider = new Parameter();
- parameterProvider.setType(complexTypeName);
- final EdmParameter parameter = new EdmParameterImpl(edm, parameterProvider);
- assertFalse(parameter.isCollection());
- final EdmType type = parameter.getType();
- assertEquals(EdmTypeKind.COMPLEX, type.getKind());
- assertEquals("ns", type.getNamespace());
- assertEquals("complex", type.getName());
- }
-
- @Test
- public void getTypeReturnsEnumType() throws Exception {
- EdmProvider provider = mock(EdmProvider.class);
- EdmProviderImpl edm = new EdmProviderImpl(provider);
- final FullQualifiedName enumTypeName = new FullQualifiedName("ns", "enum");
- EnumType enumTypeProvider = new EnumType();
- when(provider.getEnumType(enumTypeName)).thenReturn(enumTypeProvider);
- Parameter parameterProvider = new Parameter();
- parameterProvider.setType(enumTypeName);
- final EdmParameter parameter = new EdmParameterImpl(edm, parameterProvider);
- assertFalse(parameter.isCollection());
- final EdmType type = parameter.getType();
- assertEquals(EdmTypeKind.ENUM, type.getKind());
- assertEquals("ns", type.getNamespace());
- assertEquals("enum", type.getName());
- }
-
- @Test
- public void getTypeReturnsTypeDefinition() throws Exception {
- EdmProvider provider = mock(EdmProvider.class);
- EdmProviderImpl edm = new EdmProviderImpl(provider);
- final FullQualifiedName typeName = new FullQualifiedName("ns", "definition");
- TypeDefinition typeProvider = new TypeDefinition().setUnderlyingType(new FullQualifiedName("Edm", "String"));
- when(provider.getTypeDefinition(typeName)).thenReturn(typeProvider);
- Parameter parameterProvider = new Parameter();
- parameterProvider.setType(typeName);
- final EdmParameter parameter = new EdmParameterImpl(edm, parameterProvider);
- final EdmType type = parameter.getType();
- assertEquals(EdmTypeKind.DEFINITION, type.getKind());
- assertEquals("ns", type.getNamespace());
- assertEquals("definition", type.getName());
- }
-
- @Test
- public void facets() {
- EdmProviderImpl edm = new EdmProviderImpl(mock(EdmProvider.class));
- Parameter parameterProvider = new Parameter();
- parameterProvider.setType(EdmPrimitiveTypeKind.String.getFullQualifiedName());
- parameterProvider.setPrecision(42);
- parameterProvider.setScale(12);
- parameterProvider.setMaxLength(128);
- parameterProvider.setNullable(false);
- final EdmParameter parameter = new EdmParameterImpl(edm, parameterProvider);
- assertNull(parameter.getMapping());
- assertEquals(Integer.valueOf(42), parameter.getPrecision());
- assertEquals(Integer.valueOf(12), parameter.getScale());
- assertEquals(Integer.valueOf(128), parameter.getMaxLength());
- assertFalse(parameter.isNullable());
- }
-
- @Test(expected = EdmException.class)
- public void getTypeWithInvalidSimpleType() {
- EdmProviderImpl edm = new EdmProviderImpl(mock(EdmProvider.class));
- Parameter parameterProvider = new Parameter();
- parameterProvider.setType(new FullQualifiedName("Edm", "wrong"));
- final EdmParameter parameter = new EdmParameterImpl(edm, parameterProvider);
- parameter.getType();
- }
-
- @Test(expected = EdmException.class)
- public void getTypeWithNonexistingType() {
- EdmProviderImpl edm = new EdmProviderImpl(mock(EdmProvider.class));
- Parameter parameterProvider = new Parameter();
- parameterProvider.setType(new FullQualifiedName("wrong", "wrong"));
- final EdmParameter parameter = new EdmParameterImpl(edm, parameterProvider);
- parameter.getType();
- }
-
-}
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmPropertyImplTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmPropertyImplTest.java
deleted file mode 100644
index d212084..0000000
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmPropertyImplTest.java
+++ /dev/null
@@ -1,155 +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.edm.provider;
-
-import org.apache.olingo.commons.api.edm.EdmException;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
-import org.apache.olingo.commons.api.edm.EdmProperty;
-import org.apache.olingo.commons.api.edm.EdmType;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
-import org.apache.olingo.server.api.edm.provider.ComplexType;
-import org.apache.olingo.server.api.edm.provider.EdmProvider;
-import org.apache.olingo.server.api.edm.provider.EnumType;
-import org.apache.olingo.server.api.edm.provider.Property;
-import org.apache.olingo.server.api.edm.provider.TypeDefinition;
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-public class EdmPropertyImplTest {
-
- @Test
- public void getTypeReturnsPrimitiveType() {
- EdmProviderImpl edm = new EdmProviderImpl(mock(EdmProvider.class));
- Property propertyProvider = new Property();
- propertyProvider.setType(EdmPrimitiveTypeKind.Binary.getFullQualifiedName());
- final EdmProperty property = new EdmPropertyImpl(edm, null, propertyProvider);
- assertTrue(property.isPrimitive());
- final EdmType type = property.getType();
- assertEquals(EdmTypeKind.PRIMITIVE, type.getKind());
- assertEquals(EdmPrimitiveType.EDM_NAMESPACE, type.getNamespace());
- assertEquals(EdmPrimitiveTypeKind.Binary.toString(), type.getName());
- }
-
- @Test
- public void getTypeReturnsComplexType() throws Exception {
- EdmProvider provider = mock(EdmProvider.class);
- EdmProviderImpl edm = new EdmProviderImpl(provider);
- final FullQualifiedName complexTypeName = new FullQualifiedName("ns", "complex");
- ComplexType complexTypeProvider = new ComplexType();
- when(provider.getComplexType(complexTypeName)).thenReturn(complexTypeProvider);
- Property propertyProvider = new Property();
- propertyProvider.setType(complexTypeName);
- final EdmProperty property = new EdmPropertyImpl(edm, complexTypeName, propertyProvider);
- assertFalse(property.isCollection());
- assertFalse(property.isPrimitive());
- final EdmType type = property.getType();
- assertEquals(EdmTypeKind.COMPLEX, type.getKind());
- assertEquals("ns", type.getNamespace());
- assertEquals("complex", type.getName());
- }
-
- @Test
- public void getTypeReturnsEnumType() throws Exception {
- EdmProvider provider = mock(EdmProvider.class);
- EdmProviderImpl edm = new EdmProviderImpl(provider);
- final FullQualifiedName enumTypeName = new FullQualifiedName("ns", "enum");
- EnumType enumTypeProvider = new EnumType();
- when(provider.getEnumType(enumTypeName)).thenReturn(enumTypeProvider);
- Property propertyProvider = new Property();
- propertyProvider.setType(enumTypeName);
- final EdmProperty property = new EdmPropertyImpl(edm, null, propertyProvider);
- assertFalse(property.isCollection());
- assertFalse(property.isPrimitive());
- final EdmType type = property.getType();
- assertEquals(EdmTypeKind.ENUM, type.getKind());
- assertEquals("ns", type.getNamespace());
- assertEquals("enum", type.getName());
- }
-
- @Test
- public void getTypeReturnsTypeDefinition() throws Exception {
- EdmProvider provider = mock(EdmProvider.class);
- EdmProviderImpl edm = new EdmProviderImpl(provider);
- final FullQualifiedName typeName = new FullQualifiedName("ns", "definition");
- TypeDefinition typeProvider = new TypeDefinition().setUnderlyingType(new FullQualifiedName("Edm", "String"));
- when(provider.getTypeDefinition(typeName)).thenReturn(typeProvider);
- Property propertyProvider = new Property();
- propertyProvider.setType(typeName);
- final EdmProperty property = new EdmPropertyImpl(edm, null, propertyProvider);
- assertFalse(property.isPrimitive());
- final EdmType type = property.getType();
- assertEquals(EdmTypeKind.DEFINITION, type.getKind());
- assertEquals("ns", type.getNamespace());
- assertEquals("definition", type.getName());
- }
-
- @Test(expected = EdmException.class)
- public void getTypeReturnsWrongType() throws Exception {
- EdmProvider provider = mock(EdmProvider.class);
- EdmProviderImpl edm = new EdmProviderImpl(provider);
- final Property propertyProvider = new Property()
- .setType(new FullQualifiedName("ns", "wrong"));
- final EdmProperty property = new EdmPropertyImpl(edm, null, propertyProvider);
- property.getType();
- fail();
- }
-
- @Test(expected = EdmException.class)
- public void getTypeReturnsNoTypeKind() throws Exception {
- EdmProvider provider = mock(EdmProvider.class);
- EdmProviderImpl edm = new EdmProviderImpl(provider);
- final Property propertyProvider = new Property()
- .setType(new FullQualifiedName(EdmPrimitiveType.EDM_NAMESPACE, "type"));
- final EdmProperty property = new EdmPropertyImpl(edm, null, propertyProvider);
- property.getType();
- fail();
- }
-
- @Test
- public void facets() {
- EdmProviderImpl edm = new EdmProviderImpl(mock(EdmProvider.class));
- Property propertyProvider = new Property();
- propertyProvider.setType(EdmPrimitiveTypeKind.String.getFullQualifiedName());
- propertyProvider.setPrecision(42);
- propertyProvider.setScale(12);
- propertyProvider.setMaxLength(128);
- propertyProvider.setUnicode(true);
- propertyProvider.setNullable(false);
- propertyProvider.setDefaultValue("x");
- final EdmProperty property = new EdmPropertyImpl(edm, null, propertyProvider);
- assertTrue(property.isPrimitive());
- assertNull(property.getMapping());
- assertNull(property.getMimeType());
- assertEquals(Integer.valueOf(42), property.getPrecision());
- assertEquals(Integer.valueOf(12), property.getScale());
- assertEquals(Integer.valueOf(128), property.getMaxLength());
- assertTrue(property.isUnicode());
- assertFalse(property.isNullable());
- assertEquals("x", property.getDefaultValue());
- }
-}
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmProviderImplOverloadingTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmProviderImplOverloadingTest.java
deleted file mode 100644
index 641769c..0000000
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmProviderImplOverloadingTest.java
+++ /dev/null
@@ -1,198 +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.edm.provider;
-
-import org.apache.olingo.commons.api.edm.Edm;
-import org.apache.olingo.commons.api.edm.EdmAction;
-import org.apache.olingo.commons.api.edm.EdmException;
-import org.apache.olingo.commons.api.edm.EdmFunction;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.server.api.edm.provider.Action;
-import org.apache.olingo.server.api.edm.provider.EdmProvider;
-import org.apache.olingo.server.api.edm.provider.Function;
-import org.apache.olingo.server.api.edm.provider.Parameter;
-import org.junit.Before;
-import org.junit.Test;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNotSame;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-public class EdmProviderImplOverloadingTest {
-
- private Edm edm;
- private final FullQualifiedName operationName1 = new FullQualifiedName("n", "o1");
- private final FullQualifiedName operationType1 = new FullQualifiedName("n", "t1");
- private final FullQualifiedName operationType2 = new FullQualifiedName("n", "t2");
- private final FullQualifiedName wrongOperationName = new FullQualifiedName("wrong", "wrong");
- private final FullQualifiedName badOperationName = new FullQualifiedName("bad", "bad");
-
- @Before
- public void setup() throws Exception {
- EdmProvider provider = mock(EdmProvider.class);
-
- List<Action> actions = new ArrayList<Action>();
- Action action = new Action().setName(operationName1.getName());
- actions.add(action);
- List<Parameter> action1Parameters = new ArrayList<Parameter>();
- action1Parameters.add(new Parameter().setType(operationType1).setCollection(false));
- action =
- new Action().setName(operationName1.getName()).setBound(true).setParameters(action1Parameters);
- actions.add(action);
- List<Parameter> action2Parameters = new ArrayList<Parameter>();
- action2Parameters.add(new Parameter().setType(operationType1).setCollection(true));
- action =
- new Action().setName(operationName1.getName()).setBound(true).setParameters(action2Parameters);
- actions.add(action);
- when(provider.getActions(operationName1)).thenReturn(actions);
-
- List<Function> functions = new ArrayList<Function>();
- Function function = new Function().setName(operationName1.getName());
- functions.add(function);
- List<Parameter> function1Parameters = new ArrayList<Parameter>();
- function1Parameters.add(new Parameter().setType(operationType1).setName("a"));
- function = new Function().setName(operationName1.getName()).setParameters(function1Parameters);
- functions.add(function);
- List<Parameter> function2Parameters = new ArrayList<Parameter>();
- function2Parameters.add(new Parameter().setType(operationType1).setName("b"));
- function = new Function().setName(operationName1.getName()).setParameters(function2Parameters);
- functions.add(function);
- List<Parameter> function3Parameters = new ArrayList<Parameter>();
- function3Parameters.add(new Parameter().setName("a").setType(operationType1));
- function3Parameters.add(new Parameter().setName("b").setType(operationType1));
- function = new Function().setName(operationName1.getName()).setParameters(function3Parameters).setBound(true);
- functions.add(function);
- List<Parameter> function4Parameters = new ArrayList<Parameter>();
- function4Parameters.add(new Parameter().setName("a").setType(operationType2));
- function4Parameters.add(new Parameter().setName("b").setType(operationType2));
- function = new Function().setName(operationName1.getName()).setParameters(function4Parameters).setBound(true);
- functions.add(function);
- when(provider.getFunctions(operationName1)).thenReturn(functions);
-
- List<Function> badFunctions = new ArrayList<Function>();
- Function badFunction = new Function().setName(operationName1.getName()).setBound(true).setParameters(null);
- badFunctions.add(badFunction);
-
- when(provider.getFunctions(badOperationName)).thenReturn(badFunctions);
-
- edm = new EdmProviderImpl(provider);
- }
-
- @Test
- public void simpleActionGet() {
- EdmAction action = edm.getUnboundAction(operationName1);
- assertNotNull(action);
- assertEquals(operationName1.getNamespace(), action.getNamespace());
- assertEquals(operationName1.getName(), action.getName());
-
- assertNull(edm.getUnboundAction(wrongOperationName));
- }
-
- @Test
- public void boundActionOverloading() {
- EdmAction action = edm.getBoundAction(operationName1, operationType1, false);
- assertNotNull(action);
- assertEquals(operationName1.getNamespace(), action.getNamespace());
- assertEquals(operationName1.getName(), action.getName());
- assertTrue(action == edm.getBoundAction(operationName1, operationType1, false));
-
- EdmAction action2 = edm.getBoundAction(operationName1, operationType1, true);
- assertNotNull(action2);
- assertEquals(operationName1.getNamespace(), action2.getNamespace());
- assertEquals(operationName1.getName(), action2.getName());
- assertTrue(action2 == edm.getBoundAction(operationName1, operationType1, true));
-
- assertNotSame(action, action2);
- }
-
- @Test
- public void simpleFunctionGet() {
- EdmFunction function = edm.getUnboundFunction(operationName1, null);
- assertNotNull(function);
- assertEquals(operationName1.getNamespace(), function.getNamespace());
- assertEquals(operationName1.getName(), function.getName());
-
- EdmFunction function2 = edm.getUnboundFunction(operationName1, new ArrayList<String>());
- assertNotNull(function2);
- assertEquals(operationName1.getNamespace(), function2.getNamespace());
- assertEquals(operationName1.getName(), function2.getName());
-
- assertEquals(function, function2);
-
- assertNull(edm.getUnboundFunction(wrongOperationName, new ArrayList<String>()));
- }
-
- @Test
- public void functionOverloading() {
- ArrayList<String> parameter1Names = new ArrayList<String>();
- parameter1Names.add("a");
- List<String> parameter2Names = new ArrayList<String>();
- parameter2Names.add("b");
- EdmFunction function = edm.getUnboundFunction(operationName1, new ArrayList<String>());
- assertNotNull(function);
- assertFalse(function.isBound());
-
- EdmFunction function1 = edm.getUnboundFunction(operationName1, parameter1Names);
- assertNotNull(function1);
- assertFalse(function1.isBound());
-
- assertFalse(function == function1);
- assertNotSame(function, function1);
-
- EdmFunction function2 = edm.getUnboundFunction(operationName1, parameter2Names);
- assertNotNull(function2);
- assertFalse(function2.isBound());
-
- assertFalse(function1 == function2);
- assertNotSame(function1, function2);
-
- EdmFunction function3 = edm.getBoundFunction(operationName1, operationType1, false, parameter2Names);
- assertNotNull(function3);
- assertTrue(function3.isBound());
- EdmFunction function4 = edm.getBoundFunction(operationName1, operationType2, false, parameter2Names);
- assertNotNull(function4);
- assertTrue(function4.isBound());
-
- assertFalse(function3 == function4);
- assertNotSame(function3, function4);
-
- assertFalse(function1 == function3);
- assertFalse(function1 == function4);
- assertFalse(function2 == function3);
- assertFalse(function2 == function4);
- assertNotSame(function1, function3);
- assertNotSame(function1, function4);
- assertNotSame(function2, function3);
- assertNotSame(function2, function4);
- }
-
- @Test(expected = EdmException.class)
- public void noParametersAtBoundFunctionReslutsInException() {
- edm.getBoundFunction(badOperationName, operationType1, true, null);
- }
-
-}
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmProviderImplTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmProviderImplTest.java
deleted file mode 100644
index c8a4e38..0000000
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmProviderImplTest.java
+++ /dev/null
@@ -1,224 +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.edm.provider;
-
-import org.apache.olingo.commons.api.ODataException;
-import org.apache.olingo.commons.api.edm.Edm;
-import org.apache.olingo.commons.api.edm.EdmComplexType;
-import org.apache.olingo.commons.api.edm.EdmEntityContainer;
-import org.apache.olingo.commons.api.edm.EdmEntityType;
-import org.apache.olingo.commons.api.edm.EdmEnumType;
-import org.apache.olingo.commons.api.edm.EdmException;
-import org.apache.olingo.commons.api.edm.EdmTypeDefinition;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-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.EntityType;
-import org.apache.olingo.server.api.edm.provider.EnumType;
-import org.apache.olingo.server.api.edm.provider.PropertyRef;
-import org.apache.olingo.server.api.edm.provider.TypeDefinition;
-import org.junit.Before;
-import org.junit.Test;
-
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.List;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.fail;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-public class EdmProviderImplTest {
-
- private Edm edm;
- private final FullQualifiedName FQN = new FullQualifiedName("testNamespace", "testName");
- private final FullQualifiedName WRONG_FQN = new FullQualifiedName("wrong", "wrong");
-
- @Before
- public void setup() throws Exception {
- EdmProvider provider = mock(EdmProvider.class);
- EntityContainerInfo containerInfo = new EntityContainerInfo().setContainerName(FQN);
- when(provider.getEntityContainerInfo(FQN)).thenReturn(containerInfo);
- when(provider.getEntityContainerInfo(null)).thenReturn(containerInfo);
-
- EnumType enumType = new EnumType().setName(FQN.getName());
- when(provider.getEnumType(FQN)).thenReturn(enumType);
-
- TypeDefinition typeDefinition =
- new TypeDefinition().setName(FQN.getName()).setUnderlyingType(new FullQualifiedName("Edm", "String"));
- when(provider.getTypeDefinition(FQN)).thenReturn(typeDefinition);
-
- EntityType entityType = new EntityType().setName(FQN.getName()).setKey(new ArrayList<PropertyRef>());
- when(provider.getEntityType(FQN)).thenReturn(entityType);
-
- ComplexType complexType = new ComplexType().setName(FQN.getName());
- when(provider.getComplexType(FQN)).thenReturn(complexType);
-
- List<AliasInfo> aliasInfos = new ArrayList<AliasInfo>();
- aliasInfos.add(new AliasInfo().setAlias("alias").setNamespace("namespace"));
- when(provider.getAliasInfos()).thenReturn(aliasInfos);
-
- edm = new EdmProviderImpl(provider);
- }
-
- @Test
- public void nothingSpecifiedMustNotResultInExceptions() throws Exception {
- EdmProvider localProvider = mock(EdmProvider.class);
- when(localProvider.getActions(FQN)).thenReturn(null);
- when(localProvider.getFunctions(FQN)).thenReturn(null);
- Edm localEdm = new EdmProviderImpl(localProvider);
- localEdm.getUnboundAction(FQN);
- localEdm.getUnboundFunction(FQN, null);
- localEdm.getBoundAction(FQN, FQN, true);
- localEdm.getBoundFunction(FQN, FQN, true, null);
- localEdm.getComplexType(FQN);
- localEdm.getEntityContainer(FQN);
- localEdm.getEntityType(FQN);
- localEdm.getEnumType(FQN);
- localEdm.getTypeDefinition(FQN);
- }
-
- @Test
- public void convertExceptionsTest() throws Exception {
- EdmProvider localProvider = mock(EdmProvider.class);
- FullQualifiedName fqn = new FullQualifiedName("namespace", "name");
- when(localProvider.getEntityContainerInfo(fqn)).thenThrow(new ODataException("msg"));
- when(localProvider.getEnumType(fqn)).thenThrow(new ODataException("msg"));
- when(localProvider.getTypeDefinition(fqn)).thenThrow(new ODataException("msg"));
- when(localProvider.getEntityType(fqn)).thenThrow(new ODataException("msg"));
- when(localProvider.getComplexType(fqn)).thenThrow(new ODataException("msg"));
- when(localProvider.getActions(fqn)).thenThrow(new ODataException("msg"));
- when(localProvider.getFunctions(fqn)).thenThrow(new ODataException("msg"));
-
- Edm localEdm = new EdmProviderImpl(localProvider);
-
- callMethodAndExpectEdmException(localEdm, "getEntityContainer");
- callMethodAndExpectEdmException(localEdm, "getEnumType");
- callMethodAndExpectEdmException(localEdm, "getTypeDefinition");
- callMethodAndExpectEdmException(localEdm, "getEntityType");
- callMethodAndExpectEdmException(localEdm, "getComplexType");
-
- // seperate because of signature
- try {
- localEdm.getUnboundAction(fqn);
- } catch (EdmException e) {
- assertEquals("org.apache.olingo.commons.api.ODataException: msg", e.getMessage());
- }
-
- try {
- localEdm.getUnboundFunction(fqn, null);
- } catch (EdmException e) {
- assertEquals("org.apache.olingo.commons.api.ODataException: msg", e.getMessage());
- }
- try {
- localEdm.getBoundAction(fqn, fqn, true);
- } catch (EdmException e) {
- assertEquals("org.apache.olingo.commons.api.ODataException: msg", e.getMessage());
- }
-
- try {
- localEdm.getBoundFunction(fqn, fqn, true, null);
- } catch (EdmException e) {
- assertEquals("org.apache.olingo.commons.api.ODataException: msg", e.getMessage());
- }
- }
-
- private void callMethodAndExpectEdmException(final Edm localEdm, final String methodName) throws Exception {
- Method method = localEdm.getClass().getMethod(methodName, FullQualifiedName.class);
- try {
- method.invoke(localEdm, new FullQualifiedName("namespace", "name"));
- } catch (InvocationTargetException e) {
- Throwable cause = e.getCause();
- if (cause instanceof EdmException) {
- return;
- }
- }
- fail("EdmException expected for method: " + methodName);
- }
-
- @Test(expected = EdmException.class)
- public void convertExceptionsAliasTest() throws Exception {
- EdmProvider localProvider = mock(EdmProvider.class);
- when(localProvider.getAliasInfos()).thenThrow(new ODataException("msg"));
-
- Edm localEdm = new EdmProviderImpl(localProvider);
- localEdm.getEntityContainer(null);
- }
-
- @Test
- public void getEntityContainer() {
- EdmEntityContainer entityContainer = edm.getEntityContainer(FQN);
- assertNotNull(entityContainer);
- assertEquals(FQN.getNamespace(), entityContainer.getNamespace());
- assertEquals(FQN.getName(), entityContainer.getName());
-
- entityContainer = edm.getEntityContainer(null);
- assertNotNull(entityContainer);
- assertEquals(FQN.getNamespace(), entityContainer.getNamespace());
- assertEquals(FQN.getName(), entityContainer.getName());
-
- assertNull(edm.getEntityContainer(WRONG_FQN));
- }
-
- @Test
- public void getEnumType() {
- EdmEnumType enumType = edm.getEnumType(FQN);
- assertNotNull(enumType);
- assertEquals(FQN.getNamespace(), enumType.getNamespace());
- assertEquals(FQN.getName(), enumType.getName());
-
- assertNull(edm.getEnumType(WRONG_FQN));
- }
-
- @Test
- public void getTypeDefinition() {
- EdmTypeDefinition typeDefinition = edm.getTypeDefinition(FQN);
- assertNotNull(typeDefinition);
- assertEquals(FQN.getNamespace(), typeDefinition.getNamespace());
- assertEquals(FQN.getName(), typeDefinition.getName());
-
- assertNull(edm.getTypeDefinition(WRONG_FQN));
- }
-
- @Test
- public void getEntityType() {
- EdmEntityType entityType = edm.getEntityType(FQN);
- assertNotNull(entityType);
- assertEquals(FQN.getNamespace(), entityType.getNamespace());
- assertEquals(FQN.getName(), entityType.getName());
-
- assertNull(edm.getEntityType(WRONG_FQN));
- }
-
- @Test
- public void getComplexType() {
- EdmComplexType complexType = edm.getComplexType(FQN);
- assertNotNull(complexType);
- assertEquals(FQN.getNamespace(), complexType.getNamespace());
- assertEquals(FQN.getName(), complexType.getName());
-
- assertNull(edm.getComplexType(WRONG_FQN));
- }
-}
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmReturnTypeImplTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmReturnTypeImplTest.java
deleted file mode 100644
index fb69f12..0000000
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmReturnTypeImplTest.java
+++ /dev/null
@@ -1,130 +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.edm.provider;
-
-import org.apache.olingo.commons.api.edm.EdmComplexType;
-import org.apache.olingo.commons.api.edm.EdmEntityType;
-import org.apache.olingo.commons.api.edm.EdmEnumType;
-import org.apache.olingo.commons.api.edm.EdmException;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
-import org.apache.olingo.commons.api.edm.EdmReturnType;
-import org.apache.olingo.commons.api.edm.EdmType;
-import org.apache.olingo.commons.api.edm.EdmTypeDefinition;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
-import org.apache.olingo.server.api.edm.provider.ReturnType;
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-public class EdmReturnTypeImplTest {
-
- @Test
- public void primitiveReturnType() {
- ReturnType providerType = new ReturnType().setType(new FullQualifiedName("Edm", "String"));
-
- EdmReturnType typeImpl = new EdmReturnTypeImpl(mock(EdmProviderImpl.class), providerType);
-
- assertEquals(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.String), typeImpl.getType());
- assertFalse(typeImpl.isCollection());
-
- assertNull(typeImpl.getPrecision());
- assertNull(typeImpl.getMaxLength());
- assertNull(typeImpl.getScale());
- assertNull(typeImpl.isNullable());
- }
-
- @Test
- public void primitiveCollectionReturnType() {
- ReturnType providerType = new ReturnType().setType(new FullQualifiedName("Edm", "String")).setCollection(true);
-
- EdmReturnType typeImpl = new EdmReturnTypeImpl(mock(EdmProviderImpl.class), providerType);
-
- assertEquals(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.String), typeImpl.getType());
- assertTrue(typeImpl.isCollection());
- }
-
- @Test(expected = EdmException.class)
- public void invalidPrimitiveType() {
- ReturnType providerType = new ReturnType().setType(new FullQualifiedName("Edm", "wrong")).setCollection(true);
- EdmReturnType typeImpl = new EdmReturnTypeImpl(mock(EdmProviderImpl.class), providerType);
- typeImpl.getType();
- }
-
- @Test
- public void complexType() {
- EdmProviderImpl mock = mock(EdmProviderImpl.class);
- FullQualifiedName baseType = new FullQualifiedName("namespace", "type");
- EdmComplexType edmType = mock(EdmComplexType.class);
- when(mock.getComplexType(baseType)).thenReturn(edmType);
- ReturnType providerType = new ReturnType().setType(baseType);
- EdmReturnType typeImpl = new EdmReturnTypeImpl(mock, providerType);
- EdmType returnedType = typeImpl.getType();
- assertEquals(edmType, returnedType);
- }
-
- @Test
- public void entityType() {
- EdmProviderImpl mock = mock(EdmProviderImpl.class);
- FullQualifiedName baseType = new FullQualifiedName("namespace", "type");
- EdmEntityType edmType = mock(EdmEntityType.class);
- when(mock.getEntityType(baseType)).thenReturn(edmType);
- ReturnType providerType = new ReturnType().setType(baseType);
- EdmReturnType typeImpl = new EdmReturnTypeImpl(mock, providerType);
- EdmType returnedType = typeImpl.getType();
- assertEquals(edmType, returnedType);
- }
-
- @Test
- public void enumType() {
- EdmProviderImpl mock = mock(EdmProviderImpl.class);
- FullQualifiedName baseType = new FullQualifiedName("namespace", "type");
- EdmEnumType edmType = mock(EdmEnumType.class);
- when(mock.getEnumType(baseType)).thenReturn(edmType);
- ReturnType providerType = new ReturnType().setType(baseType);
- EdmReturnType typeImpl = new EdmReturnTypeImpl(mock, providerType);
- EdmType returnedType = typeImpl.getType();
- assertEquals(edmType, returnedType);
- }
-
- @Test
- public void typeDefinition() {
- EdmProviderImpl mock = mock(EdmProviderImpl.class);
- FullQualifiedName baseType = new FullQualifiedName("namespace", "type");
- EdmTypeDefinition edmType = mock(EdmTypeDefinition.class);
- when(mock.getTypeDefinition(baseType)).thenReturn(edmType);
- ReturnType providerType = new ReturnType().setType(baseType);
- EdmReturnType typeImpl = new EdmReturnTypeImpl(mock, providerType);
- EdmType returnedType = typeImpl.getType();
- assertEquals(edmType, returnedType);
- }
-
- @Test(expected = EdmException.class)
- public void invalidType() {
- ReturnType providerType = new ReturnType().setType(new FullQualifiedName("wrong", "wrong"));
- EdmReturnType typeImpl = new EdmReturnTypeImpl(mock(EdmProviderImpl.class), providerType);
- typeImpl.getType();
- }
-
-}
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmSchemaImplTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmSchemaImplTest.java
deleted file mode 100644
index 03007b3..0000000
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmSchemaImplTest.java
+++ /dev/null
@@ -1,357 +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.edm.provider;
-
-import org.apache.olingo.commons.api.ODataException;
-import org.apache.olingo.commons.api.edm.Edm;
-import org.apache.olingo.commons.api.edm.EdmAction;
-import org.apache.olingo.commons.api.edm.EdmActionImport;
-import org.apache.olingo.commons.api.edm.EdmComplexType;
-import org.apache.olingo.commons.api.edm.EdmEntityContainer;
-import org.apache.olingo.commons.api.edm.EdmEntitySet;
-import org.apache.olingo.commons.api.edm.EdmEntityType;
-import org.apache.olingo.commons.api.edm.EdmEnumType;
-import org.apache.olingo.commons.api.edm.EdmFunction;
-import org.apache.olingo.commons.api.edm.EdmFunctionImport;
-import org.apache.olingo.commons.api.edm.EdmSchema;
-import org.apache.olingo.commons.api.edm.EdmSingleton;
-import org.apache.olingo.commons.api.edm.EdmTypeDefinition;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.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.EntityContainer;
-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.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.Schema;
-import org.apache.olingo.server.api.edm.provider.Singleton;
-import org.apache.olingo.server.api.edm.provider.Term;
-import org.apache.olingo.server.api.edm.provider.TypeDefinition;
-import org.junit.Before;
-import org.junit.Test;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-public class EdmSchemaImplTest {
-
- private EdmSchema schema;
- private Edm edm;
-
- @Before
- public void before() {
- EdmProvider provider = new LocalProvider();
- edm = new EdmProviderImpl(provider);
- schema = edm.getSchemas().get(0);
-
- }
-
- @Test
- public void initialSchemaTest() {
- EdmProvider provider = mock(EdmProvider.class);
- edm = new EdmProviderImpl(provider);
- edm.getSchemas();
- }
-
- @Test
- public void emptySchemaTest() throws Exception {
- ArrayList<Schema> schemas = new ArrayList<Schema>();
- Schema providerSchema = new Schema();
- schemas.add(providerSchema);
- EdmProvider provider = mock(EdmProvider.class);
- when(provider.getSchemas()).thenReturn(schemas);
- edm = new EdmProviderImpl(provider);
- edm.getSchemas();
- }
-
- @Test
- public void basicGetters() {
- assertEquals("org.namespace", schema.getNamespace());
- assertEquals("alias", schema.getAlias());
- }
-
- @Test
- public void getTypeDefinitions() {
- List<EdmTypeDefinition> typeDefinitions = schema.getTypeDefinitions();
- assertNotNull(typeDefinitions);
- assertEquals(2, typeDefinitions.size());
-
- for (EdmTypeDefinition def : typeDefinitions) {
- assertTrue(def == edm.getTypeDefinition(new FullQualifiedName("org.namespace", def.getName())));
- }
- }
-
- @Test
- public void getEnumTypes() {
- List<EdmEnumType> enumTypes = schema.getEnumTypes();
- assertNotNull(enumTypes);
- assertEquals(2, enumTypes.size());
-
- for (EdmEnumType enumType : enumTypes) {
- assertTrue(enumType == edm.getEnumType(new FullQualifiedName("org.namespace", enumType.getName())));
- }
- }
-
- @Test
- public void getEntityTypes() {
- List<EdmEntityType> entityTypes = schema.getEntityTypes();
- assertNotNull(entityTypes);
- assertEquals(2, entityTypes.size());
-
- for (EdmEntityType entityType : entityTypes) {
- assertTrue(entityType == edm.getEntityType(new FullQualifiedName("org.namespace", entityType.getName())));
- }
- }
-
- @Test
- public void getComplexTypes() {
- List<EdmComplexType> complexTypes = schema.getComplexTypes();
- assertNotNull(complexTypes);
- assertEquals(2, complexTypes.size());
-
- for (EdmComplexType complexType : complexTypes) {
- assertTrue(complexType == edm.getComplexType(new FullQualifiedName("org.namespace", complexType.getName())));
- }
- }
-
- @Test
- public void getActions() {
- List<EdmAction> actions = schema.getActions();
- assertNotNull(actions);
- assertEquals(2, actions.size());
-
- for (EdmAction action : actions) {
- assertTrue(action == edm.getUnboundAction(new FullQualifiedName("org.namespace", action.getName())));
- }
- }
-
- @Test
- public void getFunctions() {
- List<EdmFunction> functions = schema.getFunctions();
- assertNotNull(functions);
- assertEquals(2, functions.size());
-
- for (EdmFunction function : functions) {
- FullQualifiedName functionName = new FullQualifiedName("org.namespace", function.getName());
- assertTrue(function == edm.getUnboundFunction(functionName, null));
- }
- }
-
- @Test
- public void getContainer() {
- EdmEntityContainer container = schema.getEntityContainer();
- assertNotNull(container);
-
- List<EdmEntitySet> entitySets = container.getEntitySets();
- assertNotNull(entitySets);
- assertEquals(2, entitySets.size());
- for (EdmEntitySet obj : entitySets) {
- assertNotNull(obj.getEntityType());
- }
-
- List<EdmSingleton> singletons = container.getSingletons();
- assertNotNull(singletons);
- assertEquals(2, singletons.size());
- for (EdmSingleton obj : singletons) {
- assertNotNull(obj.getEntityType());
- }
-
- List<EdmActionImport> actionImports = container.getActionImports();
- assertNotNull(actionImports);
- assertEquals(2, actionImports.size());
- for (EdmActionImport obj : actionImports) {
- assertNotNull(obj.getUnboundAction());
- }
-
- List<EdmFunctionImport> functionImports = container.getFunctionImports();
- assertNotNull(functionImports);
- assertEquals(2, functionImports.size());
- for (EdmFunctionImport obj : functionImports) {
- assertNotNull(obj.getFunctionFqn());
- }
-
- assertTrue(container == edm.getEntityContainer(new FullQualifiedName(schema.getNamespace(), container.getName())));
- assertTrue(container == edm.getEntityContainer(null));
- }
-
- private class LocalProvider extends EdmProvider {
-
- private static final String ALIAS = "alias";
- private static final String NAMESPACE = "org.namespace";
-
- @Override
- public EnumType getEnumType(final FullQualifiedName enumTypeName) throws ODataException {
- throw new RuntimeException("Provider must not be called in the schema case");
- }
-
- @Override
- public TypeDefinition getTypeDefinition(final FullQualifiedName typeDefinitionName) throws ODataException {
- throw new RuntimeException("Provider must not be called in the schema case");
- }
-
- @Override
- public EntityType getEntityType(final FullQualifiedName entityTypeName) throws ODataException {
- throw new RuntimeException("Provider must not be called in the schema case");
- }
-
- @Override
- public ComplexType getComplexType(final FullQualifiedName complexTypeName) throws ODataException {
- throw new RuntimeException("Provider must not be called in the schema case");
- }
-
- @Override
- public List<Action> getActions(final FullQualifiedName actionName) throws ODataException {
- throw new RuntimeException("Provider must not be called in the schema case");
- }
-
- @Override
- public List<Function> getFunctions(final FullQualifiedName functionName) throws ODataException {
- throw new RuntimeException("Provider must not be called in the schema case");
- }
-
- @Override
- public Term getTerm(final FullQualifiedName termName) throws ODataException {
- throw new RuntimeException("Provider must not be called in the schema case");
- }
-
- @Override
- public EntitySet getEntitySet(final FullQualifiedName entityContainer, final String entitySetName)
- throws ODataException {
- throw new RuntimeException("Provider must not be called in the schema case");
- }
-
- @Override
- public Singleton getSingleton(final FullQualifiedName entityContainer, final String singletonName)
- throws ODataException {
- throw new RuntimeException("Provider must not be called in the schema case");
- }
-
- @Override
- public ActionImport getActionImport(final FullQualifiedName entityContainer, final String actionImportName)
- throws ODataException {
- throw new RuntimeException("Provider must not be called in the schema case");
- }
-
- @Override
- public FunctionImport getFunctionImport(final FullQualifiedName entityContainer, final String functionImportName)
- throws ODataException {
- throw new RuntimeException("Provider must not be called in the schema case");
- }
-
- @Override
- public EntityContainerInfo getEntityContainerInfo(final FullQualifiedName entityContainerName)
- throws ODataException {
- throw new RuntimeException("Provider must not be called in the schema case");
- }
-
- @Override
- public List<AliasInfo> getAliasInfos() throws ODataException {
- throw new RuntimeException("Provider must not be called in the schema case");
- }
-
- @Override
- public List<Schema> getSchemas() throws ODataException {
- Schema providerSchema = new Schema();
- providerSchema.setNamespace(NAMESPACE);
- providerSchema.setAlias(ALIAS);
- EntityContainer container = new EntityContainer().setName("container");
-
- List<EntitySet> entitySets = new ArrayList<EntitySet>();
- entitySets.add(new EntitySet().setName("entitySetName")
- .setType(new FullQualifiedName(NAMESPACE, "entityType1")));
- entitySets
- .add(new EntitySet().setName("entitySetName2").setType(new FullQualifiedName(NAMESPACE, "entityType2")));
- container.setEntitySets(entitySets);
-
- List<Singleton> singletons = new ArrayList<Singleton>();
- singletons.add(new Singleton().setName("singletonName")
- .setType(new FullQualifiedName(NAMESPACE, "entityType1")));
- singletons
- .add(new Singleton().setName("singletonName2").setType(new FullQualifiedName(NAMESPACE, "entityType2")));
- container.setSingletons(singletons);
-
- List<ActionImport> actionImports = new ArrayList<ActionImport>();
- actionImports.add(new ActionImport().setName("actionImportName").setAction(
- new FullQualifiedName(NAMESPACE, "action1")));
- actionImports.add(new ActionImport().setName("actionImportName2").setAction(
- new FullQualifiedName(NAMESPACE, "action2")));
- container.setActionImports(actionImports);
-
- List<FunctionImport> functionImports = new ArrayList<FunctionImport>();
- functionImports.add(new FunctionImport().setName("functionImportName").setFunction(
- new FullQualifiedName(NAMESPACE, "function1")));
- functionImports.add(new FunctionImport().setName("functionImportName2").setFunction(
- new FullQualifiedName(NAMESPACE, "function2")));
- container.setFunctionImports(functionImports);
- providerSchema.setEntityContainer(container);
-
- List<TypeDefinition> typeDefinitions = new ArrayList<TypeDefinition>();
- typeDefinitions.add(new TypeDefinition().setName("typeDefinition1"));
- typeDefinitions.add(new TypeDefinition().setName("typeDefinition2"));
- providerSchema.setTypeDefinitions(typeDefinitions);
-
- List<EnumType> enumTypes = new ArrayList<EnumType>();
- enumTypes.add(new EnumType().setName("enumType1"));
- enumTypes.add(new EnumType().setName("enumType2"));
- providerSchema.setEnumTypes(enumTypes);
-
- List<EntityType> entityTypes = new ArrayList<EntityType>();
- entityTypes.add(new EntityType().setName("entityType1"));
- entityTypes.add(new EntityType().setName("entityType2")
- .setBaseType(new FullQualifiedName(NAMESPACE, "entityType1")));
- providerSchema.setEntityTypes(entityTypes);
-
- List<ComplexType> complexTypes = new ArrayList<ComplexType>();
- complexTypes.add(new ComplexType().setName("complexType1"));
- complexTypes.add(new ComplexType().setName("complexType2").setBaseType(
- new FullQualifiedName(NAMESPACE, "complexType1")));
- providerSchema.setComplexTypes(complexTypes);
-
- List<Action> actions = new ArrayList<Action>();
- actions.add(new Action().setName("action1"));
- actions.add(new Action().setName("action2"));
- providerSchema.setActions(actions);
-
- List<Function> functions = new ArrayList<Function>();
- functions.add(new Function().setName("function1"));
- functions.add(new Function().setName("function2"));
- providerSchema.setFunctions(functions);
- ArrayList<Schema> schemas = new ArrayList<Schema>();
- schemas.add(providerSchema);
- return schemas;
- }
-
- @Override
- public EntityContainer getEntityContainer() throws ODataException {
- throw new RuntimeException("Provider must not be called in the schema case");
- }
- }
-}
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmSingletonImplTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmSingletonImplTest.java
deleted file mode 100644
index 4611d6f..0000000
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmSingletonImplTest.java
+++ /dev/null
@@ -1,129 +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.edm.provider;
-
-import org.apache.olingo.commons.api.edm.EdmBindingTarget;
-import org.apache.olingo.commons.api.edm.EdmEntityContainer;
-import org.apache.olingo.commons.api.edm.EdmEntityType;
-import org.apache.olingo.commons.api.edm.EdmException;
-import org.apache.olingo.commons.api.edm.EdmSingleton;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.api.edm.Target;
-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.EntityType;
-import org.apache.olingo.server.api.edm.provider.NavigationPropertyBinding;
-import org.apache.olingo.server.api.edm.provider.PropertyRef;
-import org.apache.olingo.server.api.edm.provider.Singleton;
-import org.junit.Test;
-
-import java.util.Arrays;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-public class EdmSingletonImplTest {
-
- @Test
- public void singleton() throws Exception {
- EdmProvider provider = mock(EdmProvider.class);
- EdmProviderImpl edm = new EdmProviderImpl(provider);
-
- final FullQualifiedName typeName = new FullQualifiedName("ns", "entityType");
- final EntityType entityTypeProvider = new EntityType()
- .setName(typeName.getName())
- .setKey(Arrays.asList(new PropertyRef().setPropertyName("Id")));
- when(provider.getEntityType(typeName)).thenReturn(entityTypeProvider);
-
- final FullQualifiedName containerName = new FullQualifiedName("ns", "container");
- final EntityContainerInfo containerInfo = new EntityContainerInfo().setContainerName(containerName);
- when(provider.getEntityContainerInfo(containerName)).thenReturn(containerInfo);
- final EdmEntityContainer entityContainer = new EdmEntityContainerImpl(edm, provider, containerInfo);
-
- final String singletonName = "singleton";
- final Singleton singletonProvider = new Singleton()
- .setName(singletonName)
- .setType(typeName)
- .setNavigationPropertyBindings(Arrays.asList(
- new NavigationPropertyBinding().setPath("path")
- .setTarget(new Target().setEntityContainer(containerName).setTargetName(singletonName))));
- when(provider.getSingleton(containerName, singletonName)).thenReturn(singletonProvider);
-
- final EdmSingleton singleton = new EdmSingletonImpl(edm, entityContainer, singletonProvider);
- assertEquals(singletonName, entityContainer.getSingleton(singletonName).getName());
- assertEquals(singletonName, singleton.getName());
- final EdmEntityType entityType = singleton.getEntityType();
- assertEquals(typeName.getNamespace(), entityType.getNamespace());
- assertEquals(typeName.getName(), entityType.getName());
- assertEquals(entityContainer, singleton.getEntityContainer());
- assertNull(singleton.getRelatedBindingTarget(null));
- final EdmBindingTarget target = singleton.getRelatedBindingTarget("path");
- assertEquals(singletonName, target.getName());
- }
-
- @Test(expected = EdmException.class)
- public void wrongTarget() throws Exception {
- EdmProvider provider = mock(EdmProvider.class);
- EdmProviderImpl edm = new EdmProviderImpl(provider);
-
- final FullQualifiedName containerName = new FullQualifiedName("ns", "container");
- final EntityContainerInfo containerInfo = new EntityContainerInfo().setContainerName(containerName);
- when(provider.getEntityContainerInfo(containerName)).thenReturn(containerInfo);
-
- final String singletonName = "singleton";
- final Singleton singletonProvider = new Singleton()
- .setNavigationPropertyBindings(Arrays.asList(
- new NavigationPropertyBinding().setPath("path")
- .setTarget(new Target().setEntityContainer(containerName).setTargetName("wrong"))));
- when(provider.getSingleton(containerName, singletonName)).thenReturn(singletonProvider);
-
- final EdmSingleton singleton = new EdmSingletonImpl(edm, null, singletonProvider);
- singleton.getRelatedBindingTarget("path");
- }
-
- @Test(expected = EdmException.class)
- public void wrongTargetContainer() throws Exception {
- EdmProvider provider = mock(EdmProvider.class);
- EdmProviderImpl edm = new EdmProviderImpl(provider);
-
- final FullQualifiedName containerName = new FullQualifiedName("ns", "container");
- final String singletonName = "singleton";
- final Singleton singletonProvider = new Singleton()
- .setNavigationPropertyBindings(Arrays.asList(
- new NavigationPropertyBinding().setPath("path")
- .setTarget(new Target().setEntityContainer(new FullQualifiedName("ns", "wrongContainer"))
- .setTargetName(singletonName))));
- when(provider.getSingleton(containerName, singletonName)).thenReturn(singletonProvider);
-
- final EdmSingleton singleton = new EdmSingletonImpl(edm, null, singletonProvider);
- singleton.getRelatedBindingTarget("path");
- }
-
- @Test(expected = EdmException.class)
- public void nonExsistingEntityType() throws Exception {
- EdmProvider provider = mock(EdmProvider.class);
- EdmProviderImpl edm = new EdmProviderImpl(provider);
-
- Singleton singleton = new Singleton().setName("name");
- final EdmSingleton edmSingleton = new EdmSingletonImpl(edm, null, singleton);
- edmSingleton.getEntityType();
- }
-}
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmTypeDefinitionImplTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmTypeDefinitionImplTest.java
deleted file mode 100644
index 5fc116c..0000000
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmTypeDefinitionImplTest.java
+++ /dev/null
@@ -1,75 +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.edm.provider;
-
-import org.apache.olingo.commons.api.edm.EdmException;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
-import org.apache.olingo.commons.api.edm.EdmTypeDefinition;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
-import org.apache.olingo.server.api.edm.provider.TypeDefinition;
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.Mockito.mock;
-
-public class EdmTypeDefinitionImplTest {
-
- @Test
- public void typeDefOnStringNoFacets() throws Exception {
- final FullQualifiedName typeDefName = new FullQualifiedName("namespace", "name");
- final TypeDefinition providerTypeDef =
- new TypeDefinition().setName("typeDef").setUnderlyingType(new FullQualifiedName("Edm", "String"));
- final EdmTypeDefinition typeDefImpl =
- new EdmTypeDefinitionImpl(mock(EdmProviderImpl.class), typeDefName, providerTypeDef);
-
- assertEquals("name", typeDefImpl.getName());
- assertEquals("namespace", typeDefImpl.getNamespace());
- assertEquals(String.class, typeDefImpl.getDefaultType());
- assertEquals(EdmTypeKind.DEFINITION, typeDefImpl.getKind());
- assertEquals(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.String), typeDefImpl.getUnderlyingType());
- assertTrue(typeDefImpl.isCompatible(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.String)));
-
- // String validation
- assertEquals("'StringValue'", typeDefImpl.toUriLiteral("StringValue"));
- assertEquals("String''Value", typeDefImpl.fromUriLiteral("'String''''Value'"));
- assertTrue(typeDefImpl.validate("text", null, null, null, null, null));
- assertEquals("text", typeDefImpl.valueToString("text", null, null, null, null, null));
- assertEquals("text", typeDefImpl.valueOfString("text", null, null, null, null, null, String.class));
-
- // Facets must be initial
- assertNull(typeDefImpl.getMaxLength());
- assertNull(typeDefImpl.getPrecision());
- assertNull(typeDefImpl.getScale());
- assertNull(typeDefImpl.isUnicode());
- }
-
- @Test(expected = EdmException.class)
- public void invalidTypeResultsInEdmException() throws Exception {
- FullQualifiedName typeDefName = new FullQualifiedName("namespace", "name");
- TypeDefinition providerTypeDef =
- new TypeDefinition().setName("typeDef").setUnderlyingType(new FullQualifiedName("wrong", "wrong"));
- EdmTypeDefinitionImpl def = new EdmTypeDefinitionImpl(mock(EdmProviderImpl.class), typeDefName, providerTypeDef);
- def.getUnderlyingType();
- }
-
-}
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmTypeImplTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmTypeImplTest.java
deleted file mode 100644
index 141ff32..0000000
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/edm/provider/EdmTypeImplTest.java
+++ /dev/null
@@ -1,45 +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.edm.provider;
-
-import org.apache.olingo.commons.api.edm.EdmType;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
-import org.apache.olingo.commons.core.edm.EdmTypeImpl;
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-
-public class EdmTypeImplTest {
-
- @Test
- public void getterTest() {
- EdmType type = new EdmTypeImplTester(new FullQualifiedName("namespace", "name"), EdmTypeKind.UNDEFINED);
- assertEquals("name", type.getName());
- assertEquals("namespace", type.getNamespace());
- assertEquals(EdmTypeKind.UNDEFINED, type.getKind());
- }
-
- private class EdmTypeImplTester extends EdmTypeImpl {
- public EdmTypeImplTester(final FullQualifiedName name, final EdmTypeKind kind) {
- super(null, name, kind);
- }
- }
-
-}
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/BatchResponseSerializerTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/BatchResponseSerializerTest.java
deleted file mode 100644
index 85a30ac..0000000
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/BatchResponseSerializerTest.java
+++ /dev/null
@@ -1,227 +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.serializer;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.UUID;
-
-import org.apache.commons.io.IOUtils;
-import org.apache.olingo.commons.api.http.HttpHeader;
-import org.apache.olingo.commons.api.http.HttpStatusCode;
-import org.apache.olingo.server.api.ODataResponse;
-import org.apache.olingo.server.api.deserializer.batch.ODataResponsePart;
-import org.apache.olingo.server.core.deserializer.batch.BatchParserCommon;
-import org.apache.olingo.server.core.deserializer.batch.BufferedReaderIncludingLineEndings;
-import org.apache.olingo.server.core.serializer.BatchResponseSerializer;
-import org.junit.Test;
-
-public class BatchResponseSerializerTest {
- private static final String CRLF = "\r\n";
- private static final String BOUNDARY = "batch_" + UUID.randomUUID().toString();
-
- @Test
- public void testBatchResponse() throws Exception {
- final List<ODataResponsePart> parts = new ArrayList<ODataResponsePart>();
- ODataResponse response = new ODataResponse();
- response.setStatusCode(HttpStatusCode.OK.getStatusCode());
- response.setHeader(HttpHeader.CONTENT_TYPE, "application/json");
- response.setContent(IOUtils.toInputStream("Walter Winter" + CRLF));
-
- List<ODataResponse> responses = new ArrayList<ODataResponse>(1);
- responses.add(response);
- parts.add(new ODataResponsePart(responses, false));
-
- ODataResponse changeSetResponse = new ODataResponse();
- changeSetResponse.setStatusCode(HttpStatusCode.NO_CONTENT.getStatusCode());
- changeSetResponse.setHeader(BatchParserCommon.HTTP_CONTENT_ID, "1");
- responses = new ArrayList<ODataResponse>(1);
- responses.add(changeSetResponse);
- parts.add(new ODataResponsePart(responses, true));
-
- BatchResponseSerializer serializer = new BatchResponseSerializer();
- final InputStream content = serializer.serialize(parts, BOUNDARY);
- assertNotNull(content);
- final BufferedReaderIncludingLineEndings reader =
- new BufferedReaderIncludingLineEndings(new InputStreamReader(content));
- final List<String> body = reader.toList();
- reader.close();
-
- int line = 0;
- assertEquals(24, body.size());
- assertTrue(body.get(line++).contains("--batch_"));
- assertEquals("Content-Type: application/http" + CRLF, body.get(line++));
- assertEquals("Content-Transfer-Encoding: binary" + CRLF, body.get(line++));
- assertEquals(CRLF, body.get(line++));
- assertEquals("HTTP/1.1 200 OK" + CRLF, body.get(line++));
- assertEquals("Content-Type: application/json" + CRLF, body.get(line++));
- assertEquals("Content-Length: 15" + CRLF, body.get(line++));
- assertEquals(CRLF, body.get(line++));
- assertEquals("Walter Winter" + CRLF, body.get(line++));
- assertEquals(CRLF, body.get(line++));
- assertTrue(body.get(line++).contains("--batch_"));
- assertTrue(body.get(line++).contains("Content-Type: multipart/mixed; boundary=changeset_"));
- assertEquals(CRLF, body.get(line++));
- assertTrue(body.get(line++).contains("--changeset_"));
- assertEquals("Content-Type: application/http" + CRLF, body.get(line++));
- assertEquals("Content-Transfer-Encoding: binary" + CRLF, body.get(line++));
- assertEquals("Content-Id: 1" + CRLF, body.get(line++));
- assertEquals(CRLF, body.get(line++));
- assertEquals("HTTP/1.1 204 No Content" + CRLF, body.get(line++));
- assertEquals("Content-Length: 0" + CRLF, body.get(line++));
- assertEquals(CRLF, body.get(line++));
- assertEquals(CRLF, body.get(line++));
- assertTrue(body.get(line++).contains("--changeset_"));
- assertTrue(body.get(line++).contains("--batch_"));
- }
-
- @Test
- public void testBatchResponseWithEndingCRLF() throws Exception {
- final List<ODataResponsePart> parts = new ArrayList<ODataResponsePart>();
- ODataResponse response = new ODataResponse();
- response.setStatusCode(HttpStatusCode.OK.getStatusCode());
- response.setHeader(HttpHeader.CONTENT_TYPE, "application/json");
- response.setContent(IOUtils.toInputStream("Walter Winter"));
-
- List<ODataResponse> responses = new ArrayList<ODataResponse>(1);
- responses.add(response);
- parts.add(new ODataResponsePart(responses, false));
-
- ODataResponse changeSetResponse = new ODataResponse();
- changeSetResponse.setStatusCode(HttpStatusCode.NO_CONTENT.getStatusCode());
- changeSetResponse.setHeader(BatchParserCommon.HTTP_CONTENT_ID, "1");
- responses = new ArrayList<ODataResponse>(1);
- responses.add(changeSetResponse);
- parts.add(new ODataResponsePart(responses, true));
-
- BatchResponseSerializer serializer = new BatchResponseSerializer();
- final InputStream content = serializer.serialize(parts, BOUNDARY);
- assertNotNull(content);
- final BufferedReaderIncludingLineEndings reader =
- new BufferedReaderIncludingLineEndings(new InputStreamReader(content));
- final List<String> body = reader.toList();
- reader.close();
-
- int line = 0;
- assertEquals(23, body.size());
- assertTrue(body.get(line++).contains("--batch_"));
- assertEquals("Content-Type: application/http" + CRLF, body.get(line++));
- assertEquals("Content-Transfer-Encoding: binary" + CRLF, body.get(line++));
- assertEquals(CRLF, body.get(line++));
- assertEquals("HTTP/1.1 200 OK" + CRLF, body.get(line++));
- assertEquals("Content-Type: application/json" + CRLF, body.get(line++));
- assertEquals("Content-Length: 13" + CRLF, body.get(line++));
- assertEquals(CRLF, body.get(line++));
- assertEquals("Walter Winter" + CRLF, body.get(line++));
- assertTrue(body.get(line++).contains("--batch_"));
- assertTrue(body.get(line++).contains("Content-Type: multipart/mixed; boundary=changeset_"));
- assertEquals(CRLF, body.get(line++));
- assertTrue(body.get(line++).contains("--changeset_"));
- assertEquals("Content-Type: application/http" + CRLF, body.get(line++));
- assertEquals("Content-Transfer-Encoding: binary" + CRLF, body.get(line++));
- assertEquals("Content-Id: 1" + CRLF, body.get(line++));
- assertEquals(CRLF, body.get(line++));
- assertEquals("HTTP/1.1 204 No Content" + CRLF, body.get(line++));
- assertEquals("Content-Length: 0" + CRLF, body.get(line++));
- assertEquals(CRLF, body.get(line++));
- assertEquals(CRLF, body.get(line++));
- assertTrue(body.get(line++).contains("--changeset_"));
- assertTrue(body.get(line++).contains("--batch_"));
- }
-
- @Test
- public void testResponse() throws Exception {
- List<ODataResponsePart> parts = new ArrayList<ODataResponsePart>();
- ODataResponse response = new ODataResponse();
- response.setStatusCode(HttpStatusCode.OK.getStatusCode());
- response.setHeader(HttpHeader.CONTENT_TYPE, "application/json");
- response.setContent(IOUtils.toInputStream("Walter Winter"));
-
- List<ODataResponse> responses = new ArrayList<ODataResponse>(1);
- responses.add(response);
- parts.add(new ODataResponsePart(responses, false));
-
- final BatchResponseSerializer serializer = new BatchResponseSerializer();
- final InputStream content = serializer.serialize(parts, BOUNDARY);
-
- assertNotNull(content);
- final BufferedReaderIncludingLineEndings reader =
- new BufferedReaderIncludingLineEndings(new InputStreamReader(content));
- final List<String> body = reader.toList();
- reader.close();
-
- int line = 0;
- assertEquals(10, body.size());
- assertTrue(body.get(line++).contains("--batch_"));
- assertEquals("Content-Type: application/http" + CRLF, body.get(line++));
- assertEquals("Content-Transfer-Encoding: binary" + CRLF, body.get(line++));
- assertEquals(CRLF, body.get(line++));
- assertEquals("HTTP/1.1 200 OK" + CRLF, body.get(line++));
- assertEquals("Content-Type: application/json" + CRLF, body.get(line++));
- assertEquals("Content-Length: 13" + CRLF, body.get(line++));
- assertEquals(CRLF, body.get(line++));
- assertEquals("Walter Winter" + CRLF, body.get(line++));
- assertTrue(body.get(line++).contains("--batch_"));
- }
-
- @Test
- public void testChangeSetResponse() throws Exception {
- List<ODataResponsePart> parts = new ArrayList<ODataResponsePart>();
- ODataResponse response = new ODataResponse();
- response.setHeader(BatchParserCommon.HTTP_CONTENT_ID, "1");
- response.setStatusCode(HttpStatusCode.NO_CONTENT.getStatusCode());
-
- List<ODataResponse> responses = new ArrayList<ODataResponse>(1);
- responses.add(response);
- parts.add(new ODataResponsePart(responses, true));
-
- BatchResponseSerializer serializer = new BatchResponseSerializer();
- final InputStream content = serializer.serialize(parts, BOUNDARY);
-
- assertNotNull(content);
-
- final BufferedReaderIncludingLineEndings reader =
- new BufferedReaderIncludingLineEndings(new InputStreamReader(content));
- final List<String> body = reader.toList();
- reader.close();
-
- int line = 0;
- assertEquals(14, body.size());
- assertTrue(body.get(line++).contains("--batch_"));
- assertTrue(body.get(line++).contains("Content-Type: multipart/mixed; boundary=changeset_"));
- assertEquals(CRLF, body.get(line++));
- assertTrue(body.get(line++).contains("--changeset_"));
- assertEquals("Content-Type: application/http" + CRLF, body.get(line++));
- assertEquals("Content-Transfer-Encoding: binary" + CRLF, body.get(line++));
- assertEquals("Content-Id: 1" + CRLF, body.get(line++));
- assertEquals(CRLF, body.get(line++));
- assertEquals("HTTP/1.1 204 No Content" + CRLF, body.get(line++));
- assertEquals("Content-Length: 0" + CRLF, body.get(line++));
- assertEquals(CRLF, body.get(line++));
- assertEquals(CRLF, body.get(line++));
- assertTrue(body.get(line++).contains("--changeset_"));
- assertTrue(body.get(line++).contains("--batch_"));
- }
-}
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/FixedFormatSerializerTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/FixedFormatSerializerTest.java
deleted file mode 100644
index ce319fc..0000000
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/FixedFormatSerializerTest.java
+++ /dev/null
@@ -1,57 +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.serializer;
-
-import static org.junit.Assert.assertEquals;
-
-import org.apache.commons.io.IOUtils;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
-import org.apache.olingo.server.api.OData;
-import org.apache.olingo.server.api.serializer.FixedFormatSerializer;
-import org.apache.olingo.server.api.serializer.PrimitiveValueSerializerOptions;
-import org.apache.olingo.server.api.serializer.SerializerException;
-import org.junit.Test;
-
-public class FixedFormatSerializerTest {
-
- private final FixedFormatSerializer serializer;
-
- public FixedFormatSerializerTest() throws SerializerException {
- serializer = OData.newInstance().createFixedFormatSerializer();
- }
-
- @Test
- public void binary() throws Exception {
- assertEquals("ABC", IOUtils.toString(serializer.binary(new byte [] { 0x41, 0x42, 0x43 })));
- }
-
- @Test
- public void count() throws Exception {
- assertEquals("42", IOUtils.toString(serializer.count(42)));
- }
-
- @Test
- public void primitiveValue() throws Exception {
- final EdmPrimitiveType type = EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Int32);
- assertEquals("42", IOUtils.toString(serializer.primitiveValue(type, 42,
- PrimitiveValueSerializerOptions.with().nullable(true).build())));
- }
-}
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/json/ComplexTypeHelper.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/json/ComplexTypeHelper.java
deleted file mode 100644
index 83368d6..0000000
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/json/ComplexTypeHelper.java
+++ /dev/null
@@ -1,66 +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.serializer.json;
-
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.olingo.commons.api.ODataException;
-import org.apache.olingo.commons.api.edm.EdmComplexType;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.server.api.edm.provider.ComplexType;
-import org.apache.olingo.server.api.edm.provider.EdmProvider;
-import org.apache.olingo.server.api.edm.provider.NavigationProperty;
-import org.apache.olingo.server.api.edm.provider.Property;
-import org.apache.olingo.server.core.edm.provider.EdmComplexTypeImpl;
-import org.apache.olingo.server.core.edm.provider.EdmProviderImpl;
-
-public class ComplexTypeHelper {
-
- public static EdmComplexType createType() throws ODataException {
- EdmProvider provider = mock(EdmProvider.class);
- EdmProviderImpl edm = new EdmProviderImpl(provider);
-
- FullQualifiedName baseName = new FullQualifiedName("namespace", "BaseTypeName");
- ComplexType baseComplexType = new ComplexType();
- List<Property> baseProperties = new ArrayList<Property>();
- baseProperties.add(new Property().setName("prop1").setType(EdmPrimitiveTypeKind.String.getFullQualifiedName()));
- List<NavigationProperty> baseNavigationProperties = new ArrayList<NavigationProperty>();
- baseNavigationProperties.add(new NavigationProperty().setName("nav1"));
- baseComplexType.setName("BaseTypeName").setAbstract(false).setOpenType(false).setProperties(baseProperties)
- .setNavigationProperties(baseNavigationProperties);
- when(provider.getComplexType(baseName)).thenReturn(baseComplexType);
-
- FullQualifiedName name = new FullQualifiedName("namespace", "typeName");
- ComplexType complexType = new ComplexType().setBaseType(baseName);
- List<Property> properties = new ArrayList<Property>();
- properties.add(new Property().setName("prop2").setType(EdmPrimitiveTypeKind.String.getFullQualifiedName()));
- List<NavigationProperty> navigationProperties = new ArrayList<NavigationProperty>();
- navigationProperties.add(new NavigationProperty().setName("nav2"));
- complexType.setName("BaseTypeName").setAbstract(false).setOpenType(false).setProperties(properties)
- .setNavigationProperties(navigationProperties);
- when(provider.getComplexType(name)).thenReturn(complexType);
-
- return EdmComplexTypeImpl.getInstance(edm, name, complexType);
- }
-}
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/json/ODataErrorSerializerTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/json/ODataErrorSerializerTest.java
deleted file mode 100644
index 4e44db4..0000000
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/json/ODataErrorSerializerTest.java
+++ /dev/null
@@ -1,136 +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.serializer.json;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.commons.io.IOUtils;
-import org.apache.olingo.commons.api.domain.ODataErrorDetail;
-import org.apache.olingo.commons.api.format.ODataFormat;
-import org.apache.olingo.server.api.OData;
-import org.apache.olingo.server.api.ODataServerError;
-import org.apache.olingo.server.api.serializer.ODataSerializer;
-import org.apache.olingo.server.api.serializer.SerializerException;
-import org.junit.Before;
-import org.junit.Test;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.node.JsonNodeType;
-
-public class ODataErrorSerializerTest {
-
- ODataSerializer ser;
-
- @Before
- public void before() throws Exception {
- ser = OData.newInstance().createSerializer(ODataFormat.JSON);
- }
-
- @Test
- public void basicODataErrorNoCode() throws Exception {
- ODataServerError error = new ODataServerError();
- error.setMessage("ErrorMessage");
- InputStream stream = ser.error(error);
- String jsonString = IOUtils.toString(stream);
- assertEquals("{\"error\":{\"code\":null,\"message\":\"ErrorMessage\"}}", jsonString);
- }
-
- @Test
- public void basicODataErrorWithCode() throws Exception {
- ODataServerError error = new ODataServerError();
- error.setCode("Code").setMessage("ErrorMessage");
- InputStream stream = ser.error(error);
- String jsonString = IOUtils.toString(stream);
- assertEquals("{\"error\":{\"code\":\"Code\",\"message\":\"ErrorMessage\"}}", jsonString);
- }
-
- @Test
- public void basicODataErrorWithCodeAndTarget() throws Exception {
- ODataServerError error = new ODataServerError();
- error.setCode("Code").setMessage("ErrorMessage").setTarget("Target");
- InputStream stream = ser.error(error);
- String jsonString = IOUtils.toString(stream);
- assertEquals("{\"error\":{\"code\":\"Code\",\"message\":\"ErrorMessage\",\"target\":\"Target\"}}", jsonString);
- }
-
- @Test(expected = SerializerException.class)
- public void nullErrorResultsInException() throws Exception {
- ser.error(null);
- }
-
- @Test
- public void emptyDetailsList() throws Exception {
- ODataServerError error = new ODataServerError();
- error.setMessage("ErrorMessage").setDetails(new ArrayList<ODataErrorDetail>());
- InputStream stream = ser.error(error);
- String jsonString = IOUtils.toString(stream);
- assertEquals("{\"error\":{\"code\":null,\"message\":\"ErrorMessage\",\"details\":[]}}", jsonString);
- }
-
- @Test
- public void nothingSetAtODataErrorObject() throws Exception {
- ODataServerError error = new ODataServerError();
- InputStream stream = ser.error(error);
- String jsonString = IOUtils.toString(stream);
- assertEquals("{\"error\":{\"code\":null,\"message\":null}}", jsonString);
- }
-
- @Test
- public void singleDetailNothingSet() throws Exception {
- List<ODataErrorDetail> details = new ArrayList<ODataErrorDetail>();
- details.add(new ODataErrorDetail());
- ODataServerError error = new ODataServerError().setDetails(details);
- InputStream stream = ser.error(error);
- String jsonString = IOUtils.toString(stream);
- assertEquals("{\"error\":{\"code\":null,\"message\":null,\"details\":[{\"code\":null,\"message\":null}]}}",
- jsonString);
- }
-
- @Test
- public void verifiedWithJacksonParser() throws Exception {
- List<ODataErrorDetail> details = new ArrayList<ODataErrorDetail>();
- details.add(new ODataErrorDetail().setCode("detailCode").setMessage("detailMessage").setTarget("detailTarget"));
- ODataServerError error =
- new ODataServerError().setCode("Code").setMessage("Message").setTarget("Target").setDetails(details);
- InputStream stream = ser.error(error);
- JsonNode tree = new ObjectMapper().readTree(stream);
- assertNotNull(tree);
- tree = tree.get("error");
- assertNotNull(tree);
- assertEquals("Code", tree.get("code").textValue());
- assertEquals("Message", tree.get("message").textValue());
- assertEquals("Target", tree.get("target").textValue());
-
- tree = tree.get("details");
- assertNotNull(tree);
- assertEquals(JsonNodeType.ARRAY, tree.getNodeType());
-
- tree = tree.get(0);
- assertNotNull(tree);
- assertEquals("detailCode", tree.get("code").textValue());
- assertEquals("detailMessage", tree.get("message").textValue());
- assertEquals("detailTarget", tree.get("target").textValue());
- }
-}
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/json/ODataJsonSerializerTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/json/ODataJsonSerializerTest.java
deleted file mode 100644
index da7cb08..0000000
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/json/ODataJsonSerializerTest.java
+++ /dev/null
@@ -1,71 +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.serializer.json;
-
-import static org.junit.Assert.assertEquals;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.olingo.commons.api.ODataException;
-import org.apache.olingo.commons.api.data.ContextURL;
-import org.apache.olingo.commons.api.data.Property;
-import org.apache.olingo.commons.api.data.ValueType;
-import org.apache.olingo.commons.api.format.ODataFormat;
-import org.apache.olingo.commons.core.data.PropertyImpl;
-import org.apache.olingo.server.api.serializer.ComplexSerializerOptions;
-import org.junit.Test;
-
-public class ODataJsonSerializerTest {
- @Test
- public void testCollectionComplex() throws ODataException, IOException {
- final List<Property> col = new ArrayList<Property>();
- col.add(new PropertyImpl(null, "ComplexOne", ValueType.COMPLEX, getValues(1)));
- col.add(new PropertyImpl(null, "ComplexTwo", ValueType.COMPLEX, getValues(2)));
- final Property complexCollection = new PropertyImpl(null, "ComplexCol", ValueType.COLLECTION_COMPLEX, col);
-
- final ODataJsonSerializer serializer = new ODataJsonSerializer(ODataFormat.APPLICATION_JSON);
- final ComplexSerializerOptions options = ComplexSerializerOptions.with()
- .contextURL(ContextURL.with().selectList("ComplexCollection").build()).build();
- final InputStream in = serializer.complexCollection(ComplexTypeHelper.createType(), complexCollection, options);
- final BufferedReader reader = new BufferedReader(new InputStreamReader(in));
-
- String line;
- while ((line = reader.readLine()) != null) {
- if (line.contains("value")) {
- assertEquals("{\"@odata.context\":\"$metadata(ComplexCollection)\",\"value\":"
- + "[{\"prop1\":\"test1\",\"prop2\":\"test11\"},{\"prop1\":\"test2\",\"prop2\":\"test22\"}]}", line);
- }
- }
-
- }
-
- private List<Property> getValues(int i) {
- final List<Property> values = new ArrayList<Property>();
-
- values.add(new PropertyImpl(null, "prop1", ValueType.PRIMITIVE, "test" + i));
- values.add(new PropertyImpl(null, "prop2", ValueType.PRIMITIVE, "test" + i + i));
-
- return values;
- }
-}
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/utils/ContextURLBuilderTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/utils/ContextURLBuilderTest.java
deleted file mode 100644
index 0e8e8bd..0000000
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/utils/ContextURLBuilderTest.java
+++ /dev/null
@@ -1,201 +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.serializer.utils;
-
-import static org.junit.Assert.assertEquals;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.olingo.commons.api.data.ContextURL;
-import org.apache.olingo.commons.api.data.ContextURL.Suffix;
-import org.apache.olingo.commons.api.edm.EdmComplexType;
-import org.apache.olingo.commons.api.edm.EdmEntitySet;
-import org.apache.olingo.commons.api.edm.EdmEntityType;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmString;
-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.NavigationProperty;
-import org.apache.olingo.server.api.edm.provider.Property;
-import org.apache.olingo.server.core.edm.provider.EdmComplexTypeImpl;
-import org.apache.olingo.server.core.edm.provider.EdmProviderImpl;
-import org.junit.Test;
-import org.mockito.Mockito;
-
-public class ContextURLBuilderTest {
-
- @Test
- public void buildServiceDocument() {
- final ContextURL contextURL = ContextURL.with()
- .serviceRoot(URI.create("http://host/service/")).build();
- assertEquals("http://host/service/$metadata", ContextURLBuilder.create(contextURL).toASCIIString());
- }
-
- @Test
- public void buildRelative() {
- final ContextURL contextURL = ContextURL.with().build();
- assertEquals("$metadata", ContextURLBuilder.create(contextURL).toASCIIString());
- }
-
- @Test
- public void buildEntitySet() {
- EdmEntitySet entitySet = Mockito.mock(EdmEntitySet.class);
- Mockito.when(entitySet.getName()).thenReturn("Customers");
- final ContextURL contextURL = ContextURL.with().serviceRoot(URI.create("http://host/service/"))
- .entitySet(entitySet)
- .build();
- assertEquals("http://host/service/$metadata#Customers", ContextURLBuilder.create(contextURL).toASCIIString());
- }
-
- @Test
- public void buildDerivedEntitySet() {
- EdmEntitySet entitySet = Mockito.mock(EdmEntitySet.class);
- Mockito.when(entitySet.getName()).thenReturn("Customers");
- EdmEntityType derivedType = Mockito.mock(EdmEntityType.class);
- Mockito.when(derivedType.getFullQualifiedName()).thenReturn(new FullQualifiedName("Model", "VipCustomer"));
- final ContextURL contextURL = ContextURL.with().serviceRoot(URI.create("http://host/service/"))
- .entitySet(entitySet)
- .derived(derivedType)
- .build();
- assertEquals("http://host/service/$metadata#Customers/Model.VipCustomer",
- ContextURLBuilder.create(contextURL).toASCIIString());
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void buildDerivedEntitySetWithoutEntitySet() {
- EdmEntityType derivedType = Mockito.mock(EdmEntityType.class);
- Mockito.when(derivedType.getFullQualifiedName()).thenReturn(new FullQualifiedName("Model", "VipCustomer"));
- ContextURLBuilder.create(ContextURL.with().derived(derivedType).build());
- }
-
- @Test
- public void buildDerivedEntity() {
- EdmEntitySet entitySet = Mockito.mock(EdmEntitySet.class);
- Mockito.when(entitySet.getName()).thenReturn("Customers");
- EdmEntityType derivedType = Mockito.mock(EdmEntityType.class);
- Mockito.when(derivedType.getFullQualifiedName()).thenReturn(new FullQualifiedName("Model", "VipCustomer"));
- final ContextURL contextURL = ContextURL.with().serviceRoot(URI.create("http://host/service/"))
- .entitySet(entitySet)
- .derived(derivedType)
- .suffix(Suffix.ENTITY)
- .build();
- assertEquals("http://host/service/$metadata#Customers/Model.VipCustomer/$entity",
- ContextURLBuilder.create(contextURL).toASCIIString());
- }
-
- @Test
- public void buildProperty() {
- EdmEntitySet entitySet = Mockito.mock(EdmEntitySet.class);
- Mockito.when(entitySet.getName()).thenReturn("Customers");
- ContextURL contextURL = ContextURL.with().serviceRoot(URI.create("http://host/service/"))
- .entitySet(entitySet)
- .keyPath("1")
- .navOrPropertyPath("Name")
- .build();
- assertEquals("http://host/service/$metadata#Customers(1)/Name",
- ContextURLBuilder.create(contextURL).toASCIIString());
-
- contextURL = ContextURL.with().serviceRoot(URI.create("http://host/service/"))
- .entitySet(entitySet)
- .keyPath("one=1,two='two'")
- .navOrPropertyPath("ComplexName")
- .selectList("Part1")
- .build();
- assertEquals("http://host/service/$metadata#Customers(one=1,two='two')/ComplexName(Part1)",
- ContextURLBuilder.create(contextURL).toASCIIString());
- }
-
- @Test
- public void buildPrimitiveType() {
- EdmEntitySet entitySet = Mockito.mock(EdmEntitySet.class);
- Mockito.when(entitySet.getName()).thenReturn("Customers");
- ContextURL contextURL = ContextURL.with().serviceRoot(URI.create("http://host/service/"))
- .type(EdmString.getInstance())
- .build();
- assertEquals("http://host/service/$metadata#Edm.String",
- ContextURLBuilder.create(contextURL).toASCIIString());
-
- contextURL = ContextURL.with().serviceRoot(URI.create("http://host/service/"))
- .type(EdmString.getInstance()).asCollection()
- .build();
- assertEquals("http://host/service/$metadata#Collection(Edm.String)",
- ContextURLBuilder.create(contextURL).toString());
- }
-
- @Test
- public void buildComplexType() throws Exception {
- EdmProvider provider = mock(EdmProvider.class);
- EdmProviderImpl edm = new EdmProviderImpl(provider);
-
- FullQualifiedName baseName = new FullQualifiedName("namespace", "BaseTypeName");
- ComplexType baseComplexType = new ComplexType();
- List<Property> baseProperties = new ArrayList<Property>();
- baseProperties.add(new Property().setName("prop1").setType(EdmPrimitiveTypeKind.String.getFullQualifiedName()));
- List<NavigationProperty> baseNavigationProperties = new ArrayList<NavigationProperty>();
- baseNavigationProperties.add(new NavigationProperty().setName("nav1"));
- baseComplexType.setName("BaseTypeName").setAbstract(false).setOpenType(false).setProperties(baseProperties)
- .setNavigationProperties(baseNavigationProperties);
- when(provider.getComplexType(baseName)).thenReturn(baseComplexType);
-
- EdmComplexType baseType = EdmComplexTypeImpl.getInstance(edm, baseName, baseComplexType);
-
- EdmEntitySet entitySet = Mockito.mock(EdmEntitySet.class);
- Mockito.when(entitySet.getName()).thenReturn("Customers");
- ContextURL contextURL = ContextURL.with().serviceRoot(URI.create("http://host/service/"))
- .type(baseType)
- .build();
- assertEquals("http://host/service/$metadata#namespace.BaseTypeName",
- ContextURLBuilder.create(contextURL).toASCIIString());
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void buildSuffixWithoutEntitySet() {
- ContextURLBuilder.create(ContextURL.with().suffix(Suffix.ENTITY).build());
- }
-
- @Test
- public void buildReference() {
- final ContextURL contextURL = ContextURL.with().suffix(Suffix.REFERENCE).build();
- assertEquals("$metadata#$ref", ContextURLBuilder.create(contextURL).toASCIIString());
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void buildReferenceWithEntitySet() {
- EdmEntitySet entitySet = Mockito.mock(EdmEntitySet.class);
- Mockito.when(entitySet.getName()).thenReturn("Customers");
- ContextURLBuilder.create(ContextURL.with().entitySet(entitySet).suffix(Suffix.REFERENCE).build());
- }
-
- @Test
- public void buildWithCharactersToBeEscaped() {
- EdmEntitySet entitySet = Mockito.mock(EdmEntitySet.class);
- Mockito.when(entitySet.getName()).thenReturn("Entitäten");
- EdmEntityType derivedType = Mockito.mock(EdmEntityType.class);
- Mockito.when(derivedType.getFullQualifiedName()).thenReturn(
- new FullQualifiedName("Namensräumchen", "UnüblicherName"));
- final ContextURL contextURL = ContextURL.with().entitySet(entitySet).derived(derivedType).build();
- assertEquals("$metadata#Entit%C3%A4ten/Namensr%C3%A4umchen.Un%C3%BCblicherName",
- ContextURLBuilder.create(contextURL).toString());
- }
-}
diff --git a/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentXmlSerializerTest.java b/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentXmlSerializerTest.java
deleted file mode 100644
index 8b54fdf..0000000
--- a/lib/server-core/src/test/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentXmlSerializerTest.java
+++ /dev/null
@@ -1,501 +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.serializer.xml;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-import java.io.InputStream;
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-
-import org.apache.commons.io.IOUtils;
-import org.apache.olingo.commons.api.ODataException;
-import org.apache.olingo.commons.api.edm.Edm;
-import org.apache.olingo.commons.api.edm.EdmComplexType;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
-import org.apache.olingo.commons.api.edm.EdmSchema;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
-import org.apache.olingo.commons.api.format.ODataFormat;
-import org.apache.olingo.server.api.OData;
-import org.apache.olingo.server.api.ServiceMetadata;
-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.EntityContainer;
-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.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.ReturnType;
-import org.apache.olingo.server.api.edm.provider.Schema;
-import org.apache.olingo.server.api.edm.provider.Singleton;
-import org.apache.olingo.server.api.edmx.EdmxReference;
-import org.apache.olingo.server.api.edmx.EdmxReferenceInclude;
-import org.apache.olingo.server.api.edmx.EdmxReferenceIncludeAnnotation;
-import org.apache.olingo.server.api.serializer.ODataSerializer;
-import org.apache.olingo.server.api.serializer.SerializerException;
-import org.apache.olingo.server.core.ServiceMetadataImpl;
-import org.apache.olingo.server.core.edm.provider.EdmComplexTypeImpl;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-public class MetadataDocumentXmlSerializerTest {
-
- private static ODataSerializer serializer;
-
- @BeforeClass
- public static void init() throws SerializerException {
- serializer = OData.newInstance().createSerializer(ODataFormat.XML);
- }
-
- @Test
- public void writeMetadataWithEmptyMockedEdm() throws Exception {
- final Edm edm = mock(Edm.class);
- ServiceMetadata metadata = mock(ServiceMetadata.class);
- when(metadata.getEdm()).thenReturn(edm);
-
- assertEquals("<?xml version='1.0' encoding='UTF-8'?>"
- + "<edmx:Edmx Version=\"4.0\" xmlns:edmx=\"http://docs.oasis-open.org/odata/ns/edmx\">"
- + "<edmx:DataServices/></edmx:Edmx>",
- IOUtils.toString(serializer.metadataDocument(metadata)));
- }
-
- /** Writes simplest (empty) Schema. */
- @Test
- public void writeMetadataWithEmptySchema() throws Exception {
- EdmSchema schema = mock(EdmSchema.class);
- when(schema.getNamespace()).thenReturn("MyNamespace");
- Edm edm = mock(Edm.class);
- when(edm.getSchemas()).thenReturn(Arrays.asList(schema));
- ServiceMetadata serviceMetadata = mock(ServiceMetadata.class);
- when(serviceMetadata.getEdm()).thenReturn(edm);
-
- InputStream metadata = serializer.metadataDocument(serviceMetadata);
- assertNotNull(metadata);
- assertEquals("<?xml version='1.0' encoding='UTF-8'?>" +
- "<edmx:Edmx Version=\"4.0\" xmlns:edmx=\"http://docs.oasis-open.org/odata/ns/edmx\">" +
- "<edmx:DataServices>" +
- "<Schema xmlns=\"http://docs.oasis-open.org/odata/ns/edm\" Namespace=\"MyNamespace\"/>" +
- "</edmx:DataServices>" +
- "</edmx:Edmx>",
- IOUtils.toString(metadata));
- }
-
- @Test
- public void writeEdmxWithLocalTestEdm() throws Exception {
- List<EdmxReference> edmxReferences = new ArrayList<EdmxReference>();
- EdmxReference reference = new EdmxReference(URI.create("http://example.com"));
- edmxReferences.add(reference);
-
- EdmxReference referenceWithInclude = new EdmxReference(
- URI.create("http://localhost/odata/odata/v4.0/referenceWithInclude"));
- EdmxReferenceInclude include = new EdmxReferenceInclude("Org.OData.Core.V1", "Core");
- referenceWithInclude.addInclude(include);
- edmxReferences.add(referenceWithInclude);
-
- EdmxReference referenceWithTwoIncludes = new EdmxReference(
- URI.create("http://localhost/odata/odata/v4.0/referenceWithTwoIncludes"));
- referenceWithTwoIncludes.addInclude(new EdmxReferenceInclude("Org.OData.Core.2", "Core2"));
- referenceWithTwoIncludes.addInclude(new EdmxReferenceInclude("Org.OData.Core.3", "Core3"));
- edmxReferences.add(referenceWithTwoIncludes);
-
- EdmxReference referenceWithIncludeAnnos = new EdmxReference(
- URI.create("http://localhost/odata/odata/v4.0/referenceWithIncludeAnnos"));
- referenceWithIncludeAnnos.addIncludeAnnotation(
- new EdmxReferenceIncludeAnnotation("TermNs.2", "Q.2", "TargetNS.2"));
- referenceWithIncludeAnnos.addIncludeAnnotation(
- new EdmxReferenceIncludeAnnotation("TermNs.3", "Q.3", "TargetNS.3"));
- edmxReferences.add(referenceWithIncludeAnnos);
-
- EdmxReference referenceWithAll = new EdmxReference(
- URI.create("http://localhost/odata/odata/v4.0/referenceWithAll"));
- referenceWithAll.addInclude(new EdmxReferenceInclude("ReferenceWithAll.1", "Core1"));
- referenceWithAll.addInclude(new EdmxReferenceInclude("ReferenceWithAll.2", "Core2"));
- referenceWithAll.addIncludeAnnotation(
- new EdmxReferenceIncludeAnnotation("ReferenceWithAllTermNs.4", "Q.4", "TargetNS.4"));
- referenceWithAll.addIncludeAnnotation(
- new EdmxReferenceIncludeAnnotation("ReferenceWithAllTermNs.5", "Q.5", "TargetNS.5"));
- edmxReferences.add(referenceWithAll);
-
- EdmxReference referenceWithAllAndNull = new EdmxReference(
- URI.create("http://localhost/odata/odata/v4.0/referenceWithAllAndNull"));
- referenceWithAllAndNull.addInclude(new EdmxReferenceInclude("referenceWithAllAndNull.1"));
- referenceWithAllAndNull.addInclude(new EdmxReferenceInclude("referenceWithAllAndNull.2", null));
- referenceWithAllAndNull.addIncludeAnnotation(
- new EdmxReferenceIncludeAnnotation("ReferenceWithAllTermNs.4"));
- referenceWithAllAndNull.addIncludeAnnotation(
- new EdmxReferenceIncludeAnnotation("ReferenceWithAllTermAndNullNs.5", "Q.5", null));
- referenceWithAllAndNull.addIncludeAnnotation(
- new EdmxReferenceIncludeAnnotation("ReferenceWithAllTermAndNullNs.6", null, "TargetNS"));
- referenceWithAllAndNull.addIncludeAnnotation(
- new EdmxReferenceIncludeAnnotation("ReferenceWithAllTermAndNullNs.7", null, null));
- edmxReferences.add(referenceWithAllAndNull);
-
- ServiceMetadata serviceMetadata = mock(ServiceMetadata.class);
- final Edm edm = mock(Edm.class);
- when(serviceMetadata.getEdm()).thenReturn(edm);
- when(serviceMetadata.getReferences()).thenReturn(edmxReferences);
-
- InputStream metadata = serializer.metadataDocument(serviceMetadata);
- assertNotNull(metadata);
- final String metadataString = IOUtils.toString(metadata);
- // edmx reference
- assertTrue(metadataString.contains(
- "<edmx:Reference Uri=\"http://example.com\"/>"));
- assertTrue(metadataString.contains(
- "<edmx:Reference " +
- "Uri=\"http://localhost/odata/odata/v4.0/referenceWithInclude\">" +
- "<edmx:Include Namespace=\"Org.OData.Core.V1\" Alias=\"Core\"/>" +
- "</edmx:Reference>"));
- assertTrue(metadataString.contains(
- "<edmx:Reference " +
- "Uri=\"http://localhost/odata/odata/v4.0/referenceWithTwoIncludes\">" +
- "<edmx:Include Namespace=\"Org.OData.Core.2\" Alias=\"Core2\"/>" +
- "<edmx:Include Namespace=\"Org.OData.Core.3\" Alias=\"Core3\"/>" +
- "</edmx:Reference>"));
- assertTrue(metadataString.contains(
- "<edmx:Reference Uri=\"http://localhost/odata/odata/v4.0/referenceWithIncludeAnnos\">" +
- "<edmx:IncludeAnnotations TermNamespace=\"TermNs.2\" Qualifier=\"Q.2\" TargetNamespace=\"TargetNS.2\"/>" +
- "<edmx:IncludeAnnotations TermNamespace=\"TermNs.3\" Qualifier=\"Q.3\" TargetNamespace=\"TargetNS.3\"/>" +
- "</edmx:Reference>"));
- assertTrue(metadataString.contains(
- "<edmx:Reference Uri=\"http://localhost/odata/odata/v4.0/referenceWithAll\">" +
- "<edmx:Include Namespace=\"ReferenceWithAll.1\" Alias=\"Core1\"/>" +
- "<edmx:Include Namespace=\"ReferenceWithAll.2\" Alias=\"Core2\"/>" +
- "<edmx:IncludeAnnotations TermNamespace=\"ReferenceWithAllTermNs.4\" " +
- "Qualifier=\"Q.4\" TargetNamespace=\"TargetNS.4\"/>" +
- "<edmx:IncludeAnnotations TermNamespace=\"ReferenceWithAllTermNs.5\" " +
- "Qualifier=\"Q.5\" TargetNamespace=\"TargetNS.5\"/>" +
- "</edmx:Reference>"));
- assertTrue(metadataString.contains(
- "<edmx:Reference Uri=\"http://localhost/odata/odata/v4.0/referenceWithAllAndNull\">" +
- "<edmx:Include Namespace=\"referenceWithAllAndNull.1\"/>" +
- "<edmx:Include Namespace=\"referenceWithAllAndNull.2\"/>" +
- "<edmx:IncludeAnnotations TermNamespace=\"ReferenceWithAllTermNs.4\"/>" +
- "<edmx:IncludeAnnotations TermNamespace=\"ReferenceWithAllTermAndNullNs.5\" Qualifier=\"Q.5\"/>" +
- "<edmx:IncludeAnnotations TermNamespace=\"ReferenceWithAllTermAndNullNs.6\" " +
- "TargetNamespace=\"TargetNS\"/>" +
- "<edmx:IncludeAnnotations TermNamespace=\"ReferenceWithAllTermAndNullNs.7\"/>" +
- "</edmx:Reference>"));
- }
-
- @Test
- public void aliasTest() throws Exception {
- EdmProvider provider = new LocalProvider();
- ServiceMetadata serviceMetadata =
- new ServiceMetadataImpl(ODataServiceVersion.V40, provider, Collections.<EdmxReference> emptyList());
- InputStream metadataStream = serializer.metadataDocument(serviceMetadata);
- String metadata = IOUtils.toString(metadataStream);
- assertNotNull(metadata);
-
- assertTrue(metadata.contains("<EnumType Name=\"ENString\" IsFlags=\"true\" UnderlyingType=\"Edm.Int16\">"));
- assertTrue(metadata.contains("<EntityType Name=\"ETAbstractBase\" BaseType=\"Alias.ETAbstract\">"));
- assertTrue(metadata.contains("<ComplexType Name=\"CTTwoPrimBase\" BaseType=\"Alias.CTTwoPrim\"/>"));
- assertTrue(metadata.contains("<Property Name=\"PropertyInt16\" Type=\"Edm.Int16\" Nullable=\"false\"/>"));
- assertTrue(metadata.contains("<EntitySet Name=\"ESAllPrim\" EntityType=\"Alias.ETAbstractBase\"/>"));
- assertTrue(metadata.contains("<Singleton Name=\"SI\" EntityType=\"Alias.ETAbstractBase\"/>"));
- assertTrue(metadata.contains("<ActionImport Name=\"AIRTPrimParam\" Action=\"Alias.UARTPrimParam\"/>"));
- assertTrue(metadata.contains("<FunctionImport Name=\"FINRTInt16\" " +
- "Function=\"Alias.UFNRTInt16\" IncludeInServiceDocument=\"true\"/>"));
- }
-
- @Test
- public void writeAbstractComplexType() throws Exception {
- EdmSchema schema = mock(EdmSchema.class);
- when(schema.getNamespace()).thenReturn("MyNamespace");
- Edm edm = mock(Edm.class);
- when(edm.getSchemas()).thenReturn(Arrays.asList(schema));
- ServiceMetadata serviceMetadata = mock(ServiceMetadata.class);
- when(serviceMetadata.getEdm()).thenReturn(edm);
- List<EdmComplexType> complexTypes = new ArrayList<EdmComplexType>();
-
- FullQualifiedName name = new FullQualifiedName("namespace", "ComplexType");
- ComplexType complexType = new ComplexType();
- complexType.setAbstract(true);
- complexType.setName(name.getName());
- complexType.setOpenType(true);
- List<Property> properties = new ArrayList<Property>();
-
- properties.add(new Property().setName("prop1").setType(EdmPrimitiveTypeKind.String.getFullQualifiedName()));
- properties.add(new Property().setName("prop2").setType(EdmPrimitiveTypeKind.String.getFullQualifiedName()));
-
- complexType.setProperties(properties);
- EdmComplexTypeImpl c1 = EdmComplexTypeImpl.getInstance(edm, name, complexType);
- complexTypes.add(c1);
-
- when(schema.getComplexTypes()).thenReturn(complexTypes);
-
-
- InputStream metadataStream = serializer.metadataDocument(serviceMetadata);
- String metadata = IOUtils.toString(metadataStream);
-
- assertTrue(metadata.contains("<ComplexType Name=\"ComplexType\" Abstract=\"true\">"
- + "<Property Name=\"prop1\" Type=\"Edm.String\"/>"
- + "<Property Name=\"prop2\" Type=\"Edm.String\"/>"
- + "</ComplexType>"));
- }
-
- private class LocalProvider extends EdmProvider {
- private final static String nameSpace = "namespace";
-
- private final FullQualifiedName nameETAbstract = new FullQualifiedName(nameSpace, "ETAbstract");
- private final FullQualifiedName nameETAbstractBase = new FullQualifiedName(nameSpace, "ETAbstractBase");
-
- private final FullQualifiedName nameInt16 = EdmPrimitiveTypeKind.Int16.getFullQualifiedName();
- private final FullQualifiedName nameString = EdmPrimitiveTypeKind.String.getFullQualifiedName();
- private final FullQualifiedName nameUARTPrimParam = new FullQualifiedName(nameSpace, "UARTPrimParam");
- private final Property propertyInt16_NotNullable = new Property()
- .setName("PropertyInt16")
- .setType(nameInt16)
- .setNullable(false);
- private final Property propertyString = new Property()
- .setName("PropertyString")
- .setType(nameString);
-
- private final FullQualifiedName nameCTTwoPrim = new FullQualifiedName(nameSpace, "CTTwoPrim");
- private final FullQualifiedName nameCTTwoPrimBase = new FullQualifiedName(nameSpace, "CTTwoPrimBase");
- private final FullQualifiedName nameUFNRTInt16 = new FullQualifiedName(nameSpace, "UFNRTInt16");
- private final FullQualifiedName nameContainer = new FullQualifiedName(nameSpace, "container");
- private final FullQualifiedName nameENString = new FullQualifiedName(nameSpace, "ENString");
-
- @Override
- public List<AliasInfo> getAliasInfos() throws ODataException {
- return Arrays.asList(
- new AliasInfo().setAlias("Alias").setNamespace(nameSpace)
- );
- }
-
- @Override
- public EnumType getEnumType(final FullQualifiedName enumTypeName) throws ODataException {
- return new EnumType()
- .setName("ENString")
- .setFlags(true)
- .setUnderlyingType(EdmPrimitiveTypeKind.Int16.getFullQualifiedName())
- .setMembers(Arrays.asList(
- new EnumMember().setName("String1").setValue("1")));
- }
-
- @Override
- public EntityType getEntityType(final FullQualifiedName entityTypeName) throws ODataException {
- if (entityTypeName.equals(nameETAbstract)) {
- return new EntityType()
- .setName("ETAbstract")
- .setAbstract(true)
- .setProperties(Arrays.asList(propertyString));
-
- } else if (entityTypeName.equals(nameETAbstractBase)) {
- return new EntityType()
- .setName("ETAbstractBase")
- .setBaseType(nameETAbstract)
- .setKey(Arrays.asList(new PropertyRef().setPropertyName("PropertyInt16")))
- .setProperties(Arrays.asList(
- propertyInt16_NotNullable));
- }
- return null;
- }
-
- @Override
- public ComplexType getComplexType(final FullQualifiedName complexTypeName) throws ODataException {
- if (complexTypeName.equals(nameCTTwoPrim)) {
- return new ComplexType()
- .setName("CTTwoPrim")
- .setProperties(Arrays.asList(propertyInt16_NotNullable, propertyString));
-
- }
- if (complexTypeName.equals(nameCTTwoPrimBase)) {
- return new ComplexType()
- .setName("CTTwoPrimBase")
- .setBaseType(nameCTTwoPrim)
- .setProperties(Arrays.asList(propertyInt16_NotNullable, propertyString));
-
- }
- return null;
-
- }
-
- @Override
- public List<Action> 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))
- );
-
- }
- return null;
- }
-
- @Override
- public List<Function> getFunctions(final FullQualifiedName functionName) throws ODataException {
- if (functionName.equals(nameUFNRTInt16)) {
- return Arrays.asList(
- new Function()
- .setName("UFNRTInt16")
- .setParameters(new ArrayList<Parameter>())
- .setReturnType(
- new ReturnType().setType(nameInt16))
- );
-
- }
- return null;
- }
-
- @Override
- public EntitySet getEntitySet(final FullQualifiedName entityContainer, final String entitySetName)
- throws ODataException {
- if (entitySetName.equals("ESAllPrim")) {
- return new EntitySet()
- .setName("ESAllPrim")
- .setType(nameETAbstractBase);
-
- }
- return null;
- }
-
- @Override
- public Singleton getSingleton(final FullQualifiedName entityContainer, final String singletonName)
- throws ODataException {
- if (singletonName.equals("SI")) {
- return new Singleton()
- .setName("SI")
- .setType(nameETAbstractBase);
-
- }
- return null;
- }
-
- @Override
- public ActionImport getActionImport(final FullQualifiedName entityContainer, final String actionImportName)
- throws ODataException {
- if (entityContainer.equals(nameContainer)) {
- if (actionImportName.equals("AIRTPrimParam")) {
- return new ActionImport()
- .setName("AIRTPrimParam")
- .setAction(nameUARTPrimParam);
-
- }
- }
- return null;
- }
-
- @Override
- public FunctionImport getFunctionImport(final FullQualifiedName entityContainer, final String functionImportName)
- throws ODataException {
- if (entityContainer.equals(nameContainer)) {
- if (functionImportName.equals("FINRTInt16")) {
- return new FunctionImport()
- .setName("FINRTInt16")
- .setFunction(nameUFNRTInt16)
- .setIncludeInServiceDocument(true);
-
- }
- }
- return null;
- }
-
- @Override
- public List<Schema> getSchemas() throws ODataException {
- List<Schema> schemas = new ArrayList<Schema>();
- Schema schema = new Schema();
- schema.setNamespace(nameSpace);
- schema.setAlias("Alias");
- schemas.add(schema);
- // EnumTypes
- List<EnumType> enumTypes = new ArrayList<EnumType>();
- schema.setEnumTypes(enumTypes);
- enumTypes.add(getEnumType(nameENString));
- // EntityTypes
- List<EntityType> entityTypes = new ArrayList<EntityType>();
- schema.setEntityTypes(entityTypes);
-
- entityTypes.add(getEntityType(nameETAbstract));
- entityTypes.add(getEntityType(nameETAbstractBase));
-
- // ComplexTypes
- List<ComplexType> complexType = new ArrayList<ComplexType>();
- schema.setComplexTypes(complexType);
- complexType.add(getComplexType(nameCTTwoPrim));
- complexType.add(getComplexType(nameCTTwoPrimBase));
-
- // TypeDefinitions
-
- // Actions
- List<Action> actions = new ArrayList<Action>();
- schema.setActions(actions);
- actions.addAll(getActions(nameUARTPrimParam));
-
- // Functions
- List<Function> functions = new ArrayList<Function>();
- schema.setFunctions(functions);
-
- functions.addAll(getFunctions(nameUFNRTInt16));
-
- // EntityContainer
- schema.setEntityContainer(getEntityContainer());
-
- return schemas;
- }
-
- @Override
- public EntityContainer getEntityContainer() throws ODataException {
- EntityContainer container = new EntityContainer();
- container.setName("container");
-
- // EntitySets
- List<EntitySet> entitySets = new ArrayList<EntitySet>();
- container.setEntitySets(entitySets);
- entitySets.add(getEntitySet(nameContainer, "ESAllPrim"));
-
- // Singletons
- List<Singleton> singletons = new ArrayList<Singleton>();
- container.setSingletons(singletons);
- singletons.add(getSingleton(nameContainer, "SI"));
-
- // ActionImports
- List<ActionImport> actionImports = new ArrayList<ActionImport>();
- container.setActionImports(actionImports);
- actionImports.add(getActionImport(nameContainer, "AIRTPrimParam"));
-
- // FunctionImports
- List<FunctionImport> functionImports = new ArrayList<FunctionImport>();
- container.setFunctionImports(functionImports);
- functionImports.add(getFunctionImport(nameContainer, "FINRTInt16"));
-
- return container;
- }
- }
-}
diff --git a/lib/server-core/src/test/resources/batchLarge.batch b/lib/server-core/src/test/resources/batchLarge.batch
deleted file mode 100644
index faadea1..0000000
--- a/lib/server-core/src/test/resources/batchLarge.batch
+++ /dev/null
@@ -1,2422 +0,0 @@
---batch_8194-cf13-1f56
-Content-Type: application/http
-Content-Transfer-Encoding: binary
-
-GET Employees HTTP/1.1
-Host: http://localhost/odata
-Connection: keep-alive
-Accept: application/atom+xml
-MaxDataServiceVersion: 2.0
-DataServiceVersion: 2.0
-Content-Type: application/atom+xml
-Accept-Encoding: gzip,deflate
-Accept-Language: de-DE,de;q=0.8,en-US;q=0.6,en;q=0.4
-
-
---batch_8194-cf13-1f56
-Content-Type: application/http
-Content-Transfer-Encoding: binary
-
-GET Employees HTTP/1.1
-Host: http://localhost/odata
-Connection: keep-alive
-Accept: application/atom+xml
-MaxDataServiceVersion: 2.0
-DataServiceVersion: 2.0
-Content-Type: application/atom+xml
-Accept-Encoding: gzip,deflate
-Accept-Language: de-DE,de;q=0.8,en-US;q=0.6,en;q=0.4
-
-
---batch_8194-cf13-1f56
-Content-Type: application/http
-Content-Transfer-Encoding: binary
-
-GET Employees HTTP/1.1
-Host: http://localhost/odata
-Connection: keep-alive
-Accept: application/atom+xml
-MaxDataServiceVersion: 2.0
-DataServiceVersion: 2.0
-Content-Type: application/atom+xml
-Accept-Encoding: gzip,deflate
-Accept-Language: de-DE,de;q=0.8,en-US;q=0.6,en;q=0.4
-
-
---batch_8194-cf13-1f56
-Content-Type: multipart/mixed; boundary=changeset_f980-1cb6-94dd
-
---changeset_f980-1cb6-94dd
-Content-Type: application/http
-Content-Transfer-Encoding: binary
-Content-ID: 1
-
-POST Employees HTTP/1.1
-Host: http://localhost/odata
-Connection: keep-alive
-Content-Type: application/atom+xml
-Accept: */*
-Accept-Encoding: gzip,deflate
-Accept-Language: de-DE,de;q=0.8,en-US;q=0.6,en;q=0.4
-
-<entry xmlns="http://www.w3.org/2005/Atom"
- xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
- xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"
- xml:base="http://localhost:8080/org.apache.olingo.odata2.ref.web/ReferenceScenario.svc/"
- m:etag="W/2">
- <id>
- http://localhost:8080/org.apache.olingo.odata2.ref.web/ReferenceScenario.svc/Rooms('2')
- </id>
- <title type="text">Room 2</title>
- <updated>2013-04-03T10:53:26.021+02:00</updated>
- <category term="RefScenario.Room"
- scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
- <link href="Rooms('2')" rel="edit" title="Room" />
- <link href="Rooms('2')/nr_Employees"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/nr_Employees"
- title="nr_Employees" type="application/atom+xml; type=feed">
- <m:inline>
- <feed xmlns="http://www.w3.org/2005/Atom"
- xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
- xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"
- xml:base="http://localhost:8080/org.apache.olingo.odata2.ref.web/ReferenceScenario.svc/">
- <id>
- http://localhost:8080/org.apache.olingo.odata2.ref.web/ReferenceScenario.svc/Employees
- </id>
- <title type="text">Employees</title>
- <updated>2013-04-03T10:53:26.024+02:00</updated>
- <author>
- <name />
- </author>
- <link href="Employees" rel="self" title="Employees" />
- <entry>
- <id>
- http://localhost:8080/org.apache.olingo.odata2.ref.web/ReferenceScenario.svc/Employees('2')
- </id>
- <title type="text">Frederic Fall</title>
- <updated>2003-07-01T00:00:00Z</updated>
- <category term="RefScenario.Employee"
- scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
- <link href="Employees('2')" rel="edit" title="Employee" />
- <link href="Employees('2')/$value" rel="edit-media"
- type="application/octet-stream" />
- <link href="Employees('2')/ne_Manager"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Manager"
- title="ne_Manager" type="application/atom+xml; type=entry" />
- <link href="Employees('2')/ne_Team"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Team"
- title="ne_Team" type="application/atom+xml; type=entry" />
- <link href="Employees('2')/ne_Room"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Room"
- title="ne_Room" type="application/atom+xml; type=entry" />
- <content type="application/octet-stream" src="Employees('2')/$value" />
- <m:properties>
- <d:EmployeeId>2</d:EmployeeId>
- <d:EmployeeName>Frederic Fall</d:EmployeeName>
- <d:ManagerId>1</d:ManagerId>
- <d:RoomId>2</d:RoomId>
- <d:TeamId>1</d:TeamId>
- <d:Location m:type="RefScenario.c_Location">
- <d:City m:type="RefScenario.c_City">
- <d:PostalCode>69190</d:PostalCode>
- <d:CityName>Walldorf</d:CityName>
- </d:City>
- <d:Country>Germany</d:Country>
- </d:Location>
- <d:Age>32</d:Age>
- <d:EntryDate>2003-07-01T00:00:00</d:EntryDate>
- <d:ImageUrl>Employees('2')/$value</d:ImageUrl>
- </m:properties>
- </entry>
- <entry>
- <id>
- http://localhost:8080/org.apache.olingo.odata2.ref.web/ReferenceScenario.svc/Employees('3')
- </id>
- <title type="text">Jonathan Smith</title>
- <updated>2013-04-03T10:53:26.025+02:00</updated>
- <category term="RefScenario.Employee"
- scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
- <link href="Employees('3')" rel="edit" title="Employee" />
- <link href="Employees('3')/$value" rel="edit-media"
- type="application/octet-stream" />
- <link href="Employees('3')/ne_Manager"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Manager"
- title="ne_Manager" type="application/atom+xml; type=entry" />
- <link href="Employees('3')/ne_Team"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Team"
- title="ne_Team" type="application/atom+xml; type=entry" />
- <link href="Employees('3')/ne_Room"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Room"
- title="ne_Room" type="application/atom+xml; type=entry" />
- <content type="application/octet-stream" src="Employees('3')/$value" />
- <m:properties>
- <d:EmployeeId>3</d:EmployeeId>
- <d:EmployeeName>Jonathan Smith</d:EmployeeName>
- <d:ManagerId>1</d:ManagerId>
- <d:RoomId>2</d:RoomId>
- <d:TeamId>1</d:TeamId>
- <d:Location m:type="RefScenario.c_Location">
- <d:City m:type="RefScenario.c_City">
- <d:PostalCode>69190</d:PostalCode>
- <d:CityName>Walldorf</d:CityName>
- </d:City>
- <d:Country>Germany</d:Country>
- </d:Location>
- <d:Age>56</d:Age>
- <d:EntryDate m:null="true" />
- <d:ImageUrl>Employees('3')/$value</d:ImageUrl>
- </m:properties>
- </entry>
- <entry>
- <id>
- http://localhost:8080/org.apache.olingo.odata2.ref.web/ReferenceScenario.svc/Employees('4')
- </id>
- <title type="text">Peter Burke</title>
- <updated>2004-09-12T00:00:00Z</updated>
- <category term="RefScenario.Employee"
- scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
- <link href="Employees('4')" rel="edit" title="Employee" />
- <link href="Employees('4')/$value" rel="edit-media"
- type="application/octet-stream" />
- <link href="Employees('4')/ne_Manager"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Manager"
- title="ne_Manager" type="application/atom+xml; type=entry" />
- <link href="Employees('4')/ne_Team"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Team"
- title="ne_Team" type="application/atom+xml; type=entry" />
- <link href="Employees('4')/ne_Room"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Room"
- title="ne_Room" type="application/atom+xml; type=entry" />
- <content type="application/octet-stream" src="Employees('4')/$value" />
- <m:properties>
- <d:EmployeeId>4</d:EmployeeId>
- <d:EmployeeName>Peter Burke</d:EmployeeName>
- <d:ManagerId>3</d:ManagerId>
- <d:RoomId>2</d:RoomId>
- <d:TeamId>2</d:TeamId>
- <d:Location m:type="RefScenario.c_Location">
- <d:City m:type="RefScenario.c_City">
- <d:PostalCode>69190</d:PostalCode>
- <d:CityName>Walldorf</d:CityName>
- </d:City>
- <d:Country>Germany</d:Country>
- </d:Location>
- <d:Age>39</d:Age>
- <d:EntryDate>2004-09-12T00:00:00</d:EntryDate>
- <d:ImageUrl>Employees('4')/$value</d:ImageUrl>
- </m:properties>
- </entry>
- <entry>
- <id>
- http://localhost:8080/org.apache.olingo.odata2.ref.web/ReferenceScenario.svc/Employees('6')
- </id>
- <title type="text">Susan Bay</title>
- <updated>2010-12-01T00:00:00Z</updated>
- <category term="RefScenario.Employee"
- scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
- <link href="Employees('6')" rel="edit" title="Employee" />
- <link href="Employees('6')/$value" rel="edit-media"
- type="application/octet-stream" />
- <link href="Employees('6')/ne_Manager"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Manager"
- title="ne_Manager" type="application/atom+xml; type=entry" />
- <link href="Employees('6')/ne_Team"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Team"
- title="ne_Team" type="application/atom+xml; type=entry" />
- <link href="Employees('6')/ne_Room"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Room"
- title="ne_Room" type="application/atom+xml; type=entry" />
- <content type="application/octet-stream" src="Employees('6')/$value" />
- <m:properties>
- <d:EmployeeId>6</d:EmployeeId>
- <d:EmployeeName>Susan Bay</d:EmployeeName>
- <d:ManagerId>1</d:ManagerId>
- <d:RoomId>2</d:RoomId>
- <d:TeamId>3</d:TeamId>
- <d:Location m:type="RefScenario.c_Location">
- <d:City m:type="RefScenario.c_City">
- <d:PostalCode>69190</d:PostalCode>
- <d:CityName>Walldorf</d:CityName>
- </d:City>
- <d:Country>Germany</d:Country>
- </d:Location>
- <d:Age>29</d:Age>
- <d:EntryDate>2010-12-01T00:00:00</d:EntryDate>
- <d:ImageUrl>Employees('6')/$value</d:ImageUrl>
- </m:properties>
- </entry>
- </feed>
- </m:inline>
- </link>
- <link href="Rooms('2')/nr_Building"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/nr_Building"
- title="nr_Building" type="application/atom+xml; type=entry" />
- <content type="application/xml">
- <m:properties>
- <d:Id>2</d:Id>
- <d:Name>Room 2</d:Name>
- <d:Seats>5</d:Seats>
- <d:Version>2</d:Version>
- </m:properties>
- </content>
-</entry>
-
---changeset_f980-1cb6-94dd
-Content-Type: application/http
-Content-Transfer-Encoding: binary
-Content-ID: 1
-
-POST Employees HTTP/1.1
-Host: http://localhost/odata
-Connection: keep-alive
-Content-Type: application/atom+xml
-Accept: */*
-Accept-Encoding: gzip,deflate
-Accept-Language: de-DE,de;q=0.8,en-US;q=0.6,en;q=0.4
-
-<entry xmlns="http://www.w3.org/2005/Atom"
- xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
- xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"
- xml:base="http://localhost:8080/org.apache.olingo.odata2.ref.web/ReferenceScenario.svc/"
- m:etag="W/2">
- <id>
- http://localhost:8080/org.apache.olingo.odata2.ref.web/ReferenceScenario.svc/Rooms('2')
- </id>
- <title type="text">Room 2</title>
- <updated>2013-04-03T10:53:26.021+02:00</updated>
- <category term="RefScenario.Room"
- scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
- <link href="Rooms('2')" rel="edit" title="Room" />
- <link href="Rooms('2')/nr_Employees"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/nr_Employees"
- title="nr_Employees" type="application/atom+xml; type=feed">
- <m:inline>
- <feed xmlns="http://www.w3.org/2005/Atom"
- xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
- xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"
- xml:base="http://localhost:8080/org.apache.olingo.odata2.ref.web/ReferenceScenario.svc/">
- <id>
- http://localhost:8080/org.apache.olingo.odata2.ref.web/ReferenceScenario.svc/Employees
- </id>
- <title type="text">Employees</title>
- <updated>2013-04-03T10:53:26.024+02:00</updated>
- <author>
- <name />
- </author>
- <link href="Employees" rel="self" title="Employees" />
- <entry>
- <id>
- http://localhost:8080/org.apache.olingo.odata2.ref.web/ReferenceScenario.svc/Employees('2')
- </id>
- <title type="text">Frederic Fall</title>
- <updated>2003-07-01T00:00:00Z</updated>
- <category term="RefScenario.Employee"
- scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
- <link href="Employees('2')" rel="edit" title="Employee" />
- <link href="Employees('2')/$value" rel="edit-media"
- type="application/octet-stream" />
- <link href="Employees('2')/ne_Manager"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Manager"
- title="ne_Manager" type="application/atom+xml; type=entry" />
- <link href="Employees('2')/ne_Team"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Team"
- title="ne_Team" type="application/atom+xml; type=entry" />
- <link href="Employees('2')/ne_Room"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Room"
- title="ne_Room" type="application/atom+xml; type=entry" />
- <content type="application/octet-stream" src="Employees('2')/$value" />
- <m:properties>
- <d:EmployeeId>2</d:EmployeeId>
- <d:EmployeeName>Frederic Fall</d:EmployeeName>
- <d:ManagerId>1</d:ManagerId>
- <d:RoomId>2</d:RoomId>
- <d:TeamId>1</d:TeamId>
- <d:Location m:type="RefScenario.c_Location">
- <d:City m:type="RefScenario.c_City">
- <d:PostalCode>69190</d:PostalCode>
- <d:CityName>Walldorf</d:CityName>
- </d:City>
- <d:Country>Germany</d:Country>
- </d:Location>
- <d:Age>32</d:Age>
- <d:EntryDate>2003-07-01T00:00:00</d:EntryDate>
- <d:ImageUrl>Employees('2')/$value</d:ImageUrl>
- </m:properties>
- </entry>
- <entry>
- <id>
- http://localhost:8080/org.apache.olingo.odata2.ref.web/ReferenceScenario.svc/Employees('3')
- </id>
- <title type="text">Jonathan Smith</title>
- <updated>2013-04-03T10:53:26.025+02:00</updated>
- <category term="RefScenario.Employee"
- scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
- <link href="Employees('3')" rel="edit" title="Employee" />
- <link href="Employees('3')/$value" rel="edit-media"
- type="application/octet-stream" />
- <link href="Employees('3')/ne_Manager"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Manager"
- title="ne_Manager" type="application/atom+xml; type=entry" />
- <link href="Employees('3')/ne_Team"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Team"
- title="ne_Team" type="application/atom+xml; type=entry" />
- <link href="Employees('3')/ne_Room"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Room"
- title="ne_Room" type="application/atom+xml; type=entry" />
- <content type="application/octet-stream" src="Employees('3')/$value" />
- <m:properties>
- <d:EmployeeId>3</d:EmployeeId>
- <d:EmployeeName>Jonathan Smith</d:EmployeeName>
- <d:ManagerId>1</d:ManagerId>
- <d:RoomId>2</d:RoomId>
- <d:TeamId>1</d:TeamId>
- <d:Location m:type="RefScenario.c_Location">
- <d:City m:type="RefScenario.c_City">
- <d:PostalCode>69190</d:PostalCode>
- <d:CityName>Walldorf</d:CityName>
- </d:City>
- <d:Country>Germany</d:Country>
- </d:Location>
- <d:Age>56</d:Age>
- <d:EntryDate m:null="true" />
- <d:ImageUrl>Employees('3')/$value</d:ImageUrl>
- </m:properties>
- </entry>
- <entry>
- <id>
- http://localhost:8080/org.apache.olingo.odata2.ref.web/ReferenceScenario.svc/Employees('4')
- </id>
- <title type="text">Peter Burke</title>
- <updated>2004-09-12T00:00:00Z</updated>
- <category term="RefScenario.Employee"
- scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
- <link href="Employees('4')" rel="edit" title="Employee" />
- <link href="Employees('4')/$value" rel="edit-media"
- type="application/octet-stream" />
- <link href="Employees('4')/ne_Manager"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Manager"
- title="ne_Manager" type="application/atom+xml; type=entry" />
- <link href="Employees('4')/ne_Team"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Team"
- title="ne_Team" type="application/atom+xml; type=entry" />
- <link href="Employees('4')/ne_Room"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Room"
- title="ne_Room" type="application/atom+xml; type=entry" />
- <content type="application/octet-stream" src="Employees('4')/$value" />
- <m:properties>
- <d:EmployeeId>4</d:EmployeeId>
- <d:EmployeeName>Peter Burke</d:EmployeeName>
- <d:ManagerId>3</d:ManagerId>
- <d:RoomId>2</d:RoomId>
- <d:TeamId>2</d:TeamId>
- <d:Location m:type="RefScenario.c_Location">
- <d:City m:type="RefScenario.c_City">
- <d:PostalCode>69190</d:PostalCode>
- <d:CityName>Walldorf</d:CityName>
- </d:City>
- <d:Country>Germany</d:Country>
- </d:Location>
- <d:Age>39</d:Age>
- <d:EntryDate>2004-09-12T00:00:00</d:EntryDate>
- <d:ImageUrl>Employees('4')/$value</d:ImageUrl>
- </m:properties>
- </entry>
- <entry>
- <id>
- http://localhost:8080/org.apache.olingo.odata2.ref.web/ReferenceScenario.svc/Employees('6')
- </id>
- <title type="text">Susan Bay</title>
- <updated>2010-12-01T00:00:00Z</updated>
- <category term="RefScenario.Employee"
- scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
- <link href="Employees('6')" rel="edit" title="Employee" />
- <link href="Employees('6')/$value" rel="edit-media"
- type="application/octet-stream" />
- <link href="Employees('6')/ne_Manager"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Manager"
- title="ne_Manager" type="application/atom+xml; type=entry" />
- <link href="Employees('6')/ne_Team"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Team"
- title="ne_Team" type="application/atom+xml; type=entry" />
- <link href="Employees('6')/ne_Room"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Room"
- title="ne_Room" type="application/atom+xml; type=entry" />
- <content type="application/octet-stream" src="Employees('6')/$value" />
- <m:properties>
- <d:EmployeeId>6</d:EmployeeId>
- <d:EmployeeName>Susan Bay</d:EmployeeName>
- <d:ManagerId>1</d:ManagerId>
- <d:RoomId>2</d:RoomId>
- <d:TeamId>3</d:TeamId>
- <d:Location m:type="RefScenario.c_Location">
- <d:City m:type="RefScenario.c_City">
- <d:PostalCode>69190</d:PostalCode>
- <d:CityName>Walldorf</d:CityName>
- </d:City>
- <d:Country>Germany</d:Country>
- </d:Location>
- <d:Age>29</d:Age>
- <d:EntryDate>2010-12-01T00:00:00</d:EntryDate>
- <d:ImageUrl>Employees('6')/$value</d:ImageUrl>
- </m:properties>
- </entry>
- </feed>
- </m:inline>
- </link>
- <link href="Rooms('2')/nr_Building"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/nr_Building"
- title="nr_Building" type="application/atom+xml; type=entry" />
- <content type="application/xml">
- <m:properties>
- <d:Id>2</d:Id>
- <d:Name>Room 2</d:Name>
- <d:Seats>5</d:Seats>
- <d:Version>2</d:Version>
- </m:properties>
- </content>
-</entry>
-
---changeset_f980-1cb6-94dd
-Content-Type: application/http
-Content-Transfer-Encoding: binary
-Content-ID: 1
-
-PUT Employees('1') HTTP/1.1
-Host: http://localhost/odata
-Connection: keep-alive
-
-Content-Type: application/atom+xml
-Accept: */*
-Accept-Encoding: gzip,deflate
-Accept-Language: de-DE,de;q=0.8,en-US;q=0.6,en;q=0.4
-
-<?xml version='1.0' encoding='utf-8'?>
-<entry xmlns="http://www.w3.org/2005/Atom"
- xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
- xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"
- xml:base="http://localhost:19000/abc/EntryXmlChangeTest/">
- <id>http://localhost:19000/abc/EntryXmlChangeTest/Employees('9')</id>
- <title type="text">Mister X</title>
- <updated m:null='true'>Z</updated>
- <category term="RefScenario.Employee"
- scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
- <content type="image/jpeg" src="Employees('1')/$value" />
- <m:properties>
- <d:EmployeeId>1</d:EmployeeId>
- <d:EmployeeName>Mister X</d:EmployeeName>
- <d:ManagerId>1</d:ManagerId>
- <d:RoomId>2</d:RoomId>
- <d:TeamId>1</d:TeamId>
- <d:Location m:type="RefScenario.c_Location">
- <d:City m:type="RefScenario.c_City">
- <d:PostalCode>69190</d:PostalCode>
- <d:CityName>Walldorf</d:CityName>
- </d:City>
- <d:Country>Germany</d:Country>
- </d:Location>
- <d:EntryDate m:null='true'></d:EntryDate>
- <d:ImageUrl>Employees('1')/$value</d:ImageUrl>
- </m:properties>
-</entry>
---changeset_f980-1cb6-94dd--
---batch_8194-cf13-1f56
-Content-Type: multipart/mixed; boundary=changeset_f980-1cb6-94dd
-
---changeset_f980-1cb6-94dd
-Content-Type: application/http
-Content-Transfer-Encoding: binary
-Content-ID: 1
-
-POST Employees HTTP/1.1
-Host: http://localhost/odata
-Connection: keep-alive
-Content-Type: application/atom+xml
-Accept: */*
-Accept-Encoding: gzip,deflate
-Accept-Language: de-DE,de;q=0.8,en-US;q=0.6,en;q=0.4
-
-<entry xmlns="http://www.w3.org/2005/Atom"
- xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
- xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"
- xml:base="http://localhost:8080/org.apache.olingo.odata2.ref.web/ReferenceScenario.svc/"
- m:etag="W/2">
- <id>
- http://localhost:8080/org.apache.olingo.odata2.ref.web/ReferenceScenario.svc/Rooms('2')
- </id>
- <title type="text">Room 2</title>
- <updated>2013-04-03T10:53:26.021+02:00</updated>
- <category term="RefScenario.Room"
- scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
- <link href="Rooms('2')" rel="edit" title="Room" />
- <link href="Rooms('2')/nr_Employees"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/nr_Employees"
- title="nr_Employees" type="application/atom+xml; type=feed">
- <m:inline>
- <feed xmlns="http://www.w3.org/2005/Atom"
- xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
- xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"
- xml:base="http://localhost:8080/org.apache.olingo.odata2.ref.web/ReferenceScenario.svc/">
- <id>
- http://localhost:8080/org.apache.olingo.odata2.ref.web/ReferenceScenario.svc/Employees
- </id>
- <title type="text">Employees</title>
- <updated>2013-04-03T10:53:26.024+02:00</updated>
- <author>
- <name />
- </author>
- <link href="Employees" rel="self" title="Employees" />
- <entry>
- <id>
- http://localhost:8080/org.apache.olingo.odata2.ref.web/ReferenceScenario.svc/Employees('2')
- </id>
- <title type="text">Frederic Fall</title>
- <updated>2003-07-01T00:00:00Z</updated>
- <category term="RefScenario.Employee"
- scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
- <link href="Employees('2')" rel="edit" title="Employee" />
- <link href="Employees('2')/$value" rel="edit-media"
- type="application/octet-stream" />
- <link href="Employees('2')/ne_Manager"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Manager"
- title="ne_Manager" type="application/atom+xml; type=entry" />
- <link href="Employees('2')/ne_Team"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Team"
- title="ne_Team" type="application/atom+xml; type=entry" />
- <link href="Employees('2')/ne_Room"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Room"
- title="ne_Room" type="application/atom+xml; type=entry" />
- <content type="application/octet-stream" src="Employees('2')/$value" />
- <m:properties>
- <d:EmployeeId>2</d:EmployeeId>
- <d:EmployeeName>Frederic Fall</d:EmployeeName>
- <d:ManagerId>1</d:ManagerId>
- <d:RoomId>2</d:RoomId>
- <d:TeamId>1</d:TeamId>
- <d:Location m:type="RefScenario.c_Location">
- <d:City m:type="RefScenario.c_City">
- <d:PostalCode>69190</d:PostalCode>
- <d:CityName>Walldorf</d:CityName>
- </d:City>
- <d:Country>Germany</d:Country>
- </d:Location>
- <d:Age>32</d:Age>
- <d:EntryDate>2003-07-01T00:00:00</d:EntryDate>
- <d:ImageUrl>Employees('2')/$value</d:ImageUrl>
- </m:properties>
- </entry>
- <entry>
- <id>
- http://localhost:8080/org.apache.olingo.odata2.ref.web/ReferenceScenario.svc/Employees('3')
- </id>
- <title type="text">Jonathan Smith</title>
- <updated>2013-04-03T10:53:26.025+02:00</updated>
- <category term="RefScenario.Employee"
- scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
- <link href="Employees('3')" rel="edit" title="Employee" />
- <link href="Employees('3')/$value" rel="edit-media"
- type="application/octet-stream" />
- <link href="Employees('3')/ne_Manager"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Manager"
- title="ne_Manager" type="application/atom+xml; type=entry" />
- <link href="Employees('3')/ne_Team"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Team"
- title="ne_Team" type="application/atom+xml; type=entry" />
- <link href="Employees('3')/ne_Room"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Room"
- title="ne_Room" type="application/atom+xml; type=entry" />
- <content type="application/octet-stream" src="Employees('3')/$value" />
- <m:properties>
- <d:EmployeeId>3</d:EmployeeId>
- <d:EmployeeName>Jonathan Smith</d:EmployeeName>
- <d:ManagerId>1</d:ManagerId>
- <d:RoomId>2</d:RoomId>
- <d:TeamId>1</d:TeamId>
- <d:Location m:type="RefScenario.c_Location">
- <d:City m:type="RefScenario.c_City">
- <d:PostalCode>69190</d:PostalCode>
- <d:CityName>Walldorf</d:CityName>
- </d:City>
- <d:Country>Germany</d:Country>
- </d:Location>
- <d:Age>56</d:Age>
- <d:EntryDate m:null="true" />
- <d:ImageUrl>Employees('3')/$value</d:ImageUrl>
- </m:properties>
- </entry>
- <entry>
- <id>
- http://localhost:8080/org.apache.olingo.odata2.ref.web/ReferenceScenario.svc/Employees('4')
- </id>
- <title type="text">Peter Burke</title>
- <updated>2004-09-12T00:00:00Z</updated>
- <category term="RefScenario.Employee"
- scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
- <link href="Employees('4')" rel="edit" title="Employee" />
- <link href="Employees('4')/$value" rel="edit-media"
- type="application/octet-stream" />
- <link href="Employees('4')/ne_Manager"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Manager"
- title="ne_Manager" type="application/atom+xml; type=entry" />
- <link href="Employees('4')/ne_Team"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Team"
- title="ne_Team" type="application/atom+xml; type=entry" />
- <link href="Employees('4')/ne_Room"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Room"
- title="ne_Room" type="application/atom+xml; type=entry" />
- <content type="application/octet-stream" src="Employees('4')/$value" />
- <m:properties>
- <d:EmployeeId>4</d:EmployeeId>
- <d:EmployeeName>Peter Burke</d:EmployeeName>
- <d:ManagerId>3</d:ManagerId>
- <d:RoomId>2</d:RoomId>
- <d:TeamId>2</d:TeamId>
- <d:Location m:type="RefScenario.c_Location">
- <d:City m:type="RefScenario.c_City">
- <d:PostalCode>69190</d:PostalCode>
- <d:CityName>Walldorf</d:CityName>
- </d:City>
- <d:Country>Germany</d:Country>
- </d:Location>
- <d:Age>39</d:Age>
- <d:EntryDate>2004-09-12T00:00:00</d:EntryDate>
- <d:ImageUrl>Employees('4')/$value</d:ImageUrl>
- </m:properties>
- </entry>
- <entry>
- <id>
- http://localhost:8080/org.apache.olingo.odata2.ref.web/ReferenceScenario.svc/Employees('6')
- </id>
- <title type="text">Susan Bay</title>
- <updated>2010-12-01T00:00:00Z</updated>
- <category term="RefScenario.Employee"
- scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
- <link href="Employees('6')" rel="edit" title="Employee" />
- <link href="Employees('6')/$value" rel="edit-media"
- type="application/octet-stream" />
- <link href="Employees('6')/ne_Manager"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Manager"
- title="ne_Manager" type="application/atom+xml; type=entry" />
- <link href="Employees('6')/ne_Team"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Team"
- title="ne_Team" type="application/atom+xml; type=entry" />
- <link href="Employees('6')/ne_Room"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Room"
- title="ne_Room" type="application/atom+xml; type=entry" />
- <content type="application/octet-stream" src="Employees('6')/$value" />
- <m:properties>
- <d:EmployeeId>6</d:EmployeeId>
- <d:EmployeeName>Susan Bay</d:EmployeeName>
- <d:ManagerId>1</d:ManagerId>
- <d:RoomId>2</d:RoomId>
- <d:TeamId>3</d:TeamId>
- <d:Location m:type="RefScenario.c_Location">
- <d:City m:type="RefScenario.c_City">
- <d:PostalCode>69190</d:PostalCode>
- <d:CityName>Walldorf</d:CityName>
- </d:City>
- <d:Country>Germany</d:Country>
- </d:Location>
- <d:Age>29</d:Age>
- <d:EntryDate>2010-12-01T00:00:00</d:EntryDate>
- <d:ImageUrl>Employees('6')/$value</d:ImageUrl>
- </m:properties>
- </entry>
- </feed>
- </m:inline>
- </link>
- <link href="Rooms('2')/nr_Building"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/nr_Building"
- title="nr_Building" type="application/atom+xml; type=entry" />
- <content type="application/xml">
- <m:properties>
- <d:Id>2</d:Id>
- <d:Name>Room 2</d:Name>
- <d:Seats>5</d:Seats>
- <d:Version>2</d:Version>
- </m:properties>
- </content>
-</entry>
-
---changeset_f980-1cb6-94dd
-Content-Type: application/http
-Content-Transfer-Encoding: binary
-Content-ID: 1
-
-POST Employees HTTP/1.1
-Host: http://localhost/odata
-Connection: keep-alive
-Content-Type: application/atom+xml
-Accept: */*
-Accept-Encoding: gzip,deflate
-Accept-Language: de-DE,de;q=0.8,en-US;q=0.6,en;q=0.4
-
-<entry xmlns="http://www.w3.org/2005/Atom"
- xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
- xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"
- xml:base="http://localhost:8080/org.apache.olingo.odata2.ref.web/ReferenceScenario.svc/"
- m:etag="W/2">
- <id>
- http://localhost:8080/org.apache.olingo.odata2.ref.web/ReferenceScenario.svc/Rooms('2')
- </id>
- <title type="text">Room 2</title>
- <updated>2013-04-03T10:53:26.021+02:00</updated>
- <category term="RefScenario.Room"
- scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
- <link href="Rooms('2')" rel="edit" title="Room" />
- <link href="Rooms('2')/nr_Employees"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/nr_Employees"
- title="nr_Employees" type="application/atom+xml; type=feed">
- <m:inline>
- <feed xmlns="http://www.w3.org/2005/Atom"
- xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
- xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"
- xml:base="http://localhost:8080/org.apache.olingo.odata2.ref.web/ReferenceScenario.svc/">
- <id>
- http://localhost:8080/org.apache.olingo.odata2.ref.web/ReferenceScenario.svc/Employees
- </id>
- <title type="text">Employees</title>
- <updated>2013-04-03T10:53:26.024+02:00</updated>
- <author>
- <name />
- </author>
- <link href="Employees" rel="self" title="Employees" />
- <entry>
- <id>
- http://localhost:8080/org.apache.olingo.odata2.ref.web/ReferenceScenario.svc/Employees('2')
- </id>
- <title type="text">Frederic Fall</title>
- <updated>2003-07-01T00:00:00Z</updated>
- <category term="RefScenario.Employee"
- scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
- <link href="Employees('2')" rel="edit" title="Employee" />
- <link href="Employees('2')/$value" rel="edit-media"
- type="application/octet-stream" />
- <link href="Employees('2')/ne_Manager"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Manager"
- title="ne_Manager" type="application/atom+xml; type=entry" />
- <link href="Employees('2')/ne_Team"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Team"
- title="ne_Team" type="application/atom+xml; type=entry" />
- <link href="Employees('2')/ne_Room"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Room"
- title="ne_Room" type="application/atom+xml; type=entry" />
- <content type="application/octet-stream" src="Employees('2')/$value" />
- <m:properties>
- <d:EmployeeId>2</d:EmployeeId>
- <d:EmployeeName>Frederic Fall</d:EmployeeName>
- <d:ManagerId>1</d:ManagerId>
- <d:RoomId>2</d:RoomId>
- <d:TeamId>1</d:TeamId>
- <d:Location m:type="RefScenario.c_Location">
- <d:City m:type="RefScenario.c_City">
- <d:PostalCode>69190</d:PostalCode>
- <d:CityName>Walldorf</d:CityName>
- </d:City>
- <d:Country>Germany</d:Country>
- </d:Location>
- <d:Age>32</d:Age>
- <d:EntryDate>2003-07-01T00:00:00</d:EntryDate>
- <d:ImageUrl>Employees('2')/$value</d:ImageUrl>
- </m:properties>
- </entry>
- <entry>
- <id>
- http://localhost:8080/org.apache.olingo.odata2.ref.web/ReferenceScenario.svc/Employees('3')
- </id>
- <title type="text">Jonathan Smith</title>
- <updated>2013-04-03T10:53:26.025+02:00</updated>
- <category term="RefScenario.Employee"
- scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
- <link href="Employees('3')" rel="edit" title="Employee" />
- <link href="Employees('3')/$value" rel="edit-media"
- type="application/octet-stream" />
- <link href="Employees('3')/ne_Manager"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Manager"
- title="ne_Manager" type="application/atom+xml; type=entry" />
- <link href="Employees('3')/ne_Team"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Team"
- title="ne_Team" type="application/atom+xml; type=entry" />
- <link href="Employees('3')/ne_Room"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Room"
- title="ne_Room" type="application/atom+xml; type=entry" />
- <content type="application/octet-stream" src="Employees('3')/$value" />
- <m:properties>
- <d:EmployeeId>3</d:EmployeeId>
- <d:EmployeeName>Jonathan Smith</d:EmployeeName>
- <d:ManagerId>1</d:ManagerId>
- <d:RoomId>2</d:RoomId>
- <d:TeamId>1</d:TeamId>
- <d:Location m:type="RefScenario.c_Location">
- <d:City m:type="RefScenario.c_City">
- <d:PostalCode>69190</d:PostalCode>
- <d:CityName>Walldorf</d:CityName>
- </d:City>
- <d:Country>Germany</d:Country>
- </d:Location>
- <d:Age>56</d:Age>
- <d:EntryDate m:null="true" />
- <d:ImageUrl>Employees('3')/$value</d:ImageUrl>
- </m:properties>
- </entry>
- <entry>
- <id>
- http://localhost:8080/org.apache.olingo.odata2.ref.web/ReferenceScenario.svc/Employees('4')
- </id>
- <title type="text">Peter Burke</title>
- <updated>2004-09-12T00:00:00Z</updated>
- <category term="RefScenario.Employee"
- scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
- <link href="Employees('4')" rel="edit" title="Employee" />
- <link href="Employees('4')/$value" rel="edit-media"
- type="application/octet-stream" />
- <link href="Employees('4')/ne_Manager"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Manager"
- title="ne_Manager" type="application/atom+xml; type=entry" />
- <link href="Employees('4')/ne_Team"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Team"
- title="ne_Team" type="application/atom+xml; type=entry" />
- <link href="Employees('4')/ne_Room"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Room"
- title="ne_Room" type="application/atom+xml; type=entry" />
- <content type="application/octet-stream" src="Employees('4')/$value" />
- <m:properties>
- <d:EmployeeId>4</d:EmployeeId>
- <d:EmployeeName>Peter Burke</d:EmployeeName>
- <d:ManagerId>3</d:ManagerId>
- <d:RoomId>2</d:RoomId>
- <d:TeamId>2</d:TeamId>
- <d:Location m:type="RefScenario.c_Location">
- <d:City m:type="RefScenario.c_City">
- <d:PostalCode>69190</d:PostalCode>
- <d:CityName>Walldorf</d:CityName>
- </d:City>
- <d:Country>Germany</d:Country>
- </d:Location>
- <d:Age>39</d:Age>
- <d:EntryDate>2004-09-12T00:00:00</d:EntryDate>
- <d:ImageUrl>Employees('4')/$value</d:ImageUrl>
- </m:properties>
- </entry>
- <entry>
- <id>
- http://localhost:8080/org.apache.olingo.odata2.ref.web/ReferenceScenario.svc/Employees('6')
- </id>
- <title type="text">Susan Bay</title>
- <updated>2010-12-01T00:00:00Z</updated>
- <category term="RefScenario.Employee"
- scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
- <link href="Employees('6')" rel="edit" title="Employee" />
- <link href="Employees('6')/$value" rel="edit-media"
- type="application/octet-stream" />
- <link href="Employees('6')/ne_Manager"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Manager"
- title="ne_Manager" type="application/atom+xml; type=entry" />
- <link href="Employees('6')/ne_Team"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Team"
- title="ne_Team" type="application/atom+xml; type=entry" />
- <link href="Employees('6')/ne_Room"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Room"
- title="ne_Room" type="application/atom+xml; type=entry" />
- <content type="application/octet-stream" src="Employees('6')/$value" />
- <m:properties>
- <d:EmployeeId>6</d:EmployeeId>
- <d:EmployeeName>Susan Bay</d:EmployeeName>
- <d:ManagerId>1</d:ManagerId>
- <d:RoomId>2</d:RoomId>
- <d:TeamId>3</d:TeamId>
- <d:Location m:type="RefScenario.c_Location">
- <d:City m:type="RefScenario.c_City">
- <d:PostalCode>69190</d:PostalCode>
- <d:CityName>Walldorf</d:CityName>
- </d:City>
- <d:Country>Germany</d:Country>
- </d:Location>
- <d:Age>29</d:Age>
- <d:EntryDate>2010-12-01T00:00:00</d:EntryDate>
- <d:ImageUrl>Employees('6')/$value</d:ImageUrl>
- </m:properties>
- </entry>
- </feed>
- </m:inline>
- </link>
- <link href="Rooms('2')/nr_Building"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/nr_Building"
- title="nr_Building" type="application/atom+xml; type=entry" />
- <content type="application/xml">
- <m:properties>
- <d:Id>2</d:Id>
- <d:Name>Room 2</d:Name>
- <d:Seats>5</d:Seats>
- <d:Version>2</d:Version>
- </m:properties>
- </content>
-</entry>
-
---changeset_f980-1cb6-94dd
-Content-Type: application/http
-Content-Transfer-Encoding: binary
-Content-ID: 1
-
-PUT Employees('1') HTTP/1.1
-Host: http://localhost/odata
-Connection: keep-alive
-Content-Type: application/atom+xml
-Accept: */*
-Accept-Encoding: gzip,deflate
-Accept-Language: de-DE,de;q=0.8,en-US;q=0.6,en;q=0.4
-
-<?xml version='1.0' encoding='utf-8'?>
-<entry xmlns="http://www.w3.org/2005/Atom"
- xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
- xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"
- xml:base="http://localhost:19000/abc/EntryXmlChangeTest/">
- <id>http://localhost:19000/abc/EntryXmlChangeTest/Employees('9')</id>
- <title type="text">Mister X</title>
- <updated m:null='true'>Z</updated>
- <category term="RefScenario.Employee"
- scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
- <content type="image/jpeg" src="Employees('1')/$value" />
- <m:properties>
- <d:EmployeeId>1</d:EmployeeId>
- <d:EmployeeName>Mister X</d:EmployeeName>
- <d:ManagerId>1</d:ManagerId>
- <d:RoomId>2</d:RoomId>
- <d:TeamId>1</d:TeamId>
- <d:Location m:type="RefScenario.c_Location">
- <d:City m:type="RefScenario.c_City">
- <d:PostalCode>69190</d:PostalCode>
- <d:CityName>Walldorf</d:CityName>
- </d:City>
- <d:Country>Germany</d:Country>
- </d:Location>
- <d:EntryDate m:null='true'></d:EntryDate>
- <d:ImageUrl>Employees('1')/$value</d:ImageUrl>
- </m:properties>
-</entry>
---changeset_f980-1cb6-94dd--
---batch_8194-cf13-1f56
-Content-Type: multipart/mixed; boundary=changeset_f980-1cb6-94dd
-
---changeset_f980-1cb6-94dd
-Content-Type: application/http
-Content-Transfer-Encoding: binary
-Content-ID: 1
-
-POST Employees HTTP/1.1
-Host: http://localhost/odata
-Connection: keep-alive
-Content-Type: application/atom+xml
-Accept: */*
-Accept-Encoding: gzip,deflate
-Accept-Language: de-DE,de;q=0.8,en-US;q=0.6,en;q=0.4
-
-<entry xmlns="http://www.w3.org/2005/Atom"
- xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
- xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"
- xml:base="http://localhost:8080/org.apache.olingo.odata2.ref.web/ReferenceScenario.svc/"
- m:etag="W/2">
- <id>
- http://localhost:8080/org.apache.olingo.odata2.ref.web/ReferenceScenario.svc/Rooms('2')
- </id>
- <title type="text">Room 2</title>
- <updated>2013-04-03T10:53:26.021+02:00</updated>
- <category term="RefScenario.Room"
- scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
- <link href="Rooms('2')" rel="edit" title="Room" />
- <link href="Rooms('2')/nr_Employees"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/nr_Employees"
- title="nr_Employees" type="application/atom+xml; type=feed">
- <m:inline>
- <feed xmlns="http://www.w3.org/2005/Atom"
- xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
- xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"
- xml:base="http://localhost:8080/org.apache.olingo.odata2.ref.web/ReferenceScenario.svc/">
- <id>
- http://localhost:8080/org.apache.olingo.odata2.ref.web/ReferenceScenario.svc/Employees
- </id>
- <title type="text">Employees</title>
- <updated>2013-04-03T10:53:26.024+02:00</updated>
- <author>
- <name />
- </author>
- <link href="Employees" rel="self" title="Employees" />
- <entry>
- <id>
- http://localhost:8080/org.apache.olingo.odata2.ref.web/ReferenceScenario.svc/Employees('2')
- </id>
- <title type="text">Frederic Fall</title>
- <updated>2003-07-01T00:00:00Z</updated>
- <category term="RefScenario.Employee"
- scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
- <link href="Employees('2')" rel="edit" title="Employee" />
- <link href="Employees('2')/$value" rel="edit-media"
- type="application/octet-stream" />
- <link href="Employees('2')/ne_Manager"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Manager"
- title="ne_Manager" type="application/atom+xml; type=entry" />
- <link href="Employees('2')/ne_Team"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Team"
- title="ne_Team" type="application/atom+xml; type=entry" />
- <link href="Employees('2')/ne_Room"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Room"
- title="ne_Room" type="application/atom+xml; type=entry" />
- <content type="application/octet-stream" src="Employees('2')/$value" />
- <m:properties>
- <d:EmployeeId>2</d:EmployeeId>
- <d:EmployeeName>Frederic Fall</d:EmployeeName>
- <d:ManagerId>1</d:ManagerId>
- <d:RoomId>2</d:RoomId>
- <d:TeamId>1</d:TeamId>
- <d:Location m:type="RefScenario.c_Location">
- <d:City m:type="RefScenario.c_City">
- <d:PostalCode>69190</d:PostalCode>
- <d:CityName>Walldorf</d:CityName>
- </d:City>
- <d:Country>Germany</d:Country>
- </d:Location>
- <d:Age>32</d:Age>
- <d:EntryDate>2003-07-01T00:00:00</d:EntryDate>
- <d:ImageUrl>Employees('2')/$value</d:ImageUrl>
- </m:properties>
- </entry>
- <entry>
- <id>
- http://localhost:8080/org.apache.olingo.odata2.ref.web/ReferenceScenario.svc/Employees('3')
- </id>
- <title type="text">Jonathan Smith</title>
- <updated>2013-04-03T10:53:26.025+02:00</updated>
- <category term="RefScenario.Employee"
- scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
- <link href="Employees('3')" rel="edit" title="Employee" />
- <link href="Employees('3')/$value" rel="edit-media"
- type="application/octet-stream" />
- <link href="Employees('3')/ne_Manager"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Manager"
- title="ne_Manager" type="application/atom+xml; type=entry" />
- <link href="Employees('3')/ne_Team"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Team"
- title="ne_Team" type="application/atom+xml; type=entry" />
- <link href="Employees('3')/ne_Room"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Room"
- title="ne_Room" type="application/atom+xml; type=entry" />
- <content type="application/octet-stream" src="Employees('3')/$value" />
- <m:properties>
- <d:EmployeeId>3</d:EmployeeId>
- <d:EmployeeName>Jonathan Smith</d:EmployeeName>
- <d:ManagerId>1</d:ManagerId>
- <d:RoomId>2</d:RoomId>
- <d:TeamId>1</d:TeamId>
- <d:Location m:type="RefScenario.c_Location">
- <d:City m:type="RefScenario.c_City">
- <d:PostalCode>69190</d:PostalCode>
- <d:CityName>Walldorf</d:CityName>
- </d:City>
- <d:Country>Germany</d:Country>
- </d:Location>
- <d:Age>56</d:Age>
- <d:EntryDate m:null="true" />
- <d:ImageUrl>Employees('3')/$value</d:ImageUrl>
- </m:properties>
- </entry>
- <entry>
- <id>
- http://localhost:8080/org.apache.olingo.odata2.ref.web/ReferenceScenario.svc/Employees('4')
- </id>
- <title type="text">Peter Burke</title>
- <updated>2004-09-12T00:00:00Z</updated>
- <category term="RefScenario.Employee"
- scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
- <link href="Employees('4')" rel="edit" title="Employee" />
- <link href="Employees('4')/$value" rel="edit-media"
- type="application/octet-stream" />
- <link href="Employees('4')/ne_Manager"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Manager"
- title="ne_Manager" type="application/atom+xml; type=entry" />
- <link href="Employees('4')/ne_Team"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Team"
- title="ne_Team" type="application/atom+xml; type=entry" />
- <link href="Employees('4')/ne_Room"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Room"
- title="ne_Room" type="application/atom+xml; type=entry" />
- <content type="application/octet-stream" src="Employees('4')/$value" />
- <m:properties>
- <d:EmployeeId>4</d:EmployeeId>
- <d:EmployeeName>Peter Burke</d:EmployeeName>
- <d:ManagerId>3</d:ManagerId>
- <d:RoomId>2</d:RoomId>
- <d:TeamId>2</d:TeamId>
- <d:Location m:type="RefScenario.c_Location">
- <d:City m:type="RefScenario.c_City">
- <d:PostalCode>69190</d:PostalCode>
- <d:CityName>Walldorf</d:CityName>
- </d:City>
- <d:Country>Germany</d:Country>
- </d:Location>
- <d:Age>39</d:Age>
- <d:EntryDate>2004-09-12T00:00:00</d:EntryDate>
- <d:ImageUrl>Employees('4')/$value</d:ImageUrl>
- </m:properties>
- </entry>
- <entry>
- <id>
- http://localhost:8080/org.apache.olingo.odata2.ref.web/ReferenceScenario.svc/Employees('6')
- </id>
- <title type="text">Susan Bay</title>
- <updated>2010-12-01T00:00:00Z</updated>
- <category term="RefScenario.Employee"
- scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
- <link href="Employees('6')" rel="edit" title="Employee" />
- <link href="Employees('6')/$value" rel="edit-media"
- type="application/octet-stream" />
- <link href="Employees('6')/ne_Manager"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Manager"
- title="ne_Manager" type="application/atom+xml; type=entry" />
- <link href="Employees('6')/ne_Team"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Team"
- title="ne_Team" type="application/atom+xml; type=entry" />
- <link href="Employees('6')/ne_Room"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Room"
- title="ne_Room" type="application/atom+xml; type=entry" />
- <content type="application/octet-stream" src="Employees('6')/$value" />
- <m:properties>
- <d:EmployeeId>6</d:EmployeeId>
- <d:EmployeeName>Susan Bay</d:EmployeeName>
- <d:ManagerId>1</d:ManagerId>
- <d:RoomId>2</d:RoomId>
- <d:TeamId>3</d:TeamId>
- <d:Location m:type="RefScenario.c_Location">
- <d:City m:type="RefScenario.c_City">
- <d:PostalCode>69190</d:PostalCode>
- <d:CityName>Walldorf</d:CityName>
- </d:City>
- <d:Country>Germany</d:Country>
- </d:Location>
- <d:Age>29</d:Age>
- <d:EntryDate>2010-12-01T00:00:00</d:EntryDate>
- <d:ImageUrl>Employees('6')/$value</d:ImageUrl>
- </m:properties>
- </entry>
- </feed>
- </m:inline>
- </link>
- <link href="Rooms('2')/nr_Building"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/nr_Building"
- title="nr_Building" type="application/atom+xml; type=entry" />
- <content type="application/xml">
- <m:properties>
- <d:Id>2</d:Id>
- <d:Name>Room 2</d:Name>
- <d:Seats>5</d:Seats>
- <d:Version>2</d:Version>
- </m:properties>
- </content>
-</entry>
-
---changeset_f980-1cb6-94dd
-Content-Type: application/http
-Content-Transfer-Encoding: binary
-Content-ID: 1
-
-POST Employees HTTP/1.1
-Host: http://localhost/odata
-Connection: keep-alive
-Content-Type: application/atom+xml
-Accept: */*
-Accept-Encoding: gzip,deflate
-Accept-Language: de-DE,de;q=0.8,en-US;q=0.6,en;q=0.4
-
-<entry xmlns="http://www.w3.org/2005/Atom"
- xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
- xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"
- xml:base="http://localhost:8080/org.apache.olingo.odata2.ref.web/ReferenceScenario.svc/"
- m:etag="W/2">
- <id>
- http://localhost:8080/org.apache.olingo.odata2.ref.web/ReferenceScenario.svc/Rooms('2')
- </id>
- <title type="text">Room 2</title>
- <updated>2013-04-03T10:53:26.021+02:00</updated>
- <category term="RefScenario.Room"
- scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
- <link href="Rooms('2')" rel="edit" title="Room" />
- <link href="Rooms('2')/nr_Employees"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/nr_Employees"
- title="nr_Employees" type="application/atom+xml; type=feed">
- <m:inline>
- <feed xmlns="http://www.w3.org/2005/Atom"
- xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
- xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"
- xml:base="http://localhost:8080/org.apache.olingo.odata2.ref.web/ReferenceScenario.svc/">
- <id>
- http://localhost:8080/org.apache.olingo.odata2.ref.web/ReferenceScenario.svc/Employees
- </id>
- <title type="text">Employees</title>
- <updated>2013-04-03T10:53:26.024+02:00</updated>
- <author>
- <name />
- </author>
- <link href="Employees" rel="self" title="Employees" />
- <entry>
- <id>
- http://localhost:8080/org.apache.olingo.odata2.ref.web/ReferenceScenario.svc/Employees('2')
- </id>
- <title type="text">Frederic Fall</title>
- <updated>2003-07-01T00:00:00Z</updated>
- <category term="RefScenario.Employee"
- scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
- <link href="Employees('2')" rel="edit" title="Employee" />
- <link href="Employees('2')/$value" rel="edit-media"
- type="application/octet-stream" />
- <link href="Employees('2')/ne_Manager"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Manager"
- title="ne_Manager" type="application/atom+xml; type=entry" />
- <link href="Employees('2')/ne_Team"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Team"
- title="ne_Team" type="application/atom+xml; type=entry" />
- <link href="Employees('2')/ne_Room"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Room"
- title="ne_Room" type="application/atom+xml; type=entry" />
- <content type="application/octet-stream" src="Employees('2')/$value" />
- <m:properties>
- <d:EmployeeId>2</d:EmployeeId>
- <d:EmployeeName>Frederic Fall</d:EmployeeName>
- <d:ManagerId>1</d:ManagerId>
- <d:RoomId>2</d:RoomId>
- <d:TeamId>1</d:TeamId>
- <d:Location m:type="RefScenario.c_Location">
- <d:City m:type="RefScenario.c_City">
- <d:PostalCode>69190</d:PostalCode>
- <d:CityName>Walldorf</d:CityName>
- </d:City>
- <d:Country>Germany</d:Country>
- </d:Location>
- <d:Age>32</d:Age>
- <d:EntryDate>2003-07-01T00:00:00</d:EntryDate>
- <d:ImageUrl>Employees('2')/$value</d:ImageUrl>
- </m:properties>
- </entry>
- <entry>
- <id>
- http://localhost:8080/org.apache.olingo.odata2.ref.web/ReferenceScenario.svc/Employees('3')
- </id>
- <title type="text">Jonathan Smith</title>
- <updated>2013-04-03T10:53:26.025+02:00</updated>
- <category term="RefScenario.Employee"
- scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
- <link href="Employees('3')" rel="edit" title="Employee" />
- <link href="Employees('3')/$value" rel="edit-media"
- type="application/octet-stream" />
- <link href="Employees('3')/ne_Manager"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Manager"
- title="ne_Manager" type="application/atom+xml; type=entry" />
- <link href="Employees('3')/ne_Team"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Team"
- title="ne_Team" type="application/atom+xml; type=entry" />
- <link href="Employees('3')/ne_Room"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Room"
- title="ne_Room" type="application/atom+xml; type=entry" />
- <content type="application/octet-stream" src="Employees('3')/$value" />
- <m:properties>
- <d:EmployeeId>3</d:EmployeeId>
- <d:EmployeeName>Jonathan Smith</d:EmployeeName>
- <d:ManagerId>1</d:ManagerId>
- <d:RoomId>2</d:RoomId>
- <d:TeamId>1</d:TeamId>
- <d:Location m:type="RefScenario.c_Location">
- <d:City m:type="RefScenario.c_City">
- <d:PostalCode>69190</d:PostalCode>
- <d:CityName>Walldorf</d:CityName>
- </d:City>
- <d:Country>Germany</d:Country>
- </d:Location>
- <d:Age>56</d:Age>
- <d:EntryDate m:null="true" />
- <d:ImageUrl>Employees('3')/$value</d:ImageUrl>
- </m:properties>
- </entry>
- <entry>
- <id>
- http://localhost:8080/org.apache.olingo.odata2.ref.web/ReferenceScenario.svc/Employees('4')
- </id>
- <title type="text">Peter Burke</title>
- <updated>2004-09-12T00:00:00Z</updated>
- <category term="RefScenario.Employee"
- scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
- <link href="Employees('4')" rel="edit" title="Employee" />
- <link href="Employees('4')/$value" rel="edit-media"
- type="application/octet-stream" />
- <link href="Employees('4')/ne_Manager"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Manager"
- title="ne_Manager" type="application/atom+xml; type=entry" />
- <link href="Employees('4')/ne_Team"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Team"
- title="ne_Team" type="application/atom+xml; type=entry" />
- <link href="Employees('4')/ne_Room"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Room"
- title="ne_Room" type="application/atom+xml; type=entry" />
- <content type="application/octet-stream" src="Employees('4')/$value" />
- <m:properties>
- <d:EmployeeId>4</d:EmployeeId>
- <d:EmployeeName>Peter Burke</d:EmployeeName>
- <d:ManagerId>3</d:ManagerId>
- <d:RoomId>2</d:RoomId>
- <d:TeamId>2</d:TeamId>
- <d:Location m:type="RefScenario.c_Location">
- <d:City m:type="RefScenario.c_City">
- <d:PostalCode>69190</d:PostalCode>
- <d:CityName>Walldorf</d:CityName>
- </d:City>
- <d:Country>Germany</d:Country>
- </d:Location>
- <d:Age>39</d:Age>
- <d:EntryDate>2004-09-12T00:00:00</d:EntryDate>
- <d:ImageUrl>Employees('4')/$value</d:ImageUrl>
- </m:properties>
- </entry>
- <entry>
- <id>
- http://localhost:8080/org.apache.olingo.odata2.ref.web/ReferenceScenario.svc/Employees('6')
- </id>
- <title type="text">Susan Bay</title>
- <updated>2010-12-01T00:00:00Z</updated>
- <category term="RefScenario.Employee"
- scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
- <link href="Employees('6')" rel="edit" title="Employee" />
- <link href="Employees('6')/$value" rel="edit-media"
- type="application/octet-stream" />
- <link href="Employees('6')/ne_Manager"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Manager"
- title="ne_Manager" type="application/atom+xml; type=entry" />
- <link href="Employees('6')/ne_Team"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Team"
- title="ne_Team" type="application/atom+xml; type=entry" />
- <link href="Employees('6')/ne_Room"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Room"
- title="ne_Room" type="application/atom+xml; type=entry" />
- <content type="application/octet-stream" src="Employees('6')/$value" />
- <m:properties>
- <d:EmployeeId>6</d:EmployeeId>
- <d:EmployeeName>Susan Bay</d:EmployeeName>
- <d:ManagerId>1</d:ManagerId>
- <d:RoomId>2</d:RoomId>
- <d:TeamId>3</d:TeamId>
- <d:Location m:type="RefScenario.c_Location">
- <d:City m:type="RefScenario.c_City">
- <d:PostalCode>69190</d:PostalCode>
- <d:CityName>Walldorf</d:CityName>
- </d:City>
- <d:Country>Germany</d:Country>
- </d:Location>
- <d:Age>29</d:Age>
- <d:EntryDate>2010-12-01T00:00:00</d:EntryDate>
- <d:ImageUrl>Employees('6')/$value</d:ImageUrl>
- </m:properties>
- </entry>
- </feed>
- </m:inline>
- </link>
- <link href="Rooms('2')/nr_Building"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/nr_Building"
- title="nr_Building" type="application/atom+xml; type=entry" />
- <content type="application/xml">
- <m:properties>
- <d:Id>2</d:Id>
- <d:Name>Room 2</d:Name>
- <d:Seats>5</d:Seats>
- <d:Version>2</d:Version>
- </m:properties>
- </content>
-</entry>
-
---changeset_f980-1cb6-94dd
-Content-Type: application/http
-Content-Transfer-Encoding: binary
-Content-ID: 1
-
-PUT Employees('1') HTTP/1.1
-Host: http://localhost/odata
-Connection: keep-alive
-Content-Type: application/atom+xml
-Accept: */*
-Accept-Encoding: gzip,deflate
-Accept-Language: de-DE,de;q=0.8,en-US;q=0.6,en;q=0.4
-
-<?xml version='1.0' encoding='utf-8'?>
-<entry xmlns="http://www.w3.org/2005/Atom"
- xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
- xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"
- xml:base="http://localhost:19000/abc/EntryXmlChangeTest/">
- <id>http://localhost:19000/abc/EntryXmlChangeTest/Employees('9')</id>
- <title type="text">Mister X</title>
- <updated m:null='true'>Z</updated>
- <category term="RefScenario.Employee"
- scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
- <content type="image/jpeg" src="Employees('1')/$value" />
- <m:properties>
- <d:EmployeeId>1</d:EmployeeId>
- <d:EmployeeName>Mister X</d:EmployeeName>
- <d:ManagerId>1</d:ManagerId>
- <d:RoomId>2</d:RoomId>
- <d:TeamId>1</d:TeamId>
- <d:Location m:type="RefScenario.c_Location">
- <d:City m:type="RefScenario.c_City">
- <d:PostalCode>69190</d:PostalCode>
- <d:CityName>Walldorf</d:CityName>
- </d:City>
- <d:Country>Germany</d:Country>
- </d:Location>
- <d:EntryDate m:null='true'></d:EntryDate>
- <d:ImageUrl>Employees('1')/$value</d:ImageUrl>
- </m:properties>
-</entry>
---changeset_f980-1cb6-94dd--
---batch_8194-cf13-1f56
-Content-Type: multipart/mixed; boundary=changeset_f980-1cb6-94dd
-
---changeset_f980-1cb6-94dd
-Content-Type: application/http
-Content-Transfer-Encoding: binary
-Content-ID: 1
-
-POST Employees HTTP/1.1
-Host: http://localhost/odata
-Connection: keep-alive
-Content-Type: application/atom+xml
-Accept: */*
-Accept-Encoding: gzip,deflate
-Accept-Language: de-DE,de;q=0.8,en-US;q=0.6,en;q=0.4
-
-<entry xmlns="http://www.w3.org/2005/Atom"
- xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
- xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"
- xml:base="http://localhost:8080/org.apache.olingo.odata2.ref.web/ReferenceScenario.svc/"
- m:etag="W/2">
- <id>
- http://localhost:8080/org.apache.olingo.odata2.ref.web/ReferenceScenario.svc/Rooms('2')
- </id>
- <title type="text">Room 2</title>
- <updated>2013-04-03T10:53:26.021+02:00</updated>
- <category term="RefScenario.Room"
- scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
- <link href="Rooms('2')" rel="edit" title="Room" />
- <link href="Rooms('2')/nr_Employees"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/nr_Employees"
- title="nr_Employees" type="application/atom+xml; type=feed">
- <m:inline>
- <feed xmlns="http://www.w3.org/2005/Atom"
- xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
- xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"
- xml:base="http://localhost:8080/org.apache.olingo.odata2.ref.web/ReferenceScenario.svc/">
- <id>
- http://localhost:8080/org.apache.olingo.odata2.ref.web/ReferenceScenario.svc/Employees
- </id>
- <title type="text">Employees</title>
- <updated>2013-04-03T10:53:26.024+02:00</updated>
- <author>
- <name />
- </author>
- <link href="Employees" rel="self" title="Employees" />
- <entry>
- <id>
- http://localhost:8080/org.apache.olingo.odata2.ref.web/ReferenceScenario.svc/Employees('2')
- </id>
- <title type="text">Frederic Fall</title>
- <updated>2003-07-01T00:00:00Z</updated>
- <category term="RefScenario.Employee"
- scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
- <link href="Employees('2')" rel="edit" title="Employee" />
- <link href="Employees('2')/$value" rel="edit-media"
- type="application/octet-stream" />
- <link href="Employees('2')/ne_Manager"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Manager"
- title="ne_Manager" type="application/atom+xml; type=entry" />
- <link href="Employees('2')/ne_Team"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Team"
- title="ne_Team" type="application/atom+xml; type=entry" />
- <link href="Employees('2')/ne_Room"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Room"
- title="ne_Room" type="application/atom+xml; type=entry" />
- <content type="application/octet-stream" src="Employees('2')/$value" />
- <m:properties>
- <d:EmployeeId>2</d:EmployeeId>
- <d:EmployeeName>Frederic Fall</d:EmployeeName>
- <d:ManagerId>1</d:ManagerId>
- <d:RoomId>2</d:RoomId>
- <d:TeamId>1</d:TeamId>
- <d:Location m:type="RefScenario.c_Location">
- <d:City m:type="RefScenario.c_City">
- <d:PostalCode>69190</d:PostalCode>
- <d:CityName>Walldorf</d:CityName>
- </d:City>
- <d:Country>Germany</d:Country>
- </d:Location>
- <d:Age>32</d:Age>
- <d:EntryDate>2003-07-01T00:00:00</d:EntryDate>
- <d:ImageUrl>Employees('2')/$value</d:ImageUrl>
- </m:properties>
- </entry>
- <entry>
- <id>
- http://localhost:8080/org.apache.olingo.odata2.ref.web/ReferenceScenario.svc/Employees('3')
- </id>
- <title type="text">Jonathan Smith</title>
- <updated>2013-04-03T10:53:26.025+02:00</updated>
- <category term="RefScenario.Employee"
- scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
- <link href="Employees('3')" rel="edit" title="Employee" />
- <link href="Employees('3')/$value" rel="edit-media"
- type="application/octet-stream" />
- <link href="Employees('3')/ne_Manager"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Manager"
- title="ne_Manager" type="application/atom+xml; type=entry" />
- <link href="Employees('3')/ne_Team"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Team"
- title="ne_Team" type="application/atom+xml; type=entry" />
- <link href="Employees('3')/ne_Room"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Room"
- title="ne_Room" type="application/atom+xml; type=entry" />
- <content type="application/octet-stream" src="Employees('3')/$value" />
- <m:properties>
- <d:EmployeeId>3</d:EmployeeId>
- <d:EmployeeName>Jonathan Smith</d:EmployeeName>
- <d:ManagerId>1</d:ManagerId>
- <d:RoomId>2</d:RoomId>
- <d:TeamId>1</d:TeamId>
- <d:Location m:type="RefScenario.c_Location">
- <d:City m:type="RefScenario.c_City">
- <d:PostalCode>69190</d:PostalCode>
- <d:CityName>Walldorf</d:CityName>
- </d:City>
- <d:Country>Germany</d:Country>
- </d:Location>
- <d:Age>56</d:Age>
- <d:EntryDate m:null="true" />
- <d:ImageUrl>Employees('3')/$value</d:ImageUrl>
- </m:properties>
- </entry>
- <entry>
- <id>
- http://localhost:8080/org.apache.olingo.odata2.ref.web/ReferenceScenario.svc/Employees('4')
- </id>
- <title type="text">Peter Burke</title>
- <updated>2004-09-12T00:00:00Z</updated>
- <category term="RefScenario.Employee"
- scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
- <link href="Employees('4')" rel="edit" title="Employee" />
- <link href="Employees('4')/$value" rel="edit-media"
- type="application/octet-stream" />
- <link href="Employees('4')/ne_Manager"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Manager"
- title="ne_Manager" type="application/atom+xml; type=entry" />
- <link href="Employees('4')/ne_Team"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Team"
- title="ne_Team" type="application/atom+xml; type=entry" />
- <link href="Employees('4')/ne_Room"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Room"
- title="ne_Room" type="application/atom+xml; type=entry" />
- <content type="application/octet-stream" src="Employees('4')/$value" />
- <m:properties>
- <d:EmployeeId>4</d:EmployeeId>
- <d:EmployeeName>Peter Burke</d:EmployeeName>
- <d:ManagerId>3</d:ManagerId>
- <d:RoomId>2</d:RoomId>
- <d:TeamId>2</d:TeamId>
- <d:Location m:type="RefScenario.c_Location">
- <d:City m:type="RefScenario.c_City">
- <d:PostalCode>69190</d:PostalCode>
- <d:CityName>Walldorf</d:CityName>
- </d:City>
- <d:Country>Germany</d:Country>
- </d:Location>
- <d:Age>39</d:Age>
- <d:EntryDate>2004-09-12T00:00:00</d:EntryDate>
- <d:ImageUrl>Employees('4')/$value</d:ImageUrl>
- </m:properties>
- </entry>
- <entry>
- <id>
- http://localhost:8080/org.apache.olingo.odata2.ref.web/ReferenceScenario.svc/Employees('6')
- </id>
- <title type="text">Susan Bay</title>
- <updated>2010-12-01T00:00:00Z</updated>
- <category term="RefScenario.Employee"
- scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
- <link href="Employees('6')" rel="edit" title="Employee" />
- <link href="Employees('6')/$value" rel="edit-media"
- type="application/octet-stream" />
- <link href="Employees('6')/ne_Manager"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Manager"
- title="ne_Manager" type="application/atom+xml; type=entry" />
- <link href="Employees('6')/ne_Team"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Team"
- title="ne_Team" type="application/atom+xml; type=entry" />
- <link href="Employees('6')/ne_Room"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Room"
- title="ne_Room" type="application/atom+xml; type=entry" />
- <content type="application/octet-stream" src="Employees('6')/$value" />
- <m:properties>
- <d:EmployeeId>6</d:EmployeeId>
- <d:EmployeeName>Susan Bay</d:EmployeeName>
- <d:ManagerId>1</d:ManagerId>
- <d:RoomId>2</d:RoomId>
- <d:TeamId>3</d:TeamId>
- <d:Location m:type="RefScenario.c_Location">
- <d:City m:type="RefScenario.c_City">
- <d:PostalCode>69190</d:PostalCode>
- <d:CityName>Walldorf</d:CityName>
- </d:City>
- <d:Country>Germany</d:Country>
- </d:Location>
- <d:Age>29</d:Age>
- <d:EntryDate>2010-12-01T00:00:00</d:EntryDate>
- <d:ImageUrl>Employees('6')/$value</d:ImageUrl>
- </m:properties>
- </entry>
- </feed>
- </m:inline>
- </link>
- <link href="Rooms('2')/nr_Building"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/nr_Building"
- title="nr_Building" type="application/atom+xml; type=entry" />
- <content type="application/xml">
- <m:properties>
- <d:Id>2</d:Id>
- <d:Name>Room 2</d:Name>
- <d:Seats>5</d:Seats>
- <d:Version>2</d:Version>
- </m:properties>
- </content>
-</entry>
-
---changeset_f980-1cb6-94dd
-Content-Type: application/http
-Content-Transfer-Encoding: binary
-Content-ID: 1
-
-POST Employees HTTP/1.1
-Host: http://localhost/odata
-Connection: keep-alive
-Content-Type: application/atom+xml
-Accept: */*
-Accept-Encoding: gzip,deflate
-Accept-Language: de-DE,de;q=0.8,en-US;q=0.6,en;q=0.4
-
-<entry xmlns="http://www.w3.org/2005/Atom"
- xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
- xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"
- xml:base="http://localhost:8080/org.apache.olingo.odata2.ref.web/ReferenceScenario.svc/"
- m:etag="W/2">
- <id>
- http://localhost:8080/org.apache.olingo.odata2.ref.web/ReferenceScenario.svc/Rooms('2')
- </id>
- <title type="text">Room 2</title>
- <updated>2013-04-03T10:53:26.021+02:00</updated>
- <category term="RefScenario.Room"
- scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
- <link href="Rooms('2')" rel="edit" title="Room" />
- <link href="Rooms('2')/nr_Employees"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/nr_Employees"
- title="nr_Employees" type="application/atom+xml; type=feed">
- <m:inline>
- <feed xmlns="http://www.w3.org/2005/Atom"
- xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
- xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"
- xml:base="http://localhost:8080/org.apache.olingo.odata2.ref.web/ReferenceScenario.svc/">
- <id>
- http://localhost:8080/org.apache.olingo.odata2.ref.web/ReferenceScenario.svc/Employees
- </id>
- <title type="text">Employees</title>
- <updated>2013-04-03T10:53:26.024+02:00</updated>
- <author>
- <name />
- </author>
- <link href="Employees" rel="self" title="Employees" />
- <entry>
- <id>
- http://localhost:8080/org.apache.olingo.odata2.ref.web/ReferenceScenario.svc/Employees('2')
- </id>
- <title type="text">Frederic Fall</title>
- <updated>2003-07-01T00:00:00Z</updated>
- <category term="RefScenario.Employee"
- scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
- <link href="Employees('2')" rel="edit" title="Employee" />
- <link href="Employees('2')/$value" rel="edit-media"
- type="application/octet-stream" />
- <link href="Employees('2')/ne_Manager"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Manager"
- title="ne_Manager" type="application/atom+xml; type=entry" />
- <link href="Employees('2')/ne_Team"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Team"
- title="ne_Team" type="application/atom+xml; type=entry" />
- <link href="Employees('2')/ne_Room"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Room"
- title="ne_Room" type="application/atom+xml; type=entry" />
- <content type="application/octet-stream" src="Employees('2')/$value" />
- <m:properties>
- <d:EmployeeId>2</d:EmployeeId>
- <d:EmployeeName>Frederic Fall</d:EmployeeName>
- <d:ManagerId>1</d:ManagerId>
- <d:RoomId>2</d:RoomId>
- <d:TeamId>1</d:TeamId>
- <d:Location m:type="RefScenario.c_Location">
- <d:City m:type="RefScenario.c_City">
- <d:PostalCode>69190</d:PostalCode>
- <d:CityName>Walldorf</d:CityName>
- </d:City>
- <d:Country>Germany</d:Country>
- </d:Location>
- <d:Age>32</d:Age>
- <d:EntryDate>2003-07-01T00:00:00</d:EntryDate>
- <d:ImageUrl>Employees('2')/$value</d:ImageUrl>
- </m:properties>
- </entry>
- <entry>
- <id>
- http://localhost:8080/org.apache.olingo.odata2.ref.web/ReferenceScenario.svc/Employees('3')
- </id>
- <title type="text">Jonathan Smith</title>
- <updated>2013-04-03T10:53:26.025+02:00</updated>
- <category term="RefScenario.Employee"
- scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
- <link href="Employees('3')" rel="edit" title="Employee" />
- <link href="Employees('3')/$value" rel="edit-media"
- type="application/octet-stream" />
- <link href="Employees('3')/ne_Manager"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Manager"
- title="ne_Manager" type="application/atom+xml; type=entry" />
- <link href="Employees('3')/ne_Team"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Team"
- title="ne_Team" type="application/atom+xml; type=entry" />
- <link href="Employees('3')/ne_Room"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Room"
- title="ne_Room" type="application/atom+xml; type=entry" />
- <content type="application/octet-stream" src="Employees('3')/$value" />
- <m:properties>
- <d:EmployeeId>3</d:EmployeeId>
- <d:EmployeeName>Jonathan Smith</d:EmployeeName>
- <d:ManagerId>1</d:ManagerId>
- <d:RoomId>2</d:RoomId>
- <d:TeamId>1</d:TeamId>
- <d:Location m:type="RefScenario.c_Location">
- <d:City m:type="RefScenario.c_City">
- <d:PostalCode>69190</d:PostalCode>
- <d:CityName>Walldorf</d:CityName>
- </d:City>
- <d:Country>Germany</d:Country>
- </d:Location>
- <d:Age>56</d:Age>
- <d:EntryDate m:null="true" />
- <d:ImageUrl>Employees('3')/$value</d:ImageUrl>
- </m:properties>
- </entry>
- <entry>
- <id>
- http://localhost:8080/org.apache.olingo.odata2.ref.web/ReferenceScenario.svc/Employees('4')
- </id>
- <title type="text">Peter Burke</title>
- <updated>2004-09-12T00:00:00Z</updated>
- <category term="RefScenario.Employee"
- scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
- <link href="Employees('4')" rel="edit" title="Employee" />
- <link href="Employees('4')/$value" rel="edit-media"
- type="application/octet-stream" />
- <link href="Employees('4')/ne_Manager"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Manager"
- title="ne_Manager" type="application/atom+xml; type=entry" />
- <link href="Employees('4')/ne_Team"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Team"
- title="ne_Team" type="application/atom+xml; type=entry" />
- <link href="Employees('4')/ne_Room"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Room"
- title="ne_Room" type="application/atom+xml; type=entry" />
- <content type="application/octet-stream" src="Employees('4')/$value" />
- <m:properties>
- <d:EmployeeId>4</d:EmployeeId>
- <d:EmployeeName>Peter Burke</d:EmployeeName>
- <d:ManagerId>3</d:ManagerId>
- <d:RoomId>2</d:RoomId>
- <d:TeamId>2</d:TeamId>
- <d:Location m:type="RefScenario.c_Location">
- <d:City m:type="RefScenario.c_City">
- <d:PostalCode>69190</d:PostalCode>
- <d:CityName>Walldorf</d:CityName>
- </d:City>
- <d:Country>Germany</d:Country>
- </d:Location>
- <d:Age>39</d:Age>
- <d:EntryDate>2004-09-12T00:00:00</d:EntryDate>
- <d:ImageUrl>Employees('4')/$value</d:ImageUrl>
- </m:properties>
- </entry>
- <entry>
- <id>
- http://localhost:8080/org.apache.olingo.odata2.ref.web/ReferenceScenario.svc/Employees('6')
- </id>
- <title type="text">Susan Bay</title>
- <updated>2010-12-01T00:00:00Z</updated>
- <category term="RefScenario.Employee"
- scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
- <link href="Employees('6')" rel="edit" title="Employee" />
- <link href="Employees('6')/$value" rel="edit-media"
- type="application/octet-stream" />
- <link href="Employees('6')/ne_Manager"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Manager"
- title="ne_Manager" type="application/atom+xml; type=entry" />
- <link href="Employees('6')/ne_Team"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Team"
- title="ne_Team" type="application/atom+xml; type=entry" />
- <link href="Employees('6')/ne_Room"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Room"
- title="ne_Room" type="application/atom+xml; type=entry" />
- <content type="application/octet-stream" src="Employees('6')/$value" />
- <m:properties>
- <d:EmployeeId>6</d:EmployeeId>
- <d:EmployeeName>Susan Bay</d:EmployeeName>
- <d:ManagerId>1</d:ManagerId>
- <d:RoomId>2</d:RoomId>
- <d:TeamId>3</d:TeamId>
- <d:Location m:type="RefScenario.c_Location">
- <d:City m:type="RefScenario.c_City">
- <d:PostalCode>69190</d:PostalCode>
- <d:CityName>Walldorf</d:CityName>
- </d:City>
- <d:Country>Germany</d:Country>
- </d:Location>
- <d:Age>29</d:Age>
- <d:EntryDate>2010-12-01T00:00:00</d:EntryDate>
- <d:ImageUrl>Employees('6')/$value</d:ImageUrl>
- </m:properties>
- </entry>
- </feed>
- </m:inline>
- </link>
- <link href="Rooms('2')/nr_Building"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/nr_Building"
- title="nr_Building" type="application/atom+xml; type=entry" />
- <content type="application/xml">
- <m:properties>
- <d:Id>2</d:Id>
- <d:Name>Room 2</d:Name>
- <d:Seats>5</d:Seats>
- <d:Version>2</d:Version>
- </m:properties>
- </content>
-</entry>
-
---changeset_f980-1cb6-94dd
-Content-Type: application/http
-Content-Transfer-Encoding: binary
-Content-ID: 1
-
-PUT Employees('1') HTTP/1.1
-Host: http://localhost/odata
-Connection: keep-alive
-Content-Type: application/atom+xml
-Accept: */*
-Accept-Encoding: gzip,deflate
-Accept-Language: de-DE,de;q=0.8,en-US;q=0.6,en;q=0.4
-
-<?xml version='1.0' encoding='utf-8'?>
-<entry xmlns="http://www.w3.org/2005/Atom"
- xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
- xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"
- xml:base="http://localhost:19000/abc/EntryXmlChangeTest/">
- <id>http://localhost:19000/abc/EntryXmlChangeTest/Employees('9')</id>
- <title type="text">Mister X</title>
- <updated m:null='true'>Z</updated>
- <category term="RefScenario.Employee"
- scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
- <content type="image/jpeg" src="Employees('1')/$value" />
- <m:properties>
- <d:EmployeeId>1</d:EmployeeId>
- <d:EmployeeName>Mister X</d:EmployeeName>
- <d:ManagerId>1</d:ManagerId>
- <d:RoomId>2</d:RoomId>
- <d:TeamId>1</d:TeamId>
- <d:Location m:type="RefScenario.c_Location">
- <d:City m:type="RefScenario.c_City">
- <d:PostalCode>69190</d:PostalCode>
- <d:CityName>Walldorf</d:CityName>
- </d:City>
- <d:Country>Germany</d:Country>
- </d:Location>
- <d:EntryDate m:null='true'></d:EntryDate>
- <d:ImageUrl>Employees('1')/$value</d:ImageUrl>
- </m:properties>
-</entry>
---changeset_f980-1cb6-94dd--
---batch_8194-cf13-1f56
-Content-Type: multipart/mixed; boundary=changeset_f980-1cb6-94dd
-
---changeset_f980-1cb6-94dd
-Content-Type: application/http
-Content-Transfer-Encoding: binary
-Content-ID: 1
-
-POST Employees HTTP/1.1
-Host: http://localhost/odata
-Connection: keep-alive
-Content-Type: application/atom+xml
-Accept: */*
-Accept-Encoding: gzip,deflate
-Accept-Language: de-DE,de;q=0.8,en-US;q=0.6,en;q=0.4
-
-<entry xmlns="http://www.w3.org/2005/Atom"
- xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
- xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"
- xml:base="http://localhost:8080/org.apache.olingo.odata2.ref.web/ReferenceScenario.svc/"
- m:etag="W/2">
- <id>
- http://localhost:8080/org.apache.olingo.odata2.ref.web/ReferenceScenario.svc/Rooms('2')
- </id>
- <title type="text">Room 2</title>
- <updated>2013-04-03T10:53:26.021+02:00</updated>
- <category term="RefScenario.Room"
- scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
- <link href="Rooms('2')" rel="edit" title="Room" />
- <link href="Rooms('2')/nr_Employees"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/nr_Employees"
- title="nr_Employees" type="application/atom+xml; type=feed">
- <m:inline>
- <feed xmlns="http://www.w3.org/2005/Atom"
- xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
- xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"
- xml:base="http://localhost:8080/org.apache.olingo.odata2.ref.web/ReferenceScenario.svc/">
- <id>
- http://localhost:8080/org.apache.olingo.odata2.ref.web/ReferenceScenario.svc/Employees
- </id>
- <title type="text">Employees</title>
- <updated>2013-04-03T10:53:26.024+02:00</updated>
- <author>
- <name />
- </author>
- <link href="Employees" rel="self" title="Employees" />
- <entry>
- <id>
- http://localhost:8080/org.apache.olingo.odata2.ref.web/ReferenceScenario.svc/Employees('2')
- </id>
- <title type="text">Frederic Fall</title>
- <updated>2003-07-01T00:00:00Z</updated>
- <category term="RefScenario.Employee"
- scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
- <link href="Employees('2')" rel="edit" title="Employee" />
- <link href="Employees('2')/$value" rel="edit-media"
- type="application/octet-stream" />
- <link href="Employees('2')/ne_Manager"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Manager"
- title="ne_Manager" type="application/atom+xml; type=entry" />
- <link href="Employees('2')/ne_Team"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Team"
- title="ne_Team" type="application/atom+xml; type=entry" />
- <link href="Employees('2')/ne_Room"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Room"
- title="ne_Room" type="application/atom+xml; type=entry" />
- <content type="application/octet-stream" src="Employees('2')/$value" />
- <m:properties>
- <d:EmployeeId>2</d:EmployeeId>
- <d:EmployeeName>Frederic Fall</d:EmployeeName>
- <d:ManagerId>1</d:ManagerId>
- <d:RoomId>2</d:RoomId>
- <d:TeamId>1</d:TeamId>
- <d:Location m:type="RefScenario.c_Location">
- <d:City m:type="RefScenario.c_City">
- <d:PostalCode>69190</d:PostalCode>
- <d:CityName>Walldorf</d:CityName>
- </d:City>
- <d:Country>Germany</d:Country>
- </d:Location>
- <d:Age>32</d:Age>
- <d:EntryDate>2003-07-01T00:00:00</d:EntryDate>
- <d:ImageUrl>Employees('2')/$value</d:ImageUrl>
- </m:properties>
- </entry>
- <entry>
- <id>
- http://localhost:8080/org.apache.olingo.odata2.ref.web/ReferenceScenario.svc/Employees('3')
- </id>
- <title type="text">Jonathan Smith</title>
- <updated>2013-04-03T10:53:26.025+02:00</updated>
- <category term="RefScenario.Employee"
- scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
- <link href="Employees('3')" rel="edit" title="Employee" />
- <link href="Employees('3')/$value" rel="edit-media"
- type="application/octet-stream" />
- <link href="Employees('3')/ne_Manager"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Manager"
- title="ne_Manager" type="application/atom+xml; type=entry" />
- <link href="Employees('3')/ne_Team"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Team"
- title="ne_Team" type="application/atom+xml; type=entry" />
- <link href="Employees('3')/ne_Room"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Room"
- title="ne_Room" type="application/atom+xml; type=entry" />
- <content type="application/octet-stream" src="Employees('3')/$value" />
- <m:properties>
- <d:EmployeeId>3</d:EmployeeId>
- <d:EmployeeName>Jonathan Smith</d:EmployeeName>
- <d:ManagerId>1</d:ManagerId>
- <d:RoomId>2</d:RoomId>
- <d:TeamId>1</d:TeamId>
- <d:Location m:type="RefScenario.c_Location">
- <d:City m:type="RefScenario.c_City">
- <d:PostalCode>69190</d:PostalCode>
- <d:CityName>Walldorf</d:CityName>
- </d:City>
- <d:Country>Germany</d:Country>
- </d:Location>
- <d:Age>56</d:Age>
- <d:EntryDate m:null="true" />
- <d:ImageUrl>Employees('3')/$value</d:ImageUrl>
- </m:properties>
- </entry>
- <entry>
- <id>
- http://localhost:8080/org.apache.olingo.odata2.ref.web/ReferenceScenario.svc/Employees('4')
- </id>
- <title type="text">Peter Burke</title>
- <updated>2004-09-12T00:00:00Z</updated>
- <category term="RefScenario.Employee"
- scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
- <link href="Employees('4')" rel="edit" title="Employee" />
- <link href="Employees('4')/$value" rel="edit-media"
- type="application/octet-stream" />
- <link href="Employees('4')/ne_Manager"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Manager"
- title="ne_Manager" type="application/atom+xml; type=entry" />
- <link href="Employees('4')/ne_Team"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Team"
- title="ne_Team" type="application/atom+xml; type=entry" />
- <link href="Employees('4')/ne_Room"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Room"
- title="ne_Room" type="application/atom+xml; type=entry" />
- <content type="application/octet-stream" src="Employees('4')/$value" />
- <m:properties>
- <d:EmployeeId>4</d:EmployeeId>
- <d:EmployeeName>Peter Burke</d:EmployeeName>
- <d:ManagerId>3</d:ManagerId>
- <d:RoomId>2</d:RoomId>
- <d:TeamId>2</d:TeamId>
- <d:Location m:type="RefScenario.c_Location">
- <d:City m:type="RefScenario.c_City">
- <d:PostalCode>69190</d:PostalCode>
- <d:CityName>Walldorf</d:CityName>
- </d:City>
- <d:Country>Germany</d:Country>
- </d:Location>
- <d:Age>39</d:Age>
- <d:EntryDate>2004-09-12T00:00:00</d:EntryDate>
- <d:ImageUrl>Employees('4')/$value</d:ImageUrl>
- </m:properties>
- </entry>
- <entry>
- <id>
- http://localhost:8080/org.apache.olingo.odata2.ref.web/ReferenceScenario.svc/Employees('6')
- </id>
- <title type="text">Susan Bay</title>
- <updated>2010-12-01T00:00:00Z</updated>
- <category term="RefScenario.Employee"
- scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
- <link href="Employees('6')" rel="edit" title="Employee" />
- <link href="Employees('6')/$value" rel="edit-media"
- type="application/octet-stream" />
- <link href="Employees('6')/ne_Manager"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Manager"
- title="ne_Manager" type="application/atom+xml; type=entry" />
- <link href="Employees('6')/ne_Team"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Team"
- title="ne_Team" type="application/atom+xml; type=entry" />
- <link href="Employees('6')/ne_Room"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Room"
- title="ne_Room" type="application/atom+xml; type=entry" />
- <content type="application/octet-stream" src="Employees('6')/$value" />
- <m:properties>
- <d:EmployeeId>6</d:EmployeeId>
- <d:EmployeeName>Susan Bay</d:EmployeeName>
- <d:ManagerId>1</d:ManagerId>
- <d:RoomId>2</d:RoomId>
- <d:TeamId>3</d:TeamId>
- <d:Location m:type="RefScenario.c_Location">
- <d:City m:type="RefScenario.c_City">
- <d:PostalCode>69190</d:PostalCode>
- <d:CityName>Walldorf</d:CityName>
- </d:City>
- <d:Country>Germany</d:Country>
- </d:Location>
- <d:Age>29</d:Age>
- <d:EntryDate>2010-12-01T00:00:00</d:EntryDate>
- <d:ImageUrl>Employees('6')/$value</d:ImageUrl>
- </m:properties>
- </entry>
- </feed>
- </m:inline>
- </link>
- <link href="Rooms('2')/nr_Building"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/nr_Building"
- title="nr_Building" type="application/atom+xml; type=entry" />
- <content type="application/xml">
- <m:properties>
- <d:Id>2</d:Id>
- <d:Name>Room 2</d:Name>
- <d:Seats>5</d:Seats>
- <d:Version>2</d:Version>
- </m:properties>
- </content>
-</entry>
-
---changeset_f980-1cb6-94dd
-Content-Type: application/http
-Content-Transfer-Encoding: binary
-Content-ID: 1
-
-POST Employees HTTP/1.1
-Host: http://localhost/odata
-Connection: keep-alive
-Content-Type: application/atom+xml
-Accept: */*
-Accept-Encoding: gzip,deflate
-Accept-Language: de-DE,de;q=0.8,en-US;q=0.6,en;q=0.4
-
-<entry xmlns="http://www.w3.org/2005/Atom"
- xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
- xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"
- xml:base="http://localhost:8080/org.apache.olingo.odata2.ref.web/ReferenceScenario.svc/"
- m:etag="W/2">
- <id>
- http://localhost:8080/org.apache.olingo.odata2.ref.web/ReferenceScenario.svc/Rooms('2')
- </id>
- <title type="text">Room 2</title>
- <updated>2013-04-03T10:53:26.021+02:00</updated>
- <category term="RefScenario.Room"
- scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
- <link href="Rooms('2')" rel="edit" title="Room" />
- <link href="Rooms('2')/nr_Employees"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/nr_Employees"
- title="nr_Employees" type="application/atom+xml; type=feed">
- <m:inline>
- <feed xmlns="http://www.w3.org/2005/Atom"
- xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
- xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"
- xml:base="http://localhost:8080/org.apache.olingo.odata2.ref.web/ReferenceScenario.svc/">
- <id>
- http://localhost:8080/org.apache.olingo.odata2.ref.web/ReferenceScenario.svc/Employees
- </id>
- <title type="text">Employees</title>
- <updated>2013-04-03T10:53:26.024+02:00</updated>
- <author>
- <name />
- </author>
- <link href="Employees" rel="self" title="Employees" />
- <entry>
- <id>
- http://localhost:8080/org.apache.olingo.odata2.ref.web/ReferenceScenario.svc/Employees('2')
- </id>
- <title type="text">Frederic Fall</title>
- <updated>2003-07-01T00:00:00Z</updated>
- <category term="RefScenario.Employee"
- scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
- <link href="Employees('2')" rel="edit" title="Employee" />
- <link href="Employees('2')/$value" rel="edit-media"
- type="application/octet-stream" />
- <link href="Employees('2')/ne_Manager"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Manager"
- title="ne_Manager" type="application/atom+xml; type=entry" />
- <link href="Employees('2')/ne_Team"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Team"
- title="ne_Team" type="application/atom+xml; type=entry" />
- <link href="Employees('2')/ne_Room"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Room"
- title="ne_Room" type="application/atom+xml; type=entry" />
- <content type="application/octet-stream" src="Employees('2')/$value" />
- <m:properties>
- <d:EmployeeId>2</d:EmployeeId>
- <d:EmployeeName>Frederic Fall</d:EmployeeName>
- <d:ManagerId>1</d:ManagerId>
- <d:RoomId>2</d:RoomId>
- <d:TeamId>1</d:TeamId>
- <d:Location m:type="RefScenario.c_Location">
- <d:City m:type="RefScenario.c_City">
- <d:PostalCode>69190</d:PostalCode>
- <d:CityName>Walldorf</d:CityName>
- </d:City>
- <d:Country>Germany</d:Country>
- </d:Location>
- <d:Age>32</d:Age>
- <d:EntryDate>2003-07-01T00:00:00</d:EntryDate>
- <d:ImageUrl>Employees('2')/$value</d:ImageUrl>
- </m:properties>
- </entry>
- <entry>
- <id>
- http://localhost:8080/org.apache.olingo.odata2.ref.web/ReferenceScenario.svc/Employees('3')
- </id>
- <title type="text">Jonathan Smith</title>
- <updated>2013-04-03T10:53:26.025+02:00</updated>
- <category term="RefScenario.Employee"
- scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
- <link href="Employees('3')" rel="edit" title="Employee" />
- <link href="Employees('3')/$value" rel="edit-media"
- type="application/octet-stream" />
- <link href="Employees('3')/ne_Manager"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Manager"
- title="ne_Manager" type="application/atom+xml; type=entry" />
- <link href="Employees('3')/ne_Team"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Team"
- title="ne_Team" type="application/atom+xml; type=entry" />
- <link href="Employees('3')/ne_Room"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Room"
- title="ne_Room" type="application/atom+xml; type=entry" />
- <content type="application/octet-stream" src="Employees('3')/$value" />
- <m:properties>
- <d:EmployeeId>3</d:EmployeeId>
- <d:EmployeeName>Jonathan Smith</d:EmployeeName>
- <d:ManagerId>1</d:ManagerId>
- <d:RoomId>2</d:RoomId>
- <d:TeamId>1</d:TeamId>
- <d:Location m:type="RefScenario.c_Location">
- <d:City m:type="RefScenario.c_City">
- <d:PostalCode>69190</d:PostalCode>
- <d:CityName>Walldorf</d:CityName>
- </d:City>
- <d:Country>Germany</d:Country>
- </d:Location>
- <d:Age>56</d:Age>
- <d:EntryDate m:null="true" />
- <d:ImageUrl>Employees('3')/$value</d:ImageUrl>
- </m:properties>
- </entry>
- <entry>
- <id>
- http://localhost:8080/org.apache.olingo.odata2.ref.web/ReferenceScenario.svc/Employees('4')
- </id>
- <title type="text">Peter Burke</title>
- <updated>2004-09-12T00:00:00Z</updated>
- <category term="RefScenario.Employee"
- scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
- <link href="Employees('4')" rel="edit" title="Employee" />
- <link href="Employees('4')/$value" rel="edit-media"
- type="application/octet-stream" />
- <link href="Employees('4')/ne_Manager"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Manager"
- title="ne_Manager" type="application/atom+xml; type=entry" />
- <link href="Employees('4')/ne_Team"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Team"
- title="ne_Team" type="application/atom+xml; type=entry" />
- <link href="Employees('4')/ne_Room"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Room"
- title="ne_Room" type="application/atom+xml; type=entry" />
- <content type="application/octet-stream" src="Employees('4')/$value" />
- <m:properties>
- <d:EmployeeId>4</d:EmployeeId>
- <d:EmployeeName>Peter Burke</d:EmployeeName>
- <d:ManagerId>3</d:ManagerId>
- <d:RoomId>2</d:RoomId>
- <d:TeamId>2</d:TeamId>
- <d:Location m:type="RefScenario.c_Location">
- <d:City m:type="RefScenario.c_City">
- <d:PostalCode>69190</d:PostalCode>
- <d:CityName>Walldorf</d:CityName>
- </d:City>
- <d:Country>Germany</d:Country>
- </d:Location>
- <d:Age>39</d:Age>
- <d:EntryDate>2004-09-12T00:00:00</d:EntryDate>
- <d:ImageUrl>Employees('4')/$value</d:ImageUrl>
- </m:properties>
- </entry>
- <entry>
- <id>
- http://localhost:8080/org.apache.olingo.odata2.ref.web/ReferenceScenario.svc/Employees('6')
- </id>
- <title type="text">Susan Bay</title>
- <updated>2010-12-01T00:00:00Z</updated>
- <category term="RefScenario.Employee"
- scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
- <link href="Employees('6')" rel="edit" title="Employee" />
- <link href="Employees('6')/$value" rel="edit-media"
- type="application/octet-stream" />
- <link href="Employees('6')/ne_Manager"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Manager"
- title="ne_Manager" type="application/atom+xml; type=entry" />
- <link href="Employees('6')/ne_Team"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Team"
- title="ne_Team" type="application/atom+xml; type=entry" />
- <link href="Employees('6')/ne_Room"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ne_Room"
- title="ne_Room" type="application/atom+xml; type=entry" />
- <content type="application/octet-stream" src="Employees('6')/$value" />
- <m:properties>
- <d:EmployeeId>6</d:EmployeeId>
- <d:EmployeeName>Susan Bay</d:EmployeeName>
- <d:ManagerId>1</d:ManagerId>
- <d:RoomId>2</d:RoomId>
- <d:TeamId>3</d:TeamId>
- <d:Location m:type="RefScenario.c_Location">
- <d:City m:type="RefScenario.c_City">
- <d:PostalCode>69190</d:PostalCode>
- <d:CityName>Walldorf</d:CityName>
- </d:City>
- <d:Country>Germany</d:Country>
- </d:Location>
- <d:Age>29</d:Age>
- <d:EntryDate>2010-12-01T00:00:00</d:EntryDate>
- <d:ImageUrl>Employees('6')/$value</d:ImageUrl>
- </m:properties>
- </entry>
- </feed>
- </m:inline>
- </link>
- <link href="Rooms('2')/nr_Building"
- rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/nr_Building"
- title="nr_Building" type="application/atom+xml; type=entry" />
- <content type="application/xml">
- <m:properties>
- <d:Id>2</d:Id>
- <d:Name>Room 2</d:Name>
- <d:Seats>5</d:Seats>
- <d:Version>2</d:Version>
- </m:properties>
- </content>
-</entry>
-
---changeset_f980-1cb6-94dd
-Content-Type: application/http
-Content-Transfer-Encoding: binary
-Content-ID: 1
-
-PUT Employees('1') HTTP/1.1
-Host: http://localhost/odata
-Connection: keep-alive
-Content-Type: application/atom+xml
-Accept: */*
-Accept-Encoding: gzip,deflate
-Accept-Language: de-DE,de;q=0.8,en-US;q=0.6,en;q=0.4
-
-<?xml version='1.0' encoding='utf-8'?>
-<entry xmlns="http://www.w3.org/2005/Atom"
- xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
- xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"
- xml:base="http://localhost:19000/abc/EntryXmlChangeTest/">
- <id>http://localhost:19000/abc/EntryXmlChangeTest/Employees('9')</id>
- <title type="text">Mister X</title>
- <updated m:null='true'>Z</updated>
- <category term="RefScenario.Employee"
- scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
- <content type="image/jpeg" src="Employees('1')/$value" />
- <m:properties>
- <d:EmployeeId>1</d:EmployeeId>
- <d:EmployeeName>Mister X</d:EmployeeName>
- <d:ManagerId>1</d:ManagerId>
- <d:RoomId>2</d:RoomId>
- <d:TeamId>1</d:TeamId>
- <d:Location m:type="RefScenario.c_Location">
- <d:City m:type="RefScenario.c_City">
- <d:PostalCode>69190</d:PostalCode>
- <d:CityName>Walldorf</d:CityName>
- </d:City>
- <d:Country>Germany</d:Country>
- </d:Location>
- <d:EntryDate m:null='true'></d:EntryDate>
- <d:ImageUrl>Employees('1')/$value</d:ImageUrl>
- </m:properties>
-</entry>
---changeset_f980-1cb6-94dd--
---batch_8194-cf13-1f56--
\ No newline at end of file
diff --git a/lib/server-core/src/test/resources/batchWithContent.batch b/lib/server-core/src/test/resources/batchWithContent.batch
deleted file mode 100644
index 834857d..0000000
--- a/lib/server-core/src/test/resources/batchWithContent.batch
+++ /dev/null
@@ -1 +0,0 @@
-/9j/4AAQSkZJRgABAQEBLAEsAAD/4RM0RXhpZgAATU0AKgAAAAgABwESAAMAAAABAAEAAAEaAAUAAAABAAAAYgEbAAUAAAABAAAAagEoAAMAAAABAAIAAAExAAIAAAAUAAAAcgEyAAIAAAAUAAAAhodpAAQAAAABAAAAnAAAAMgAAAEsAAAAAQAAASwAAAABQWRvYmUgUGhvdG9zaG9wIDcuMAAyMDA1OjExOjE1IDE1OjMyOjQwAAAAAAOgAQADAAAAAf//AACgAgAEAAAAAQAAAV6gAwAEAAAAAQAAAZMAAAAAAAAABgEDAAMAAAABAAYAAAEaAAUAAAABAAABFgEbAAUAAAABAAABHgEoAAMAAAABAAIAAAIBAAQAAAABAAABJgICAAQAAAABAAASBgAAAAAAAABIAAAAAQAAAEgAAAAB/9j/4AAQSkZJRgABAgEASABIAAD/7QAMQWRvYmVfQ00AAv/uAA5BZG9iZQBkgAAAAAH/2wCEAAwICAgJCAwJCQwRCwoLERUPDAwPFRgTExUTExgRDAwMDAwMEQwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwBDQsLDQ4NEA4OEBQODg4UFA4ODg4UEQwMDAwMEREMDAwMDAwRDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDP/AABEIAIAAbwMBIgACEQEDEQH/3QAEAAf/xAE/AAABBQEBAQEBAQAAAAAAAAADAAECBAUGBwgJCgsBAAEFAQEBAQEBAAAAAAAAAAEAAgMEBQYHCAkKCxAAAQQBAwIEAgUHBggFAwwzAQACEQMEIRIxBUFRYRMicYEyBhSRobFCIyQVUsFiMzRygtFDByWSU/Dh8WNzNRaisoMmRJNUZEXCo3Q2F9JV4mXys4TD03Xj80YnlKSFtJXE1OT0pbXF1eX1VmZ2hpamtsbW5vY3R1dnd4eXp7fH1+f3EQACAgECBAQDBAUGBwcGBTUBAAIRAyExEgRBUWFxIhMFMoGRFKGxQiPBUtHwMyRi4XKCkkNTFWNzNPElBhaisoMHJjXC0kSTVKMXZEVVNnRl4vKzhMPTdePzRpSkhbSVxNTk9KW1xdXl9VZmdoaWprbG1ub2JzdHV2d3h5ent8f/2gAMAwEAAhEDEQA/APVUkkklKSSXBfXb/GBVgVHD6WW3ZtjnsDnDdVW2tzqLb7G/4az7RXdj4+O79FvotyLvUr9D1Ep6rqX1h6Z06gX5F9ddbvoW2vbVW6Bu/Rvf7r/b/wBxa8hc3mf40ugVtLqMr1CJ9tWLdbx/wtzsBq8myszKzcl2VmXWZOS/6V1ri939WXfRZ/IZ7EzGF5k6Dj5o0i3vOtf4yX/rNeEMp14ZFGS21ldW9zA5tv2P07nfo3u/mfVs/wCEtQ7f8aX1iwcmzFLcTOrodsbe6t9b7GgD9I/0bXUte78706vTXLYXTX34VuTWf5gv3jxAG9US0GsEcjukp9S6L/jQyOouLLOkTs+mcfJpc/8ArDGyzhv2/wDXF2eH1PFzIbWXV2kbvRta6t8d3Blgbva2fp17618712WVWNtqcWWN+i9pghdF0T6+9b6Y9rL9vUcUO3ejadjwfGi+v+bf/YSpVvuKSzug9bweudNqz8Gw2VWSDuAa9rm6WU31j+bur/O/M/wlX6NaKCVJJJJKf//Q9VSSSSU5n1gy8nG6ca8IhudmPZi4hOobZadnrxDtzcSn1cx/8jHXh/1mxcDC+sGdh9OJOJj2CquSXQWNa25u930tt3qf217Zlb8n6x4tIBNXT8ezKcewuvP2LEd/7Djqa8Cs9Qlz3Bx3PcS9wMEkud9I/nP+kiEFiNTp3Vpg2gAdlWYYcDzqtrovQM/rb7W4L6AcfabfWs2EB30XCtrX2Pb/AGUlPQfUPFrv6dmm0Sz7Q1jh4hzDv/6K5G/HOLk34hMnHtspn+o91f8ABek/VXpR6X0m3Gssbbccu43OaCG7qz6Aazd7tuyvd/bWFm/VinqGNl9U9c4dlGVlsuea32se1t7yywsxw69r2Ns2b62WexK0vEEQY8EyLktY17tljbWAlotZO10HR7N4Y/a7+WxBmdRqEUPZ/wCLDrg6d144FztuP1QBjfAZDPdQf5Pq1+tR/X9Bexr5y25uGMXNYx1RcfWw7iPY91Lg6arB7XOptbtuZ/OVf4RfQnTc2vqHT8XPqEV5dTLmDmBY0Wbf7O5NKWykkkkp/9H1VJJJJTwvXfrg7pXUetV4WM/Mz2GqvcWzRTU2lt7bL3g/pHerkZX6pX+kf6f+DXm/Xer53Vsht+bbbZXUSymt7g4hzv0lz7C2Km5F7v0ljamfoK/Rxa9lFFVa6T/GB1bHx8rI6Z06WG+19+S/dJLnkGx5/lXOqqZV/osTFp9P+fXI44osxTW8HfQ912v0XMLWM2fyXeq2tv8AbRCCyw8HLyAH1troqILm2XE+4Ax+jYwPut937tfpf8ItvE699Y+kVCnHyMP0Rr6Hotr3fGz0muc7/jXrHOXl1scTYQ7IaHOcIBIH6OsN/wBHXt+hs/wf6OtVSdZmSdSSkp6Rv176tNrKqaqXl7rrIZ6p3ODQ/bvura1rnM3/AEbE1f1y+sJxBXj5VOBXue82VsD7rHWPfbbY1jd/pe5371CzcYtFddd2Q2pjXF7K3EiA6N1gimxv02/v2ZH+ipVTJcXZFrnHe5z3OL+Zkn3Ttr+l/wAXX/xaSkl9udfc+85dltjvdZa6sNJ83mv1FTe+5rpt9x8SAZHjuaj0WPZYNjizcQ0xwQdPc385IDc1zPzS1zgD4t1cG/5u5JTr/VvL6e19vROsNLuk9Sc0uO6DjZA9lPVMV7/bW5jfZk/8B9P1qK7KV6/9VumZXSOhY3TMp7brMPfU21ugfWHv+zv2+7Z+g9Pez8x68BL3ENM6gD7wI/gvWv8AFr9ZrOo4LOn5LybsJoq1jVnOPZ/J2+/G/wC2EikPdJJJIKf/0vVVR611KvpfTMjOeQBSwkT4/mq8vPv8a3VhXhNwGO91ha2ATEuPqW7v5VVNbG/+hiSny3KybMrJsybTusueXunxd/5H6Kkz213tJDHFgAB0kh7HbW/9UgztIPKs0mvextwLqSYc9v0thIEtn89kbUUMb7jbYXgbW7WNa3mA0beyiGk6ak9h3PwH0l6C/wCoX1fHT33YdmTfbbWX41r7Ghslu6r9DVWxv+evP6X3Mey6txquqc17HcFtjTuaR/KrsCSm19nys9xtc0N2MDWsYxx2t1LNzK2vc3d/wn6R6bMraGY9jJLH1SbACWyCWvHqRs/N/rrovqv9Yvq/gY+XX1+i67JyHvyacj0zYLHPH09Cx+/1Ge1/83/wiB03635vT6ep14dAbh9Rfbc2h3tfU+0Nroyq7o/SMY6r9LT/AOCpKebYSHNfMgEHTyMold0+nU/aBT6hLxJkPH0f+kuk+pn1fxOq0ZWT1Cs3NFjaa3OLgZj1brA5pa71PcxX/rL0LoPTsvAwOntNNt7jdkPtIc2uhgPq27tjbHWbWv8ATr3/AE9iSnhXtcwbHNLXNAmedRuWr9U+rWdJ65jZLdzmFwZZW36Tmn81n/Cf6L/hVS6raLs23IZIZc421bvpFrj7bXf1/wDBf8GqoJHBg9ikp+kqLq76a76nB9drQ9jxwWuG5rtf3moi5L/Fx1k9Q6N9msIL8QNNcT/NWb9rXz+dTk05eP8A8TTSutQS/wD/0/U7LGVsdZY4MYwFz3OMAAauc4rw767dR+3dRr1O7Ycq4HkWZRbdXV/1np7MCj/ra9a+tNzD05vTi4Nd1SxuIZjSpwNue9278yvAqyXLw3qmd+0OqZmfEDJvssYD2YXH0m/2atjUQotMrS6VT9pJxHw0ZD9mLY7RoySN1dFjvzKsxv6Df/g7vRt/0qzy1ruDHkVaqLX02Y7yxzLADtd+jO4Dbua7+a37fb9KtJDvU/WvLw/qx+zanObnG51dVh/nK6tXXSz6TMhln6H+R+l/0awun4dnUM/HwmPDbMuwVMc/WXPO3+1v/lLqsCzMv6dm9RYcY5NlYd1DFt0tynY8j18V9e7Zdl0vZXlVf9q7vVtp/pKF0XC6Vh2dJ6i+237dj5H2vOqbhZWjYaKcHF20ei1uP793/CP/ANHWkpHR0zGZ0QevWLbGfWSrDfa/3PNTWbLKfUb/AIJzvzGrP6v0puNn9asoDmYvTsx1DWGXNDLXOFVTrCXPr3R+je5dC1uGOnvxTfeXv6wOrBwwMuNv+gP6L+d/8DT59eFl0/WCttmWz9u5FN9R/Z+UfS9F/qllvs9+/wD4NJTzn1e61mdE6g2ysPyMO0j7TjN13sP0cilv5l9cf+69i0/rFkYuX1TM6pdNuFjxjUtiG3Wjc6rFa76XpPY1uTnvZ768H9D/ADmfSonHwMbrIxOn5D8DCymix+Tl49lb8Y1j1L6q67mtfk4+Xt/Q17vp/wDblmPmWVWvLbbnFlLy2sBpcXNM2XZe+x/89l5Dt9tT6v8Arv6CpIpc7Jutvtffc/1LrXbrHmBJP8lvtb/JY36CEFYvfX6LWDdvnWeDrO7b+bt+ggDlJD1v+L/q7endWpe5+ykWCm4GI9HKLKNznH6P2fqFeB/1q/IXtC+dOnX0U5X6y1z8a5llF7WQHFljHV7qy/2epVZsur3/AOEqXs+D9Yr8/wColnWsdwOfTg2us0GmVRW8Wbq//DFe9rf9EkUh/9SX+NjrYf1KjpVDo+y1F17hzuv2ubT/AGaqmWv/AONZ/LXnpXf/AOM/6rdQZ1K36wY7HX4V7WnKLRLqXVsZTvewe77O+qtn6X/BfpPVXAESA4cHg9iigsHFWbYbteOHBVStLpeN9tz8DCcdMm1lLo1O17mMf/msSUhoy8ihxNDzWTEwAdQd7HbXAt3MeN7HLq6frD1bqr3W4mZlHMc0HK6WzIe2S1sPzOlNbvfZRsb6uV0yr9Yx/wDtN6lH83g/WLpGL0jq1mNiZVeZiuHqUPY9rntafo05Ppy1trP3v8Mz9Is5rnsey2t7q7ayH12MJa5rhq19b2+5j2/vNSU9hjZd19lVnr2Wi9ss22EFw49j63ZnUH/2qk1tub64qY+xrWtL8kWXGplVYljr8u977upV0t/l012Xv/QUV+osTG6/ktvttucG23g+u9tcttfB23349dmNU/L/AO7H+E/7UU3KlmdVysig4jQ2jEe/1bKqwGm14+jZlPaG+ts/wVfsx6P8DSkpn1XPZmXn0S91DdGPuc59j4Jh7nXustrq/wBBj+p+ir/fsQtw9Frnak/jqqomIRmhoEkyfDsElI7jwTzH5dVAHupW9vKPw0UAipnyfius+pfWMirA670gkux8rp2VkNH7t1VXpl4/46l+2z/iKlzfT8DO6hmNw+n0Oysp3FVYBIH71jnQypn8u1zGL1L6vfUDI6T0DqbrXNu631HEuoaAYrqFjDsx2WfnOst9N2Rf/U2fzX6QFQf/1fVVzHXP8Xf1a6w51xpODku1N2IRXuPO62na6i137z/S9X/hF06SSnyHqX+KHr9D3Hp+Tj51Q+iHl1Fp/sRdR/4Mxcruzuh5mQ0tZXm0NtxLIcH7H2NNORssrca/VqqsfV/wb19Dunadph0aE6iV8+/WbonUuhZ7cDqTm2ZDm/aDewlzbPUJ32Nc9rH/AM96jX72IhDkB20Q0ADwCcXPAjhRU6qbr3iumt1tjuGMaXOPyaipTXbj7jz4KVpY1o28k8ob2uqsNVgNdjTDmPBa4H+Ux8OT01W5FgqxmOvtPDKml7v81m5JTKpxe8NcYnwVn7PLTtcS6NAeFGzpvUMPIYzKofQ76QDxoW/vNIRg6CkpsfVnoDvrF1T9mNyGYdxYbGutk7tpHq111jbvtax3q7P3PUXpHTf8UXQMfa7Pvvz3NGrJFNZ/sUfp/wD2ZXLfU/6odX6tmY3XMS1uHTg5FZFz5m303frDaGt+l6bN9Lt/6O3+Y/wVi9jQKWtg9OwOnUDHwMerFpGvp0sDAT+87YPc7+UrKSSCn//W9VSSSSUpcv8A4wfqq/6x9HH2VoPUcJxtxQSBvBEXYu93tZ67Wt2/8NXT+YuoSSU/NFlVtVjqrmOqtrJbZXY0te1w+kyxjvcx7VPFy8rCvbkYlz6Lm/RsYYP9U/mvZ/IevdvrB9Sfq99YHG7NoNeXG0ZdB9O2NPpu91d23b7ftFdq5Sz/ABNY4cTV1OxzezH1gH/t1jv/AESjaKeSb9fOuWDbn04PVG/mtzcVjw0RG1npGn26In/jh9daw1Y1GBh0BpAox8bYzcfo2R6jvcz/ALb/AODXQu/xPZROmc2PGYP/AJ4coj/E5lzr1BgH3/8AopiWitXz/LzMvNyHZOXc6692hsd4DhjQ2GsY39xi1vqv9XupfWPNbiYoLamEHKzCPZUzv7vovyX/AOAo/P8A+J9Sxd1hf4nemse12dm2XNBBdXUPTkD/AAbrHPs9jvzvTrqt/wCEXc9N6ZgdLxGYfT6GY2PX9GusQJ/ecfpPe786x/vStVMsDBxenYdODh1irGx2CuqsdmjzPuc7997vpqwkkglSSSSSn//Z/9sAQwAGBAUGBQQGBgUGBwcGCAoQCgoJCQoUDg8MEBcUGBgXFBYWGh0lHxobIxwWFiAsICMmJykqKRkfLTAtKDAlKCko/9sAQwEHBwcKCAoTCgoTKBoWGigoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgo/8AAEQgBkwFeAwEiAAIRAQMRAf/EAB0AAQAABwEBAAAAAAAAAAAAAAABAgMEBQYHCAn/xABNEAABAwMBBQQHBQQHBQYHAAABAAIDBAURBgcSITFBE1FhcRQiMoGRobEIFSNCYlJywdEkM0OCkqLhFiU08PFTY3OywtIXJkRUdIOT/8QAFgEBAQEAAAAAAAAAAAAAAAAAAAEC/8QAGxEBAQEBAAMBAAAAAAAAAAAAAAERMQISIUH/2gAMAwEAAhEDEQA/APVKIiAiIgIiICIiAiIgIiICIiAipzzxU8ZknkZHGBkue7AHvWuT62tHauhtxqbrUA4MdvgdNg+Lh6o95QbOi1J921VWD+gWCnomHk+4VQLv8DM/VWNTR6sqP+K1LSUTeraSjyR73FMNb2td1Tq62abdGyu9JlnlBcyClgdK8jvw0cB5rUqjTD6hx+8NZX6TPPs5mwj/AChW94v9i2WULaauudZUS1zu0gdKTNI1gAzl3dvEn3+CuJqtU7ZbVBnNj1CQOpoXBW0+3Ox00ZkqbRfYWD80lLuj4krXJttennDLa6Z3h2Lv5Lme1jaj/tPRNttsklbQkh0pcCDIegx3K4a9WaP1PbtV2WG52qQmCTI3XjDmkcwQs7kd68OavtR0/Y9M3K1VczGXCk3ntZI4YeDx4g9crCUWrr9TseYr3conNHq7tS/H1Uw17+ReGrdtb1rQY7K+1Mg7psP+oW22r7RGqKUhtbBRVjRz3oy0/EKK9cIvP1j+0lbZi1t3s88Pe+nkDwPccLo2ntrGjL4Wspr1BBM7lFVfgn/Nw+BQb2ikilZMwPie17TyLTkFToCIiAiIgIiICIiAiIgIiICIiAiIgIiICIiAiIgIiICIVi7lcXslFLQRCorSM7pOGxj9p56Dw5lBeV1bT0MBmq5mQxDm55wsE64Xi7n/AHRTtoKM/wD1lY313DvZFzx4ux5LXdZao09ohgrtTVnp93xvRQNALgf0M5NHiePivPGvdtuotSumgo5fuu3ngIoHeu4fqf192FcTXfNUag0RpcGTVF2N1r28eykd2zs+EY9VvvXNb99o2SNpg0xZYKaEcGunOT/hbgBeeJp3yvLpHuc48SSckqRrgQcgk9O5XDrpV32060uTiPvQ07T+WBoatYrda6lrD/SLzXv7/wAYha44boyeAPcpct6ojJT3i5T/ANdX1L/35nH+K2PXl4fdaXSjHSb5prRHG4uOeO+/n7gFpe8OjVMHulcxr3Eho3R4D/koKrd5w4SNB7uATde7gHAlVewiaeGXeYVVrGtA3G4Q1tOrrlHW6C0nEx536ds0TxjkQ4LRyfFXEUkj8QucTHGXFre7PNSzsLW5AyO7uQUd7h/qoFw/6qXI6hQOPFBtWmJNOzvZFdaaRkpOA/tDun+S6LS6Q0rVsH4M0WR7TJlxAHxWyab1PUWwthnLpKb5t8lV13jTWla+zOa/Surq2jxxEFQ0SRHwIyui2zWN+tDGt1damz0vL7yteZWDxfH7TfMArhdn15QQuafS2DzOF0/TGtKeqDewnjk/ceCphrsNquVJdKNlVQVEVRA/k+N2Qrxc+oGUklUau0y/dte/i4tH4U3hIzkfMYK262XF07uwrIvR6xoyWZy14/aYeo+alismiIoCIiAiIgIiICIiAiIgIiICIiAiIgIiICIsdqG70tis1Xc6+QMpqaMvcT9PMoKV4uToZ6egpN11fU5LBz3GD2nnwHDzJAXI9re1Wl0PDLZdOFlTe5Bmeocd7snHq7vd4dFh7htFms2hbhq2ocPv7UEzoaCN39hAzgMDoBknxJC80VtVNV1Ms9TI6SWRxc57jkknmVYlqtd7pWXaulq7hUyVFTKd575HZJKsicNyeJPJSlS571UTZHVTB/q4LRnoVTxxwpmtJOMIJnOe/GTy5I1u8RgZKMHrDqr6GLcGeRQUWU7zzw3zUtGzFQQeJCvRjpknxVvTDFU/zQbBWW1zaVksbeOASArKrpnQxQueMbwXRbdRia307w0YcwLEa0t5jt8crW+wcFBz6JoFS/PVViAfJUTkVPFV0FjKzDiD7lSV3UNy3I5hWpGEEEREEchV6SsnpZBJTTPieDkFhwrZMoOpaN2u3WzysiurRXUo4F3KRvv5H3r0roTV9n1jbmmjqA57OOM4kid5dF4aaQDx5LLaevdfp66w11qqXwVERyC08D4EdR4Ia+hFJM/Jinx2reORyeO8K6XPdlOuaXXunI6mPdhulLhs8OfZPeP0lb/DIJGBwBHeO4rLSdERAREQEREBERAREQEREBERAREQEREBebvtNaqnr6+n0lanOe2Iek1YZ1IGQD4AZPwXfdT3eCw6fr7pVODYaWF0hz1I5D3nAXD9kmm5LxZdQavvbO0rbuZI4S/8sf5iPM8PIIPOepb5PdnUTJCW09HA2ngj6NaOZ8ySSsKTwWW1Vbza75VUnSN/DyWJK0yKRRGQhOUEWcHA9OqqBxY4lvNUhjiqjBvEdyC4pGcS9w8ldj1jxVONu60DCqNOEFQAK0gGKqVVySeiowf8VKg7npGn9I03RPx+TCn1VaTVWGrYG+sGFw9yyWziEyaOon46FbC+kbI17HDIcCCstPKj8iq48xzVYHKvNUUJtupKqmcMbkhx5KyBwStMpXjLSFZOWQdyVjKN15QU0yiIIEJhEQRBU+d5uO5U1MOYCDbtmmr6rRuqKW40zndiDuTx54SRk8QR9F7pttdBXUtLX0bw+lrI2yMcORyMgr51N4HhzXrD7L2pvvbSNVYKiXNRb3b0OTx7Nxz8nZ+KlWV3ZFTgeZImkjDuRHceqqKKIiICIiAiIgIiICIiAiIgIiICIhQcV+0Xcp66OyaQt5JqrrUtMjW89wHAz7+PuW+3CGm0zpKnoYd1lNRwBueXADifqucaTH+2G3273d/r0VjYYYc8Rv8Asj/1FVftJ6k+7NJvpYn4nrn9g3HMNxlx+Ax70SvL2sLn98ahra3PqySHc/d6fJYNVXHiqRGCtIcgoJlEEQMq6pmZ4nkFat5rIQDEYQVkxhE4oAdxOeCpQf8AFS+QVXqqcY/pjx3gIPTmzGDd0NbierSVnWt/FPgqGiqb0bR9siIwRA0keavMYJyFjWnn7bfRim1ZBKwACeIOOO8EhaGup7b6Y1N/tMbfbfGWgd/rLlr2lj3McMOacEFblShOVbVI4g4VwpJWb7D3hEWSKJGOB5qHJBAoolQ6IB5KI44KgFM1BMDghbvsh1U7SGt6Guc4ilc7sagDkWO4H4c1pLW8FMDxyg+jcEjHHfjcHRyND2kHgVcLlf2f9TnUGzukbO/fq7a70WQk8S0D1T8Poup9VlpFERAREQEREBERAREQEREBERAWK1XdG2XTV0uUnAUtNJLx6kNOB8cLKrl32iLg+DQQt0BPb3OpjpWtHUE5I+Q+KC2+z7a32/QMt0qB/SrpM+oc48yM4H8Vyf7UJmN2tLpHfgmN5a3xyMlemLZbWWjTFFbYQA2mgZFw8BxPxXmz7Uo/pViHXcl+oRK4K5UnH1lUfkcVSK0gihzUcccIJm81kISHMBHLCx2CFc00m64NOcFBdg4UWqLRlwb1PBdJ01slul4pY6qSqp4IHgEEHeOEJHNuqvdOUEly1JS0sTS4yuAwOPDPFdtoNitsgw6trp5yOYb6oUbZYbdp7ahbae3wBkUlFIePElwPNTVx0yliEFJFC0YbGwMHuCoPGc8FfOxu8FaSdSsYrj+1PDdZaZe4cO1Gf8YWF2i6Dq4q+W4WmIy08h3nRt5tPXgsztgbu33Tkg6TY/zNXV6eEPA3uq0PI88EsDy2aN7HDo4YVPivUWp4dKxkQ3xtLHI4ZG+MFce2g2vStPTifT9aHT5wYWnIIWozXNqkAEHHNW6v5WBzcEKxc0gkFBKiJ0wggCqjVSIIPBVIwXkAH1jwwUFZSNPrlVqmlqaKXsqyCSF5AcA9pGQeo7wqA4SclV47r9lW+ei6rrbPM7EVfCS0frbx+hK9WwEmMZ58ivAmzi8mwa2s9yDsNhqWb/7hOHfIle+4iMuxxB9YHzWFVEREBERAREQEREBERAREQEREBci2if762v6Lsp9aKlc6vlb09XiPm0Lrq4/pR33vt+1LWe1HbqVlKw9xOM/xQdcmZvRkdFxba/s8m1vVUBhqm0opS8Oc5uQWnB+WF2Wvq6eho5aqtmjgpoml0kkjsNaO8lea9c7SK3Xl9/2b0jMaGzu3jVVvsudE323E/lYB8UStaj2TW2qt9VdfviKj05QucyatlO9JO9vAhjRwAzwHUrj1zFKK2YW8yGlDiI3Se05vQlbjtF1fHc4qWw2Iug03bRuQRjh27+sr+8k5x3LROJdw4k9FpEOSgM9OauBSyHBeAwfqOPkqzGwRe29pPkgtoonPxgH3q9ghDemXdFKauBvDLz5cP4K6ob42jeHRRbxHEb2D/BBk7Tp26XaRrKKjleT1xwXoDZRpy76dtczLtUlzZCCyHOdxcatm1i60DQ2FrGtHQMb/ACWwUe2qskc30iOJ3m3H0RY76/lvZK0O/tMe0XTlR+V8c0JPjgFYm17V6OrAFRDgnhmN4PyOCqt71Haqqe017KuNopasF4f6rmtcCCSDx7llXRXygKk6UEHitKuO0jTlKSBXCc90TS75rA1W1mztP4NPUyeYAQVNp9L6VfNLxtGS+tDfm1diihaAPVC4GzXFBftTWCeeCWlhpaoylzhvAjdOOXXIC2nUO2Cjpd5ltja8jh2jzw+H+qDdtW6Vtuo6N0VfC3faPVlHBzfeuC6t2cV1mc+WlmiqaYfqAcPcqV82sXWtLmtqntaekfqj5cfmtNrdVXGpeSJXA9/M/E5PzWp8TUzaOpkcWsgkcRz3WkqEllrX+sIHNP6uH1WLmuVdPntaiZ3m8lWzppD7Tz8URk5LRXM/sHHyIKtpaOpiyX08rR3lhVqJH/tEKpHUTx8WSvafAkIIgA8+ahjcOVXFfI/AnDZfF4yfjzU+IJxkZiz38R/NB1nZDd7TqqnbovWkbZqeXP3fVuOJaZ/7LXdx7uWVrm0/ZrddCXPFQ01Ftkd+BVsHqu8HdzlpQZUUU0U7CW7p3o5YzwyO4jqvZmy/UVu2obO/Qr0yKpqY2ej1sL+ZPR47s8896lV4wZ6rshe99ml1N60LYq9zt58lK1rz+powfovJG1vZ1WaEvjmtD5rTO4mmqCOn7Lv1D5r0B9mG4Gr2dGmJy6kqXN9xwf5pVdgCioKKgIiICIiAiIgIiICIiAiIgEgDJ5LzRsv2g2TT9x1neb3UubNWVhfDExu8+QZccAfzXoHVtaLdpe7VhOOwpJZAfENOF4o0JpGt1ZdJGRMcKOnb2tTNyDW92ehPyGT0QZ3ajtLvWumPYGOpLJHKBHTsPtu6bx/MeuFobb2+jsdRbaEFkta4CqlHtOYDkRj9OeJ78BdUqLXboLLNdTCTR4dR2WmaMOqZDwfPg9O4nkBlcon9HtW8ync2Wq/POOIae5n/ALlYlWQoOyAfWu7MnlEPbPn3e9UpKpsOWU8Yj+vxV5Ym+m3hna5LGh0js9cDKxVQd6Z5xzcSqiR8r3Z3nHipACeQVaGB88jWRtL3uO60NGST3LdaSgt2mAPvGFlxvRAIpScxU5/7wj2nfpHAde5BgbJpK83pu/RUUnYD2ppMRxt83OwFmm6GgiGKu/24SDmyn35yPewY+azrn1txayW6zumx7EI9WKMdwaOChKRGziQxo9wQYJ2kKAD1Lu4n9VI8BWFRpYtP4NfRyfvPMR/zAfVZapu1NHkNcHnwCxNXcmT8AwBUkYurtNfQnMkT2tPJwOWnyI4H3KjHX1bGhhlcWtOQHHICycNbJBnsXFoPMDkfMciradktxqWxwU+9O84a2JnFx8AEKqwXufID4aaY/qgac/AKtNf6gYEVNR05720zQfiQVBtluNtqQa2nfSub0lY4H4AKrUxur3NY4iR/INY1zSfiFBiqqvrKh2ZZnPPQk5x5dyu7Zp+4XQGVsZEDfammcGRt83u4BTVFuq7RURyVNJJC08WCZvB381Ur7rPXuaat8kobwYwnDWjwaOAVMX8VpsFFj065vqpBzZRREt/xuwPgCoyVOn42ltNZ53/qmqOPyCwrpmdI/moCQdW/NF4u5pLfIfVoTGD+zKT9Vay0tJJns3vjPQPGR8QqkPZvkDXODM9Ss390xmly0hxxkEdVEapUUUsIDi3LDycOIPvVthZlr307y3gW8nMdxBVOqpY3M9Jpf6vOHsPExk/w8UGJIV1SguilaBkt9ZKqmMW69v8AVP5H6hT2sgVsbXey/wBQ+9BXhqHUwBGHRv4OY7i0+a27Z9qSq0ffor3ZXOkp2+rV0pOSYzz8x49Oq1BzPUfE7mwkKShqZaOpEkTy17DkEfRCV71lhsO0fRsbnhlXbK6MOafzMP8ABwK1HY1oy4aHut/ttSHSUEhZJTVHR44jHgR3Ll2wvXcVguIgmf2dlrZA2eInhSTHgHj9DuXgV6nBB5clloHLKipW8lMEBERAREQEREBERAREQEREGs7SLfW3bRF2t1rYH1lVF2TATgcSAcnyyuX3u0UWj9LU2jKKct7dnpN6rIx65hzgsb13nnDGjxXbq+rhoaKerqniOCBjpJHHo0DJXm3VupHW6lrtQ1oH3nWSl1JC/juSAYa4juiaeH6ye5BpO0/UL4qh1EGMhqWxiJ0TDltHEPZgb44wXHqeHRcllkdI455K5r6mSpqHvkeXve4uc5xyST1Vq1vV3Bq0yz2jIHT11S1vtejuA8zwWMrKN0Nwkp35aWnDvAK603cTbro2ZvBuN057lnbnDT3K7RPpyM1jQ95/7NjfaPvwgsLbUiz03pcTQK2YFtPn+ybyL/M9PeVYQTFs4keS4728c9Spayb0mskkAwzOGDuaOAHwVSmYQ0yFu8eTW95QbG7UZpqACRjH1L/YjH5R3n+S1uvq6mokJqZCXHjug8B7lSpnkzSTyneLBvceruioFxcSXHiUE7iQ0KTJU7j6oUmFV1Mwne4lX1vrKi2VcVdRSOjngO+xwPIrHtHrBZCKLfjcMdES1n7hV6nrnMrLpJUNhlaJGgDmDyIChSS3J72Mom1Bm5AlmMnzyoM09d5LXQXCvq2Op5I2mGMzjeDOnA8lkI7fWV0TaaARQSHg17p2jJUGG1dX3qqrYaK/hzZqRm6Gubunjxye9YHdWc1RQ3OgvlRT3x0jq1gGTI/eJGBjj5LCvcFVimCCo8FDHEHgodUVN0V5QXCekdhh34+rCrJTMeWvDhjIKC7q3NlPaxnLXfEeat4pnU8oe0Bw5OaeTh1BVzcAymrT2YxFI0O3enEK2maG+OeIUZXL42lrqUnMMw34XHoenwPD3+Cw7N6KTjwc0/ArLwDt7bPH/a0347D+nk4fMH3FYutcHTdo384yfPqguK6TFa5w5Pw74hWjz+Jw6qpOe27Nw4uAAIVJ7XAg4KDJ2W4uoqoPwHsILXxu5SNPNpXrvZDrP740pPbpKpzq2ig34Jn8XSQ/lLh1LfZd5eK8Yg4IIXQNmGqKmyXylmpzvSxu32MJ4SA+3Ef3m5x+oBM1Y9oabu4u1M9zozHNGQ2RvMb3XB7lmAtE0hW08V3YaR+/bbnCJ6V/z3fMcR7lvayqKIiAiIgIiICIiAiIgIig4gAknAHMoNB2rXPdo4LVHI2MzntZnu5NjbxyfDIz47uOq8h7QNSm93SR0O82ji/CpmE8WxjkT4nmT3ldb23ap7SOufE/Elc7sY+8QN/nw+JXnad5e89ysSpS4E56qTPHmjeDhnkp42BxPHiFUGc/FbJp/MNmvNc72mxMpoyeheePyaVrmMOWep5dzRs7OslezP8AdjP/ALkGMafWAHUrYayJlBahIR+JuYb5lYS1M7aviaeI3lf6sqcyRQZ9kbxCDEsw2jd3uf8ARUlMTmmYP1FUsoK+fUCkyVAP9XChkdEFRhy4Ad62Kgpy5jjjk3KwNviMtZEwcyVuEtVQ22ne2eVpkLCNyM5dn+CDUYqwtez0l8k4YN1rN/AAHRX895jniEXowiHRzZCT81giPXOM46ZVR4OAgzVVI+qeZ3Oc7eGPWOSAMcFjHnDsFZegie+YMDch8bSOIHhlY+vhEb3Y5tOCOoKpKoAgoSqO+pt8I0mPBRyN3A5qnvBC4ImsleT69Nnn2LUkp3ijjLhg8m+PVU707+lsZ1ZEwfJZyiDarTeTxdF17iESsXYns+86drhgSkxO8nDBHzWGqWFkjo3c2OLVf0jwy4QubyEoI+Kp3poZd6xvQTO+qgsugHcobx55+KqxMLhnHDv71JIzoOJ8EEg4EhXNHM6KVrmOLXNIcCOhVrJ7ZA78I1xBGOiD03sm1BJdLI6gjditp819CB+00/jRD/zAeK9CWitZcbbT1cRy2Vgd5FeHtml7qLddYTSPxUxPFTTeMjQcs8nt3m+8L1/oivgnibLRuzbrgz0ul/ST7bPMEqVY28IoBRUUREQEREBERAREQFrWv7kaCwyRxn8eqPYsGe/n8vqtlXENseod2a4Sxv8AwqCM08ZHWVwG8fdkDzaUHnbaTd/vHUFR2bt6CD8GI94HN3vOT71pR71e3GUuncQeOeKsSFplDOCp8HJI5hUwMnA4lX0TN5rmkcUFEHIyfes3HA5+jxIwEhteQcDPOIfyKwgZ7Q7llKO7mnsclvDSHGpbUb3Tg0tx80FnbKwUteyRwO4Dg+HipLrUGpuE0jTvMJw0+Col2ST3qcSfhFnDic5QQw4wtHUEqUNPUgKYBzuQJPgpmtefy/FADBzLvgFEbgPBpPmVHs93jI4DyU8b2B49TLe9BL644j1fLgqfUrKUdtuF2EpoKKeobE0veIYy7db3nCmpaBlLuT3RjhEWh7Ic4dJnl5Dr/wBUFnQW6qrX7tJTzTO7o2F2PgspUabuzI9822rOPaxEThZihpbjd6YZkNLQDg2KL1WfAc/MqpLpeaMGS31L+2bxADt0n3hBbaV7CSmnhrYiJGubHnd4sacjPxwsRqCKaCvkiqWETt4OcPzjoVkaK5yGu7K7OImGWduR67fB37Q+ayN90rqKurWyxUU1ax4BjdTtL94EZyMKcMaQWB3JuT4cCqZYO8g+KzlXY7hROeLlbq2mc1pI3oSDnoOKw7pSDuycf3grKWKXZ4/N8QotjO+0FzcZ4qriNwyN4eXEKXDBx7QYQT3NzqitnljGYyeBHd0UYK+eG2y0rODZHZPHioRTCJkgh4ve0tyegPNWwDgcYQXdtjfJUMORhpB5+Kq39ub7W/8Aiu+qpUTjA8vBy4jG6BklXtDRzXOuL3HL3nGd3kep938UGMkeWepnjyPh4Km48QPFVamLsKqWIne3HEZ71Rfhkg3jjHHggpOOXuPTKgoAKYIL+1VL6Wqjlidh8bg9pHQgr1PsRv7J31Fkc8DtG/elt495xLGPI54dxK8nRktcCOi6Toe9T0NHBX0bj6dZJ21jB+1ASGyt+bT8UxY9tQSCWJr28nDKqhYuw18Fxt1PWUbg6mq4xPER3EZIWTCyqKIiAiIgIiICIiDGakubbPZKyvdxMMZLW/tO5NHvOF5T2s1rqW1UVDI/emlDqmV37RyRk+bu0d5OC7vtYr3VFfZ7DA7D5nmrm8GMOG583kfBeVNqd4F11XXPi/4aNwghH6GANH0z71YlaTMcuJ71TxhTvUh8VUT0hb2ha78wwD3FVC50cmc+sDx8QrUZB4K9IE8AePbA4+KC5jhEzHyx8QW8R3FQpKeOWKQuxvNaSPEq2o53wOJZycMFveru31IjkLQMgneCC2EJcxzw1rWt4HJUgj967ps20rprUMEj62l3pQQ4MDt0bpHhzOQV0636L03bi00topQ4fmc3ePzQeTKe11kre0ipKhzW8d4MOFSqYXQyOD/VP7PcvYlfBE2NzIY2NAHANAAXnrbLao6S6w1cEYY2oB3t0YG8EHOAB04qUnCiRwUCM8Ag2vZxqlmk79LcZWPkBpJYWsbw3nObgZ8MrF1lS65XGEg+02KIeGGtasMWuc7DQsjb3xUdwpXzEmOKVr3448iCUHoWz6OkqRDR0sfqtaGgeSy9fs0rKOEz8G7vE4K2DZPqG3X2q9Ioahkm8DlnJzfAjmt61pOYbLIRy657kHkDapZPu+opatrd3tSY3kdSOR+C7VseuNLPojThnqhHVQ1PHDwHOaCQAfDiuPbXdUUd07K10jd+SnlMj5QcjljdHetPaainZQXC2SuMbSCYi88JGEEt59eBCnkseudekU8VRK8b0bQ5xB4jgvI2pr668Vkkno1NCzJ3RHGAceJXSrxtljv+k6yir6J9NcnxFjXRneY4nh5j5rjBPFTxi2q9HTvqqqKCBm9LI4NaBwyVuMuzy8tY0xtppnYzuh3H5gKTZPbhXaqjcW7zYWGTyPIL0BDRDI4LTLzlUaQusJPpNLNTgdTCSPiFPS6cooiHVtVNjqGxEL1zaoWsiG8AeHHIUbw23QUM09TS05bGwuJdGOgSrjx3Pa4mV4bbpZRFu7xMw3N0d58FtGmfRYbNcZ4mZggcGmUjjK/nw8FjNcVz5ax1PExrZal4lcxo9lp9hnDwOfMrc2WSKzaMp46oB263tJGnq9x/5CyY5BUMLXSVEww57iWtP1WKd67zjOM9Vlr/AFLqqtk3Rxzg45DuaPALGvb2bSOq2iVxGA0cgjcDmpG9VMoKgWwaOuTaC8U0k/GncTFM39pjhuuHwK11qrUzt2QIPYH2eLy5lDc9KVkm9VWibegJPtwOPAjy/iF2RePtJalNlveltWRuPZOJtdxA8MbpPm0g/wBxevoZGyxMkjcHMcA5pHUFZaVEUAooCIiAiIgIUWp7Ur87T2jK6qhP9LlAp6cd8j+A+uUHJtS3z0iv1VqYu/DhaaWkPTcZljT75HPP9xeZrjMZalzicnmSu2bTpBZNndttTHfi1cgkeepYzgPi4vd/eXCpCXPJKsSqZPEqV3NRdzUpVRKVWgkMeHDoeKpYypm+w4eRQX09PgMljP4Tzz/Zcjm7rRM0YcHbsjf2Xd/kVcWCeJ0xpKvHYTerk/lPer650UlBUSCdhJYAyZv7cZ9l4/55jxQbdsuv7rXcY3Od+HvAPH6HHifccH4r0hBI2RrXDByM5XkChqvuypYx+HwuGQ4D22H/AEXonZjfTcrWaOofvVVJhhdni9mPVd7wg3GraPVIXJ9slu9J01JOxuX0zw73Z4rq9W7Eec8lx7aVrmgpoqy200Yqah43Hj8rCg4aeLsdVXh3Izl4yR9VS5HPUqAaXEAcygrxOwXTuA4HDR3u/wBFNTW+qrw50DPUHNx4BUZHBzmtzuxsGM/Uq9kvkrKcQUEYhhYMZ5uPigsKC4Vtsqu2oamammaeD4nlp+SzV11xqa50no1dfLhNDjBY+YkFbtcdl1dS6Gkv2aZ0forajG5g7paDwIPPj1XO9O2mrut4p6OkpxUTvJ3YiD62ASRwx0BVLFhRQzVU7WQjekOTxPPqsnbZjFJJR1JLIpiA4n+zePZePI/IlXN/o7jp2sgZU2wW2oaThwDh2g/vEj4LFVdc6rl35WNbJ1LRgFCVe19NiZ7pmbsoyJWt6/qascBxxnI6FZJz3VlE2UOPpFMMO4+0zofMcj4YVhKeb2D1fzAflKmYtdh2C24NFfWuA9YiJvu4ldmhaOHeF5x2e69k089lLVs7Wgc7juj1mZ6jvXoiz1cFfRw1dJK2WCVoc17eIOURsMT92MHwWi7Wr4KKwGma/wBepzvAdI28XH6D3rcXP/CAzjguDbY7qX+muDstkeKKL91vrSEeZwFKsaXovduurvTK4gxxZndvch3LKa71Q6saIqckRE4ib+1+s/w957lrlvZHR0RqpCRCfVLM47d3d+6OGe/ks/YqCKitUmrNQNDt5xbQ07hjtXj82P2QorVLhbxaaOM1Q/ps7d7cPNjTyz4lYFxJ3ieayF3rprjWy1NQ8ukkdklY54w1aZShTBSgYUwQRBwVODxBVPCnCDetC/70oLxYncTVwdvAO6aLJb8QXD3r1H9n3VB1HoCniqH5rra70WYHmQB6p94+hXjzS1xfa7zSVkZw6GQO93cu2bLbzHpDbHPQh+7ab21r4u7DxvRn3ElqlWPUaioKIUUREQEREArim1qufe9oNk0/AS6K3sNbOB1kdhsYPln5rs9RK2GF8shwxjS5x7gF500tcfTLtqbV9T7D5JJ2E9I48sjA83E//wA0HN9uV2ZV6nfSwuBhomtpmY/SOPzJXL5fWc4jkOCyF+rH11xlnkJLnuLyT3k5/irKR47ERM5A5J7ytMrclSqdykQFMzm791U3KaH+sA78j5IJ2HDsjmumWKP/AGs0w+ONoderawlrTznh6t8f+i55aqY1dbHCObis5ZbnVaW1LDV0xxJA/i3o5vUFBZvh3mOpM5LMyQE8yOrf9O9b3sovZornRukOBn0SXJ6Hiw/HIVLajZKdwotVWDjZ7oO0w3+wm/Ow9xyCtXtNS2GtdUZDGzsO9j8sjfWHxx80HfdqmqY7DpyRkDx6ZUgsiGeIzzcvM0sjpJHPe4uc45JPMrZNoN4N31DLI2V0kEYDI89BjitY3cgnoEEh4hTNJaM9cJEwOcSfZAyVWp3wsqGvqMmMcS0c3eCDI2jTtXdHx4buRv8AZyMk+OO5UrzQQ0NyqKZsv9Sd3Dhk5wO5dw2MWWLUen665cYnid1Nk8d1ga04b554nwXJ9b0jmasvUbcOaypkGQegJCD0bqproth87GnlaYW/5WLg2xtrhtLseXuI7V54nP5HL0Frdm5sdrGtwSLbEPP1Wrz7slfIzaTYQ5jQHVBGWjva4JpI3v7ULBIbBI5wGBKMkc/ZXG7TZRcoJuxe4uiLeIGRggnOOfRdz+03TOkt1iexrnESyNOBnoFz7ZZZqy5S3WKga11VCIpS3eGcAuB+o4INIlp6mz1rGy4cMZaR7L2nmFRrIxTzNfHxglbvM8W93mDkLYtcz+i3mrttXA6J8Tg5pPONxGSMdywlDishdRPI3nHehd3P7vf9cKrFjNF2bmuYd6Jwy0/wXQtkmt/9nbgKK4PP3ZUO9YnlE79ry71odOwCR1NPlgccZP5XKMNDUvrfRWRuM+cYH18lEew7zXNorTUVoIc2KIyAg5DuHBeeNd0clReqOgll/CpKft6uQcdxzzvO9+SAPHC2CwarlGyqrpap2/WUEzYWscfWc3OWt+PBajWxXC+XSC00jTPcq+YPnDeO8/oP3WjPzKlqyLzR1hj1Vdaisrz6Jpm0x9pPJ0awcmDvc7+KwevNSO1FdzJEwQUEDRFS07fZjjHIY7+pW1bTbpTWS0UuiLFK11LRuEtfMw/8RUdcnqG8lzA9VCqTuZVKbg0eJVU81TqOUfkT81pFFqmCgAohUTDgFOwjfaXDhniqanCguXDsqjDeLTxBW9V00ldom0XincRXWao9Ee4c+zJ34nHyO8Fz8P3mtB5tW+7NHNr5bhYpSNy6UzomZ6St9Zh+Ix70I9j7PtQR6n0ba7tGQTPCO0A/K8cHD4grYl51+ypqF0TrtpircQ9jzUQsd0PJ4+hXopZaRRAiAiIeSDRNtd7Nk2f15hP9KrMUcAHMvfw+mSuLaz3dM7I2UbDuy10racY6sjHH4u3z71t22G4m8bQrTZosvp7TE6unaORkOAwfEtH95c2+0VWiC42myRuyLfTDtPF7uf0+asiVxeV29K5x71Brd7eUFFp3TlVFMjCgVckteOSpvi6tPxQW7uYVxQ00lRKOzx6veVScx3cqkTXloczeyDxI6IMtYWSU11hlLctY71h1Cv8AVjWyXEzQtO4WjJx1WEhrpmFvaBsm7y3ufx5rY6K8ARPZBVFgkbh0dXHvNHk8Z+YQbRsiu1JWNq9HX14Fsu3CF7uUNRj1XDuzy+C06+WCus2oamx1bN2pZN2Y44B48HDwKtJIJI5hJHugggh0Tw4A94XXLhTf/E/QjbnA3/5qsrAypwMGpjHJ/nw+PmpxelJszt9TZ47mWztnJcXQPdkc8Y8e9afqjSplDRYomuha8tODjfI5uz3ZBAWYt+u66DQ9Rag13bvf2bZXHHYB3tH38x3HKtNQ6npaOyPorad6fdELZBwA7yPd9VUc7qoxC/0ZhDnMOHlvHLvDv7lCpt9RSthkqYXxiZu9Hnq3OM/JbZsv0jNqnUDGvzHQU5D6mbw/ZHif9VsG3mKlg1ZRwUrWQwxUTGsYOAwHO6qjqP2a4Ws2dzloPr10p49fVYFwXXjGv1tfXD2jWy4PX2yu7bBaptLs9ijzkuqZXZHLmB/BcE1fLK7Vd4d2nA1cvA/vlTcWPUOvRu7Jq9uDwt7OXgGrz3stAdtH06Bvg+lDO8OmDywu+atqRPszr2YPG35/ygrguzSYM2hWJ5LSRPybx/KVL0jqH2nIA7TdnfxwKpw597f9FrX2aWOF/vW8XEGkZje/fWzfaLnfPo+gMZLSysHED9Dlqn2cppBfb3JJ6zjTMBIH60/TGtfaDpmQ7TKx3EdpBE/AH6cc/cufx0tRFBHUdm5sD8lknTgcH4FdS+0DCZdeiU8A+kjPI8cZCzegNH0+qdljA1m5WR1E0bXO6jOeX95XUrl1PbpNQPiqKQAzhwbVDIGO6T39fHzW9Q22jpqiR73sjlDA2MuON5ueLfceXgVojRXaO1Q+GrheyWB25LEeG+w/zHIrMapnF3uVJFbnOe12HMOMk73glrTJ6iqrbb7fJTRAemySiofutyCcYxnp3qpbriNEWKStA39UXSPERxxpYXdf3iOSxPowoNStl1HSVEMEbTKyOaMs7Z4Hqg55An5LA3G51lzvRqcCWpdJvN3QTnHIAdwwsjG1LZvSH+k73ak5dvc8lSNhe7j6rR3udhZF9Lc7ncxCYJ31k7wwM3d0ucenFLrY6y2PlZW9hFNGcOjdKC74BCrFkEXHMgc7r0A96tq2OENHZuc57eBPT3LMUFLRSUTnysrZqzew2ONoDMd5d/orO5wOpoi2SJkbjybvZPvWmWJCKCigKdSKcDJGEDqOOFlrBXyW+5U1XA4tlhkbI3HeDlYk81VhduyAoOw1leNG7X7XqOk9W13Ps60FvLs5BiQe528vYEUjZY2vYQ5jgHNI6grxvWwt1FsagmDgbhp+cgt/N2Dz9AcL0LsF1IdR7Obe6V+9VUQ9EmyeJ3eDT7xhStOjBRUFEKAqVXOymppZ5SBHGwvcT0AGSqq53t4vb7Ps8rYqckVdwc2jiA5kvPrf5c/FBzbZw52o9W1t8quIrax9U7PSng9ke+RzP8C4jtQuxvOsrnVudnfmdjyHAfRb7HrdukrVW2i3sBrewZRdr0jAy6QjvO84/BccuE/pFXJIM4J4Z5rUSrdCigURDJHIqq128FQTJHJBce9TxSujfmMlrvBWhecYyrmFu8wHnlBfPrB2uJ6eGZh7xun4hXdOy2VDC2OWakeeko32D3jj8liZxjd8lCM4IQZz7jq2kSRNbWU4OXOp3Bxx18R8FsuzuGCe9XB0lTU0sUbC5lOJCHPbvcieGd0cfMBaVBPJG4Oie5rh1BwVm7dqCqilikkLJnxHLDI0Fzffz93JTix6opaPQd703Nb4qWkYRD2jmygNkJxneL+ZPeV5d2kWKl0/q6roaGcz0bSHxPzn1SM/Lktz0zeRV08slvghmrWscDTukwR0wM8xhZbQ9ktetbhO+42KoqamLDZnOqzGGnljATC1ZaQ2oaZ01ZYaClste7d4vfvsBe7qSru47XNKV0glq9JSVMrRuh0zoycd2cLY77pXZNZap9Ld2+iVTOcIq5HO+RVpDYdk72B8dFWSMPJz5ZWNPkXEAqpKwtLtrs9FEIaLSz4YQSQxlQ1oGefANVu/a5piWV0k+iYnyOOXOMjCSf8AAs3XW/ZNScH2ipkd3Rzvd8w5YmpGzRjQ+DS1a+Pll1aW8fLeQXz9vFrdAYXaXkdERuljqhuCO7G7yVhFtk0/DUMnh0XEyZhy17ZWAtPgd1UoW6Dly5mjZ9wdXXJzc+8nCv30OgIYu0fpUO/Sy77x+AchqFVt2t9TH2c+lu1ZnO7JO1wz72qlS7b7ZSOc6j0m2Av9oxztbveeGKD37O2Ny3R83/7K1w/9SnhrNnspLIdHNBH53yveB54cgVG3WiqCDPpRkhAwC+oa4497Eh260cMXZwaakp2Z3sQ1TWjPluK4E2hm07pTpe1cOhqC048i7KxwvWzog9tpmKM/pBcP/Mg1HaJra26xjEzrVVwXFhAjndUMcA3q0gMGR15rYNg9bbbXd2XC7wsdTsa4GQtLjGRxGPetevE9FVzOFoslrZCSdwtY8ux45ctaF1rbXNNHA+NjXcHxsGWlB2bbJr+2ashNPRUTjHG134kow7GOncFyDTFfXWC4PraZlOXujdF/SBkYcMEjiCD4hUBXyzsc4u3d7njqreQE8fqsrrIXe81FyuDq2vrppqnII7IbobjgMHorA134hdDTxh/V8n4jvieHyVu9uG5Kg1mG5VkNVzWTvcDNM8gHOM4HwVhX1bqiRzuaqSn8N58MKwIwFUECgOKmCCIGVUYMcVTbzVbogpnmiHmUQZygutVFBIIZntMjDFIGnAe3lg96699l3UwteqqiyVL92C4szHk8O0by+IyuEwymN2Ry6jvWXtddNQV1LX0MhZU08jZYnjo4HIS/Vj6G54YURyWA0PqSm1Xpqiu1IW4nYO0YDxjePaafIrPZWVTLz39o7UjKS7UMMZD56KNz4GHiBM/h2hH6W8R4kdy9AzSNhifJIQ1jGlziegC8Ia+v8mpNW3O5yPJjlmd2WejBy+QQaxVyFgLiSZHdScnxJWPVSeQyyFx9yprTKBUColSk5QQUEKIJCVf231mEc8FWCvbW7FQWnkQqLurj/DBCtAcFZKoGYnLFOPFQVmuwVN2pY8FUA5HOyEF3T1csFQJqeR8cjTlrmnBC2rS2uLnYtQRXSOQlxIE7G8BM3rvDv8VpjOQVVnJB3jXWl6XX9AdXaQk368NBqaX8xIHMfq8Oq0C23GquEkdHXX58XZer2dVvYZ4LC6P1hcdJ3ptZb5HbhwJYSfVkHiP4rrd8sFl2qWx170w6Okv7BmenyG9ofEdD49UJWqTNt9JIfSLzT1H/AOPTb+feQot1HBSMMdshtJZnIfU0bXyZ8yVqVE+a1189HfjXQSwHd7MMyQR3g8lsts1XHTAtoWUuD1mpWvfnzVaXf33eKqESVNVTCEcsNETfdwH1WbZbLXVUzXV2oLLl3ONrRJID3YI5rGVF1vddC2SaqAj/ACgtMLfdgYV4+C1Naw12paGTe5xCMucD1HrDCzZgt5JrLZJ+1tYpKmbG6TWUu/GfEMzgKzqtTXuohe2Gpo6eDr6NTCFuPcFWbc6C1VpntEdIZcYBfSteDx/Zzj5KnXXjVF3heacTmEDOKel7Jg94SC3t7aWpp3z3y/Q0bgThpgfK547wcYUkNisl9L/us1csUZBmrp2tjY0dzWjmT4qx0vYbnqmumfWPfDboD+NUPOR+6CebvDom0DVNLR0zbDp0CKlhBa9zOp68ep8VdSsPqe8QU85obNhkMTezDwMnGePHqSevuC1R7iSM+alxjcDuLj6xUXcQiJ45Dlu6cDPJZYtwwLDQ8x5rNDi3wUooytyQred5HBqrzSBuccSrBzy5/gkE8n/C5P5nfRWj+DVdznDImdwJ+P8A0VnPw4LQkaoqRToIqo0qmFMFBE80ToiAq9LIWv3SfVd9VQUQg779mfV5tWpXWCrkIpbifwg48GzAcPiOHuC9Ur542utlo6ukrad5bPBI2Vjh0c1wIPyX0EtNV6faqOrA3fSIWS4/eaD/ABUsxpq+2W5yWnZnfqiEkSug7FpHTfIb9CV4crH7sJaPzHHuXufa/apbzs4vtJTt3puwMrG95YQ7HyXhavB3W9OKQWCIVAqshUinUiCCg5RUpOUEFXonbtVGemcKgoxnErCP2gg2A+sCD3LGxRdqx+PaaVkGnIVnQHEkvcgsyC0kO4FDxW9WnQdwvumrheaJoLaY7oZ1fgZOPJaKWljyHDBBwQUE7TyVdnLwVBvgq8jTG0DvQQlAIz1V/pu+1unrnHW22Z0crDxxycO4jqFjuhUuMoO/RXOw7VbextXI22alhbusnb+bwP7Q+YWmVd81VoKqktNxayMZy2UQscJB+01xHFc5pKmaknbNTyOjkachzTghdBbtBN6tEds1LSR1sTBwk5SNPe13Q/IoNgtH3/qqhNZHcpTA0kF0srIxkdMB2fkrsU2mqONrqy+3Wqf+aJlE9oB7t53Bc2kigtgbURxGutxdwmY4skZ+l46H5dxW0T610pFFH6BpmWomxgiprnuBP7oASzWlzValt1trxLpyJ9NUgboldGxznDxGFeaXt+p9e1b6m63SsisMR/EkLtwOP7DAOBP0WGr7lS1tPT3HUFvpaChaC6noqVpbLUnxJ9ln6jx6BUNTbVqusssdps9Oy30rW7p7Lhw/Zb3D5pjOsltQ1pSUFK3TumA2KmgG490Z4DvGepPUrjpJc7Ljk5UXuL3lziSSmOIQXDjvSZHIDAUruuUbxHkpX8kE7OAHxWT9IHo7ePrY4rG8gpomOldgchzKlixUfIXuwOJVMAteAQrpgbHwaPMlSzAb7TjqkRTqv60DuaB8lZzH11eVh/HPkPoFYyn11oSqYHKlUWqCZRCgooJ+idFADCigrU8QcR2g9V3DKlljMchaVM2YiMNA5KaJrpHAvOQEGTsdunuNwoLfSsMlRUyNiY0D8ziAF9A7ZSChttJSMOW08LIh/dAH8F5/+zfs5lhlZqq8w7nAihieOPHnJj6L0UpbrSL2hzSHDIPMd68lbddls+n6+ou9phMlmqHF7gxuTTuPMH9PcV62VOogiqYXwzxskieN1zHDIcO4hQfN+SIsOCqZGF6o2m7AqetMtfpBzYJjlzqKQ+oT+g/l8jwXnO+6cuNhrnUl5pJ6SYdJGYz5HqtRmxgSpSr6SmY1pLXb3DPBWZQUypFUdzVM8FQU0IzK3zUqqUx3Zd49AgyzD6pJVK3gYe49SpDUANdjuV5puiluNbS0VOCZZ5AwDzKD1bsrpoaLZzZo90ZqInTP4cy5x/hhcx2v7Mot+S62Bga92Xy045HvIWwa215T6BdarLS0zaoU9KGPG9gtwOHxOVzbVO1263imfT0tPFSROaWkglzsHx6LODmwBaSCMEcCCp5Hl5GeipEkuLicknPFTb2eaonA9VAMKAPBT8+SCmoA4OQcEKoQRzCpSEAoMlbbpLSPJaQQ4Yexwy1w7iOoWWjuVopWdvTWoelji0yTmSJh7wzH1JC1RjsE8VOXtI4qivcq+ouNS+aplfI9x4ucVYvbgqoXBQeRgIKYCjhTDB6qLQoINypjxx4KKg0cUFWOPfxngPmr5jWsYAOAVmwjHPBU2/hBXkPcqUxy3yUpflSF2QUCpdvODu9oVpL0VYuzGP0lUX8lRKgGUUWoJlEKAGVWjZg8UDsy1uT1UAM8lfUsEtTK2GnifNI44DGNJJ9wXV9C7CNQ34sqLqBaKJxzmVuZCPBn81KSOTUFDPW1EcFNDJNNIcMjjblzj4AL0nsj2FimdBdtZMaXNw+K38wO4yH/ANPxXWNCbOdPaLp2i1UvaVePXq58OlcfPoPALcQFNXErGNYxrWNAa0YAAwAFMFFFFEREBYy+2C13+jdS3mhgrIHfllbnHkeYPksmiDz3rX7OtJO6SfSdc6mcePo1SS5vudz+K4Xq3Z1qTS73fetrmZCP7aMb8Z/vD+K98KWSNkrCyRrXsPAtcMg+5XR82ZIiD5qm6PxC9x6t2MaM1G6SV9t9Aqn5Jmoj2WT3lvsn4LkOpPszXCIufp69xVDekVUzcd/iGQrKzjzxuHPRRYwk8wt4v2yPXFk3jU2GqnjH9pSDtgfc3j8lpc1JUU0/Y1MUsEgPFkrSxw9xQVvR2Cle9zvxC4Bo6Y45/gt42Smmor6bnWyNZFRMLxnq7HBaJNG4yxxZyQMlVJy6Cmc1r3DeOMAqjLa0vZ1DqWtuLj6kr/UB6NHALAOe3PAhW2T3qHvQXHaDwTtB3q2ypMlEX7HtPMqp24byWNDiFHOUNXxqe4qk+YOOcDKtwg9pBXBJ5EKYMeeWFJGSrmJwHcglbC7GSQFUMLcZJJVVrh4KErsBBYvcGuIbyUzZBw4q3fxJUvvQXe/kc0DuGVbt5c1f253B46oqi0uPQ8FMXEniCCsnG3kc8FWbgjkD7lBiA1zhwHJSO3geKy80G+09PELDTdpFKWu5jkgg0OyQQcFRMT+4qXtnLsOyfZjNtAtD66nr6anbTy9jK1wLng4BBx3EH5K6OP8AYvzjdPwV9HSujhGYnFzuXBetLL9nzT8G4+7VtXWubxLIyImn4cV0ixaK03Yg37rs9HC9vKQxh7/8RyVnVx4x0xsu1XqEsdQWidkLv7WcdmwDvyV2LSX2b4mlkuqLo53U09IMZ8C4/wAl6OAwMDgiaY1vS2h9OaWiDLJaqendjjKRvSO83HJWyYUcIophERAREQEREBERAREQEREBabtZuFvs2hrpcrjS01QYoiImzxteDIeDefiVuS8zfa41RvG3abpn8j6ROAeZ5NH1+KDzzSl00s1Q/mc/NW1fJvPa0chxKyMUYjptzr1WFndvSuPitsqagVNlQREFDCiiCXCEYUyIJQohFEIJmFVo3KhlMkILztMKnLNkEA8Vb9UQQRCiAOSu6B+JwO9WmVWo3YqWE8soTrNjPLoqgOMBUwcFTA5UVWVvW0YqWDBw8ciqzSqgKDW3xuieWPBDguufZu1kNM62ZRVkm7b7niB+Twa/8h+PD3rn9zpRUU/aMH4rPmFhY3ujka5ji1zTkEHiCg+lg5KIXP8AYlrAay0JR1UzwbhTNFPVDqXtHte8YPxXQAstGEREBERAREQEREBERAREQEREBERAXmT7QOz++3PW1NXWuilrqWtIGWD+qf4noF6bUEHzxvNFUWysqaSsjdFUwPLHscMEELW3cSvU/wBqfQwdRM1ZbYvxGYjrmtHNv5ZPdyPuXlkrUrNiRFMeKYVRJzTCiiBhQwoq4pKWeqkEdNE+V56NGUFvjKiQt7tezW7VtGZZHxU8p4tifkk+ZHJYG+6VvFjefvCilZH0laN5h94QYFFPgqOCgkAUFOAp44ZJXhsTHPceADRklBSAUOK3Ww7Or7dQHug9FhP55uGfILc4tlVDHRdnPNM+frK3h8Ag4vxVWlYXzsA78rbNV6RgskvZx3FkshP9W5uCB5rE01MyAE53nHqhiq0bwx+Ycj3qUkjgPgouO6QR0UJD62eiiqkblWByrVrgSq7HdCguo+BHjwW5Q7D9UVOmWXyGmDnzyDs6AD8Xszyeeg8ueOK237P2gG6guRvl1i3rZRvxExw4TSj+A+q9StGAAOXcpq40HY3od2idMNgqtw3Cow+oLOQOODfHHeugBQUQooiIgIiICIiAiIgIiICIiAiIgIiICIiC0u1vp7rbamhrYxJTVEZjkaeoIwvn9tH0rUaN1hX2apB3Yn70LyP6yI8Wu/56gr6GFcZ+0rs/OqdMNu9ui3rvbGlw3R60sPNzfHHMe/vViV4zRRx38FDC0yIiICvrPdKu0Vbaihl3JBzyMgjuIViohB3HRe022VBjgvcYo5uXat4xn+IXTavU+l6WigdWXClljqTuMY0iTez4d3mvIIOFNvHhx5Ir2JVbLNH3vEzrTB6/HtKWQx8/3ThY5/2fdJyu/DddIvBswP1avL9r1BdrYc2+51tKf+5mc36FbHBtS1tA3cj1Lcd0ftSb31QehqXYNo+jcHSQVtQR/wBtOcH3DCyzrDpfTZhgipaGifJwjy0Bzj4ErzHJtS1pJnf1JcDnn64/ksDedTXm9Fhutzq6vcOW9rITunwQevK2KONhfugMHUkALmOtNfWuzB8VO9lVVfsRngD4lcartSXie2wwSXSqfSgboj7Q4HgtdcS45PNBlNQ3ysvle+pq38SfVa3k0LHMqJGHg4kdxVNQwiavI6vePr8Mq6a7eaOKxOFe0bssIzyRV21bHobTlVqzUlHaaIEOmdl78cI2D2nHyCwEMT5ZWRxNc+R5DWtaMkk8gF7F2E7PW6NsBrK+MffVc0GYnnEzmIx9T4+SmrG/aes9JYbLSWy3RiOmpmBjR395PieayYUMKKyoiIgIiICIiAiIgIiICIiAiIgIiICIiAiIgKDhkcVFEHlrb9sYmp6qq1JpGmL6aQmSroom5MZ6vYOo6kLzo4YPXyX0wIyuHbX9hdDqZ0900wIqC7uy58Xswznxx7J8VqVMeP0WV1Dp+7aer30d8oKihqGnG7KzAPiDyI8QsUqyAZRRxwygCCCKYAdVVLW7oPeiqIGVEc1ULQDwBUjvBESuUBwKi5QwUFUvzCG/qzhSckwUPFFSoimY3PQkoiVX1op5qupZT00L5ppXBrI2NLnOJ5AAc1m9EaGvusbi2lstE+VuR2kzvVjiHe53IeXPwXrzZPsmtOg4G1DgysvDm+tVOb7HeGDp581LVka3sP2QN06Yr5qWNkl2xvQQHBFNnqe9/wBF29FFZaEREBERAREQEREBERAREQEREBERAREQEREBERAREQEREGPvNmtt7o3Ut2oqesgP5JmBwHlnkuSam+zrpK5ufJa5Ky1SniBE7fZn91y7WiDypcvs232kLjbbharlGOTKgSU7z7xvBYSXY3e7e4mv0fcaho60FwikB8gcFexkV1MeLajRFvpg4VulNZ0h6kUwkA94KxT9M6YjJEr9V0//AIlszj5r3OoOaHDiAfNNMeEptO6Ve3Db/c4T/wB7aJP4FSM0rpVzcnVtQ09xs0/817rdTQO9qGM+bAoeiU3/ANvD/gCaY8Iu0rpgZ3NVVDj4WedUxpaw/lvdzl8I7NL/ABK95CkpxygiH9wKdsMbfZjYPIBX2MeEo9J2hxAbHquqPdFatzPxcVlqPQMtSALfofVdUejqjdhafkvbaBTTHk6y7FtUVu7u6bs1ojP9pXVZneP7rcj6Loml/s/2aje2bUNbJcpOZhijEEOfIcSPMrtqgm0xZWu20Vpo46S20sNLSs4NihYGtHuV6EAUVFEREBERAREQEREBERAREQEREBERAREQEREBERAREQEREBERAREQEREBERAREQEREBERAREQEREBERAREQEREBERAREQEREBERB//9k=
\ No newline at end of file
diff --git a/lib/server-core/src/test/resources/batchWithPost.batch b/lib/server-core/src/test/resources/batchWithPost.batch
deleted file mode 100644
index 227c3d3..0000000
--- a/lib/server-core/src/test/resources/batchWithPost.batch
+++ /dev/null
@@ -1,39 +0,0 @@
---batch_8194-cf13-1f56
-Content-Type: application/http
-Content-Transfer-Encoding: binary
-
-GET Employees('2')/EmployeeName?$format=json HTTP/1.1
-Accept: application/atomsvc+xml;q=0.8, application/json;odata=verbose;q=0.5, */*;q=0.1
-Accept-Language:en-US,en;q=0.7,en-UK;q=0.9
-MaxDataServiceVersion: 2.0
-
-
---batch_8194-cf13-1f56
-Content-Type: multipart/mixed; boundary=changeset_f980-1cb6-94dd
-
---changeset_f980-1cb6-94dd
-Content-Type: application/http
-Content-Transfer-Encoding: binary
-Content-ID: changeRequest1
-
-PUT Employees('2')/EmployeeName HTTP/1.1
-Content-Length: 100000
-Accept: application/atomsvc+xml;q=0.8, application/json;odata=verbose;q=0.5, */*;q=0.1
-DataServiceVersion: 1.0
-Content-Type: application/json;odata=verbose
-MaxDataServiceVersion: 2.0
-
-{"EmployeeName":"Frederic Fall MODIFIED"}
-
---changeset_f980-1cb6-94dd--
-
---batch_8194-cf13-1f56
-Content-Type: application/http
-Content-Transfer-Encoding: binary
-
-GET Employees('2')/EmployeeName?$format=json HTTP/1.1
-Accept: application/atomsvc+xml;q=0.8, application/json;odata=verbose;q=0.5, */*;q=0.1
-MaxDataServiceVersion: 2.0
-
-
---batch_8194-cf13-1f56--
diff --git a/lib/server-core/src/test/resources/simplelogger.properties b/lib/server-core/src/test/resources/simplelogger.properties
deleted file mode 100644
index 2a3350c..0000000
--- a/lib/server-core/src/test/resources/simplelogger.properties
+++ /dev/null
@@ -1,20 +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.
-#
-org.slf4j.simpleLogger.defaultLogLevel=debug
-org.slf4j.simpleLogger.logFile=System.out
\ No newline at end of file
diff --git a/lib/server-tecsvc/pom.xml b/lib/server-tecsvc/pom.xml
deleted file mode 100644
index 60220e9..0000000
--- a/lib/server-tecsvc/pom.xml
+++ /dev/null
@@ -1,159 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
- 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.
-
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <artifactId>odata-server-tecsvc</artifactId>
- <packaging>war</packaging>
- <name>${project.artifactId}</name>
-
- <parent>
- <groupId>org.apache.olingo</groupId>
- <artifactId>odata-lib</artifactId>
- <version>4.0.0-beta-02</version>
- <relativePath>..</relativePath>
- </parent>
-
- <build>
-
- <resources>
- <resource>
- <directory>src/main/version</directory>
- <filtering>true</filtering>
- <targetPath>../${project.build.finalName}/gen</targetPath>
- </resource>
- <resource>
- <directory>src/main/resources</directory>
- <filtering>true</filtering>
- </resource>
- <resource>
- <directory>target/maven-shared-archive-resources</directory>
- </resource>
- </resources>
-
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-jar-plugin</artifactId>
- <executions>
- <execution>
- <id>make-a-jar</id>
- <phase>compile</phase>
- <goals>
- <goal>jar</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-install-plugin</artifactId>
- <executions>
- <execution>
- <phase>install</phase>
- <goals>
- <goal>install-file</goal>
- </goals>
- <configuration>
- <packaging>jar</packaging>
- <artifactId>${project.artifactId}</artifactId>
- <groupId>${project.groupId}</groupId>
- <version>${project.version}</version>
- <file>
- ${project.build.directory}/${project.artifactId}-${project.version}.jar
- </file>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>com.keyboardsamurais.maven</groupId>
- <artifactId>maven-timestamp-plugin</artifactId>
- <configuration>
- <propertyName>timestamp</propertyName>
- <timestampPattern>dd.MM.yyyy HH:mm</timestampPattern>
- </configuration>
- <executions>
- <execution>
- <goals>
- <goal>create</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-
- <dependencies>
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- <version>2.5</version>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.olingo</groupId>
- <artifactId>odata-server-api</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.olingo</groupId>
- <artifactId>odata-server-core</artifactId>
- <version>${project.version}</version>
- <scope>runtime</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.olingo</groupId>
- <artifactId>odata-commons-api</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.olingo</groupId>
- <artifactId>odata-commons-core</artifactId>
- <version>${project.version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-simple</artifactId>
- <scope>runtime</scope>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- </dependency>
- <dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-all</artifactId>
- </dependency>
- <dependency>
- <groupId>commons-io</groupId>
- <artifactId>commons-io</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
-</project>
diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/TechnicalServlet.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/TechnicalServlet.java
deleted file mode 100644
index 7fa981b..0000000
--- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/TechnicalServlet.java
+++ /dev/null
@@ -1,78 +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.tecsvc;
-
-import java.io.IOException;
-import java.net.URI;
-import java.util.Arrays;
-import java.util.List;
-
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.HttpSession;
-
-import org.apache.olingo.server.api.OData;
-import org.apache.olingo.server.api.ODataHttpHandler;
-import org.apache.olingo.server.api.ServiceMetadata;
-import org.apache.olingo.server.api.edmx.EdmxReference;
-import org.apache.olingo.server.api.edmx.EdmxReferenceInclude;
-import org.apache.olingo.server.tecsvc.data.DataProvider;
-import org.apache.olingo.server.tecsvc.processor.TechnicalBatchProcessor;
-import org.apache.olingo.server.tecsvc.processor.TechnicalEntityProcessor;
-import org.apache.olingo.server.tecsvc.processor.TechnicalPrimitiveComplexProcessor;
-import org.apache.olingo.server.tecsvc.provider.EdmTechProvider;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class TechnicalServlet extends HttpServlet {
-
- private static final long serialVersionUID = 1L;
- private static final Logger LOG = LoggerFactory.getLogger(TechnicalServlet.class);
-
- @Override
- protected void service(final HttpServletRequest req, final HttpServletResponse resp)
- throws ServletException, IOException {
- try {
- OData odata = OData.newInstance();
- EdmxReference reference = new EdmxReference(URI.create("../v4.0/cs02/vocabularies/Org.OData.Core.V1.xml"));
- reference.addInclude(new EdmxReferenceInclude("Org.OData.Core.V1", "Core"));
- final List<EdmxReference> references = Arrays.asList(reference);
- final ServiceMetadata serviceMetadata = odata.createServiceMetadata(new EdmTechProvider(references), references);
-
- HttpSession session = req.getSession(true);
- DataProvider dataProvider = (DataProvider) session.getAttribute(DataProvider.class.getName());
- if (dataProvider == null) {
- dataProvider = new DataProvider();
- session.setAttribute(DataProvider.class.getName(), dataProvider);
- LOG.info("Created new data provider.");
- }
-
- ODataHttpHandler handler = odata.createHandler(serviceMetadata);
- handler.register(new TechnicalEntityProcessor(dataProvider));
- handler.register(new TechnicalPrimitiveComplexProcessor(dataProvider));
- handler.register(new TechnicalBatchProcessor(dataProvider));
- handler.process(req, resp);
- } catch (RuntimeException e) {
- LOG.error("Server Error", e);
- throw new ServletException(e);
- }
- }
-}
diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/DataProvider.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/DataProvider.java
deleted file mode 100644
index 07b748d..0000000
--- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/data/DataProvider.java
+++ /dev/null
@@ -1,610 +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.tecsvc.data;
-
-import java.nio.charset.Charset;
-import java.sql.Timestamp;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Calendar;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-import java.util.TimeZone;
-import java.util.UUID;
-
-import org.apache.olingo.commons.api.data.Entity;
-import org.apache.olingo.commons.api.data.EntitySet;
-import org.apache.olingo.commons.api.data.Link;
-import org.apache.olingo.commons.api.data.LinkedComplexValue;
-import org.apache.olingo.commons.api.data.Property;
-import org.apache.olingo.commons.api.data.ValueType;
-import org.apache.olingo.commons.api.edm.EdmEntitySet;
-import org.apache.olingo.commons.api.edm.EdmEntityType;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
-import org.apache.olingo.commons.api.edm.EdmProperty;
-import org.apache.olingo.commons.api.http.HttpStatusCode;
-import org.apache.olingo.commons.core.data.EntityImpl;
-import org.apache.olingo.commons.core.data.EntitySetImpl;
-import org.apache.olingo.commons.core.data.LinkImpl;
-import org.apache.olingo.commons.core.data.LinkedComplexValueImpl;
-import org.apache.olingo.commons.core.data.PropertyImpl;
-import org.apache.olingo.server.api.ODataApplicationException;
-import org.apache.olingo.server.api.uri.UriParameter;
-
-public class DataProvider {
-
- private static final UUID GUID = UUID.fromString("01234567-89ab-cdef-0123-456789abcdef");
- private static final String MEDIA_PROPERTY_NAME = "$value";
-
- private Map<String, EntitySet> data;
-
- public DataProvider() {
- data = new HashMap<String, EntitySet>();
- data.put("ESTwoPrim", createESTwoPrim());
- data.put("ESAllPrim", createESAllPrim());
- data.put("ESCompAllPrim", createESCompAllPrim());
- data.put("ESCollAllPrim", createESCollAllPrim());
- data.put("ESMixPrimCollComp", createESMixPrimCollComp());
- data.put("ESAllKey", createESAllKey());
- data.put("ESCompComp", createESCompComp());
- data.put("ESMedia", createESMedia());
-
- linkESTwoPrim();
- linkESAllPrim();
- }
-
- public EntitySet readAll(final EdmEntitySet edmEntitySet) throws DataProviderException {
- return data.get(edmEntitySet.getName());
- }
-
- public Entity read(final EdmEntitySet edmEntitySet, final List<UriParameter> keys) throws DataProviderException {
- final EdmEntityType entityType = edmEntitySet.getEntityType();
- final EntitySet entitySet = data.get(edmEntitySet.getName());
- if (entitySet == null) {
- return null;
- } else {
- try {
- for (final Entity entity : entitySet.getEntities()) {
- boolean found = true;
- for (final UriParameter key : keys) {
- final EdmProperty property = (EdmProperty) entityType.getProperty(key.getName());
- final EdmPrimitiveType type = (EdmPrimitiveType) property.getType();
- final Object value = entity.getProperty(key.getName()).getValue();
- final Object keyValue = type.valueOfString(type.fromUriLiteral(key.getText()),
- property.isNullable(), property.getMaxLength(), property.getPrecision(), property.getScale(),
- property.isUnicode(),
- Calendar.class.isAssignableFrom(value.getClass()) ? Calendar.class : value.getClass());
- if (!value.equals(keyValue)) {
- found = false;
- break;
- }
- }
- if (found) {
- return entity;
- }
- }
- return null;
- } catch (final EdmPrimitiveTypeException e) {
- throw new DataProviderException("Wrong key!", e);
- }
- }
- }
-
- public void delete(final EdmEntitySet edmEntitySet, final Entity entity) throws DataProviderException {
- deleteLinksTo(entity);
- data.get(edmEntitySet.getName()).getEntities().remove(entity);
- }
-
- public void deleteLinksTo(final Entity to) throws DataProviderException {
- for (final String entitySet : data.keySet()) {
- for (final Entity entity : data.get(entitySet).getEntities()) {
- for (Iterator<Link> linkIterator = entity.getNavigationLinks().iterator(); linkIterator.hasNext();) {
- final Link link = linkIterator.next();
- if (to.equals(link.getInlineEntity())) {
- linkIterator.remove();
- } else if (link.getInlineEntitySet() != null) {
- for (Iterator<Entity> iterator = link.getInlineEntitySet().getEntities().iterator(); iterator.hasNext();) {
- if (to.equals(iterator.next())) {
- iterator.remove();
- }
- }
- if (link.getInlineEntitySet().getEntities().isEmpty()) {
- linkIterator.remove();
- }
- }
- }
- }
- }
- }
-
- public Entity create(final EdmEntitySet edmEntitySet) throws DataProviderException {
- List<Entity> entities = readAll(edmEntitySet).getEntities();
- Entity entity = new EntityImpl();
- final List<String> keyNames = edmEntitySet.getEntityType().getKeyPredicateNames();
- if (keyNames.size() == 1 && keyNames.get(0).equals("PropertyInt16")) {
- entity.addProperty(createPrimitive("PropertyInt16",
- entities.isEmpty() ? 1 :
- (Integer) entities.get(entities.size() - 1).getProperty("PropertyInt16").getValue() + 1));
- } else {
- throw new DataProviderException("Key construction not supported!");
- }
- entities.add(entity);
- return entity;
- }
-
- public byte[] readMedia(final Entity entity) {
- return (byte[]) entity.getProperty(MEDIA_PROPERTY_NAME).asPrimitive();
- }
-
- public void setMedia(Entity entity, byte[] media, String type) {
- entity.getProperties().remove(entity.getProperty(MEDIA_PROPERTY_NAME));
- entity.addProperty(createPrimitive(MEDIA_PROPERTY_NAME, media));
- entity.setMediaContentType(type);
- }
-
- public static class DataProviderException extends ODataApplicationException {
- private static final long serialVersionUID = 5098059649321796156L;
-
- public DataProviderException(final String message, final Throwable throwable) {
- super(message, HttpStatusCode.INTERNAL_SERVER_ERROR.getStatusCode(), Locale.ROOT, throwable);
- }
-
- public DataProviderException(final String message) {
- super(message, HttpStatusCode.INTERNAL_SERVER_ERROR.getStatusCode(), Locale.ROOT);
- }
- }
-
- private EntitySet createESTwoPrim() {
- EntitySet entitySet = new EntitySetImpl();
-
- entitySet.getEntities().add(new EntityImpl()
- .addProperty(createPrimitive("PropertyInt16", 32766))
- .addProperty(createPrimitive("PropertyString", "Test String1")));
-
- entitySet.getEntities().add(new EntityImpl()
- .addProperty(createPrimitive("PropertyInt16", -365))
- .addProperty(createPrimitive("PropertyString", "Test String2")));
-
- entitySet.getEntities().add(new EntityImpl()
- .addProperty(createPrimitive("PropertyInt16", -32766))
- .addProperty(createPrimitive("PropertyString", null)));
-
- entitySet.getEntities().add(new EntityImpl()
- .addProperty(createPrimitive("PropertyInt16", Short.MAX_VALUE))
- .addProperty(createPrimitive("PropertyString", "Test String4")));
-
- return entitySet;
- }
-
- private EntitySet createESAllPrim() {
- EntitySet entitySet = new EntitySetImpl();
-
- entitySet.getEntities().add(new EntityImpl()
- .addProperty(createPrimitive("PropertyInt16", Short.MAX_VALUE))
- .addProperty(createPrimitive("PropertyString", "First Resource - positive values"))
- .addProperty(createPrimitive("PropertyBoolean", true))
- .addProperty(createPrimitive("PropertyByte", 255))
- .addProperty(createPrimitive("PropertySByte", Byte.MAX_VALUE))
- .addProperty(createPrimitive("PropertyInt32", Integer.MAX_VALUE))
- .addProperty(createPrimitive("PropertyInt64", Long.MAX_VALUE))
- .addProperty(createPrimitive("PropertySingle", 1.79000000E+20))
- .addProperty(createPrimitive("PropertyDouble", -1.7900000000000000E+19))
- .addProperty(createPrimitive("PropertyDecimal", 34))
- .addProperty(createPrimitive("PropertyBinary",
- new byte[] { 0x01, 0x23, 0x45, 0x67, (byte) 0x89, (byte) 0xAB, (byte) 0xCD, (byte) 0xEF }))
- .addProperty(createPrimitive("PropertyDate", getDateTime(2012, 12, 3, 0, 0, 0)))
- .addProperty(createPrimitive("PropertyDateTimeOffset", getDateTime(2012, 12, 3, 7, 16, 23)))
- .addProperty(createPrimitive("PropertyDuration", 6))
- .addProperty(createPrimitive("PropertyGuid", GUID))
- .addProperty(createPrimitive("PropertyTimeOfDay", getTime(3, 26, 5))));
-
- entitySet.getEntities().add(new EntityImpl()
- .addProperty(createPrimitive("PropertyInt16", Short.MIN_VALUE))
- .addProperty(createPrimitive("PropertyString", "Second Resource - negative values"))
- .addProperty(createPrimitive("PropertyBoolean", false))
- .addProperty(createPrimitive("PropertyByte", 0))
- .addProperty(createPrimitive("PropertySByte", Byte.MIN_VALUE))
- .addProperty(createPrimitive("PropertyInt32", Integer.MIN_VALUE))
- .addProperty(createPrimitive("PropertyInt64", Long.MIN_VALUE))
- .addProperty(createPrimitive("PropertySingle", -1.79000000E+08))
- .addProperty(createPrimitive("PropertyDouble", -1.7900000000000000E+05))
- .addProperty(createPrimitive("PropertyDecimal", -34))
- .addProperty(createPrimitive("PropertyBinary",
- new byte[] { 0x01, 0x23, 0x45, 0x67, (byte) 0x89, (byte) 0xAB, (byte) 0xCD, (byte) 0xEF }))
- .addProperty(createPrimitive("PropertyDate", getDateTime(2015, 11, 5, 0, 0, 0)))
- .addProperty(createPrimitive("PropertyDateTimeOffset", getDateTime(2005, 12, 3, 7, 17, 8)))
- .addProperty(createPrimitive("PropertyDuration", 9))
- .addProperty(createPrimitive("PropertyGuid", UUID.fromString("76543201-23ab-cdef-0123-456789dddfff")))
- .addProperty(createPrimitive("PropertyTimeOfDay", getTime(23, 49, 14))));
-
- entitySet.getEntities().add(new EntityImpl()
- .addProperty(createPrimitive("PropertyInt16", 0))
- .addProperty(createPrimitive("PropertyString", ""))
- .addProperty(createPrimitive("PropertyBoolean", false))
- .addProperty(createPrimitive("PropertyByte", 0))
- .addProperty(createPrimitive("PropertySByte", 0))
- .addProperty(createPrimitive("PropertyInt32", 0))
- .addProperty(createPrimitive("PropertyInt64", 0))
- .addProperty(createPrimitive("PropertySingle", 0))
- .addProperty(createPrimitive("PropertyDouble", 0))
- .addProperty(createPrimitive("PropertyDecimal", 0))
- .addProperty(createPrimitive("PropertyBinary", new byte[] {}))
- .addProperty(createPrimitive("PropertyDate", getDateTime(1970, 1, 1, 0, 0, 0)))
- .addProperty(createPrimitive("PropertyDateTimeOffset", getDateTime(2005, 12, 3, 0, 0, 0)))
- .addProperty(createPrimitive("PropertyDuration", 0))
- .addProperty(createPrimitive("PropertyGuid", UUID.fromString("76543201-23ab-cdef-0123-456789cccddd")))
- .addProperty(createPrimitive("PropertyTimeOfDay", getTime(0, 1, 1))));
-
- return entitySet;
- }
-
- private EntitySet createESCompAllPrim() {
- EntitySet entitySet = new EntitySetImpl();
-
- Entity entity = new EntityImpl();
- entity.addProperty(createPrimitive("PropertyInt16", Short.MAX_VALUE));
- LinkedComplexValue complexValue = new LinkedComplexValueImpl();
- complexValue.getValue().add(createPrimitive("PropertyString", "First Resource - first"));
- complexValue.getValue().add(createPrimitive("PropertyBinary",
- new byte[] { 0x01, 0x23, 0x45, 0x67, (byte) 0x89, (byte) 0xAB, (byte) 0xCD, (byte) 0xEF }));
- complexValue.getValue().add(createPrimitive("PropertyBoolean", true));
- complexValue.getValue().add(createPrimitive("PropertyByte", 255));
- complexValue.getValue().add(createPrimitive("PropertyDate", getDateTime(2012, 10, 3, 0, 0, 0)));
- complexValue.getValue().add(createPrimitive("PropertyDateTimeOffset",
- getTimestamp(2012, 10, 3, 7, 16, 23, 123456700)));
- complexValue.getValue().add(createPrimitive("PropertyDecimal", 34.27));
- complexValue.getValue().add(createPrimitive("PropertySingle", 1.79000000E+20));
- complexValue.getValue().add(createPrimitive("PropertyDouble", -1.7900000000000000E+19));
- complexValue.getValue().add(createPrimitive("PropertyDuration", 6));
- complexValue.getValue().add(createPrimitive("PropertyGuid", GUID));
- complexValue.getValue().add(createPrimitive("PropertyInt16", Short.MAX_VALUE));
- complexValue.getValue().add(createPrimitive("PropertyInt32", Integer.MAX_VALUE));
- complexValue.getValue().add(createPrimitive("PropertyInt64", Long.MAX_VALUE));
- complexValue.getValue().add(createPrimitive("PropertySByte", Byte.MAX_VALUE));
- complexValue.getValue().add(createPrimitive("PropertyTimeOfDay", getTime(1, 0, 1)));
- entity.addProperty(new PropertyImpl(null, "PropertyComp", ValueType.LINKED_COMPLEX, complexValue));
- entitySet.getEntities().add(entity);
-
- entity = new EntityImpl();
- entity.addProperty(createPrimitive("PropertyInt16", 7));
- complexValue = new LinkedComplexValueImpl();
- complexValue.getValue().add(createPrimitive("PropertyString", "Second Resource - second"));
- complexValue.getValue().add(createPrimitive("PropertyBinary",
- new byte[] { 0x01, 0x23, 0x45, 0x67, (byte) 0x89, (byte) 0xAB, (byte) 0xCD, (byte) 0xEF }));
- complexValue.getValue().add(createPrimitive("PropertyBoolean", true));
- complexValue.getValue().add(createPrimitive("PropertyByte", 255));
- complexValue.getValue().add(createPrimitive("PropertyDate", getDateTime(2013, 11, 4, 0, 0, 0)));
- complexValue.getValue().add(createPrimitive("PropertyDateTimeOffset",
- getDateTime(2013, 11, 4, 7, 16, 23)));
- complexValue.getValue().add(createPrimitive("PropertyDecimal", 34.27));
- complexValue.getValue().add(createPrimitive("PropertySingle", 1.79000000E+20));
- complexValue.getValue().add(createPrimitive("PropertyDouble", -1.7900000000000000E+02));
- complexValue.getValue().add(createPrimitive("PropertyDuration", 6));
- complexValue.getValue().add(createPrimitive("PropertyGuid", GUID));
- complexValue.getValue().add(createPrimitive("PropertyInt16", 25));
- complexValue.getValue().add(createPrimitive("PropertyInt32", Integer.MAX_VALUE));
- complexValue.getValue().add(createPrimitive("PropertyInt64", Long.MAX_VALUE));
- complexValue.getValue().add(createPrimitive("PropertySByte", Byte.MAX_VALUE));
- complexValue.getValue().add(createPrimitive("PropertyTimeOfDay", getTimestamp(1, 1, 1, 7, 45, 12, 765432100)));
- entity.addProperty(new PropertyImpl(null, "PropertyComp", ValueType.LINKED_COMPLEX, complexValue));
- entitySet.getEntities().add(entity);
-
- entity = new EntityImpl();
- entity.addProperty(createPrimitive("PropertyInt16", 0));
- complexValue = new LinkedComplexValueImpl();
- complexValue.getValue().add(createPrimitive("PropertyString", "Third Resource - third"));
- complexValue.getValue().add(createPrimitive("PropertyBinary",
- new byte[] { 0x01, 0x23, 0x45, 0x67, (byte) 0x89, (byte) 0xAB, (byte) 0xCD, (byte) 0xEF }));
- complexValue.getValue().add(createPrimitive("PropertyBoolean", true));
- complexValue.getValue().add(createPrimitive("PropertyByte", 255));
- complexValue.getValue().add(createPrimitive("PropertyDate", getDateTime(2014, 12, 5, 0, 0, 0)));
- complexValue.getValue().add(createPrimitive("PropertyDateTimeOffset",
- getTimestamp(2014, 12, 5, 8, 17, 45, 123456700)));
- complexValue.getValue().add(createPrimitive("PropertyDecimal", 17.98));
- complexValue.getValue().add(createPrimitive("PropertySingle", 1.79000000E+20));
- complexValue.getValue().add(createPrimitive("PropertyDouble", -1.7900000000000000E+02));
- complexValue.getValue().add(createPrimitive("PropertyDuration", 6));
- complexValue.getValue().add(createPrimitive("PropertyGuid", GUID));
- complexValue.getValue().add(createPrimitive("PropertyInt16", -25));
- complexValue.getValue().add(createPrimitive("PropertyInt32", Integer.MAX_VALUE));
- complexValue.getValue().add(createPrimitive("PropertyInt64", Long.MAX_VALUE));
- complexValue.getValue().add(createPrimitive("PropertySByte", Byte.MAX_VALUE));
- complexValue.getValue().add(createPrimitive("PropertyTimeOfDay", getTime(13, 27, 45)));
- entity.addProperty(new PropertyImpl(null, "PropertyComp", ValueType.LINKED_COMPLEX, complexValue));
- entitySet.getEntities().add(entity);
-
- return entitySet;
- }
-
- private EntitySet createESCollAllPrim() {
- EntitySet entitySet = new EntitySetImpl();
-
- entitySet.getEntities().add(new EntityImpl()
- .addProperty(createPrimitive("PropertyInt16", 1))
- .addProperty(createCollection("CollPropertyString",
- "Employee1@company.example", "Employee2@company.example", "Employee3@company.example"))
- .addProperty(createCollection("CollPropertyBoolean", true, false, true))
- .addProperty(createCollection("CollPropertyByte", 50, 200, 249))
- .addProperty(createCollection("CollPropertySByte", -120, 120, 126))
- .addProperty(createCollection("CollPropertyInt16", 1000, 2000, 30112))
- .addProperty(createCollection("CollPropertyInt32", 23232323, 11223355, 10000001))
- .addProperty(createCollection("CollPropertyInt64", 929292929292L, 333333333333L, 444444444444L))
- .addProperty(createCollection("CollPropertySingle", 1.79000000E+03, 2.66000000E+04, 3.21000000E+03))
- .addProperty(createCollection("CollPropertyDouble",
- -1.7900000000000000E+04, -2.7800000000000000E+07, 3.2100000000000000E+03))
- .addProperty(createCollection("CollPropertyDecimal", 12, -2, 1234))
- .addProperty(createCollection("CollPropertyBinary",
- new byte[] { (byte) 0xAB, (byte) 0xCD, (byte) 0xEF },
- new byte[] { 0x01, 0x23, 0x45 },
- new byte[] { 0x54, 0x67, (byte) 0x89 }))
- .addProperty(createCollection("CollPropertyDate",
- getDateTime(1958, 12, 3, 0, 0, 0),
- getDateTime(1999, 8, 5, 0, 0, 0),
- getDateTime(2013, 6, 25, 0, 0, 0)))
- .addProperty(createCollection("CollPropertyDateTimeOffset",
- getDateTime(2015, 8, 12, 3, 8, 34),
- getDateTime(1970, 3, 28, 12, 11, 10),
- getDateTime(1948, 2, 17, 9, 9, 9)))
- .addProperty(createCollection("CollPropertyDuration", 13, 19680, 3600))
- .addProperty(createCollection("CollPropertyGuid",
- UUID.fromString("ffffff67-89ab-cdef-0123-456789aaaaaa"),
- UUID.fromString("eeeeee67-89ab-cdef-0123-456789bbbbbb"),
- UUID.fromString("cccccc67-89ab-cdef-0123-456789cccccc")))
- .addProperty(createCollection("CollPropertyTimeOfDay",
- getTime(4, 14, 13), getTime(23, 59, 59), getTime(1, 12, 33))));
-
- Entity entity = new EntityImpl();
- entity.getProperties().addAll(entitySet.getEntities().get(0).getProperties());
- entity.getProperties().set(0, createPrimitive("PropertyInt16", 2));
- entitySet.getEntities().add(entity);
-
- entity = new EntityImpl();
- entity.getProperties().addAll(entitySet.getEntities().get(0).getProperties());
- entity.getProperties().set(0, createPrimitive("PropertyInt16", 3));
- entitySet.getEntities().add(entity);
-
- return entitySet;
- }
-
- private EntitySet createESMixPrimCollComp() {
- EntitySet entitySet = new EntitySetImpl();
-
- Entity entity = new EntityImpl();
- entity.addProperty(createPrimitive("PropertyInt16", Short.MAX_VALUE));
- entity.addProperty(createCollection("CollPropertyString",
- "Employee1@company.example", "Employee2@company.example", "Employee3@company.example"));
- LinkedComplexValue complexValue = new LinkedComplexValueImpl();
- complexValue.getValue().add(createPrimitive("PropertyInt16", 111));
- complexValue.getValue().add(createPrimitive("PropertyString", "TEST A"));
- entity.addProperty(new PropertyImpl(null, "PropertyComp", ValueType.LINKED_COMPLEX, complexValue));
- List<LinkedComplexValue> complexCollection = new ArrayList<LinkedComplexValue>();
- complexValue = new LinkedComplexValueImpl();
- complexValue.getValue().add(createPrimitive("PropertyInt16", 123));
- complexValue.getValue().add(createPrimitive("PropertyString", "TEST 1"));
- complexCollection.add(complexValue);
- complexValue = new LinkedComplexValueImpl();
- complexValue.getValue().add(createPrimitive("PropertyInt16", 456));
- complexValue.getValue().add(createPrimitive("PropertyString", "TEST 2"));
- complexCollection.add(complexValue);
- complexValue = new LinkedComplexValueImpl();
- complexValue.getValue().add(createPrimitive("PropertyInt16", 789));
- complexValue.getValue().add(createPrimitive("PropertyString", "TEST 3"));
- complexCollection.add(complexValue);
- entity.addProperty(new PropertyImpl(null, "CollPropertyComp", ValueType.COLLECTION_LINKED_COMPLEX,
- complexCollection));
- entitySet.getEntities().add(entity);
-
- entity = new EntityImpl();
- entity.addProperty(createPrimitive("PropertyInt16", 7));
- entity.addProperty(createCollection("CollPropertyString",
- "Employee1@company.example", "Employee2@company.example", "Employee3@company.example"));
- complexValue = new LinkedComplexValueImpl();
- complexValue.getValue().add(createPrimitive("PropertyInt16", 222));
- complexValue.getValue().add(createPrimitive("PropertyString", "TEST B"));
- entity.addProperty(new PropertyImpl(null, "PropertyComp", ValueType.LINKED_COMPLEX, complexValue));
- entity.addProperty(new PropertyImpl(null, "CollPropertyComp", ValueType.COLLECTION_LINKED_COMPLEX,
- complexCollection));
- entitySet.getEntities().add(entity);
-
- entity = new EntityImpl();
- entity.addProperty(createPrimitive("PropertyInt16", 0));
- entity.addProperty(createCollection("CollPropertyString",
- "Employee1@company.example", "Employee2@company.example", "Employee3@company.example"));
- complexValue = new LinkedComplexValueImpl();
- complexValue.getValue().add(createPrimitive("PropertyInt16", 333));
- complexValue.getValue().add(createPrimitive("PropertyString", "TEST C"));
- entity.addProperty(new PropertyImpl(null, "PropertyComp", ValueType.LINKED_COMPLEX, complexValue));
- entity.addProperty(new PropertyImpl(null, "CollPropertyComp", ValueType.COLLECTION_LINKED_COMPLEX,
- complexCollection));
- entitySet.getEntities().add(entity);
-
- return entitySet;
- }
-
- private EntitySet createESAllKey() {
- EntitySet entitySet = new EntitySetImpl();
-
- entitySet.getEntities().add(new EntityImpl()
- .addProperty(createPrimitive("PropertyString", "First"))
- .addProperty(createPrimitive("PropertyBoolean", true))
- .addProperty(createPrimitive("PropertyByte", 255))
- .addProperty(createPrimitive("PropertySByte", Byte.MAX_VALUE))
- .addProperty(createPrimitive("PropertyInt16", Short.MAX_VALUE))
- .addProperty(createPrimitive("PropertyInt32", Integer.MAX_VALUE))
- .addProperty(createPrimitive("PropertyInt64", Long.MAX_VALUE))
- .addProperty(createPrimitive("PropertyDecimal", 34))
- .addProperty(createPrimitive("PropertyDate", getDateTime(2012, 12, 3, 0, 0, 0)))
- .addProperty(createPrimitive("PropertyDateTimeOffset", getDateTime(2012, 12, 3, 7, 16, 23)))
- .addProperty(createPrimitive("PropertyDuration", 6))
- .addProperty(createPrimitive("PropertyGuid", GUID))
- .addProperty(createPrimitive("PropertyTimeOfDay", getTime(2, 48, 21))));
-
- entitySet.getEntities().add(new EntityImpl()
- .addProperty(createPrimitive("PropertyString", "Second"))
- .addProperty(createPrimitive("PropertyBoolean", true))
- .addProperty(createPrimitive("PropertyByte", 254))
- .addProperty(createPrimitive("PropertySByte", 124))
- .addProperty(createPrimitive("PropertyInt16", 32764))
- .addProperty(createPrimitive("PropertyInt32", 2147483644))
- .addProperty(createPrimitive("PropertyInt64", 9223372036854775804L))
- .addProperty(createPrimitive("PropertyDecimal", 34))
- .addProperty(createPrimitive("PropertyDate", getDateTime(2012, 12, 3, 0, 0, 0)))
- .addProperty(createPrimitive("PropertyDateTimeOffset", getDateTime(2012, 12, 3, 7, 16, 23)))
- .addProperty(createPrimitive("PropertyDuration", 6))
- .addProperty(createPrimitive("PropertyGuid", GUID))
- .addProperty(createPrimitive("PropertyTimeOfDay", getTime(2, 48, 21))));
-
- return entitySet;
- }
-
- private EntitySet createESCompComp() {
- EntitySet entitySet = new EntitySetImpl();
-
- Entity entity = new EntityImpl();
- entity.addProperty(createPrimitive("PropertyInt16", 1));
- LinkedComplexValue complexValueInner = new LinkedComplexValueImpl();
- complexValueInner.getValue().add(createPrimitive("PropertyInt16", 123));
- complexValueInner.getValue().add(createPrimitive("PropertyString", "String 1"));
- LinkedComplexValue complexValueOuter = new LinkedComplexValueImpl();
- complexValueOuter.getValue().add(
- new PropertyImpl(null, "PropertyComp", ValueType.LINKED_COMPLEX, complexValueInner));
- entity.addProperty(new PropertyImpl(null, "PropertyComp", ValueType.LINKED_COMPLEX, complexValueOuter));
- entitySet.getEntities().add(entity);
-
- entity = new EntityImpl();
- entity.addProperty(createPrimitive("PropertyInt16", 2));
- complexValueInner = new LinkedComplexValueImpl();
- complexValueInner.getValue().add(createPrimitive("PropertyInt16", 987));
- complexValueInner.getValue().add(createPrimitive("PropertyString", "String 2"));
- complexValueOuter = new LinkedComplexValueImpl();
- complexValueOuter.getValue().add(
- new PropertyImpl(null, "PropertyComp", ValueType.LINKED_COMPLEX, complexValueInner));
- entity.addProperty(new PropertyImpl(null, "PropertyComp", ValueType.LINKED_COMPLEX, complexValueOuter));
- entitySet.getEntities().add(entity);
-
- return entitySet;
- }
-
- private EntitySet createESMedia() {
- EntitySet entitySet = new EntitySetImpl();
-
- Entity entity = new EntityImpl();
- entity.addProperty(createPrimitive("PropertyInt16", 1));
- setMedia(entity, createImage("darkturquoise"), "image/svg+xml");
- entitySet.getEntities().add(entity);
-
- entity = new EntityImpl();
- entity.addProperty(createPrimitive("PropertyInt16", 2));
- setMedia(entity, createImage("royalblue"), "image/svg+xml");
- entitySet.getEntities().add(entity);
-
- entity = new EntityImpl();
- entity.addProperty(createPrimitive("PropertyInt16", 3));
- setMedia(entity, createImage("crimson"), "image/svg+xml");
- entitySet.getEntities().add(entity);
-
- entity = new EntityImpl();
- entity.addProperty(createPrimitive("PropertyInt16", 4));
- setMedia(entity, createImage("black"), "image/svg+xml");
- entitySet.getEntities().add(entity);
-
- return entitySet;
- }
-
- private static byte[] createImage(final String color) {
- return ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
- + "<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" viewBox=\"0 0 100 100\">\n"
- + " <g stroke=\"darkmagenta\" stroke-width=\"16\" fill=\"" + color + "\">\n"
- + " <circle cx=\"50\" cy=\"50\" r=\"42\"/>\n"
- + " </g>\n"
- + "</svg>\n").getBytes(Charset.forName("UTF-8"));
- }
-
- private void linkESTwoPrim() {
- EntitySet entitySet = data.get("ESTwoPrim");
- final List<Entity> targetEntities = data.get("ESAllPrim").getEntities();
-
- setLinks(entitySet.getEntities().get(1), "NavPropertyETAllPrimMany", targetEntities.subList(1, 3));
-
- setLink(entitySet.getEntities().get(3), "NavPropertyETAllPrimOne", targetEntities.get(0));
- }
-
- private void linkESAllPrim() {
- EntitySet entitySet = data.get("ESAllPrim");
- final List<Entity> targetEntities = data.get("ESTwoPrim").getEntities();
-
- setLinks(entitySet.getEntities().get(0), "NavPropertyETTwoPrimMany", targetEntities.subList(1, 2));
- setLink(entitySet.getEntities().get(0), "NavPropertyETTwoPrimOne", targetEntities.get(3));
-
- setLinks(entitySet.getEntities().get(2), "NavPropertyETTwoPrimMany",
- Arrays.asList(targetEntities.get(0), targetEntities.get(2), targetEntities.get(3)));
- }
-
- private Property createPrimitive(final String name, final Object value) {
- return new PropertyImpl(null, name, ValueType.PRIMITIVE, value);
- }
-
- private Property createCollection(final String name, final Object... values) {
- return new PropertyImpl(null, name, ValueType.COLLECTION_PRIMITIVE, Arrays.asList(values));
- }
-
- private Calendar getDateTime(final int year, final int month, final int day,
- final int hour, final int minute, final int second) {
- Calendar dateTime = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
- dateTime.clear();
- dateTime.set(year, month - 1, day, hour, minute, second);
- return dateTime;
- }
-
- private Calendar getTime(final int hour, final int minute, final int second) {
- Calendar time = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
- time.clear();
- time.set(Calendar.HOUR_OF_DAY, hour);
- time.set(Calendar.MINUTE, minute);
- time.set(Calendar.SECOND, second);
- return time;
- }
-
- private Timestamp getTimestamp(final int year, final int month, final int day,
- final int hour, final int minute, final int second, final int nanosecond) {
- Timestamp timestamp = new Timestamp(getDateTime(year, month, day, hour, minute, second).getTimeInMillis());
- timestamp.setNanos(nanosecond);
- return timestamp;
- }
-
- private void setLink(Entity entity, final String navigationPropertyName, final Entity target) {
- Link link = new LinkImpl();
- link.setTitle(navigationPropertyName);
- link.setInlineEntity(target);
- entity.getNavigationLinks().add(link);
- }
-
- private void setLinks(Entity entity, final String navigationPropertyName, final List<Entity> targets) {
- Link link = new LinkImpl();
- link.setTitle(navigationPropertyName);
- EntitySet target = new EntitySetImpl();
- target.getEntities().addAll(targets);
- link.setInlineEntitySet(target);
- entity.getNavigationLinks().add(link);
- }
-}
diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalBatchProcessor.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalBatchProcessor.java
deleted file mode 100644
index 37884be..0000000
--- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalBatchProcessor.java
+++ /dev/null
@@ -1,126 +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.tecsvc.processor;
-
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.UUID;
-
-import org.apache.olingo.commons.api.format.ContentType;
-import org.apache.olingo.commons.api.http.HttpHeader;
-import org.apache.olingo.commons.api.http.HttpStatusCode;
-import org.apache.olingo.server.api.ODataRequest;
-import org.apache.olingo.server.api.ODataResponse;
-import org.apache.olingo.server.api.batch.BatchFacade;
-import org.apache.olingo.server.api.batch.exception.BatchDeserializerException;
-import org.apache.olingo.server.api.batch.exception.BatchSerializerException;
-import org.apache.olingo.server.api.deserializer.batch.BatchOptions;
-import org.apache.olingo.server.api.deserializer.batch.BatchRequestPart;
-import org.apache.olingo.server.api.deserializer.batch.ODataResponsePart;
-import org.apache.olingo.server.api.processor.BatchProcessor;
-import org.apache.olingo.server.tecsvc.data.DataProvider;
-
-public class TechnicalBatchProcessor extends TechnicalProcessor implements BatchProcessor {
- private static final String PREFERENCE_CONTINUE_ON_ERROR = "odata.continue-on-error";
-
- public TechnicalBatchProcessor(DataProvider dataProvider) {
- super(dataProvider);
- }
-
- @Override
- public void processBatch(BatchFacade fascade, ODataRequest request, ODataResponse response)
- throws BatchSerializerException, BatchDeserializerException {
- boolean continueOnError = isContinueOnError(request);
-
- final String boundary = fascade.extractBoundaryFromContentType(request.getHeader(HttpHeader.CONTENT_TYPE));
- final BatchOptions options = BatchOptions.with()
- .rawBaseUri(request.getRawBaseUri())
- .rawServiceResolutionUri(request.getRawServiceResolutionUri()).build();
- final List<BatchRequestPart> parts = odata.createFixedFormatDeserializer().parseBatchRequest(request.getBody(),
- boundary, options);
- final List<ODataResponsePart> responseParts = new ArrayList<ODataResponsePart>();
-
- for (BatchRequestPart part : parts) {
- final ODataResponsePart responsePart = fascade.handleBatchRequest(part);
- responseParts.add(responsePart); // Also add failed responses
- final int statusCode = responsePart.getResponses().get(0).getStatusCode();
-
- if ((statusCode >= 400 && statusCode <= 600) && !continueOnError) {
-
- // Perform some additions actions
- // ...
-
- break; // Stop processing, but serialize all recent requests
- }
- }
-
- final String responseBoundary = "batch_" + UUID.randomUUID().toString();;
- final InputStream responseContent =
- odata.createFixedFormatSerializer().batchResponse(responseParts, responseBoundary);
- response.setHeader(HttpHeader.CONTENT_TYPE, ContentType.MULTIPART_MIXED + ";boundary=" + responseBoundary);
- response.setContent(responseContent);
- response.setStatusCode(HttpStatusCode.ACCEPTED.getStatusCode());
- }
-
- private boolean isContinueOnError(ODataRequest request) {
- final List<String> preferValues = request.getHeaders(HttpHeader.PREFER);
-
- if (preferValues != null) {
- for (final String preference : preferValues) {
- if (PREFERENCE_CONTINUE_ON_ERROR.equals(preference)) {
- return true;
- }
- }
- }
- return false;
- }
-
- @Override
- public ODataResponsePart processChangeSet(BatchFacade fascade, List<ODataRequest> requests)
- throws BatchDeserializerException {
- List<ODataResponse> responses = new ArrayList<ODataResponse>();
-
- for (ODataRequest request : requests) {
- final ODataResponse oDataResponse = fascade.handleODataRequest(request);
- final int statusCode = oDataResponse.getStatusCode();
-
- if (statusCode < 400) {
- responses.add(oDataResponse);
- } else {
- // Rollback
- // ...
-
- // OData Version 4.0 Part 1: Protocol Plus Errata 01
- // 11.7.4 Responding to a Batch Request
- //
- // When a request within a change set fails, the change set response is not represented using
- // the multipart/mixed media type. Instead, a single response, using the application/http media type
- // and a Content-Transfer-Encoding header with a value of binary, is returned that applies to all requests
- // in the change set and MUST be formatted according to the Error Handling defined
- // for the particular response format.
-
- return new ODataResponsePart(oDataResponse, false);
- }
- }
-
- return new ODataResponsePart(responses, true);
- }
-
-}
diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalEntityProcessor.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalEntityProcessor.java
deleted file mode 100644
index f86a64c..0000000
--- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalEntityProcessor.java
+++ /dev/null
@@ -1,300 +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.tecsvc.processor;
-
-import java.util.List;
-import java.util.Locale;
-
-import org.apache.olingo.commons.api.data.ContextURL;
-import org.apache.olingo.commons.api.data.ContextURL.Suffix;
-import org.apache.olingo.commons.api.data.Entity;
-import org.apache.olingo.commons.api.data.EntitySet;
-import org.apache.olingo.commons.api.edm.EdmEntitySet;
-import org.apache.olingo.commons.api.format.ContentType;
-import org.apache.olingo.commons.api.format.ODataFormat;
-import org.apache.olingo.commons.api.http.HttpContentType;
-import org.apache.olingo.commons.api.http.HttpHeader;
-import org.apache.olingo.commons.api.http.HttpStatusCode;
-import org.apache.olingo.server.api.ODataApplicationException;
-import org.apache.olingo.server.api.ODataRequest;
-import org.apache.olingo.server.api.ODataResponse;
-import org.apache.olingo.server.api.deserializer.DeserializerException;
-import org.apache.olingo.server.api.processor.ActionEntityCollectionProcessor;
-import org.apache.olingo.server.api.processor.ActionEntityProcessor;
-import org.apache.olingo.server.api.processor.CountEntityCollectionProcessor;
-import org.apache.olingo.server.api.processor.EntityCollectionProcessor;
-import org.apache.olingo.server.api.processor.EntityProcessor;
-import org.apache.olingo.server.api.processor.MediaEntityProcessor;
-import org.apache.olingo.server.api.serializer.EntityCollectionSerializerOptions;
-import org.apache.olingo.server.api.serializer.ODataSerializer;
-import org.apache.olingo.server.api.serializer.EntitySerializerOptions;
-import org.apache.olingo.server.api.serializer.SerializerException;
-import org.apache.olingo.server.api.uri.UriInfo;
-import org.apache.olingo.server.api.uri.UriResource;
-import org.apache.olingo.server.api.uri.UriResourceEntitySet;
-import org.apache.olingo.server.api.uri.UriResourceKind;
-import org.apache.olingo.server.api.uri.queryoption.ExpandOption;
-import org.apache.olingo.server.api.uri.queryoption.SelectOption;
-import org.apache.olingo.server.tecsvc.data.DataProvider;
-
-/**
- * Technical Processor for entity-related functionality.
- */
-public class TechnicalEntityProcessor extends TechnicalProcessor
- implements EntityCollectionProcessor, ActionEntityCollectionProcessor, CountEntityCollectionProcessor,
- EntityProcessor, ActionEntityProcessor, MediaEntityProcessor {
-
- public TechnicalEntityProcessor(final DataProvider dataProvider) {
- super(dataProvider);
- }
-
- @Override
- public void readEntityCollection(final ODataRequest request, ODataResponse response, final UriInfo uriInfo,
- final ContentType requestedContentType) throws ODataApplicationException, SerializerException {
- validateOptions(uriInfo.asUriInfoResource());
- blockNavigation(uriInfo);
-
- final EdmEntitySet edmEntitySet = getEdmEntitySet(uriInfo.asUriInfoResource());
- final EntitySet entitySet = readEntitySetInternal(edmEntitySet,
- uriInfo.getCountOption() != null && uriInfo.getCountOption().getValue());
- if (entitySet == null) {
- throw new ODataApplicationException("Nothing found.", HttpStatusCode.NOT_FOUND.getStatusCode(), Locale.ROOT);
- } else {
- final ODataFormat format = ODataFormat.fromContentType(requestedContentType);
- ODataSerializer serializer = odata.createSerializer(format);
- final ExpandOption expand = uriInfo.getExpandOption();
- final SelectOption select = uriInfo.getSelectOption();
- response.setContent(serializer.entityCollection(edmEntitySet.getEntityType(), entitySet,
- EntityCollectionSerializerOptions.with()
- .contextURL(format == ODataFormat.JSON_NO_METADATA ? null :
- getContextUrl(edmEntitySet, false, expand, select))
- .count(uriInfo.getCountOption())
- .expand(expand).select(select)
- .build()));
- response.setStatusCode(HttpStatusCode.OK.getStatusCode());
- response.setHeader(HttpHeader.CONTENT_TYPE, requestedContentType.toContentTypeString());
- }
- }
-
- @Override
- public void processActionEntityCollection(final ODataRequest request, final ODataResponse response,
- final UriInfo uriInfo,
- final ContentType requestFormat, final ContentType responseFormat)
- throws ODataApplicationException, DeserializerException, SerializerException {
- throw new ODataApplicationException("Process entity collection is not supported yet.",
- HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ROOT);
- }
-
- @Override
- public void countEntityCollection(final ODataRequest request, ODataResponse response, final UriInfo uriInfo)
- throws ODataApplicationException, SerializerException {
- validateOptions(uriInfo.asUriInfoResource());
- blockNavigation(uriInfo);
-
- final List<UriResource> resourceParts = uriInfo.asUriInfoResource().getUriResourceParts();
- final EntitySet entitySet =
- readEntitySetInternal(((UriResourceEntitySet) resourceParts.get(resourceParts.size() - 2)).getEntitySet(),
- true);
- if (entitySet == null) {
- throw new ODataApplicationException("Nothing found.", HttpStatusCode.NOT_FOUND.getStatusCode(), Locale.ROOT);
- } else {
- response.setContent(odata.createFixedFormatSerializer().count(entitySet.getCount()));
- response.setStatusCode(HttpStatusCode.OK.getStatusCode());
- response.setHeader(HttpHeader.CONTENT_TYPE, HttpContentType.TEXT_PLAIN);
- }
- }
-
- @Override
- public void readEntity(final ODataRequest request, ODataResponse response, final UriInfo uriInfo,
- final ContentType requestedContentType) throws ODataApplicationException, SerializerException {
- validateOptions(uriInfo.asUriInfoResource());
- blockNavigation(uriInfo);
-
- final EdmEntitySet edmEntitySet = getEdmEntitySet(uriInfo.asUriInfoResource());
- final UriResourceEntitySet resourceEntitySet = (UriResourceEntitySet) uriInfo.getUriResourceParts().get(0);
- final Entity entity = dataProvider.read(edmEntitySet, resourceEntitySet.getKeyPredicates());
-
- if (entity == null) {
- throw new ODataApplicationException("Nothing found.", HttpStatusCode.NOT_FOUND.getStatusCode(), Locale.ROOT);
- } else {
- final ODataFormat format = ODataFormat.fromContentType(requestedContentType);
- ODataSerializer serializer = odata.createSerializer(format);
- final ExpandOption expand = uriInfo.getExpandOption();
- final SelectOption select = uriInfo.getSelectOption();
- response.setContent(serializer.entity(edmEntitySet.getEntityType(), entity,
- EntitySerializerOptions.with()
- .contextURL(format == ODataFormat.JSON_NO_METADATA ? null :
- getContextUrl(edmEntitySet, true, expand, select))
- .expand(expand).select(select)
- .build()));
- response.setStatusCode(HttpStatusCode.OK.getStatusCode());
- response.setHeader(HttpHeader.CONTENT_TYPE, requestedContentType.toContentTypeString());
- }
- }
-
- @Override
- public void readMediaEntity(final ODataRequest request, ODataResponse response, final UriInfo uriInfo,
- final ContentType responseFormat) throws ODataApplicationException, SerializerException {
- blockNavigation(uriInfo);
- final UriResourceEntitySet resourceEntitySet = (UriResourceEntitySet) uriInfo.getUriResourceParts().get(0);
- final Entity entity = dataProvider.read(resourceEntitySet.getEntitySet(), resourceEntitySet.getKeyPredicates());
- if (entity == null) {
- throw new ODataApplicationException("Nothing found.", HttpStatusCode.NOT_FOUND.getStatusCode(), Locale.ROOT);
- } else {
- response.setContent(odata.createFixedFormatSerializer().binary(dataProvider.readMedia(entity)));
- response.setStatusCode(HttpStatusCode.OK.getStatusCode());
- response.setHeader(HttpHeader.CONTENT_TYPE, entity.getMediaContentType());
- }
- }
-
- @Override
- public void createMediaEntity(final ODataRequest request, ODataResponse response, final UriInfo uriInfo,
- final ContentType requestFormat, final ContentType responseFormat)
- throws ODataApplicationException, DeserializerException, SerializerException {
-
- blockNavigation(uriInfo);
- final UriResourceEntitySet resourceEntitySet = (UriResourceEntitySet) uriInfo.getUriResourceParts().get(0);
- final EdmEntitySet edmEntitySet = resourceEntitySet.getEntitySet();
- Entity entity = null;
- if (edmEntitySet.getEntityType().hasStream()) {
- if (requestFormat == null) {
- throw new ODataApplicationException("The content type has not been set in the request.",
- HttpStatusCode.BAD_REQUEST.getStatusCode(), Locale.ROOT);
- }
- entity = dataProvider.create(edmEntitySet);
- dataProvider.setMedia(entity, odata.createFixedFormatDeserializer().binary(request.getBody()),
- requestFormat.toContentTypeString());
- } else {
- throw new ODataApplicationException("Requested Entity is not a media resource.",
- HttpStatusCode.BAD_REQUEST.getStatusCode(), Locale.ROOT);
- }
-
- final ODataFormat format = ODataFormat.fromContentType(responseFormat);
- ODataSerializer serializer = odata.createSerializer(format);
- response.setContent(serializer.entity(edmEntitySet.getEntityType(), entity,
- EntitySerializerOptions.with()
- .contextURL(format == ODataFormat.JSON_NO_METADATA ? null :
- getContextUrl(edmEntitySet, true, null, null))
- .build()));
- response.setStatusCode(HttpStatusCode.CREATED.getStatusCode());
- response.setHeader(HttpHeader.CONTENT_TYPE, responseFormat.toContentTypeString());
- response.setHeader(HttpHeader.LOCATION,
- request.getRawBaseUri() + '/' + odata.createUriHelper().buildCanonicalURL(edmEntitySet, entity));
- }
-
- @Override
- public void createEntity(final ODataRequest request, ODataResponse response, final UriInfo uriInfo,
- final ContentType requestFormat, final ContentType responseFormat)
- throws ODataApplicationException, DeserializerException, SerializerException {
-
- throw new ODataApplicationException("Entity creation is not supported yet.",
- HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ROOT);
- }
-
- @Override
- public void updateEntity(final ODataRequest request, final ODataResponse response,
- final UriInfo uriInfo, final ContentType requestFormat,
- final ContentType responseFormat)
- throws ODataApplicationException, DeserializerException, SerializerException {
- throw new ODataApplicationException("Entity update is not supported yet.",
- HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ROOT);
- }
-
- @Override
- public void updateMediaEntity(final ODataRequest request, ODataResponse response, final UriInfo uriInfo,
- final ContentType requestFormat, final ContentType responseFormat)
- throws ODataApplicationException, DeserializerException, SerializerException {
- blockNavigation(uriInfo);
- final UriResourceEntitySet resourceEntitySet = (UriResourceEntitySet) uriInfo.getUriResourceParts().get(0);
- final EdmEntitySet edmEntitySet = resourceEntitySet.getEntitySet();
- final Entity entity = dataProvider.read(edmEntitySet, resourceEntitySet.getKeyPredicates());
- if (entity == null) {
- throw new ODataApplicationException("Nothing found.", HttpStatusCode.NOT_FOUND.getStatusCode(), Locale.ROOT);
- }
- if (requestFormat == null) {
- throw new ODataApplicationException("The content type has not been set in the request.",
- HttpStatusCode.BAD_REQUEST.getStatusCode(), Locale.ROOT);
- }
- dataProvider.setMedia(entity, odata.createFixedFormatDeserializer().binary(request.getBody()),
- requestFormat.toContentTypeString());
-
- final ODataFormat format = ODataFormat.fromContentType(responseFormat);
- ODataSerializer serializer = odata.createSerializer(format);
- response.setContent(serializer.entity(edmEntitySet.getEntityType(), entity,
- EntitySerializerOptions.with()
- .contextURL(format == ODataFormat.JSON_NO_METADATA ? null :
- getContextUrl(edmEntitySet, true, null, null))
- .build()));
- response.setStatusCode(HttpStatusCode.OK.getStatusCode());
- response.setHeader(HttpHeader.CONTENT_TYPE, responseFormat.toContentTypeString());
- }
-
- @Override
- public void deleteEntity(final ODataRequest request, ODataResponse response, final UriInfo uriInfo)
- throws ODataApplicationException {
- blockNavigation(uriInfo);
- final UriResourceEntitySet resourceEntitySet = (UriResourceEntitySet) uriInfo.getUriResourceParts().get(0);
- final Entity entity = dataProvider.read(resourceEntitySet.getEntitySet(), resourceEntitySet.getKeyPredicates());
- if (entity == null) {
- throw new ODataApplicationException("Nothing found.", HttpStatusCode.NOT_FOUND.getStatusCode(), Locale.ROOT);
- } else {
- dataProvider.delete(resourceEntitySet.getEntitySet(), entity);
- response.setStatusCode(HttpStatusCode.NO_CONTENT.getStatusCode());
- }
- }
-
- @Override
- public void processActionEntity(final ODataRequest request, final ODataResponse response,
- final UriInfo uriInfo, final ContentType requestFormat,
- final ContentType responseFormat)
- throws ODataApplicationException, DeserializerException, SerializerException {
- throw new ODataApplicationException("Process entity is not supported yet.",
- HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ROOT);
- }
-
- private void blockNavigation(final UriInfo uriInfo) throws ODataApplicationException {
- final List<UriResource> parts = uriInfo.asUriInfoResource().getUriResourceParts();
- if (parts.size() > 2
- || parts.size() == 2
- && parts.get(1).getKind() != UriResourceKind.count
- && parts.get(1).getKind() != UriResourceKind.value) {
- throw new ODataApplicationException("Invalid resource type.",
- HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ROOT);
- }
- }
-
- private EntitySet readEntitySetInternal(final EdmEntitySet edmEntitySet, final boolean withCount)
- throws DataProvider.DataProviderException {
- EntitySet entitySet = dataProvider.readAll(edmEntitySet);
- // TODO: set count (correctly) and next link
- if (withCount && entitySet.getCount() == null) {
- entitySet.setCount(entitySet.getEntities().size());
- }
- return entitySet;
- }
-
- private ContextURL getContextUrl(final EdmEntitySet entitySet, final boolean isSingleEntity,
- final ExpandOption expand, final SelectOption select) throws SerializerException {
- return ContextURL.with().entitySet(entitySet)
- .selectList(odata.createUriHelper()
- .buildContextURLSelectList(entitySet.getEntityType(), expand, select))
- .suffix(isSingleEntity ? Suffix.ENTITY : null)
- .build();
- }
-}
diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalPrimitiveComplexProcessor.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalPrimitiveComplexProcessor.java
deleted file mode 100644
index 75e3dcc..0000000
--- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalPrimitiveComplexProcessor.java
+++ /dev/null
@@ -1,366 +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.tecsvc.processor;
-
-import java.util.Collections;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Locale;
-
-import org.apache.olingo.commons.api.data.ContextURL;
-import org.apache.olingo.commons.api.data.Entity;
-import org.apache.olingo.commons.api.data.Property;
-import org.apache.olingo.commons.api.edm.EdmComplexType;
-import org.apache.olingo.commons.api.edm.EdmEntitySet;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
-import org.apache.olingo.commons.api.edm.EdmProperty;
-import org.apache.olingo.commons.api.edm.EdmStructuredType;
-import org.apache.olingo.commons.api.format.ContentType;
-import org.apache.olingo.commons.api.format.ODataFormat;
-import org.apache.olingo.commons.api.http.HttpHeader;
-import org.apache.olingo.commons.api.http.HttpStatusCode;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
-import org.apache.olingo.server.api.ODataApplicationException;
-import org.apache.olingo.server.api.ODataRequest;
-import org.apache.olingo.server.api.ODataResponse;
-import org.apache.olingo.server.api.deserializer.DeserializerException;
-import org.apache.olingo.server.api.processor.ActionComplexCollectionProcessor;
-import org.apache.olingo.server.api.processor.ActionComplexProcessor;
-import org.apache.olingo.server.api.processor.ActionPrimitiveCollectionProcessor;
-import org.apache.olingo.server.api.processor.ActionPrimitiveProcessor;
-import org.apache.olingo.server.api.processor.ComplexCollectionProcessor;
-import org.apache.olingo.server.api.processor.ComplexProcessor;
-import org.apache.olingo.server.api.processor.PrimitiveCollectionProcessor;
-import org.apache.olingo.server.api.processor.PrimitiveProcessor;
-import org.apache.olingo.server.api.processor.PrimitiveValueProcessor;
-import org.apache.olingo.server.api.serializer.ComplexSerializerOptions;
-import org.apache.olingo.server.api.serializer.FixedFormatSerializer;
-import org.apache.olingo.server.api.serializer.ODataSerializer;
-import org.apache.olingo.server.api.serializer.PrimitiveSerializerOptions;
-import org.apache.olingo.server.api.serializer.PrimitiveValueSerializerOptions;
-import org.apache.olingo.server.api.serializer.RepresentationType;
-import org.apache.olingo.server.api.serializer.SerializerException;
-import org.apache.olingo.server.api.uri.UriHelper;
-import org.apache.olingo.server.api.uri.UriInfo;
-import org.apache.olingo.server.api.uri.UriInfoResource;
-import org.apache.olingo.server.api.uri.UriResource;
-import org.apache.olingo.server.api.uri.UriResourceEntitySet;
-import org.apache.olingo.server.api.uri.UriResourceKind;
-import org.apache.olingo.server.api.uri.UriResourceProperty;
-import org.apache.olingo.server.api.uri.queryoption.ExpandOption;
-import org.apache.olingo.server.api.uri.queryoption.SelectOption;
-import org.apache.olingo.server.tecsvc.data.DataProvider;
-
-/**
- * Technical Processor which provides functionality related to primitive and complex types and collections thereof.
- */
-public class TechnicalPrimitiveComplexProcessor extends TechnicalProcessor
- implements PrimitiveProcessor, PrimitiveValueProcessor, ActionPrimitiveProcessor,
- PrimitiveCollectionProcessor, ActionPrimitiveCollectionProcessor,
- ComplexProcessor, ActionComplexProcessor,
- ComplexCollectionProcessor, ActionComplexCollectionProcessor {
-
- public TechnicalPrimitiveComplexProcessor(final DataProvider dataProvider) {
- super(dataProvider);
- }
-
- @Override
- public void readPrimitive(final ODataRequest request, ODataResponse response, final UriInfo uriInfo,
- final ContentType contentType) throws ODataApplicationException, SerializerException {
- readProperty(response, uriInfo, contentType, RepresentationType.PRIMITIVE);
- }
-
- @Override
- public void updatePrimitive(final ODataRequest request, ODataResponse response, final UriInfo uriInfo,
- final ContentType requestFormat, final ContentType responseFormat)
- throws ODataApplicationException, DeserializerException, SerializerException {
- throw new ODataApplicationException("Not supported yet.",
- HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ROOT);
- }
-
- @Override
- public void deletePrimitive(final ODataRequest request, ODataResponse response, final UriInfo uriInfo)
- throws ODataApplicationException {
- deleteProperty(response, uriInfo);
- }
-
- @Override
- public void processActionPrimitive(final ODataRequest request, final ODataResponse response,
- final UriInfo uriInfo,
- final ContentType requestFormat, final ContentType responseFormat)
- throws ODataApplicationException, DeserializerException, SerializerException {
- throw new ODataApplicationException("Not supported yet.",
- HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ROOT);
- }
-
- @Override
- public void readPrimitiveCollection(final ODataRequest request, ODataResponse response, final UriInfo uriInfo,
- final ContentType contentType) throws ODataApplicationException, SerializerException {
- readProperty(response, uriInfo, contentType, RepresentationType.COLLECTION_PRIMITIVE);
- }
-
- @Override
- public void updatePrimitiveCollection(final ODataRequest request, final ODataResponse response,
- final UriInfo uriInfo, final ContentType requestFormat, final ContentType responseFormat)
- throws ODataApplicationException, DeserializerException, SerializerException {
- throw new ODataApplicationException("Not supported yet.",
- HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ROOT);
- }
-
- @Override
- public void deletePrimitiveCollection(final ODataRequest request, ODataResponse response, final UriInfo uriInfo)
- throws ODataApplicationException {
- deleteProperty(response, uriInfo);
- }
-
- @Override
- public void processActionPrimitiveCollection(final ODataRequest request, final ODataResponse response,
- final UriInfo uriInfo,
- final ContentType requestFormat, final ContentType responseFormat)
- throws ODataApplicationException, DeserializerException,
- SerializerException {
- throw new ODataApplicationException("Not supported yet.",
- HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ROOT);
- }
-
- @Override
- public void readComplex(final ODataRequest request, ODataResponse response, final UriInfo uriInfo,
- final ContentType contentType) throws ODataApplicationException, SerializerException {
- readProperty(response, uriInfo, contentType, RepresentationType.COMPLEX);
- }
-
- @Override
- public void updateComplex(final ODataRequest request, final ODataResponse response, final UriInfo uriInfo,
- final ContentType requestFormat, final ContentType responseFormat)
- throws ODataApplicationException, DeserializerException, SerializerException {
- throw new ODataApplicationException("Not supported yet.",
- HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ROOT);
- }
-
- @Override
- public void processActionComplex(ODataRequest request, ODataResponse response, UriInfo uriInfo, ContentType
- requestFormat, ContentType responseFormat) throws ODataApplicationException, DeserializerException,
- SerializerException {
- throw new ODataApplicationException("Not supported yet.",
- HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ROOT);
- }
-
- @Override
- public void deleteComplex(final ODataRequest request, final ODataResponse response, final UriInfo uriInfo)
- throws ODataApplicationException {
- deleteProperty(response, uriInfo);
- }
-
- @Override
- public void readComplexCollection(final ODataRequest request, ODataResponse response, final UriInfo uriInfo,
- final ContentType contentType) throws ODataApplicationException, SerializerException {
- readProperty(response, uriInfo, contentType, RepresentationType.COLLECTION_COMPLEX);
- }
-
- @Override
- public void updateComplexCollection(final ODataRequest request, final ODataResponse response, final UriInfo uriInfo,
- final ContentType requestFormat, final ContentType responseFormat)
- throws ODataApplicationException, DeserializerException, SerializerException {
- throw new ODataApplicationException("Not supported yet.",
- HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ROOT);
- }
-
- @Override
- public void processActionComplexCollection(ODataRequest request, ODataResponse response,
- UriInfo uriInfo, ContentType requestFormat,
- ContentType responseFormat)
- throws ODataApplicationException, DeserializerException, SerializerException {
- throw new ODataApplicationException("Not supported yet.",
- HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ROOT);
- }
-
- @Override
- public void deleteComplexCollection(final ODataRequest request, ODataResponse response, final UriInfo uriInfo)
- throws ODataApplicationException {
- deleteProperty(response, uriInfo);
- }
-
- private void readProperty(final ODataResponse response, final UriInfo uriInfo, final ContentType contentType,
- final RepresentationType representationType) throws ODataApplicationException, SerializerException {
- final UriInfoResource resource = uriInfo.asUriInfoResource();
- validateOptions(resource);
- validatePath(resource);
-
- final List<UriResource> resourceParts = resource.getUriResourceParts();
- final UriResourceEntitySet resourceEntitySet = (UriResourceEntitySet) resourceParts.get(0);
- final List<String> path = getPropertyPath(resourceParts);
-
- final Property property = getPropertyData(resourceEntitySet, path);
-
- if (property == null) {
- throw new ODataApplicationException("Nothing found.", HttpStatusCode.NOT_FOUND.getStatusCode(), Locale.ROOT);
- } else {
- if (property.getValue() == null) {
- response.setStatusCode(HttpStatusCode.NO_CONTENT.getStatusCode());
- } else {
- final EdmEntitySet edmEntitySet = getEdmEntitySet(resource);
- final EdmProperty edmProperty = ((UriResourceProperty) resourceParts.get(path.size())).getProperty();
-
- final ODataFormat format = ODataFormat.fromContentType(contentType);
- ODataSerializer serializer = odata.createSerializer(format);
- final ExpandOption expand = uriInfo.getExpandOption();
- final SelectOption select = uriInfo.getSelectOption();
- final UriHelper helper = odata.createUriHelper();
- final ContextURL contextURL = format == ODataFormat.JSON_NO_METADATA ? null :
- ContextURL.with().entitySet(edmEntitySet)
- .keyPath(helper.buildContextURLKeyPredicate(
- ((UriResourceEntitySet) resourceParts.get(0)).getKeyPredicates()))
- .navOrPropertyPath(buildPropertyPath(path))
- .selectList(edmProperty.isPrimitive() ? null :
- helper.buildContextURLSelectList((EdmStructuredType) edmProperty.getType(), expand, select))
- .build();
- switch (representationType) {
- case PRIMITIVE:
- response.setContent(serializer.primitive((EdmPrimitiveType) edmProperty.getType(), property,
- PrimitiveSerializerOptions.with().contextURL(contextURL).facetsFrom(edmProperty).build()));
- break;
- case COMPLEX:
- response.setContent(serializer.complex((EdmComplexType) edmProperty.getType(), property,
- ComplexSerializerOptions.with().contextURL(contextURL)
- .expand(expand).select(select)
- .build()));
- break;
- case COLLECTION_PRIMITIVE:
- response.setContent(serializer.primitiveCollection((EdmPrimitiveType) edmProperty.getType(), property,
- PrimitiveSerializerOptions.with().contextURL(contextURL).facetsFrom(edmProperty).build()));
- break;
- case COLLECTION_COMPLEX:
- response.setContent(serializer.complexCollection((EdmComplexType) edmProperty.getType(), property,
- ComplexSerializerOptions.with().contextURL(contextURL)
- .expand(expand).select(select)
- .build()));
- break;
- default:
- break;
- }
- response.setStatusCode(HttpStatusCode.OK.getStatusCode());
- response.setHeader(HttpHeader.CONTENT_TYPE, contentType.toContentTypeString());
- }
- }
- }
-
- private void deleteProperty(final ODataResponse response, final UriInfo uriInfo) throws ODataApplicationException {
- final UriInfoResource resource = uriInfo.asUriInfoResource();
- validatePath(resource);
-
- final List<UriResource> resourceParts = resource.getUriResourceParts();
- final UriResourceEntitySet resourceEntitySet = (UriResourceEntitySet) resourceParts.get(0);
- final List<String> path = getPropertyPath(resourceParts);
-
- final EdmProperty edmProperty = ((UriResourceProperty) resourceParts.get(path.size())).getProperty();
- final Property property = getPropertyData(resourceEntitySet, path);
-
- if (edmProperty.isNullable() == null || edmProperty.isNullable()) {
- property.setValue(property.getValueType(), edmProperty.isCollection() ? Collections.emptyList() : null);
- response.setStatusCode(HttpStatusCode.NO_CONTENT.getStatusCode());
- } else {
- throw new ODataApplicationException("Not nullable.", HttpStatusCode.BAD_REQUEST.getStatusCode(), Locale.ROOT);
- }
- }
-
- private Property getPropertyData(final UriResourceEntitySet resourceEntitySet, final List<String> path)
- throws ODataApplicationException {
- final Entity entity = dataProvider.read(resourceEntitySet.getEntitySet(), resourceEntitySet.getKeyPredicates());
- if (entity == null) {
- throw new ODataApplicationException("Nothing found.", HttpStatusCode.NOT_FOUND.getStatusCode(), Locale.ROOT);
- } else {
- Property property = entity.getProperty(path.get(0));
- for (final String name : path.subList(1, path.size())) {
- if (property != null && (property.isLinkedComplex() || property.isComplex())) {
- final List<Property> complex = property.isLinkedComplex() ?
- property.asLinkedComplex().getValue() : property.asComplex();
- property = null;
- for (final Property innerProperty : complex) {
- if (innerProperty.getName().equals(name)) {
- property = innerProperty;
- break;
- }
- }
- }
- }
- return property;
- }
- }
-
- private List<String> getPropertyPath(final List<UriResource> path) {
- List<String> result = new LinkedList<String>();
- int index = 1;
- while (index < path.size() && path.get(index) instanceof UriResourceProperty) {
- result.add(((UriResourceProperty) path.get(index)).getProperty().getName());
- index++;
- }
- return result;
- }
-
- private String buildPropertyPath(final List<String> path) {
- StringBuilder result = new StringBuilder();
- for (final String segment : path) {
- result.append(result.length() == 0 ? "" : '/').append(segment);
- }
- return result.toString();
- }
-
- @Override
- public void readPrimitiveValue(final ODataRequest request, ODataResponse response, final UriInfo uriInfo,
- final ContentType contentType) throws ODataApplicationException, SerializerException {
- final UriInfoResource resource = uriInfo.asUriInfoResource();
- validateOptions(resource);
- validatePath(resource);
-
- final List<UriResource> resourceParts = resource.getUriResourceParts();
- final UriResourceEntitySet resourceEntitySet = (UriResourceEntitySet) resourceParts.get(0);
- final List<String> path = getPropertyPath(resourceParts);
-
- final Property property = getPropertyData(resourceEntitySet, path);
-
- if (property == null || property.getValue() == null) {
- response.setStatusCode(HttpStatusCode.NO_CONTENT.getStatusCode());
- } else {
- final EdmProperty edmProperty = ((UriResourceProperty) resourceParts.get(path.size())).getProperty();
- final EdmPrimitiveType type = (EdmPrimitiveType) edmProperty.getType();
- final FixedFormatSerializer serializer = odata.createFixedFormatSerializer();
- response.setContent(type == EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Binary) ?
- serializer.binary((byte[]) property.getValue()) :
- serializer.primitiveValue(type, property.getValue(),
- PrimitiveValueSerializerOptions.with().facetsFrom(edmProperty).build()));
- response.setHeader(HttpHeader.CONTENT_TYPE, contentType.toContentTypeString());
- response.setStatusCode(HttpStatusCode.OK.getStatusCode());
- }
- }
-
- private void validatePath(final UriInfoResource uriInfo) throws ODataApplicationException {
- final List<UriResource> resourcePaths = uriInfo.getUriResourceParts();
- for (final UriResource segment : resourcePaths.subList(1, resourcePaths.size())) {
- final UriResourceKind kind = segment.getKind();
- if (kind != UriResourceKind.primitiveProperty
- && kind != UriResourceKind.complexProperty
- && kind != UriResourceKind.count
- && kind != UriResourceKind.value) {
- throw new ODataApplicationException("Invalid resource type.",
- HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ROOT);
- }
- }
- }
-}
diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalProcessor.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalProcessor.java
deleted file mode 100644
index 4fa3d36..0000000
--- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalProcessor.java
+++ /dev/null
@@ -1,83 +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.tecsvc.processor;
-
-
-import java.util.List;
-import java.util.Locale;
-
-import org.apache.olingo.commons.api.edm.EdmEntitySet;
-import org.apache.olingo.commons.api.http.HttpStatusCode;
-import org.apache.olingo.server.api.OData;
-import org.apache.olingo.server.api.ODataApplicationException;
-import org.apache.olingo.server.api.ServiceMetadata;
-import org.apache.olingo.server.api.processor.Processor;
-import org.apache.olingo.server.api.uri.UriInfoResource;
-import org.apache.olingo.server.api.uri.UriResource;
-import org.apache.olingo.server.api.uri.UriResourceEntitySet;
-import org.apache.olingo.server.tecsvc.data.DataProvider;
-
-/**
- * Technical Processor base.
- */
-public abstract class TechnicalProcessor implements Processor {
-
- protected OData odata;
- protected DataProvider dataProvider;
-
- protected TechnicalProcessor(final DataProvider dataProvider) {
- this.dataProvider = dataProvider;
- }
-
- @Override
- public void init(final OData odata, final ServiceMetadata serviceMetadata) {
- this.odata = odata;
- }
-
- protected EdmEntitySet getEdmEntitySet(final UriInfoResource uriInfo) throws ODataApplicationException {
- final List<UriResource> resourcePaths = uriInfo.getUriResourceParts();
- // first must be entity set
- if (!(resourcePaths.get(0) instanceof UriResourceEntitySet)) {
- throw new ODataApplicationException("Invalid resource type.",
- HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ROOT);
- }
-
- final UriResourceEntitySet uriResource = (UriResourceEntitySet) resourcePaths.get(0);
- if (uriResource.getTypeFilterOnCollection() != null || uriResource.getTypeFilterOnEntry() != null) {
- throw new ODataApplicationException("Type filters are not supported.",
- HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ROOT);
- }
- return uriResource.getEntitySet();
- }
-
- protected void validateOptions(final UriInfoResource uriInfo) throws ODataApplicationException {
- if (uriInfo.getCountOption() != null
- || !uriInfo.getCustomQueryOptions().isEmpty()
- || uriInfo.getFilterOption() != null
- || uriInfo.getIdOption() != null
- || uriInfo.getOrderByOption() != null
- || uriInfo.getSearchOption() != null
- || uriInfo.getSkipOption() != null
- || uriInfo.getSkipTokenOption() != null
- || uriInfo.getTopOption() != null) {
- throw new ODataApplicationException("Not all of the specified options are supported.",
- HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ROOT);
- }
- }
-}
diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/ActionProvider.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/ActionProvider.java
deleted file mode 100644
index 6158898..0000000
--- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/ActionProvider.java
+++ /dev/null
@@ -1,204 +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.tecsvc.provider;
-
-import java.util.Arrays;
-import java.util.List;
-
-import org.apache.olingo.commons.api.ODataException;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.server.api.edm.provider.Action;
-import org.apache.olingo.server.api.edm.provider.Parameter;
-import org.apache.olingo.server.api.edm.provider.ReturnType;
-
-public class ActionProvider {
-
- // Bound Actions
- public static final FullQualifiedName nameBAESAllPrimRTETAllPrim =
- new FullQualifiedName(SchemaProvider.NAMESPACE, "BAESAllPrimRTETAllPrim");
-
- public static final FullQualifiedName nameBAESTwoKeyNavRTESTwoKeyNav =
- new FullQualifiedName(SchemaProvider.NAMESPACE, "BAESTwoKeyNavRTESTwoKeyNav");
-
- public static final FullQualifiedName nameBAETBaseTwoKeyNavRTETBaseTwoKeyNav =
- new FullQualifiedName(SchemaProvider.NAMESPACE, "BAETBaseTwoKeyNavRTETBaseTwoKeyNav");
-
- public static final FullQualifiedName nameBAETTwoBaseTwoKeyNavRTETBaseTwoKeyNav =
- new FullQualifiedName(SchemaProvider.NAMESPACE, "BAETTwoBaseTwoKeyNavRTETBaseTwoKeyNav");
-
- public static final FullQualifiedName nameBAETTwoKeyNavRTETTwoKeyNav =
- new FullQualifiedName(SchemaProvider.NAMESPACE, "BAETTwoKeyNavRTETTwoKeyNav");
-
- // Unbound Actions
- public static final FullQualifiedName nameUARTString = new FullQualifiedName(SchemaProvider.NAMESPACE,
- "UARTString");
- public static final FullQualifiedName nameUARTCollStringTwoParam = new FullQualifiedName(SchemaProvider.NAMESPACE,
- "UARTCollStringTwoParam");
- public static final FullQualifiedName nameUARTCollCTTwoPrimParam = new FullQualifiedName(SchemaProvider.NAMESPACE,
- "UARTCollCTTwoPrimParam");
- public static final FullQualifiedName nameUARTCTTwoPrimParam = new FullQualifiedName(SchemaProvider.NAMESPACE,
- "UARTCTTwoPrimParam");
- public static final FullQualifiedName nameUARTETTwoKeyTwoPrimParam =
- new FullQualifiedName(SchemaProvider.NAMESPACE, "UARTETTwoKeyTwoPrimParam");
- public static final FullQualifiedName nameUARTCollETKeyNavParam =
- new FullQualifiedName(SchemaProvider.NAMESPACE, "UARTCollETKeyNavParam");
- public static final FullQualifiedName nameUARTETAllPrimParam =
- new FullQualifiedName(SchemaProvider.NAMESPACE, "UARTETAllPrimParam");
- public static final FullQualifiedName nameUARTCollETAllPrimParam =
- new FullQualifiedName(SchemaProvider.NAMESPACE, "UARTCollETAllPrimParam");
-
-
- public List<Action> getActions(final FullQualifiedName actionName) throws ODataException {
- if (actionName.equals(nameUARTString)) {
- return Arrays.asList(
- new Action().setName(nameUARTString.getName())
- .setReturnType(new ReturnType().setType(PropertyProvider.nameString))
- );
- } else if (actionName.equals(nameUARTCollStringTwoParam)) {
- return Arrays.asList(
- new Action().setName(nameUARTCollStringTwoParam.getName())
- .setParameters(Arrays.asList(
- new Parameter().setName("ParameterInt16").setType(PropertyProvider.nameInt16)))
- .setReturnType(new ReturnType().setType(PropertyProvider.nameString).setCollection(true))
- );
-
- } else if (actionName.equals(nameUARTCTTwoPrimParam)) {
- return Arrays.asList(
- new Action().setName(nameUARTCTTwoPrimParam.getName())
- .setParameters(Arrays.asList(
- new Parameter().setName("ParameterInt16").setType(PropertyProvider.nameInt16)))
- .setReturnType(
- new ReturnType().setType(ComplexTypeProvider.nameCTTwoPrim))
- );
-
- } else if (actionName.equals(nameUARTCollCTTwoPrimParam)) {
- return Arrays.asList(
- new Action().setName(nameUARTCollCTTwoPrimParam.getName())
- .setParameters(Arrays.asList(
- new Parameter().setName("ParameterInt16").setType(PropertyProvider.nameInt16)))
- .setReturnType(
- new ReturnType().setType(ComplexTypeProvider.nameCTTwoPrim).setCollection(true))
- );
-
- } else if (actionName.equals(nameUARTETTwoKeyTwoPrimParam)) {
- return Arrays.asList(
- new Action().setName(nameUARTETTwoKeyTwoPrimParam.getName())
- .setParameters(Arrays.asList(
- new Parameter().setName("ParameterInt16").setType(PropertyProvider.nameInt16)))
- .setReturnType(
- new ReturnType().setType(EntityTypeProvider.nameETTwoKeyTwoPrim))
- );
-
- } else if (actionName.equals(nameUARTCollETKeyNavParam)) {
- return Arrays.asList(
- new Action().setName(nameUARTCollETKeyNavParam.getName())
- .setParameters(Arrays.asList(
- new Parameter().setName("ParameterInt16").setType(PropertyProvider.nameInt16)))
- .setReturnType(
- new ReturnType().setType(EntityTypeProvider.nameETKeyNav).setCollection(true))
- );
-
- } else if (actionName.equals(nameUARTETAllPrimParam)) {
- return Arrays.asList(
- new Action().setName(nameUARTETAllPrimParam.getName())
- .setParameters(Arrays.asList(
- new Parameter().setName("ParameterDate").setType(PropertyProvider.nameDate)))
- .setReturnType(
- new ReturnType().setType(EntityTypeProvider.nameETAllPrim))
- );
-
- } else if (actionName.equals(nameUARTCollETAllPrimParam)) {
- return Arrays.asList(
- new Action().setName(nameUARTCollETAllPrimParam.getName())
- .setParameters(Arrays.asList(
- new Parameter().setName("ParameterTimeOfDay").setType(PropertyProvider.nameInt16)))
- .setReturnType(
- new ReturnType().setType(EntityTypeProvider.nameETAllPrim).setCollection(true))
- );
-
- } else if (actionName.equals(nameBAETTwoKeyNavRTETTwoKeyNav)) {
- return Arrays.asList(
- new Action().setName("BAETTwoKeyNavRTETTwoKeyNav")
- .setParameters(Arrays.asList(
- new Parameter().setName("ParameterETTwoKeyNav").setType(EntityTypeProvider.nameETTwoKeyNav)
- .setNullable(false)))
- .setBound(true)
- .setReturnType(
- new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav))
- ,
- new Action().setName("BAETTwoKeyNavRTETTwoKeyNav")
- .setParameters(Arrays.asList(
- new Parameter().setName("ParameterETKeyNav").setType(EntityTypeProvider.nameETKeyNav)
- .setNullable(false)))
- .setBound(true)
- .setReturnType(
- new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav))
- );
-
- } else if (actionName.equals(nameBAESAllPrimRTETAllPrim)) {
- return Arrays.asList(
- new Action().setName("BAESAllPrimRTETAllPrim")
- .setParameters(
- Arrays.asList(
- new Parameter().setName("ParameterESAllPrim").setType(EntityTypeProvider.nameETAllPrim)
- .setCollection(true).setNullable(false)))
- .setBound(true)
- .setReturnType(
- new ReturnType().setType(EntityTypeProvider.nameETAllPrim))
- );
-
- } else if (actionName.equals(nameBAESTwoKeyNavRTESTwoKeyNav)) {
- return Arrays.asList(
- new Action().setName("BAESTwoKeyNavRTESTwoKeyNav")
- .setParameters(
- Arrays.asList(
- new Parameter().setName("ParameterETTwoKeyNav").setType(EntityTypeProvider.nameETTwoKeyNav)
- .setCollection(true).setNullable(false)))
- .setBound(true)
- .setReturnType(
- new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav).setCollection(true))
- );
-
- } else if (actionName.equals(nameBAETBaseTwoKeyNavRTETBaseTwoKeyNav)) {
- return Arrays.asList(
- new Action().setName("BAETBaseTwoKeyNavRTETBaseTwoKeyNav")
- .setParameters(Arrays.asList(
- new Parameter().setName("ParameterETTwoKeyNav").setType(EntityTypeProvider.nameETBaseTwoKeyNav)
- .setNullable(false)))
- .setBound(true)
- .setReturnType(
- new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav))
- );
-
- } else if (actionName.equals(nameBAETTwoBaseTwoKeyNavRTETBaseTwoKeyNav)) {
- return Arrays.asList(
- new Action().setName("BAETTwoBaseTwoKeyNavRTETBaseTwoKeyNav")
- .setParameters(
- Arrays.asList(
- new Parameter().setName("ParameterETTwoBaseTwoKeyNav").setType(
- EntityTypeProvider.nameETTwoBaseTwoKeyNav).setNullable(false)))
- .setBound(true)
- .setReturnType(
- new ReturnType().setType(EntityTypeProvider.nameETBaseTwoKeyNav))
- );
- }
-
- return null;
- }
-}
diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/ComplexTypeProvider.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/ComplexTypeProvider.java
deleted file mode 100644
index bf30b32..0000000
--- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/ComplexTypeProvider.java
+++ /dev/null
@@ -1,179 +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.tecsvc.provider;
-
-import org.apache.olingo.commons.api.ODataException;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.server.api.edm.provider.ComplexType;
-import org.apache.olingo.server.api.edm.provider.NavigationProperty;
-import org.apache.olingo.server.api.edm.provider.Property;
-
-import java.util.Arrays;
-
-public class ComplexTypeProvider {
-
- public static final FullQualifiedName nameCTAllPrim = new FullQualifiedName(SchemaProvider.NAMESPACE, "CTAllPrim");
- public static final FullQualifiedName nameCTBase = new FullQualifiedName(SchemaProvider.NAMESPACE, "CTBase");
- public static final FullQualifiedName nameCTBasePrimCompNav = new FullQualifiedName(SchemaProvider.NAMESPACE,
- "CTBasePrimCompNav");
- public static final FullQualifiedName nameCTCollAllPrim = new FullQualifiedName(SchemaProvider.NAMESPACE,
- "CTCollAllPrim");
- public static final FullQualifiedName nameCTCompCollComp = new FullQualifiedName(SchemaProvider.NAMESPACE,
- "CTCompCollComp");
- public static final FullQualifiedName nameCTCompComp = new FullQualifiedName(SchemaProvider.NAMESPACE, "CTCompComp");
- public static final FullQualifiedName nameCTCompNav = new FullQualifiedName(SchemaProvider.NAMESPACE, "CTCompNav");
-
- public static final FullQualifiedName nameCTMixPrimCollComp = new FullQualifiedName(SchemaProvider.NAMESPACE,
- "CTMixPrimCollComp");
- public static final FullQualifiedName nameCTNavFiveProp = new FullQualifiedName(SchemaProvider.NAMESPACE,
- "CTNavFiveProp");
- public static final FullQualifiedName nameCTPrim = new FullQualifiedName(SchemaProvider.NAMESPACE, "CTPrim");
- public static final FullQualifiedName nameCTPrimComp = new FullQualifiedName(SchemaProvider.NAMESPACE, "CTPrimComp");
- public static final FullQualifiedName nameCTTwoBase = new FullQualifiedName(SchemaProvider.NAMESPACE, "CTTwoBase");
- public static final FullQualifiedName nameCTTwoBasePrimCompNav =
- new FullQualifiedName(SchemaProvider.NAMESPACE, "CTTwoBasePrimCompNav");
- public static final FullQualifiedName nameCTTwoPrim = new FullQualifiedName(SchemaProvider.NAMESPACE, "CTTwoPrim");
- public static final FullQualifiedName nameCTMixEnumDef = new FullQualifiedName(SchemaProvider.NAMESPACE,
- "CTMixEnumDef");
-
- public ComplexType getComplexType(final FullQualifiedName complexTypeName) throws ODataException {
-
- if (complexTypeName.equals(nameCTPrim)) {
- return new ComplexType()
- .setName("CTPrim")
- .setProperties(Arrays.asList(PropertyProvider.propertyInt16));
-
- } else if (complexTypeName.equals(nameCTAllPrim)) {
- return new ComplexType()
- .setName("CTAllPrim")
- .setProperties(
- Arrays.asList(PropertyProvider.propertyString, PropertyProvider.propertyBinary,
- PropertyProvider.propertyBoolean, PropertyProvider.propertyByte, PropertyProvider.propertyDate,
- PropertyProvider.propertyDateTimeOffset, PropertyProvider.propertyDecimal,
- PropertyProvider.propertySingle, PropertyProvider.propertyDouble, PropertyProvider.propertyDuration,
- PropertyProvider.propertyGuid, PropertyProvider.propertyInt16, PropertyProvider.propertyInt32,
- PropertyProvider.propertyInt64, PropertyProvider.propertySByte, PropertyProvider.propertyTimeOfDay
- /* TODO add propertyStream */));
-
- } else if (complexTypeName.equals(nameCTCollAllPrim)) {
- return new ComplexType()
- .setName("CTCollAllPrim")
- .setProperties(
- Arrays.asList(
- PropertyProvider.collPropertyString, PropertyProvider.collPropertyBoolean,
- PropertyProvider.collPropertyByte, PropertyProvider.collPropertySByte,
- PropertyProvider.collPropertyInt16, PropertyProvider.collPropertyInt32,
- PropertyProvider.collPropertyInt64, PropertyProvider.collPropertySingle,
- PropertyProvider.collPropertyDouble, PropertyProvider.collPropertyDecimal,
- PropertyProvider.collPropertyBinary, PropertyProvider.collPropertyDate,
- PropertyProvider.collPropertyDateTimeOffset, PropertyProvider.collPropertyDuration,
- PropertyProvider.collPropertyGuid, PropertyProvider.collPropertyTimeOfDay
- /* TODO add collectionPropertyStream */));
-
- } else if (complexTypeName.equals(nameCTTwoPrim)) {
- return new ComplexType()
- .setName("CTTwoPrim")
- .setProperties(Arrays.asList(PropertyProvider.propertyInt16_NotNullable,
- PropertyProvider.propertyString_NotNullable));
-
- } else if (complexTypeName.equals(nameCTCompNav)) {
- return new ComplexType()
- .setName("CTCompNav")
- .setProperties(Arrays.asList(PropertyProvider.propertyString,
- PropertyProvider.propertyComp_CTNavFiveProp));
-
- } else if (complexTypeName.equals(nameCTMixPrimCollComp)) {
- return new ComplexType()
- .setName("CTMixPrimCollComp")
- .setProperties(
- Arrays.asList(PropertyProvider.propertyInt16, PropertyProvider.collPropertyString,
- PropertyProvider.propertyComp_CTTwoPrim, PropertyProvider.collPropertyComp_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);
-
- } else if (complexTypeName.equals(nameCTCompComp)) {
- return new ComplexType()
- .setName("CTCompComp")
- .setProperties(Arrays.asList(PropertyProvider.propertyComp_CTTwoPrim));
-
- } else if (complexTypeName.equals(nameCTCompCollComp)) {
- return new ComplexType()
- .setName("CTCompCollComp")
- .setProperties(Arrays.asList(PropertyProvider.collPropertyComp_CTTwoPrim));
-
- } else if (complexTypeName.equals(nameCTPrimComp)) {
- return new ComplexType()
- .setName("CTPrimComp")
- .setProperties(Arrays.asList(PropertyProvider.propertyInt16, PropertyProvider.propertyComp_CTAllPrim));
-
- } else if (complexTypeName.equals(nameCTNavFiveProp)) {
- return new ComplexType()
- .setName("CTNavFiveProp")
- .setProperties(Arrays.asList(PropertyProvider.propertyInt16))
- .setNavigationProperties((Arrays.asList(
- PropertyProvider.collectionNavPropertyETTwoKeyNavOne_ETTwoKeyNav,
- PropertyProvider.collectionNavPropertyETTwoKeyNavMany_ETTwoKeyNav,
- new NavigationProperty()
- .setName("NavPropertyETMediaOne")
- .setType(EntityTypeProvider.nameETMedia),
- new NavigationProperty()
- .setName("NavPropertyETMediaMany")
- .setType(EntityTypeProvider.nameETMedia).setCollection(true)
- )));
-
- } else if (complexTypeName.equals(nameCTBasePrimCompNav)) {
- return new ComplexType()
- .setName("CTBasePrimCompNav")
- .setBaseType(nameCTPrimComp)
- .setNavigationProperties(Arrays.asList(
- PropertyProvider.collectionNavPropertyETTwoKeyNavMany_ETTwoKeyNav,
- PropertyProvider.collectionNavPropertyETTwoKeyNavOne_ETTwoKeyNav,
- PropertyProvider.navPropertyETKeyNavOne_ETKeyNav,
- PropertyProvider.collectionNavPropertyETKeyNavMany_ETKeyNav));
-
- } else if (complexTypeName.equals(nameCTTwoBasePrimCompNav)) {
- return new ComplexType()
- .setName("CTTwoBasePrimCompNav")
- .setBaseType(nameCTBasePrimCompNav);
-
- } else if (complexTypeName.equals(nameCTMixEnumDef)) {
- return new ComplexType()
- .setName(nameCTMixEnumDef.getName())
- .setProperties(Arrays.asList(
- PropertyProvider.propertyEnumString_ENString,
- PropertyProvider.collPropertyEnumString_ENString,
- PropertyProvider.propertyTypeDefinition_TDString,
- PropertyProvider.collPropertyTypeDefinition_TDString));
- }
-
- return null;
- }
-}
diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/ContainerProvider.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/ContainerProvider.java
deleted file mode 100644
index 7cf15fa..0000000
--- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/ContainerProvider.java
+++ /dev/null
@@ -1,464 +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.tecsvc.provider;
-
-import org.apache.olingo.commons.api.ODataException;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.api.edm.Target;
-import org.apache.olingo.server.api.edm.provider.ActionImport;
-import org.apache.olingo.server.api.edm.provider.EntityContainer;
-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.FunctionImport;
-import org.apache.olingo.server.api.edm.provider.NavigationPropertyBinding;
-import org.apache.olingo.server.api.edm.provider.Singleton;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-public class ContainerProvider {
-
- public static final FullQualifiedName nameContainer = new FullQualifiedName(SchemaProvider.NAMESPACE, "Container");
- public static final String AIRT_STRING = "AIRTString";
- public static final String AIRT_COLL_STRING_TWO_PARAM = "AIRTCollStringTwoParam";
- public static final String AIRTCT_TWO_PRIM_PARAM = "AIRTCTTwoPrimParam";
- public static final String AIRT_COLL_CT_TWO_PRIM_PARAM = "AIRTCollCTTwoPrimParam";
- public static final String AIRTET_TWO_KEY_TWO_PRIM_PARAM = "AIRTETTwoKeyTwoPrimParam";
- public static final String AIRT_COLL_ET_KEY_NAV_PARAM = "AIRTCollETKeyNavParam";
- public static final String AIRTES_ALL_PRIM_PARAM = "AIRTESAllPrimParam";
- public static final String AIRT_COLL_ES_ALL_PRIM_PARAM = "AIRTCollESAllPrimParam";
-
- EntityContainerInfo entityContainerInfoTest1 =
- new EntityContainerInfo().setContainerName(nameContainer);
-
- private EdmTechProvider prov;
-
- public ContainerProvider(final EdmTechProvider edmTechProvider) {
- prov = edmTechProvider;
- }
-
- public EntityContainerInfo getEntityContainerInfo(final FullQualifiedName entityContainerName) throws ODataException {
- if (entityContainerName == null) {
- return entityContainerInfoTest1;
- } else if (entityContainerName.equals(nameContainer)) {
- return entityContainerInfoTest1;
- }
-
- return null;
- }
-
- public EntityContainer getEntityContainer() throws ODataException {
- EntityContainer container = new EntityContainer();
- container.setName(ContainerProvider.nameContainer.getName());
-
- // EntitySets
- List<EntitySet> entitySets = new ArrayList<EntitySet>();
- container.setEntitySets(entitySets);
- entitySets.add(prov.getEntitySet(ContainerProvider.nameContainer, "ESAllPrim"));
- entitySets.add(prov.getEntitySet(ContainerProvider.nameContainer, "ESCollAllPrim"));
- entitySets.add(prov.getEntitySet(ContainerProvider.nameContainer, "ESTwoPrim"));
- entitySets.add(prov.getEntitySet(ContainerProvider.nameContainer, "ESMixPrimCollComp"));
- entitySets.add(prov.getEntitySet(ContainerProvider.nameContainer, "ESBase"));
- entitySets.add(prov.getEntitySet(ContainerProvider.nameContainer, "ESTwoBase"));
- entitySets.add(prov.getEntitySet(ContainerProvider.nameContainer, "ESTwoKeyTwoPrim"));
- entitySets.add(prov.getEntitySet(ContainerProvider.nameContainer, "ESBaseTwoKeyTwoPrim"));
- entitySets.add(prov.getEntitySet(ContainerProvider.nameContainer, "ESTwoBaseTwoKeyTwoPrim"));
- entitySets.add(prov.getEntitySet(ContainerProvider.nameContainer, "ESAllKey"));
- entitySets.add(prov.getEntitySet(ContainerProvider.nameContainer, "ESCompAllPrim"));
- entitySets.add(prov.getEntitySet(ContainerProvider.nameContainer, "ESCompCollAllPrim"));
- entitySets.add(prov.getEntitySet(ContainerProvider.nameContainer, "ESCompComp"));
- entitySets.add(prov.getEntitySet(ContainerProvider.nameContainer, "ESCompCollComp"));
- entitySets.add(prov.getEntitySet(ContainerProvider.nameContainer, "ESMedia"));
- entitySets.add(prov.getEntitySet(ContainerProvider.nameContainer, "ESKeyTwoKeyComp"));
- entitySets.add(prov.getEntitySet(ContainerProvider.nameContainer, "ESInvisible"));
- entitySets.add(prov.getEntitySet(ContainerProvider.nameContainer, "ESServerSidePaging"));
- entitySets.add(prov.getEntitySet(ContainerProvider.nameContainer, "ESAllNullable"));
- entitySets.add(prov.getEntitySet(ContainerProvider.nameContainer, "ESKeyNav"));
- entitySets.add(prov.getEntitySet(ContainerProvider.nameContainer, "ESTwoKeyNav"));
- entitySets.add(prov.getEntitySet(ContainerProvider.nameContainer, "ESBaseTwoKeyNav"));
- entitySets.add(prov.getEntitySet(ContainerProvider.nameContainer, "ESCompMixPrimCollComp"));
- entitySets.add(prov.getEntitySet(ContainerProvider.nameContainer, "ESFourKeyAlias"));
- entitySets.add(prov.getEntitySet(ContainerProvider.nameContainer, "ESMixEnumDefCollComp"));
-
- // Singletons
- List<Singleton> singletons = new ArrayList<Singleton>();
- container.setSingletons(singletons);
- singletons.add(prov.getSingleton(ContainerProvider.nameContainer, "SI"));
- singletons.add(prov.getSingleton(ContainerProvider.nameContainer, "SINav"));
- singletons.add(prov.getSingleton(ContainerProvider.nameContainer, "SIMedia"));
-
- // ActionImports
- List<ActionImport> actionImports = new ArrayList<ActionImport>();
- container.setActionImports(actionImports);
- actionImports.add(prov.getActionImport(ContainerProvider.nameContainer, AIRT_STRING));
- actionImports.add(prov.getActionImport(ContainerProvider.nameContainer, AIRT_COLL_STRING_TWO_PARAM));
- actionImports.add(prov.getActionImport(ContainerProvider.nameContainer, AIRTCT_TWO_PRIM_PARAM));
- actionImports.add(prov.getActionImport(ContainerProvider.nameContainer, AIRT_COLL_CT_TWO_PRIM_PARAM));
- actionImports.add(prov.getActionImport(ContainerProvider.nameContainer, AIRTET_TWO_KEY_TWO_PRIM_PARAM));
- actionImports.add(prov.getActionImport(ContainerProvider.nameContainer, AIRT_COLL_ET_KEY_NAV_PARAM));
- actionImports.add(prov.getActionImport(ContainerProvider.nameContainer, AIRTES_ALL_PRIM_PARAM));
- actionImports.add(prov.getActionImport(ContainerProvider.nameContainer, AIRT_COLL_ES_ALL_PRIM_PARAM));
-
- // FunctionImports
- List<FunctionImport> functionImports = new ArrayList<FunctionImport>();
- container.setFunctionImports(functionImports);
- functionImports.add(prov.getFunctionImport(ContainerProvider.nameContainer, "FINRTInt16"));
- functionImports.add(prov.getFunctionImport(ContainerProvider.nameContainer, "FINInvisibleRTInt16"));
- functionImports.add(prov.getFunctionImport(ContainerProvider.nameContainer, "FINInvisible2RTInt16"));
- functionImports.add(prov.getFunctionImport(ContainerProvider.nameContainer, "FICRTETKeyNav"));
- functionImports.add(prov.getFunctionImport(ContainerProvider.nameContainer, "FICRTETTwoKeyNavParam"));
- functionImports.add(prov.getFunctionImport(ContainerProvider.nameContainer, "FICRTStringTwoParam"));
- functionImports.add(prov.getFunctionImport(ContainerProvider.nameContainer, "FICRTCollStringTwoParam"));
- functionImports.add(prov.getFunctionImport(ContainerProvider.nameContainer, "FICRTCTAllPrimTwoParam"));
- functionImports.add(prov.getFunctionImport(ContainerProvider.nameContainer, "FICRTESMixPrimCollCompTwoParam"));
- functionImports.add(prov.getFunctionImport(ContainerProvider.nameContainer, "FINRTESMixPrimCollCompTwoParam"));
- functionImports.add(prov.getFunctionImport(ContainerProvider.nameContainer, "FICRTCollCTTwoPrim"));
- functionImports.add(prov.getFunctionImport(ContainerProvider.nameContainer, "FICRTETMedia"));
- functionImports.add(prov.getFunctionImport(ContainerProvider.nameContainer, "FICRTCTTwoPrimParam"));
- functionImports.add(prov.getFunctionImport(ContainerProvider.nameContainer, "FICRTCTTwoPrim"));
- functionImports.add(prov.getFunctionImport(ContainerProvider.nameContainer, "FICRTCollString"));
- functionImports.add(prov.getFunctionImport(ContainerProvider.nameContainer, "FICRTString"));
- functionImports.add(prov.getFunctionImport(ContainerProvider.nameContainer, "FICRTESTwoKeyNavParam"));
- functionImports.add(prov.getFunctionImport(ContainerProvider.nameContainer, "FICRTCollCTTwoPrimParam"));
-
- return container;
- }
-
- public EntitySet getEntitySet(final FullQualifiedName entityContainer, final String name) throws ODataException {
- if (entityContainer == nameContainer) {
- if (name.equals("ESAllPrim")) {
- return new EntitySet()
- .setName("ESAllPrim")
- .setType(EntityTypeProvider.nameETAllPrim);
-
- } else if (name.equals("ESCollAllPrim")) {
- return new EntitySet()
- .setName("ESCollAllPrim")
- .setType(EntityTypeProvider.nameETCollAllPrim);
-
- } else if (name.equals("ESTwoPrim")) {
- return new EntitySet()
- .setName("ESTwoPrim")
- .setType(EntityTypeProvider.nameETTwoPrim);
-
- } else if (name.equals("ESMixPrimCollComp")) {
- return new EntitySet()
- .setName("ESMixPrimCollComp")
- .setType(EntityTypeProvider.nameETMixPrimCollComp);
-
- } else if (name.equals("ESBase")) {
- return new EntitySet()
- .setName("ESBase")
- .setType(EntityTypeProvider.nameETBase);
-
- } else if (name.equals("ESTwoBase")) {
- return new EntitySet()
- .setName("ESTwoBase")
- .setType(EntityTypeProvider.nameETTwoBase);
-
- } else if (name.equals("ESTwoKeyTwoPrim")) {
- return new EntitySet()
- .setName("ESTwoKeyTwoPrim")
- .setType(EntityTypeProvider.nameETTwoKeyTwoPrim);
-
- } else if (name.equals("ESBaseTwoKeyTwoPrim")) {
- return new EntitySet()
- .setName("ESBaseTwoKeyTwoPrim")
- .setType(EntityTypeProvider.nameETBaseTwoKeyTwoPrim);
-
- } else if (name.equals("ESTwoBaseTwoKeyTwoPrim")) {
- return new EntitySet()
- .setName("ESTwoBaseTwoKeyTwoPrim")
- .setType(EntityTypeProvider.nameETTwoBaseTwoKeyTwoPrim);
-
- } else if (name.equals("ESAllKey")) {
- return new EntitySet()
- .setName("ESAllKey")
- .setType(EntityTypeProvider.nameETAllKey);
-
- } else if (name.equals("ESCompAllPrim")) {
- return new EntitySet()
- .setName("ESCompAllPrim")
- .setType(EntityTypeProvider.nameETCompAllPrim);
-
- } else if (name.equals("ESCompCollAllPrim")) {
- return new EntitySet()
- .setName("ESCompCollAllPrim")
- .setType(EntityTypeProvider.nameETCompCollAllPrim);
-
- } else if (name.equals("ESCompComp")) {
- return new EntitySet()
- .setName("ESCompComp")
- .setType(EntityTypeProvider.nameETCompComp);
-
- } else if (name.equals("ESCompCollComp")) {
- return new EntitySet()
- .setName("ESCompCollComp")
- .setType(EntityTypeProvider.nameETCompCollComp);
-
- } else if (name.equals("ESMedia")) {
- return new EntitySet()
- .setName("ESMedia")
- .setType(EntityTypeProvider.nameETMedia)
- .setIncludeInServiceDocument(true);
-
- } else if (name.equals("ESKeyTwoKeyComp")) {
- return new EntitySet()
- .setName("ESKeyTwoKeyComp")
- .setType(EntityTypeProvider.nameETKeyTwoKeyComp);
-
- } else if (name.equals("ESInvisible")) {
- return new EntitySet()
- .setName("ESInvisible")
- .setType(EntityTypeProvider.nameETAllPrim);
-
- } else if (name.equals("ESServerSidePaging")) {
- return new EntitySet()
- .setName("ESServerSidePaging")
- .setType(EntityTypeProvider.nameETServerSidePaging);
-
- } else if (name.equals("ESAllNullable")) {
- return new EntitySet()
- .setName("ESAllNullable")
- .setType(EntityTypeProvider.nameETAllNullable);
-
- } else if (name.equals("ESKeyNav")) {
- return new EntitySet()
- .setName("ESKeyNav")
- .setType(EntityTypeProvider.nameETKeyNav);
-
- } else if (name.equals("ESTwoKeyNav")) {
- return new EntitySet()
- .setName("ESTwoKeyNav")
- .setType(EntityTypeProvider.nameETTwoKeyNav);
-
- } else if (name.equals("ESBaseTwoKeyNav")) {
- return new EntitySet()
- .setName("ESBaseTwoKeyNav")
- .setType(EntityTypeProvider.nameETBaseTwoKeyNav);
-
- } else if (name.equals("ESCompMixPrimCollComp")) {
- return new EntitySet()
- .setName("ESCompMixPrimCollComp")
- .setType(EntityTypeProvider.nameETCompMixPrimCollComp);
-
- } else if (name.equals("ESFourKeyAlias")) {
- return new EntitySet()
- .setName("ESFourKeyAlias")
- .setType(EntityTypeProvider.nameETFourKeyAlias);
-
- } else if (name.equals("ESMixEnumDefCollComp")) {
- return new EntitySet().setName("ESMixEnumDefCollComp").setType(
- EntityTypeProvider.nameETMixEnumDefCollComp);
- }
- }
-
- return null;
- }
-
- public ActionImport getActionImport(final FullQualifiedName entityContainer, final String name)
- throws ODataException {
- if (entityContainer.equals(nameContainer)) {
- if (name.equals(AIRT_STRING)) {
- return new ActionImport()
- .setName(AIRT_STRING)
- .setAction(ActionProvider.nameUARTString);
-
- } else if (name.equals(AIRT_COLL_STRING_TWO_PARAM)) {
- return new ActionImport()
- .setName(AIRT_COLL_STRING_TWO_PARAM)
- .setAction(ActionProvider.nameUARTCollStringTwoParam);
-
- } else if (name.equals(AIRTCT_TWO_PRIM_PARAM)) {
- return new ActionImport()
- .setName(AIRTCT_TWO_PRIM_PARAM)
- .setAction(ActionProvider.nameUARTCTTwoPrimParam);
-
- } else if (name.equals(AIRT_COLL_CT_TWO_PRIM_PARAM)) {
- return new ActionImport()
- .setName(AIRT_COLL_CT_TWO_PRIM_PARAM)
- .setAction(ActionProvider.nameUARTCollCTTwoPrimParam);
-
- } else if (name.equals(AIRTET_TWO_KEY_TWO_PRIM_PARAM)) {
- return new ActionImport()
- .setName(AIRTET_TWO_KEY_TWO_PRIM_PARAM)
- .setAction(ActionProvider.nameUARTETTwoKeyTwoPrimParam);
-
- } else if (name.equals(AIRT_COLL_ET_KEY_NAV_PARAM)) {
- return new ActionImport()
- .setName(AIRT_COLL_ET_KEY_NAV_PARAM)
- .setAction(ActionProvider.nameUARTCollETKeyNavParam);
-
- } else if (name.equals(AIRTES_ALL_PRIM_PARAM)) {
- return new ActionImport()
- .setName(AIRTES_ALL_PRIM_PARAM)
- .setAction(ActionProvider.nameUARTETAllPrimParam);
-
- } else if (name.equals(AIRT_COLL_ES_ALL_PRIM_PARAM)) {
- return new ActionImport()
- .setName(AIRT_COLL_ES_ALL_PRIM_PARAM)
- .setAction(ActionProvider.nameUARTCollETAllPrimParam);
- }
- }
-
- return null;
- }
-
- 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(FunctionProvider.nameUFNRTInt16)
- .setIncludeInServiceDocument(true);
-
- } else if (name.equals("FINInvisibleRTInt16")) {
- return new FunctionImport()
- .setName("FINInvisibleRTInt16")
- .setFunction(FunctionProvider.nameUFNRTInt16);
-
- } else if (name.equals("FINInvisible2RTInt16")) {
- return new FunctionImport()
- .setName("FINInvisible2RTInt16")
- .setFunction(FunctionProvider.nameUFNRTInt16);
-
- } else if (name.equals("FICRTETKeyNav")) {
- return new FunctionImport()
- .setName("FICRTETKeyNav")
- .setFunction(FunctionProvider.nameUFCRTETKeyNav);
-
- } else if (name.equals("FICRTETTwoKeyNavParam")) {
- return new FunctionImport()
- .setName("FICRTETTwoKeyNavParam")
- .setFunction(FunctionProvider.nameUFCRTETTwoKeyNavParam)
- .setIncludeInServiceDocument(true);
-
- } else if (name.equals("FICRTStringTwoParam")) {
- return new FunctionImport()
- .setName("FICRTStringTwoParam")
- .setFunction(FunctionProvider.nameUFCRTStringTwoParam)
- .setIncludeInServiceDocument(true);
-
- } else if (name.equals("FICRTCollStringTwoParam")) {
- return new FunctionImport()
- .setName("FICRTCollStringTwoParam")
- .setFunction(FunctionProvider.nameUFCRTCollStringTwoParam)
- .setIncludeInServiceDocument(true);
-
- } else if (name.equals("FICRTCTAllPrimTwoParam")) {
- return new FunctionImport()
- .setName("FICRTCTAllPrimTwoParam")
- .setFunction(FunctionProvider.nameUFCRTCTAllPrimTwoParam)
- .setIncludeInServiceDocument(true);
-
- } else if (name.equals("FICRTESMixPrimCollCompTwoParam")) {
- return new FunctionImport()
- .setName("FICRTESMixPrimCollCompTwoParam")
- .setFunction(FunctionProvider.nameUFCRTESMixPrimCollCompTwoParam)
- .setIncludeInServiceDocument(true);
-
- } else if (name.equals("FINRTESMixPrimCollCompTwoParam")) {
- return new FunctionImport()
- .setName("FINRTESMixPrimCollCompTwoParam")
- .setFunction(FunctionProvider.nameUFNRTESMixPrimCollCompTwoParam)
- .setIncludeInServiceDocument(true);
-
- } else if (name.equals("FICRTCollCTTwoPrim")) {
- return new FunctionImport()
- .setName("FICRTCollCTTwoPrim")
- .setFunction(FunctionProvider.nameUFCRTCollCTTwoPrim)
- .setIncludeInServiceDocument(true);
-
- } else if (name.equals("FICRTETMedia")) {
- return new FunctionImport()
- .setName("FICRTETMedia")
- .setFunction(FunctionProvider.nameUFCRTETMedia)
- .setIncludeInServiceDocument(true);
-
- } else if (name.equals("FICRTCTTwoPrimParam")) {
- return new FunctionImport()
- .setName("FICRTCTTwoPrimParam")
- .setFunction(FunctionProvider.nameUFCRTCTTwoPrimParam)
- .setIncludeInServiceDocument(true);
-
- } else if (name.equals("FICRTCTTwoPrim")) {
- return new FunctionImport()
- .setName("FICRTCTTwoPrim")
- .setFunction(FunctionProvider.nameUFCRTCTTwoPrim)
- .setIncludeInServiceDocument(true);
-
- } else if (name.equals("FICRTCollString")) {
- return new FunctionImport()
- .setName("FICRTCollString")
- .setFunction(FunctionProvider.nameUFCRTCollString)
- .setIncludeInServiceDocument(true);
-
- } else if (name.equals("FICRTString")) {
- return new FunctionImport()
- .setName("FICRTString")
- .setFunction(FunctionProvider.nameUFCRTString)
- .setIncludeInServiceDocument(true);
-
- } else if (name.equals("FICRTESTwoKeyNavParam")) {
- return new FunctionImport()
- .setName("FICRTESTwoKeyNavParam")
- .setFunction(FunctionProvider.nameUFCRTESTwoKeyNavParam)
- .setIncludeInServiceDocument(true);
-
- } else if (name.equals("FICRTCollCTTwoPrimParam")) {
- return new FunctionImport()
- .setName("FICRTCollCTTwoPrimParam")
- .setFunction(FunctionProvider.nameUFCRTCollCTTwoPrimParam)
- .setIncludeInServiceDocument(true);
-
- }
- }
-
- return null;
- }
-
- 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(EntityTypeProvider.nameETTwoPrim);
-
- } else if (name.equals("SINav")) {
- return new Singleton()
- .setName("SINav")
- .setType(EntityTypeProvider.nameETTwoKeyNav)
- .setNavigationPropertyBindings(Arrays.asList(
- new NavigationPropertyBinding()
- .setPath("NavPropertyETTwoKeyNavMany")
- .setTarget(new Target().setTargetName("ESTwoKeyNav"))));
-
- } else if (name.equals("SIMedia")) {
- return new Singleton()
- .setName("SIMedia")
- .setType(EntityTypeProvider.nameETMedia);
- }
- }
- return null;
- }
-}
diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/EdmTechProvider.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/EdmTechProvider.java
deleted file mode 100644
index aadc45b..0000000
--- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/EdmTechProvider.java
+++ /dev/null
@@ -1,155 +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.tecsvc.provider;
-
-import org.apache.olingo.commons.api.ODataException;
-import org.apache.olingo.server.api.edmx.EdmxReference;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-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.EntityContainer;
-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.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.Schema;
-import org.apache.olingo.server.api.edm.provider.Singleton;
-import org.apache.olingo.server.api.edm.provider.Term;
-import org.apache.olingo.server.api.edm.provider.TypeDefinition;
-
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-
-public class EdmTechProvider extends EdmProvider {
-
- public static final String nameSpace = "olingo.odata.test1";
-
- private final SchemaProvider schemaProvider;
- private final EntityTypeProvider entityTypeProvider;
- private final ContainerProvider containerProvider;
- private final ComplexTypeProvider complexTypeProvider;
- private final EnumTypeProvider enumTypeProvider;
- private final ActionProvider actionProvider;
- private final FunctionProvider functionProvider;
- private final TypeDefinitionProvider typeDefinitionProvider;
- private final List<EdmxReference> references;
-
- public EdmTechProvider() {
- this(Collections.<EdmxReference>emptyList());
- }
-
- public EdmTechProvider(List<EdmxReference> references) {
- containerProvider = new ContainerProvider(this);
- entityTypeProvider = new EntityTypeProvider();
- complexTypeProvider = new ComplexTypeProvider();
- enumTypeProvider = new EnumTypeProvider();
- actionProvider = new ActionProvider();
- functionProvider = new FunctionProvider();
- typeDefinitionProvider = new TypeDefinitionProvider();
- schemaProvider = new SchemaProvider(this);
- this.references = references;
- }
-
- @Override
- public List<AliasInfo> getAliasInfos() throws ODataException {
- return Arrays.asList(
- new AliasInfo().setAlias("Namespace1_Alias").setNamespace(nameSpace)
- );
- }
-
- @Override
- public EnumType getEnumType(final FullQualifiedName enumTypeName) throws ODataException {
- return enumTypeProvider.getEnumType(enumTypeName);
- }
-
- @Override
- public TypeDefinition getTypeDefinition(final FullQualifiedName typeDefinitionName) throws ODataException {
- return typeDefinitionProvider.getTypeDefinition(typeDefinitionName);
- }
-
- @Override
- public EntityType getEntityType(final FullQualifiedName entityTypeName) throws ODataException {
- return entityTypeProvider.getEntityType(entityTypeName);
- }
-
- @Override
- public ComplexType getComplexType(final FullQualifiedName complexTypeName) throws ODataException {
- return complexTypeProvider.getComplexType(complexTypeName);
- }
-
- @Override
- public List<Action> getActions(final FullQualifiedName actionName) throws ODataException {
- return actionProvider.getActions(actionName);
- }
-
- @Override
- public List<Function> getFunctions(final FullQualifiedName functionName) throws ODataException {
- return functionProvider.getFunctions(functionName);
- }
-
- @Override
- public Term getTerm(final FullQualifiedName termName) throws ODataException {
- return null;
- }
-
- @Override
- public EntitySet getEntitySet(final FullQualifiedName entityContainer, final String entitySetName)
- throws ODataException {
- return containerProvider.getEntitySet(entityContainer, entitySetName);
- }
-
- @Override
- public Singleton getSingleton(final FullQualifiedName entityContainer, final String singletonName)
- throws ODataException {
- return containerProvider.getSingleton(entityContainer, singletonName);
- }
-
- @Override
- public ActionImport getActionImport(final FullQualifiedName entityContainer, final String actionImportName)
- throws ODataException {
- return containerProvider.getActionImport(entityContainer, actionImportName);
- }
-
- @Override
- public FunctionImport getFunctionImport(final FullQualifiedName entityContainer, final String functionImportName)
- throws ODataException {
- return containerProvider.getFunctionImport(entityContainer, functionImportName);
- }
-
- @Override
- public List<Schema> getSchemas() throws ODataException {
- return schemaProvider.getSchemas();
- }
-
- @Override
- public EntityContainer getEntityContainer() throws ODataException {
- return containerProvider.getEntityContainer();
- }
-
- @Override
- public EntityContainerInfo getEntityContainerInfo(final FullQualifiedName entityContainerName) throws ODataException {
- return containerProvider.getEntityContainerInfo(entityContainerName);
- }
-}
diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/EntityTypeProvider.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/EntityTypeProvider.java
deleted file mode 100644
index 55ec15f..0000000
--- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/EntityTypeProvider.java
+++ /dev/null
@@ -1,441 +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.tecsvc.provider;
-
-import org.apache.olingo.commons.api.ODataException;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.server.api.edm.provider.EntityType;
-import org.apache.olingo.server.api.edm.provider.NavigationProperty;
-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 java.util.Arrays;
-
-public class EntityTypeProvider {
-
- public static final FullQualifiedName nameETAllKey = new FullQualifiedName(SchemaProvider.NAMESPACE, "ETAllKey");
- public static final FullQualifiedName nameETAllNullable = new FullQualifiedName(SchemaProvider.NAMESPACE,
- "ETAllNullable");
- public static final FullQualifiedName nameETAllPrim = new FullQualifiedName(SchemaProvider.NAMESPACE, "ETAllPrim");
- public static final FullQualifiedName nameETBase = new FullQualifiedName(SchemaProvider.NAMESPACE, "ETBase");
- public static final FullQualifiedName nameETBaseTwoKeyNav = new FullQualifiedName(SchemaProvider.NAMESPACE,
- "ETBaseTwoKeyNav");
- public static final FullQualifiedName nameETBaseTwoKeyTwoPrim =
- new FullQualifiedName(SchemaProvider.NAMESPACE, "ETBaseTwoKeyTwoPrim");
- public static final FullQualifiedName nameETCollAllPrim = new FullQualifiedName(SchemaProvider.NAMESPACE,
- "ETCollAllPrim");
- public static final FullQualifiedName nameETCompAllPrim = new FullQualifiedName(SchemaProvider.NAMESPACE,
- "ETCompAllPrim");
- public static final FullQualifiedName nameETCompCollAllPrim = new FullQualifiedName(SchemaProvider.NAMESPACE,
- "ETCompCollAllPrim");
- public static final FullQualifiedName nameETCompCollComp = new FullQualifiedName(SchemaProvider.NAMESPACE,
- "ETCompCollComp");
- public static final FullQualifiedName nameETCompComp = new FullQualifiedName(SchemaProvider.NAMESPACE, "ETCompComp");
- public static final FullQualifiedName nameETCompMixPrimCollComp =
- new FullQualifiedName(SchemaProvider.NAMESPACE, "ETCompMixPrimCollComp");
- public static final FullQualifiedName nameETFourKeyAlias = new FullQualifiedName(SchemaProvider.NAMESPACE,
- "ETFourKeyAlias");
- public static final FullQualifiedName nameETKeyNav = new FullQualifiedName(SchemaProvider.NAMESPACE, "ETKeyNav");
- public static final FullQualifiedName nameETKeyPrimNav = new FullQualifiedName(SchemaProvider.NAMESPACE,
- "ETKeyPrimNav");
- public static final FullQualifiedName nameETKeyTwoKeyComp = new FullQualifiedName(SchemaProvider.NAMESPACE,
- "ETKeyTwoKeyComp");
- public static final FullQualifiedName nameETMedia = new FullQualifiedName(SchemaProvider.NAMESPACE, "ETMedia");
- public static final FullQualifiedName nameETMixPrimCollComp = new FullQualifiedName(SchemaProvider.NAMESPACE,
- "ETMixPrimCollComp");
- public static final FullQualifiedName nameETServerSidePaging =
- new FullQualifiedName(SchemaProvider.NAMESPACE, "ETServerSidePaging");
- public static final FullQualifiedName nameETTwoBase = new FullQualifiedName(SchemaProvider.NAMESPACE, "ETTwoBase");
- public static final FullQualifiedName nameETTwoBaseTwoKeyNav =
- new FullQualifiedName(SchemaProvider.NAMESPACE, "ETTwoBaseTwoKeyNav");
- public static final FullQualifiedName nameETTwoBaseTwoKeyTwoPrim =
- new FullQualifiedName(SchemaProvider.NAMESPACE, "ETTwoBaseTwoKeyTwoPrim");
- public static final FullQualifiedName nameETTwoKeyNav =
- new FullQualifiedName(SchemaProvider.NAMESPACE, "ETTwoKeyNav");
- public static final FullQualifiedName nameETTwoKeyTwoPrim = new FullQualifiedName(SchemaProvider.NAMESPACE,
- "ETTwoKeyTwoPrim");
- public static final FullQualifiedName nameETTwoPrim = new FullQualifiedName(SchemaProvider.NAMESPACE, "ETTwoPrim");
- public static final FullQualifiedName nameETAbstract = new FullQualifiedName(SchemaProvider.NAMESPACE, "ETAbstract");
- public static final FullQualifiedName nameETAbstractBase = new FullQualifiedName(SchemaProvider.NAMESPACE,
- "ETAbstractBase");
-
- public static final FullQualifiedName nameETMixEnumDefCollComp = new FullQualifiedName(SchemaProvider.NAMESPACE,
- "ETMixEnumDefCollComp");
-
- 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(
- PropertyProvider.propertyInt16_NotNullable, PropertyProvider.propertyString,
- PropertyProvider.propertyBoolean, PropertyProvider.propertyByte, PropertyProvider.propertySByte,
- PropertyProvider.propertyInt32, PropertyProvider.propertyInt64,
- PropertyProvider.propertySingle, PropertyProvider.propertyDouble, PropertyProvider.propertyDecimal,
- PropertyProvider.propertyBinary, PropertyProvider.propertyDate, PropertyProvider.propertyDateTimeOffset,
- PropertyProvider.propertyDuration, PropertyProvider.propertyGuid, PropertyProvider.propertyTimeOfDay
- /* TODO add propertyStream */))
- .setNavigationProperties(Arrays.asList(PropertyProvider.navPropertyETTwoPrimOne_ETTwoPrim,
- PropertyProvider.collectionNavPropertyETTwoPrimMany_ETTwoPrim));
-
- } else if (entityTypeName.equals(nameETCollAllPrim)) {
- return new EntityType()
- .setName("ETCollAllPrim")
- .setKey(Arrays.asList(new PropertyRef().setPropertyName("PropertyInt16")))
-
- .setProperties(
- Arrays.asList(
- PropertyProvider.propertyInt16_NotNullable,
- PropertyProvider.collPropertyString_NotNullable,
- PropertyProvider.collPropertyBoolean, PropertyProvider.collPropertyByte,
- PropertyProvider.collPropertySByte,
- PropertyProvider.collPropertyInt16_NotNullable,
- PropertyProvider.collPropertyInt32, PropertyProvider.collPropertyInt64,
- PropertyProvider.collPropertySingle, PropertyProvider.collPropertyDouble,
- PropertyProvider.collPropertyDecimal, PropertyProvider.collPropertyBinary,
- PropertyProvider.collPropertyDate_NotNullable,
- PropertyProvider.collPropertyDateTimeOffset_NotNullable,
- PropertyProvider.collPropertyDuration_NotNullable,
- PropertyProvider.collPropertyGuid, PropertyProvider.collPropertyTimeOfDay
- /* TODO add propertyStream */));
-
- } else if (entityTypeName.equals(nameETTwoPrim)) {
- return new EntityType()
- .setName("ETTwoPrim")
- .setKey(Arrays.asList(new PropertyRef().setPropertyName("PropertyInt16")))
- .setProperties(Arrays.asList(
- PropertyProvider.propertyInt16_NotNullable, PropertyProvider.propertyString))
- .setNavigationProperties(
- Arrays.asList(PropertyProvider.navPropertyETAllPrimOne_ETAllPrim,
- PropertyProvider.collectionNavPropertyETAllPrimMany_ETAllPrim));
-
- } else if (entityTypeName.equals(nameETMixPrimCollComp)) {
- return new EntityType()
- .setName("ETMixPrimCollComp")
- .setKey(Arrays.asList(new PropertyRef().setPropertyName("PropertyInt16")))
- .setProperties(Arrays.asList(
- PropertyProvider.propertyInt16_NotNullable, PropertyProvider.collPropertyString,
- PropertyProvider.propertyComp_CTTwoPrim, PropertyProvider.collPropertyComp_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(
- PropertyProvider.propertyInt16_NotNullable, PropertyProvider.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(PropertyProvider.nameString)));
-
- } else if (entityTypeName.equals(nameETTwoBase)) {
- return new EntityType()
- .setName("ETTwoBase")
- .setBaseType(nameETBase)
- .setProperties(Arrays.asList(new Property()
- .setName("AdditionalPropertyString_6")
- .setType(PropertyProvider.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(
- PropertyProvider.propertyString_NotNullable, PropertyProvider.propertyBoolean_NotNullable,
- PropertyProvider.propertyByte_NotNullable, PropertyProvider.propertySByte_NotNullable,
- PropertyProvider.propertyInt16_NotNullable, PropertyProvider.propertyInt32_NotNullable,
- PropertyProvider.propertyInt64_NotNullable,
- PropertyProvider.propertyDecimal_NotNullable, PropertyProvider.propertyDate_NotNullable,
- PropertyProvider.propertyDateTimeOffset_NotNullable,
- PropertyProvider.propertyDuration_NotNullable, PropertyProvider.propertyGuid_NotNullable,
- PropertyProvider.propertyTimeOfDay_NotNullable /* TODO add propertyStream */));
-
- } else if (entityTypeName.equals(nameETCompAllPrim)) {
- return new EntityType()
- .setName("ETCompAllPrim")
- .setKey(Arrays.asList(new PropertyRef().setPropertyName("PropertyInt16")))
- .setProperties(
- Arrays.asList(PropertyProvider.propertyInt16_NotNullable, PropertyProvider.propertyComp_CTAllPrim));
-
- } else if (entityTypeName.equals(nameETCompCollAllPrim)) {
- return new EntityType()
- .setName("ETCompCollAllPrim")
- .setKey(Arrays.asList(new PropertyRef().setPropertyName("PropertyInt16")))
-
- .setProperties(
- Arrays.asList(PropertyProvider.propertyInt16_NotNullable,
- PropertyProvider.propertyComp_CTCollAllPrim));
-
- } else if (entityTypeName.equals(nameETCompComp)) {
- return new EntityType()
- .setName("ETCompComp")
- .setKey(Arrays.asList(new PropertyRef().setPropertyName("PropertyInt16")))
- .setProperties(
- Arrays.asList(PropertyProvider.propertyInt16_NotNullable, PropertyProvider.propertyComp_CTCompComp));
-
- } else if (entityTypeName.equals(nameETCompCollComp)) {
- return new EntityType()
- .setName("ETCompCollComp")
- .setKey(Arrays.asList(new PropertyRef().setPropertyName("PropertyInt16")))
- .setProperties(
- Arrays
- .asList(PropertyProvider.propertyInt16_NotNullable, PropertyProvider.propertyComp_CTCompCollComp));
-
- } else if (entityTypeName.equals(nameETMedia)) {
- return new EntityType()
- .setName("ETMedia")
- .setKey(Arrays.asList(new PropertyRef().setPropertyName("PropertyInt16")))
- .setProperties(Arrays.asList(PropertyProvider.propertyInt16_NotNullable))
- .setHasStream(true);
-
- } else if (entityTypeName.equals(nameETKeyTwoKeyComp)) {
- return new EntityType()
- .setName("ETKeyTwoKeyComp")
- .setKey(Arrays.asList(
- new PropertyRef()
- .setPropertyName("PropertyInt16"),
- new PropertyRef()
- .setPropertyName("PropertyComp/PropertyInt16")
- .setAlias("KeyAlias1"),
- new PropertyRef()
- .setPropertyName("PropertyComp/PropertyString")
- .setAlias("KeyAlias2"),
- new PropertyRef()
- .setPropertyName("PropertyCompComp/PropertyComp/PropertyString")
- .setAlias("KeyAlias3")))
- .setProperties(
- Arrays.asList(
- PropertyProvider.propertyInt16_NotNullable, PropertyProvider.propertyComp_CTTwoPrim,
- PropertyProvider.propertyCompComp_CTCompComp));
-
- } else if (entityTypeName.equals(nameETServerSidePaging)) {
- return new EntityType()
- .setName(nameETServerSidePaging.getName())
- .setKey(Arrays.asList(new PropertyRef().setPropertyName("PropertyInt16")))
- .setProperties(Arrays.asList(PropertyProvider.propertyInt16_NotNullable,
- PropertyProvider.propertyString_NotNullable));
-
- } 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(PropertyProvider.nameInt16).setNullable(false),
- PropertyProvider.propertyInt16_ExplicitNullable, PropertyProvider.propertyString_ExplicitNullable,
- PropertyProvider.propertyBoolean_ExplicitNullable, PropertyProvider.propertyByte_ExplicitNullable,
- PropertyProvider.propertySByte_ExplicitNullable, PropertyProvider.propertyInt32_ExplicitNullable,
- PropertyProvider.propertyInt64_ExplicitNullable, PropertyProvider.propertySingle_ExplicitNullable,
- PropertyProvider.propertyDouble_ExplicitNullable, PropertyProvider.propertyDecimal_ExplicitNullable,
- PropertyProvider.propertyBinary_ExplicitNullable, PropertyProvider.propertyDate_ExplicitNullable,
- PropertyProvider.propertyDateTimeOffset_ExplicitNullable,
- PropertyProvider.propertyDuration_ExplicitNullable, PropertyProvider.propertyGuid_ExplicitNullable,
- PropertyProvider.propertyTimeOfDay_ExplicitNullable /* TODO add propertyStream */,
- PropertyProvider.collPropertyString_ExplicitNullable,
- PropertyProvider.collPropertyBoolean_ExplicitNullable,
- PropertyProvider.collPropertyByte_ExplicitNullable,
- PropertyProvider.collPropertySByte_ExplicitNullable,
- PropertyProvider.collPropertyInt16_ExplicitNullable,
- PropertyProvider.collPropertyInt32_ExplicitNullable,
- PropertyProvider.collPropertyInt64_ExplicitNullable,
- PropertyProvider.collPropertySingle_ExplicitNullable,
- PropertyProvider.collPropertyDouble_ExplicitNullable,
- PropertyProvider.collPropertyDecimal_ExplicitNullable,
- PropertyProvider.collPropertyBinary_ExplicitNullable,
- PropertyProvider.collPropertyDate_ExplicitNullable,
- PropertyProvider.collPropertyDateTimeOffset_ExplicitNullable,
- PropertyProvider.collPropertyDuration_ExplicitNullable,
- PropertyProvider.collPropertyGuid_ExplicitNullable,
- PropertyProvider.collPropertyTimeOfDay_ExplicitNullable /* TODO add propertyStream */));
-
- } else if (entityTypeName.equals(nameETKeyNav)) {
- return new EntityType()
- .setName("ETKeyNav")
- .setKey(Arrays.asList(new PropertyRef().setPropertyName("PropertyInt16")))
- .setProperties(
- Arrays.asList(
- PropertyProvider.propertyInt16_NotNullable, PropertyProvider.propertyString_NotNullable,
- PropertyProvider.propertyComp_CTNavFiveProp,
- PropertyProvider.propertyCompAllPrim_CTAllPrim, PropertyProvider.propertyCompTwoPrim_CTTwoPrim,
- PropertyProvider.collPropertyString, PropertyProvider.collPropertyInt16,
- PropertyProvider.collPropertyComp_CTPrimComp,
- new Property()
- .setName("PropertyCompComp").setType(ComplexTypeProvider.nameCTCompNav)
- ))
- .setNavigationProperties(
- Arrays.asList(
- PropertyProvider.navPropertyETTwoKeyNavOne_ETTwoKeyNav_NotNullable,
- PropertyProvider.collectionNavPropertyETTwoKeyNavMany_ETTwoKeyNav,
- PropertyProvider.navPropertyETKeyNavOne_ETKeyNav,
- PropertyProvider.collectionNavPropertyETKeyNavMany_ETKeyNav,
- PropertyProvider.navPropertyETMediaOne_ETMedia,
- PropertyProvider.collectionNavPropertyETMediaMany_ETMedia
- ));
- } else if (entityTypeName.equals(nameETKeyPrimNav)) {
- return new EntityType()
- .setName("ETKeyPrimNav")
- .setKey(Arrays.asList(new PropertyRef().setPropertyName("PropertyInt16")))
- .setProperties(Arrays.asList(
- PropertyProvider.propertyInt16_NotNullable, PropertyProvider.propertyString_ExplicitNullable))
- .setNavigationProperties(
- Arrays.asList(
- PropertyProvider.navPropertyETKeyPrimNavOne_ETKeyPrimNav));
-
- } else if (entityTypeName.equals(nameETTwoKeyNav)) {
- return new EntityType()
- .setName("ETTwoKeyNav")
- .setKey(Arrays.asList(
- new PropertyRef().setPropertyName("PropertyInt16"),
- new PropertyRef().setPropertyName("PropertyString")))
- .setProperties(
- Arrays.asList(
- PropertyProvider.propertyInt16_NotNullable, PropertyProvider.propertyString_NotNullable,
- PropertyProvider.propertyComp_CTPrimComp_NotNullable,
- new Property().setName("PropertyCompNav").setType(ComplexTypeProvider.nameCTBasePrimCompNav)
- .setNullable(false),
- PropertyProvider.collPropertyComp_CTPrimComp,
- new Property().setName("CollPropertyCompNav").setType(ComplexTypeProvider.nameCTNavFiveProp)
- .setCollection(true),
- PropertyProvider.collPropertyString, PropertyProvider.propertyCompTwoPrim_CTTwoPrim
- ))
- .setNavigationProperties(Arrays.asList(
- new NavigationProperty()
- .setName("NavPropertyETKeyNavOne")
- .setType(nameETKeyNav)
- .setReferentialConstraints(Arrays.asList(
- new ReferentialConstraint()
- .setProperty("PropertyInt16")
- .setReferencedProperty("PropertyInt16"))),
- PropertyProvider.collectionNavPropertyETKeyNavMany_ETKeyNav,
- PropertyProvider.navPropertyETTwoKeyNavOne_ETTwoKeyNav,
- PropertyProvider.collectionNavPropertyETTwoKeyNavMany_ETTwoKeyNav));
-
- } else if (entityTypeName.equals(nameETBaseTwoKeyNav)) {
- return new EntityType()
- .setName("ETBaseTwoKeyNav")
- .setBaseType(nameETTwoKeyNav)
- .setProperties(Arrays.asList(PropertyProvider.propertyDate_ExplicitNullable))
- .setNavigationProperties(Arrays.asList(
- new NavigationProperty()
- .setName("NavPropertyETBaseTwoKeyNavOne")
- .setType(nameETBaseTwoKeyNav),
- new NavigationProperty()
- .setName("NavPropertyETTwoBaseTwoKeyNavOne")
- .setType(nameETTwoBaseTwoKeyNav)));
-
- } else if (entityTypeName.equals(nameETTwoBaseTwoKeyNav)) {
- return new EntityType()
- .setName("ETTwoBaseTwoKeyNav")
- .setBaseType(nameETBaseTwoKeyNav)
- .setKey(Arrays.asList(new PropertyRef().setPropertyName("PropertyInt16")))
- .setProperties(Arrays.asList(PropertyProvider.propertyGuid_ExplicitNullable))
- .setNavigationProperties(Arrays.asList(
- 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().setPath("PropertyComp/PropertyInt16").setPropertyName("PropertyInt16").setAlias(
- "KeyAlias1"),
- new PropertyRef().setPath("PropertyComp/PropertyString").setPropertyName("PropertyString")
- .setAlias("KeyAlias2"),
- new PropertyRef().setPath("PropertyCompComp/PropertyComp/PropertyString").setPropertyName(
- "PropertyString").setAlias("KeyAlias3"))).setProperties(
- Arrays.asList(PropertyProvider.propertyInt16_NotNullable, PropertyProvider.propertyComp_CTTwoPrim,
- PropertyProvider.propertyCompComp_CTCompComp));
- } else if (entityTypeName.equals(nameETCompMixPrimCollComp)) {
- return new EntityType()
- .setName("ETCompMixPrimCollComp")
- .setKey(Arrays.asList(
- new PropertyRef()
- .setPropertyName("PropertyInt16")))
- .setProperties(
- Arrays.asList(PropertyProvider.propertyInt16_NotNullable,
- PropertyProvider.propertyMixedPrimCollComp_CTMixPrimCollComp));
- } else if (entityTypeName.equals(nameETAbstract)) {
- return new EntityType()
- .setName("ETAbstract")
- .setAbstract(true)
- .setProperties(Arrays.asList(PropertyProvider.propertyString));
-
- } else if (entityTypeName.equals(nameETAbstractBase)) {
- return new EntityType()
- .setName("ETAbstractBase")
- .setBaseType(nameETAbstract)
- .setKey(Arrays.asList(new PropertyRef().setPropertyName("PropertyInt16")))
- .setProperties(Arrays.asList(
- PropertyProvider.propertyInt16_NotNullable));
- } else if (entityTypeName.equals(nameETMixEnumDefCollComp)) {
- return new EntityType()
- .setName(nameETMixEnumDefCollComp.getName())
- .setKey(Arrays.asList(new PropertyRef().setPropertyName("PropertyInt16")))
- .setProperties(Arrays.asList(
- PropertyProvider.propertyInt16_NotNullable,
- PropertyProvider.propertyEnumString_ENString,
- PropertyProvider.collPropertyEnumString_ENString,
- PropertyProvider.propertyTypeDefinition_TDString,
- PropertyProvider.collPropertyTypeDefinition_TDString,
- PropertyProvider.propertyComp_CTMixEnumTypeDefColl,
- PropertyProvider.propertyCompColl_CTMixEnumTypeDefColl));
- }
-
- return null;
- }
-}
diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/EnumTypeProvider.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/EnumTypeProvider.java
deleted file mode 100644
index 79bdcb4..0000000
--- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/EnumTypeProvider.java
+++ /dev/null
@@ -1,47 +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.tecsvc.provider;
-
-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.server.api.edm.provider.EnumMember;
-import org.apache.olingo.server.api.edm.provider.EnumType;
-
-import java.util.Arrays;
-
-public class EnumTypeProvider {
-
- public static final FullQualifiedName nameENString = new FullQualifiedName(SchemaProvider.NAMESPACE, "ENString");
-
- public EnumType getEnumType(final FullQualifiedName enumTypeName) throws ODataException {
- if (enumTypeName.equals(nameENString)) {
- return new EnumType()
- .setName("ENString")
- .setFlags(true)
- .setUnderlyingType(EdmPrimitiveTypeKind.Int16.getFullQualifiedName())
- .setMembers(Arrays.asList(
- new EnumMember().setName("String1").setValue("1"),
- new EnumMember().setName("String2").setValue("2"),
- new EnumMember().setName("String3").setValue("4")));
- }
-
- return null;
- }
-}
diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/FunctionProvider.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/FunctionProvider.java
deleted file mode 100644
index c4ee503..0000000
--- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/FunctionProvider.java
+++ /dev/null
@@ -1,852 +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.tecsvc.provider;
-
-import org.apache.olingo.commons.api.ODataException;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.server.api.edm.provider.Function;
-import org.apache.olingo.server.api.edm.provider.Parameter;
-import org.apache.olingo.server.api.edm.provider.ReturnType;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-public class FunctionProvider {
-
- // Bound Functions
- public static final FullQualifiedName nameBFCCollCTPrimCompRTESAllPrim =
- new FullQualifiedName(SchemaProvider.NAMESPACE, "BFCCollCTPrimCompRTESAllPrim");
-
- public static final FullQualifiedName nameBFCCollStringRTESTwoKeyNav =
- new FullQualifiedName(SchemaProvider.NAMESPACE, "BFCCollStringRTESTwoKeyNav");
-
- public static final FullQualifiedName nameBFCCTPrimCompRTESBaseTwoKeyNav =
- new FullQualifiedName(SchemaProvider.NAMESPACE, "BFCCTPrimCompRTESBaseTwoKeyNav");
-
- public static final FullQualifiedName nameBFCCTPrimCompRTESTwoKeyNav =
- new FullQualifiedName(SchemaProvider.NAMESPACE, "BFCCTPrimCompRTESTwoKeyNav");
-
- public static final FullQualifiedName nameBFCCTPrimCompRTESTwoKeyNavParam =
- new FullQualifiedName(SchemaProvider.NAMESPACE, "BFCCTPrimCompRTESTwoKeyNavParam");
-
- public static final FullQualifiedName nameBFCCTPrimCompRTETTwoKeyNavParam =
- new FullQualifiedName(SchemaProvider.NAMESPACE, "BFCCTPrimCompRTETTwoKeyNavParam");
-
- public static final FullQualifiedName nameBFCESAllPrimRTCTAllPrim =
- new FullQualifiedName(SchemaProvider.NAMESPACE, "BFCESAllPrimRTCTAllPrim");
-
- public static final FullQualifiedName nameBFCESBaseTwoKeyNavRTESBaseTwoKey =
- new FullQualifiedName(SchemaProvider.NAMESPACE, "BFCESBaseTwoKeyNavRTESBaseTwoKey");
-
- public static final FullQualifiedName nameBFCESKeyNavRTETKeyNav =
- new FullQualifiedName(SchemaProvider.NAMESPACE, "BFCESKeyNavRTETKeyNav");
-
- public static final FullQualifiedName nameBFCESKeyNavRTETKeyNavParam =
- new FullQualifiedName(SchemaProvider.NAMESPACE, "BFCESKeyNavRTETKeyNavParam");
-
- public static final FullQualifiedName nameBFCESTwoKeyNavRTCollCTTwoPrim =
- new FullQualifiedName(SchemaProvider.NAMESPACE, "BFCESTwoKeyNavRTCollCTTwoPrim");
-
- public static final FullQualifiedName nameBFCESTwoKeyNavRTCollString =
- new FullQualifiedName(SchemaProvider.NAMESPACE, "BFCESTwoKeyNavRTCollString");
-
- public static final FullQualifiedName nameBFCESTwoKeyNavRTCTTwoPrim =
- new FullQualifiedName(SchemaProvider.NAMESPACE, "BFCESTwoKeyNavRTCTTwoPrim");
-
- public static final FullQualifiedName nameBFCESTwoKeyNavRTESTwoKeyNav =
- new FullQualifiedName(SchemaProvider.NAMESPACE, "BFCESTwoKeyNavRTESTwoKeyNav");
-
- public static final FullQualifiedName nameBFCESTwoKeyNavRTString =
- new FullQualifiedName(SchemaProvider.NAMESPACE, "BFCESTwoKeyNavRTString");
-
- public static final FullQualifiedName nameBFCESTwoKeyNavRTStringParam =
- new FullQualifiedName(SchemaProvider.NAMESPACE, "BFCESTwoKeyNavRTStringParam");
-
- public static final FullQualifiedName nameBFCESTwoKeyNavRTTwoKeyNav =
- new FullQualifiedName(SchemaProvider.NAMESPACE, "BFCESTwoKeyNavRTTwoKeyNav");
-
- public static final FullQualifiedName nameBFCETBaseTwoKeyNavRTESBaseTwoKey =
- new FullQualifiedName(SchemaProvider.NAMESPACE, "BFCETBaseTwoKeyNavRTESBaseTwoKey");
-
- public static final FullQualifiedName nameBFCETBaseTwoKeyNavRTESTwoKeyNav =
- new FullQualifiedName(SchemaProvider.NAMESPACE, "BFCETBaseTwoKeyNavRTESTwoKeyNav");
-
- public static final FullQualifiedName nameBFCETBaseTwoKeyNavRTETTwoKeyNav =
- new FullQualifiedName(SchemaProvider.NAMESPACE, "BFCETBaseTwoKeyNavRTETTwoKeyNav");
-
- public static final FullQualifiedName nameBFCETKeyNavRTETKeyNav =
- new FullQualifiedName(SchemaProvider.NAMESPACE, "BFCETKeyNavRTETKeyNav");
-
- public static final FullQualifiedName nameBFCETTwoKeyNavRTCTTwoPrim =
- new FullQualifiedName(SchemaProvider.NAMESPACE, "BFCETTwoKeyNavRTCTTwoPrim");
-
- public static final FullQualifiedName nameBFCETTwoKeyNavRTESTwoKeyNav =
- new FullQualifiedName(SchemaProvider.NAMESPACE, "BFCETTwoKeyNavRTESTwoKeyNav");
-
- public static final FullQualifiedName nameBFCETTwoKeyNavRTETTwoKeyNav =
- new FullQualifiedName(SchemaProvider.NAMESPACE, "BFCETTwoKeyNavRTETTwoKeyNav");
-
- public static final FullQualifiedName nameBFCSINavRTESTwoKeyNav =
- new FullQualifiedName(SchemaProvider.NAMESPACE, "BFCSINavRTESTwoKeyNav");
-
- public static final FullQualifiedName nameBFCStringRTESTwoKeyNav =
- new FullQualifiedName(SchemaProvider.NAMESPACE, "BFCStringRTESTwoKeyNav");
-
- public static final FullQualifiedName nameBFESTwoKeyNavRTESTwoKeyNav =
- new FullQualifiedName(SchemaProvider.NAMESPACE, "BFESTwoKeyNavRTESTwoKeyNav");
-
- // Unbound Functions
- public static final FullQualifiedName nameUFCRTCollCTTwoPrim =
- new FullQualifiedName(SchemaProvider.NAMESPACE, "UFCRTCollCTTwoPrim");
- public static final FullQualifiedName nameUFCRTCollCTTwoPrimParam =
- new FullQualifiedName(SchemaProvider.NAMESPACE, "UFCRTCollCTTwoPrimParam");
- public static final FullQualifiedName nameUFCRTCollString = new FullQualifiedName(SchemaProvider.NAMESPACE,
- "UFCRTCollString");
- public static final FullQualifiedName nameUFCRTCollStringTwoParam =
- new FullQualifiedName(SchemaProvider.NAMESPACE, "UFCRTCollStringTwoParam");
- public static final FullQualifiedName nameUFCRTCTAllPrimTwoParam =
- new FullQualifiedName(SchemaProvider.NAMESPACE, "UFCRTCTAllPrimTwoParam");
- public static final FullQualifiedName nameUFCRTCTTwoPrim = new FullQualifiedName(SchemaProvider.NAMESPACE,
- "UFCRTCTTwoPrim");
- public static final FullQualifiedName nameUFCRTCTTwoPrimParam =
- new FullQualifiedName(SchemaProvider.NAMESPACE, "UFCRTCTTwoPrimParam");
- public static final FullQualifiedName nameUFCRTESMixPrimCollCompTwoParam =
- new FullQualifiedName(SchemaProvider.NAMESPACE, "UFCRTESMixPrimCollCompTwoParam");
- public static final FullQualifiedName nameUFCRTESTwoKeyNavParam =
- new FullQualifiedName(SchemaProvider.NAMESPACE, "UFCRTESTwoKeyNavParam");
- public static final FullQualifiedName nameUFCRTETAllPrimTwoParam =
- new FullQualifiedName(SchemaProvider.NAMESPACE, "UFCRTETAllPrimTwoParam");
- public static final FullQualifiedName nameUFCRTETKeyNav = new FullQualifiedName(SchemaProvider.NAMESPACE,
- "UFCRTETKeyNav");
- public static final FullQualifiedName nameUFCRTETMedia = new FullQualifiedName(SchemaProvider.NAMESPACE,
- "UFCRTETMedia");
-
- public static final FullQualifiedName nameUFCRTETTwoKeyNavParam =
- new FullQualifiedName(SchemaProvider.NAMESPACE, "UFCRTETTwoKeyNavParam");
-
- public static final FullQualifiedName nameUFCRTETTwoKeyNavParamCTTwoPrim =
- new FullQualifiedName(SchemaProvider.NAMESPACE, "UFCRTETTwoKeyNavParamCTTwoPrim");
-
- public static final FullQualifiedName nameUFCRTString =
- new FullQualifiedName(SchemaProvider.NAMESPACE, "UFCRTString");
-
- public static final FullQualifiedName nameUFCRTStringTwoParam =
- new FullQualifiedName(SchemaProvider.NAMESPACE, "UFCRTStringTwoParam");
-
- public static final FullQualifiedName nameUFNRTESMixPrimCollCompTwoParam =
- new FullQualifiedName(SchemaProvider.NAMESPACE, "UFNRTESMixPrimCollCompTwoParam");
- public static final FullQualifiedName nameUFNRTInt16 =
- new FullQualifiedName(SchemaProvider.NAMESPACE, "UFNRTInt16");
-
- public static final FullQualifiedName nameUFNRTCollCTNavFiveProp = new FullQualifiedName(SchemaProvider.NAMESPACE,
- "UFNRTCollCTNavFiveProp");
-
- public static final FullQualifiedName nameBFCESTwoKeyNavRTCTNavFiveProp = new FullQualifiedName(
- SchemaProvider.NAMESPACE, "BFCESTwoKeyNavRTCTNavFiveProp");
-
- public static final FullQualifiedName nameBFCESTwoKeyNavRTCollCTNavFiveProp = new FullQualifiedName(
- SchemaProvider.NAMESPACE, "BFCESTwoKeyNavRTCollCTNavFiveProp");
-
- public List<Function> getFunctions(final FullQualifiedName functionName) throws ODataException {
-
- if (functionName.equals(nameUFNRTInt16)) {
- return Arrays.asList(
- new Function()
- .setName("UFNRTInt16")
- .setParameters(new ArrayList<Parameter>())
- .setReturnType(
- new ReturnType().setType(PropertyProvider.nameInt16))
- );
-
- } else if (functionName.equals(nameUFCRTETKeyNav)) {
- return Arrays.asList(
- new Function()
- .setName("UFCRTETKeyNav")
- .setParameters(new ArrayList<Parameter>())
- .setComposable(true)
- .setReturnType(
- new ReturnType().setType(EntityTypeProvider.nameETKeyNav).setNullable(false))
- );
-
- } else if (functionName.equals(nameUFCRTETTwoKeyNavParam)) {
- return Arrays.asList(
- new Function()
- .setName("UFCRTETTwoKeyNavParam")
- .setParameters(Arrays.asList(
- new Parameter().setName("ParameterInt16").setType(PropertyProvider.nameInt16).setNullable(false)))
- .setComposable(true)
- .setReturnType(
- new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav).setNullable(false)
- )
- );
-
- } else if (functionName.equals(nameUFCRTETTwoKeyNavParamCTTwoPrim)) {
- return Arrays.asList(
- new Function()
- .setName("UFCRTETTwoKeyNavParamCTTwoPrim")
- .setParameters(Arrays.asList(
- new Parameter().setName("ParameterCTTwoPrim").setType(ComplexTypeProvider.nameCTTwoPrim)
- .setNullable(false)))
- .setComposable(true)
- .setReturnType(
- new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav).setNullable(false)
- )
- );
-
- } else if (functionName.equals(nameUFCRTStringTwoParam)) {
- return Arrays.asList(
- new Function()
- .setName("UFCRTStringTwoParam")
- .setParameters(Arrays.asList(
- new Parameter()
- .setName("ParameterInt16")
- .setType(PropertyProvider.nameInt16)
- .setNullable(false)))
- .setComposable(true)
- .setReturnType(
- new ReturnType().setType(PropertyProvider.nameString).setNullable(false)),
- new Function()
- .setName("UFCRTStringTwoParam")
- .setParameters(Arrays.asList(
- new Parameter()
- .setName("ParameterString")
- .setType(PropertyProvider.nameString)
- .setNullable(false),
- new Parameter()
- .setName("ParameterInt16")
- .setType(PropertyProvider.nameInt16)
- .setNullable(false)))
- .setComposable(true)
- .setReturnType(new ReturnType().setType(PropertyProvider.nameString).setNullable(false))
-
- );
-
- } else if (functionName.equals(nameUFCRTESTwoKeyNavParam)) {
- return Arrays.asList(
- new Function()
- .setName("UFCRTESTwoKeyNavParam")
- .setParameters(Arrays.asList(
- new Parameter()
- .setName("ParameterInt16")
- .setType(PropertyProvider.nameInt16)
- .setNullable(false)))
- .setComposable(true)
- .setReturnType(
- new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav).setCollection(true).setNullable(false))
- );
-
- } else if (functionName.equals(nameUFCRTString)) {
- return Arrays.asList(
- new Function()
- .setName("UFCRTString")
-
- .setComposable(true)
- .setParameters(new ArrayList<Parameter>())
- .setComposable(true)
- .setReturnType(
- new ReturnType().setType(PropertyProvider.nameString).setNullable(false)
- )
- );
-
- } else if (functionName.equals(nameUFCRTCollStringTwoParam)) {
- return Arrays.asList(
- new Function()
- .setName("UFCRTCollStringTwoParam")
- .setParameters(Arrays.asList(
- new Parameter().setName("ParameterString").setType(PropertyProvider.nameString).setNullable(false),
- new Parameter().setName("ParameterInt16").setType(PropertyProvider.nameInt16).setNullable(false)))
- .setComposable(true)
- .setReturnType(
- new ReturnType().setType(PropertyProvider.nameString).setCollection(true).setNullable(false))
- );
-
- } else if (functionName.equals(nameUFCRTCollString)) {
- return Arrays.asList(
- new Function()
- .setName("UFCRTCollString")
- .setParameters(new ArrayList<Parameter>())
- .setComposable(true)
- .setReturnType(
- new ReturnType().setType(PropertyProvider.nameString).setCollection(true).setNullable(false))
- );
-
- } else if (functionName.equals(nameUFCRTCTAllPrimTwoParam)) {
- return Arrays.asList(
- new Function()
- .setName("UFCRTCTAllPrimTwoParam")
- .setParameters(Arrays.asList(
- new Parameter().setName("ParameterString").setType(PropertyProvider.nameString).setNullable(false),
- new Parameter().setName("ParameterInt16").setType(PropertyProvider.nameInt16).setNullable(false)))
- .setComposable(true)
- .setReturnType(
- new ReturnType().setType(ComplexTypeProvider.nameCTAllPrim).setNullable(false))
- );
-
- } else if (functionName.equals(nameUFCRTCTTwoPrimParam)) {
- return Arrays.asList(
- new Function()
- .setName("UFCRTCTTwoPrimParam")
- .setParameters(Arrays.asList(
- new Parameter().setName("ParameterInt16").setType(PropertyProvider.nameInt16).setNullable(false),
- new Parameter().setName("ParameterString").setType(PropertyProvider.nameString).setNullable(true)))
- .setComposable(true)
- .setReturnType(
- new ReturnType().setType(ComplexTypeProvider.nameCTTwoPrim).setNullable(false))
- );
- } else if (functionName.equals(nameUFCRTCollCTTwoPrimParam)) {
- return Arrays.asList(
- new Function()
- .setName("UFCRTCollCTTwoPrimParam")
- .setParameters(Arrays.asList(
- new Parameter().setName("ParameterInt16").setType(PropertyProvider.nameInt16).setNullable(false),
- new Parameter().setName("ParameterString").setType(PropertyProvider.nameString).setNullable(true)))
- .setComposable(true)
- .setReturnType(
- new ReturnType().setType(ComplexTypeProvider.nameCTTwoPrim).setCollection(true).setNullable(false))
- );
-
- } else if (functionName.equals(nameUFCRTCTTwoPrim)) {
- return Arrays.asList(
- new Function()
- .setName("UFCRTCTTwoPrim")
- .setParameters(new ArrayList<Parameter>())
- .setComposable(true)
- .setReturnType(
- new ReturnType().setType(ComplexTypeProvider.nameCTTwoPrim).setNullable(false))
- );
-
- } else if (functionName.equals(nameUFCRTCollCTTwoPrim)) {
- return Arrays.asList(
- new Function()
- .setName("UFCRTCollCTTwoPrim")
- .setComposable(true)
- .setParameters(new ArrayList<Parameter>())
- .setReturnType(
- new ReturnType().setType(ComplexTypeProvider.nameCTTwoPrim).setCollection(true).setNullable(false))
- );
-
- } else if (functionName.equals(nameUFCRTETMedia)) {
- return Arrays.asList(
- new Function()
- .setName("UFCRTETMedia")
- .setParameters(new ArrayList<Parameter>())
- .setComposable(true)
- .setReturnType(
- new ReturnType().setType(EntityTypeProvider.nameETMedia).setNullable(false))
- );
-
- } else if (functionName.equals(nameUFNRTESMixPrimCollCompTwoParam)) {
- return Arrays.asList(
- new Function()
- .setName("UFNRTESMixPrimCollCompTwoParam")
- .setParameters(Arrays.asList(
- new Parameter().setName("ParameterString").setType(PropertyProvider.nameString).setNullable(false),
- new Parameter().setName("ParameterInt16").setType(PropertyProvider.nameInt16).setNullable(false)))
- .setComposable(false)
- .setReturnType(
- new ReturnType().setType(EntityTypeProvider.nameETMixPrimCollComp).setCollection(true)
- .setNullable(false))
- );
-
- } else if (functionName.equals(nameUFCRTETAllPrimTwoParam)) {
- return Arrays.asList(
- new Function()
- .setName("UFCRTETAllPrimTwoParam")
- .setParameters(Arrays.asList(
- new Parameter().setName("ParameterString").setType(PropertyProvider.nameString).setNullable(false),
- new Parameter().setName("ParameterInt16").setType(PropertyProvider.nameInt16).setNullable(false)))
- .setComposable(true)
- .setReturnType(
- new ReturnType().setType(EntityTypeProvider.nameETAllPrim).setNullable(false))
- );
-
- } else if (functionName.equals(nameUFCRTESMixPrimCollCompTwoParam)) {
- return Arrays.asList(
- new Function()
- .setName("UFCRTESMixPrimCollCompTwoParam")
- .setParameters(Arrays.asList(
- new Parameter().setName("ParameterString").setType(PropertyProvider.nameString).setNullable(false),
- new Parameter().setName("ParameterInt16").setType(PropertyProvider.nameInt16).setNullable(false)
- ))
- .setComposable(true)
- .setReturnType(
- new ReturnType().setType(EntityTypeProvider.nameETMixPrimCollComp).setCollection(true)
- .setNullable(false))
- );
-
- } else if (functionName.equals(nameUFNRTCollCTNavFiveProp)) {
- return Arrays.asList(
- new Function()
- .setName("UFNRTCollCTNavFiveProp")
- .setReturnType(
- new ReturnType().setType(ComplexTypeProvider.nameCTNavFiveProp).setCollection(true))
- );
- } else if (functionName.equals(nameBFCESTwoKeyNavRTESTwoKeyNav)) {
- return Arrays
- .asList(
- new Function()
- .setName("BFCESTwoKeyNavRTESTwoKeyNav")
- .setBound(true)
- .setParameters(
- Arrays.asList(
- new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETTwoKeyNav)
- .setCollection(true).setNullable(false)))
- .setComposable(true)
- .setReturnType(
- new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav).setCollection(true)
- .setNullable(false)),
-
- new Function()
- .setName("BFCESTwoKeyNavRTESTwoKeyNav")
- .setBound(true)
- .setParameters(
- Arrays.asList(
- new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETTwoKeyNav)
- .setCollection(true).setNullable(false),
- new Parameter().setName("ParameterString").setType(PropertyProvider.nameString)
- .setCollection(false).setNullable(false)))
- .setComposable(true)
- .setReturnType(
- new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav).setCollection(true)
- .setNullable(false)),
- new Function()
- .setName("BFCESTwoKeyNavRTESTwoKeyNav")
- .setBound(true)
- .setParameters(
- Arrays.asList(
- new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETKeyNav)
- .setCollection(true).setNullable(false)))
- .setComposable(true)
- .setReturnType(
- new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav).setCollection(true)
- .setNullable(false)),
- new Function()
- .setName("BFCESTwoKeyNavRTESTwoKeyNav")
- .setBound(true)
- .setParameters(
- Arrays.asList(new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETKeyNav)
- .setCollection(true).setNullable(false),
- new Parameter().setName("ParameterString").setType(PropertyProvider.nameString)
- .setCollection(false).setNullable(false)))
- .setComposable(true)
- .setReturnType(
- new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav).setCollection(true)
- .setNullable(false))
- );
-
- } else if (functionName.equals(nameBFCStringRTESTwoKeyNav)) {
- return Arrays.asList(
- new Function().setName("BFCStringRTESTwoKeyNav")
- .setBound(true)
- .setParameters(Arrays.asList(
- new Parameter().setName("BindingParam").setType(PropertyProvider.nameString).setNullable(false)))
- .setComposable(true)
- .setReturnType(
- new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav).setCollection(true).setNullable(false))
- );
-
- } else if (functionName.equals(nameBFCETBaseTwoKeyNavRTETTwoKeyNav)) {
- return Arrays.asList(
- new Function()
- .setName("BFCETBaseTwoKeyNavRTETTwoKeyNav")
- .setBound(true)
- .setParameters(Arrays.asList(
- new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETBaseTwoKeyNav)
- .setNullable(false)))
- .setComposable(true)
- .setReturnType(
- new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav).setNullable(false)
- )
- );
-
- } else if (functionName.equals(nameBFCESBaseTwoKeyNavRTESBaseTwoKey)) {
- return Arrays.asList(
- new Function()
- .setName("BFCESBaseTwoKeyNavRTESBaseTwoKey")
- .setBound(true)
- .setParameters(Arrays.asList(
- new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETBaseTwoKeyNav)
- .setCollection(true).setNullable(false)))
- .setComposable(true)
- .setReturnType(
- new ReturnType().setType(EntityTypeProvider.nameETBaseTwoKeyNav).setCollection(true)
- .setNullable(false))
- );
-
- } else if (functionName.equals(nameBFCESAllPrimRTCTAllPrim)) {
- return Arrays.asList(
- new Function()
- .setName("BFCESAllPrimRTCTAllPrim")
- .setBound(true)
- .setParameters(
- Arrays.asList(
- new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETAllPrim)
- .setCollection(true).setNullable(false)))
- .setComposable(true)
- .setReturnType(
- new ReturnType().setType(ComplexTypeProvider.nameCTAllPrim).setNullable(false))
- );
-
- } else if (functionName.equals(nameBFCESTwoKeyNavRTCTTwoPrim)) {
- return Arrays.asList(
- new Function()
- .setName("BFCESTwoKeyNavRTCTTwoPrim")
- .setBound(true)
- .setParameters(
- Arrays.asList(
- new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETTwoKeyNav)
- .setCollection(true).setNullable(false)))
- .setComposable(true)
- .setReturnType(
- new ReturnType().setType(ComplexTypeProvider.nameCTTwoPrim).setNullable(false))
- );
-
- } else if (functionName.equals(nameBFCESTwoKeyNavRTCollCTTwoPrim)) {
- return Arrays.asList(
- new Function()
- .setName("BFCESTwoKeyNavRTCollCTTwoPrim")
- .setBound(true)
- .setParameters(
- Arrays.asList(
- new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETTwoKeyNav)
- .setCollection(true).setNullable(false)))
- .setComposable(true)
- .setReturnType(
- new ReturnType().setType(ComplexTypeProvider.nameCTTwoPrim).setCollection(true).setNullable(false))
- );
-
- } else if (functionName.equals(nameBFCESTwoKeyNavRTString)) {
- return Arrays.asList(
- new Function()
- .setName("BFCESTwoKeyNavRTString")
- .setBound(true)
- .setParameters(
- Arrays.asList(
- new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETTwoKeyNav)
- .setCollection(true).setNullable(false)))
- .setComposable(true)
- .setReturnType(
- new ReturnType().setType(PropertyProvider.nameString).setNullable(false))
- );
-
- } else if (functionName.equals(nameBFCESTwoKeyNavRTCollString)) {
- return Arrays.asList(
- new Function()
- .setName("BFCESTwoKeyNavRTCollString")
- .setBound(true)
- .setParameters(
- Arrays.asList(
- new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETTwoKeyNav)
- .setCollection(true).setNullable(false)))
- .setComposable(true)
- .setReturnType(
- new ReturnType().setType(PropertyProvider.nameString).setCollection(true).setNullable(false))
- );
-
- } else if (functionName.equals(nameBFCETTwoKeyNavRTESTwoKeyNav)) {
- return Arrays.asList(
- new Function()
- .setName("BFCETTwoKeyNavRTESTwoKeyNav")
- .setBound(true)
- .setParameters(Arrays.asList(
- new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETTwoKeyNav)
- .setNullable(false)))
- .setComposable(true)
- .setReturnType(
- new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav).setCollection(true).setNullable(false))
- );
-
- } else if (functionName.equals(nameBFCETBaseTwoKeyNavRTESTwoKeyNav)) {
- return Arrays.asList(
- new Function()
- .setName("BFCETBaseTwoKeyNavRTESTwoKeyNav")
- .setBound(true)
- .setParameters(
- Arrays.asList(
- new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETBaseTwoKeyNav)
- .setNullable(false)))
- .setComposable(true)
- .setReturnType(
- new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav).setCollection(true).setNullable(false))
- );
-
- } else if (functionName.equals(nameBFCSINavRTESTwoKeyNav)) {
- return Arrays.asList(
- new Function()
- .setName("BFCSINavRTESTwoKeyNav")
- .setBound(true)
- .setParameters(
- Arrays.asList(
- new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETTwoKeyNav).setNullable(
- false)))
- .setComposable(true)
- .setReturnType(
- new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav).setCollection(true).setNullable(false))
- );
-
- } else if (functionName.equals(nameBFCETBaseTwoKeyNavRTESBaseTwoKey)) {
- return Arrays.asList(
- new Function()
- .setName("BFCETBaseTwoKeyNavRTESBaseTwoKey")
- .setBound(true)
- .setParameters(
- Arrays.asList(
- new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETBaseTwoKeyNav)
- .setNullable(false)))
- .setComposable(true)
- .setReturnType(
- new ReturnType().setType(EntityTypeProvider.nameETBaseTwoKeyNav).setCollection(true).setNullable(
- false))
- );
-
- } else if (functionName.equals(nameBFCCollStringRTESTwoKeyNav)) {
- return Arrays.asList(
- new Function()
- .setName("BFCCollStringRTESTwoKeyNav")
- .setBound(true)
- .setParameters(
- Arrays.asList(
- new Parameter().setName("BindingParam").setType(PropertyProvider.nameString).setCollection(true)
- .setNullable(false)))
- .setComposable(true)
- .setReturnType(
- new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav).setCollection(true).setNullable(false))
- );
-
- } else if (functionName.equals(nameBFCCTPrimCompRTESTwoKeyNav)) {
- return Arrays.asList(
- new Function()
- .setName("BFCCTPrimCompRTESTwoKeyNav")
- .setBound(true)
- .setParameters(
- Arrays.asList(
- new Parameter().setName("BindingParam").setType(ComplexTypeProvider.nameCTPrimComp).setNullable(
- false)))
- .setComposable(true)
- .setReturnType(
- new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav).setCollection(true).setNullable(false))
- );
-
- } else if (functionName.equals(nameBFCCTPrimCompRTESBaseTwoKeyNav)) {
- return Arrays.asList(
- new Function()
- .setName("BFCCTPrimCompRTESBaseTwoKeyNav")
- .setBound(true)
- .setParameters(
- Arrays.asList(
- new Parameter().setName("BindingParam").setType(ComplexTypeProvider.nameCTPrimComp).setNullable(
- false)))
- .setComposable(true)
- .setReturnType(
- new ReturnType().setType(EntityTypeProvider.nameETBaseTwoKeyNav).setCollection(true).setNullable(
- false))
- );
-
- } else if (functionName.equals(nameBFCCollCTPrimCompRTESAllPrim)) {
- return Arrays.asList(
- new Function()
- .setName("BFCCollCTPrimCompRTESAllPrim")
- .setBound(true)
- .setParameters(
- Arrays.asList(
- new Parameter().setName("BindingParam").setType(ComplexTypeProvider.nameCTPrimComp)
- .setCollection(true).setNullable(false)))
- .setComposable(true)
- .setReturnType(
- new ReturnType().setType(EntityTypeProvider.nameETAllPrim).setCollection(true).setNullable(false))
- );
-
- } else if (functionName.equals(nameBFCESTwoKeyNavRTTwoKeyNav)) {
- return Arrays.asList(
- new Function()
- .setName("BFCESTwoKeyNavRTTwoKeyNav")
- .setBound(true)
- .setParameters(
- Arrays.asList(
- new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETTwoKeyNav)
- .setCollection(true).setNullable(false)))
- .setComposable(true)
- .setReturnType(
- new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav).setNullable(false))
- );
-
- } else if (functionName.equals(nameBFCESKeyNavRTETKeyNav)) {
- return Arrays
- .asList(
- new Function()
- .setName("BFCESKeyNavRTETKeyNav")
- .setBound(true)
- .setParameters(
- Arrays.asList(
- new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETKeyNav).setCollection(
- true).setNullable(false)))
- .setComposable(true)
- .setReturnType(
- new ReturnType().setType(EntityTypeProvider.nameETKeyNav).setNullable(false))
- );
-
- } else if (functionName.equals(nameBFCETKeyNavRTETKeyNav)) {
- return Arrays.asList(
- new Function()
- .setName("BFCETKeyNavRTETKeyNav")
- .setBound(true)
- .setParameters(Arrays.asList(
- new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETKeyNav).setNullable(false)))
- .setComposable(true)
- .setReturnType(
- new ReturnType().setType(EntityTypeProvider.nameETKeyNav).setNullable(false))
- );
- } else if (functionName.equals(nameBFESTwoKeyNavRTESTwoKeyNav)) {
- return Arrays.asList(
- new Function()
- .setName("BFESTwoKeyNavRTESTwoKeyNav")
- .setBound(true)
- .setParameters(
- Arrays.asList(
- new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETTwoKeyNav)
- .setCollection(true).setNullable(false)))
- .setComposable(true)
- .setReturnType(
- new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav).setCollection(true).setNullable(false))
-
- );
-
- } else if (functionName.equals(nameBFCETTwoKeyNavRTETTwoKeyNav)) {
- return Arrays.asList(
- new Function()
- .setName("BFCETTwoKeyNavRTETTwoKeyNav")
- .setBound(true)
- .setParameters(
- Arrays.asList(
- new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETTwoKeyNav).setNullable(
- false)))
- .setComposable(true)
- .setReturnType(
- new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav).setNullable(false))
- );
-
- } else if (functionName.equals(nameBFCETTwoKeyNavRTCTTwoPrim)) {
- return Arrays.asList(
- new Function()
- .setName("BFCETTwoKeyNavRTCTTwoPrim")
- .setBound(true)
- .setParameters(
- Arrays.asList(
- new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETTwoKeyNav).setNullable(
- false)))
- .setComposable(true)
- .setReturnType(
- new ReturnType().setType(ComplexTypeProvider.nameCTTwoPrim).setNullable(false))
- );
- } else if (functionName.equals(nameBFCESTwoKeyNavRTCTNavFiveProp)) {
- return Arrays.asList(
- new Function()
- .setName("BFCESTwoKeyNavRTCTNavFiveProp")
- .setBound(true)
- .setParameters(
- Arrays.asList(
- new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETTwoKeyNav)
- .setCollection(true).setNullable(false)))
- .setComposable(true)
- .setReturnType(
- new ReturnType().setType(ComplexTypeProvider.nameCTNavFiveProp).setNullable(false))
- );
- } else if (functionName.equals(nameBFCESTwoKeyNavRTCollCTNavFiveProp)) {
- return Arrays.asList(
- new Function()
- .setName("BFCESTwoKeyNavRTCollCTNavFiveProp")
- .setBound(true)
- .setParameters(
- Arrays.asList(
- new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETTwoKeyNav)
- .setCollection(true).setNullable(false)))
- .setComposable(true)
- .setReturnType(
- new ReturnType().setType(ComplexTypeProvider.nameCTNavFiveProp).setCollection(true)
- .setNullable(false))
- );
- } else if (functionName.equals(nameBFCESTwoKeyNavRTStringParam)) {
- return Arrays.asList(
- new Function()
- .setName("BFCESTwoKeyNavRTStringParam")
- .setBound(true)
- .setParameters(
- Arrays.asList(
- new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETTwoKeyNav)
- .setCollection(true).setNullable(false),
- new Parameter().setName("ParameterComplex").setType(ComplexTypeProvider.nameCTTwoPrim)
- .setNullable(false)))
- .setComposable(true)
- .setReturnType(
- new ReturnType().setType(PropertyProvider.nameString).setNullable(false))
- );
-
- } else if (functionName.equals(nameBFCESKeyNavRTETKeyNavParam)) {
- return Arrays.asList(
- new Function()
- .setName("BFCESKeyNavRTETKeyNavParam")
- .setBound(true)
- .setParameters(
- Arrays.asList(
- new Parameter().setName("BindingParam").setType(EntityTypeProvider.nameETKeyNav).setCollection(
- true).setNullable(false),
- new Parameter().setName("ParameterString").setType(PropertyProvider.nameString)
- .setNullable(false)))
- .setComposable(true)
- .setReturnType(
- new ReturnType().setType(EntityTypeProvider.nameETKeyNav).setNullable(false))
- );
- } else if (functionName.equals(nameBFCCTPrimCompRTETTwoKeyNavParam)) {
- return Arrays.asList(
- new Function()
- .setName("BFCCTPrimCompRTETTwoKeyNavParam")
- .setBound(true)
- .setParameters(
- Arrays.asList(
- new Parameter().setName("BindingParam").setType(ComplexTypeProvider.nameCTPrimComp).setNullable(
- false),
- new Parameter().setName("ParameterString").setType(PropertyProvider.nameString)
- .setNullable(false)))
- .setComposable(true)
- .setReturnType(new ReturnType()
- .setType(EntityTypeProvider.nameETTwoKeyNav).setNullable(false)
- )
- );
- } else if (functionName.equals(nameBFCCTPrimCompRTESTwoKeyNavParam)) {
- return Arrays.asList(
- new Function()
- .setName("BFCCTPrimCompRTESTwoKeyNavParam")
- .setBound(true)
- .setParameters(
- Arrays.asList(
- new Parameter().setName("BindingParam").setType(ComplexTypeProvider.nameCTPrimComp).setNullable(
- false),
- new Parameter().setName("ParameterString").setType(PropertyProvider.nameString)
- .setNullable(false)))
- .setComposable(true)
- .setReturnType(
- new ReturnType().setType(EntityTypeProvider.nameETTwoKeyNav).setCollection(true).setNullable(false))
- );
- }
-
- return null;
- }
-
-}
diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/PropertyProvider.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/PropertyProvider.java
deleted file mode 100644
index 7b1ef0f..0000000
--- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/PropertyProvider.java
+++ /dev/null
@@ -1,707 +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.tecsvc.provider;
-
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.server.api.edm.provider.NavigationProperty;
-import org.apache.olingo.server.api.edm.provider.Property;
-
-public class PropertyProvider {
-
- // Primitive Type Names
- 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 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 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();
-
- // Primitive Properties --------------------------------------------------------------------------------------------
- public static final Property collPropertyBinary = new Property()
- .setName("CollPropertyBinary")
- .setType(nameBinary)
- .setCollection(true);
-
- public static final Property collPropertyBinary_ExplicitNullable = new Property()
- .setName("CollPropertyBinary")
- .setType(nameBinary)
- .setNullable(true)
- .setCollection(true);
-
- public static final Property collPropertyBinary_NotNullable = new Property()
- .setName("CollPropertyBinary")
- .setType(nameBinary)
- .setNullable(false)
- .setCollection(true);
-
- public static final Property collPropertyBoolean = new Property()
- .setName("CollPropertyBoolean")
- .setType(nameBoolean)
- .setCollection(true);
-
- public static final Property collPropertyBoolean_ExplicitNullable = new Property()
- .setName("CollPropertyBoolean")
- .setType(nameBoolean)
- .setNullable(true)
- .setCollection(true);
-
- public static final Property collPropertyBoolean_NotNullable = new Property()
- .setName("CollPropertyBoolean")
- .setType(nameBoolean)
- .setNullable(true)
- .setCollection(true);
-
- public static final Property collPropertyByte = new Property()
- .setName("CollPropertyByte")
- .setType(nameByte)
- .setCollection(true);
-
- public static final Property collPropertyByte_ExplicitNullable = new Property()
- .setName("CollPropertyByte")
- .setType(nameByte)
- .setNullable(true)
- .setCollection(true);
-
- public static final Property collPropertyByte_NotNullable = new Property()
- .setName("CollPropertyByte")
- .setType(nameByte)
- .setNullable(false)
- .setCollection(true);
-
- public static final Property collPropertyDate = new Property()
- .setName("CollPropertyDate")
- .setType(nameDate)
- .setCollection(true);
-
- public static final Property collPropertyDate_ExplicitNullable = new Property()
- .setName("CollPropertyDate")
- .setType(nameDate)
- .setNullable(true)
- .setCollection(true);
-
- public static final Property collPropertyDate_NotNullable = new Property()
- .setName("CollPropertyDate")
- .setType(nameDate)
- .setNullable(false)
- .setCollection(true);
-
- public static final Property collPropertyDateTimeOffset = new Property()
- .setName("CollPropertyDateTimeOffset")
- .setType(nameDateTimeOffset)
- .setCollection(true);
-
- public static final Property collPropertyDateTimeOffset_ExplicitNullable = new Property()
- .setName("CollPropertyDateTimeOffset")
- .setType(nameDateTimeOffset)
- .setNullable(true)
- .setCollection(true);
-
- public static final Property collPropertyDateTimeOffset_NotNullable = new Property()
- .setName("CollPropertyDateTimeOffset")
- .setType(nameDateTimeOffset)
- .setNullable(false)
- .setCollection(true);
-
- public static final Property collPropertyDecimal = new Property()
- .setName("CollPropertyDecimal")
- .setType(nameDecimal)
- .setCollection(true);
-
- public static final Property collPropertyDecimal_ExplicitNullable = new Property()
- .setName("CollPropertyDecimal")
- .setType(nameDecimal)
- .setNullable(true)
- .setCollection(true);
-
- public static final Property collPropertyDecimal_NotNullable = new Property()
- .setName("CollPropertyDecimal")
- .setType(nameDecimal)
- .setNullable(false)
- .setCollection(true);
-
- public static final Property collPropertyDouble = new Property()
- .setName("CollPropertyDouble")
- .setType(nameDouble)
- .setCollection(true);
-
- public static final Property collPropertyDouble_ExplicitNullable = new Property()
- .setName("CollPropertyDouble")
- .setType(nameDouble)
- .setNullable(true)
- .setCollection(true);
-
- public static final Property collPropertyDouble_NotNullable = new Property()
- .setName("CollPropertyDouble")
- .setType(nameDouble)
- .setNullable(false)
- .setCollection(true);
-
- public static final Property collPropertyDuration = new Property()
- .setName("CollPropertyDuration")
- .setType(nameDuration)
- .setCollection(true);
-
- public static final Property collPropertyDuration_ExplicitNullable = new Property()
- .setName("CollPropertyDuration")
- .setType(nameDuration)
- .setNullable(true)
- .setCollection(true);
-
- public static final Property collPropertyDuration_NotNullable = new Property()
- .setName("CollPropertyDuration")
- .setType(nameDuration)
- .setNullable(false)
- .setCollection(true);
-
- public static final Property collPropertyGuid = new Property()
- .setName("CollPropertyGuid")
- .setType(nameGuid)
- .setCollection(true);
-
- public static final Property collPropertyGuid_ExplicitNullable = new Property()
- .setName("CollPropertyGuid")
- .setType(nameGuid)
- .setNullable(true)
- .setCollection(true);
-
- public static final Property collPropertyGuid_NotNullable = new Property()
- .setName("CollPropertyGuid")
- .setType(nameGuid)
- .setNullable(false)
- .setCollection(true);
-
- public static final Property collPropertyInt16 = new Property()
- .setName("CollPropertyInt16")
- .setType(nameInt16)
- .setCollection(true);
-
- public static final Property collPropertyInt16_ExplicitNullable = new Property()
- .setName("CollPropertyInt16")
- .setType(nameInt16)
- .setNullable(true)
- .setCollection(true);
-
- public static final Property collPropertyInt16_NotNullable = new Property()
- .setName("CollPropertyInt16")
- .setType(nameInt16)
- .setNullable(false)
- .setCollection(true);
-
- public static final Property collPropertyInt32 = new Property()
- .setName("CollPropertyInt32")
- .setType(nameInt32)
- .setCollection(true);
-
- public static final Property collPropertyInt32_ExplicitNullable = new Property()
- .setName("CollPropertyInt32")
- .setType(nameInt32)
- .setNullable(true)
- .setCollection(true);
-
- public static final Property collPropertyInt32_NotNullable = new Property()
- .setName("CollPropertyInt32")
- .setType(nameInt32)
- .setNullable(false)
- .setCollection(true);
-
- public static final Property collPropertyInt64 = new Property()
- .setName("CollPropertyInt64")
- .setType(nameInt64)
- .setCollection(true);
-
- public static final Property collPropertyInt64_ExplicitNullable = new Property()
- .setName("CollPropertyInt64")
- .setType(nameInt64)
- .setNullable(true)
- .setCollection(true);
-
- public static final Property collPropertyInt64_NotNullable = new Property()
- .setName("CollPropertyInt64")
- .setType(nameInt64)
- .setNullable(false)
- .setCollection(true);
-
- public static final Property collPropertySByte = new Property()
- .setName("CollPropertySByte")
- .setType(nameSByte)
- .setCollection(true);
-
- public static final Property collPropertySByte_ExplicitNullable = new Property()
- .setName("CollPropertySByte")
- .setType(nameSByte)
- .setNullable(true)
- .setCollection(true);
-
- public static final Property collPropertySByte_NotNullable = new Property()
- .setName("CollPropertySByte")
- .setType(nameSByte)
- .setNullable(false)
- .setCollection(true);
-
- public static final Property collPropertySingle = new Property()
- .setName("CollPropertySingle")
- .setType(nameSingle)
- .setCollection(true);
-
- public static final Property collPropertySingle_ExplicitNullable = new Property()
- .setName("CollPropertySingle")
- .setType(nameSingle)
- .setNullable(true)
- .setCollection(true);
-
- public static final Property collPropertySingle_NotNullable = new Property()
- .setName("CollPropertySingle")
- .setType(nameSingle)
- .setNullable(false)
- .setCollection(true);
-
- public static final Property collPropertyString = new Property()
- .setName("CollPropertyString")
- .setType(nameString)
- .setCollection(true);
-
- public static final Property collPropertyString_ExplicitNullable = new Property()
- .setName("CollPropertyString")
- .setType(nameString)
- .setNullable(true)
- .setCollection(true);
-
- public static final Property collPropertyString_NotNullable = new Property()
- .setName("CollPropertyString")
- .setType(nameString)
- .setNullable(false)
- .setCollection(true);
-
- public static final Property collPropertyTimeOfDay = new Property()
- .setName("CollPropertyTimeOfDay")
- .setType(nameTimeOfDay)
- .setCollection(true);
-
- public static final Property collPropertyTimeOfDay_ExplicitNullable = new Property()
- .setName("CollPropertyTimeOfDay")
- .setType(nameTimeOfDay)
- .setNullable(true)
- .setCollection(true);
-
- public static final Property collPropertyTimeOfDay_NotNullable = new Property()
- .setName("CollPropertyTimeOfDay")
- .setType(nameTimeOfDay)
- .setNullable(false)
- .setCollection(true);
-
- public static final Property propertyBinary = new Property()
- .setName("PropertyBinary")
- .setType(nameBinary);
-
- public static final Property propertyBinary_NotNullable = new Property()
- .setName("PropertyBinary")
- .setType(nameBinary)
- .setNullable(false);
-
- public static final Property propertyBinary_ExplicitNullable = new Property()
- .setName("PropertyBinary")
- .setType(nameBinary)
- .setNullable(true);
-
- public static final Property propertyBoolean = new Property()
- .setName("PropertyBoolean")
- .setType(nameBoolean);
-
- public static final Property propertyBoolean_NotNullable = new Property()
- .setName("PropertyBoolean")
- .setType(nameBoolean)
- .setNullable(false);
-
- public static final Property propertyBoolean_ExplicitNullable = new Property()
- .setName("PropertyBoolean")
- .setType(nameBoolean)
- .setNullable(true);
-
- public static final Property propertyByte = new Property()
- .setName("PropertyByte")
- .setType(nameByte);
-
- public static final Property propertyByte_NotNullable = new Property()
- .setName("PropertyByte")
- .setType(nameByte)
- .setNullable(false);
-
- public static final Property propertyByte_ExplicitNullable = new Property()
- .setName("PropertyByte")
- .setType(nameByte)
- .setNullable(true);
-
- public static final Property propertyDate = new Property()
- .setName("PropertyDate")
- .setType(nameDate);
-
- public static final Property propertyDate_NotNullable = new Property()
- .setName("PropertyDate")
- .setType(nameDate)
- .setNullable(false);
-
- public static final Property propertyDate_ExplicitNullable = new Property()
- .setName("PropertyDate")
- .setType(nameDate)
- .setNullable(true);
-
- public static final Property propertyDateTimeOffset = new Property()
- .setName("PropertyDateTimeOffset")
- .setPrecision(20)
- .setType(nameDateTimeOffset);
-
- public static final Property propertyDateTimeOffset_NotNullable = new Property()
- .setName("PropertyDateTimeOffset")
- .setType(nameDateTimeOffset)
- .setNullable(false);
-
- public static final Property propertyDateTimeOffset_ExplicitNullable = new Property()
- .setName("PropertyDateTimeOffset")
- .setType(nameDateTimeOffset)
- .setNullable(true);
-
- public static final Property propertyDecimal = new Property()
- .setName("PropertyDecimal")
- .setScale(10)
- .setType(nameDecimal);
-
- public static final Property propertyDecimal_NotNullable = new Property()
- .setName("PropertyDecimal")
- .setType(nameDecimal)
- .setNullable(false);
-
- public static final Property propertyDecimal_ExplicitNullable = new Property()
- .setName("PropertyDecimal")
- .setType(nameDecimal)
- .setNullable(true);
-
- public static final Property propertyDouble = new Property()
- .setName("PropertyDouble")
- .setType(nameDouble);
-
- public static final Property propertyDouble_NotNullable = new Property()
- .setName("PropertyDouble")
- .setType(nameDouble)
- .setNullable(false);
-
- public static final Property propertyDouble_ExplicitNullable = new Property()
- .setName("PropertyDouble")
- .setType(nameDouble)
- .setNullable(true);
-
- public static final Property propertyDuration = new Property()
- .setName("PropertyDuration")
- .setType(nameDuration);
-
- public static final Property propertyDuration_NotNullable = new Property()
- .setName("PropertyDuration")
- .setType(nameDuration)
- .setNullable(false);
-
- public static final Property propertyDuration_ExplicitNullable = new Property()
- .setName("PropertyDuration")
- .setType(nameDuration)
- .setNullable(true);
-
- public static final Property propertyGuid = new Property()
- .setName("PropertyGuid")
- .setType(nameGuid);
-
- public static final Property propertyGuid_NotNullable = new Property()
- .setName("PropertyGuid")
- .setType(nameGuid)
- .setNullable(false);
-
- public static final Property propertyGuid_ExplicitNullable = new Property()
- .setName("PropertyGuid")
- .setType(nameGuid)
- .setNullable(true);
-
- public static final Property propertyInt16 = new Property()
- .setName("PropertyInt16")
- .setType(nameInt16);
-
- public static final Property propertyInt16_NotNullable = new Property()
- .setName("PropertyInt16")
- .setType(nameInt16)
- .setNullable(false);
-
- public static final Property propertyInt16_ExplicitNullable = new Property()
- .setName("PropertyInt16")
- .setType(nameInt16)
- .setNullable(true);
-
- public static final Property propertyInt32 = new Property()
- .setName("PropertyInt32")
- .setType(nameInt32);
-
- public static final Property propertyInt32_NotNullable = new Property()
- .setName("PropertyInt32")
- .setType(nameInt32)
- .setNullable(false);
-
- public static final Property propertyInt32_ExplicitNullable = new Property()
- .setName("PropertyInt32")
- .setType(nameInt32)
- .setNullable(true);
-
- public static final Property propertyInt64 = new Property()
- .setName("PropertyInt64")
- .setType(nameInt64);
-
- public static final Property propertyInt64_NotNullable = new Property()
- .setName("PropertyInt64")
- .setType(nameInt64)
- .setNullable(false);
-
- public static final Property propertyInt64_ExplicitNullable = new Property()
- .setName("PropertyInt64")
- .setType(nameInt64)
- .setNullable(true);
-
- public static final Property propertySByte = new Property()
- .setName("PropertySByte")
- .setType(nameSByte);
-
- public static final Property propertySByte_NotNullable = new Property()
- .setName("PropertySByte")
- .setType(nameSByte)
- .setNullable(false);
-
- public static final Property propertySByte_ExplicitNullable = new Property()
- .setName("PropertySByte")
- .setType(nameSByte)
- .setNullable(true);
-
- public static final Property propertySingle = new Property()
- .setName("PropertySingle")
- .setType(nameSingle);
-
- public static final Property propertySingle_NotNullable = new Property()
- .setName("PropertySingle")
- .setType(nameSingle)
- .setNullable(false);
-
- public static final Property propertySingle_ExplicitNullable = new Property()
- .setName("PropertySingle")
- .setType(nameSingle)
- .setNullable(true);
-
- public static final Property propertyString = new Property()
- .setName("PropertyString")
- .setType(nameString);
-
- public static final Property propertyString_NotNullable = new Property()
- .setName("PropertyString")
- .setType(nameString)
- .setNullable(false);
-
- public static final Property propertyString_ExplicitNullable = new Property()
- .setName("PropertyString")
- .setType(nameString)
- .setNullable(true);
-
- public static final Property propertyTimeOfDay = new Property()
- .setName("PropertyTimeOfDay")
- .setPrecision(10)
- .setType(nameTimeOfDay);
-
- public static final Property propertyTimeOfDay_NotNullable = new Property()
- .setName("PropertyTimeOfDay")
- .setType(nameTimeOfDay)
- .setNullable(false);
-
- public static final Property propertyTimeOfDay_ExplicitNullable = new Property()
- .setName("PropertyTimeOfDay")
- .setType(nameTimeOfDay)
- .setNullable(true);
-
- /*
- * TODO add propertyStream
- * Property propertyStream = new Property()
- * .setName("PropertyStream")
- * .setType(EdmStream.getFullQualifiedName());
- */
-
- // Complex Properties ----------------------------------------------------------------------------------------------
- public static final Property collPropertyComp_CTPrimComp = new Property()
- .setName("CollPropertyComp")
- .setType(ComplexTypeProvider.nameCTPrimComp)
- .setCollection(true);
-
- public static final Property collPropertyComp_CTTwoPrim = new Property()
- .setName("CollPropertyComp")
- .setType(ComplexTypeProvider.nameCTTwoPrim)
- .setCollection(true);
-
- public static final Property propertyComp_CTAllPrim = new Property()
- .setName("PropertyComp")
- .setType(ComplexTypeProvider.nameCTAllPrim);
-
- public static final Property propertyComp_CTCollAllPrim = new Property()
- .setName("PropertyComp")
- .setType(ComplexTypeProvider.nameCTCollAllPrim);
-
- public static final Property propertyComp_CTCompCollComp = new Property()
- .setName("PropertyComp")
- .setType(ComplexTypeProvider.nameCTCompCollComp);
-
- public static final Property propertyComp_CTCompComp = new Property()
- .setName("PropertyComp")
- .setType(ComplexTypeProvider.nameCTCompComp);
-
- public static final Property propertyComp_CTNavFiveProp = new Property()
- .setName("PropertyComp")
- .setType(ComplexTypeProvider.nameCTNavFiveProp);
-
- public static final Property propertyComp_CTPrimComp_NotNullable = new Property()
- .setName("PropertyComp")
- .setType(ComplexTypeProvider.nameCTPrimComp)
- .setNullable(false);
-
- public static final Property propertyComp_CTTwoPrim = new Property()
- .setName("PropertyComp")
- .setType(ComplexTypeProvider.nameCTTwoPrim);
-
- public static final Property propertyCompAllPrim_CTAllPrim = new Property()
- .setName("PropertyCompAllPrim")
- .setType(ComplexTypeProvider.nameCTAllPrim);
-
- public static final Property propertyCompComp_CTCompComp = new Property()
- .setName("PropertyCompComp")
- .setType(ComplexTypeProvider.nameCTCompComp);
-
- public static final Property propertyCompTwoPrim_CTTwoPrim = new Property()
- .setName("PropertyCompTwoPrim")
- .setType(ComplexTypeProvider.nameCTTwoPrim);
-
- public static final Property propertyMixedPrimCollComp_CTMixPrimCollComp = new Property()
- .setName("PropertyMixedPrimCollComp")
- .setType(ComplexTypeProvider.nameCTMixPrimCollComp);
-
- public static final Property propertyComp_CTMixEnumTypeDefColl = new Property()
- .setName("PropertyCompMixedEnumDef")
- .setType(ComplexTypeProvider.nameCTMixEnumDef);
-
- public static final Property propertyCompColl_CTMixEnumTypeDefColl = new Property()
- .setName("CollPropertyCompMixedEnumDef")
- .setType(ComplexTypeProvider.nameCTMixEnumDef)
- .setCollection(true);
-
- // Navigation Properties -------------------------------------------------------------------------------------------
- public static final NavigationProperty collectionNavPropertyETKeyNavMany_ETKeyNav = new NavigationProperty()
- .setName("NavPropertyETKeyNavMany")
- .setType(EntityTypeProvider.nameETKeyNav)
- .setCollection(true);
-
- public static final NavigationProperty collectionNavPropertyETMediaMany_ETMedia = new NavigationProperty()
- .setName("NavPropertyETMediaMany")
- .setType(EntityTypeProvider.nameETMedia)
- .setCollection(true);
-
- public static final NavigationProperty collectionNavPropertyETTwoKeyNavMany_ETTwoKeyNav = new NavigationProperty()
- .setName("NavPropertyETTwoKeyNavMany")
- .setType(EntityTypeProvider.nameETTwoKeyNav)
- .setCollection(true)
- .setPartner("NavPropertyETKeyNavOne");
-
- public static final NavigationProperty collectionNavPropertyETTwoKeyNavOne_ETTwoKeyNav = new NavigationProperty()
- .setName("NavPropertyETTwoKeyNavOne")
- .setType(EntityTypeProvider.nameETTwoKeyNav);
-
- public static final NavigationProperty collectionNavPropertyETTwoPrimMany_ETTwoPrim = new NavigationProperty()
- .setName("NavPropertyETTwoPrimMany")
- .setType(EntityTypeProvider.nameETTwoPrim)
- .setCollection(true)
- .setNullable(false);
-
- public static final NavigationProperty collectionNavPropertyETAllPrimMany_ETAllPrim = new NavigationProperty()
- .setName("NavPropertyETAllPrimMany")
- .setType(EntityTypeProvider.nameETAllPrim)
- .setCollection(true);
-
- public static final NavigationProperty navPropertyETKeyNavOne_ETKeyNav = new NavigationProperty()
- .setName("NavPropertyETKeyNavOne")
- .setType(EntityTypeProvider.nameETKeyNav);
-
- public static final NavigationProperty navPropertyETMediaOne_ETMedia = new NavigationProperty()
- .setName("NavPropertyETMediaOne")
- .setType(EntityTypeProvider.nameETMedia);
-
- public static final NavigationProperty navPropertyETKeyPrimNavOne_ETKeyPrimNav = new NavigationProperty()
- .setName("NavPropertyETKeyPrimNavOne")
- .setType(EntityTypeProvider.nameETKeyPrimNav);
-
- public static final NavigationProperty navPropertyETTwoKeyNavOne_ETTwoKeyNav_NotNullable = new NavigationProperty()
- .setName("NavPropertyETTwoKeyNavOne")
- .setType(EntityTypeProvider.nameETTwoKeyNav)
- .setNullable(false);
-
- public static final NavigationProperty navPropertyETTwoKeyNavOne_ETTwoKeyNav = new NavigationProperty()
- .setName("NavPropertyETTwoKeyNavOne")
- .setType(EntityTypeProvider.nameETTwoKeyNav);
-
- public static final NavigationProperty navPropertyETTwoPrimOne_ETTwoPrim = new NavigationProperty()
- .setName("NavPropertyETTwoPrimOne")
- .setType(EntityTypeProvider.nameETTwoPrim)
- .setNullable(false);
-
- public static final NavigationProperty navPropertyETAllPrimOne_ETAllPrim = new NavigationProperty()
- .setName("NavPropertyETAllPrimOne")
- .setType(EntityTypeProvider.nameETAllPrim);
-
- // EnumProperties --------------------------------------------------------------------------------------------------
- public static final Property propertyEnumString_ENString = new Property()
- .setName("PropertyEnumString")
- .setType(EnumTypeProvider.nameENString);
-
- public static final Property collPropertyEnumString_ENString = new Property()
- .setName("CollPropertyEnumString")
- .setType(EnumTypeProvider.nameENString)
- .setCollection(true);
-
- // TypeDefinition Properties ---------------------------------------------------------------------------------------
- public static final Property propertyTypeDefinition_TDString = new Property()
- .setName("PropertyDefString")
- .setType(TypeDefinitionProvider.nameTDString)
- .setMaxLength(15);
-
- public static final Property collPropertyTypeDefinition_TDString = new Property()
- .setName("CollPropertyDefString")
- .setType(TypeDefinitionProvider.nameTDString)
- .setMaxLength(15)
- .setCollection(true);
-}
diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/SchemaProvider.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/SchemaProvider.java
deleted file mode 100644
index 27e6a68..0000000
--- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/SchemaProvider.java
+++ /dev/null
@@ -1,185 +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.tecsvc.provider;
-
-import org.apache.olingo.commons.api.ODataException;
-import org.apache.olingo.server.api.edm.provider.Action;
-import org.apache.olingo.server.api.edm.provider.ComplexType;
-import org.apache.olingo.server.api.edm.provider.EntityType;
-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.Schema;
-import org.apache.olingo.server.api.edm.provider.TypeDefinition;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class SchemaProvider {
-
- private EdmTechProvider prov;
-
- public static final String NAMESPACE = "olingo.odata.test1";
-
- public SchemaProvider(final EdmTechProvider prov) {
- this.prov = prov;
- }
-
- public List<Schema> getSchemas() throws ODataException {
- List<Schema> schemas = new ArrayList<Schema>();
- Schema schema = new Schema();
- schema.setNamespace(NAMESPACE);
- schema.setAlias("Namespace1_Alias");
- schemas.add(schema);
- // EnumTypes
- List<EnumType> enumTypes = new ArrayList<EnumType>();
- schema.setEnumTypes(enumTypes);
- enumTypes.add(prov.getEnumType(EnumTypeProvider.nameENString));
- // EntityTypes
- List<EntityType> entityTypes = new ArrayList<EntityType>();
- schema.setEntityTypes(entityTypes);
-
- entityTypes.add(prov.getEntityType(EntityTypeProvider.nameETAllPrim));
- entityTypes.add(prov.getEntityType(EntityTypeProvider.nameETCollAllPrim));
- entityTypes.add(prov.getEntityType(EntityTypeProvider.nameETTwoPrim));
- entityTypes.add(prov.getEntityType(EntityTypeProvider.nameETMixPrimCollComp));
- entityTypes.add(prov.getEntityType(EntityTypeProvider.nameETTwoKeyTwoPrim));
- entityTypes.add(prov.getEntityType(EntityTypeProvider.nameETBase));
- entityTypes.add(prov.getEntityType(EntityTypeProvider.nameETTwoBase));
- entityTypes.add(prov.getEntityType(EntityTypeProvider.nameETAllKey));
- entityTypes.add(prov.getEntityType(EntityTypeProvider.nameETCompAllPrim));
- entityTypes.add(prov.getEntityType(EntityTypeProvider.nameETCompCollAllPrim));
- entityTypes.add(prov.getEntityType(EntityTypeProvider.nameETCompComp));
- entityTypes.add(prov.getEntityType(EntityTypeProvider.nameETCompCollComp));
- entityTypes.add(prov.getEntityType(EntityTypeProvider.nameETMedia));
- entityTypes.add(prov.getEntityType(EntityTypeProvider.nameETFourKeyAlias));
- entityTypes.add(prov.getEntityType(EntityTypeProvider.nameETServerSidePaging));
- entityTypes.add(prov.getEntityType(EntityTypeProvider.nameETAllNullable));
- entityTypes.add(prov.getEntityType(EntityTypeProvider.nameETKeyNav));
- entityTypes.add(prov.getEntityType(EntityTypeProvider.nameETTwoKeyNav));
- entityTypes.add(prov.getEntityType(EntityTypeProvider.nameETBaseTwoKeyNav));
- entityTypes.add(prov.getEntityType(EntityTypeProvider.nameETTwoBaseTwoKeyNav));
- entityTypes.add(prov.getEntityType(EntityTypeProvider.nameETCompMixPrimCollComp));
- entityTypes.add(prov.getEntityType(EntityTypeProvider.nameETKeyPrimNav));
- entityTypes.add(prov.getEntityType(EntityTypeProvider.nameETAbstract));
- entityTypes.add(prov.getEntityType(EntityTypeProvider.nameETAbstractBase));
- entityTypes.add(prov.getEntityType(EntityTypeProvider.nameETMixEnumDefCollComp));
-
- // ComplexTypes
- List<ComplexType> complexType = new ArrayList<ComplexType>();
- schema.setComplexTypes(complexType);
- complexType.add(prov.getComplexType(ComplexTypeProvider.nameCTPrim));
- complexType.add(prov.getComplexType(ComplexTypeProvider.nameCTAllPrim));
- complexType.add(prov.getComplexType(ComplexTypeProvider.nameCTCollAllPrim));
- complexType.add(prov.getComplexType(ComplexTypeProvider.nameCTTwoPrim));
- complexType.add(prov.getComplexType(ComplexTypeProvider.nameCTMixPrimCollComp));
- complexType.add(prov.getComplexType(ComplexTypeProvider.nameCTBase));
- complexType.add(prov.getComplexType(ComplexTypeProvider.nameCTTwoBase));
- complexType.add(prov.getComplexType(ComplexTypeProvider.nameCTCompComp));
- complexType.add(prov.getComplexType(ComplexTypeProvider.nameCTCompCollComp));
- complexType.add(prov.getComplexType(ComplexTypeProvider.nameCTPrimComp));
- complexType.add(prov.getComplexType(ComplexTypeProvider.nameCTNavFiveProp));
- complexType.add(prov.getComplexType(ComplexTypeProvider.nameCTBasePrimCompNav));
- complexType.add(prov.getComplexType(ComplexTypeProvider.nameCTTwoBasePrimCompNav));
- complexType.add(prov.getComplexType(ComplexTypeProvider.nameCTCompNav));
- complexType.add(prov.getComplexType(ComplexTypeProvider.nameCTMixEnumDef));
-
- // TypeDefinitions
- List<TypeDefinition> typeDefinitions = new ArrayList<TypeDefinition>();
- schema.setTypeDefinitions(typeDefinitions);
- typeDefinitions.add(prov.getTypeDefinition(TypeDefinitionProvider.nameTDString));
-
- // Actions
- List<Action> actions = new ArrayList<Action>();
- schema.setActions(actions);
- actions.addAll(prov.getActions(ActionProvider.nameBAETTwoKeyNavRTETTwoKeyNav));
- actions.addAll(prov.getActions(ActionProvider.nameBAESAllPrimRTETAllPrim));
- actions.addAll(prov.getActions(ActionProvider.nameBAESTwoKeyNavRTESTwoKeyNav));
- actions.addAll(prov.getActions(ActionProvider.nameBAETBaseTwoKeyNavRTETBaseTwoKeyNav));
- actions.addAll(prov.getActions(ActionProvider.nameBAETTwoBaseTwoKeyNavRTETBaseTwoKeyNav));
- actions.addAll(prov.getActions(ActionProvider.nameUARTString));
- actions.addAll(prov.getActions(ActionProvider.nameUARTCollStringTwoParam));
- actions.addAll(prov.getActions(ActionProvider.nameUARTCTTwoPrimParam));
- actions.addAll(prov.getActions(ActionProvider.nameUARTCollCTTwoPrimParam));
- actions.addAll(prov.getActions(ActionProvider.nameUARTETTwoKeyTwoPrimParam));
- actions.addAll(prov.getActions(ActionProvider.nameUARTCollETKeyNavParam));
- actions.addAll(prov.getActions(ActionProvider.nameUARTETAllPrimParam));
- actions.addAll(prov.getActions(ActionProvider.nameUARTCollETAllPrimParam));
-
- // Functions
- List<Function> functions = new ArrayList<Function>();
- schema.setFunctions(functions);
-
- functions.addAll(prov.getFunctions(FunctionProvider.nameUFNRTInt16));
- functions.addAll(prov.getFunctions(FunctionProvider.nameUFCRTETKeyNav));
- functions.addAll(prov.getFunctions(FunctionProvider.nameUFCRTETTwoKeyNavParam));
- functions.addAll(prov.getFunctions(FunctionProvider.nameUFCRTETTwoKeyNavParamCTTwoPrim));
- functions.addAll(prov.getFunctions(FunctionProvider.nameUFCRTStringTwoParam));
- functions.addAll(prov.getFunctions(FunctionProvider.nameUFCRTESTwoKeyNavParam));
- functions.addAll(prov.getFunctions(FunctionProvider.nameUFCRTString));
- functions.addAll(prov.getFunctions(FunctionProvider.nameUFCRTCollStringTwoParam));
- functions.addAll(prov.getFunctions(FunctionProvider.nameUFCRTCollString));
- functions.addAll(prov.getFunctions(FunctionProvider.nameUFCRTCTAllPrimTwoParam));
- functions.addAll(prov.getFunctions(FunctionProvider.nameUFCRTCTTwoPrimParam));
- functions.addAll(prov.getFunctions(FunctionProvider.nameUFCRTCollCTTwoPrimParam));
- functions.addAll(prov.getFunctions(FunctionProvider.nameUFCRTCTTwoPrim));
- functions.addAll(prov.getFunctions(FunctionProvider.nameUFCRTCollCTTwoPrim));
- functions.addAll(prov.getFunctions(FunctionProvider.nameUFCRTETMedia));
- functions.addAll(prov.getFunctions(FunctionProvider.nameUFNRTESMixPrimCollCompTwoParam));
- functions.addAll(prov.getFunctions(FunctionProvider.nameUFCRTETAllPrimTwoParam));
- functions.addAll(prov.getFunctions(FunctionProvider.nameUFCRTESMixPrimCollCompTwoParam));
- functions.addAll(prov.getFunctions(FunctionProvider.nameUFNRTCollCTNavFiveProp));
- functions.addAll(prov.getFunctions(FunctionProvider.nameBFCESTwoKeyNavRTESTwoKeyNav));
- functions.addAll(prov.getFunctions(FunctionProvider.nameBFCStringRTESTwoKeyNav));
- functions.addAll(prov.getFunctions(FunctionProvider.nameBFCETBaseTwoKeyNavRTETTwoKeyNav));
- functions.addAll(prov.getFunctions(FunctionProvider.nameBFCESBaseTwoKeyNavRTESBaseTwoKey));
- functions.addAll(prov.getFunctions(FunctionProvider.nameBFCESAllPrimRTCTAllPrim));
- functions.addAll(prov.getFunctions(FunctionProvider.nameBFCESTwoKeyNavRTCTTwoPrim));
- functions.addAll(prov.getFunctions(FunctionProvider.nameBFCESTwoKeyNavRTCollCTTwoPrim));
- functions.addAll(prov.getFunctions(FunctionProvider.nameBFCESTwoKeyNavRTString));
- functions.addAll(prov.getFunctions(FunctionProvider.nameBFCESTwoKeyNavRTCollString));
- functions.addAll(prov.getFunctions(FunctionProvider.nameBFCETTwoKeyNavRTESTwoKeyNav));
- functions.addAll(prov.getFunctions(FunctionProvider.nameBFCETBaseTwoKeyNavRTESTwoKeyNav));
- functions.addAll(prov.getFunctions(FunctionProvider.nameBFCSINavRTESTwoKeyNav));
- functions.addAll(prov.getFunctions(FunctionProvider.nameBFCETBaseTwoKeyNavRTESBaseTwoKey));
- functions.addAll(prov.getFunctions(FunctionProvider.nameBFCCollStringRTESTwoKeyNav));
- functions.addAll(prov.getFunctions(FunctionProvider.nameBFCCTPrimCompRTESTwoKeyNav));
- functions.addAll(prov.getFunctions(FunctionProvider.nameBFCCTPrimCompRTESBaseTwoKeyNav));
- functions.addAll(prov.getFunctions(FunctionProvider.nameBFCCollCTPrimCompRTESAllPrim));
- functions.addAll(prov.getFunctions(FunctionProvider.nameBFCESTwoKeyNavRTTwoKeyNav));
- functions.addAll(prov.getFunctions(FunctionProvider.nameBFCESKeyNavRTETKeyNav));
- functions.addAll(prov.getFunctions(FunctionProvider.nameBFCETKeyNavRTETKeyNav));
- functions.addAll(prov.getFunctions(FunctionProvider.nameBFESTwoKeyNavRTESTwoKeyNav));
- functions.addAll(prov.getFunctions(FunctionProvider.nameBFCETTwoKeyNavRTETTwoKeyNav));
- functions.addAll(prov.getFunctions(FunctionProvider.nameBFCETTwoKeyNavRTCTTwoPrim));
-
- functions.addAll(prov.getFunctions(FunctionProvider.nameBFCESTwoKeyNavRTCTNavFiveProp));
- functions.addAll(prov.getFunctions(FunctionProvider.nameBFCESTwoKeyNavRTCollCTNavFiveProp));
-
- functions.addAll(prov.getFunctions(FunctionProvider.nameBFCESTwoKeyNavRTStringParam));
- functions.addAll(prov.getFunctions(FunctionProvider.nameBFCESKeyNavRTETKeyNavParam));
- functions.addAll(prov.getFunctions(FunctionProvider.nameBFCCTPrimCompRTETTwoKeyNavParam));
- // functions.addAll(prov.getFunctions(FunctionProvider.nameBFCCTPrimCompRTESTwoKeyNavParam));
-
- // EntityContainer
- schema.setEntityContainer(prov.getEntityContainer());
-
- return schemas;
- }
-
-}
diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/TypeDefinitionProvider.java b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/TypeDefinitionProvider.java
deleted file mode 100644
index 242c44f..0000000
--- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/provider/TypeDefinitionProvider.java
+++ /dev/null
@@ -1,37 +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.tecsvc.provider;
-
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.server.api.edm.provider.TypeDefinition;
-
-public class TypeDefinitionProvider {
-
- public static final FullQualifiedName nameTDString = new FullQualifiedName(SchemaProvider.NAMESPACE, "TDString");
-
- public TypeDefinition getTypeDefinition(final FullQualifiedName typeDefinitionName) {
- if (nameTDString.equals(typeDefinitionName)) {
- return new TypeDefinition().setName(nameTDString.getName()).setUnderlyingType(
- EdmPrimitiveTypeKind.String.getFullQualifiedName());
- }
- return null;
- }
-
-}
diff --git a/lib/server-tecsvc/src/main/resources/META-INF/LICENSE b/lib/server-tecsvc/src/main/resources/META-INF/LICENSE
deleted file mode 100644
index 715ff30..0000000
--- a/lib/server-tecsvc/src/main/resources/META-INF/LICENSE
+++ /dev/null
@@ -1,331 +0,0 @@
-Licenses for TecSvc artifact
-
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
-TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
-1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
-2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
-3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
-4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
-5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
-6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
-7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
-8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
-9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
-END OF TERMS AND CONDITIONS
-
-APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
-Copyright [yyyy] [name of copyright owner]
-
-Licensed 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.
-
-
-From: 'abego Software GmbH, Germany' (http://abego-software.de) - abego
-TreeLayout Core (http://code.google.com/p/treelayout/)
-org.abego.treelayout:org.abego.treelayout.core:jar:1.0.1 License: BSD 3-Clause
-"New" or "Revised" License (BSD-3-Clause)
-(http://treelayout.googlecode.com/files/LICENSE.TXT)
-
-[The "BSD license"]
-Copyright (c) 2011, abego Software GmbH, Germany (http://www.abego.org)
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
-1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-3. Neither the name of the abego Software GmbH nor the names of its
- contributors may be used to endorse or promote products derived from this
- software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGE.
-
-
-From: 'ANTLR' (http://www.antlr.org) - ANTLR 4 Runtime
-(http://www.antlr.org/antlr4-runtime) org.antlr:antlr4-runtime:jar:4.1 License:
-The BSD License (http://www.antlr.org/license.html)
-
-[The BSD License]
-Copyright (c) 2012 Terence Parr and Sam Harwell
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- Redistributions of source code must retain the above copyright notice, this
- list of conditions and the following disclaimer. Redistributions in binary
- form must reproduce the above copyright notice, this list of conditions and
- the following disclaimer in the documentation and/or other materials
- provided with the distribution. Neither the name of the author nor the
- names of its contributors may be used to endorse or promote products
- derived from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
-ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-
-From: 'fasterxml.com' (http://fasterxml.com) - Stax2 API
-(http://wiki.fasterxml.com/WoodstoxStax2)
-org.codehaus.woodstox:stax2-api:bundle:3.1.4 License: The BSD License
-(http://www.opensource.org/licenses/bsd-license.php)
-
-Copyright (c) 2004-2010, Woodstox Project (http://woodstox.codehaus.org/)
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
-1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-3. Neither the name of the Woodstox XML Processor nor the names
- of its contributors may be used to endorse or promote products derived
- from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGE.
-
-
-From: 'QOS.ch' (http://www.qos.ch)
- - SLF4J API Module (http://www.slf4j.org) org.slf4j:slf4j-api:jar:1.7.7
- License: MIT License (http://www.opensource.org/licenses/mit-license.php)
- - SLF4J Simple Binding (http://www.slf4j.org) org.slf4j:slf4j-simple:jar:1.7.7
- License: MIT License (http://www.opensource.org/licenses/mit-license.php)
-
-
-Copyright (c) 2004-2013 QOS.ch
-
-All rights reserved. Permission is hereby granted, free of charge, to any
-person obtaining a copy of this software and associated documentation files
-(the "Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish, distribute,
-sublicense, and/or sell copies of the Software, and to permit persons to whom
-the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
diff --git a/lib/server-tecsvc/src/main/resources/simplelogger.properties b/lib/server-tecsvc/src/main/resources/simplelogger.properties
deleted file mode 100644
index 2a3350c..0000000
--- a/lib/server-tecsvc/src/main/resources/simplelogger.properties
+++ /dev/null
@@ -1,20 +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.
-#
-org.slf4j.simpleLogger.defaultLogLevel=debug
-org.slf4j.simpleLogger.logFile=System.out
\ No newline at end of file
diff --git a/lib/server-tecsvc/src/main/version/version.html b/lib/server-tecsvc/src/main/version/version.html
deleted file mode 100644
index 7bc2ddd..0000000
--- a/lib/server-tecsvc/src/main/version/version.html
+++ /dev/null
@@ -1,37 +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.
--->
-
-<table>
- <thead>
- <tr><th colspan=2>Version Information</th></tr>
- </thead>
-
- <tfoot>
- <tr>
- <td>Home</td>
- <td><a href="http://olingo.apache.org/" target="self">Apache Olingo</a></td>
- </tr>
- </tfoot>
-
- <tbody>
- <tr><td>name</td><td>${name}</td></tr>
- <tr><td>version</td><td>${version}</td></tr>
- <tr><td>timestamp</td><td>${timestamp}</td></tr>
- </tbody>
-</table>
diff --git a/lib/server-tecsvc/src/main/webapp/WEB-INF/web.xml b/lib/server-tecsvc/src/main/webapp/WEB-INF/web.xml
deleted file mode 100644
index 3c68d16..0000000
--- a/lib/server-tecsvc/src/main/webapp/WEB-INF/web.xml
+++ /dev/null
@@ -1,42 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
--->
-<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
- xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
- id="WebApp_ID" version="2.5">
-
- <display-name>Apache Olingo OData 4.0 Technical Service</display-name>
-
- <welcome-file-list>
- <welcome-file>index.jsp</welcome-file>
- </welcome-file-list>
-
- <servlet>
- <servlet-name>ODataServlet</servlet-name>
- <servlet-class>org.apache.olingo.server.tecsvc.TechnicalServlet</servlet-class>
- <load-on-startup>1</load-on-startup>
- </servlet>
-
- <servlet-mapping>
- <servlet-name>ODataServlet</servlet-name>
- <url-pattern>/odata.svc/*</url-pattern>
- </servlet-mapping>
-
-</web-app>
diff --git a/lib/server-tecsvc/src/main/webapp/css/olingo.css b/lib/server-tecsvc/src/main/webapp/css/olingo.css
deleted file mode 100644
index 5b9deec..0000000
--- a/lib/server-tecsvc/src/main/webapp/css/olingo.css
+++ /dev/null
@@ -1,91 +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.
-*/
-body {
- font-family: Arial, sans-serif;
- font-size: 13px;
- line-height: 18px;
- color: #8904B1;
- background-color: #ffffff;
-}
-
-a {
- color: #8904B1;
-}
-
-a:VISITED {
- color: #D358F7;
-}
-
-td {
- padding: 5px;
-}
-
-h1,h2,h3,h4,h5,h6 {
- font-family: inherit;
- font-weight: bold;
- line-height: 1;
- color: #8904B1;
-}
-
-h1 {
- font-size: 36px;
- line-height: 40px;
-}
-
-h2 {
- font-size: 30px;
- line-height: 40px;
-}
-
-h3 {
- font-size: 24px;
- line-height: 40px;
-}
-
-h4 {
- font-size: 18px;
- line-height: 20px;
-}
-
-h5 {
- font-size: 14px;
- line-height: 20px;
-}
-
-h6 {
- font-size: 12px;
- line-height: 20px;
-}
-
-.logo {
- float: right;
-}
-
-hr, thead, tfoot {
- margin: 9px 0;
- border-top: 1px solid #8904B1;
- border-bottom: 1px solid #8904B1;
-}
-
-table { border-collapse: collapse; border: 1px solid #8904B1; }
-
-.version {
- font-family: "Courier New", monospace;
- font-size: 10px;
-}
\ No newline at end of file
diff --git a/lib/server-tecsvc/src/main/webapp/img/OlingoOrangeTM.png b/lib/server-tecsvc/src/main/webapp/img/OlingoOrangeTM.png
deleted file mode 100644
index 4878e8a..0000000
--- a/lib/server-tecsvc/src/main/webapp/img/OlingoOrangeTM.png
+++ /dev/null
Binary files differ
diff --git a/lib/server-tecsvc/src/main/webapp/index.jsp b/lib/server-tecsvc/src/main/webapp/index.jsp
deleted file mode 100644
index 788390f..0000000
--- a/lib/server-tecsvc/src/main/webapp/index.jsp
+++ /dev/null
@@ -1,55 +0,0 @@
-<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
-
-<!--
- 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.
--->
-
-<!DOCTYPE html>
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
- <title>Apache Olingo - OData 4.0</title>
- <link type="text/css" rel="stylesheet" href="css/olingo.css">
-</head>
-
-<body>
- <div class="logo">
- <img height="40" src="img/OlingoOrangeTM.png" />
- </div>
- <h1>Olingo OData 4.0</h1>
- <hr>
- <h2>Technical Service</h2>
- <ul>
- <li><a href="odata.svc/">Service Document</a></li>
- <li><a href="odata.svc/$metadata">Metadata</a></li>
- <li>Entity Set <a href="odata.svc/ESAllPrim">ESAllPrim</a></li>
- <li>Entity <a href="odata.svc/ESAllPrim(32767)">ESAllPrim(32767)</a></li>
- </ul>
- <hr>
- <div class="version">
- <% String version = "gen/version.html";
- try {
- %>
- <jsp:include page='<%=version%>' />
- <%} catch (Exception e) {
- %>
- <p>IDE Build</p>
- <%}%>
- </div>
-</body>
-</html>
diff --git a/lib/server-tecsvc/src/main/webapp/v4.0/cs02/vocabularies/Org.OData.Core.V1.xml b/lib/server-tecsvc/src/main/webapp/v4.0/cs02/vocabularies/Org.OData.Core.V1.xml
deleted file mode 100644
index aeca931..0000000
--- a/lib/server-tecsvc/src/main/webapp/v4.0/cs02/vocabularies/Org.OData.Core.V1.xml
+++ /dev/null
@@ -1,134 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
- 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.
-
--->
-
-<!--
- OData Version 4.0
- Committee Specification 02
- 17 November 2013
- Copyright (c) OASIS Open 2013. All Rights Reserved.
- Source: http://docs.oasis-open.org/odata/odata/v4.0/cs02/vocabularies/
--->
-
-<edmx:Edmx xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx" Version="4.0">
- <edmx:DataServices>
- <Schema xmlns="http://docs.oasis-open.org/odata/ns/edm" Namespace="Org.OData.Core.V1" Alias="Core">
- <Annotation Term="Core.Description">
- <String>Core terms needed to write vocabularies</String>
- </Annotation>
-
- <!--Documentation -->
-
- <Term Name="Description" Type="Edm.String">
- <Annotation Term="Core.Description" String="A brief description of a model element" />
- <Annotation Term="Core.IsLanguageDependent" />
- </Term>
-
- <Term Name="LongDescription" Type="Edm.String">
- <Annotation Term="Core.Description" String="A lengthy description of a model element" />
- <Annotation Term="Core.IsLanguageDependent" />
- </Term>
-
- <!-- Localization -->
-
- <Term Name="IsLanguageDependent" Type="Core.Tag" DefaultValue="true" AppliesTo="Property Term">
- <Annotation Term="Core.Description" String="Properties and terms annotated with this term are language-dependent" />
- <Annotation Term="Core.RequiresType" String="Edm.String" />
- </Term>
-
- <!-- Term Restrictions -->
-
- <TypeDefinition Name="Tag" UnderlyingType="Edm.Boolean">
- <Annotation Term="Core.Description" String="This is the type to use for all tagging terms" />
- </TypeDefinition>
-
- <Term Name="RequiresType" Type="Edm.String" AppliesTo="Term">
- <Annotation Term="Core.Description"
- String="Properties and terms annotated with this annotation MUST have a type that is identical to or derived from the given type name" />
- </Term>
-
- <!--Resource Paths -->
-
- <Term Name="ResourcePath" Type="Edm.String" AppliesTo="EntitySet Singleton ActionImport FunctionImport">
- <Annotation Term="Core.Description"
- String="Resource path for entity container child, can be relative to xml:base and the request URL" />
- <Annotation Term="Core.IsUrl" />
- </Term>
-
- <Term Name="DereferenceableIDs" Type="Core.Tag" DefaultValue="true" AppliesTo="EntityContainer">
- <Annotation Term="Core.Description" String="Entity-ids are URLs that locate the identified entity" />
- </Term>
-
- <Term Name="ConventionalIDs" Type="Core.Tag" DefaultValue="true" AppliesTo="EntityContainer">
- <Annotation Term="Core.Description" String="Entity-ids follow OData URL conventions" />
- </Term>
-
- <!-- Permissions -->
-
- <Term Name="Permissions" Type="Core.Permission" AppliesTo="Property">
- <Annotation Term="Core.Description" String="Permissions available for a property.The value of 2 is reserved for future use." />
- </Term>
- <EnumType Name="Permission" IsFlags="true">
- <Member Name="None" Value="0" />
- <Member Name="Read" Value="1" />
- <Member Name="ReadWrite" Value="3" />
- </EnumType>
-
- <!-- Metadata Extensions -->
-
- <Term Name="Immutable" Type="Core.Tag" DefaultValue="true" AppliesTo="Property">
- <Annotation Term="Core.Description"
- String="A value for this non-key property can be provided on insert and remains unchanged on update" />
- </Term>
-
- <Term Name="Computed" Type="Core.Tag" DefaultValue="true" AppliesTo="Property">
- <Annotation Term="Core.Description" String="A value for this property is generated on both insert and update" />
- </Term>
-
- <Term Name="IsURL" Type="Core.Tag" DefaultValue="true" AppliesTo="Property Term">
- <Annotation Term="Core.Description" String="Properties and terms annotated with this term MUST contain a valid URL" />
- <Annotation Term="Core.RequiresType" String="Edm.String" />
- </Term>
-
- <Term Name="AcceptableMediaTypes" Type="Collection(Edm.String)" AppliesTo="EntityType Property">
- <Annotation Term="Core.Description"
- String="Lists the MIME types acceptable for the annotated entity type marked with HasStream="true" or the annotated stream property" />
- <Annotation Term="Core.IsMediaType" />
- </Term>
-
- <Term Name="MediaType" Type="Edm.String" AppliesTo="Property">
- <Annotation Term="Core.IsMediaType" />
- <Annotation Term="Core.RequiresType" String="Edm.Binary" />
- </Term>
-
- <Term Name="IsMediaType" Type="Core.Tag" DefaultValue="true" AppliesTo="Property Term">
- <Annotation Term="Core.Description" String="Properties and terms annotated with this term MUST contain a valid MIME type" />
- <Annotation Term="Core.RequiresType" String="Edm.String" />
- </Term>
-
- <Term Name="OptimisticConcurrency" Type="Collection(Edm.PropertyPath)" AppliesTo="EntitySet">
- <Annotation Term="Core.Description"
- String="Data modification requires the use of Etags. A non-empty collection contains the set of properties that are used to compute the ETag" />
- </Term>
-
- </Schema>
- </edmx:DataServices>
-</edmx:Edmx>
\ No newline at end of file
diff --git a/lib/server-tecsvc/src/test/java/org/apache/olingo/server/tecsvc/data/DataProviderTest.java b/lib/server-tecsvc/src/test/java/org/apache/olingo/server/tecsvc/data/DataProviderTest.java
deleted file mode 100644
index 264febd..0000000
--- a/lib/server-tecsvc/src/test/java/org/apache/olingo/server/tecsvc/data/DataProviderTest.java
+++ /dev/null
@@ -1,177 +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.tecsvc.data;
-
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-
-import org.apache.olingo.commons.api.data.Entity;
-import org.apache.olingo.commons.api.data.EntitySet;
-import org.apache.olingo.commons.api.data.LinkedComplexValue;
-import org.apache.olingo.commons.api.data.Property;
-import org.apache.olingo.commons.api.edm.Edm;
-import org.apache.olingo.commons.api.edm.EdmEntityContainer;
-import org.apache.olingo.commons.api.edm.EdmEntitySet;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.server.api.OData;
-import org.apache.olingo.server.api.edmx.EdmxReference;
-import org.apache.olingo.server.api.uri.UriParameter;
-import org.apache.olingo.server.tecsvc.provider.EdmTechProvider;
-import org.junit.Assert;
-import org.junit.Test;
-import org.mockito.Mockito;
-
-public class DataProviderTest {
-
- private final Edm edm = OData.newInstance().createServiceMetadata(new EdmTechProvider(
- Collections.<EdmxReference> emptyList()), Collections.<EdmxReference> emptyList())
- .getEdm();
- private final EdmEntityContainer entityContainer = edm.getEntityContainer(
- new FullQualifiedName("olingo.odata.test1", "Container"));
-
- private final EdmEntitySet esAllPrim = entityContainer.getEntitySet("ESAllPrim");
- private final EdmEntitySet esAllKey = entityContainer.getEntitySet("ESAllKey");
- private final EdmEntitySet esCompAllPrim = entityContainer.getEntitySet("ESCompAllPrim");
- private final EdmEntitySet esCollAllPrim = entityContainer.getEntitySet("ESCollAllPrim");
- private final EdmEntitySet esMixPrimCollComp = entityContainer.getEntitySet("ESMixPrimCollComp");
- private final EdmEntitySet esMedia = entityContainer.getEntitySet("ESMedia");
-
- @Test
- public void esAllPrimEntity() throws Exception {
- final DataProvider dataProvider = new DataProvider();
- final Entity entity = dataProvider.readAll(esAllPrim).getEntities().get(2);
- Assert.assertEquals(16, entity.getProperties().size());
-
- Assert.assertEquals(entity,
- dataProvider.read(esAllPrim, Arrays.asList(mockParameter("PropertyInt16", "-0"))));
- }
-
- @Test
- public void esAllKeyEntity() throws Exception {
- final DataProvider dataProvider = new DataProvider();
- final Entity entity = dataProvider.readAll(esAllKey).getEntities().get(0);
- Assert.assertEquals(13, entity.getProperties().size());
-
- Assert.assertEquals(entity, dataProvider.read(esAllKey, Arrays.asList(
- mockParameter("PropertyBoolean", "true"),
- mockParameter("PropertyByte", "255"),
- mockParameter("PropertyDate", "2012-12-03"),
- mockParameter("PropertyDateTimeOffset", "2012-12-03T07:16:23Z"),
- mockParameter("PropertyDecimal", "34"),
- mockParameter("PropertyDuration", "duration'PT6S'"),
- mockParameter("PropertyGuid", "01234567-89AB-CDEF-0123-456789ABCDEF"),
- mockParameter("PropertyInt16", "32767"),
- mockParameter("PropertyInt32", "2147483647"),
- mockParameter("PropertyInt64", "9223372036854775807"),
- mockParameter("PropertySByte", "127"),
- mockParameter("PropertyString", "'First'"),
- mockParameter("PropertyTimeOfDay", "02:48:21"))));
- }
-
- @Test
- public void esAllPrim() throws Exception {
- final DataProvider data = new DataProvider();
- EntitySet outSet = data.readAll(esAllPrim);
-
- Assert.assertEquals(3, outSet.getEntities().size());
-
- Entity first = outSet.getEntities().get(0);
- Assert.assertEquals(16, first.getProperties().size());
- Assert.assertEquals(2, first.getNavigationLinks().size());
- final EntitySet target = first.getNavigationLink("NavPropertyETTwoPrimMany").getInlineEntitySet();
- Assert.assertNotNull(target);
- Assert.assertEquals(1, target.getEntities().size());
- Assert.assertEquals(data.readAll(entityContainer.getEntitySet("ESTwoPrim")).getEntities().get(1),
- target.getEntities().get(0));
-
- Assert.assertEquals(16, outSet.getEntities().get(1).getProperties().size());
- Assert.assertEquals(16, outSet.getEntities().get(2).getProperties().size());
- }
-
- @Test
- public void esCollAllPrim() throws Exception {
- EntitySet outSet = new DataProvider().readAll(esCollAllPrim);
-
- Assert.assertEquals(3, outSet.getEntities().size());
- Assert.assertEquals(17, outSet.getEntities().get(0).getProperties().size());
- Property list = outSet.getEntities().get(0).getProperties().get(1);
- Assert.assertTrue(list.isCollection());
- Assert.assertEquals(3, list.asCollection().size());
- Assert.assertEquals(17, outSet.getEntities().get(1).getProperties().size());
- Assert.assertEquals(17, outSet.getEntities().get(2).getProperties().size());
- }
-
- @Test
- public void esCompAllPrim() throws Exception {
- EntitySet outSet = new DataProvider().readAll(esCompAllPrim);
-
- Assert.assertEquals(3, outSet.getEntities().size());
- Assert.assertEquals(2, outSet.getEntities().get(0).getProperties().size());
- Property complex = outSet.getEntities().get(0).getProperties().get(1);
- Assert.assertTrue(complex.isLinkedComplex());
- Assert.assertEquals(16, complex.asLinkedComplex().getValue().size());
- Assert.assertEquals(2, outSet.getEntities().get(1).getProperties().size());
- Assert.assertEquals(2, outSet.getEntities().get(2).getProperties().size());
- }
-
- @Test
- public void esMixPrimCollComp() throws Exception {
- EntitySet outSet = new DataProvider().readAll(esMixPrimCollComp);
-
- Assert.assertEquals(3, outSet.getEntities().size());
- Assert.assertEquals(4, outSet.getEntities().get(0).getProperties().size());
- Property complex = outSet.getEntities().get(0).getProperties().get(2);
- Assert.assertTrue(complex.isLinkedComplex());
- Assert.assertEquals(2, complex.asLinkedComplex().getValue().size());
- Property complexCollection = outSet.getEntities().get(0).getProperties().get(3);
- Assert.assertTrue(complexCollection.isCollection());
- List<?> linkedComplexValues = complexCollection.asCollection();
- Assert.assertEquals(3, linkedComplexValues.size());
- LinkedComplexValue linkedComplexValue = (LinkedComplexValue) linkedComplexValues.get(0);
- Assert.assertEquals(2, linkedComplexValue.getValue().size());
- Property lcProp = linkedComplexValue.getValue().get(0);
- Assert.assertFalse(lcProp.isCollection());
- Assert.assertEquals(123, lcProp.getValue());
- //
- Assert.assertEquals(4, outSet.getEntities().get(1).getProperties().size());
- Assert.assertEquals(4, outSet.getEntities().get(2).getProperties().size());
- }
-
- @Test
- public void esMedia() throws Exception {
- DataProvider dataProvider = new DataProvider();
- Entity entity = dataProvider.read(esMedia, Arrays.asList(mockParameter("PropertyInt16", "3")));
- Assert.assertNotNull(dataProvider.readMedia(entity));
- dataProvider.delete(esMedia, entity);
- Assert.assertEquals(3, dataProvider.readAll(esMedia).getEntities().size());
- entity = dataProvider.create(esMedia);
- Assert.assertEquals(5, entity.getProperty("PropertyInt16").getValue());
- dataProvider.setMedia(entity, new byte[] { 1, 2, 3, 4 }, "x/y");
- Assert.assertArrayEquals(new byte[] { 1, 2, 3, 4 }, dataProvider.readMedia(entity));
- Assert.assertEquals("x/y", entity.getMediaContentType());
- }
-
- private static UriParameter mockParameter(final String name, final String text) {
- UriParameter parameter = Mockito.mock(UriParameter.class);
- Mockito.when(parameter.getName()).thenReturn(name);
- Mockito.when(parameter.getText()).thenReturn(text);
- return parameter;
- }
-}
diff --git a/lib/server-test/pom.xml b/lib/server-test/pom.xml
deleted file mode 100644
index 40534fd..0000000
--- a/lib/server-test/pom.xml
+++ /dev/null
@@ -1,100 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
- 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.
-
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <artifactId>odata-server-test</artifactId>
- <packaging>jar</packaging>
- <name>${project.artifactId}</name>
-
- <parent>
- <groupId>org.apache.olingo</groupId>
- <artifactId>odata-lib</artifactId>
- <version>4.0.0-beta-02</version>
- <relativePath>..</relativePath>
- </parent>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.olingo</groupId>
- <artifactId>odata-server-core</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.olingo</groupId>
- <artifactId>odata-server-tecsvc</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.antlr</groupId>
- <artifactId>antlr4-runtime</artifactId>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- </dependency>
- <dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-all</artifactId>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-simple</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>commons-io</groupId>
- <artifactId>commons-io</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-dependency-plugin</artifactId>
- <version>2.8</version>
- <executions>
- <execution>
- <id>unpack-dependencies</id>
- <phase>compile</phase>
- <goals>
- <goal>unpack-dependencies</goal>
- </goals>
- <configuration>
- <!--<includes>**/olingo/**/*.class</includes>-->
- <!--<excludes>**/*.properties</excludes>-->
- <includeGroupIds>${project.groupId}</includeGroupIds>
- <outputDirectory>${project.build.directory}/classes</outputDirectory>
- <overWriteReleases>true</overWriteReleases>
- <overWriteSnapshots>true</overWriteSnapshots>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/ODataHandlerTest.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/ODataHandlerTest.java
deleted file mode 100644
index b62371e..0000000
--- a/lib/server-test/src/test/java/org/apache/olingo/server/core/ODataHandlerTest.java
+++ /dev/null
@@ -1,700 +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;
-
-import static org.hamcrest.CoreMatchers.containsString;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertThat;
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.doThrow;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.verifyZeroInteractions;
-
-import java.util.Collections;
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.commons.io.IOUtils;
-import org.apache.olingo.commons.api.ODataException;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
-import org.apache.olingo.commons.api.format.ContentType;
-import org.apache.olingo.commons.api.format.ODataFormat;
-import org.apache.olingo.commons.api.http.HttpContentType;
-import org.apache.olingo.commons.api.http.HttpHeader;
-import org.apache.olingo.commons.api.http.HttpMethod;
-import org.apache.olingo.commons.api.http.HttpStatusCode;
-import org.apache.olingo.server.api.OData;
-import org.apache.olingo.server.api.ODataApplicationException;
-import org.apache.olingo.server.api.ODataRequest;
-import org.apache.olingo.server.api.ODataResponse;
-import org.apache.olingo.server.api.ODataServerError;
-import org.apache.olingo.server.api.ServiceMetadata;
-import org.apache.olingo.server.api.edm.provider.EdmProvider;
-import org.apache.olingo.server.api.edm.provider.EntitySet;
-import org.apache.olingo.server.api.edmx.EdmxReference;
-import org.apache.olingo.server.api.processor.ActionComplexCollectionProcessor;
-import org.apache.olingo.server.api.processor.ActionComplexProcessor;
-import org.apache.olingo.server.api.processor.ActionEntityCollectionProcessor;
-import org.apache.olingo.server.api.processor.ActionEntityProcessor;
-import org.apache.olingo.server.api.processor.ActionPrimitiveCollectionProcessor;
-import org.apache.olingo.server.api.processor.ActionPrimitiveProcessor;
-import org.apache.olingo.server.api.processor.BatchProcessor;
-import org.apache.olingo.server.api.processor.ComplexCollectionProcessor;
-import org.apache.olingo.server.api.processor.ComplexProcessor;
-import org.apache.olingo.server.api.processor.CountComplexCollectionProcessor;
-import org.apache.olingo.server.api.processor.CountEntityCollectionProcessor;
-import org.apache.olingo.server.api.processor.CountPrimitiveCollectionProcessor;
-import org.apache.olingo.server.api.processor.EntityCollectionProcessor;
-import org.apache.olingo.server.api.processor.EntityProcessor;
-import org.apache.olingo.server.api.processor.ErrorProcessor;
-import org.apache.olingo.server.api.processor.MediaEntityProcessor;
-import org.apache.olingo.server.api.processor.MetadataProcessor;
-import org.apache.olingo.server.api.processor.PrimitiveCollectionProcessor;
-import org.apache.olingo.server.api.processor.PrimitiveProcessor;
-import org.apache.olingo.server.api.processor.PrimitiveValueProcessor;
-import org.apache.olingo.server.api.processor.Processor;
-import org.apache.olingo.server.api.processor.ReferenceCollectionProcessor;
-import org.apache.olingo.server.api.processor.ReferenceProcessor;
-import org.apache.olingo.server.api.processor.ServiceDocumentProcessor;
-import org.apache.olingo.server.api.uri.UriInfo;
-import org.apache.olingo.server.tecsvc.provider.ContainerProvider;
-import org.apache.olingo.server.tecsvc.provider.EdmTechProvider;
-import org.junit.Test;
-
-public class ODataHandlerTest {
-
- private static final String BASE_URI = "http://localhost/odata";
-
- @Test
- public void serviceDocumentNonDefault() throws Exception {
- final ServiceDocumentProcessor processor = mock(ServiceDocumentProcessor.class);
- final ODataResponse response = dispatch(HttpMethod.GET, "/", processor);
- assertEquals(HttpStatusCode.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode());
-
- verify(processor).readServiceDocument(
- any(ODataRequest.class), any(ODataResponse.class), any(UriInfo.class), any(ContentType.class));
-
- dispatchMethodNotAllowed(HttpMethod.POST, "/", processor);
- dispatchMethodNotAllowed(HttpMethod.PUT, "/", processor);
- dispatchMethodNotAllowed(HttpMethod.PATCH, "/", processor);
- dispatchMethodNotAllowed(HttpMethod.DELETE, "/", processor);
- }
-
- @Test
- public void serviceDocumentDefault() throws Exception {
- final ODataResponse response = dispatch(HttpMethod.GET, "/", null);
- assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode());
-
- String ct = response.getHeaders().get(HttpHeader.CONTENT_TYPE);
- assertThat(ct, containsString("application/json"));
- assertThat(ct, containsString("odata.metadata=minimal"));
-
- assertNotNull(response.getContent());
- String doc = IOUtils.toString(response.getContent());
-
- assertThat(doc, containsString("\"@odata.context\" : \"" + BASE_URI + "/$metadata\""));
- assertThat(doc, containsString("\"value\" :"));
- }
-
- @Test
- public void serviceDocumentRedirect() throws Exception {
- final ODataResponse response = dispatch(HttpMethod.GET, "", null);
- assertEquals(HttpStatusCode.TEMPORARY_REDIRECT.getStatusCode(), response.getStatusCode());
- assertEquals(BASE_URI + "/", response.getHeaders().get(HttpHeader.LOCATION));
- }
-
- @Test
- public void metadataNonDefault() throws Exception {
- final MetadataProcessor processor = mock(MetadataProcessor.class);
- final ODataResponse response = dispatch(HttpMethod.GET, "$metadata", processor);
- assertEquals(HttpStatusCode.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode());
-
- verify(processor).readMetadata(
- any(ODataRequest.class), any(ODataResponse.class), any(UriInfo.class), any(ContentType.class));
-
- dispatchMethodNotAllowed(HttpMethod.POST, "$metadata", processor);
- dispatchMethodNotAllowed(HttpMethod.PUT, "$metadata", processor);
- dispatchMethodNotAllowed(HttpMethod.PATCH, "$metadata", processor);
- dispatchMethodNotAllowed(HttpMethod.DELETE, "$metadata", processor);
- }
-
- @Test
- public void metadataDefault() throws Exception {
- final ODataResponse response = dispatch(HttpMethod.GET, "$metadata", null);
- assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode());
- assertEquals(HttpContentType.APPLICATION_XML, response.getHeaders().get(HttpHeader.CONTENT_TYPE));
-
- assertNotNull(response.getContent());
- assertThat(IOUtils.toString(response.getContent()),
- containsString("<edmx:Edmx Version=\"4.0\""));
- }
-
- @Test
- public void maxVersionNone() {
- final ODataResponse response = dispatch(HttpMethod.GET, "$metadata", null);
- assertEquals(ODataServiceVersion.V40.toString(), response.getHeaders().get(HttpHeader.ODATA_VERSION));
- }
-
- @Test
- public void maxVersionSupported() {
- final ODataResponse response = dispatch(HttpMethod.GET, "$metadata", null,
- HttpHeader.ODATA_MAX_VERSION, ODataServiceVersion.V40.toString(), null);
- assertEquals(ODataServiceVersion.V40.toString(), response.getHeaders().get(HttpHeader.ODATA_VERSION));
- }
-
- @Test
- public void maxVersionNotSupported() {
- final ODataResponse response = dispatch(HttpMethod.GET, "$metadata", null,
- HttpHeader.ODATA_MAX_VERSION, ODataServiceVersion.V30.toString(), null);
-
- assertEquals(ODataServiceVersion.V40.toString(), response.getHeaders().get(HttpHeader.ODATA_VERSION));
- assertEquals(HttpStatusCode.BAD_REQUEST.getStatusCode(), response.getStatusCode());
- }
-
- @Test
- public void contentNegotiationSupported() {
- final ODataResponse response = dispatch(HttpMethod.GET, "$metadata", "$format=xml", null, null, null);
- assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode());
- }
-
- @Test
- public void contentNegotiationNotSupported() {
- final ODataResponse response = dispatch(HttpMethod.GET, "$metadata", "$format=not/Supported", null, null, null);
- assertEquals(HttpStatusCode.NOT_ACCEPTABLE.getStatusCode(), response.getStatusCode());
- }
-
- @Test
- public void contentNegotiationNotSupported2() {
- final ODataResponse response = dispatch(HttpMethod.GET, "$metadata", "$format=notSupported", null, null, null);
- assertEquals(HttpStatusCode.NOT_ACCEPTABLE.getStatusCode(), response.getStatusCode());
- }
-
- @Test
- public void unregisteredProcessor() {
- final ODataResponse response = dispatch(HttpMethod.GET, "ESAllPrim", null);
- assertEquals(HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), response.getStatusCode());
- }
-
- @Test
- public void uriParserExceptionResultsInRightResponseNotFound() throws Exception {
- final ODataResponse response = dispatch(HttpMethod.GET, "NotFound", null);
- assertEquals(HttpStatusCode.NOT_FOUND.getStatusCode(), response.getStatusCode());
- }
-
- @Test
- public void uriParserExceptionResultsInRightResponseBadRequest() throws Exception {
- final ODataResponse response = dispatch(HttpMethod.GET, "ESAllPrim('122')", null);
- assertEquals(HttpStatusCode.BAD_REQUEST.getStatusCode(), response.getStatusCode());
- }
-
- @Test
- public void applicationExceptionInProcessor() throws Exception {
- MetadataProcessor processor = mock(MetadataProcessor.class);
- doThrow(new ODataApplicationException("msg", 425, Locale.ENGLISH)).when(processor).readMetadata(
- any(ODataRequest.class), any(ODataResponse.class), any(UriInfo.class), any(ContentType.class));
- final ODataResponse response = dispatch(HttpMethod.GET, "$metadata", processor);
- assertEquals(425, response.getStatusCode());
- }
-
- @Test
- public void uriParserExceptionResultsInRightResponseEdmCause() throws Exception {
- final OData odata = OData.newInstance();
- final ServiceMetadata serviceMetadata = odata.createServiceMetadata(
- new EdmProvider() {
- public EntitySet getEntitySet(final FullQualifiedName entityContainer, final String entitySetName)
- throws ODataException {
- throw new ODataException("msg");
- }
- },
- Collections.<EdmxReference> emptyList());
-
- ODataRequest request = new ODataRequest();
- request.setMethod(HttpMethod.GET);
- request.setRawODataPath("EdmException");
-
- final ODataResponse response = new ODataHandler(odata, serviceMetadata).process(request);
- assertNotNull(response);
- assertEquals(HttpStatusCode.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode());
- }
-
- @Test
- public void dispatchBatch() throws Exception {
- final String uri = "$batch";
- final BatchProcessor processor = mock(BatchProcessor.class);
-
- dispatch(HttpMethod.POST, uri, processor);
- // TODO: Verify that batch processing has been called.
-
- dispatchMethodNotAllowed(HttpMethod.GET, uri, processor);
- dispatchMethodNotAllowed(HttpMethod.PATCH, uri, processor);
- dispatchMethodNotAllowed(HttpMethod.PUT, uri, processor);
- dispatchMethodNotAllowed(HttpMethod.DELETE, uri, processor);
- }
-
- @Test
- public void dispatchEntitySet() throws Exception {
- final String uri = "ESAllPrim";
- final EntityCollectionProcessor processor = mock(EntityCollectionProcessor.class);
-
- dispatch(HttpMethod.GET, uri, processor);
- verify(processor).readEntityCollection(
- any(ODataRequest.class), any(ODataResponse.class), any(UriInfo.class), any(ContentType.class));
-
- dispatchMethodNotAllowed(HttpMethod.PATCH, uri, processor);
- dispatchMethodNotAllowed(HttpMethod.PUT, uri, processor);
- dispatchMethodNotAllowed(HttpMethod.DELETE, uri, processor);
- }
-
- @Test
- public void dispatchEntitySetCount() throws Exception {
- final String uri = "ESAllPrim/$count";
- final CountEntityCollectionProcessor processor = mock(CountEntityCollectionProcessor.class);
-
- dispatch(HttpMethod.GET, uri, processor);
- verify(processor).countEntityCollection(
- any(ODataRequest.class), any(ODataResponse.class), any(UriInfo.class));
-
- dispatchMethodNotAllowed(HttpMethod.POST, uri, processor);
- dispatchMethodNotAllowed(HttpMethod.PATCH, uri, processor);
- dispatchMethodNotAllowed(HttpMethod.PUT, uri, processor);
- dispatchMethodNotAllowed(HttpMethod.DELETE, uri, processor);
- }
-
- @Test
- public void dispatchCountWithNavigation() throws Exception {
- final CountEntityCollectionProcessor processor = mock(CountEntityCollectionProcessor.class);
- dispatch(HttpMethod.GET, "ESAllPrim(0)/NavPropertyETTwoPrimMany/$count", processor);
-
- verify(processor).countEntityCollection(
- any(ODataRequest.class), any(ODataResponse.class), any(UriInfo.class));
- }
-
- @Test
- public void dispatchFunction() throws Exception {
- EntityProcessor entityProcessor = mock(EntityProcessor.class);
- dispatch(HttpMethod.GET, "FICRTETKeyNav()", entityProcessor);
- verify(entityProcessor).readEntity(
- any(ODataRequest.class), any(ODataResponse.class), any(UriInfo.class), any(ContentType.class));
-
- EntityCollectionProcessor entityCollectionProcessor = mock(EntityCollectionProcessor.class);
- dispatch(HttpMethod.GET, "FICRTESTwoKeyNavParam(ParameterInt16=123)", entityCollectionProcessor);
- verify(entityCollectionProcessor).readEntityCollection(
- any(ODataRequest.class), any(ODataResponse.class), any(UriInfo.class), any(ContentType.class));
-
- PrimitiveProcessor primitiveProcessor = mock(PrimitiveProcessor.class);
- dispatch(HttpMethod.GET, "FICRTString()", primitiveProcessor);
- verify(primitiveProcessor).readPrimitive(
- any(ODataRequest.class), any(ODataResponse.class), any(UriInfo.class), any(ContentType.class));
-
- PrimitiveCollectionProcessor primitiveCollectionProcessor = mock(PrimitiveCollectionProcessor.class);
- dispatch(HttpMethod.GET, "FICRTCollString()", primitiveCollectionProcessor);
- verify(primitiveCollectionProcessor).readPrimitiveCollection(
- any(ODataRequest.class), any(ODataResponse.class), any(UriInfo.class), any(ContentType.class));
-
- ComplexProcessor complexProcessor = mock(ComplexProcessor.class);
- dispatch(HttpMethod.GET, "FICRTCTTwoPrim()", complexProcessor);
- verify(complexProcessor).readComplex(
- any(ODataRequest.class), any(ODataResponse.class), any(UriInfo.class), any(ContentType.class));
-
- ComplexCollectionProcessor complexCollectionProcessor = mock(ComplexCollectionProcessor.class);
- dispatch(HttpMethod.GET, "FICRTCollCTTwoPrim()", complexCollectionProcessor);
- verify(complexCollectionProcessor).readComplexCollection(
- any(ODataRequest.class), any(ODataResponse.class), any(UriInfo.class), any(ContentType.class));
-
- dispatchMethodNotAllowed(HttpMethod.POST, "FICRTCollString()", mock(Processor.class));
- dispatchMethodNotAllowed(HttpMethod.PUT, "FICRTCollString()", mock(Processor.class));
- dispatchMethodNotAllowed(HttpMethod.DELETE, "FICRTCollString()", mock(Processor.class));
- }
-
-
- @Test
- public void dispatchAction() throws Exception {
- ActionPrimitiveProcessor primitiveProcessor = mock(ActionPrimitiveProcessor.class);
- dispatch(HttpMethod.POST, ContainerProvider.AIRT_STRING, primitiveProcessor);
- verify(primitiveProcessor).processActionPrimitive(
- any(ODataRequest.class), any(ODataResponse.class), any(UriInfo.class),
- any(ContentType.class), any(ContentType.class));
-
- ActionPrimitiveCollectionProcessor primitiveCollectionProcessor = mock(ActionPrimitiveCollectionProcessor.class);
- dispatch(HttpMethod.POST, ContainerProvider.AIRT_COLL_STRING_TWO_PARAM, primitiveCollectionProcessor);
- verify(primitiveCollectionProcessor).processActionPrimitiveCollection(
- any(ODataRequest.class), any(ODataResponse.class), any(UriInfo.class),
- any(ContentType.class), any(ContentType.class));
-
- ActionComplexProcessor complexProcessor = mock(ActionComplexProcessor.class);
- dispatch(HttpMethod.POST, ContainerProvider.AIRTCT_TWO_PRIM_PARAM, complexProcessor);
- verify(complexProcessor).processActionComplex(
- any(ODataRequest.class), any(ODataResponse.class), any(UriInfo.class),
- any(ContentType.class), any(ContentType.class));
-
- ActionComplexCollectionProcessor complexCollectionProcessor = mock(ActionComplexCollectionProcessor.class);
- dispatch(HttpMethod.POST, ContainerProvider.AIRT_COLL_CT_TWO_PRIM_PARAM, complexCollectionProcessor);
- verify(complexCollectionProcessor).processActionComplexCollection(
- any(ODataRequest.class), any(ODataResponse.class), any(UriInfo.class),
- any(ContentType.class), any(ContentType.class));
-
- ActionEntityProcessor entityProcessor = mock(ActionEntityProcessor.class);
- dispatch(HttpMethod.POST, ContainerProvider.AIRTET_TWO_KEY_TWO_PRIM_PARAM, entityProcessor);
- verify(entityProcessor).processActionEntity(
- any(ODataRequest.class), any(ODataResponse.class), any(UriInfo.class),
- any(ContentType.class), any(ContentType.class));
-
- ActionEntityCollectionProcessor entityCollectionProcessor = mock(ActionEntityCollectionProcessor.class);
- dispatch(HttpMethod.POST, ContainerProvider.AIRT_COLL_ET_KEY_NAV_PARAM, entityCollectionProcessor);
- verify(entityCollectionProcessor).processActionEntityCollection(
- any(ODataRequest.class), any(ODataResponse.class), any(UriInfo.class),
- any(ContentType.class), any(ContentType.class));
-
- ActionEntityProcessor entityProcessorEs = mock(ActionEntityProcessor.class);
- dispatch(HttpMethod.POST, ContainerProvider.AIRTES_ALL_PRIM_PARAM, entityProcessorEs);
- verify(entityProcessorEs).processActionEntity(
- any(ODataRequest.class), any(ODataResponse.class), any(UriInfo.class),
- any(ContentType.class), any(ContentType.class));
-
- ActionEntityCollectionProcessor entityCollectionProcessorEs = mock(ActionEntityCollectionProcessor.class);
- dispatch(HttpMethod.POST, ContainerProvider.AIRT_COLL_ES_ALL_PRIM_PARAM, entityCollectionProcessorEs);
- verify(entityCollectionProcessorEs).processActionEntityCollection(
- any(ODataRequest.class), any(ODataResponse.class), any(UriInfo.class),
- any(ContentType.class), any(ContentType.class));
-
- dispatchMethodNotAllowed(HttpMethod.GET, "AIRTString", mock(Processor.class));
- }
-
- @Test
- public void dispatchEntity() throws Exception {
- final String uri = "ESAllPrim(0)";
- final EntityProcessor processor = mock(EntityProcessor.class);
-
- dispatch(HttpMethod.GET, uri, processor);
- verify(processor).readEntity(
- any(ODataRequest.class), any(ODataResponse.class), any(UriInfo.class), any(ContentType.class));
-
- dispatch(HttpMethod.PUT, uri, processor);
- verify(processor).updateEntity(
- any(ODataRequest.class), any(ODataResponse.class), any(UriInfo.class), any(ContentType.class),
- any(ContentType.class));
-
- dispatch(HttpMethod.PATCH, uri, processor);
- verify(processor, times(2)).updateEntity(
- any(ODataRequest.class), any(ODataResponse.class), any(UriInfo.class), any(ContentType.class),
- any(ContentType.class));
-
- dispatch(HttpMethod.DELETE, uri, processor);
- verify(processor).deleteEntity(any(ODataRequest.class), any(ODataResponse.class), any(UriInfo.class));
-
- dispatch(HttpMethod.POST, "ESAllPrim", processor);
- verify(processor).createEntity(any(ODataRequest.class), any(ODataResponse.class), any(UriInfo.class),
- any(ContentType.class), any(ContentType.class));
-
- dispatchMethodNotAllowed(HttpMethod.POST, uri, processor);
- }
-
- @Test
- public void dispatchMedia() throws Exception {
- final String uri = "ESMedia(1)/$value";
- final MediaEntityProcessor processor = mock(MediaEntityProcessor.class);
-
- dispatch(HttpMethod.GET, uri, processor);
- verify(processor).readMediaEntity(
- any(ODataRequest.class), any(ODataResponse.class), any(UriInfo.class), any(ContentType.class));
-
- dispatch(HttpMethod.POST, "ESMedia", processor);
- verify(processor).createMediaEntity(any(ODataRequest.class), any(ODataResponse.class), any(UriInfo.class),
- any(ContentType.class), any(ContentType.class));
-
- dispatch(HttpMethod.PUT, uri, processor);
- verify(processor).updateMediaEntity(any(ODataRequest.class), any(ODataResponse.class), any(UriInfo.class),
- any(ContentType.class), any(ContentType.class));
-
- dispatch(HttpMethod.DELETE, uri, processor);
- verify(processor).deleteEntity(any(ODataRequest.class), any(ODataResponse.class), any(UriInfo.class));
-
- dispatchMethodNotAllowed(HttpMethod.POST, uri, processor);
- dispatchMethodNotAllowed(HttpMethod.PATCH, uri, processor);
- }
-
- @Test
- public void dispatchMediaDeleteIndirect() throws Exception {
- final MediaEntityProcessor processor = mock(MediaEntityProcessor.class);
- dispatch(HttpMethod.DELETE, "ESMedia(1)", processor);
-
- verify(processor).deleteEntity(any(ODataRequest.class), any(ODataResponse.class), any(UriInfo.class));
- }
-
- @Test
- public void dispatchPrimitiveProperty() throws Exception {
- final String uri = "ESAllPrim(0)/PropertyString";
- final PrimitiveProcessor processor = mock(PrimitiveProcessor.class);
-
- dispatch(HttpMethod.GET, uri, processor);
- verify(processor).readPrimitive(
- any(ODataRequest.class), any(ODataResponse.class), any(UriInfo.class), any(ContentType.class));
-
- dispatch(HttpMethod.PUT, uri, processor);
- verify(processor).updatePrimitive(
- any(ODataRequest.class), any(ODataResponse.class), any(UriInfo.class), any(ContentType.class),
- any(ContentType.class));
-
- dispatch(HttpMethod.PATCH, uri, processor);
- verify(processor, times(2)).updatePrimitive(
- any(ODataRequest.class), any(ODataResponse.class), any(UriInfo.class), any(ContentType.class),
- any(ContentType.class));
-
- dispatch(HttpMethod.DELETE, uri, processor);
- verify(processor).deletePrimitive(any(ODataRequest.class), any(ODataResponse.class), any(UriInfo.class));
-
- dispatchMethodNotAllowed(HttpMethod.POST, uri, processor);
- }
-
- @Test
- public void dispatchPrimitivePropertyValue() throws Exception {
- final String uri = "ESAllPrim(0)/PropertyString/$value";
- final PrimitiveValueProcessor processor = mock(PrimitiveValueProcessor.class);
-
- dispatch(HttpMethod.GET, uri, processor);
- verify(processor).readPrimitiveValue(any(ODataRequest.class), any(ODataResponse.class), any(UriInfo.class),
- any(ContentType.class));
-
- dispatch(HttpMethod.PUT, uri, null, HttpHeader.CONTENT_TYPE, ContentType.TEXT_PLAIN.toContentTypeString(),
- processor);
- verify(processor).updatePrimitive(
- any(ODataRequest.class), any(ODataResponse.class), any(UriInfo.class), any(ContentType.class),
- any(ContentType.class));
-
- dispatch(HttpMethod.DELETE, uri, processor);
- verify(processor).deletePrimitive(any(ODataRequest.class), any(ODataResponse.class), any(UriInfo.class));
-
- dispatchMethodNotAllowed(HttpMethod.POST, uri, processor);
- dispatchMethodNotAllowed(HttpMethod.PATCH, uri, processor);
- }
-
- @Test
- public void dispatchPrimitiveCollectionProperty() throws Exception {
- final String uri = "ESMixPrimCollComp(7)/CollPropertyString";
- final PrimitiveCollectionProcessor processor = mock(PrimitiveCollectionProcessor.class);
-
- dispatch(HttpMethod.GET, uri, processor);
- verify(processor).readPrimitiveCollection(
- any(ODataRequest.class), any(ODataResponse.class), any(UriInfo.class), any(ContentType.class));
-
- dispatch(HttpMethod.PUT, uri, processor);
- verify(processor).updatePrimitiveCollection(
- any(ODataRequest.class), any(ODataResponse.class), any(UriInfo.class), any(ContentType.class),
- any(ContentType.class));
-
- dispatch(HttpMethod.DELETE, uri, processor);
- verify(processor).deletePrimitiveCollection(any(ODataRequest.class), any(ODataResponse.class), any(UriInfo.class));
-
- dispatchMethodNotAllowed(HttpMethod.POST, uri, processor);
- }
-
- @Test
- public void dispatchPrimitiveCollectionPropertyCount() throws Exception {
- final String uri = "ESMixPrimCollComp(7)/CollPropertyString/$count";
- final CountPrimitiveCollectionProcessor processor = mock(CountPrimitiveCollectionProcessor.class);
-
- dispatch(HttpMethod.GET, uri, processor);
- verify(processor).countPrimitiveCollection(any(ODataRequest.class), any(ODataResponse.class), any(UriInfo.class));
-
- dispatchMethodNotAllowed(HttpMethod.POST, uri, processor);
- dispatchMethodNotAllowed(HttpMethod.PUT, uri, processor);
- dispatchMethodNotAllowed(HttpMethod.PATCH, uri, processor);
- dispatchMethodNotAllowed(HttpMethod.DELETE, uri, processor);
- }
-
- @Test
- public void dispatchComplexProperty() throws Exception {
- final String uri = "ESMixPrimCollComp(7)/PropertyComp";
- final ComplexProcessor processor = mock(ComplexProcessor.class);
-
- dispatch(HttpMethod.GET, uri, processor);
- verify(processor).readComplex(
- any(ODataRequest.class), any(ODataResponse.class), any(UriInfo.class), any(ContentType.class));
-
- dispatch(HttpMethod.PUT, uri, processor);
- verify(processor).updateComplex(
- any(ODataRequest.class), any(ODataResponse.class), any(UriInfo.class), any(ContentType.class),
- any(ContentType.class));
-
- dispatch(HttpMethod.PATCH, uri, processor);
- verify(processor, times(2)).updateComplex(
- any(ODataRequest.class), any(ODataResponse.class), any(UriInfo.class), any(ContentType.class),
- any(ContentType.class));
-
- dispatch(HttpMethod.DELETE, uri, processor);
- verify(processor).deleteComplex(any(ODataRequest.class), any(ODataResponse.class), any(UriInfo.class));
-
- dispatchMethodNotAllowed(HttpMethod.POST, uri, processor);
- }
-
- @Test
- public void dispatchComplexCollectionProperty() throws Exception {
- final String uri = "ESMixPrimCollComp(7)/CollPropertyComp";
- final ComplexCollectionProcessor processor = mock(ComplexCollectionProcessor.class);
-
- dispatch(HttpMethod.GET, uri, processor);
- verify(processor).readComplexCollection(
- any(ODataRequest.class), any(ODataResponse.class), any(UriInfo.class), any(ContentType.class));
-
- dispatch(HttpMethod.PUT, uri, processor);
- verify(processor).updateComplexCollection(
- any(ODataRequest.class), any(ODataResponse.class), any(UriInfo.class), any(ContentType.class),
- any(ContentType.class));
-
- dispatch(HttpMethod.DELETE, uri, processor);
- verify(processor).deleteComplexCollection(any(ODataRequest.class), any(ODataResponse.class), any(UriInfo.class));
-
- dispatchMethodNotAllowed(HttpMethod.POST, uri, processor);
- }
-
- @Test
- public void dispatchComplexCollectionPropertyCount() throws Exception {
- final String uri = "ESMixPrimCollComp(7)/CollPropertyComp/$count";
- final CountComplexCollectionProcessor processor = mock(CountComplexCollectionProcessor.class);
-
- dispatch(HttpMethod.GET, uri, processor);
- verify(processor).countComplexCollection(any(ODataRequest.class), any(ODataResponse.class), any(UriInfo.class));
-
- dispatchMethodNotAllowed(HttpMethod.POST, uri, processor);
- dispatchMethodNotAllowed(HttpMethod.PUT, uri, processor);
- dispatchMethodNotAllowed(HttpMethod.PATCH, uri, processor);
- dispatchMethodNotAllowed(HttpMethod.DELETE, uri, processor);
- }
-
- @Test
- public void dispatchReference() throws Exception {
- final String uri = "ESAllPrim(0)/NavPropertyETTwoPrimOne/$ref";
- final ReferenceProcessor processor = mock(ReferenceProcessor.class);
-
- dispatch(HttpMethod.GET, uri, processor);
- verify(processor).readReference(any(ODataRequest.class), any(ODataResponse.class), any(UriInfo.class),
- any(ContentType.class));
-
- dispatch(HttpMethod.PUT, uri, processor);
- verify(processor).updateReference(any(ODataRequest.class), any(ODataResponse.class), any(UriInfo.class),
- any(ContentType.class));
-
- dispatch(HttpMethod.PATCH, uri, processor);
- verify(processor, times(2)).updateReference(any(ODataRequest.class), any(ODataResponse.class), any(UriInfo.class),
- any(ContentType.class));
-
- dispatch(HttpMethod.DELETE, uri, processor);
- verify(processor).deleteReference(any(ODataRequest.class), any(ODataResponse.class), any(UriInfo.class));
-
- dispatch(HttpMethod.POST, uri.replace("One", "Many"), processor);
- verify(processor).createReference(any(ODataRequest.class), any(ODataResponse.class), any(UriInfo.class),
- any(ContentType.class));
-
- dispatchMethodNotAllowed(HttpMethod.POST, uri, processor);
- }
-
- @Test
- public void dispatchReferenceCollection() throws Exception {
- final String uri = "ESAllPrim(0)/NavPropertyETTwoPrimMany/$ref";
- final ReferenceCollectionProcessor processor = mock(ReferenceCollectionProcessor.class);
-
- dispatch(HttpMethod.GET, uri, processor);
- verify(processor).readReferenceCollection(any(ODataRequest.class), any(ODataResponse.class), any(UriInfo.class),
- any(ContentType.class));
-
- dispatchMethodNotAllowed(HttpMethod.PUT, uri, processor);
- dispatchMethodNotAllowed(HttpMethod.PATCH, uri, processor);
- dispatchMethodNotAllowed(HttpMethod.DELETE, uri, processor);
- }
-
- @Test
- public void unsupportedRequestContentType() throws Exception {
- EntityProcessor processor = mock(EntityProcessor.class);
- ErrorProcessor errorProcessor = mock(ErrorProcessor.class);
- dispatch(HttpMethod.POST, "ESAllPrim", "", HttpHeader.CONTENT_TYPE, "some/unsupported", errorProcessor);
- verifyZeroInteractions(processor);
- verify(errorProcessor).processError(any(ODataRequest.class), any(ODataResponse.class), any(ODataServerError.class),
- any(ContentType.class));
- }
-
- private ODataResponse dispatch(final HttpMethod method, final String path, final String query,
- final String headerName, final String headerValue, final Processor processor) {
- Map<String, List<String>> headers = null;
- if(headerName != null) {
- headers = Collections.singletonMap(headerName, Collections.singletonList(headerValue));
- }
- List<Processor> processors = null;
- if(processor != null) {
- processors = Collections.singletonList(processor);
- }
- return dispatch(method, path, query, headers, processors);
- }
-
-
- private ODataResponse dispatch(final HttpMethod method, final String path, final String query,
- final Map<String, List<String>> headers, final List<Processor> processors) {
- ODataRequest request = new ODataRequest();
- request.setMethod(method);
- request.setRawBaseUri(BASE_URI);
- if (path.isEmpty()) {
- request.setRawRequestUri(BASE_URI);
- }
- request.setRawODataPath(path);
- request.setRawQueryPath(query);
-
- if (headers != null) {
- Set<Map.Entry<String, List<String>>> headerSet = headers.entrySet();
- for (Map.Entry<String, List<String>> headerItem : headerSet) {
- request.addHeader(headerItem.getKey(), headerItem.getValue());
- }
- }
-
- if(request.getHeaders(HttpHeader.CONTENT_TYPE) == null) {
- request.addHeader(HttpHeader.CONTENT_TYPE, Collections.singletonList(
- ODataFormat.JSON.getContentType(ODataServiceVersion.V40).toContentTypeString()));
- }
-
- final OData odata = OData.newInstance();
- final ServiceMetadata metadata = odata.createServiceMetadata(
- new EdmTechProvider(), Collections.<EdmxReference> emptyList());
-
- ODataHandler handler = new ODataHandler(odata, metadata);
-
- if (processors != null && !processors.isEmpty()) {
- for (Processor p : processors) {
- handler.register(p);
- }
- }
-
- final ODataResponse response = handler.process(request);
- assertNotNull(response);
- return response;
- }
-
- private ODataResponse dispatch(final HttpMethod method, final String path, final Processor processor) {
- return dispatch(method, path, null, null, null, processor);
- }
-
- private void dispatchMethodNotAllowed(final HttpMethod method, final String path, final Processor processor) {
- final ODataResponse response = dispatch(method, path, processor);
- assertEquals(HttpStatusCode.METHOD_NOT_ALLOWED.getStatusCode(), response.getStatusCode());
- assertNotNull(response.getContent());
- }
-}
diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/deserializer/json/AbstractODataDeserializerTest.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/deserializer/json/AbstractODataDeserializerTest.java
deleted file mode 100644
index 185d869..0000000
--- a/lib/server-test/src/test/java/org/apache/olingo/server/core/deserializer/json/AbstractODataDeserializerTest.java
+++ /dev/null
@@ -1,42 +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.deserializer.json;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Collections;
-
-import org.apache.olingo.commons.api.edm.Edm;
-import org.apache.olingo.server.api.OData;
-import org.apache.olingo.server.api.edmx.EdmxReference;
-import org.apache.olingo.server.tecsvc.provider.EdmTechProvider;
-
-public class AbstractODataDeserializerTest {
-
- protected static final Edm edm = OData.newInstance().createServiceMetadata(
- new EdmTechProvider(), Collections.<EdmxReference> emptyList()).getEdm();
-
- protected InputStream getFileAsStream(final String filename) throws IOException {
- InputStream in = Thread.currentThread().getContextClassLoader().getResourceAsStream(filename);
- if (in == null) {
- throw new IOException("Requested file '" + filename + "' was not found.");
- }
- return in;
- }
-}
diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/deserializer/json/ODataDeserializerDeepInsertTest.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/deserializer/json/ODataDeserializerDeepInsertTest.java
deleted file mode 100644
index 417e371..0000000
--- a/lib/server-test/src/test/java/org/apache/olingo/server/core/deserializer/json/ODataDeserializerDeepInsertTest.java
+++ /dev/null
@@ -1,172 +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.deserializer.json;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-
-import java.io.ByteArrayInputStream;
-import java.io.InputStream;
-
-import org.apache.olingo.commons.api.data.Entity;
-import org.apache.olingo.commons.api.data.Link;
-import org.apache.olingo.commons.api.domain.ODataLinkType;
-import org.apache.olingo.commons.api.edm.EdmEntityType;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.api.format.ODataFormat;
-import org.apache.olingo.server.api.OData;
-import org.apache.olingo.server.api.deserializer.DeserializerException;
-import org.junit.Test;
-
-public class ODataDeserializerDeepInsertTest extends AbstractODataDeserializerTest {
-
- @Test
- public void esAllPrimExpandedToOne() throws Exception {
- EdmEntityType edmEntityType = edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETAllPrim"));
- InputStream stream = getFileAsStream("EntityESAllPrimExpandedNavPropertyETTwoPrimOne.json");
- Entity entity = OData.newInstance().createDeserializer(ODataFormat.JSON).entity(stream, edmEntityType);
-
- Link navigationLink = entity.getNavigationLink("NavPropertyETTwoPrimOne");
- assertNotNull(navigationLink);
-
- assertEquals("NavPropertyETTwoPrimOne", navigationLink.getTitle());
- assertEquals(ODataLinkType.ENTITY_NAVIGATION.toString(), navigationLink.getType());
- assertNotNull(navigationLink.getInlineEntity());
- assertNull(navigationLink.getInlineEntitySet());
- }
-
- @Test
- public void esAllPrimExpandedToOneWithODataAnnotations() throws Exception {
- EdmEntityType edmEntityType = edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETAllPrim"));
- InputStream stream = getFileAsStream("EntityESAllPrimExpandedNavPropertyETTwoPrimOneWithODataAnnotations.json");
- OData.newInstance().createDeserializer(ODataFormat.JSON).entity(stream, edmEntityType);
- }
-
- @Test
- public void esAllPrimExpandedToMany() throws Exception {
- EdmEntityType edmEntityType = edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETAllPrim"));
- InputStream stream = getFileAsStream("EntityESAllPrimExpandedNavPropertyETTwoPrimMany.json");
- Entity entity = OData.newInstance().createDeserializer(ODataFormat.JSON).entity(stream, edmEntityType);
-
- Link navigationLink = entity.getNavigationLink("NavPropertyETTwoPrimMany");
- assertNotNull(navigationLink);
-
- assertEquals("NavPropertyETTwoPrimMany", navigationLink.getTitle());
- assertEquals(ODataLinkType.ENTITY_SET_NAVIGATION.toString(), navigationLink.getType());
- assertNull(navigationLink.getInlineEntity());
- assertNotNull(navigationLink.getInlineEntitySet());
- assertEquals(1, navigationLink.getInlineEntitySet().getEntities().size());
- }
-
- @Test
- public void esAllPrimExpandedToManyWithODataAnnotations() throws Exception {
- EdmEntityType edmEntityType = edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETAllPrim"));
- InputStream stream = getFileAsStream("EntityESAllPrimExpandedNavPropertyETTwoPrimManyWithODataAnnotations.json");
- OData.newInstance().createDeserializer(ODataFormat.JSON).entity(stream, edmEntityType);
- }
-
- @Test(expected = DeserializerException.class)
- public void esAllPrimExpandedToOneWithCustomAnnotations() throws Exception {
- EdmEntityType edmEntityType = edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETAllPrim"));
- InputStream stream = getFileAsStream("EntityESAllPrimExpandedNavPropertyETTwoPrimOneWithCustomAnnotations.json");
- try {
- OData.newInstance().createDeserializer(ODataFormat.JSON).entity(stream, edmEntityType);
- } catch (DeserializerException e) {
- assertEquals(DeserializerException.MessageKeys.NOT_IMPLEMENTED, e.getMessageKey());
- throw e;
- }
- }
-
- @Test(expected = DeserializerException.class)
- public void esAllPrimExpandedToManyWithCustomAnnotations() throws Exception {
- EdmEntityType edmEntityType = edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETAllPrim"));
- InputStream stream = getFileAsStream("EntityESAllPrimExpandedNavPropertyETTwoPrimManyWithCustomAnnotations.json");
- try {
- OData.newInstance().createDeserializer(ODataFormat.JSON).entity(stream, edmEntityType);
- } catch (DeserializerException e) {
- assertEquals(DeserializerException.MessageKeys.NOT_IMPLEMENTED, e.getMessageKey());
- throw e;
- }
- }
-
- @Test(expected = DeserializerException.class)
- public void expandedToOneInvalidNullValue() throws Exception {
- String entityString =
- "{\"PropertyInt16\":32767,"
- + "\"NavPropertyETTwoPrimOne\":null"
- + "}";
- InputStream stream = new ByteArrayInputStream(entityString.getBytes());
- EdmEntityType edmEntityType = edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETAllPrim"));
- try {
- OData.newInstance().createDeserializer(ODataFormat.JSON).entity(stream, edmEntityType);
- } catch (DeserializerException e) {
- assertEquals(DeserializerException.MessageKeys.INVALID_NULL_PROPERTY, e.getMessageKey());
- throw e;
- }
- }
-
- @Test(expected = DeserializerException.class)
- public void expandedToOneInvalidStringValue() throws Exception {
- String entityString =
- "{\"PropertyInt16\":32767,"
- + "\"NavPropertyETTwoPrimOne\":\"First Resource - positive values\""
- + "}";
- InputStream stream = new ByteArrayInputStream(entityString.getBytes());
- EdmEntityType edmEntityType = edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETAllPrim"));
- try {
- OData.newInstance().createDeserializer(ODataFormat.JSON).entity(stream, edmEntityType);
- } catch (DeserializerException e) {
- assertEquals(DeserializerException.MessageKeys.INVALID_VALUE_FOR_NAVIGATION_PROPERTY, e.getMessageKey());
- throw e;
- }
- }
-
- @Test(expected = DeserializerException.class)
- public void expandedToManyInvalidNullValue() throws Exception {
- String entityString =
- "{\"PropertyInt16\":32767,"
- + "\"NavPropertyETTwoPrimMany\":null"
- + "}";
- InputStream stream = new ByteArrayInputStream(entityString.getBytes());
- EdmEntityType edmEntityType = edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETAllPrim"));
- try {
- OData.newInstance().createDeserializer(ODataFormat.JSON).entity(stream, edmEntityType);
- } catch (DeserializerException e) {
- assertEquals(DeserializerException.MessageKeys.INVALID_NULL_PROPERTY, e.getMessageKey());
- throw e;
- }
- }
-
- @Test(expected = DeserializerException.class)
- public void expandedToManyInvalidStringValue() throws Exception {
- String entityString =
- "{\"PropertyInt16\":32767,"
- + "\"NavPropertyETTwoPrimMany\":\"First Resource - positive values\""
- + "}";
- InputStream stream = new ByteArrayInputStream(entityString.getBytes());
- EdmEntityType edmEntityType = edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETAllPrim"));
- try {
- OData.newInstance().createDeserializer(ODataFormat.JSON).entity(stream, edmEntityType);
- } catch (DeserializerException e) {
- assertEquals(DeserializerException.MessageKeys.INVALID_VALUE_FOR_NAVIGATION_PROPERTY, e.getMessageKey());
- throw e;
- }
- }
-}
diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/deserializer/json/ODataDeserializerEntityCollectionTest.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/deserializer/json/ODataDeserializerEntityCollectionTest.java
deleted file mode 100644
index 3a17eae..0000000
--- a/lib/server-test/src/test/java/org/apache/olingo/server/core/deserializer/json/ODataDeserializerEntityCollectionTest.java
+++ /dev/null
@@ -1,251 +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.deserializer.json;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.io.ByteArrayInputStream;
-import java.io.InputStream;
-import java.math.BigDecimal;
-import java.util.List;
-
-import org.apache.olingo.commons.api.data.Entity;
-import org.apache.olingo.commons.api.data.EntitySet;
-import org.apache.olingo.commons.api.data.Property;
-import org.apache.olingo.commons.api.edm.EdmEntityType;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.api.format.ODataFormat;
-import org.apache.olingo.server.api.OData;
-import org.apache.olingo.server.api.deserializer.DeserializerException;
-import org.junit.Test;
-
-public class ODataDeserializerEntityCollectionTest extends AbstractODataDeserializerTest {
-
- @Test
- public void esAllPrim() throws Exception {
- EdmEntityType edmEntityType = edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETAllPrim"));
- InputStream stream = getFileAsStream("ESAllPrim.json");
- EntitySet entitySet =
- OData.newInstance().createDeserializer(ODataFormat.JSON).entityCollection(stream, edmEntityType);
-
- assertNotNull(entitySet);
- assertEquals(3, entitySet.getEntities().size());
-
- // Check first entity
- Entity entity = entitySet.getEntities().get(0);
- List<Property> properties = entity.getProperties();
- assertNotNull(properties);
- assertEquals(16, properties.size());
-
- assertEquals(new Short((short) 32767), entity.getProperty("PropertyInt16").getValue());
- assertEquals("First Resource - positive values", entity.getProperty("PropertyString").getValue());
- assertEquals(new Boolean(true), entity.getProperty("PropertyBoolean").getValue());
- assertEquals(new Short((short) 255), entity.getProperty("PropertyByte").getValue());
- assertEquals(new Byte((byte) 127), entity.getProperty("PropertySByte").getValue());
- assertEquals(new Integer(2147483647), entity.getProperty("PropertyInt32").getValue());
- assertEquals(new Long(9223372036854775807l), entity.getProperty("PropertyInt64").getValue());
- assertEquals(new Float(1.79E20), entity.getProperty("PropertySingle").getValue());
- assertEquals(new Double(-1.79E19), entity.getProperty("PropertyDouble").getValue());
- assertEquals(new BigDecimal(34), entity.getProperty("PropertyDecimal").getValue());
- assertNotNull(entity.getProperty("PropertyBinary").getValue());
- assertNotNull(entity.getProperty("PropertyDate").getValue());
- assertNotNull(entity.getProperty("PropertyDateTimeOffset").getValue());
- assertNotNull(entity.getProperty("PropertyDuration").getValue());
- assertNotNull(entity.getProperty("PropertyGuid").getValue());
- assertNotNull(entity.getProperty("PropertyTimeOfDay").getValue());
- }
-
- @Test
- public void eSCompCollComp() throws Exception {
- EdmEntityType edmEntityType = edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETCompCollComp"));
- InputStream stream = getFileAsStream("ESCompCollComp.json");
- EntitySet entitySet =
- OData.newInstance().createDeserializer(ODataFormat.JSON).entityCollection(stream, edmEntityType);
-
- assertNotNull(entitySet);
- assertEquals(2, entitySet.getEntities().size());
-
- // Since entity deserialization is called we do not check all entities here excplicitly
- }
-
- @Test
- public void esAllPrimODataAnnotationsAreIgnored() throws Exception {
- EdmEntityType edmEntityType = edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETAllPrim"));
- InputStream stream = getFileAsStream("ESAllPrimWithODataAnnotations.json");
- OData.newInstance().createDeserializer(ODataFormat.JSON).entityCollection(stream, edmEntityType);
- }
-
- @Test
- public void emptyETAllPrim() throws Exception {
- String entityCollectionString = "{\"value\" : []}";
- InputStream stream = new ByteArrayInputStream(entityCollectionString.getBytes());
- EdmEntityType edmEntityType = edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETAllPrim"));
- EntitySet entityCollection =
- OData.newInstance().createDeserializer(ODataFormat.JSON).entityCollection(stream, edmEntityType);
- assertNotNull(entityCollection.getEntities());
- assertTrue(entityCollection.getEntities().isEmpty());
- }
-
- @Test(expected = DeserializerException.class)
- public void esAllPrimCustomAnnotationsLeadToNotImplemented() throws Exception {
- EdmEntityType edmEntityType = edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETAllPrim"));
- InputStream stream = getFileAsStream("ESAllPrimWithCustomAnnotations.json");
- try {
- OData.newInstance().createDeserializer(ODataFormat.JSON).entityCollection(stream, edmEntityType);
- } catch (DeserializerException e) {
- assertEquals(DeserializerException.MessageKeys.NOT_IMPLEMENTED, e.getMessageKey());
- throw e;
- }
- }
-
- @Test(expected = DeserializerException.class)
- public void esAllPrimDoubleKeysLeadToException() throws Exception {
- EdmEntityType edmEntityType = edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETAllPrim"));
- InputStream stream = getFileAsStream("ESAllPrimWithDoubleKey.json");
- try {
- OData.newInstance().createDeserializer(ODataFormat.JSON).entityCollection(stream, edmEntityType);
- } catch (DeserializerException e) {
- assertEquals(DeserializerException.MessageKeys.DUPLICATE_JSON_PROPERTY, e.getMessageKey());
- throw e;
- }
- }
-
- @Test(expected = DeserializerException.class)
- public void wrongValueTagJsonValueNull() throws Exception {
- String entityCollectionString = "{\"value\" : null}";
- InputStream stream = new ByteArrayInputStream(entityCollectionString.getBytes());
- EdmEntityType edmEntityType = edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETAllPrim"));
- try {
- OData.newInstance().createDeserializer(ODataFormat.JSON).entityCollection(stream, edmEntityType);
- } catch (DeserializerException e) {
- assertEquals(DeserializerException.MessageKeys.VALUE_TAG_MUST_BE_AN_ARRAY, e.getMessageKey());
- throw e;
- }
- }
-
- @Test(expected = DeserializerException.class)
- public void wrongValueTagJsonValueNumber() throws Exception {
- String entityCollectionString = "{\"value\" : 1234}";
- InputStream stream = new ByteArrayInputStream(entityCollectionString.getBytes());
- EdmEntityType edmEntityType = edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETAllPrim"));
- try {
- OData.newInstance().createDeserializer(ODataFormat.JSON).entityCollection(stream, edmEntityType);
- } catch (DeserializerException e) {
- assertEquals(DeserializerException.MessageKeys.VALUE_TAG_MUST_BE_AN_ARRAY, e.getMessageKey());
- throw e;
- }
- }
-
- @Test(expected = DeserializerException.class)
- public void wrongValueTagJsonValueObject() throws Exception {
- String entityCollectionString = "{\"value\" : {}}";
- InputStream stream = new ByteArrayInputStream(entityCollectionString.getBytes());
- EdmEntityType edmEntityType = edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETAllPrim"));
- try {
- OData.newInstance().createDeserializer(ODataFormat.JSON).entityCollection(stream, edmEntityType);
- } catch (DeserializerException e) {
- assertEquals(DeserializerException.MessageKeys.VALUE_TAG_MUST_BE_AN_ARRAY, e.getMessageKey());
- throw e;
- }
- }
-
- @Test(expected = DeserializerException.class)
- public void valueTagMissing() throws Exception {
- String entityCollectionString = "{}";
- InputStream stream = new ByteArrayInputStream(entityCollectionString.getBytes());
- EdmEntityType edmEntityType = edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETAllPrim"));
- try {
- OData.newInstance().createDeserializer(ODataFormat.JSON).entityCollection(stream, edmEntityType);
- } catch (DeserializerException e) {
- assertEquals(DeserializerException.MessageKeys.VALUE_ARRAY_NOT_PRESENT, e.getMessageKey());
- throw e;
- }
- }
-
- @Test(expected = DeserializerException.class)
- public void wrongValueInValueArrayNumber() throws Exception {
- String entityCollectionString = "{\"value\" : [1234,123]}";
- InputStream stream = new ByteArrayInputStream(entityCollectionString.getBytes());
- EdmEntityType edmEntityType = edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETAllPrim"));
- try {
- OData.newInstance().createDeserializer(ODataFormat.JSON).entityCollection(stream, edmEntityType);
- } catch (DeserializerException e) {
- assertEquals(DeserializerException.MessageKeys.INVALID_ENTITY, e.getMessageKey());
- throw e;
- }
- }
-
- @Test(expected = DeserializerException.class)
- public void wrongValueInValueArrayNestedArray() throws Exception {
- String entityCollectionString = "{\"value\" : [[],[]]}";
- InputStream stream = new ByteArrayInputStream(entityCollectionString.getBytes());
- EdmEntityType edmEntityType = edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETAllPrim"));
- try {
- OData.newInstance().createDeserializer(ODataFormat.JSON).entityCollection(stream, edmEntityType);
- } catch (DeserializerException e) {
- assertEquals(DeserializerException.MessageKeys.INVALID_ENTITY, e.getMessageKey());
- throw e;
- }
- }
-
- @Test(expected = DeserializerException.class)
- public void invalidJsonSyntax() throws Exception {
- String entityCollectionString = "{\"value\" : }";
- InputStream stream = new ByteArrayInputStream(entityCollectionString.getBytes());
- EdmEntityType edmEntityType = edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETAllPrim"));
- try {
- OData.newInstance().createDeserializer(ODataFormat.JSON).entityCollection(stream, edmEntityType);
- } catch (DeserializerException e) {
- assertEquals(DeserializerException.MessageKeys.JSON_SYNTAX_EXCEPTION, e.getMessageKey());
- throw e;
- }
- }
-
- @Test(expected = DeserializerException.class)
- public void unknownContentInCollection() throws Exception {
- String entityCollectionString = "{\"value\" : [],"
- + "\"unknown\":null"
- + "}";
- InputStream stream = new ByteArrayInputStream(entityCollectionString.getBytes());
- EdmEntityType edmEntityType = edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETAllPrim"));
- try {
- OData.newInstance().createDeserializer(ODataFormat.JSON).entityCollection(stream, edmEntityType);
- } catch (DeserializerException e) {
- assertEquals(DeserializerException.MessageKeys.UNKOWN_CONTENT, e.getMessageKey());
- throw e;
- }
- }
-
- @Test(expected = DeserializerException.class)
- public void customAnnotationNotSupportedYet() throws Exception {
- String entityCollectionString = "{\"value\" : [],"
- + "\"@custom.annotation\":null"
- + "}";
- InputStream stream = new ByteArrayInputStream(entityCollectionString.getBytes());
- EdmEntityType edmEntityType = edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETAllPrim"));
- try {
- OData.newInstance().createDeserializer(ODataFormat.JSON).entityCollection(stream, edmEntityType);
- } catch (DeserializerException e) {
- assertEquals(DeserializerException.MessageKeys.NOT_IMPLEMENTED, e.getMessageKey());
- throw e;
- }
- }
-}
diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/deserializer/json/ODataJsonDeserializerEntityTest.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/deserializer/json/ODataJsonDeserializerEntityTest.java
deleted file mode 100644
index 6c48d73..0000000
--- a/lib/server-test/src/test/java/org/apache/olingo/server/core/deserializer/json/ODataJsonDeserializerEntityTest.java
+++ /dev/null
@@ -1,1365 +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.deserializer.json;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import java.io.ByteArrayInputStream;
-import java.io.InputStream;
-import java.math.BigDecimal;
-import java.util.List;
-
-import org.apache.olingo.commons.api.data.Entity;
-import org.apache.olingo.commons.api.data.Link;
-import org.apache.olingo.commons.api.data.Property;
-import org.apache.olingo.commons.api.data.ValueType;
-import org.apache.olingo.commons.api.domain.ODataLinkType;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.api.format.ODataFormat;
-import org.apache.olingo.server.api.OData;
-import org.apache.olingo.server.api.deserializer.DeserializerException;
-import org.apache.olingo.server.api.deserializer.ODataDeserializer;
-import org.junit.Test;
-
-public class ODataJsonDeserializerEntityTest extends AbstractODataDeserializerTest {
-
- @Test
- public void emptyEntity() throws Exception {
- String entityString = "{}";
- InputStream stream = new ByteArrayInputStream(entityString.getBytes());
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
- Entity entity =
- deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETAllPrim")));
- assertNotNull(entity);
- List<Property> properties = entity.getProperties();
- assertNotNull(properties);
- assertEquals(0, properties.size());
- }
-
- @Test
- public void simpleEntityETAllPrim() throws Exception {
- String entityString =
- "{\"PropertyInt16\":32767," +
- "\"PropertyString\":\"First Resource - positive values\"," +
- "\"PropertyBoolean\":true," +
- "\"PropertyByte\":255," +
- "\"PropertySByte\":127," +
- "\"PropertyInt32\":2147483647," +
- "\"PropertyInt64\":9223372036854775807," +
- "\"PropertySingle\":1.79E20," +
- "\"PropertyDouble\":-1.79E19," +
- "\"PropertyDecimal\":34," +
- "\"PropertyBinary\":\"ASNFZ4mrze8=\"," +
- "\"PropertyDate\":\"2012-12-03\"," +
- "\"PropertyDateTimeOffset\":\"2012-12-03T07:16:23Z\"," +
- "\"PropertyDuration\":\"PT6S\"," +
- "\"PropertyGuid\":\"01234567-89ab-cdef-0123-456789abcdef\"," +
- "\"PropertyTimeOfDay\":\"03:26:05\"}";
- InputStream stream = new ByteArrayInputStream(entityString.getBytes());
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
- Entity entity =
- deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETAllPrim")));
- assertNotNull(entity);
- List<Property> properties = entity.getProperties();
- assertNotNull(properties);
- assertEquals(16, properties.size());
-
- assertEquals(new Short((short) 32767), entity.getProperty("PropertyInt16").getValue());
- assertEquals("First Resource - positive values", entity.getProperty("PropertyString").getValue());
- assertEquals(new Boolean(true), entity.getProperty("PropertyBoolean").getValue());
- assertEquals(new Short((short) 255), entity.getProperty("PropertyByte").getValue());
- assertEquals(new Byte((byte) 127), entity.getProperty("PropertySByte").getValue());
- assertEquals(new Integer(2147483647), entity.getProperty("PropertyInt32").getValue());
- assertEquals(new Long(9223372036854775807l), entity.getProperty("PropertyInt64").getValue());
- assertEquals(new Float(1.79E20), entity.getProperty("PropertySingle").getValue());
- assertEquals(new Double(-1.79E19), entity.getProperty("PropertyDouble").getValue());
- assertEquals(new BigDecimal(34), entity.getProperty("PropertyDecimal").getValue());
- assertNotNull(entity.getProperty("PropertyBinary").getValue());
- assertNotNull(entity.getProperty("PropertyDate").getValue());
- assertNotNull(entity.getProperty("PropertyDateTimeOffset").getValue());
- assertNotNull(entity.getProperty("PropertyDuration").getValue());
- assertNotNull(entity.getProperty("PropertyGuid").getValue());
- assertNotNull(entity.getProperty("PropertyTimeOfDay").getValue());
- }
-
- @Test
- public void simpleEntityETAllPrimWithDefaultNullValue() throws Exception {
- String entityString =
- "{\"PropertyInt16\":32767," +
- "\"PropertyString\":\"First Resource - positive values\"," +
- "\"PropertyBoolean\":null," +
- "\"PropertyByte\":255," +
- "\"PropertySByte\":127," +
- "\"PropertyInt32\":2147483647," +
- "\"PropertyInt64\":9223372036854775807," +
- "\"PropertySingle\":1.79E20," +
- "\"PropertyDouble\":-1.79E19," +
- "\"PropertyDecimal\":34," +
- "\"PropertyBinary\":\"ASNFZ4mrze8=\"," +
- "\"PropertyDate\":null," +
- "\"PropertyDateTimeOffset\":\"2012-12-03T07:16:23Z\"," +
- "\"PropertyDuration\":\"PT6S\"," +
- "\"PropertyGuid\":\"01234567-89ab-cdef-0123-456789abcdef\"," +
- "\"PropertyTimeOfDay\":\"03:26:05\"}";
- InputStream stream = new ByteArrayInputStream(entityString.getBytes());
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
- Entity entity =
- deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETAllPrim")));
- assertNotNull(entity);
- List<Property> properties = entity.getProperties();
- assertNotNull(properties);
- assertEquals(16, properties.size());
-
- assertEquals("First Resource - positive values", entity.getProperty("PropertyString").getValue());
- assertNull(entity.getProperty("PropertyBoolean").getValue());
- assertNull(entity.getProperty("PropertyDate").getValue());
- }
-
- @Test
- public void simpleEntityETAllPrimNoTAllPropertiesPresent() throws Exception {
- String entityString =
- "{\"PropertyInt16\":32767," +
- "\"PropertyString\":\"First Resource - positive values\"" +
- "}";
- InputStream stream = new ByteArrayInputStream(entityString.getBytes());
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
- Entity entity =
- deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETAllPrim")));
- assertNotNull(entity);
- List<Property> properties = entity.getProperties();
- assertNotNull(properties);
- assertEquals(2, properties.size());
- }
-
- @Test
- public void simpleEntityETNoneNullable() throws Exception {
- String entityString =
- "{\"PropertyInt16\":32767," +
- "\"PropertyString\":\"First Resource - positive values\"," +
- "\"PropertyBoolean\":null," +
- "\"PropertyByte\":255," +
- "\"PropertySByte\":127," +
- "\"PropertyInt32\":2147483647," +
- "\"PropertyInt64\":9223372036854775807," +
- "\"PropertySingle\":1.79E20," +
- "\"PropertyDouble\":-1.79E19," +
- "\"PropertyDecimal\":34," +
- "\"PropertyBinary\":\"ASNFZ4mrze8=\"," +
- "\"PropertyDate\":null," +
- "\"PropertyDateTimeOffset\":\"2012-12-03T07:16:23Z\"," +
- "\"PropertyDuration\":\"PT6S\"," +
- "\"PropertyGuid\":\"01234567-89ab-cdef-0123-456789abcdef\"," +
- "\"PropertyTimeOfDay\":\"03:26:05\"}";
- InputStream stream = new ByteArrayInputStream(entityString.getBytes());
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
- Entity entity =
- deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETAllPrim")));
- assertNotNull(entity);
- List<Property> properties = entity.getProperties();
- assertNotNull(properties);
- assertEquals(16, properties.size());
-
- assertEquals("First Resource - positive values", entity.getProperty("PropertyString").getValue());
- assertNull(entity.getProperty("PropertyBoolean").getValue());
- assertNull(entity.getProperty("PropertyDate").getValue());
- }
-
- @Test
- public void simpleEntityETCompAllPrim() throws Exception {
- String entityString = "{\"PropertyInt16\":32767," +
- "\"PropertyComp\":{" +
- "\"PropertyString\":\"First Resource - first\"," +
- "\"PropertyBinary\":\"ASNFZ4mrze8=\"," +
- "\"PropertyBoolean\":true," +
- "\"PropertyByte\":255," +
- "\"PropertyDate\":\"2012-10-03\"," +
- "\"PropertyDateTimeOffset\":\"2012-10-03T07:16:23.1234567Z\"," +
- "\"PropertyDecimal\":34.27," +
- "\"PropertySingle\":1.79E20," +
- "\"PropertyDouble\":-1.79E19," +
- "\"PropertyDuration\":\"PT6S\"," +
- "\"PropertyGuid\":\"01234567-89ab-cdef-0123-456789abcdef\"," +
- "\"PropertyInt16\":32767," +
- "\"PropertyInt32\":2147483647," +
- "\"PropertyInt64\":9223372036854775807," +
- "\"PropertySByte\":127," +
- "\"PropertyTimeOfDay\":\"01:00:01\"}}";
- InputStream stream = new ByteArrayInputStream(entityString.getBytes());
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
- Entity entity =
- deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETCompAllPrim")));
- assertNotNull(entity);
- List<Property> properties = entity.getProperties();
- assertNotNull(properties);
- assertEquals(2, properties.size());
-
- assertEquals(new Short((short) 32767), entity.getProperty("PropertyInt16").getValue());
-
- assertNotNull(entity.getProperty("PropertyComp"));
- assertNotNull(entity.getProperty("PropertyComp") instanceof List);
- List<Property> complexProperties = entity.getProperty("PropertyComp").asComplex();
- assertEquals(16, complexProperties.size());
- }
-
- @Test
- public void simpleEntityETCollAllPrim() throws Exception {
- final String entityString = "{"
- + "\"PropertyInt16\":1,"
- + "\"CollPropertyString\":"
- + "[\"Employee1@company.example\",\"Employee2@company.example\",\"Employee3@company.example\"],"
- + "\"CollPropertyBoolean\":[true,false,true],"
- + "\"CollPropertyByte\":[50,200,249],"
- + "\"CollPropertySByte\":[-120,120,126],"
- + "\"CollPropertyInt16\":[1000,2000,30112],"
- + "\"CollPropertyInt32\":[23232323,11223355,10000001],"
- + "\"CollPropertyInt64\":[929292929292,333333333333,444444444444],"
- + "\"CollPropertySingle\":[1790.0,26600.0,3210.0],"
- + "\"CollPropertyDouble\":[-17900.0,-2.78E7,3210.0],"
- + "\"CollPropertyDecimal\":[12,-2,1234],"
- + "\"CollPropertyBinary\":[\"q83v\",\"ASNF\",\"VGeJ\"],"
- + "\"CollPropertyDate\":[\"1958-12-03\",\"1999-08-05\",\"2013-06-25\"],"
- + "\"CollPropertyDateTimeOffset\":[\"2015-08-12T03:08:34Z\",\"1970-03-28T12:11:10Z\","
- + "\"1948-02-17T09:09:09Z\"],"
- + "\"CollPropertyDuration\":[\"PT13S\",\"PT5H28M0S\",\"PT1H0S\"],"
- + "\"CollPropertyGuid\":[\"ffffff67-89ab-cdef-0123-456789aaaaaa\",\"eeeeee67-89ab-cdef-0123-456789bbbbbb\","
- + "\"cccccc67-89ab-cdef-0123-456789cccccc\"],"
- + "\"CollPropertyTimeOfDay\":[\"04:14:13\",\"23:59:59\",\"01:12:33\"]"
- + "}";
- InputStream stream = new ByteArrayInputStream(entityString.getBytes());
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
- Entity entity =
- deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETCollAllPrim")));
- assertNotNull(entity);
- List<Property> properties = entity.getProperties();
- assertNotNull(properties);
- assertEquals(17, properties.size());
-
- // All properties need 3 entires
- for (Property prop : properties) {
- if (!prop.getName().equals("PropertyInt16")) {
- assertEquals(ValueType.COLLECTION_PRIMITIVE, prop.getValueType());
- assertTrue(prop.getValue() instanceof List);
- List<? extends Object> asCollection = prop.asCollection();
- assertEquals(3, asCollection.size());
- }
- }
- Property property = entity.getProperty("CollPropertyBoolean");
- List<? extends Object> asCollection = property.asCollection();
- assertEquals(true, asCollection.get(0));
- assertEquals(false, asCollection.get(1));
- assertEquals(true, asCollection.get(2));
- }
-
- @SuppressWarnings("unchecked")
- @Test
- public void simpleEntityETMixPrimCollComp() throws Exception {
- final String entityString = "{"
- + "\"PropertyInt16\":32767,"
- + "\"CollPropertyString\":"
- + "[\"Employee1@company.example\",\"Employee2@company.example\",\"Employee3@company.example\"],"
- + "\"PropertyComp\":{\"PropertyInt16\":111,\"PropertyString\":\"TEST A\"},"
- + "\"CollPropertyComp\":["
- + "{\"PropertyInt16\":123,\"PropertyString\":\"TEST 1\"},"
- + "{\"PropertyInt16\":456,\"PropertyString\":\"TEST 2\"},"
- + "{\"PropertyInt16\":789,\"PropertyString\":\"TEST 3\"}]}";
-
- InputStream stream = new ByteArrayInputStream(entityString.getBytes());
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
- Entity entity =
- deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETMixPrimCollComp")));
- assertNotNull(entity);
- List<Property> properties = entity.getProperties();
- assertNotNull(properties);
- assertEquals(4, properties.size());
-
- Property property = entity.getProperty("CollPropertyComp");
- assertEquals(ValueType.COLLECTION_COMPLEX, property.getValueType());
-
- assertTrue(property.getValue() instanceof List);
- List<? extends Object> asCollection = property.asCollection();
- assertEquals(3, asCollection.size());
-
- for (Object arrayElement : asCollection) {
- assertTrue(arrayElement instanceof List);
- List<Object> castedArrayElement = (List<Object>) arrayElement;
- assertEquals(2, castedArrayElement.size());
- }
- }
-
- @SuppressWarnings("unchecked")
- @Test
- public void eTMixPrimCollCompMIssingPropertyInComplexType() throws Exception {
- final String entityString = "{"
- + "\"PropertyComp\":{\"PropertyInt16\":111},"
- + "\"CollPropertyComp\":["
- + "{\"PropertyInt16\":123},"
- + "{\"PropertyInt16\":456},"
- + "{\"PropertyInt16\":789}]}";
-
- InputStream stream = new ByteArrayInputStream(entityString.getBytes());
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
- Entity entity =
- deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETMixPrimCollComp")));
- assertNotNull(entity);
- List<Property> properties = entity.getProperties();
- assertNotNull(properties);
- assertEquals(2, properties.size());
-
- Property complexProperty = entity.getProperty("PropertyComp");
- assertEquals(ValueType.COMPLEX, complexProperty.getValueType());
- List<Property> complexPropertyValues = (List<Property>) complexProperty.getValue();
- assertEquals(1, complexPropertyValues.size());
-
- Property property = entity.getProperty("CollPropertyComp");
- assertEquals(ValueType.COLLECTION_COMPLEX, property.getValueType());
-
- assertTrue(property.getValue() instanceof List);
- List<? extends Object> asCollection = property.asCollection();
- assertEquals(3, asCollection.size());
-
- for (Object arrayElement : asCollection) {
- assertTrue(arrayElement instanceof List);
- List<Object> castedArrayElement = (List<Object>) arrayElement;
- assertEquals(1, castedArrayElement.size());
- }
- }
-
- @Test
- public void simpleEntityWithContextURL() throws Exception {
- String entityString =
- "{\"@odata.context\": \"$metadata#ESAllPrim/$entity\"," +
- "\"PropertyInt16\":32767," +
- "\"PropertyString\":\"First Resource - positive values\"," +
- "\"PropertyBoolean\":true," +
- "\"PropertyByte\":255," +
- "\"PropertySByte\":127," +
- "\"PropertyInt32\":2147483647," +
- "\"PropertyInt64\":9223372036854775807," +
- "\"PropertySingle\":1.79E20," +
- "\"PropertyDouble\":-1.79E19," +
- "\"PropertyDecimal\":34," +
- "\"PropertyBinary\":\"ASNFZ4mrze8=\"," +
- "\"PropertyDate\":\"2012-12-03\"," +
- "\"PropertyDateTimeOffset\":\"2012-12-03T07:16:23Z\"," +
- "\"PropertyDuration\":\"PT6S\"," +
- "\"PropertyGuid\":\"01234567-89ab-cdef-0123-456789abcdef\"," +
- "\"PropertyTimeOfDay\":\"03:26:05\"}";
- InputStream stream = new ByteArrayInputStream(entityString.getBytes());
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
- Entity entity =
- deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETAllPrim")));
- assertNotNull(entity);
- }
-
- @Test
- public void ignoreSomeAnnotationsInEntityTypes() throws Exception {
- // We have to ignore @odata.navigation, @odata.association and @odata.type annotations on server side
- String entityString =
- "{\"PropertyInt16\":32767,"
- + "\"PropertyString@odata.type\":\"test\","
- + "\"Navigation@odata.navigationLink\":\"test\","
- + "\"Association@odata.associationLink\":\"test\","
- + "\"PropertyString\":\"First Resource - positive values\""
- + "}";
- InputStream stream = new ByteArrayInputStream(entityString.getBytes());
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
- deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETAllPrim")));
- }
-
- @Test
- public void ignoreSomeAnnotationsInComplexTypes() throws Exception {
- final String entityString = "{"
- + "\"PropertyInt16\":32767,"
- + "\"CollPropertyString\":"
- + "[\"Employee1@company.example\",\"Employee2@company.example\",\"Employee3@company.example\"],"
- + "\"PropertyComp\":{\"PropertyInt16\":111,\"Navigation@odata.navigationLink\": 12," +
- "\"Association@odata.associationLink\": 12,\"PropertyString@odata.type\": 12,\"PropertyString\":\"TEST A\"},"
- + "\"CollPropertyComp\":["
- + "{\"PropertyInt16\":123,\"PropertyString\":\"TEST 1\"},"
- + "{\"PropertyInt16\":456,\"Navigation@odata.navigationLink\": 12," +
- "\"Association@odata.associationLink\": 12,\"PropertyString@odata.type\": 12,\"PropertyString\":\"TEST 2\"},"
- + "{\"PropertyInt16\":789,\"PropertyString\":\"TEST 3\"}]}";
-
- InputStream stream = new ByteArrayInputStream(entityString.getBytes());
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
- deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETMixPrimCollComp")));
- }
-
- @Test
- public void odataControlInformationIsIgnoredForRequests() throws Exception {
- String entityString =
- "{"
- + "\"@odata.context\":\"http://localhost:8080\","
- + "\"@odata.metadataEtag\":\"metadataEtag\","
- + "\"@odata.id\":\"value\","
- + "\"@odata.editLink\":\"value\","
- + "\"@odata.readLink\":\"value\","
- + "\"@odata.etag\":\"value\","
- + "\"@odata.mediaEtag\":\"value\","
- + "\"@odata.mediaReadLink\":\"value\","
- + "\"@odata.mediaEditLink\":\"value\","
- + "\"PropertyInt16\":32767,"
- + "\"PropertyString\":\"First Resource - positive values\""
- + "}";
- InputStream stream = new ByteArrayInputStream(entityString.getBytes());
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
- Entity entity =
- deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETAllPrim")));
- assertNotNull(entity);
- List<Property> properties = entity.getProperties();
- assertNotNull(properties);
- assertEquals(2, properties.size());
- }
-
- @Test
- public void etAllPrimBindingOperation() throws Exception {
- String entityString =
- "{\"PropertyInt16\":32767,"
- + "\"PropertyString\":\"First Resource - positive values\","
- + "\"NavPropertyETTwoPrimOne@odata.bind\":\"ESTwoPrim(2)\","
- + "\"NavPropertyETTwoPrimMany@odata.bind\":[\"ESTwoPrim(2)\",\"ESTwoPrim(3)\"]"
- + "}";
- InputStream stream = new ByteArrayInputStream(entityString.getBytes());
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
- Entity entity =
- deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETAllPrim")));
- assertNotNull(entity);
-
- Link bindingToOne = entity.getNavigationBinding("NavPropertyETTwoPrimOne");
- assertNotNull(bindingToOne);
- assertEquals("NavPropertyETTwoPrimOne", bindingToOne.getTitle());
- assertEquals("ESTwoPrim(2)", bindingToOne.getBindingLink());
- assertEquals(ODataLinkType.ENTITY_BINDING.toString(), bindingToOne.getType());
- assertTrue(bindingToOne.getBindingLinks().isEmpty());
- assertNull(bindingToOne.getHref());
- assertNull(bindingToOne.getRel());
-
- Link bindingToMany = entity.getNavigationBinding("NavPropertyETTwoPrimMany");
- assertNotNull(bindingToMany);
- assertEquals("NavPropertyETTwoPrimMany", bindingToMany.getTitle());
- assertNotNull(bindingToMany.getBindingLinks());
- assertEquals(2, bindingToMany.getBindingLinks().size());
- assertEquals(ODataLinkType.ENTITY_COLLECTION_BINDING.toString(), bindingToMany.getType());
- assertNull(bindingToMany.getBindingLink());
- assertNull(bindingToMany.getHref());
- assertNull(bindingToMany.getRel());
- }
-
- @Test
- public void etAllPrimBindingOperationEmptyArray() throws Exception {
- String entityString =
- "{\"PropertyInt16\":32767,"
- + "\"PropertyString\":\"First Resource - positive values\","
- + "\"NavPropertyETTwoPrimMany@odata.bind\":[]"
- + "}";
- InputStream stream = new ByteArrayInputStream(entityString.getBytes());
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
- Entity entity =
- deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETAllPrim")));
- Link bindingToMany = entity.getNavigationBinding("NavPropertyETTwoPrimMany");
- assertNotNull(bindingToMany);
- assertTrue(bindingToMany.getBindingLinks().isEmpty());
- }
-
- @SuppressWarnings("unchecked")
- @Test
- public void eTTwoKeyNavEnumTest() throws Exception {
- InputStream stream = getFileAsStream("EntityETMixEnumDefCollComp.json");
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
- Entity entity =
- deserializer.entity(stream, edm
- .getEntityType(new FullQualifiedName("Namespace1_Alias", "ETMixEnumDefCollComp")));
-
- assertEquals(6, entity.getProperties().size());
-
- Property enumProperty = entity.getProperty("PropertyEnumString");
- assertNotNull(enumProperty);
- assertEquals((short) 2, enumProperty.getValue());
-
- Property defProperty = entity.getProperty("PropertyDefString");
- assertNotNull(defProperty);
- assertEquals("string", defProperty.getValue());
-
- Property complexProperty = entity.getProperty("PropertyCompMixedEnumDef");
- List<Property> value = (List<Property>) complexProperty.getValue();
- assertEquals((short) 2, value.get(0).getValue());
- }
-
- @Test
- public void eTCollAllPrimWithNullValue() throws Exception {
- final String entityString = "{"
- + "\"PropertyInt16\":1,"
- + "\"CollPropertyString\":"
- + "[\"Employee1@company.example\",\"Employee2@company.example\",\"Employee3@company.example\"],"
- + "\"CollPropertyBoolean\":[true,null,false],"
- + "\"CollPropertyByte\":[50,200,249],"
- + "\"CollPropertySByte\":[-120,120,126],"
- + "\"CollPropertyInt16\":[1000,2000,30112],"
- + "\"CollPropertyInt32\":[23232323,11223355,10000001],"
- + "\"CollPropertyInt64\":[929292929292,333333333333,444444444444],"
- + "\"CollPropertySingle\":[1790.0,26600.0,3210.0],"
- + "\"CollPropertyDouble\":[-17900.0,-2.78E7,3210.0],"
- + "\"CollPropertyDecimal\":[12,-2,1234],"
- + "\"CollPropertyBinary\":[\"q83v\",\"ASNF\",\"VGeJ\"],"
- + "\"CollPropertyDate\":[\"1958-12-03\",\"1999-08-05\",\"2013-06-25\"],"
- + "\"CollPropertyDateTimeOffset\":[\"2015-08-12T03:08:34Z\",\"1970-03-28T12:11:10Z\","
- + "\"1948-02-17T09:09:09Z\"],"
- + "\"CollPropertyDuration\":[\"PT13S\",\"PT5H28M0S\",\"PT1H0S\"],"
- + "\"CollPropertyGuid\":[\"ffffff67-89ab-cdef-0123-456789aaaaaa\",\"eeeeee67-89ab-cdef-0123-456789bbbbbb\","
- + "\"cccccc67-89ab-cdef-0123-456789cccccc\"],"
- + "\"CollPropertyTimeOfDay\":[\"04:14:13\",\"23:59:59\",\"01:12:33\"]"
- + "}";
- InputStream stream = new ByteArrayInputStream(entityString.getBytes());
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
- Entity e = deserializer.entity(stream, edm.getEntityType(
- new FullQualifiedName("Namespace1_Alias", "ETCollAllPrim")));
-
- assertTrue((Boolean) e.getProperty("CollPropertyBoolean").asCollection().get(0));
- assertNull(e.getProperty("CollPropertyBoolean").asCollection().get(1));
- assertFalse((Boolean) e.getProperty("CollPropertyBoolean").asCollection().get(2));
- }
-
- @Test
- public void validJsonValueForComplexTypeNull() throws Exception {
- final String entityString = "{"
- + "\"PropertyComp\":null"
- + "}";
- InputStream stream = new ByteArrayInputStream(entityString.getBytes());
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
- Entity entity = deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias",
- "ETMixPrimCollComp")));
-
- assertNull(entity.getProperty("PropertyComp").getValue());
- }
-
- @Test
- public void validJsonValueForComplexCollectionNullValue() throws Exception {
- final String entityString = "{"
- + "\"CollPropertyComp\":["
- + "null,"
- + "{\"PropertyInt16\":789,\"PropertyString\":\"TEST 3\"}]}";
- InputStream stream = new ByteArrayInputStream(entityString.getBytes());
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
-
- Entity entity = deserializer.entity(stream, edm.getEntityType(
- new FullQualifiedName("Namespace1_Alias", "ETMixPrimCollComp")));
- List<?> collPropertyComp = entity.getProperty("CollPropertyComp").asCollection();
- assertNull(collPropertyComp.get(0));
- List<Property> complexPropertyProperties = (List<Property>) collPropertyComp.get(1);
- assertEquals(Short.valueOf((short) 789), complexPropertyProperties.get(0).getValue());
- assertEquals("TEST 3", complexPropertyProperties.get(1).getValue());
- }
-
- @Test
- public void validJsonValueForPrimPropertyInComplexTypeNull() throws Exception {
- final String entityString = "{"
- + "\"PropertyComp\":{\"PropertyString\":\"TEST A\",\"PropertyInt16\":null}"
- + "}";
- InputStream stream = new ByteArrayInputStream(entityString.getBytes());
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
- Entity entity = deserializer.entity(stream, edm.getEntityType(
- new FullQualifiedName("Namespace1_Alias", "ETCompAllPrim")));
-
- assertEquals("TEST A", entity.getProperty("PropertyComp").asComplex().get(0).getValue());
- assertNull(entity.getProperty("PropertyComp").asComplex().get(1).getValue());
- }
-
- @Test
- public void eTMixEnumDefCollCompNavValidComplexEnumValueNull() throws Exception {
- String entityString = "{"
- + "\"PropertyEnumString\" : 2,"
- + "\"PropertyCompMixedEnumDef\" : {"
- + "\"PropertyEnumString\" : null"
- + "}}";
-
- InputStream stream = new ByteArrayInputStream(entityString.getBytes());
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
- Entity e = deserializer.entity(stream, edm.getEntityType(
- new FullQualifiedName("Namespace1_Alias", "ETMixEnumDefCollComp")));
-
- assertEquals(Short.valueOf("2"), e.getProperty("PropertyEnumString").getValue());
- Property propertyCompMixedEnumDef = e.getProperty("PropertyCompMixedEnumDef");
- assertNull(propertyCompMixedEnumDef.asComplex().get(0).getValue());
- }
-
-
-// ---------------------------------- Negative Tests -----------------------------------------------------------
-
- @Test(expected = DeserializerException.class)
- public void etAllPrimWithInvalidNullValue() throws Exception {
- String entityString =
- "{\"PropertyInt16\":null," +
- "\"PropertyString\":\"First Resource - positive values\"," +
- "\"PropertyBoolean\":true," +
- "\"PropertyByte\":255," +
- "\"PropertySByte\":127," +
- "\"PropertyInt32\":2147483647," +
- "\"PropertyInt64\":9223372036854775807," +
- "\"PropertySingle\":1.79E20," +
- "\"PropertyDouble\":-1.79E19," +
- "\"PropertyDecimal\":34," +
- "\"PropertyBinary\":\"ASNFZ4mrze8=\"," +
- "\"PropertyDate\":\"2012-12-03\"," +
- "\"PropertyDateTimeOffset\":\"2012-12-03T07:16:23Z\"," +
- "\"PropertyDuration\":\"PT6S\"," +
- "\"PropertyGuid\":\"01234567-89ab-cdef-0123-456789abcdef\"," +
- "\"PropertyTimeOfDay\":\"03:26:05\"}";
- InputStream stream = new ByteArrayInputStream(entityString.getBytes());
- try {
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
- deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETAllPrim")));
- } catch (DeserializerException e) {
- assertEquals(DeserializerException.MessageKeys.INVALID_NULL_PROPERTY, e.getMessageKey());
- throw e;
- }
- }
-
- @Test(expected = DeserializerException.class)
- public void doublePrimitiveProperty() throws Exception {
- final String entityString = "{\"@odata.context\":\"$metadata#ESTwoPrim/$entity\"," +
- "\"PropertyInt16\":32766,\"PropertyInt16\":32766,\"PropertyString\":\"Test String1\"}";
-
- InputStream stream = new ByteArrayInputStream(entityString.getBytes());
- try {
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
- deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETTwoPrim")));
- } catch (DeserializerException e) {
- assertEquals(DeserializerException.MessageKeys.DUPLICATE_PROPERTY, e.getMessageKey());
- throw e;
- }
- }
-
- @Test(expected = DeserializerException.class)
- public void doubleComplexProperty() throws Exception {
- final String entityString = "{"
- + "\"PropertyInt16\":32767,"
- + "\"CollPropertyString\":"
- + "[\"Employee1@company.example\",\"Employee2@company.example\",\"Employee3@company.example\"],"
- + "\"PropertyComp\":{\"PropertyInt16\":111,\"PropertyString\":\"TEST A\"},"
- + "\"PropertyComp\":{\"PropertyInt16\":111,\"PropertyString\":\"TEST B\"},"
- + "\"CollPropertyComp\":["
- + "{\"PropertyInt16\":123,\"PropertyString\":\"TEST 1\"},"
- + "{\"PropertyInt16\":456,\"PropertyString\":\"TEST 2\"},"
- + "{\"PropertyInt16\":789,\"PropertyString\":\"TEST 3\"}]}";
-
- InputStream stream = new ByteArrayInputStream(entityString.getBytes());
- try {
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
- deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETMixPrimCollComp")));
- } catch (DeserializerException e) {
- assertEquals(DeserializerException.MessageKeys.DUPLICATE_PROPERTY, e.getMessageKey());
- throw e;
- }
- }
-
- @Test(expected = DeserializerException.class)
- public void doubleComplexPropertyCollection() throws Exception {
- final String entityString = "{"
- + "\"PropertyInt16\":32767,"
- + "\"CollPropertyString\":"
- + "[\"Employee1@company.example\",\"Employee2@company.example\",\"Employee3@company.example\"],"
- + "\"PropertyComp\":{\"PropertyInt16\":111,\"PropertyString\":\"TEST A\"},"
- + "\"CollPropertyComp\":["
- + "{\"PropertyInt16\":123,\"PropertyString\":\"TEST 1\"},"
- + "{\"PropertyInt16\":456,\"PropertyString\":\"TEST 2\"},"
- + "{\"PropertyInt16\":789,\"PropertyString\":\"TEST 3\"}],"
- + "\"CollPropertyComp\":["
- + "{\"PropertyInt16\":123,\"PropertyString\":\"TEST 1\"},"
- + "{\"PropertyInt16\":456,\"PropertyString\":\"TEST 2\"},"
- + "{\"PropertyInt16\":789,\"PropertyString\":\"TEST 3\"}]"
- + "}";
-
- InputStream stream = new ByteArrayInputStream(entityString.getBytes());
- try {
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
- deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETMixPrimCollComp")));
- } catch (DeserializerException e) {
- assertEquals(DeserializerException.MessageKeys.DUPLICATE_PROPERTY, e.getMessageKey());
- throw e;
- }
- }
-
- @Test(expected = DeserializerException.class)
- public void doublePrimitivePropertyCollection() throws Exception {
- final String entityString = "{"
- + "\"PropertyInt16\":32767,"
- + "\"CollPropertyString\":"
- + "[\"Employee1@company.example\",\"Employee2@company.example\",\"Employee3@company.example\"],"
- + "\"CollPropertyString\":"
- + "[\"Employee1@company.example\",\"Employee2@company.example\",\"Employee3@company.example\"],"
- + "\"PropertyComp\":{\"PropertyInt16\":111,\"PropertyString\":\"TEST A\"},"
- + "\"CollPropertyComp\":["
- + "{\"PropertyInt16\":123,\"PropertyString\":\"TEST 1\"},"
- + "{\"PropertyInt16\":456,\"PropertyString\":\"TEST 2\"},"
- + "{\"PropertyInt16\":789,\"PropertyString\":\"TEST 3\"}]}";
-
- InputStream stream = new ByteArrayInputStream(entityString.getBytes());
- try {
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
- deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETMixPrimCollComp")));
- } catch (DeserializerException e) {
- assertEquals(DeserializerException.MessageKeys.DUPLICATE_PROPERTY, e.getMessageKey());
- throw e;
- }
- }
-
- @Test(expected = DeserializerException.class)
- public void customAnnotationInEntityLeadToNotImplemented() throws Exception {
- final String entityString = "{"
- + "\"PropertyInt16\":32767,"
- + "\"CollPropertyString@custom.annotation\": 12,"
- + "\"CollPropertyString\":"
- + "[\"Employee1@company.example\",\"Employee2@company.example\",\"Employee3@company.example\"],"
- + "\"PropertyComp\":{\"PropertyInt16\":111,\"PropertyString\":\"TEST A\"},"
- + "\"CollPropertyComp\":["
- + "{\"PropertyInt16\":123,\"PropertyString\":\"TEST 1\"},"
- + "{\"PropertyInt16\":456,\"PropertyString\":\"TEST 2\"},"
- + "{\"PropertyInt16\":789,\"PropertyString\":\"TEST 3\"}]}";
-
- InputStream stream = new ByteArrayInputStream(entityString.getBytes());
- try {
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
- deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETMixPrimCollComp")));
- } catch (DeserializerException e) {
- assertEquals(DeserializerException.MessageKeys.NOT_IMPLEMENTED, e.getMessageKey());
- throw e;
- }
- }
-
- @Test(expected = DeserializerException.class)
- public void customAnnotationInComplexValueLeadToNotImplemented() throws Exception {
- final String entityString = "{"
- + "\"PropertyInt16\":32767,"
- + "\"CollPropertyString\":"
- + "[\"Employee1@company.example\",\"Employee2@company.example\",\"Employee3@company.example\"],"
- + "\"PropertyComp\":{\"PropertyInt16\":111," +
- "\"CollPropertyString@custom.annotation\": 12,\"PropertyString\":\"TEST A\"},"
- + "\"CollPropertyComp\":["
- + "{\"PropertyInt16\":123,\"PropertyString\":\"TEST 1\"},"
- + "{\"PropertyInt16\":456,\"PropertyString\":\"TEST 2\"},"
- + "{\"PropertyInt16\":789,\"PropertyString\":\"TEST 3\"}]}";
-
- InputStream stream = new ByteArrayInputStream(entityString.getBytes());
- try {
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
- deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETMixPrimCollComp")));
- } catch (DeserializerException e) {
- assertEquals(DeserializerException.MessageKeys.NOT_IMPLEMENTED, e.getMessageKey());
- throw e;
- }
- }
-
- @Test(expected = DeserializerException.class)
- public void customAnnotationInComplexCollectionValueLeadToNotImplemented() throws Exception {
- final String entityString = "{"
- + "\"PropertyInt16\":32767,"
- + "\"CollPropertyString\":"
- + "[\"Employee1@company.example\",\"Employee2@company.example\",\"Employee3@company.example\"],"
- + "\"PropertyComp\":{\"PropertyInt16\":111,\"PropertyString\":\"TEST A\"},"
- + "\"CollPropertyComp\":["
- + "{\"PropertyInt16\":123,\"CollPropertyString@custom.annotation\": 12,\"PropertyString\":\"TEST 1\"},"
- + "{\"PropertyInt16\":456,\"PropertyString\":\"TEST 2\"},"
- + "{\"PropertyInt16\":789,\"PropertyString\":\"TEST 3\"}]}";
-
- InputStream stream = new ByteArrayInputStream(entityString.getBytes());
- try {
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
- deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETMixPrimCollComp")));
- } catch (DeserializerException e) {
- assertEquals(DeserializerException.MessageKeys.NOT_IMPLEMENTED, e.getMessageKey());
- throw e;
- }
- }
-
- @Test(expected = DeserializerException.class)
- public void unkownContentInEntity() throws Exception {
- final String entityString = "{"
- + "\"PropertyInt16\":32767,"
- + "\"unknown\": 12,"
- + "\"CollPropertyString\":"
- + "[\"Employee1@company.example\",\"Employee2@company.example\",\"Employee3@company.example\"],"
- + "\"PropertyComp\":{\"PropertyInt16\":111,\"PropertyString\":\"TEST A\"},"
- + "\"CollPropertyComp\":["
- + "{\"PropertyInt16\":123,\"PropertyString\":\"TEST 1\"},"
- + "{\"PropertyInt16\":456,\"PropertyString\":\"TEST 2\"},"
- + "{\"PropertyInt16\":789,\"PropertyString\":\"TEST 3\"}]}";
-
- InputStream stream = new ByteArrayInputStream(entityString.getBytes());
- try {
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
- deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETMixPrimCollComp")));
- } catch (DeserializerException e) {
- assertEquals(DeserializerException.MessageKeys.UNKOWN_CONTENT, e.getMessageKey());
- throw e;
- }
- }
-
- @Test(expected = DeserializerException.class)
- public void unkownContentInComplexProperty() throws Exception {
- final String entityString = "{"
- + "\"PropertyInt16\":32767,"
- + "\"CollPropertyString\":"
- + "[\"Employee1@company.example\",\"Employee2@company.example\",\"Employee3@company.example\"],"
- + "\"PropertyComp\":{\"PropertyInt16\":111,\"unknown\": 12,\"PropertyString\":\"TEST A\"},"
- + "\"CollPropertyComp\":["
- + "{\"PropertyInt16\":123,\"PropertyString\":\"TEST 1\"},"
- + "{\"PropertyInt16\":456,\"PropertyString\":\"TEST 2\"},"
- + "{\"PropertyInt16\":789,\"PropertyString\":\"TEST 3\"}]}";
-
- InputStream stream = new ByteArrayInputStream(entityString.getBytes());
- try {
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
- deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETMixPrimCollComp")));
- } catch (DeserializerException e) {
- assertEquals(DeserializerException.MessageKeys.UNKOWN_CONTENT, e.getMessageKey());
- throw e;
- }
- }
-
- @Test(expected = DeserializerException.class)
- public void unkownContentInComplexCollectionProperty() throws Exception {
- final String entityString = "{"
- + "\"PropertyInt16\":32767,"
- + "\"CollPropertyString\":"
- + "[\"Employee1@company.example\",\"Employee2@company.example\",\"Employee3@company.example\"],"
- + "\"PropertyComp\":{\"PropertyInt16\":111,\"PropertyString\":\"TEST A\"},"
- + "\"CollPropertyComp\":["
- + "{\"PropertyInt16\":123,\"PropertyString\":\"TEST 1\"},"
- + "{\"PropertyInt16\":456,\"unknown\": 12,\"PropertyString\":\"TEST 2\"},"
- + "{\"PropertyInt16\":789,\"PropertyString\":\"TEST 3\"}]}";
-
- InputStream stream = new ByteArrayInputStream(entityString.getBytes());
- try {
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
- deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETMixPrimCollComp")));
- } catch (DeserializerException e) {
- assertEquals(DeserializerException.MessageKeys.UNKOWN_CONTENT, e.getMessageKey());
- throw e;
- }
- }
-
- @Test
- public void propertyInt16JsonTypesNegativeCheck() throws Exception {
- checkPropertyJsonType("{\"PropertyInt16\":\"32767\"}");
- checkPropertyJsonType("{\"PropertyInt16\":true}");
- }
-
- @Test
- public void propertyInt32JsonTypesNegativeCheck() throws Exception {
- checkPropertyJsonType("{\"PropertyInt32\":\"2147483647\"}");
- checkPropertyJsonType("{\"PropertyInt32\":true}");
- }
-
- @Test
- public void propertyInt64JsonTypesNegativeCheck() throws Exception {
- checkPropertyJsonType("{\"PropertyInt64\":\"9223372036854775807\"}");
- checkPropertyJsonType("{\"PropertyInt64\":true}");
- }
-
- @Test
- public void propertyStringJsonTypesNegativeCheck() throws Exception {
- checkPropertyJsonType("{\"PropertyString\":32767}");
- checkPropertyJsonType("{\"PropertyString\":true}");
- }
-
- @Test
- public void propertyBooleanJsonTypesNegativeCheck() throws Exception {
- checkPropertyJsonType("{\"PropertyBoolean\":\"true\"}");
- checkPropertyJsonType("{\"PropertyBoolean\":123}");
- }
-
- @Test
- public void propertyByteJsonTypesNegativeCheck() throws Exception {
- checkPropertyJsonType("{\"PropertyByte\":\"255\"}");
- checkPropertyJsonType("{\"PropertyByte\":true}");
- }
-
- @Test
- public void propertySByteJsonTypesNegativeCheck() throws Exception {
- checkPropertyJsonType("{\"PropertySByte\":\"127\"}");
- checkPropertyJsonType("{\"PropertySByte\":true}");
- }
-
- @Test
- public void propertySingleJsonTypesNegativeCheck() throws Exception {
- checkPropertyJsonType("{\"PropertySingle\":\"1.79E20\"}");
- checkPropertyJsonType("{\"PropertySingle\":true}");
- }
-
- @Test
- public void propertyDoubleJsonTypesNegativeCheck() throws Exception {
- checkPropertyJsonType("{\"PropertyDouble\":\"-1.79E19\"}");
- checkPropertyJsonType("{\"PropertyDouble\":true}");
- }
-
- @Test
- public void propertyDecimalJsonTypesNegativeCheck() throws Exception {
- checkPropertyJsonType("{\"PropertyDecimal\":\"34\"}");
- checkPropertyJsonType("{\"PropertyDecimal\":true}");
- }
-
- @Test
- public void propertyBinaryJsonTypesNegativeCheck() throws Exception {
- checkPropertyJsonType("{\"PropertyBinary\":32767}");
- checkPropertyJsonType("{\"PropertyBinary\":true}");
- }
-
- @Test
- public void propertyDateJsonTypesNegativeCheck() throws Exception {
- checkPropertyJsonType("{\"PropertyDate\":32767}");
- checkPropertyJsonType("{\"PropertyDate\":true}");
- }
-
- @Test
- public void propertyDateTimeOffsetJsonTypesNegativeCheck() throws Exception {
- checkPropertyJsonType("{\"PropertyDateTimeOffset\":32767}");
- checkPropertyJsonType("{\"PropertyDateTimeOffset\":true}");
- }
-
- @Test
- public void propertyDurationJsonTypesNegativeCheck() throws Exception {
- checkPropertyJsonType("{\"PropertyDuration\":32767}");
- checkPropertyJsonType("{\"PropertyDuration\":true}");
- }
-
- @Test
- public void propertyGuidTimeOffsetJsonTypesNegativeCheck() throws Exception {
- checkPropertyJsonType("{\"PropertyGuid\":32767}");
- checkPropertyJsonType("{\"PropertyGuid\":true}");
- }
-
- @Test
- public void propertyTimeOfDayJsonTypesNegativeCheck() throws Exception {
- checkPropertyJsonType("{\"PropertyTimeOfDay\":32767}");
- checkPropertyJsonType("{\"PropertyTimeOfDay\":true}");
- }
-
- @Test(expected = DeserializerException.class)
- public void bindOperationWrongJsonTypeForToOne() throws Exception {
- String entityString =
- "{\"PropertyInt16\":32767,"
- + "\"PropertyString\":\"First Resource - positive values\","
- + "\"NavPropertyETTwoPrimOne@odata.bind\":[\"ESTwoPrim(2)\"]"
- + "}";
- InputStream stream = new ByteArrayInputStream(entityString.getBytes());
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
- try {
- deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETAllPrim")));
- } catch (DeserializerException e) {
- assertEquals(DeserializerException.MessageKeys.INVALID_ANNOTATION_TYPE, e.getMessageKey());
- throw e;
- }
- }
-
- @Test(expected = DeserializerException.class)
- public void bindOperationWrongJsonTypeForToMany() throws Exception {
- String entityString =
- "{\"PropertyInt16\":32767,"
- + "\"PropertyString\":\"First Resource - positive values\","
- + "\"NavPropertyETTwoPrimMany@odata.bind\":\"ESTwoPrim(2)\""
- + "}";
- InputStream stream = new ByteArrayInputStream(entityString.getBytes());
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
- try {
- deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETAllPrim")));
- } catch (DeserializerException e) {
- assertEquals(DeserializerException.MessageKeys.INVALID_ANNOTATION_TYPE, e.getMessageKey());
- throw e;
- }
- }
-
- @Test(expected = DeserializerException.class)
- public void bindOperationWrongJsonTypeForToManyNumberInArray() throws Exception {
- String entityString =
- "{\"PropertyInt16\":32767,"
- + "\"PropertyString\":\"First Resource - positive values\","
- + "\"NavPropertyETTwoPrimMany@odata.bind\":[123,456]"
- + "}";
- InputStream stream = new ByteArrayInputStream(entityString.getBytes());
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
- try {
- deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETAllPrim")));
- } catch (DeserializerException e) {
- assertEquals(DeserializerException.MessageKeys.INVALID_ANNOTATION_TYPE, e.getMessageKey());
- throw e;
- }
- }
-
- @Test(expected = DeserializerException.class)
- public void bindOperationWrongAnnotationFormat() throws Exception {
- String entityString =
- "{\"PropertyInt16\":32767,"
- + "\"PropertyString\":\"First Resource - positive values\","
- + "\"@odata.bind\":\"ESTwoPrim(2)\""
- + "}";
- InputStream stream = new ByteArrayInputStream(entityString.getBytes());
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
- try {
- deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETAllPrim")));
- } catch (DeserializerException e) {
- assertEquals(DeserializerException.MessageKeys.NAVIGATION_PROPERTY_NOT_FOUND, e.getMessageKey());
- throw e;
- }
- }
-
- @Test(expected = DeserializerException.class)
- public void bindingOperationNullOnToOne() throws Exception {
- String entityString =
- "{\"PropertyInt16\":32767,"
- + "\"PropertyString\":\"First Resource - positive values\","
- + "\"NavPropertyETTwoPrimOne@odata.bind\":null"
- + "}";
- InputStream stream = new ByteArrayInputStream(entityString.getBytes());
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
- try {
- deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETAllPrim")));
- } catch (DeserializerException e) {
- assertEquals(DeserializerException.MessageKeys.INVALID_NULL_ANNOTATION, e.getMessageKey());
- throw e;
- }
- }
-
- @Test(expected = DeserializerException.class)
- public void bindingOperationNullOnToMany() throws Exception {
- String entityString =
- "{\"PropertyInt16\":32767,"
- + "\"PropertyString\":\"First Resource - positive values\","
- + "\"NavPropertyETTwoPrimMany@odata.bind\":null"
- + "}";
- InputStream stream = new ByteArrayInputStream(entityString.getBytes());
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
- try {
- deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETAllPrim")));
- } catch (DeserializerException e) {
- assertEquals(DeserializerException.MessageKeys.INVALID_NULL_ANNOTATION, e.getMessageKey());
- throw e;
- }
- }
-
- @Test(expected = DeserializerException.class)
- public void bindingOperationNullInArray() throws Exception {
- String entityString =
- "{\"PropertyInt16\":32767,"
- + "\"PropertyString\":\"First Resource - positive values\","
- + "\"NavPropertyETTwoPrimMany@odata.bind\":[null]"
- + "}";
- InputStream stream = new ByteArrayInputStream(entityString.getBytes());
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
- try {
- deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETAllPrim")));
- } catch (DeserializerException e) {
- assertEquals(DeserializerException.MessageKeys.INVALID_NULL_ANNOTATION, e.getMessageKey());
- throw e;
- }
- }
-
- @Test(expected = DeserializerException.class)
- public void invalidJsonSyntax() throws Exception {
- String entityString =
- "{\"PropertyInt16\":32767,}";
- InputStream stream = new ByteArrayInputStream(entityString.getBytes());
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
- try {
- deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETAllPrim")));
- } catch (DeserializerException e) {
- assertEquals(DeserializerException.MessageKeys.JSON_SYNTAX_EXCEPTION, e.getMessageKey());
- throw e;
- }
- }
-
- @Test(expected = DeserializerException.class)
- public void invalidJsonValueForPrimTypeArray() throws Exception {
- String entityString =
- "{\"PropertyInt16\":[]}";
- InputStream stream = new ByteArrayInputStream(entityString.getBytes());
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
- try {
- deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETAllPrim")));
- } catch (DeserializerException e) {
- assertEquals(DeserializerException.MessageKeys.INVALID_JSON_TYPE_FOR_PROPERTY, e.getMessageKey());
- throw e;
- }
- }
-
- @Test(expected = DeserializerException.class)
- public void invalidJsonValueForPrimTypeObject() throws Exception {
- String entityString =
- "{\"PropertyInt16\":{}}";
- InputStream stream = new ByteArrayInputStream(entityString.getBytes());
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
- try {
- deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETAllPrim")));
- } catch (DeserializerException e) {
- assertEquals(DeserializerException.MessageKeys.INVALID_JSON_TYPE_FOR_PROPERTY, e.getMessageKey());
- throw e;
- }
- }
-
- @Test(expected = DeserializerException.class)
- public void invalidJsonValueForPrimCollectionTypeObject() throws Exception {
- final String entityString = "{"
- + "\"CollPropertyString\":"
- + "{\"Employee1@company.example\":1234}"
- + "}";
- InputStream stream = new ByteArrayInputStream(entityString.getBytes());
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
- try {
- deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETMixPrimCollComp")));
- } catch (DeserializerException e) {
- assertEquals(DeserializerException.MessageKeys.INVALID_JSON_TYPE_FOR_PROPERTY, e.getMessageKey());
- throw e;
- }
- }
-
- @Test(expected = DeserializerException.class)
- public void invalidJsonValueForComplexTypeTypeString() throws Exception {
- final String entityString = "{"
- + "\"PropertyComp\":\"InvalidString\""
- + "}";
- InputStream stream = new ByteArrayInputStream(entityString.getBytes());
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
- try {
- deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETMixPrimCollComp")));
- } catch (DeserializerException e) {
- assertEquals(DeserializerException.MessageKeys.INVALID_JSON_TYPE_FOR_PROPERTY, e.getMessageKey());
- throw e;
- }
- }
-
- @Test(expected = DeserializerException.class)
- public void invalidNullValueForComplexTypeNullableFalse() throws Exception {
- final String entityString = "{"
- + "\"PropertyComp\":null"
- + "}";
- InputStream stream = new ByteArrayInputStream(entityString.getBytes());
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
- try {
- deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETTwoKeyNav")));
- } catch (DeserializerException e) {
- assertEquals(DeserializerException.MessageKeys.INVALID_NULL_PROPERTY, e.getMessageKey());
- throw e;
- }
- }
-
- @Test(expected = DeserializerException.class)
- public void invalidNullValueForPrimBeforeComplexTypeNullableFalse() throws Exception {
- final String entityString = "{"
- + "\"PropertyInt16\": null, \"PropertyString\": \"321\", "
- + "\"PropertyComp\":{\"PropertyInt16\": null, "
- + "\"PropertyComp\": {\"PropertyString\":\"StringValue\"}}"
- + "}";
- InputStream stream = new ByteArrayInputStream(entityString.getBytes());
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
- try {
- deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETTwoKeyNav")));
- } catch (DeserializerException e) {
- assertEquals(DeserializerException.MessageKeys.INVALID_NULL_PROPERTY, e.getMessageKey());
- throw e;
- }
- }
-
- @Test(expected = DeserializerException.class)
- public void invalidNullValueForComplexTypePropertyNullableFalse() throws Exception {
- final String entityString = "{"
- + "\"PropertyInt16\": 123, "
- + "\"PropertyCompTwoPrim\":{\"PropertyInt16\": null, \"PropertyString\":\"StringValue\"}"
- + "}";
- InputStream stream = new ByteArrayInputStream(entityString.getBytes());
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
- try {
- deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETKeyNav")));
- } catch (DeserializerException e) {
- assertEquals(DeserializerException.MessageKeys.INVALID_NULL_PROPERTY, e.getMessageKey());
- throw e;
- }
- }
-
- @Test(expected = DeserializerException.class)
- public void invalidNullValueForPrimCollectionNullableFalse() throws Exception {
- final String entityString = "{"
- + "\"CollPropertyString\":["
- + "null,"
- + "\"StringValue_1\",\"TEST 3\"]}";
- InputStream stream = new ByteArrayInputStream(entityString.getBytes());
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
- try {
- deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETCollAllPrim")));
- } catch (DeserializerException e) {
- assertEquals(DeserializerException.MessageKeys.INVALID_NULL_PROPERTY, e.getMessageKey());
- throw e;
- }
- }
-
- @Test(expected = DeserializerException.class)
- public void invalidNullValueForPrimIntCollectionNullableFalse() throws Exception {
- final String entityString = "{"
- + "\"CollPropertyInt16\":[123,\"null\",4711]"
- + "}";
- InputStream stream = new ByteArrayInputStream(entityString.getBytes());
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
- try {
- deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETCollAllPrim")));
- } catch (DeserializerException e) {
- assertEquals(DeserializerException.MessageKeys.INVALID_VALUE_FOR_PROPERTY, e.getMessageKey());
- throw e;
- }
- }
-
- @Test(expected = DeserializerException.class)
- public void provokedPrimitiveTypeException() throws Exception {
- final String entityString = "{"
- + "\"PropertyInt16\":32767000000000000000000000000000000000000"
- + "}";
- InputStream stream = new ByteArrayInputStream(entityString.getBytes());
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
- try {
- deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETMixPrimCollComp")));
- } catch (DeserializerException e) {
- assertEquals(DeserializerException.MessageKeys.INVALID_VALUE_FOR_PROPERTY, e.getMessageKey());
- throw e;
- }
- }
-
- @Test(expected = DeserializerException.class)
- public void eTMixEnumDefCollCompInvalidEnumValueNull() throws Exception {
- String entityString = "{"
- + "\"PropertyEnumString\" : null,"
- + "\"PropertyCompEnum\" : {"
- + "\"PropertyEnumString\" : 2"
- + "}}";
-
- InputStream stream = new ByteArrayInputStream(entityString.getBytes());
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
- Entity e = deserializer.entity(stream, edm.getEntityType(
- new FullQualifiedName("Namespace1_Alias", "ETMixEnumDefCollComp")));
-
- assertNull(e.getProperty("PropertyEnumString").getValue());
- Property propertyCompMixedEnumDef = e.getProperty("PropertyCompMixedEnumDef");
- assertEquals(Short.valueOf("2"), propertyCompMixedEnumDef.asComplex().get(0).getValue());
- }
-
- @Test(expected = DeserializerException.class)
- public void eTMixEnumDefCollCompInvalidEnumValueArray() throws Exception {
- String entityString = "{"
- + "\"PropertyEnumString\" : [],"
- + "\"PropertyCompEnum\" : {"
- + "\"PropertyEnumString\" : 2"
- + "}}";
-
- InputStream stream = new ByteArrayInputStream(entityString.getBytes());
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
- try {
- deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETMixEnumDefCollComp")));
- } catch (DeserializerException e) {
- assertEquals(DeserializerException.MessageKeys.INVALID_JSON_TYPE_FOR_PROPERTY, e.getMessageKey());
- throw e;
- }
- }
-
- @Test(expected = DeserializerException.class)
- public void eTMixEnumDefCollCompInvalidEnumValueObject() throws Exception {
- String entityString = "{"
- + "\"PropertyEnumString\" : {},"
- + "\"PropertyCompEnum\" : {"
- + "\"PropertyEnumString\" : 2"
- + "}}";
-
- InputStream stream = new ByteArrayInputStream(entityString.getBytes());
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
- try {
- deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETMixEnumDefCollComp")));
- } catch (DeserializerException e) {
- assertEquals(DeserializerException.MessageKeys.INVALID_JSON_TYPE_FOR_PROPERTY, e.getMessageKey());
- throw e;
- }
- }
-
- @Test(expected = DeserializerException.class)
- public void eTMixEnumDefCollCompInvalidEnumValue() throws Exception {
- String entityString = "{"
- + "\"PropertyEnumString\" : \"invalid\","
- + "\"PropertyCompEnum\" : {"
- + "\"PropertyEnumString\" : 2"
- + "}}";
-
- InputStream stream = new ByteArrayInputStream(entityString.getBytes());
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
- try {
- deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETMixEnumDefCollComp")));
- } catch (DeserializerException e) {
- assertEquals(DeserializerException.MessageKeys.INVALID_VALUE_FOR_PROPERTY, e.getMessageKey());
- throw e;
- }
- }
-
- @Test(expected = DeserializerException.class)
- public void eTMixEnumDefCollCompInvalidEnumValueByPrimitiveTypeException() throws Exception {
- String entityString = "{"
- + "\"PropertyEnumString\" : 18,"
- + "\"PropertyCompEnum\" : {"
- + "\"PropertyEnumString\" : 2"
- + "}}";
-
- InputStream stream = new ByteArrayInputStream(entityString.getBytes());
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
- try {
- deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETMixEnumDefCollComp")));
- } catch (DeserializerException e) {
- assertEquals(DeserializerException.MessageKeys.INVALID_VALUE_FOR_PROPERTY, e.getMessageKey());
- throw e;
- }
- }
-
-// @Test(expected = DeserializerException.class)
-// public void invalidJsonValueForPrimCollectionTypeObject() throws Exception {
-// final String entityString = "{"
-// + "\"PropertyInt16\":32767,"
-// + "\"CollPropertyString\":"
-// + "[\"Employee1@company.example\",\"Employee2@company.example\",\"Employee3@company.example\"],"
-// + "\"PropertyComp\":{\"PropertyInt16\":111,\"PropertyString\":\"TEST A\"},"
-// + "\"CollPropertyComp\":["
-// + "{\"PropertyInt16\":123,\"PropertyString\":\"TEST 1\"},"
-// + "{\"PropertyInt16\":456,\"PropertyString\":\"TEST 2\"},"
-// + "{\"PropertyInt16\":789,\"PropertyString\":\"TEST 3\"}]}";
-// InputStream stream = new ByteArrayInputStream(entityString.getBytes());
-// ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
-// try {
-// deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETMixPrimCollComp")));
-// } catch (DeserializerException e) {
-// assertEquals(DeserializerException.MessageKeys.INVALID_JSON_TYPE_FOR_PROPERTY, e.getMessageKey());
-// throw e;
-// }
-// }
-
- private void checkPropertyJsonType(String entityString) throws DeserializerException {
- InputStream stream = new ByteArrayInputStream(entityString.getBytes());
- ODataDeserializer deserializer = OData.newInstance().createDeserializer(ODataFormat.JSON);
- try {
- deserializer.entity(stream, edm.getEntityType(new FullQualifiedName("Namespace1_Alias", "ETAllPrim")));
- fail("Expected an exception but was not thrown: " + this.getClass().getName());
- } catch (DeserializerException e) {
- assertEquals(DeserializerException.MessageKeys.INVALID_VALUE_FOR_PROPERTY, e.getMessageKey());
- }
- }
-}
diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/serializer/ExpandSelectMock.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/serializer/ExpandSelectMock.java
deleted file mode 100644
index 1bf2c9d..0000000
--- a/lib/server-test/src/test/java/org/apache/olingo/server/core/serializer/ExpandSelectMock.java
+++ /dev/null
@@ -1,90 +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.serializer;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import org.apache.olingo.commons.api.edm.EdmElement;
-import org.apache.olingo.commons.api.edm.EdmEntitySet;
-import org.apache.olingo.commons.api.edm.EdmNavigationProperty;
-import org.apache.olingo.commons.api.edm.EdmProperty;
-import org.apache.olingo.commons.api.edm.EdmStructuredType;
-import org.apache.olingo.commons.api.edm.constants.EdmTypeKind;
-import org.apache.olingo.server.api.uri.UriInfoResource;
-import org.apache.olingo.server.api.uri.UriResource;
-import org.apache.olingo.server.api.uri.UriResourceNavigation;
-import org.apache.olingo.server.api.uri.UriResourceProperty;
-import org.apache.olingo.server.api.uri.queryoption.ExpandItem;
-import org.apache.olingo.server.api.uri.queryoption.ExpandOption;
-import org.apache.olingo.server.api.uri.queryoption.SelectItem;
-import org.apache.olingo.server.api.uri.queryoption.SelectOption;
-import org.mockito.Mockito;
-
-public final class ExpandSelectMock {
-
- private static UriInfoResource mockResource(final EdmEntitySet edmEntitySet, final String... names) {
- EdmStructuredType type = edmEntitySet.getEntityType();
- List<UriResource> elements = new ArrayList<UriResource>();
- for (final String name : Arrays.asList(names)) {
- final EdmElement edmElement = type.getProperty(name);
- if (edmElement.getType().getKind() == EdmTypeKind.ENTITY) {
- UriResourceNavigation element = Mockito.mock(UriResourceNavigation.class);
- Mockito.when(element.getProperty()).thenReturn((EdmNavigationProperty) edmElement);
- elements.add(element);
- } else {
- final EdmProperty property = (EdmProperty) edmElement;
- UriResourceProperty element = Mockito.mock(UriResourceProperty.class);
- Mockito.when(element.getProperty()).thenReturn(property);
- elements.add(element);
- type = property.isPrimitive() ? null : (EdmStructuredType) property.getType();
- }
- }
- UriInfoResource resource = Mockito.mock(UriInfoResource.class);
- Mockito.when(resource.getUriResourceParts()).thenReturn(elements);
- return resource;
- }
-
- public static SelectItem mockSelectItem(final EdmEntitySet edmEntitySet, final String... names) {
- final UriInfoResource resource = mockResource(edmEntitySet, names);
- SelectItem selectItem = Mockito.mock(SelectItem.class);
- Mockito.when(selectItem.getResourcePath()).thenReturn(resource);
- return selectItem;
- }
-
- public static SelectOption mockSelectOption(final List<SelectItem> selectItems) {
- SelectOption select = Mockito.mock(SelectOption.class);
- Mockito.when(select.getSelectItems()).thenReturn(selectItems);
- return select;
- }
-
- public static ExpandItem mockExpandItem(final EdmEntitySet edmEntitySet, final String... names) {
- final UriInfoResource resource = mockResource(edmEntitySet, names);
- ExpandItem expandItem = Mockito.mock(ExpandItem.class);
- Mockito.when(expandItem.getResourcePath()).thenReturn(resource);
- return expandItem;
- }
-
- public static ExpandOption mockExpandOption(final List<ExpandItem> expandItems) {
- ExpandOption expand = Mockito.mock(ExpandOption.class);
- Mockito.when(expand.getExpandItems()).thenReturn(expandItems);
- return expand;
- }
-}
diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/serializer/json/ODataJsonSerializerTest.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/serializer/json/ODataJsonSerializerTest.java
deleted file mode 100644
index 038c668..0000000
--- a/lib/server-test/src/test/java/org/apache/olingo/server/core/serializer/json/ODataJsonSerializerTest.java
+++ /dev/null
@@ -1,681 +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.serializer.json;
-
-import java.io.InputStream;
-import java.net.URI;
-import java.util.Arrays;
-import java.util.Collections;
-
-import org.apache.commons.io.IOUtils;
-import org.apache.olingo.commons.api.data.ContextURL;
-import org.apache.olingo.commons.api.data.ContextURL.Suffix;
-import org.apache.olingo.commons.api.data.Entity;
-import org.apache.olingo.commons.api.data.EntitySet;
-import org.apache.olingo.commons.api.data.Property;
-import org.apache.olingo.commons.api.data.ValueType;
-import org.apache.olingo.commons.api.edm.Edm;
-import org.apache.olingo.commons.api.edm.EdmComplexType;
-import org.apache.olingo.commons.api.edm.EdmEntityContainer;
-import org.apache.olingo.commons.api.edm.EdmEntitySet;
-import org.apache.olingo.commons.api.edm.EdmEntityType;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
-import org.apache.olingo.commons.api.edm.EdmProperty;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.api.format.ODataFormat;
-import org.apache.olingo.commons.core.data.PropertyImpl;
-import org.apache.olingo.server.api.OData;
-import org.apache.olingo.server.api.edmx.EdmxReference;
-import org.apache.olingo.server.api.serializer.ComplexSerializerOptions;
-import org.apache.olingo.server.api.serializer.EntityCollectionSerializerOptions;
-import org.apache.olingo.server.api.serializer.ODataSerializer;
-import org.apache.olingo.server.api.serializer.EntitySerializerOptions;
-import org.apache.olingo.server.api.serializer.PrimitiveSerializerOptions;
-import org.apache.olingo.server.api.serializer.SerializerException;
-import org.apache.olingo.server.api.uri.UriHelper;
-import org.apache.olingo.server.api.uri.queryoption.CountOption;
-import org.apache.olingo.server.api.uri.queryoption.ExpandItem;
-import org.apache.olingo.server.api.uri.queryoption.ExpandOption;
-import org.apache.olingo.server.api.uri.queryoption.SelectItem;
-import org.apache.olingo.server.api.uri.queryoption.SelectOption;
-import org.apache.olingo.server.core.serializer.ExpandSelectMock;
-import org.apache.olingo.server.core.uri.UriHelperImpl;
-import org.apache.olingo.server.tecsvc.data.DataProvider;
-import org.apache.olingo.server.tecsvc.provider.EdmTechProvider;
-import org.hamcrest.CoreMatchers;
-import org.junit.Assert;
-import org.junit.Test;
-import org.mockito.Mockito;
-
-public class ODataJsonSerializerTest {
-
- private static final Edm edm = OData.newInstance().createServiceMetadata(
- new EdmTechProvider(), Collections.<EdmxReference> emptyList()).getEdm();
- private static final EdmEntityContainer entityContainer = edm.getEntityContainer(
- new FullQualifiedName("olingo.odata.test1", "Container"));
- private final DataProvider data = new DataProvider();
- private final ODataSerializer serializer = new ODataJsonSerializer(ODataFormat.JSON);
- private final UriHelper helper = new UriHelperImpl();
-
- @Test
- public void entitySimple() throws Exception {
- final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESAllPrim");
- final Entity entity = data.readAll(edmEntitySet).getEntities().get(0);
- InputStream result = serializer.entity(edmEntitySet.getEntityType(), entity,
- EntitySerializerOptions.with()
- .contextURL(ContextURL.with().entitySet(edmEntitySet).suffix(Suffix.ENTITY).build())
- .build());
- final String resultString = IOUtils.toString(result);
- final String expectedResult = "{"
- + "\"@odata.context\":\"$metadata#ESAllPrim/$entity\","
- + "\"PropertyInt16\":32767,"
- + "\"PropertyString\":\"First Resource - positive values\","
- + "\"PropertyBoolean\":true,"
- + "\"PropertyByte\":255,"
- + "\"PropertySByte\":127,"
- + "\"PropertyInt32\":2147483647,"
- + "\"PropertyInt64\":9223372036854775807,"
- + "\"PropertySingle\":1.79E20,"
- + "\"PropertyDouble\":-1.79E19,"
- + "\"PropertyDecimal\":34,"
- + "\"PropertyBinary\":\"ASNFZ4mrze8=\","
- + "\"PropertyDate\":\"2012-12-03\","
- + "\"PropertyDateTimeOffset\":\"2012-12-03T07:16:23Z\","
- + "\"PropertyDuration\":\"PT6S\","
- + "\"PropertyGuid\":\"01234567-89ab-cdef-0123-456789abcdef\","
- + "\"PropertyTimeOfDay\":\"03:26:05\""
- + "}";
- Assert.assertEquals(expectedResult, resultString);
- }
-
- @Test
- public void entityAllPrimAllNull() throws Exception {
- final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESAllPrim");
- Entity entity = data.readAll(edmEntitySet).getEntities().get(0);
- entity.getProperties().retainAll(Arrays.asList(entity.getProperties().get(0)));
- final String resultString = IOUtils.toString(serializer.entity(edmEntitySet.getEntityType(), entity,
- EntitySerializerOptions.with()
- .contextURL(ContextURL.with().entitySet(edmEntitySet).suffix(Suffix.ENTITY).build())
- .build()));
- final String expectedResult = "{\"@odata.context\":\"$metadata#ESAllPrim/$entity\","
- + "\"PropertyInt16\":32767,"
- + "\"PropertyString\":null,\"PropertyBoolean\":null,"
- + "\"PropertyByte\":null,\"PropertySByte\":null,"
- + "\"PropertyInt32\":null,\"PropertyInt64\":null,"
- + "\"PropertySingle\":null,\"PropertyDouble\":null,\"PropertyDecimal\":null,"
- + "\"PropertyBinary\":null,"
- + "\"PropertyDate\":null,\"PropertyDateTimeOffset\":null,\"PropertyDuration\":null,"
- + "\"PropertyGuid\":null,\"PropertyTimeOfDay\":null}";
- Assert.assertEquals(expectedResult, resultString);
- }
-
- @Test(expected = SerializerException.class)
- public void entityAllPrimKeyNull() throws Exception {
- final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESAllPrim");
- Entity entity = data.readAll(edmEntitySet).getEntities().get(0);
- entity.getProperties().clear();
- serializer.entity(edmEntitySet.getEntityType(), entity,
- EntitySerializerOptions.with()
- .contextURL(ContextURL.with().entitySet(edmEntitySet).suffix(Suffix.ENTITY).build())
- .build());
- }
-
- @Test
- public void entityWrongData() throws Exception {
- final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESAllPrim");
- Entity entity = data.readAll(edmEntitySet).getEntities().get(0);
- entity.getProperties().get(0).setValue(ValueType.PRIMITIVE, false);
- try {
- serializer.entity(edmEntitySet.getEntityType(), entity,
- EntitySerializerOptions.with()
- .contextURL(ContextURL.with().entitySet(edmEntitySet).suffix(Suffix.ENTITY).build())
- .build());
- Assert.fail("Expected exception not thrown!");
- } catch (final SerializerException e) {
- Assert.assertEquals(SerializerException.MessageKeys.WRONG_PROPERTY_VALUE, e.getMessageKey());
- final String message = e.getLocalizedMessage();
- Assert.assertThat(message, CoreMatchers.containsString("PropertyInt16"));
- Assert.assertThat(message, CoreMatchers.containsString("false"));
- }
- }
-
- @Test
- public void entitySetAllPrim() throws Exception {
- final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESAllPrim");
- EntitySet entitySet = data.readAll(edmEntitySet);
- entitySet.setCount(entitySet.getEntities().size());
- entitySet.setNext(URI.create("/next"));
- CountOption countOption = Mockito.mock(CountOption.class);
- Mockito.when(countOption.getValue()).thenReturn(true);
- InputStream result = serializer.entityCollection(edmEntitySet.getEntityType(), entitySet,
- EntityCollectionSerializerOptions.with()
- .contextURL(ContextURL.with().entitySet(edmEntitySet).build())
- .count(countOption)
- .build());
- final String resultString = IOUtils.toString(result);
-
- Assert.assertThat(resultString, CoreMatchers.startsWith("{"
- + "\"@odata.context\":\"$metadata#ESAllPrim\","
- + "\"@odata.count\":3,\"value\":["));
- Assert.assertThat(resultString, CoreMatchers.endsWith("],"
- + "\"@odata.nextLink\":\"/next\"}"));
-
- int count = 0;
- int index = -1;
- while ((index = resultString.indexOf("PropertyInt16\":", ++index)) > 0) {
- count++;
- }
- Assert.assertEquals(3, count);
- }
-
- @Test
- public void entityCollAllPrim() throws Exception {
- final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESCollAllPrim");
- final Entity entity = data.readAll(edmEntitySet).getEntities().get(0);
- InputStream result = serializer.entity(edmEntitySet.getEntityType(), entity,
- EntitySerializerOptions.with()
- .contextURL(ContextURL.with().serviceRoot(URI.create("http://host/service/"))
- .entitySet(edmEntitySet).suffix(Suffix.ENTITY).build())
- .build());
- final String resultString = IOUtils.toString(result);
- final String expectedResult = "{"
- + "\"@odata.context\":\"http://host/service/$metadata#ESCollAllPrim/$entity\","
- + "\"PropertyInt16\":1,"
- + "\"CollPropertyString\":"
- + "[\"Employee1@company.example\",\"Employee2@company.example\",\"Employee3@company.example\"],"
- + "\"CollPropertyBoolean\":[true,false,true],"
- + "\"CollPropertyByte\":[50,200,249],"
- + "\"CollPropertySByte\":[-120,120,126],"
- + "\"CollPropertyInt16\":[1000,2000,30112],"
- + "\"CollPropertyInt32\":[23232323,11223355,10000001],"
- + "\"CollPropertyInt64\":[929292929292,333333333333,444444444444],"
- + "\"CollPropertySingle\":[1790.0,26600.0,3210.0],"
- + "\"CollPropertyDouble\":[-17900.0,-2.78E7,3210.0],"
- + "\"CollPropertyDecimal\":[12,-2,1234],"
- + "\"CollPropertyBinary\":[\"q83v\",\"ASNF\",\"VGeJ\"],"
- + "\"CollPropertyDate\":[\"1958-12-03\",\"1999-08-05\",\"2013-06-25\"],"
- + "\"CollPropertyDateTimeOffset\":[\"2015-08-12T03:08:34Z\",\"1970-03-28T12:11:10Z\","
- + "\"1948-02-17T09:09:09Z\"],"
- + "\"CollPropertyDuration\":[\"PT13S\",\"PT5H28M0S\",\"PT1H0S\"],"
- + "\"CollPropertyGuid\":[\"ffffff67-89ab-cdef-0123-456789aaaaaa\",\"eeeeee67-89ab-cdef-0123-456789bbbbbb\","
- + "\"cccccc67-89ab-cdef-0123-456789cccccc\"],"
- + "\"CollPropertyTimeOfDay\":[\"04:14:13\",\"23:59:59\",\"01:12:33\"]"
- + "}";
- Assert.assertEquals(expectedResult, resultString);
- }
-
- @Test
- public void entityCompAllPrim() throws Exception {
- final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESCompAllPrim");
- final Entity entity = data.readAll(edmEntitySet).getEntities().get(0);
- InputStream result = serializer.entity(edmEntitySet.getEntityType(), entity,
- EntitySerializerOptions.with()
- .contextURL(ContextURL.with().entitySet(edmEntitySet).suffix(Suffix.ENTITY).build())
- .build());
- final String resultString = IOUtils.toString(result);
- final String expectedResult = "{"
- + "\"@odata.context\":\"$metadata#ESCompAllPrim/$entity\","
- + "\"PropertyInt16\":32767,"
- + "\"PropertyComp\":{"
- + "\"PropertyString\":\"First Resource - first\","
- + "\"PropertyBinary\":\"ASNFZ4mrze8=\","
- + "\"PropertyBoolean\":true,"
- + "\"PropertyByte\":255,"
- + "\"PropertyDate\":\"2012-10-03\","
- + "\"PropertyDateTimeOffset\":\"2012-10-03T07:16:23.1234567Z\","
- + "\"PropertyDecimal\":34.27,"
- + "\"PropertySingle\":1.79E20,"
- + "\"PropertyDouble\":-1.79E19,"
- + "\"PropertyDuration\":\"PT6S\","
- + "\"PropertyGuid\":\"01234567-89ab-cdef-0123-456789abcdef\","
- + "\"PropertyInt16\":32767,"
- + "\"PropertyInt32\":2147483647,"
- + "\"PropertyInt64\":9223372036854775807,"
- + "\"PropertySByte\":127,"
- + "\"PropertyTimeOfDay\":\"01:00:01\""
- + "}}";
- Assert.assertEquals(expectedResult, resultString);
- }
-
- @Test
- public void entityMixPrimCollComp() throws Exception {
- final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESMixPrimCollComp");
- final Entity entity = data.readAll(edmEntitySet).getEntities().get(0);
- InputStream result = serializer.entity(edmEntitySet.getEntityType(), entity,
- EntitySerializerOptions.with()
- .contextURL(ContextURL.with().entitySet(edmEntitySet).suffix(Suffix.ENTITY).build())
- .build());
- final String resultString = IOUtils.toString(result);
- final String expectedResult = "{"
- + "\"@odata.context\":\"$metadata#ESMixPrimCollComp/$entity\","
- + "\"PropertyInt16\":32767,"
- + "\"CollPropertyString\":"
- + "[\"Employee1@company.example\",\"Employee2@company.example\",\"Employee3@company.example\"],"
- + "\"PropertyComp\":{\"PropertyInt16\":111,\"PropertyString\":\"TEST A\"},"
- + "\"CollPropertyComp\":["
- + "{\"PropertyInt16\":123,\"PropertyString\":\"TEST 1\"},"
- + "{\"PropertyInt16\":456,\"PropertyString\":\"TEST 2\"},"
- + "{\"PropertyInt16\":789,\"PropertyString\":\"TEST 3\"}]}";
- Assert.assertEquals(expectedResult, resultString);
- }
-
- @Test
- public void entityMixPrimCollCompAllNull() throws Exception {
- final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESMixPrimCollComp");
- Entity entity = data.readAll(edmEntitySet).getEntities().get(0);
- entity.getProperties().retainAll(Arrays.asList(entity.getProperties().get(0)));
- final String resultString = IOUtils.toString(serializer.entity(edmEntitySet.getEntityType(), entity,
- EntitySerializerOptions.with()
- .contextURL(ContextURL.with().entitySet(edmEntitySet).suffix(Suffix.ENTITY).build())
- .build()));
- final String expectedResult = "{\"@odata.context\":\"$metadata#ESMixPrimCollComp/$entity\","
- + "\"PropertyInt16\":32767,"
- + "\"CollPropertyString\":null,\"PropertyComp\":null,\"CollPropertyComp\":null}";
- Assert.assertEquals(expectedResult, resultString);
- }
-
- @Test
- public void entityTwoPrimNoMetadata() throws Exception {
- final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESTwoPrim");
- final Entity entity = data.readAll(edmEntitySet).getEntities().get(0);
- InputStream result = new ODataJsonSerializer(ODataFormat.JSON_NO_METADATA)
- .entity(edmEntitySet.getEntityType(), entity, null);
- final String resultString = IOUtils.toString(result);
- final String expectedResult = "{\"PropertyInt16\":32766,\"PropertyString\":\"Test String1\"}";
- Assert.assertEquals(expectedResult, resultString);
- }
-
- @Test
- public void entitySetTwoPrimNoMetadata() throws Exception {
- final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESTwoPrim");
- final EntitySet entitySet = data.readAll(edmEntitySet);
- InputStream result = new ODataJsonSerializer(ODataFormat.JSON_NO_METADATA)
- .entityCollection(edmEntitySet.getEntityType(), entitySet,
- EntityCollectionSerializerOptions.with()
- .contextURL(ContextURL.with().entitySet(edmEntitySet).build()).build());
- final String resultString = IOUtils.toString(result);
- final String expectedResult = "{\"value\":["
- + "{\"PropertyInt16\":32766,\"PropertyString\":\"Test String1\"},"
- + "{\"PropertyInt16\":-365,\"PropertyString\":\"Test String2\"},"
- + "{\"PropertyInt16\":-32766,\"PropertyString\":null},"
- + "{\"PropertyInt16\":32767,\"PropertyString\":\"Test String4\"}]}";
- Assert.assertEquals(expectedResult, resultString);
- }
-
- @Test
- public void entityMedia() throws Exception {
- final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESMedia");
- Entity entity = data.readAll(edmEntitySet).getEntities().get(0);
- entity.setMediaETag("theMediaETag");
- final String resultString = IOUtils.toString(serializer.entity(edmEntitySet.getEntityType(), entity,
- EntitySerializerOptions.with()
- .contextURL(ContextURL.with().entitySet(edmEntitySet).suffix(Suffix.ENTITY).build())
- .build()));
- final String expectedResult = "{\"@odata.context\":\"$metadata#ESMedia/$entity\","
- + "\"@odata.mediaEtag\":\"theMediaETag\",\"@odata.mediaContentType\":\"image/svg+xml\","
- + "\"PropertyInt16\":1}";
- Assert.assertEquals(expectedResult, resultString);
- }
-
- @Test
- public void entitySetMedia() throws Exception {
- final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESMedia");
- final EntitySet entitySet = data.readAll(edmEntitySet);
- final String resultString = IOUtils.toString(serializer.entityCollection(edmEntitySet.getEntityType(), entitySet,
- EntityCollectionSerializerOptions.with()
- .contextURL(ContextURL.with().entitySet(edmEntitySet).build()).build()));
- final String expectedResult = "{\"@odata.context\":\"$metadata#ESMedia\",\"value\":["
- + "{\"@odata.mediaContentType\":\"image/svg+xml\",\"PropertyInt16\":1},"
- + "{\"@odata.mediaContentType\":\"image/svg+xml\",\"PropertyInt16\":2},"
- + "{\"@odata.mediaContentType\":\"image/svg+xml\",\"PropertyInt16\":3},"
- + "{\"@odata.mediaContentType\":\"image/svg+xml\",\"PropertyInt16\":4}]}";
- Assert.assertEquals(expectedResult, resultString);
- }
-
- @Test
- public void select() throws Exception {
- final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESAllPrim");
- final EdmEntityType entityType = edmEntitySet.getEntityType();
- final Entity entity = data.readAll(edmEntitySet).getEntities().get(0);
- final SelectItem selectItem1 = ExpandSelectMock.mockSelectItem(edmEntitySet, "PropertyDate");
- final SelectItem selectItem2 = ExpandSelectMock.mockSelectItem(edmEntitySet, "PropertyBoolean");
- final SelectOption select = ExpandSelectMock.mockSelectOption(Arrays.asList(
- selectItem1, selectItem2, selectItem2));
- InputStream result = serializer
- .entity(entityType, entity,
- EntitySerializerOptions.with()
- .contextURL(ContextURL.with().entitySet(edmEntitySet)
- .selectList(helper.buildContextURLSelectList(entityType, null, select))
- .suffix(Suffix.ENTITY).build())
- .select(select)
- .build());
- final String resultString = IOUtils.toString(result);
- final String expectedResult = "{"
- + "\"@odata.context\":\"$metadata#ESAllPrim(PropertyBoolean,PropertyDate)/$entity\","
- + "\"PropertyBoolean\":true,\"PropertyDate\":\"2012-12-03\"}";
- Assert.assertEquals(expectedResult, resultString);
- }
-
- @Test
- public void selectAll() throws Exception {
- final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESTwoPrim");
- final Entity entity = data.readAll(edmEntitySet).getEntities().get(0);
- final SelectItem selectItem1 = ExpandSelectMock.mockSelectItem(edmEntitySet, "PropertyString");
- SelectItem selectItem2 = Mockito.mock(SelectItem.class);
- Mockito.when(selectItem2.isStar()).thenReturn(true);
- final SelectOption select = ExpandSelectMock.mockSelectOption(Arrays.asList(selectItem1, selectItem2));
- InputStream result = serializer.entity(edmEntitySet.getEntityType(), entity,
- EntitySerializerOptions.with()
- .contextURL(ContextURL.with().entitySet(edmEntitySet).suffix(Suffix.ENTITY).build())
- .select(select)
- .build());
- final String resultString = IOUtils.toString(result);
- final String expectedResult = "{\"@odata.context\":\"$metadata#ESTwoPrim/$entity\","
- + "\"PropertyInt16\":32766,\"PropertyString\":\"Test String1\"}";
- Assert.assertEquals(expectedResult, resultString);
- }
-
- @Test
- public void selectComplex() throws Exception {
- final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESCompComp");
- final EdmEntityType entityType = edmEntitySet.getEntityType();
- final EntitySet entitySet = data.readAll(edmEntitySet);
- final SelectOption select = ExpandSelectMock.mockSelectOption(Arrays.asList(
- ExpandSelectMock.mockSelectItem(edmEntitySet, "PropertyComp", "PropertyComp", "PropertyString")));
- InputStream result = serializer
- .entityCollection(entityType, entitySet,
- EntityCollectionSerializerOptions.with()
- .contextURL(ContextURL.with().entitySet(edmEntitySet)
- .selectList(helper.buildContextURLSelectList(entityType, null, select))
- .build())
- .select(select)
- .build());
- final String resultString = IOUtils.toString(result);
- Assert.assertEquals("{"
- + "\"@odata.context\":\"$metadata#ESCompComp(PropertyComp/PropertyComp/PropertyString)\","
- + "\"value\":["
- + "{\"PropertyComp\":{\"PropertyComp\":{\"PropertyString\":\"String 1\"}}},"
- + "{\"PropertyComp\":{\"PropertyComp\":{\"PropertyString\":\"String 2\"}}}]}",
- resultString);
- }
-
- @Test
- public void selectComplexTwice() throws Exception {
- final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESCompComp");
- final EdmEntityType entityType = edmEntitySet.getEntityType();
- final EntitySet entitySet = data.readAll(edmEntitySet);
- final SelectOption select = ExpandSelectMock.mockSelectOption(Arrays.asList(
- ExpandSelectMock.mockSelectItem(edmEntitySet, "PropertyComp", "PropertyComp", "PropertyString"),
- ExpandSelectMock.mockSelectItem(edmEntitySet, "PropertyComp", "PropertyComp")));
- final String resultString = IOUtils.toString(serializer
- .entityCollection(entityType, entitySet,
- EntityCollectionSerializerOptions.with()
- .contextURL(ContextURL.with().entitySet(edmEntitySet)
- .selectList(helper.buildContextURLSelectList(entityType, null, select))
- .build())
- .select(select)
- .build()));
- Assert.assertEquals("{"
- + "\"@odata.context\":\"$metadata#ESCompComp(PropertyComp/PropertyComp)\","
- + "\"value\":["
- + "{\"PropertyComp\":{\"PropertyComp\":{\"PropertyInt16\":123,\"PropertyString\":\"String 1\"}}},"
- + "{\"PropertyComp\":{\"PropertyComp\":{\"PropertyInt16\":987,\"PropertyString\":\"String 2\"}}}]}",
- resultString);
- }
-
- @Test
- public void expand() throws Exception {
- final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESTwoPrim");
- final Entity entity = data.readAll(edmEntitySet).getEntities().get(3);
- final ExpandOption expand = ExpandSelectMock.mockExpandOption(Arrays.asList(
- ExpandSelectMock.mockExpandItem(edmEntitySet, "NavPropertyETAllPrimOne")));
- InputStream result = serializer.entity(edmEntitySet.getEntityType(), entity,
- EntitySerializerOptions.with()
- .contextURL(ContextURL.with().entitySet(edmEntitySet).suffix(Suffix.ENTITY).build())
- .expand(expand)
- .build());
- final String resultString = IOUtils.toString(result);
- Assert.assertEquals("{\"@odata.context\":\"$metadata#ESTwoPrim/$entity\","
- + "\"PropertyInt16\":32767,\"PropertyString\":\"Test String4\","
- + "\"NavPropertyETAllPrimOne\":{"
- + "\"PropertyInt16\":32767,"
- + "\"PropertyString\":\"First Resource - positive values\","
- + "\"PropertyBoolean\":true,"
- + "\"PropertyByte\":255,"
- + "\"PropertySByte\":127,"
- + "\"PropertyInt32\":2147483647,"
- + "\"PropertyInt64\":9223372036854775807,"
- + "\"PropertySingle\":1.79E20,"
- + "\"PropertyDouble\":-1.79E19,"
- + "\"PropertyDecimal\":34,"
- + "\"PropertyBinary\":\"ASNFZ4mrze8=\","
- + "\"PropertyDate\":\"2012-12-03\","
- + "\"PropertyDateTimeOffset\":\"2012-12-03T07:16:23Z\","
- + "\"PropertyDuration\":\"PT6S\","
- + "\"PropertyGuid\":\"01234567-89ab-cdef-0123-456789abcdef\","
- + "\"PropertyTimeOfDay\":\"03:26:05\"}}",
- resultString);
- }
-
- @Test
- public void expandSelect() throws Exception {
- final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESTwoPrim");
- final EdmEntityType entityType = edmEntitySet.getEntityType();
- final Entity entity = data.readAll(edmEntitySet).getEntities().get(3);
- final SelectOption select = ExpandSelectMock.mockSelectOption(Arrays.asList(
- ExpandSelectMock.mockSelectItem(entityContainer.getEntitySet("ESAllPrim"), "PropertyDate")));
- ExpandItem expandItem = ExpandSelectMock.mockExpandItem(edmEntitySet, "NavPropertyETAllPrimOne");
- Mockito.when(expandItem.getSelectOption()).thenReturn(select);
- final ExpandOption expand = ExpandSelectMock.mockExpandOption(Arrays.asList(expandItem));
- final String resultString = IOUtils.toString(serializer
- .entity(entityType, entity,
- EntitySerializerOptions.with()
- .contextURL(ContextURL.with().entitySet(edmEntitySet)
- .selectList(helper.buildContextURLSelectList(entityType, expand, select))
- .suffix(Suffix.ENTITY).build())
- .expand(expand)
- .build()));
- Assert.assertEquals("{"
- + "\"@odata.context\":\"$metadata#ESTwoPrim(NavPropertyETAllPrimOne(PropertyDate))/$entity\","
- + "\"PropertyInt16\":32767,\"PropertyString\":\"Test String4\","
- + "\"NavPropertyETAllPrimOne\":{\"PropertyDate\":\"2012-12-03\"}}",
- resultString);
- }
-
- @Test
- public void expandAll() throws Exception {
- final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESAllPrim");
- final EdmEntityType entityType = edmEntitySet.getEntityType();
- final Entity entity = data.readAll(edmEntitySet).getEntities().get(0);
- final ExpandItem expandItem = ExpandSelectMock.mockExpandItem(edmEntitySet, "NavPropertyETTwoPrimOne");
- ExpandItem expandItemAll = Mockito.mock(ExpandItem.class);
- Mockito.when(expandItemAll.isStar()).thenReturn(true);
- final ExpandOption expand = ExpandSelectMock.mockExpandOption(Arrays.asList(
- expandItem, expandItem, expandItemAll));
- final SelectOption select = ExpandSelectMock.mockSelectOption(Arrays.asList(
- ExpandSelectMock.mockSelectItem(edmEntitySet, "PropertySByte")));
- final String resultString = IOUtils.toString(serializer
- .entity(entityType, entity,
- EntitySerializerOptions.with()
- .contextURL(ContextURL.with().entitySet(edmEntitySet)
- .selectList(helper.buildContextURLSelectList(entityType, expand, select))
- .suffix(Suffix.ENTITY).build())
- .expand(expand)
- .select(select)
- .build()));
- Assert.assertEquals("{"
- + "\"@odata.context\":\"$metadata#ESAllPrim(PropertySByte)/$entity\","
- + "\"PropertySByte\":127,"
- + "\"NavPropertyETTwoPrimOne\":{\"PropertyInt16\":32767,\"PropertyString\":\"Test String4\"},"
- + "\"NavPropertyETTwoPrimMany\":[{\"PropertyInt16\":-365,\"PropertyString\":\"Test String2\"}]}",
- resultString);
- }
-
- @Test
- public void expandNoData() throws Exception {
- final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESAllPrim");
- final EdmEntityType entityType = edmEntitySet.getEntityType();
- final Entity entity = data.readAll(edmEntitySet).getEntities().get(1);
- ExpandItem expandItemAll = Mockito.mock(ExpandItem.class);
- Mockito.when(expandItemAll.isStar()).thenReturn(true);
- final ExpandOption expand = ExpandSelectMock.mockExpandOption(Arrays.asList(expandItemAll));
- final SelectOption select = ExpandSelectMock.mockSelectOption(Arrays.asList(
- ExpandSelectMock.mockSelectItem(edmEntitySet, "PropertyTimeOfDay")));
- final String resultString = IOUtils.toString(serializer
- .entity(entityType, entity,
- EntitySerializerOptions.with()
- .contextURL(ContextURL.with().entitySet(edmEntitySet)
- .selectList(helper.buildContextURLSelectList(entityType, expand, select))
- .suffix(Suffix.ENTITY).build())
- .expand(expand)
- .select(select)
- .build()));
- Assert.assertEquals("{"
- + "\"@odata.context\":\"$metadata#ESAllPrim(PropertyTimeOfDay)/$entity\","
- + "\"PropertyTimeOfDay\":\"23:49:14\","
- + "\"NavPropertyETTwoPrimOne\":null,\"NavPropertyETTwoPrimMany\":[]}",
- resultString);
- }
-
- @Test
- public void expandTwoLevels() throws Exception {
- final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESTwoPrim");
- final EdmEntityType entityType = edmEntitySet.getEntityType();
- final EdmEntitySet innerEntitySet = entityContainer.getEntitySet("ESAllPrim");
- final Entity entity = data.readAll(edmEntitySet).getEntities().get(1);
- ExpandItem expandItemSecond = Mockito.mock(ExpandItem.class);
- Mockito.when(expandItemSecond.isStar()).thenReturn(true);
- final ExpandOption expandInner = ExpandSelectMock.mockExpandOption(Arrays.asList(expandItemSecond));
- ExpandItem expandItemFirst = ExpandSelectMock.mockExpandItem(edmEntitySet, "NavPropertyETAllPrimMany");
- Mockito.when(expandItemFirst.getExpandOption()).thenReturn(expandInner);
- final SelectOption select = ExpandSelectMock.mockSelectOption(Arrays.asList(
- ExpandSelectMock.mockSelectItem(innerEntitySet, "PropertyInt32")));
- Mockito.when(expandItemFirst.getSelectOption()).thenReturn(select);
- final ExpandOption expand = ExpandSelectMock.mockExpandOption(Arrays.asList(expandItemFirst));
- final String resultString = IOUtils.toString(serializer
- .entity(entityType, entity,
- EntitySerializerOptions.with()
- .contextURL(ContextURL.with().entitySet(edmEntitySet)
- .selectList(helper.buildContextURLSelectList(entityType, expand, select))
- .suffix(Suffix.ENTITY).build())
- .expand(expand)
- .build()));
- Assert.assertEquals("{"
- + "\"@odata.context\":\"$metadata#ESTwoPrim(NavPropertyETAllPrimMany(PropertyInt32))/$entity\","
- + "\"PropertyInt16\":-365,\"PropertyString\":\"Test String2\","
- + "\"NavPropertyETAllPrimMany\":["
- + "{\"PropertyInt32\":-2147483648,\"NavPropertyETTwoPrimOne\":null,\"NavPropertyETTwoPrimMany\":[]},"
- + "{\"PropertyInt32\":0,\"NavPropertyETTwoPrimOne\":null,"
- + "\"NavPropertyETTwoPrimMany\":["
- + "{\"PropertyInt16\":32766,\"PropertyString\":\"Test String1\"},"
- + "{\"PropertyInt16\":-32766,\"PropertyString\":null},"
- + "{\"PropertyInt16\":32767,\"PropertyString\":\"Test String4\"}]}]}",
- resultString);
- }
-
- @Test
- public void primitiveProperty() throws Exception {
- final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESAllPrim");
- final EdmProperty edmProperty = (EdmProperty) edmEntitySet.getEntityType().getProperty("PropertyString");
- final Property property = data.readAll(edmEntitySet).getEntities().get(0).getProperty(edmProperty.getName());
- final String resultString = IOUtils.toString(serializer
- .primitive((EdmPrimitiveType) edmProperty.getType(), property,
- PrimitiveSerializerOptions.with()
- .contextURL(ContextURL.with()
- .entitySet(edmEntitySet).keyPath("32767").navOrPropertyPath(edmProperty.getName())
- .build())
- .build()));
- Assert.assertEquals("{"
- + "\"@odata.context\":\"$metadata#ESAllPrim(32767)/PropertyString\","
- + "\"value\":\"First Resource - positive values\"}",
- resultString);
- }
-
- @Test(expected = SerializerException.class)
- public void primitivePropertyNull() throws Exception {
- final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESAllPrim");
- final EdmProperty edmProperty = (EdmProperty) edmEntitySet.getEntityType().getProperty("PropertyString");
- final Property property = new PropertyImpl("Edm.String", edmProperty.getName(), ValueType.PRIMITIVE, null);
- serializer.primitive((EdmPrimitiveType) edmProperty.getType(), property,
- PrimitiveSerializerOptions.with()
- .contextURL(ContextURL.with()
- .entitySet(edmEntitySet).keyPath("4242").navOrPropertyPath(edmProperty.getName())
- .build())
- .build());
- }
-
- @Test
- public void primitiveCollectionProperty() throws Exception {
- final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESCollAllPrim");
- final EdmProperty edmProperty = (EdmProperty) edmEntitySet.getEntityType().getProperty("CollPropertyString");
- final Property property = data.readAll(edmEntitySet).getEntities().get(0).getProperty(edmProperty.getName());
-
- final String resultString = IOUtils.toString(serializer
- .primitiveCollection((EdmPrimitiveType) edmProperty.getType(), property,
- PrimitiveSerializerOptions.with()
- .contextURL(ContextURL.with()
- .entitySet(edmEntitySet).keyPath("1").navOrPropertyPath(edmProperty.getName())
- .build())
- .build()));
- Assert.assertEquals("{"
- + "\"@odata.context\":\"$metadata#ESCollAllPrim(1)/CollPropertyString\","
- + "\"value\":[\"Employee1@company.example\",\"Employee2@company.example\",\"Employee3@company.example\"]}",
- resultString);
- }
-
- @Test
- public void complexProperty() throws Exception {
- final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESMixPrimCollComp");
- final EdmProperty edmProperty = (EdmProperty) edmEntitySet.getEntityType().getProperty("PropertyComp");
- final Property property = data.readAll(edmEntitySet).getEntities().get(0).getProperty("PropertyComp");
-
- final String resultString = IOUtils.toString(serializer
- .complex((EdmComplexType) edmProperty.getType(), property,
- ComplexSerializerOptions.with()
- .contextURL(ContextURL.with()
- .entitySet(edmEntitySet).keyPath("32767").navOrPropertyPath(edmProperty.getName())
- .build())
- .build()));
- Assert.assertEquals("{"
- + "\"@odata.context\":\"$metadata#ESMixPrimCollComp(32767)/PropertyComp\","
- + "\"PropertyInt16\":111,\"PropertyString\":\"TEST A\"}",
- resultString);
- }
-
- @Test
- public void complexCollectionProperty() throws Exception {
- final EdmEntitySet edmEntitySet = entityContainer.getEntitySet("ESMixPrimCollComp");
- final EdmProperty edmProperty = (EdmProperty) edmEntitySet.getEntityType().getProperty("CollPropertyComp");
- final Property property = data.readAll(edmEntitySet).getEntities().get(0).getProperty(edmProperty.getName());
-
- final String resultString = IOUtils.toString(serializer
- .complexCollection((EdmComplexType) edmProperty.getType(), property,
- ComplexSerializerOptions.with()
- .contextURL(ContextURL.with()
- .entitySet(edmEntitySet).keyPath("32767").navOrPropertyPath(edmProperty.getName())
- .build())
- .build()));
- Assert.assertEquals("{"
- + "\"@odata.context\":\"$metadata#ESMixPrimCollComp(32767)/CollPropertyComp\","
- + "\"value\":[{\"PropertyInt16\":123,\"PropertyString\":\"TEST 1\"},"
- + "{\"PropertyInt16\":456,\"PropertyString\":\"TEST 2\"},"
- + "{\"PropertyInt16\":789,\"PropertyString\":\"TEST 3\"}]}",
- resultString);
- }
-}
diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/serializer/json/ServiceDocumentTest.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/serializer/json/ServiceDocumentTest.java
deleted file mode 100644
index de03327..0000000
--- a/lib/server-test/src/test/java/org/apache/olingo/server/core/serializer/json/ServiceDocumentTest.java
+++ /dev/null
@@ -1,133 +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.serializer.json;
-
-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;
-import org.apache.olingo.commons.api.edm.EdmFunctionImport;
-import org.apache.olingo.commons.api.edm.EdmSingleton;
-import org.apache.olingo.commons.api.format.ODataFormat;
-import org.apache.olingo.server.api.OData;
-import org.apache.olingo.server.api.serializer.ODataSerializer;
-import org.junit.Before;
-import org.junit.Test;
-
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.List;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-public class ServiceDocumentTest {
-
- private Edm edm;
-
- @Before
- public void before() {
-
- EdmEntitySet edmEntitySet1 = mock(EdmEntitySet.class);
- when(edmEntitySet1.getName()).thenReturn("entitySetName1");
- when(edmEntitySet1.isIncludeInServiceDocument()).thenReturn(true);
-
- EdmEntitySet edmEntitySet2 = mock(EdmEntitySet.class);
- when(edmEntitySet2.getName()).thenReturn("entitySetName2");
- when(edmEntitySet2.isIncludeInServiceDocument()).thenReturn(true);
-
- EdmEntitySet edmEntitySet3 = mock(EdmEntitySet.class);
- when(edmEntitySet3.getName()).thenReturn("entitySetName3");
- when(edmEntitySet3.isIncludeInServiceDocument()).thenReturn(false);
-
- List<EdmEntitySet> entitySets = new ArrayList<EdmEntitySet>();
- entitySets.add(edmEntitySet1);
- entitySets.add(edmEntitySet2);
- entitySets.add(edmEntitySet3);
-
- EdmFunctionImport functionImport1 = mock(EdmFunctionImport.class);
- when(functionImport1.getName()).thenReturn("functionImport1");
- when(functionImport1.isIncludeInServiceDocument()).thenReturn(true);
-
- EdmFunctionImport functionImport2 = mock(EdmFunctionImport.class);
- when(functionImport2.getName()).thenReturn("functionImport2");
- when(functionImport2.isIncludeInServiceDocument()).thenReturn(true);
-
- EdmFunctionImport functionImport3 = mock(EdmFunctionImport.class);
- when(functionImport3.getName()).thenReturn("functionImport3");
- when(functionImport3.isIncludeInServiceDocument()).thenReturn(false);
-
- List<EdmFunctionImport> functionImports = new ArrayList<EdmFunctionImport>();
- functionImports.add(functionImport1);
- functionImports.add(functionImport2);
- functionImports.add(functionImport3);
-
- EdmSingleton singleton1 = mock(EdmSingleton.class);
- when(singleton1.getName()).thenReturn("singleton1");
-
- EdmSingleton singleton2 = mock(EdmSingleton.class);
- when(singleton2.getName()).thenReturn("singleton2");
-
- EdmSingleton singleton3 = mock(EdmSingleton.class);
- when(singleton3.getName()).thenReturn("singleton3");
-
- List<EdmSingleton> singletons = new ArrayList<EdmSingleton>();
- singletons.add(singleton1);
- singletons.add(singleton2);
- singletons.add(singleton3);
-
- EdmEntityContainer edmEntityContainer = mock(EdmEntityContainer.class);
- when(edmEntityContainer.getEntitySets()).thenReturn(entitySets);
- when(edmEntityContainer.getFunctionImports()).thenReturn(functionImports);
- when(edmEntityContainer.getSingletons()).thenReturn(singletons);
-
- edm = mock(Edm.class);
- when(edm.getEntityContainer(null)).thenReturn(edmEntityContainer);
- }
-
- @Test
- public void writeServiceDocumentJson() throws Exception {
- String serviceRoot = "http://localhost:8080/odata.svc";
-
- OData server = OData.newInstance();
- assertNotNull(server);
-
- ODataSerializer serializer = server.createSerializer(ODataFormat.JSON);
- assertNotNull(serializer);
-
- InputStream result = serializer.serviceDocument(edm, serviceRoot);
- assertNotNull(result);
- String jsonString = IOUtils.toString(result);
-
- assertTrue(jsonString.contains("entitySetName1"));
- assertTrue(jsonString.contains("entitySetName2"));
- assertFalse(jsonString.contains("entitySetName3"));
-
- assertTrue(jsonString.contains("functionImport1"));
- assertTrue(jsonString.contains("functionImport2"));
- assertFalse(jsonString.contains("functionImport3"));
-
- assertTrue(jsonString.contains("singleton1"));
- assertTrue(jsonString.contains("singleton2"));
- assertTrue(jsonString.contains("singleton3"));
- }
-}
diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/serializer/utils/ContextURLHelperTest.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/serializer/utils/ContextURLHelperTest.java
deleted file mode 100644
index 5397856..0000000
--- a/lib/server-test/src/test/java/org/apache/olingo/server/core/serializer/utils/ContextURLHelperTest.java
+++ /dev/null
@@ -1,215 +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.serializer.utils;
-
-import static org.junit.Assert.assertEquals;
-
-import java.util.Arrays;
-import java.util.Collections;
-
-import org.apache.olingo.commons.api.data.ContextURL;
-import org.apache.olingo.commons.api.edm.Edm;
-import org.apache.olingo.commons.api.edm.EdmEntityContainer;
-import org.apache.olingo.commons.api.edm.EdmEntitySet;
-import org.apache.olingo.commons.api.edm.EdmProperty;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.server.api.OData;
-import org.apache.olingo.server.api.edmx.EdmxReference;
-import org.apache.olingo.server.api.uri.UriParameter;
-import org.apache.olingo.server.api.uri.queryoption.ExpandItem;
-import org.apache.olingo.server.api.uri.queryoption.ExpandOption;
-import org.apache.olingo.server.api.uri.queryoption.SelectItem;
-import org.apache.olingo.server.api.uri.queryoption.SelectOption;
-import org.apache.olingo.server.core.serializer.ExpandSelectMock;
-import org.apache.olingo.server.tecsvc.provider.EdmTechProvider;
-import org.junit.Test;
-import org.mockito.Mockito;
-
-public class ContextURLHelperTest {
-
- private static final Edm edm = OData.newInstance().createServiceMetadata(
- new EdmTechProvider(), Collections.<EdmxReference>emptyList()).getEdm();
- private static final EdmEntityContainer entityContainer = edm.getEntityContainer(
- new FullQualifiedName("olingo.odata.test1", "Container"));
-
- @Test
- public void buildSelect() throws Exception {
- final EdmEntitySet entitySet = entityContainer.getEntitySet("ESAllPrim");
- final SelectItem selectItem1 = ExpandSelectMock.mockSelectItem(entitySet, "PropertyString");
- final SelectItem selectItem2 = ExpandSelectMock.mockSelectItem(entitySet, "PropertyInt16");
- final SelectOption select = ExpandSelectMock.mockSelectOption(Arrays.asList(
- selectItem1, selectItem2, selectItem2));
- final ContextURL contextURL = ContextURL.with().entitySet(entitySet)
- .selectList(ContextURLHelper.buildSelectList(entitySet.getEntityType(), null, select)).build();
- assertEquals("$metadata#ESAllPrim(PropertyInt16,PropertyString)",
- ContextURLBuilder.create(contextURL).toASCIIString());
- }
-
- @Test
- public void buildSelectAll() throws Exception {
- final EdmEntitySet entitySet = entityContainer.getEntitySet("ESAllPrim");
- final SelectItem selectItem1 = ExpandSelectMock.mockSelectItem(entitySet, "PropertyGuid");
- SelectItem selectItem2 = Mockito.mock(SelectItem.class);
- Mockito.when(selectItem2.isStar()).thenReturn(true);
- final SelectOption select = ExpandSelectMock.mockSelectOption(Arrays.asList(selectItem1, selectItem2));
- final ContextURL contextURL = ContextURL.with().entitySet(entitySet)
- .selectList(ContextURLHelper.buildSelectList(entitySet.getEntityType(), null, select)).build();
- assertEquals("$metadata#ESAllPrim(*)", ContextURLBuilder.create(contextURL).toASCIIString());
- }
-
- @Test
- public void buildSelectComplex() throws Exception {
- final EdmEntitySet entitySet = entityContainer.getEntitySet("ESCompMixPrimCollComp");
- final SelectOption select = ExpandSelectMock.mockSelectOption(Arrays.asList(
- ExpandSelectMock.mockSelectItem(entitySet,
- "PropertyMixedPrimCollComp", "PropertyComp", "PropertyString"),
- ExpandSelectMock.mockSelectItem(entitySet,
- "PropertyMixedPrimCollComp", "PropertyComp", "PropertyInt16"),
- ExpandSelectMock.mockSelectItem(entitySet, "PropertyMixedPrimCollComp", "CollPropertyString"),
- ExpandSelectMock.mockSelectItem(entitySet, "PropertyMixedPrimCollComp", "CollPropertyComp"),
- ExpandSelectMock.mockSelectItem(entitySet, "PropertyInt16")));
- final ContextURL contextURL = ContextURL.with().entitySet(entitySet)
- .selectList(ContextURLHelper.buildSelectList(entitySet.getEntityType(), null, select)).build();
- assertEquals("$metadata#ESCompMixPrimCollComp("
- + "PropertyInt16,"
- + "PropertyMixedPrimCollComp/CollPropertyString,"
- + "PropertyMixedPrimCollComp/PropertyComp/PropertyInt16,"
- + "PropertyMixedPrimCollComp/PropertyComp/PropertyString,"
- + "PropertyMixedPrimCollComp/CollPropertyComp)",
- ContextURLBuilder.create(contextURL).toASCIIString());
- }
-
- @Test
- public void buildExpandAll() throws Exception {
- final EdmEntitySet entitySet = entityContainer.getEntitySet("ESTwoPrim");
- ExpandItem expandItem = Mockito.mock(ExpandItem.class);
- Mockito.when(expandItem.isStar()).thenReturn(true);
- final ExpandOption expand = ExpandSelectMock.mockExpandOption(Arrays.asList(expandItem));
- final ContextURL contextURL = ContextURL.with().entitySet(entitySet)
- .selectList(ContextURLHelper.buildSelectList(entitySet.getEntityType(), expand, null)).build();
- assertEquals("$metadata#ESTwoPrim", ContextURLBuilder.create(contextURL).toASCIIString());
- }
-
- @Test
- public void buildExpandNoSelect() throws Exception {
- final EdmEntitySet entitySet = entityContainer.getEntitySet("ESTwoPrim");
- final ExpandOption expand = ExpandSelectMock.mockExpandOption(Arrays.asList(
- ExpandSelectMock.mockExpandItem(entitySet, "NavPropertyETAllPrimOne")));
- final ContextURL contextURL = ContextURL.with().entitySet(entitySet)
- .selectList(ContextURLHelper.buildSelectList(entitySet.getEntityType(), expand, null)).build();
- assertEquals("$metadata#ESTwoPrim", ContextURLBuilder.create(contextURL).toASCIIString());
- }
-
- @Test
- public void buildExpandSelect() throws Exception {
- final EdmEntitySet entitySet = entityContainer.getEntitySet("ESTwoPrim");
- final ExpandItem expandItem1 = ExpandSelectMock.mockExpandItem(entitySet, "NavPropertyETAllPrimOne");
- final EdmEntitySet innerEntitySet = entityContainer.getEntitySet("ESAllPrim");
- ExpandItem expandItem2 = ExpandSelectMock.mockExpandItem(entitySet, "NavPropertyETAllPrimMany");
- final SelectOption innerSelect = ExpandSelectMock.mockSelectOption(Arrays.asList(
- ExpandSelectMock.mockSelectItem(innerEntitySet, "PropertyInt32")));
- Mockito.when(expandItem2.getSelectOption()).thenReturn(innerSelect);
- final ExpandOption expand = ExpandSelectMock.mockExpandOption(Arrays.asList(
- expandItem1, expandItem2));
- final SelectItem selectItem = ExpandSelectMock.mockSelectItem(entitySet, "PropertyString");
- final SelectOption select = ExpandSelectMock.mockSelectOption(Arrays.asList(selectItem));
- final ContextURL contextURL = ContextURL.with().entitySet(entitySet)
- .selectList(ContextURLHelper.buildSelectList(entitySet.getEntityType(), expand, select)).build();
- assertEquals("$metadata#ESTwoPrim(PropertyString,NavPropertyETAllPrimMany(PropertyInt32))",
- ContextURLBuilder.create(contextURL).toASCIIString());
- }
-
- @Test
- public void buildExpandTwoLevels() throws Exception {
- final EdmEntitySet entitySet = entityContainer.getEntitySet("ESTwoPrim");
- final EdmEntitySet innerEntitySet = entityContainer.getEntitySet("ESAllPrim");
- final ExpandOption innerExpand = ExpandSelectMock.mockExpandOption(Arrays.asList(
- ExpandSelectMock.mockExpandItem(innerEntitySet, "NavPropertyETTwoPrimOne")));
- ExpandItem expandItem = ExpandSelectMock.mockExpandItem(entitySet, "NavPropertyETAllPrimOne");
- Mockito.when(expandItem.getExpandOption()).thenReturn(innerExpand);
- final ExpandOption expand = ExpandSelectMock.mockExpandOption(Arrays.asList(expandItem));
- final ContextURL contextURL = ContextURL.with().entitySet(entitySet)
- .selectList(ContextURLHelper.buildSelectList(entitySet.getEntityType(), expand, null)).build();
- assertEquals("$metadata#ESTwoPrim", ContextURLBuilder.create(contextURL).toASCIIString());
- }
-
- @Test
- public void buildExpandTwoLevelsInnerAll() throws Exception {
- final EdmEntitySet entitySet = entityContainer.getEntitySet("ESTwoPrim");
- ExpandItem expandItemInner = Mockito.mock(ExpandItem.class);
- Mockito.when(expandItemInner.isStar()).thenReturn(true);
- final ExpandOption innerExpand = ExpandSelectMock.mockExpandOption(Arrays.asList(expandItemInner));
- ExpandItem expandItem = ExpandSelectMock.mockExpandItem(entitySet, "NavPropertyETAllPrimOne");
- Mockito.when(expandItem.getExpandOption()).thenReturn(innerExpand);
- final ExpandOption expand = ExpandSelectMock.mockExpandOption(Arrays.asList(expandItem));
- final ContextURL contextURL = ContextURL.with().entitySet(entitySet)
- .selectList(ContextURLHelper.buildSelectList(entitySet.getEntityType(), expand, null)).build();
- assertEquals("$metadata#ESTwoPrim", ContextURLBuilder.create(contextURL).toASCIIString());
- }
-
- @Test
- public void buildExpandSelectTwoLevels() throws Exception {
- final EdmEntitySet entitySet = entityContainer.getEntitySet("ESTwoPrim");
- final EdmEntitySet innerEntitySet = entityContainer.getEntitySet("ESAllPrim");
- ExpandItem expandItemInner = ExpandSelectMock.mockExpandItem(innerEntitySet, "NavPropertyETTwoPrimOne");
- SelectItem innerSelectItem = Mockito.mock(SelectItem.class);
- Mockito.when(innerSelectItem.isStar()).thenReturn(true);
- final SelectOption innerSelect = ExpandSelectMock.mockSelectOption(Arrays.asList(innerSelectItem));
- Mockito.when(expandItemInner.getSelectOption()).thenReturn(innerSelect);
- final ExpandOption innerExpand = ExpandSelectMock.mockExpandOption(Arrays.asList(expandItemInner));
- ExpandItem expandItem = ExpandSelectMock.mockExpandItem(entitySet, "NavPropertyETAllPrimOne");
- Mockito.when(expandItem.getExpandOption()).thenReturn(innerExpand);
- final ExpandOption expand = ExpandSelectMock.mockExpandOption(Arrays.asList(expandItem));
- final ContextURL contextURL = ContextURL.with().entitySet(entitySet)
- .selectList(ContextURLHelper.buildSelectList(entitySet.getEntityType(), expand, null)).build();
- assertEquals("$metadata#ESTwoPrim(NavPropertyETAllPrimOne(NavPropertyETTwoPrimOne(*)))",
- ContextURLBuilder.create(contextURL).toASCIIString());
- }
-
- @Test
- public void buildSingleKey() throws Exception {
- final EdmEntitySet entitySet = entityContainer.getEntitySet("ESTwoPrim");
- final EdmProperty edmProperty = entitySet.getEntityType().getStructuralProperty("PropertyInt16");
- UriParameter key = Mockito.mock(UriParameter.class);
- Mockito.when(key.getName()).thenReturn(edmProperty.getName());
- Mockito.when(key.getText()).thenReturn("42");
- final ContextURL contextURL = ContextURL.with().entitySet(entitySet)
- .keyPath(ContextURLHelper.buildKeyPredicate(Arrays.asList(key)))
- .navOrPropertyPath(edmProperty.getName()).build();
- assertEquals("$metadata#ESTwoPrim(42)/PropertyInt16",
- ContextURLBuilder.create(contextURL).toASCIIString());
- }
-
- @Test
- public void buildCompoundKey() throws Exception {
- final EdmEntitySet entitySet = entityContainer.getEntitySet("ESTwoKeyNav");
- final EdmProperty edmProperty = entitySet.getEntityType().getStructuralProperty("PropertyInt16");
- UriParameter key1 = Mockito.mock(UriParameter.class);
- Mockito.when(key1.getName()).thenReturn(edmProperty.getName());
- Mockito.when(key1.getText()).thenReturn("1");
- UriParameter key2 = Mockito.mock(UriParameter.class);
- Mockito.when(key2.getName()).thenReturn("PropertyString");
- Mockito.when(key2.getText()).thenReturn("'2'");
- final ContextURL contextURL = ContextURL.with().entitySet(entitySet)
- .keyPath(ContextURLHelper.buildKeyPredicate(Arrays.asList(key1, key2)))
- .navOrPropertyPath(edmProperty.getName()).build();
- assertEquals("$metadata#ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/PropertyInt16",
- ContextURLBuilder.create(contextURL).toASCIIString());
- }
-}
diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentTest.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentTest.java
deleted file mode 100644
index c438d00..0000000
--- a/lib/server-test/src/test/java/org/apache/olingo/server/core/serializer/xml/MetadataDocumentTest.java
+++ /dev/null
@@ -1,158 +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.serializer.xml;
-
-import static org.hamcrest.CoreMatchers.containsString;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertThat;
-
-import java.net.URI;
-import java.util.Arrays;
-import java.util.List;
-
-import org.apache.commons.io.IOUtils;
-import org.apache.olingo.commons.api.format.ODataFormat;
-import org.apache.olingo.server.api.OData;
-import org.apache.olingo.server.api.ServiceMetadata;
-import org.apache.olingo.server.api.edmx.EdmxReference;
-import org.apache.olingo.server.api.edmx.EdmxReferenceInclude;
-import org.apache.olingo.server.tecsvc.provider.EdmTechProvider;
-import org.junit.Test;
-
-public class MetadataDocumentTest {
-
- private static final String CORE_VOCABULARY =
- "http://docs.oasis-open.org/odata/odata/v4.0/cs02/vocabularies/Org.OData.Core.V1.xml";
-
- @Test
- public void writeMetadataWithTechnicalScenario() throws Exception {
- final OData odata = OData.newInstance();
- final List<EdmxReference> references = getEdmxReferences();
- final ServiceMetadata serviceMetadata = odata.createServiceMetadata(
- new EdmTechProvider(references), references);
-
- final String metadata = IOUtils.toString(
- odata.createSerializer(ODataFormat.XML).metadataDocument(serviceMetadata));
- assertNotNull(metadata);
-
- assertThat(metadata,
- containsString("<edmx:Reference Uri=\"" + CORE_VOCABULARY + "\">"
- + "<edmx:Include Namespace=\"Org.OData.Core.V1\" Alias=\"Core\"/>"
- + "</edmx:Reference>"));
-
- assertThat(metadata,
- containsString("<edmx:Edmx Version=\"4.0\" xmlns:edmx=\"http://docs.oasis-open.org/odata/ns/edmx\">"));
-
- assertThat(metadata,
- containsString("<Schema xmlns=\"http://docs.oasis-open.org/odata/ns/edm\" "
- + "Namespace=\"olingo.odata.test1\" Alias=\"Namespace1_Alias\">"));
-
- assertThat(metadata,
- containsString("<EntityType Name=\"ETTwoPrim\">"
- + "<Key><PropertyRef Name=\"PropertyInt16\"/></Key>"
- + "<Property Name=\"PropertyInt16\" Type=\"Edm.Int16\" Nullable=\"false\"/>"
- + "<Property Name=\"PropertyString\" Type=\"Edm.String\"/>"
- + "<NavigationProperty Name=\"NavPropertyETAllPrimOne\" Type=\"Namespace1_Alias.ETAllPrim\"/>"
- + "<NavigationProperty Name=\"NavPropertyETAllPrimMany\" "
- + "Type=\"Collection(Namespace1_Alias.ETAllPrim)\"/>"
- + "</EntityType>"));
-
- assertThat(metadata,
- containsString("<EntityType Name=\"ETBase\" BaseType=\"Namespace1_Alias.ETTwoPrim\">"
- + "<Property Name=\"AdditionalPropertyString_5\" Type=\"Edm.String\"/>"
- + "</EntityType>"));
-
- assertThat(metadata,
- containsString("<ComplexType Name=\"CTPrim\">"
- + "<Property Name=\"PropertyInt16\" Type=\"Edm.Int16\"/></ComplexType>"));
-
- assertThat(metadata,
- containsString("<ComplexType Name=\"CTBase\" BaseType=\"Namespace1_Alias.CTTwoPrim\">"
- + "<Property Name=\"AdditionalPropString\" Type=\"Edm.String\"/></ComplexType>"));
-
- // TODO: TypeDefinition
- // assertThat(metadata, containsString("<TypeDefinition Name=\"typeDef\" Type=\"Edm.Int16\"/>"));
-
- assertThat(metadata, containsString("<Action Name=\"UARTCTTwoPrimParam\" IsBound=\"false\">"
- + "<Parameter Name=\"ParameterInt16\" Type=\"Edm.Int16\"/>"
- + "<ReturnType Type=\"Namespace1_Alias.CTTwoPrim\"/></Action>"));
-
- assertThat(metadata,
- containsString("<Action Name=\"BAESAllPrimRTETAllPrim\" IsBound=\"true\">"
- + "<Parameter Name=\"ParameterESAllPrim\" "
- + "Type=\"Collection(Namespace1_Alias.ETAllPrim)\" Nullable=\"false\"/>"
- + "<ReturnType Type=\"Namespace1_Alias.ETAllPrim\"/></Action>"));
-
- assertThat(metadata,
- containsString("<Function Name=\"UFNRTInt16\" IsBound=\"false\" IsComposable=\"false\">"
- + "<ReturnType Type=\"Edm.Int16\"/></Function>"));
-
- assertThat(metadata,
- containsString("<Function Name=\"BFCESTwoKeyNavRTESTwoKeyNav\" IsBound=\"true\" IsComposable=\"true\">"
- + "<Parameter Name=\"BindingParam\" Type=\"Collection(Namespace1_Alias.ETTwoKeyNav)\" "
- + "Nullable=\"false\"/>"
- + "<ReturnType Type=\"Collection(Namespace1_Alias.ETTwoKeyNav)\" Nullable=\"false\"/></Function>"));
-
- assertThat(metadata, containsString("<EntityContainer Name=\"Container\">"));
-
- assertThat(metadata,
- containsString("<EntitySet Name=\"ESTwoPrim\" EntityType=\"Namespace1_Alias.ETTwoPrim\"/>"));
-
- assertThat(metadata,
- containsString("<Singleton Name=\"SINav\" EntityType=\"Namespace1_Alias.ETTwoKeyNav\">"
- + "<NavigationPropertyBinding Path=\"NavPropertyETTwoKeyNavMany\" Target=\"ESTwoKeyNav\"/>"
- + "</Singleton>"));
-
- assertThat(metadata,
- containsString("<ActionImport Name=\"AIRTCTTwoPrimParam\" Action=\"Namespace1_Alias.UARTCTTwoPrimParam\"/>"));
-
- assertThat(metadata,
- containsString("<FunctionImport Name=\"FINInvisible2RTInt16\" Function=\"Namespace1_Alias.UFNRTInt16\" "
- + "IncludeInServiceDocument=\"false\"/>"));
-
- assertThat(metadata, containsString("</EntityContainer></Schema></edmx:DataServices></edmx:Edmx>"));
-
- // BaseTypeCheck
- assertThat(metadata, containsString("<EntityType Name=\"ETBase\" BaseType=\"Namespace1_Alias.ETTwoPrim\">"));
- assertThat(metadata, containsString("<EntityType Name=\"ETAbstract\" Abstract=\"true\">"));
- assertThat(metadata,
- containsString("<EntityType Name=\"ETAbstractBase\" BaseType=\"Namespace1_Alias.ETAbstract\">"));
-
- // TypeDefCheck
- assertThat(metadata,
- containsString("<Property Name=\"PropertyDefString\" Type=\"Namespace1_Alias.TDString\" MaxLength=\"15\"/>"));
- assertThat(metadata, containsString("<Property Name=\"CollPropertyDefString\" " +
- "Type=\"Collection(Namespace1_Alias.TDString)\" MaxLength=\"15\"/>"));
- }
-
- /**
- * <code>
- * <edmx:Reference Uri="http://docs.oasis-open.org/odata/odata/v4.0/cs02/vocabularies/Org.OData.Core.V1.xml">
- * <edmx:Include Namespace="Org.OData.Core.V1" Alias="Core"/>
- * </edmx:Reference>
- * </code>
- *
- * @return default emdx reference
- */
- private List<EdmxReference> getEdmxReferences() {
- EdmxReference reference = new EdmxReference(URI.create(CORE_VOCABULARY));
- reference.addInclude(new EdmxReferenceInclude("Org.OData.Core.V1", "Core"));
- return Arrays.asList(reference);
- }
-}
diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/RawUriTest.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/RawUriTest.java
deleted file mode 100644
index 5e991b0..0000000
--- a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/RawUriTest.java
+++ /dev/null
@@ -1,151 +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.uri;
-
-import org.apache.olingo.server.core.uri.parser.RawUri;
-import org.apache.olingo.server.core.uri.parser.UriDecoder;
-import org.apache.olingo.server.core.uri.parser.UriParserSyntaxException;
-import org.junit.Test;
-
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-
-import static org.junit.Assert.assertEquals;
-
-public class RawUriTest {
-
- private RawUri runRawParser(final String path, final String query, final int skipSegments)
- throws UriParserSyntaxException {
- return UriDecoder.decodeUri(path, query, null, skipSegments);
- }
-
- @Test
- public void testOption() throws Exception {
- RawUri rawUri;
- rawUri = runRawParser("", "", 0);
- checkOptionCount(rawUri, 0);
-
- rawUri = runRawParser("", "a", 0);
- checkOption(rawUri, 0, "a", "");
-
- rawUri = runRawParser("", "a=b", 0);
- checkOption(rawUri, 0, "a", "b");
-
- rawUri = runRawParser("", "=", 0);
- checkOption(rawUri, 0, "", "");
-
- rawUri = runRawParser("", "=b", 0);
- checkOption(rawUri, 0, "", "b");
-
- rawUri = runRawParser("", "a&c", 0);
- checkOption(rawUri, 0, "a", "");
- checkOption(rawUri, 1, "c", "");
-
- rawUri = runRawParser("", "a=b&c", 0);
- checkOption(rawUri, 0, "a", "b");
- checkOption(rawUri, 1, "c", "");
-
- rawUri = runRawParser("", "a=b&c=d", 0);
- checkOption(rawUri, 0, "a", "b");
- checkOption(rawUri, 1, "c", "d");
-
- rawUri = runRawParser("", "=&=", 0);
- checkOption(rawUri, 0, "", "");
- checkOption(rawUri, 1, "", "");
-
- rawUri = runRawParser("", "=&c=d", 0);
- checkOption(rawUri, 0, "", "");
- checkOption(rawUri, 1, "c", "d");
- }
-
- private void checkOption(final RawUri rawUri, final int index, final String name, final String value) {
- RawUri.QueryOption option = rawUri.queryOptionListDecoded.get(index);
-
- assertEquals(name, option.name);
- assertEquals(value, option.value);
- }
-
- private void checkOptionCount(final RawUri rawUri, final int count) {
- assertEquals(count, rawUri.queryOptionListDecoded.size());
- }
-
- @Test
- public void testPath() throws Exception {
- RawUri rawUri;
-
- rawUri = runRawParser("", null, 0);
- checkPath(rawUri, "", Collections.<String> emptyList());
-
- rawUri = runRawParser("/", null, 0);
- checkPath(rawUri, "/", Collections.<String> emptyList());
-
- rawUri = runRawParser("/entitySet", null, 0);
- checkPath(rawUri, "/entitySet", Arrays.asList("entitySet"));
-
- rawUri = runRawParser("//entitySet", null, 0);
- checkPath(rawUri, "//entitySet", Arrays.asList("entitySet"));
-
- rawUri = runRawParser("entitySet", null, 0);
- checkPath(rawUri, "entitySet", Arrays.asList("entitySet"));
-
- rawUri = runRawParser("/nonServiceSegment/entitySet", null, 0);
- checkPath(rawUri, "/nonServiceSegment/entitySet", Arrays.asList("nonServiceSegment", "entitySet"));
-
- rawUri = runRawParser("/nonServiceSegment/entitySet", null, 1);
- checkPath(rawUri, "/nonServiceSegment/entitySet", Arrays.asList("entitySet"));
-
- rawUri = runRawParser("nonServiceSegment/entitySet", null, 0);
- checkPath(rawUri, "nonServiceSegment/entitySet", Arrays.asList("nonServiceSegment", "entitySet"));
-
- rawUri = runRawParser("nonServiceSegment/entitySet", null, 1);
- checkPath(rawUri, "nonServiceSegment/entitySet", Arrays.asList("entitySet"));
-
- rawUri = runRawParser("non//Service/Segment///entitySet/", null, 3);
- checkPath(rawUri, "non//Service/Segment///entitySet/", Arrays.asList("entitySet"));
-
- rawUri = runRawParser("/a", "abc=xx+yz", 0);
- checkPath(rawUri, "/a", Arrays.asList("a"));
- }
-
- @Test
- public void testSplit() {
- UriDecoder.split("", '/');
- UriDecoder.split("/", '/');
- UriDecoder.split("a", '/');
- UriDecoder.split("a/", '/');
- UriDecoder.split("/a", '/');
- UriDecoder.split("a/a", '/');
- }
-
- private void checkPath(final RawUri rawUri, final String path, final List<String> list) {
- assertEquals(path, rawUri.path);
-
- assertEquals(list.size(), rawUri.pathSegmentListDecoded.size());
-
- for (int i = 0; i < list.size(); i++) {
- assertEquals(list.get(i), rawUri.pathSegmentListDecoded.get(i));
- }
- }
-
- @Test(expected = UriParserSyntaxException.class)
- public void wrongPercentEncoding() throws Exception {
- runRawParser("%wrong", null, 0);
- }
-}
diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/UriHelperTest.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/UriHelperTest.java
deleted file mode 100644
index fe44305..0000000
--- a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/UriHelperTest.java
+++ /dev/null
@@ -1,82 +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.uri;
-
-import java.util.Collections;
-
-import org.apache.olingo.commons.api.data.Entity;
-import org.apache.olingo.commons.api.data.ValueType;
-import org.apache.olingo.commons.api.edm.Edm;
-import org.apache.olingo.commons.api.edm.EdmEntityContainer;
-import org.apache.olingo.commons.api.edm.EdmEntitySet;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.server.api.OData;
-import org.apache.olingo.server.api.edmx.EdmxReference;
-import org.apache.olingo.server.api.serializer.SerializerException;
-import org.apache.olingo.server.api.uri.UriHelper;
-import org.apache.olingo.server.tecsvc.data.DataProvider;
-import org.apache.olingo.server.tecsvc.provider.EdmTechProvider;
-import org.junit.Assert;
-import org.junit.Test;
-
-public class UriHelperTest {
-
- private static final Edm edm = OData.newInstance().createServiceMetadata(
- new EdmTechProvider(), Collections.<EdmxReference> emptyList()).getEdm();
- private static final EdmEntityContainer container = edm.getEntityContainer(
- new FullQualifiedName("olingo.odata.test1", "Container"));
- private static final UriHelper helper = new UriHelperImpl();
- private final DataProvider data = new DataProvider();
-
- @Test
- public void canonicalURL() throws Exception {
- final EdmEntitySet entitySet = container.getEntitySet("ESAllPrim");
- final Entity entity = data.readAll(entitySet).getEntities().get(0);
- Assert.assertEquals("ESAllPrim(32767)", helper.buildCanonicalURL(entitySet, entity));
- }
-
- @Test
- public void canonicalURLLong() throws Exception {
- final EdmEntitySet entitySet = container.getEntitySet("ESAllKey");
- final Entity entity = data.readAll(entitySet).getEntities().get(0);
- Assert.assertEquals("ESAllKey("
- + "PropertyString='First',"
- + "PropertyBoolean=true,"
- + "PropertyByte=255,"
- + "PropertySByte=127,"
- + "PropertyInt16=32767,"
- + "PropertyInt32=2147483647,"
- + "PropertyInt64=9223372036854775807,"
- + "PropertyDecimal=34,"
- + "PropertyDate=2012-12-03,"
- + "PropertyDateTimeOffset=2012-12-03T07%3A16%3A23Z,"
- + "PropertyDuration=duration'PT6S',"
- + "PropertyGuid=01234567-89ab-cdef-0123-456789abcdef,"
- + "PropertyTimeOfDay=02%3A48%3A21)",
- helper.buildCanonicalURL(entitySet, entity));
- }
-
- @Test(expected = SerializerException.class)
- public void canonicalURLWrong() throws Exception {
- final EdmEntitySet entitySet = container.getEntitySet("ESAllPrim");
- Entity entity = data.readAll(entitySet).getEntities().get(0);
- entity.getProperty("PropertyInt16").setValue(ValueType.PRIMITIVE, "wrong");
- helper.buildCanonicalURL(entitySet, entity);
- }
-}
diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/UriInfoImplTest.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/UriInfoImplTest.java
deleted file mode 100644
index d4e8ebd..0000000
--- a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/UriInfoImplTest.java
+++ /dev/null
@@ -1,209 +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.uri;
-
-import org.apache.olingo.commons.api.ODataRuntimeException;
-import org.apache.olingo.commons.api.edm.Edm;
-import org.apache.olingo.commons.api.edm.EdmEntityType;
-import org.apache.olingo.server.api.uri.UriInfoAll;
-import org.apache.olingo.server.api.uri.UriInfoBatch;
-import org.apache.olingo.server.api.uri.UriInfoCrossjoin;
-import org.apache.olingo.server.api.uri.UriInfoEntityId;
-import org.apache.olingo.server.api.uri.UriInfoKind;
-import org.apache.olingo.server.api.uri.UriInfoMetadata;
-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.uri.queryoption.CountOptionImpl;
-import org.apache.olingo.server.core.uri.queryoption.CustomQueryOptionImpl;
-import org.apache.olingo.server.core.uri.queryoption.ExpandOptionImpl;
-import org.apache.olingo.server.core.uri.queryoption.FilterOptionImpl;
-import org.apache.olingo.server.core.uri.queryoption.FormatOptionImpl;
-import org.apache.olingo.server.core.uri.queryoption.IdOptionImpl;
-import org.apache.olingo.server.core.uri.queryoption.LevelsOptionImpl;
-import org.apache.olingo.server.core.uri.queryoption.OrderByOptionImpl;
-import org.apache.olingo.server.core.uri.queryoption.QueryOptionImpl;
-import org.apache.olingo.server.core.uri.queryoption.SearchOptionImpl;
-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.tecsvc.provider.EntityTypeProvider;
-import org.junit.Test;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-public class UriInfoImplTest {
-
- Edm edm = new EdmProviderImpl(new EdmTechTestProvider());
-
- @Test
- public void testKind() {
- UriInfoImpl uriInfo = new UriInfoImpl().setKind(UriInfoKind.all);
- assertEquals(UriInfoKind.all, uriInfo.getKind());
- }
-
- @Test
- public void testCasts() {
- UriInfoImpl uriInfo = new UriInfoImpl();
-
- UriInfoAll all = uriInfo.asUriInfoAll();
- assertEquals(uriInfo, all);
-
- UriInfoBatch batch = uriInfo.asUriInfoBatch();
- assertEquals(uriInfo, batch);
-
- UriInfoCrossjoin crossjoin = uriInfo.asUriInfoCrossjoin();
- assertEquals(uriInfo, crossjoin);
-
- UriInfoEntityId entityID = uriInfo.asUriInfoEntityId();
- assertEquals(uriInfo, entityID);
-
- UriInfoMetadata metadata = uriInfo.asUriInfoMetadata();
- assertEquals(uriInfo, metadata);
-
- UriInfoResource resource = uriInfo.asUriInfoResource();
- assertEquals(uriInfo, resource);
-
- UriInfoService service = uriInfo.asUriInfoService();
- assertEquals(uriInfo, service);
-
- }
-
- @Test
- public void testEntityNames() {
- UriInfoImpl uriInfo = new UriInfoImpl();
- uriInfo.addEntitySetName("A");
- uriInfo.addEntitySetName("B");
-
- assertEquals("A", uriInfo.getEntitySetNames().get(0));
- assertEquals("B", uriInfo.getEntitySetNames().get(1));
-
- }
-
- @Test
- public void testResourceParts() {
- UriInfoImpl uriInfo = new UriInfoImpl();
-
- UriResourceActionImpl action = new UriResourceActionImpl();
- UriResourceEntitySetImpl entitySet0 = new UriResourceEntitySetImpl();
- UriResourceEntitySetImpl entitySet1 = new UriResourceEntitySetImpl();
-
- uriInfo.addResourcePart(action);
- uriInfo.addResourcePart(entitySet0);
-
- assertEquals(action, uriInfo.getUriResourceParts().get(0));
- assertEquals(entitySet0, uriInfo.getUriResourceParts().get(1));
-
- assertEquals(entitySet0, uriInfo.getLastResourcePart());
-
- uriInfo.addResourcePart(entitySet1);
- assertEquals(entitySet1, uriInfo.getLastResourcePart());
- }
-
- @Test(expected = ODataRuntimeException.class)
- public void doubleSystemQueryOptions() {
- new UriInfoImpl()
- .setSystemQueryOption(new FormatOptionImpl())
- .setSystemQueryOption(new FormatOptionImpl());
- }
-
- @Test
- public void testCustomQueryOption() {
- UriInfoImpl uriInfo = new UriInfoImpl();
-
- List<QueryOptionImpl> queryOptions = new ArrayList<QueryOptionImpl>();
-
- ExpandOptionImpl expand = new ExpandOptionImpl();
- FilterOptionImpl filter = new FilterOptionImpl();
- FormatOptionImpl format = new FormatOptionImpl();
- IdOptionImpl id = new IdOptionImpl();
- CountOptionImpl inlinecount = new CountOptionImpl();
- OrderByOptionImpl orderby = new OrderByOptionImpl();
- SearchOptionImpl search = new SearchOptionImpl();
- SelectOptionImpl select = new SelectOptionImpl();
- SkipOptionImpl skip = new SkipOptionImpl();
- SkipTokenOptionImpl skipToken = new SkipTokenOptionImpl();
- TopOptionImpl top = new TopOptionImpl();
- LevelsOptionImpl levels = new LevelsOptionImpl();
-
- CustomQueryOptionImpl customOption0 = new CustomQueryOptionImpl();
- customOption0.setText("A");
- CustomQueryOptionImpl customOption1 = new CustomQueryOptionImpl();
- customOption1.setText("B");
-
- QueryOptionImpl queryOption = new QueryOptionImpl();
-
- queryOptions.add(expand.setName(""));
- queryOptions.add(filter.setName(""));
- queryOptions.add(format.setName(""));
- queryOptions.add(id.setName(""));
- queryOptions.add(inlinecount.setName(""));
- queryOptions.add(orderby.setName(""));
- queryOptions.add(search.setName(""));
- queryOptions.add(select.setName(""));
- queryOptions.add(skip.setName(""));
- queryOptions.add(skipToken.setName(""));
- queryOptions.add(top.setName(""));
- queryOptions.add(customOption0.setName(""));
- queryOptions.add(customOption1.setName(""));
- queryOptions.add(levels.setName(""));// not stored
- queryOptions.add(queryOption.setName(""));// not stored
- uriInfo.setQueryOptions(queryOptions);
-
- assertEquals(expand, uriInfo.getExpandOption());
- assertEquals(filter, uriInfo.getFilterOption());
- assertEquals(format, uriInfo.getFormatOption());
- assertEquals(id, uriInfo.getIdOption());
- assertEquals(inlinecount, uriInfo.getCountOption());
- assertEquals(orderby, uriInfo.getOrderByOption());
- assertEquals(search, uriInfo.getSearchOption());
- assertEquals(select, uriInfo.getSelectOption());
- assertEquals(skip, uriInfo.getSkipOption());
- assertEquals(skipToken, uriInfo.getSkipTokenOption());
- assertEquals(top, uriInfo.getTopOption());
-
- List<CustomQueryOption> customQueryOptions = uriInfo.getCustomQueryOptions();
- assertEquals(customOption0, customQueryOptions.get(0));
- assertEquals(customOption1, customQueryOptions.get(1));
- }
-
- @Test
- public void testFragment() {
- UriInfoImpl uriInfo = new UriInfoImpl();
- uriInfo.setFragment("F");
- assertEquals("F", uriInfo.getFragment());
- }
-
- @Test
- public void testEntityTypeCast() {
- UriInfoImpl uriInfo = new UriInfoImpl();
- EdmEntityType entityType = edm.getEntityType(EntityTypeProvider.nameETKeyNav);
- assertNotNull(entityType);
-
- uriInfo.setEntityTypeCast(entityType);
- assertEquals(entityType, uriInfo.getEntityTypeCast());
- }
-}
diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/UriResourceImplTest.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/UriResourceImplTest.java
deleted file mode 100644
index c08e37f..0000000
--- a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/UriResourceImplTest.java
+++ /dev/null
@@ -1,508 +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.uri;
-
-import org.apache.olingo.commons.api.edm.Edm;
-import org.apache.olingo.commons.api.edm.EdmAction;
-import org.apache.olingo.commons.api.edm.EdmActionImport;
-import org.apache.olingo.commons.api.edm.EdmEntityType;
-import org.apache.olingo.commons.api.edm.EdmFunction;
-import org.apache.olingo.commons.api.edm.EdmFunctionImport;
-import org.apache.olingo.commons.api.edm.EdmNavigationProperty;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeKind;
-import org.apache.olingo.commons.api.edm.EdmProperty;
-import org.apache.olingo.commons.api.edm.EdmType;
-import org.apache.olingo.commons.core.edm.primitivetype.EdmPrimitiveTypeFactory;
-import org.apache.olingo.server.api.uri.UriResourceKind;
-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.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.tecsvc.provider.ActionProvider;
-import org.apache.olingo.server.tecsvc.provider.ComplexTypeProvider;
-import org.apache.olingo.server.tecsvc.provider.EntityTypeProvider;
-import org.junit.Test;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-public class UriResourceImplTest {
-
- Edm edm = new EdmProviderImpl(new EdmTechTestProvider());
-
- @Test
- public void testUriParameterImpl() {
- UriParameterImpl impl = new UriParameterImpl();
- ExpressionImpl expression = new LiteralImpl().setText("Expression");
-
- impl.setText("Text");
- impl.setName("A");
- impl.setAlias("@A");
- impl.setExpression(expression);
-
- assertEquals("Text", impl.getText());
- assertEquals("A", impl.getName());
- assertEquals("@A", impl.getAlias());
- assertEquals(expression, impl.getExpression());
- }
-
- @Test
- public void testUriResourceActionImpl() {
- UriResourceActionImpl impl = new UriResourceActionImpl();
- assertEquals(UriResourceKind.action, impl.getKind());
- assertEquals("", impl.toString());
-
- // action
- EdmAction action = edm.getUnboundAction(ActionProvider.nameUARTETTwoKeyTwoPrimParam);
- impl.setAction(action);
- assertEquals(action, impl.getAction());
- assertEquals(ActionProvider.nameUARTETTwoKeyTwoPrimParam.getName(), impl.toString());
-
- // action import
- impl = new UriResourceActionImpl();
- EdmActionImport actionImport = edm.getEntityContainer(null).getActionImport("AIRTCTTwoPrimParam");
- impl.setActionImport(actionImport);
- assertEquals(actionImport, impl.getActionImport());
- assertEquals(actionImport.getUnboundAction(), impl.getAction());
- assertEquals(false, impl.isCollection());
- assertEquals("AIRTCTTwoPrimParam", impl.toString());
- assertEquals(actionImport.getUnboundAction().getReturnType().getType(), impl.getType());
- }
-
- @Test
- public void testUriResourceLambdaAllImpl() {
- UriResourceLambdaAllImpl impl = new UriResourceLambdaAllImpl();
- assertEquals(UriResourceKind.lambdaAll, impl.getKind());
-
- ExpressionImpl expression = new LiteralImpl().setText("Expression");
- impl.setExpression(expression);
- impl.setLamdaVariable("A");
-
- assertEquals(false, impl.isCollection());
- assertEquals(expression, impl.getExpression());
- assertEquals("A", impl.getLambdaVariable());
- assertEquals(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Boolean), impl.getType());
- assertEquals("all", impl.toString());
- }
-
- @Test
- public void testUriResourceLambdaAnyImpl() {
- UriResourceLambdaAnyImpl impl = new UriResourceLambdaAnyImpl();
- assertEquals(UriResourceKind.lambdaAny, impl.getKind());
-
- ExpressionImpl expression = new LiteralImpl().setText("Expression");
- impl.setExpression(expression);
- impl.setLamdaVariable("A");
-
- assertEquals(false, impl.isCollection());
- assertEquals(expression, impl.getExpression());
- assertEquals("A", impl.getLamdaVariable());
- assertEquals(EdmPrimitiveTypeFactory.getInstance(EdmPrimitiveTypeKind.Boolean), impl.getType());
- assertEquals("any", impl.toString());
- }
-
- @Test
- public void testUriResourceComplexPropertyImpl() {
- UriResourceComplexPropertyImpl impl = new UriResourceComplexPropertyImpl();
- assertEquals(UriResourceKind.complexProperty, impl.getKind());
-
- EdmEntityType entityType = edm.getEntityType(EntityTypeProvider.nameETKeyNav);
- EdmProperty property = (EdmProperty) entityType.getProperty("PropertyComp");
- impl.setProperty(property);
-
- assertEquals(property, impl.getProperty());
- assertEquals(property.getName(), impl.toString());
- assertEquals(false, impl.isCollection());
- assertEquals(property.getType(), impl.getType());
- assertEquals(property.getType(), impl.getComplexType());
- impl.getComplexType();
-
- EdmComplexTypeImpl complexTypeImplType =
- (EdmComplexTypeImpl) edm.getComplexType(ComplexTypeProvider.nameCTBasePrimCompNav);
-
- impl.setTypeFilter(complexTypeImplType);
- assertEquals(complexTypeImplType, impl.getTypeFilter());
- assertEquals(complexTypeImplType, impl.getComplexTypeFilter());
- impl.getComplexTypeFilter();
-
- }
-
- @Test
- public void testUriResourcePrimitivePropertyImpl() {
- UriResourcePrimitivePropertyImpl impl = new UriResourcePrimitivePropertyImpl();
- assertEquals(UriResourceKind.primitiveProperty, impl.getKind());
-
- EdmEntityType entityType = edm.getEntityType(EntityTypeProvider.nameETKeyNav);
- EdmProperty property = (EdmProperty) entityType.getProperty("PropertyInt16");
- impl.setProperty(property);
-
- assertEquals(property, impl.getProperty());
- assertEquals(property.getName(), impl.toString());
- assertEquals(false, impl.isCollection());
- assertEquals(property.getType(), impl.getType());
- }
-
- @Test
- public void testUriResourceCountImpl() {
- UriResourceCountImpl impl = new UriResourceCountImpl();
- assertEquals(UriResourceKind.count, impl.getKind());
- assertEquals("$count", impl.toString());
- }
-
- @Test
- public void testUriResourceEntitySetImpl() {
- UriResourceEntitySetImpl impl = new UriResourceEntitySetImpl();
- assertEquals(UriResourceKind.entitySet, impl.getKind());
-
- EdmEntitySetImpl entitySet = (EdmEntitySetImpl) edm.getEntityContainer(null).getEntitySet("ESAllPrim");
- impl.setEntitSet(entitySet);
-
- assertEquals("ESAllPrim", impl.toString());
- assertEquals(entitySet, impl.getEntitySet());
-
- assertEquals(entitySet.getEntityType(), impl.getType());
- assertEquals(entitySet.getEntityType(), impl.getEntityType());
- impl.getEntityType();
-
- // is Collection
- assertEquals(true, impl.isCollection());
- impl.setKeyPredicates(new ArrayList<UriParameterImpl>());
- assertEquals(false, impl.isCollection());
- }
-
- @Test
- public void testUriResourceFunctionImpl() {
- UriResourceFunctionImpl impl = new UriResourceFunctionImpl();
- assertEquals(UriResourceKind.function, impl.getKind());
- assertEquals("", impl.toString());
-
- // function
- EdmFunction function = edm.getEntityContainer(null).getFunctionImport("FINRTInt16")
- .getUnboundFunction(new ArrayList<String>());
- assertNotNull(function);
- impl.setFunction(function);
-
- assertEquals(function, impl.getFunction());
- assertEquals("UFNRTInt16", impl.toString());
- assertEquals(function.getReturnType().getType(), impl.getType());
- assertEquals(false, impl.isParameterListFilled());
-
- // function import
- impl = new UriResourceFunctionImpl();
- EdmFunctionImport functionImport = edm.getEntityContainer(null).getFunctionImport("FINRTInt16");
- impl.setFunctionImport(functionImport, new ArrayList<UriParameterImpl>());
- assertEquals(functionImport, impl.getFunctionImport());
- assertEquals("FINRTInt16", impl.toString());
-
- // function collection
- impl = new UriResourceFunctionImpl();
- functionImport = edm.getEntityContainer(null).getFunctionImport("FICRTESTwoKeyNavParam");
- assertNotNull(function);
- UriParameterImpl parameter = new UriParameterImpl().setName("ParameterInt16");
- impl.setFunctionImport(functionImport, Arrays.asList(parameter));
- assertEquals("FICRTESTwoKeyNavParam", impl.toString());
-
- impl.setFunction(functionImport.getUnboundFunction(Arrays.asList("ParameterInt16")));
- assertEquals(true, impl.isCollection());
- impl.setKeyPredicates(new ArrayList<UriParameterImpl>());
- assertEquals(false, impl.isCollection());
-
- assertEquals(parameter, impl.getParameters().get(0));
- assertEquals(true, impl.isParameterListFilled());
- }
-
- @Test
- public void testUriResourceImplKeyPred() {
- class Mock extends UriResourceWithKeysImpl {
-
- EdmType type;
-
- public Mock() {
- super(UriResourceKind.action);
- }
-
- @Override
- public EdmType getType() {
- return type;
- }
-
- public Mock setType(final EdmType type) {
- this.type = type;
- return this;
- }
-
- @Override
- public boolean isCollection() {
- return false;
- }
-
- @Override
- public String toString() {
- return "mock";
- }
- }
-
- Mock impl = new Mock();
- EdmEntityType entityType = edm.getEntityType(EntityTypeProvider.nameETTwoKeyNav);
- EdmEntityType entityTypeBaseColl = edm.getEntityType(EntityTypeProvider.nameETBaseTwoKeyNav);
- EdmEntityType entityTypeBaseEntry = edm.getEntityType(EntityTypeProvider.nameETTwoBaseTwoKeyNav);
-
- impl.setType(entityType);
- assertEquals(entityType, impl.getType());
- assertEquals("mock", impl.toString(false));
- assertEquals("mock", impl.toString(true));
-
- // set both
- impl.setCollectionTypeFilter(entityTypeBaseColl);
- assertEquals(entityTypeBaseColl, impl.getTypeFilterOnCollection());
- assertEquals("mock", impl.toString(false));
- assertEquals("mock/olingo.odata.test1.ETBaseTwoKeyNav", impl.toString(true));
- impl.setEntryTypeFilter(entityTypeBaseEntry);
- assertEquals(entityTypeBaseEntry, impl.getTypeFilterOnEntry());
- assertEquals("mock", impl.toString(false));
- assertEquals("mock/olingo.odata.test1.ETBaseTwoKeyNav/()olingo.odata.test1.ETTwoBaseTwoKeyNav",
- impl.toString(true));
-
- // set entry
- impl = new Mock();
- impl.setType(entityType);
- impl.setEntryTypeFilter(entityTypeBaseEntry);
- assertEquals(entityTypeBaseEntry, impl.getTypeFilterOnEntry());
- assertEquals("mock", impl.toString(false));
- assertEquals("mock/olingo.odata.test1.ETTwoBaseTwoKeyNav", impl.toString(true));
-
- // set collection
- impl = new Mock();
- impl.setType(entityType);
- impl.setCollectionTypeFilter(entityTypeBaseColl);
- assertEquals(entityTypeBaseColl, impl.getTypeFilterOnCollection());
- assertEquals("mock", impl.toString(false));
- assertEquals("mock/olingo.odata.test1.ETBaseTwoKeyNav", impl.toString(true));
-
- impl = new Mock();
- UriParameterImpl parameter = new UriParameterImpl().setName("ParameterInt16");
- List<UriParameterImpl> keyPredicates = new ArrayList<UriParameterImpl>();
- keyPredicates.add(parameter);
-
- impl.setKeyPredicates(keyPredicates);
- assertNotNull(null, impl.getKeyPredicates());
-
- }
-
- @Test
- public void testUriResourceImplTyped() {
- class Mock extends UriResourceTypedImpl {
-
- EdmType type;
-
- public Mock() {
- super(UriResourceKind.action);
- }
-
- @Override
- public EdmType getType() {
- return type;
- }
-
- @Override
- public boolean isCollection() {
- return false;
- }
-
- public Mock setType(final EdmType type) {
- this.type = type;
- return this;
- }
-
- @Override
- public String toString() {
- return "mock";
- }
-
- }
-
- Mock impl = new Mock();
- EdmEntityType entityType = edm.getEntityType(EntityTypeProvider.nameETTwoKeyNav);
- EdmEntityType entityTypeBaseColl = edm.getEntityType(EntityTypeProvider.nameETBaseTwoKeyNav);
- edm.getEntityType(EntityTypeProvider.nameETTwoBaseTwoKeyNav);
-
- impl.setType(entityType);
- assertEquals("mock", impl.toString());
- assertEquals("mock", impl.toString(true));
- assertEquals("mock", impl.toString(false));
-
- impl.setTypeFilter(entityTypeBaseColl);
- assertEquals(entityTypeBaseColl, impl.getTypeFilter());
- assertEquals("mock", impl.toString());
- assertEquals("mock/olingo.odata.test1.ETBaseTwoKeyNav", impl.toString(true));
- assertEquals("mock", impl.toString(false));
- //
- }
-
- @Test
- public void testUriResourceItImpl() {
- UriResourceItImpl impl = new UriResourceItImpl();
- assertEquals(UriResourceKind.it, impl.getKind());
-
- EdmEntityType entityType = edm.getEntityType(EntityTypeProvider.nameETTwoKeyNav);
- assertEquals("$it", impl.toString());
-
- impl.setType(entityType);
- assertEquals(entityType, impl.getType());
-
- UriParameterImpl parameter = new UriParameterImpl().setName("ParameterInt16");
- List<UriParameterImpl> keyPredicates = new ArrayList<UriParameterImpl>();
- keyPredicates.add(parameter);
-
- assertEquals(false, impl.isCollection());
- impl.setCollection(true);
- assertEquals(true, impl.isCollection());
- impl.setKeyPredicates(keyPredicates);
- assertEquals(false, impl.isCollection());
- }
-
- @Test
- public void testUriResourceNavigationPropertyImpl() {
- UriResourceNavigationPropertyImpl impl = new UriResourceNavigationPropertyImpl();
- assertEquals(UriResourceKind.navigationProperty, impl.getKind());
-
- EdmEntityType entityType = edm.getEntityType(EntityTypeProvider.nameETTwoKeyNav);
- EdmNavigationProperty property = (EdmNavigationProperty) entityType.getProperty("NavPropertyETKeyNavMany");
- assertNotNull(property);
-
- impl.setNavigationProperty(property);
- assertEquals(property, impl.getProperty());
-
- assertEquals("NavPropertyETKeyNavMany", impl.toString());
- assertEquals(property.getType(), impl.getType());
-
- UriParameterImpl parameter = new UriParameterImpl().setName("ParameterInt16");
- List<UriParameterImpl> keyPredicates = new ArrayList<UriParameterImpl>();
- keyPredicates.add(parameter);
-
- assertEquals(true, impl.isCollection());
- impl.setKeyPredicates(keyPredicates);
- assertEquals(false, impl.isCollection());
- }
-
- @Test
- public void testUriResourceRefImpl() {
- UriResourceRefImpl impl = new UriResourceRefImpl();
- assertEquals(UriResourceKind.ref, impl.getKind());
- assertEquals("$ref", impl.toString());
- }
-
- @Test
- public void testUriResourceRootImpl() {
- UriResourceRootImpl impl = new UriResourceRootImpl();
- assertEquals(UriResourceKind.root, impl.getKind());
-
- EdmEntityType entityType = edm.getEntityType(EntityTypeProvider.nameETTwoKeyNav);
- assertEquals("$root", impl.toString());
-
- impl.setType(entityType);
- assertEquals(entityType, impl.getType());
-
- UriParameterImpl parameter = new UriParameterImpl().setName("ParameterInt16");
- List<UriParameterImpl> keyPredicates = new ArrayList<UriParameterImpl>();
- keyPredicates.add(parameter);
-
- assertEquals(false, impl.isCollection());
- impl.setCollection(true);
- assertEquals(true, impl.isCollection());
- impl.setKeyPredicates(keyPredicates);
- assertEquals(false, impl.isCollection());
- }
-
- @Test
- public void testUriResourceSingletonImpl() {
- UriResourceSingletonImpl impl = new UriResourceSingletonImpl();
- assertEquals(UriResourceKind.singleton, impl.getKind());
-
- EdmSingletonImpl singleton = (EdmSingletonImpl) edm.getEntityContainer(null).getSingleton("SINav");
- EdmEntityType entityTypeBaseColl = edm.getEntityType(EntityTypeProvider.nameETBaseTwoKeyNav);
- impl.setSingleton(singleton);
-
- assertEquals("SINav", impl.toString());
- assertEquals(singleton, impl.getSingleton());
-
- assertEquals(singleton.getEntityType(), impl.getType());
- assertEquals(singleton.getEntityType(), impl.getEntityType());
- impl.getEntityType();
-
- impl.setTypeFilter(entityTypeBaseColl);
- assertEquals(entityTypeBaseColl, impl.getEntityTypeFilter());
-
- // is Collection
- assertEquals(false, impl.isCollection());
- }
-
- @Test
- public void testUriResourceValueImpl() {
- UriResourceValueImpl impl = new UriResourceValueImpl();
- assertEquals(UriResourceKind.value, impl.getKind());
- assertEquals("$value", impl.toString());
- }
-
- @Test
- public void testUriResourceLambdaVarImpl() {
- UriResourceLambdaVarImpl impl = new UriResourceLambdaVarImpl();
- assertEquals(UriResourceKind.lambdaVariable, impl.getKind());
-
- EdmEntityType entityType = edm.getEntityType(EntityTypeProvider.nameETTwoKeyNav);
- impl.setType(entityType);
- impl.setVariableText("A");
-
- assertEquals("A", impl.toString());
- assertEquals(entityType, impl.getType());
- assertEquals("A", impl.getVariableName());
- assertEquals(false, impl.isCollection());
- impl.setCollection(true);
- assertEquals(true, impl.isCollection());
- }
-
- @Test
- public void testUriResourceStartingTypeFilterImpl() {
- UriResourceStartingTypeFilterImpl impl = new UriResourceStartingTypeFilterImpl();
-
- EdmEntityType entityType = edm.getEntityType(EntityTypeProvider.nameETTwoKeyNav);
-
- impl.setType(entityType);
- assertEquals("olingo.odata.test1.ETTwoKeyNav", impl.toString());
- assertEquals(entityType, impl.getType());
-
- UriParameterImpl parameter = new UriParameterImpl().setName("ParameterInt16");
- List<UriParameterImpl> keyPredicates = new ArrayList<UriParameterImpl>();
- keyPredicates.add(parameter);
-
- assertEquals(false, impl.isCollection());
- impl.setCollection(true);
- assertEquals(true, impl.isCollection());
- impl.setKeyPredicates(keyPredicates);
- assertEquals(false, impl.isCollection());
-
- }
-}
diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/antlr/TestFullResourcePath.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/antlr/TestFullResourcePath.java
deleted file mode 100644
index 0b5cb2a..0000000
--- a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/antlr/TestFullResourcePath.java
+++ /dev/null
@@ -1,5204 +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.uri.antlr;
-
-import java.io.UnsupportedEncodingException;
-import java.util.Arrays;
-
-import org.apache.olingo.commons.api.edm.Edm;
-import org.apache.olingo.commons.api.http.HttpContentType;
-import org.apache.olingo.commons.core.Encoder;
-import org.apache.olingo.server.api.ODataApplicationException;
-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.BinaryOperatorKind;
-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.uri.parser.UriParserException;
-import org.apache.olingo.server.core.uri.parser.UriParserSemanticException;
-import org.apache.olingo.server.core.uri.parser.UriParserSyntaxException;
-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.tecsvc.provider.ComplexTypeProvider;
-import org.apache.olingo.server.tecsvc.provider.ContainerProvider;
-import org.apache.olingo.server.tecsvc.provider.EntityTypeProvider;
-import org.apache.olingo.server.tecsvc.provider.EnumTypeProvider;
-import org.apache.olingo.server.tecsvc.provider.PropertyProvider;
-import org.junit.Ignore;
-import org.junit.Test;
-
-public class TestFullResourcePath {
- Edm edm = null;
- TestUriValidator testUri = null;
- ResourceValidator testRes = null;
- FilterValidator testFilter = null;
-
- public TestFullResourcePath() {
- edm = new EdmProviderImpl(new EdmTechTestProvider());
- testUri = new TestUriValidator().setEdm(edm);
- testRes = new ResourceValidator().setEdm(edm);
- testFilter = new FilterValidator().setEdm(edm);
- }
-
- @Test
- public void testFunctionBound_varOverloading() throws Exception {
- // on ESTwoKeyNav
- testUri.run("ESTwoKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav()").goPath()
- .at(0)
- .isUriPathInfoKind(UriResourceKind.entitySet)
- .isType(EntityTypeProvider.nameETTwoKeyNav, true)
- .at(1)
- .isUriPathInfoKind(UriResourceKind.function)
- .isType(EntityTypeProvider.nameETTwoKeyNav);
-
- // with string parameter
- testUri.run("ESTwoKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav(ParameterString='ABC')").goPath()
- .at(0)
- .isUriPathInfoKind(UriResourceKind.entitySet)
- .isType(EntityTypeProvider.nameETTwoKeyNav, true)
- .at(1)
- .isUriPathInfoKind(UriResourceKind.function)
- .isType(EntityTypeProvider.nameETTwoKeyNav);
-
- // with string parameter
- testUri.run("ESTwoKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav()").goPath()
- .at(0)
- .isUriPathInfoKind(UriResourceKind.entitySet)
- .isType(EntityTypeProvider.nameETTwoKeyNav, true)
- .at(1)
- .isUriPathInfoKind(UriResourceKind.function)
- .isType(EntityTypeProvider.nameETTwoKeyNav);
- }
-
- @Test
- public void runBfuncBnCpropCastRtEs() throws Exception {
-
- testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/olingo.odata.test1.ETBaseTwoKeyNav"
- + "/PropertyComp/olingo.odata.test1.BFCCTPrimCompRTESBaseTwoKeyNav()")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoKeyNav")
- .isType(EntityTypeProvider.nameETTwoKeyNav, false)
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isKeyPredicate(1, "PropertyString", "'2'")
- .isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav)
- .n()
- .isComplex("PropertyComp")
- .isType(ComplexTypeProvider.nameCTPrimComp, false)
- .n()
- .isFunction("BFCCTPrimCompRTESBaseTwoKeyNav");
-
- testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/olingo.odata.test1.ETBaseTwoKeyNav"
- + "/PropertyComp/olingo.odata.test1.BFCCTPrimCompRTESBaseTwoKeyNav()/$count")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoKeyNav")
- .isType(EntityTypeProvider.nameETTwoKeyNav, false)
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isKeyPredicate(1, "PropertyString", "'2'")
- .isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav)
- .n()
- .isComplex("PropertyComp")
- .isType(ComplexTypeProvider.nameCTPrimComp, false)
- .n()
- .isFunction("BFCCTPrimCompRTESBaseTwoKeyNav")
- .isType(EntityTypeProvider.nameETBaseTwoKeyNav)
- .n()
- .isUriPathInfoKind(UriResourceKind.count);
-
- }
-
- @Test
- public void runBfuncBnCpropCollRtEs() throws Exception {
- testUri.run("ESKeyNav(PropertyInt16=1)/CollPropertyComp/olingo.odata.test1.BFCCollCTPrimCompRTESAllPrim()")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .n()
- .isUriPathInfoKind(UriResourceKind.complexProperty)
- .isComplex("CollPropertyComp")
- .isType(ComplexTypeProvider.nameCTPrimComp, true)
- .n()
- .isFunction("BFCCollCTPrimCompRTESAllPrim");
-
- testUri
- .run("ESKeyNav(PropertyInt16=1)/CollPropertyComp/olingo.odata.test1.BFCCollCTPrimCompRTESAllPrim()/$count")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .n()
- .isUriPathInfoKind(UriResourceKind.complexProperty)
- .isComplex("CollPropertyComp")
- .isType(ComplexTypeProvider.nameCTPrimComp, true)
- .n()
- .isFunction("BFCCollCTPrimCompRTESAllPrim")
- .isType(EntityTypeProvider.nameETAllPrim, true)
- .n()
- .isUriPathInfoKind(UriResourceKind.count);
- }
-
- @Test
- public void runBfuncBnCpropRtEs() throws Exception {
- testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')"
- + "/PropertyComp/olingo.odata.test1.BFCCTPrimCompRTESTwoKeyNav()")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoKeyNav")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isKeyPredicate(1, "PropertyString", "'2'")
- .n()
- .isUriPathInfoKind(UriResourceKind.complexProperty)
- .isComplex("PropertyComp")
- .isType(ComplexTypeProvider.nameCTPrimComp, false)
- .n()
- .isFunction("BFCCTPrimCompRTESTwoKeyNav");
-
- testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')"
- + "/PropertyComp/olingo.odata.test1.BFCCTPrimCompRTESTwoKeyNav()/$count")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoKeyNav")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isKeyPredicate(1, "PropertyString", "'2'")
- .n()
- .isUriPathInfoKind(UriResourceKind.complexProperty)
- .isComplex("PropertyComp")
- .isType(ComplexTypeProvider.nameCTPrimComp, false)
- .n()
- .isFunction("BFCCTPrimCompRTESTwoKeyNav")
- .isType(EntityTypeProvider.nameETTwoKeyNav)
- .n()
- .isUriPathInfoKind(UriResourceKind.count);
-
- }
-
- @Test
- public void runBfuncBnEntityRtEs() throws Exception {
- testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/olingo.odata.test1.BFCETTwoKeyNavRTESTwoKeyNav()")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoKeyNav")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isKeyPredicate(1, "PropertyString", "'2'")
- .n()
- .isFunction("BFCETTwoKeyNavRTESTwoKeyNav");
- }
-
- @Test
- public void runBfuncBnEntityCastRtEs() throws Exception {
- testUri
- .run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/olingo.odata.test1.ETBaseTwoKeyNav"
- + "/olingo.odata.test1.BFCETBaseTwoKeyNavRTESTwoKeyNav()")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoKeyNav")
- .isType(EntityTypeProvider.nameETTwoKeyNav, false)
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isKeyPredicate(1, "PropertyString", "'2'")
- .isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav)
- .n()
- .isFunction("BFCETBaseTwoKeyNavRTESTwoKeyNav");
-
- testUri
- .run("ESTwoKeyNav/olingo.odata.test1.ETBaseTwoKeyNav(PropertyInt16=1,PropertyString='(''2'')')"
- + "/olingo.odata.test1.BFCETBaseTwoKeyNavRTESTwoKeyNav()")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoKeyNav")
- .isType(EntityTypeProvider.nameETTwoKeyNav, false)
- .isTypeFilterOnCollection(EntityTypeProvider.nameETBaseTwoKeyNav)
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isKeyPredicate(1, "PropertyString", "'(''2'')'")
- .n()
- .isFunction("BFCETBaseTwoKeyNavRTESTwoKeyNav");
- }
-
- @Test
- public void runBfuncBnEsCastRtEs() throws Exception {
- testUri.run("ESTwoKeyNav/olingo.odata.test1.ETBaseTwoKeyNav"
- + "/olingo.odata.test1.BFCESBaseTwoKeyNavRTESBaseTwoKey()")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoKeyNav")
- .isType(EntityTypeProvider.nameETTwoKeyNav, true)
- .isTypeFilterOnCollection(EntityTypeProvider.nameETBaseTwoKeyNav)
- .n()
- .isFunction("BFCESBaseTwoKeyNavRTESBaseTwoKey");
-
- testUri.run("ESTwoKeyNav/olingo.odata.test1.ETBaseTwoKeyNav"
- + "/olingo.odata.test1.BFCESBaseTwoKeyNavRTESBaseTwoKey()"
- + "/olingo.odata.test1.ETTwoBaseTwoKeyNav")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoKeyNav")
- .isType(EntityTypeProvider.nameETTwoKeyNav, true)
- .isTypeFilterOnCollection(EntityTypeProvider.nameETBaseTwoKeyNav)
- .n()
- .isFunction("BFCESBaseTwoKeyNavRTESBaseTwoKey")
- .isType(EntityTypeProvider.nameETBaseTwoKeyNav)
- .isTypeFilterOnCollection(EntityTypeProvider.nameETTwoBaseTwoKeyNav);
-
- testUri.run("ESTwoKeyNav"
- + "/olingo.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav()"
- + "/olingo.odata.test1.ETBaseTwoKeyNav(PropertyInt16=1,PropertyString='2')"
- + "/olingo.odata.test1.ETTwoBaseTwoKeyNav")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoKeyNav")
- .n()
- .isFunction("BFCESTwoKeyNavRTESTwoKeyNav")
- .isType(EntityTypeProvider.nameETTwoKeyNav)
- .isTypeFilterOnCollection(EntityTypeProvider.nameETBaseTwoKeyNav)
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isKeyPredicate(1, "PropertyString", "'2'")
- .isTypeFilterOnEntry(EntityTypeProvider.nameETTwoBaseTwoKeyNav);
- }
-
- @Test
- public void runBfuncBnEsRtCprop() throws Exception {
- testUri.run("ESAllPrim/olingo.odata.test1.BFCESAllPrimRTCTAllPrim()")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESAllPrim")
- .n()
- .isFunction("BFCESAllPrimRTCTAllPrim")
- .isType(ComplexTypeProvider.nameCTAllPrim);
-
- testUri.run("ESTwoKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTCTTwoPrim()/olingo.odata.test1.CTBase")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoKeyNav")
- .n()
- .isFunction("BFCESTwoKeyNavRTCTTwoPrim")
- .isType(ComplexTypeProvider.nameCTTwoPrim, false)
- .isTypeFilterOnEntry(ComplexTypeProvider.nameCTBase);
- }
-
- @Test
- public void runBfuncBnEsRtCpropColl() throws Exception {
- testUri.run("ESTwoKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTCollCTTwoPrim()")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoKeyNav")
- .n()
- .isFunction("BFCESTwoKeyNavRTCollCTTwoPrim")
- .isType(ComplexTypeProvider.nameCTTwoPrim, true);
-
- testUri.run("ESTwoKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTCollCTTwoPrim()/$count")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoKeyNav")
- .n()
- .isFunction("BFCESTwoKeyNavRTCollCTTwoPrim")
- .isType(ComplexTypeProvider.nameCTTwoPrim, true)
- .n()
- .isUriPathInfoKind(UriResourceKind.count);
- }
-
- @Test
- public void runBfuncBnEsRtEntityPpNp() throws Exception {
- testUri.run("ESTwoKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTTwoKeyNav()/NavPropertyETKeyNavOne")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoKeyNav")
- .n()
- .isFunction("BFCESTwoKeyNavRTTwoKeyNav")
- .n()
- .isNavProperty("NavPropertyETKeyNavOne", EntityTypeProvider.nameETKeyNav, false);
-
- testUri.run("ESTwoKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTTwoKeyNav()/NavPropertyETKeyNavOne/$ref")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoKeyNav")
- .n()
- .isFunction("BFCESTwoKeyNavRTTwoKeyNav")
- .n()
- .isNavProperty("NavPropertyETKeyNavOne", EntityTypeProvider.nameETKeyNav, false)
- .n()
- .isUriPathInfoKind(UriResourceKind.ref);
-
- testUri.run("ESKeyNav/olingo.odata.test1.BFCESKeyNavRTETKeyNav()/NavPropertyETMediaOne/$value")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .n()
- .isFunction("BFCESKeyNavRTETKeyNav")
- .n()
- .isNavProperty("NavPropertyETMediaOne", EntityTypeProvider.nameETMedia, false)
- .n()
- .isValue();
-
- testUri.run("ESKeyNav/olingo.odata.test1.BFCESKeyNavRTETKeyNavParam(ParameterString='1')"
- + "/NavPropertyETTwoKeyNavOne")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .n()
- .isFunction("BFCESKeyNavRTETKeyNavParam")
- .isParameter(0, "ParameterString", "'1'")
- .n()
- .isNavProperty("NavPropertyETTwoKeyNavOne", EntityTypeProvider.nameETTwoKeyNav, false);
-
- testUri.run("ESKeyNav/olingo.odata.test1.BFCESKeyNavRTETKeyNavParam(ParameterString='1')"
- + "/NavPropertyETTwoKeyNavOne/PropertyComp")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .n()
- .isFunction("BFCESKeyNavRTETKeyNavParam")
- .isParameter(0, "ParameterString", "'1'")
- .n()
- .isNavProperty("NavPropertyETTwoKeyNavOne", EntityTypeProvider.nameETTwoKeyNav, false)
- .n()
- .isComplex("PropertyComp")
- .isType(ComplexTypeProvider.nameCTPrimComp);
-
- testUri.run("ESKeyNav/olingo.odata.test1.BFCESKeyNavRTETKeyNavParam(ParameterString='1')"
- + "/NavPropertyETTwoKeyNavOne/PropertyComp/PropertyComp")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .n()
- .isFunction("BFCESKeyNavRTETKeyNavParam")
- .isParameter(0, "ParameterString", "'1'")
- .n()
- .isNavProperty("NavPropertyETTwoKeyNavOne", EntityTypeProvider.nameETTwoKeyNav, false)
- .n()
- .isComplex("PropertyComp")
- .isType(ComplexTypeProvider.nameCTPrimComp)
- .n()
- .isComplex("PropertyComp")
- .isType(ComplexTypeProvider.nameCTAllPrim);
-
- testUri.run("ESKeyNav/olingo.odata.test1.BFCESKeyNavRTETKeyNavParam(ParameterString='1')"
- + "/NavPropertyETTwoKeyNavOne/PropertyString")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .n()
- .isFunction("BFCESKeyNavRTETKeyNavParam")
- .isParameter(0, "ParameterString", "'1'")
- .n()
- .isNavProperty("NavPropertyETTwoKeyNavOne", EntityTypeProvider.nameETTwoKeyNav, false)
- .n()
- .isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false);
-
- testUri.run("ESKeyNav/olingo.odata.test1.BFCESKeyNavRTETKeyNavParam(ParameterString='1')"
- + "/NavPropertyETTwoKeyNavMany(PropertyInt16=2,PropertyString='3')/PropertyString")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .n()
- .isFunction("BFCESKeyNavRTETKeyNavParam")
- .isParameter(0, "ParameterString", "'1'")
- .n()
- .isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, false)
- .isKeyPredicate(0, "PropertyInt16", "2")
- .isKeyPredicate(1, "PropertyString", "'3'")
- .n()
- .isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false);
-
- testUri.runEx("ESKeyNav/olingo.odata.test1.BFCESKeyNavRTETKeyNavParam(WrongParameter='1')")
- .isExSemantic(UriParserSemanticException.MessageKeys.UNKNOWN_PART);
- testUri.runEx("ESKeyNav/olingo.odata.test1.BFCESKeyNavRTETKeyNavParam(ParameterString=wrong)")
- .isExSemantic(UriParserSemanticException.MessageKeys.INVALID_KEY_VALUE);
- }
-
- @Test
- public void runBfuncBnEsRtEntyPpNpCast() throws Exception {
- testUri.run("ESTwoKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTTwoKeyNav()"
- + "/NavPropertyETTwoKeyNavOne/olingo.odata.test1.ETBaseTwoKeyNav")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoKeyNav")
- .n()
- .isFunction("BFCESTwoKeyNavRTTwoKeyNav")
- .n()
- .isNavProperty("NavPropertyETTwoKeyNavOne", EntityTypeProvider.nameETTwoKeyNav, false)
- .isType(EntityTypeProvider.nameETTwoKeyNav, false)
- .isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav);
-
- testUri
- .run("ESTwoKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav()(PropertyInt16=1,PropertyString='2')"
- + "/NavPropertyETTwoKeyNavOne/olingo.odata.test1.ETTwoBaseTwoKeyNav")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoKeyNav")
- .n()
- .isFunction("BFCESTwoKeyNavRTESTwoKeyNav")
- .isType(EntityTypeProvider.nameETTwoKeyNav, false)
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isKeyPredicate(1, "PropertyString", "'2'")
- .n()
- .isNavProperty("NavPropertyETTwoKeyNavOne", EntityTypeProvider.nameETTwoKeyNav, false)
- .isType(EntityTypeProvider.nameETTwoKeyNav, false)
- .isTypeFilterOnEntry(EntityTypeProvider.nameETTwoBaseTwoKeyNav);
-
- }
-
- @Test
- public void runBfuncBnEsRtEntityPpCp() throws Exception {
-
- testUri.run("ESKeyNav/olingo.odata.test1.BFCESKeyNavRTETKeyNav()/PropertyComp")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .n()
- .isFunction("BFCESKeyNavRTETKeyNav")
- .n()
- .isComplex("PropertyComp")
- .isType(ComplexTypeProvider.nameCTNavFiveProp);
-
- testUri.run("ESKeyNav/olingo.odata.test1.BFCESKeyNavRTETKeyNav()/PropertyComp/PropertyInt16")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .n()
- .isFunction("BFCESKeyNavRTETKeyNav")
- .n()
- .isComplex("PropertyComp")
- .isType(ComplexTypeProvider.nameCTNavFiveProp)
- .n()
- .isPrimitiveProperty("PropertyInt16", PropertyProvider.nameInt16, false);
-
- testUri.run("ESKeyNav/olingo.odata.test1.BFCESKeyNavRTETKeyNav()/PropertyComp/PropertyInt16/$value")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .n()
- .isFunction("BFCESKeyNavRTETKeyNav")
- .n()
- .isComplex("PropertyComp")
- .isType(ComplexTypeProvider.nameCTNavFiveProp)
- .n()
- .isPrimitiveProperty("PropertyInt16", PropertyProvider.nameInt16, false)
- .n()
- .isValue();
-
- }
-
- @Test
- public void runBfuncBnEsRtEntyPpCpCast() throws Exception {
-
- testUri.run("ESKeyNav/olingo.odata.test1.BFCESKeyNavRTETKeyNavParam(ParameterString='1')"
- + "/PropertyCompTwoPrim/olingo.odata.test1.CTTwoBase")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .n()
- .isFunction("BFCESKeyNavRTETKeyNavParam")
- .isParameter(0, "ParameterString", "'1'")
- .n()
- .isComplex("PropertyCompTwoPrim")
- .isType(ComplexTypeProvider.nameCTTwoPrim)
- .isTypeFilter(ComplexTypeProvider.nameCTTwoBase);
-
- testUri.run("ESKeyNav/olingo.odata.test1.BFCESKeyNavRTETKeyNavParam(ParameterString='1')"
- + "/NavPropertyETTwoKeyNavMany(PropertyInt16=2,PropertyString='3')"
- + "/PropertyCompTwoPrim/olingo.odata.test1.CTTwoBase")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .n()
- .isFunction("BFCESKeyNavRTETKeyNavParam")
- .isParameter(0, "ParameterString", "'1'")
- .n()
- .isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, false)
- .isKeyPredicate(0, "PropertyInt16", "2")
- .isKeyPredicate(1, "PropertyString", "'3'")
- .n()
- .isComplex("PropertyCompTwoPrim")
- .isType(ComplexTypeProvider.nameCTTwoPrim)
- .isTypeFilter(ComplexTypeProvider.nameCTTwoBase);
- }
-
- @Test
- public void runBfuncBnEsRtEntityPpSp() throws Exception {
- testUri.run("ESKeyNav/olingo.odata.test1.BFCESKeyNavRTETKeyNav()/PropertyInt16")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .n()
- .isFunction("BFCESKeyNavRTETKeyNav")
- .n()
- .isPrimitiveProperty("PropertyInt16", PropertyProvider.nameInt16, false);
-
- testUri.run("ESKeyNav/olingo.odata.test1.BFCESKeyNavRTETKeyNav()/PropertyInt16/$value")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .n()
- .isFunction("BFCESKeyNavRTETKeyNav")
- .n()
- .isPrimitiveProperty("PropertyInt16", PropertyProvider.nameInt16, false)
- .n()
- .isValue();
-
- }
-
- @Test
- public void runBfuncBnEsRtEs() throws Exception {
-
- testUri.run("ESTwoKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav()")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoKeyNav")
- .n()
- .isFunction("BFCESTwoKeyNavRTESTwoKeyNav")
- .isType(EntityTypeProvider.nameETTwoKeyNav);
-
- testUri.run("ESTwoKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav(ParameterString='2')")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoKeyNav")
- .n()
- .isFunction("BFCESTwoKeyNavRTESTwoKeyNav")
- .isParameter(0, "ParameterString", "'2'")
- .isType(EntityTypeProvider.nameETTwoKeyNav);
-
- testUri.run("ESKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav()")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .n()
- .isFunction("BFCESTwoKeyNavRTESTwoKeyNav")
- .isType(EntityTypeProvider.nameETTwoKeyNav);
-
- testUri.run("ESKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav(ParameterString='3')")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .n()
- .isFunction("BFCESTwoKeyNavRTESTwoKeyNav")
- .isParameter(0, "ParameterString", "'3'")
- .isType(EntityTypeProvider.nameETTwoKeyNav);
-
- testUri.run("ESTwoKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav()/$count")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoKeyNav")
- .n()
- .isFunction("BFCESTwoKeyNavRTESTwoKeyNav")
- .isType(EntityTypeProvider.nameETTwoKeyNav)
- .n()
- .isCount();
-
- testUri.run("ESTwoKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav()(PropertyInt16=1,PropertyString='2')")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoKeyNav")
- .n()
- .isFunction("BFCESTwoKeyNavRTESTwoKeyNav")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isKeyPredicate(1, "PropertyString", "'2'");
-
- }
-
- @Test
- public void runBfuncBnEsRtEsBa() throws Exception {
-
- testUri.run("ESKeyNav(PropertyInt16=1)/CollPropertyComp"
- + "/olingo.odata.test1.BFCCollCTPrimCompRTESAllPrim()/olingo.odata.test1.BAESAllPrimRTETAllPrim")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .n()
- .isComplex("CollPropertyComp")
- .isType(ComplexTypeProvider.nameCTPrimComp)
- .n()
- .isFunction("BFCCollCTPrimCompRTESAllPrim")
- .n()
- .isAction("BAESAllPrimRTETAllPrim");
-
- }
-
- @Test
- public void runBfuncBnEsRtPrim() throws Exception {
- testUri.run("ESTwoKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTString()")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoKeyNav")
- .n()
- .isFunction("BFCESTwoKeyNavRTString");
-
- testUri.run("ESTwoKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTString()/$value")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoKeyNav")
- .n()
- .isFunction("BFCESTwoKeyNavRTString")
- .isType(PropertyProvider.nameString)
- .n()
- .isValue();
- }
-
- @Test
- public void runbfuncBnEsRtPrimColl() throws Exception {
- testUri.run("ESTwoKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTCollString()")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoKeyNav")
- .n()
- .isFunction("BFCESTwoKeyNavRTCollString")
- .isType(PropertyProvider.nameString, true);
-
- testUri.run("ESTwoKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTCollString()/$count")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoKeyNav")
- .n()
- .isFunction("BFCESTwoKeyNavRTCollString")
- .isType(PropertyProvider.nameString, true)
- .n()
- .isCount();
- }
-
- @Test
- public void runBfuncBnPpropCollRtEs() throws Exception {
- testUri.run("ESKeyNav(1)/CollPropertyString/olingo.odata.test1.BFCCollStringRTESTwoKeyNav()")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .n()
- .isPrimitiveProperty("CollPropertyString", PropertyProvider.nameString, true)
- .n()
- .isFunction("BFCCollStringRTESTwoKeyNav")
- .isType(EntityTypeProvider.nameETTwoKeyNav, true);
-
- testUri.run("ESKeyNav(1)/CollPropertyString/olingo.odata.test1.BFCCollStringRTESTwoKeyNav()/$count")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .n()
- .isPrimitiveProperty("CollPropertyString", PropertyProvider.nameString, true)
- .n()
- .isFunction("BFCCollStringRTESTwoKeyNav")
- .isType(EntityTypeProvider.nameETTwoKeyNav, true)
- .n()
- .isCount();
- }
-
- @Test
- public void runBfuncBnPpropRtEs() throws Exception {
-
- testUri.run("ESKeyNav(1)/PropertyString/olingo.odata.test1.BFCStringRTESTwoKeyNav()")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .n()
- .isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false)
- .n()
- .isFunction("BFCStringRTESTwoKeyNav")
- .isType(EntityTypeProvider.nameETTwoKeyNav, true);
-
- testUri.run("ESKeyNav(1)/PropertyString/olingo.odata.test1.BFCStringRTESTwoKeyNav()/$count")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .n()
- .isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false)
- .n()
- .isFunction("BFCStringRTESTwoKeyNav")
- .isType(EntityTypeProvider.nameETTwoKeyNav, true)
- .n()
- .isCount();
-
- testUri.run("ESKeyNav(1)/PropertyString/olingo.odata.test1.BFCStringRTESTwoKeyNav()/$ref")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .n()
- .isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false)
- .n()
- .isFunction("BFCStringRTESTwoKeyNav")
- .isType(EntityTypeProvider.nameETTwoKeyNav, true)
- .n()
- .isRef();
- }
-
- @Test
- public void runBfuncBnSingleRtEs() throws Exception {
-
- testUri.run("SINav/olingo.odata.test1.BFCSINavRTESTwoKeyNav()")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isSingleton("SINav")
- .isType(EntityTypeProvider.nameETTwoKeyNav, false)
- .n()
- .isFunction("BFCSINavRTESTwoKeyNav");
- }
-
- @Test
- public void runBfuncBnSingleCastRtEs() throws Exception {
- testUri.run("SINav/olingo.odata.test1.ETBaseTwoKeyNav/olingo.odata.test1.BFCETBaseTwoKeyNavRTESBaseTwoKey()")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isSingleton("SINav")
- .isType(EntityTypeProvider.nameETTwoKeyNav, false)
- .isTypeFilter(EntityTypeProvider.nameETBaseTwoKeyNav)
- .n()
- .isFunction("BFCETBaseTwoKeyNavRTESBaseTwoKey");
- }
-
- @Test
- public void runActionBound_on_EntityEntry() throws Exception {
-
- testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/olingo.odata.test1.BAETTwoKeyNavRTETTwoKeyNav")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoKeyNav")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isKeyPredicate(1, "PropertyString", "'2'")
- .n()
- .isAction("BAETTwoKeyNavRTETTwoKeyNav");
-
- testUri.run("ESKeyNav(PropertyInt16=1)/olingo.odata.test1.BAETTwoKeyNavRTETTwoKeyNav")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .n()
- .isAction("BAETTwoKeyNavRTETTwoKeyNav");
- }
-
- @Test
- public void runActionBound_on_EntityCollection() throws Exception {
- testUri.run("ESTwoKeyNav/olingo.odata.test1.BAESTwoKeyNavRTESTwoKeyNav")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoKeyNav")
- .n()
- .isAction("BAESTwoKeyNavRTESTwoKeyNav");
- }
-
- @Test
- public void runFunctionBound_on_var_Types() throws Exception {
-
- // on primitive
- testUri.run("ESAllPrim(1)/PropertyString/olingo.odata.test1.BFCStringRTESTwoKeyNav()")
- .goPath()
- .at(0)
- .isUriPathInfoKind(UriResourceKind.entitySet)
- .isType(EntityTypeProvider.nameETAllPrim, false)
- .at(1)
- .isUriPathInfoKind(UriResourceKind.primitiveProperty)
- .isType(PropertyProvider.nameString);
-
- // on collection of primitive
- testUri.run("ESCollAllPrim(1)/CollPropertyString/olingo.odata.test1.BFCCollStringRTESTwoKeyNav()")
- .goPath()
- .at(0)
- .isUriPathInfoKind(UriResourceKind.entitySet)
- .isType(EntityTypeProvider.nameETCollAllPrim, false)
- .at(1)
- .isUriPathInfoKind(UriResourceKind.primitiveProperty)
- .isType(PropertyProvider.nameString);
-
- // on complex
- testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='ABC')"
- + "/PropertyComp/olingo.odata.test1.BFCCTPrimCompRTESTwoKeyNav()")
- .goPath()
- .at(0)
- .isUriPathInfoKind(UriResourceKind.entitySet)
- .isType(EntityTypeProvider.nameETTwoKeyNav, false)
- .at(1)
- .isUriPathInfoKind(UriResourceKind.complexProperty)
- .at(2)
- .isType(EntityTypeProvider.nameETTwoKeyNav);
-
- // on collection of complex
- testUri.run("ESKeyNav(1)/CollPropertyComp/olingo.odata.test1.BFCCollCTPrimCompRTESAllPrim()")
- .goPath()
- .at(0)
- .isUriPathInfoKind(UriResourceKind.entitySet)
- .at(1)
- .isType(ComplexTypeProvider.nameCTPrimComp, true)
- .at(2)
- .isUriPathInfoKind(UriResourceKind.function)
- .isType(EntityTypeProvider.nameETAllPrim);
-
- // on entity
- testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='ABC')"
- + "/olingo.odata.test1.BFCETTwoKeyNavRTESTwoKeyNav()")
- .goPath()
- .at(0)
- .isUriPathInfoKind(UriResourceKind.entitySet)
- .isType(EntityTypeProvider.nameETTwoKeyNav, false)
- .at(1)
- .isUriPathInfoKind(UriResourceKind.function)
- .isType(EntityTypeProvider.nameETTwoKeyNav);
-
- // on collection of entity
- testUri.run("ESTwoKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav()")
- .goPath()
- .at(0)
- .isUriPathInfoKind(UriResourceKind.entitySet)
- .isType(EntityTypeProvider.nameETTwoKeyNav, true)
- .at(1).isUriPathInfoKind(UriResourceKind.function)
- .isType(EntityTypeProvider.nameETTwoKeyNav);
- }
-
- @Test
- public void runActionBound_on_EntityCast() throws Exception {
-
- testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/olingo.odata.test1.ETBaseTwoKeyNav"
- + "/olingo.odata.test1.BAETBaseTwoKeyNavRTETBaseTwoKeyNav")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoKeyNav")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isKeyPredicate(1, "PropertyString", "'2'")
- .isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav)
- .n()
- .isAction("BAETBaseTwoKeyNavRTETBaseTwoKeyNav");
-
- testUri.run("ESTwoKeyNav/olingo.odata.test1.ETBaseTwoKeyNav(PropertyInt16=1,PropertyString='2')"
- + "/olingo.odata.test1.ETTwoBaseTwoKeyNav/olingo.odata.test1.BAETTwoBaseTwoKeyNavRTETBaseTwoKeyNav")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoKeyNav")
- .isTypeFilterOnCollection(EntityTypeProvider.nameETBaseTwoKeyNav)
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isKeyPredicate(1, "PropertyString", "'2'")
- .isTypeFilterOnEntry(EntityTypeProvider.nameETTwoBaseTwoKeyNav)
- .n()
- .isAction("BAETTwoBaseTwoKeyNavRTETBaseTwoKeyNav");
- }
-
- @Test
- public void runCrossjoin() throws Exception {
- testUri.run("$crossjoin(ESKeyNav)")
- .isKind(UriInfoKind.crossjoin)
- .isCrossJoinEntityList(Arrays.asList("ESKeyNav"));
-
- testUri.run("$crossjoin(ESKeyNav, ESTwoKeyNav)")
- .isKind(UriInfoKind.crossjoin)
- .isCrossJoinEntityList(Arrays.asList("ESKeyNav", "ESTwoKeyNav"));
- }
-
- @Test
- public void runCrossjoinError() throws Exception {
- testUri.runEx("$crossjoin").isExSyntax(UriParserSyntaxException.MessageKeys.SYNTAX);
- testUri.runEx("$crossjoin/error").isExSyntax(UriParserSyntaxException.MessageKeys.MUST_BE_LAST_SEGMENT);
- testUri.runEx("$crossjoin()").isExSyntax(UriParserSyntaxException.MessageKeys.SYNTAX);
- testUri.runEx("$crossjoin(ESKeyNav, ESTwoKeyNav)/invalid")
- .isExSyntax(UriParserSyntaxException.MessageKeys.MUST_BE_LAST_SEGMENT);
- }
-
- @Test
- public void runEntityId() throws Exception {
- testUri.run("$entity", "$id=ESKeyNav(1)")
- .isKind(UriInfoKind.entityId)
- .isIdText("ESKeyNav(1)");
- testUri.run("$entity/olingo.odata.test1.ETKeyNav", "$id=ESKeyNav(1)")
- .isKind(UriInfoKind.entityId)
- .isEntityType(EntityTypeProvider.nameETKeyNav)
- .isIdText("ESKeyNav(1)");
- }
-
- @Test
- public void runEntityIdError() {
- // TODO planned: move to validator
- // testUri.runEx("$entity").isExSyntax(UriParserSyntaxException.MessageKeys.SYNTAX);
- // testUri.runEx("$entity?$idfalse=ESKeyNav(1)").isExSyntax(UriParserSyntaxException.MessageKeys.SYNTAX);
- // testUri.runEx("$entity/olingo.odata.test1.invalidType?$id=ESKeyNav(1)").isExSemantic();
- // testUri.runEx("$entity/invalid?$id=ESKeyNav(1)").isExSyntax(UriParserSyntaxException.MessageKeys.SYNTAX);
- }
-
- @Test
- public void runEsName() throws Exception {
- testUri.run("ESAllPrim")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESAllPrim")
- .isType(EntityTypeProvider.nameETAllPrim, true);
-
- testUri.run("ESAllPrim/$count")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESAllPrim")
- .isType(EntityTypeProvider.nameETAllPrim, true)
- .n()
- .isCount();
- }
-
- @Test
- public void runEsNameError() {
-
- testUri.runEx("ESAllPrim/$count/$ref")
- .isExSemantic(UriParserSemanticException.MessageKeys.ONLY_FOR_TYPED_PROPERTIES);
- testUri.runEx("ESAllPrim/$ref/$count")
- .isExSemantic(UriParserSemanticException.MessageKeys.ONLY_FOR_TYPED_PARTS);
- testUri.runEx("ESAllPrim/$ref/invalid")
- .isExSemantic(UriParserSemanticException.MessageKeys.RESOURCE_PART_ONLY_FOR_TYPED_PARTS);
- testUri.runEx("ESAllPrim/$count/invalid")
- .isExSemantic(UriParserSemanticException.MessageKeys.RESOURCE_PART_ONLY_FOR_TYPED_PARTS);
- testUri.runEx("ESAllPrim/PropertyString")
- .isExSemantic(UriParserSemanticException.MessageKeys.PROPERTY_AFTER_COLLECTION);
- testUri.runEx("ESAllPrim(1)/whatever")
- .isExSemantic(UriParserSemanticException.MessageKeys.PROPERTY_NOT_IN_TYPE);
- testUri.runEx("ESAllPrim(PropertyInt16)")
- .isExSemantic(UriParserSemanticException.MessageKeys.INVALID_KEY_VALUE);
- testUri.runEx("ESAllPrim(PropertyInt16=)")
- .isExSyntax(UriParserSyntaxException.MessageKeys.SYNTAX);
- testUri.runEx("ESAllPrim(PropertyInt16=1,Invalid='1')")
- .isExSemantic(UriParserSemanticException.MessageKeys.WRONG_NUMBER_OF_KEY_PROPERTIES);
-
- testUri.runEx("ESBase/olingo.odata.test1.ETBase/PropertyInt16")
- .isExSemantic(UriParserSemanticException.MessageKeys.PROPERTY_AFTER_COLLECTION);
-
- testUri.runEx("ETBaseTwoKeyTwoPrim/olingo.odata.test1.ETBaseTwoKeyTwoPrim"
- + "/olingo.odata.test1.ETTwoBaseTwoKeyTwoPrim")
- .isExSemantic(UriParserSemanticException.MessageKeys.RESOURCE_NOT_FOUND);
-
- testUri.runEx("ETBaseTwoKeyTwoPrim/olingo.odata.test1.ETBaseTwoKeyTwoPrim(1)/olingo.odata.test1.ETAllKey")
- .isExSemantic(UriParserSemanticException.MessageKeys.RESOURCE_NOT_FOUND);
-
- testUri.runEx("ETBaseTwoKeyTwoPrim(1)/olingo.odata.test1.ETBaseTwoKeyTwoPrim('1')/olingo.odata.test1.ETAllKey")
- .isExSemantic(UriParserSemanticException.MessageKeys.RESOURCE_NOT_FOUND);
-
- testUri.runEx("ETBaseTwoKeyTwoPrim(1)/olingo.odata.test1.ETBaseTwoKeyTwoPrim"
- + "/olingo.odata.test1.ETTwoBaseTwoKeyTwoPrim")
- .isExSemantic(UriParserSemanticException.MessageKeys.RESOURCE_NOT_FOUND);
-
- testUri.runEx("ETBaseTwoKeyTwoPrim/olingo.odata.test1.ETBaseTwoKeyTwoPrim"
- + "/olingo.odata.test1.ETTwoBaseTwoKeyTwoPrim(1)")
- .isExSemantic(UriParserSemanticException.MessageKeys.RESOURCE_NOT_FOUND);
-
- testUri.runEx("ETBaseTwoKeyTwoPrim/olingo.odata.test1.ETAllKey")
- .isExSemantic(UriParserSemanticException.MessageKeys.RESOURCE_NOT_FOUND);
-
- testUri.runEx("ETBaseTwoKeyTwoPrim()")
- .isExSemantic(UriParserSemanticException.MessageKeys.RESOURCE_NOT_FOUND);
-
- testUri.runEx("ESAllNullable(1)/CollPropertyString/$value")
- .isExSemantic(UriParserSemanticException.MessageKeys.ONLY_FOR_TYPED_PARTS);
-
- testUri.runEx("ETMixPrimCollComp(1)/ComplexProperty/$value")
- .isExSemantic(UriParserSemanticException.MessageKeys.RESOURCE_NOT_FOUND);
- }
-
- @Test
- public void runEsNameCast() throws Exception {
- testUri.run("ESTwoPrim/olingo.odata.test1.ETBase")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoPrim")
- .isType(EntityTypeProvider.nameETTwoPrim, true)
- .isTypeFilterOnCollection(EntityTypeProvider.nameETBase);
-
- testUri.run("ESTwoPrim/olingo.odata.test1.ETBase(-32768)/olingo.odata.test1.ETTwoBase")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoPrim")
- .isType(EntityTypeProvider.nameETTwoPrim, false)
- .isTypeFilterOnCollection(EntityTypeProvider.nameETBase)
- .isKeyPredicate(0, "PropertyInt16", "-32768")
- .isTypeFilterOnEntry(EntityTypeProvider.nameETTwoBase);
-
- testUri.run("ESTwoPrim/olingo.odata.test1.ETTwoBase(-32768)")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoPrim")
- .isType(EntityTypeProvider.nameETTwoPrim, false)
- .isTypeFilterOnCollection(EntityTypeProvider.nameETTwoBase)
- .isKeyPredicate(0, "PropertyInt16", "-32768");
-
- testUri.run("ESTwoPrim/Namespace1_Alias.ETTwoBase(-32768)")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoPrim")
- .isType(EntityTypeProvider.nameETTwoPrim, false)
- .isTypeFilterOnCollection(EntityTypeProvider.nameETTwoBase)
- .isKeyPredicate(0, "PropertyInt16", "-32768");
-
- }
-
- @Test
- public void runEsNamePpSpCast() throws Exception {
-
- testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/olingo.odata.test1.ETBaseTwoKeyNav/PropertyDate")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoKeyNav")
- .isType(EntityTypeProvider.nameETTwoKeyNav, false)
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isKeyPredicate(1, "PropertyString", "'2'")
- .isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav)
- .n()
- .isPrimitiveProperty("PropertyDate", PropertyProvider.nameDate, false);
-
- testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/olingo.odata.test1.ETBaseTwoKeyNav"
- + "/PropertyComp/PropertyInt16")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoKeyNav")
- .isType(EntityTypeProvider.nameETTwoKeyNav, false)
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isKeyPredicate(1, "PropertyString", "'2'")
- .isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav)
- .n()
- .isComplex("PropertyComp")
- .n()
- .isPrimitiveProperty("PropertyInt16", PropertyProvider.nameInt16, false);
- }
-
- @Test
- public void runEsNameKey() throws Exception {
- testUri.run("ESCollAllPrim(1)")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESCollAllPrim");
-
- testUri.run("ESCollAllPrim(PropertyInt16=1)")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESCollAllPrim");
-
- testUri.run("ESFourKeyAlias(PropertyInt16=1,KeyAlias1=2,KeyAlias2='3',KeyAlias3='4')")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESFourKeyAlias")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isKeyPredicate(1, "KeyAlias1", "2")
- .isKeyPredicate(2, "KeyAlias2", "'3'")
- .isKeyPredicate(3, "KeyAlias3", "'4'");
-
- testUri.runEx("ESTwoPrim(wrong)")
- .isExSemantic(UriParserSemanticException.MessageKeys.INVALID_KEY_VALUE);
- testUri.runEx("ESTwoPrim(PropertyInt16=wrong)")
- .isExSemantic(UriParserSemanticException.MessageKeys.INVALID_KEY_VALUE);
- }
-
- @Test
- public void runEsNameParaKeys() throws Exception {
- testUri.run(encode("ESAllKey(PropertyString='O''Neil',PropertyBoolean=true,PropertyByte=255,"
- + "PropertySByte=-128,PropertyInt16=-32768,PropertyInt32=-2147483648,"
- + "PropertyInt64=-9223372036854775808,PropertyDecimal=1,PropertyDate=2013-09-25,"
- + "PropertyDateTimeOffset=2002-10-10T12:00:00-05:00,"
- + "PropertyDuration=duration'P50903316DT2H25M4S',"
- + "PropertyGuid=12345678-1234-1234-1234-123456789012,"
- + "PropertyTimeOfDay=12:34:55)"))
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESAllKey")
- .isKeyPredicate(0, "PropertyString", "'O''Neil'")
- .isKeyPredicate(1, "PropertyBoolean", "true")
- .isKeyPredicate(2, "PropertyByte", "255")
- .isKeyPredicate(3, "PropertySByte", "-128")
- .isKeyPredicate(4, "PropertyInt16", "-32768")
- .isKeyPredicate(5, "PropertyInt32", "-2147483648")
- .isKeyPredicate(6, "PropertyInt64", "-9223372036854775808")
- .isKeyPredicate(7, "PropertyDecimal", "1")
- .isKeyPredicate(8, "PropertyDate", "2013-09-25")
- .isKeyPredicate(9, "PropertyDateTimeOffset", "2002-10-10T12:00:00-05:00")
- .isKeyPredicate(10, "PropertyDuration", "duration'P50903316DT2H25M4S'")
- .isKeyPredicate(11, "PropertyGuid", "12345678-1234-1234-1234-123456789012")
- .isKeyPredicate(12, "PropertyTimeOfDay", "12:34:55");
- }
-
- @Test
- public void runEsNameKeyCast() throws Exception {
- // testUri.runEx("ESTwoPrim(1)/olingo.odata.test1.ETBase(1)")
- // .isExSemantic(UriParserSemanticException.MessageKeys.xxx);
-
- // testUri.runEx("ESTwoPrim/olingo.odata.test1.ETBase(1)/olingo.odata.test1.ETTwoBase(1)")
- // .isExSemantic(UriParserSemanticException.MessageKeys.xxx);
-
- testUri.runEx("ESBase/olingo.odata.test1.ETTwoPrim(1)")
- .isExSemantic(UriParserSemanticException.MessageKeys.INCOMPATIBLE_TYPE_FILTER);
-
- testUri.run("ESTwoPrim(1)/olingo.odata.test1.ETBase")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoPrim")
- .isType(EntityTypeProvider.nameETTwoPrim)
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isTypeFilterOnEntry(EntityTypeProvider.nameETBase);
-
- testUri.run("ESTwoPrim(1)/olingo.odata.test1.ETTwoBase")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoPrim")
- .isType(EntityTypeProvider.nameETTwoPrim)
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isTypeFilterOnEntry(EntityTypeProvider.nameETTwoBase);
-
- testUri.run("ESTwoPrim/olingo.odata.test1.ETBase(1)")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoPrim")
- .isType(EntityTypeProvider.nameETTwoPrim)
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isTypeFilterOnCollection(EntityTypeProvider.nameETBase);
-
- testUri.run("ESTwoPrim/olingo.odata.test1.ETTwoBase(1)")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoPrim")
- .isType(EntityTypeProvider.nameETTwoPrim)
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isTypeFilterOnCollection(EntityTypeProvider.nameETTwoBase);
-
- testUri.run("ESTwoPrim/olingo.odata.test1.ETBase(1)/olingo.odata.test1.ETTwoBase")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoPrim")
- .isType(EntityTypeProvider.nameETTwoPrim)
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isTypeFilterOnCollection(EntityTypeProvider.nameETBase);
-
- testUri.run("ESTwoPrim/olingo.odata.test1.ETTwoBase")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoPrim")
- .isType(EntityTypeProvider.nameETTwoPrim)
- .isTypeFilterOnCollection(EntityTypeProvider.nameETTwoBase);
- }
-
- @Test
- public void runEsNameParaKeysCast() throws Exception {
- testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/olingo.odata.test1.ETBaseTwoKeyNav")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoKeyNav")
- .isType(EntityTypeProvider.nameETTwoKeyNav)
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isKeyPredicate(1, "PropertyString", "'2'")
- .isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav);
-
- testUri.run("ESTwoKeyNav/olingo.odata.test1.ETBaseTwoKeyNav(PropertyInt16=1,PropertyString='2')")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoKeyNav")
- .isType(EntityTypeProvider.nameETTwoKeyNav)
- .isTypeFilterOnCollection(EntityTypeProvider.nameETBaseTwoKeyNav)
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isKeyPredicate(1, "PropertyString", "'2'");
- }
-
- @Test
- public void run_EsNamePpCp() throws Exception {
- testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/PropertyComp")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoKeyNav")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isKeyPredicate(1, "PropertyString", "'2'")
- .n()
- .isComplex("PropertyComp");
-
- testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/PropertyComp/PropertyComp")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoKeyNav")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isKeyPredicate(1, "PropertyString", "'2'")
- .n()
- .isComplex("PropertyComp")
- .n()
- .isComplex("PropertyComp");
- }
-
- @Test
- public void runEsNamePpCpColl() throws Exception {
- testUri.run("ESMixPrimCollComp(5)/CollPropertyComp")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESMixPrimCollComp")
- .isKeyPredicate(0, "PropertyInt16", "5")
- .n()
- .isComplex("CollPropertyComp")
- .isType(ComplexTypeProvider.nameCTTwoPrim, true);
-
- testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavOne/CollPropertyComp")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .n()
- .isNavProperty("NavPropertyETTwoKeyNavOne", EntityTypeProvider.nameETTwoKeyNav, false)
- .n()
- .isComplex("CollPropertyComp")
- .isType(ComplexTypeProvider.nameCTPrimComp, true);
-
- testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavOne/CollPropertyComp/$count")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .n()
- .isNavProperty("NavPropertyETTwoKeyNavOne", EntityTypeProvider.nameETTwoKeyNav, false)
- .n()
- .isComplex("CollPropertyComp")
- .isType(ComplexTypeProvider.nameCTPrimComp, true)
- .n()
- .isCount();
- }
-
- @Test
- public void runEsNamePpCpCast() throws Exception {
- testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/olingo.odata.test1.ETBaseTwoKeyNav/PropertyComp")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoKeyNav")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isKeyPredicate(1, "PropertyString", "'2'")
- .isType(EntityTypeProvider.nameETTwoKeyNav)
- .isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav)
- .n()
- .isComplex("PropertyComp");
-
- testUri
- .run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/olingo.odata.test1.ETBaseTwoKeyNav"
- + "/PropertyComp/PropertyComp")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoKeyNav")
- .isType(EntityTypeProvider.nameETTwoKeyNav)
- .isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav)
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isKeyPredicate(1, "PropertyString", "'2'")
- .n()
- .isComplex("PropertyComp")
- .n()
- .isComplex("PropertyComp");
-
- testUri
- .run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/olingo.odata.test1.ETBaseTwoKeyNav"
- + "/PropertyCompTwoPrim/olingo.odata.test1.CTBase")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoKeyNav")
- .isType(EntityTypeProvider.nameETTwoKeyNav)
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isKeyPredicate(1, "PropertyString", "'2'")
-
- .isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav)
- .n()
- .isComplex("PropertyCompTwoPrim")
- .isType(ComplexTypeProvider.nameCTTwoPrim)
- .isTypeFilter(ComplexTypeProvider.nameCTBase);
-
- testUri
- .run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/olingo.odata.test1.ETBaseTwoKeyNav"
- + "/PropertyCompTwoPrim/olingo.odata.test1.CTTwoBase")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoKeyNav")
- .isType(EntityTypeProvider.nameETTwoKeyNav)
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isKeyPredicate(1, "PropertyString", "'2'")
- .isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav)
- .n()
- .isComplex("PropertyCompTwoPrim")
- .isType(ComplexTypeProvider.nameCTTwoPrim)
- .isTypeFilter(ComplexTypeProvider.nameCTTwoBase);
- }
-
- @Test
- public void runNsNamePpNp() throws Exception {
- testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .n()
- .isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, true);
-
- testUri.run("ESKeyNav(1)/NavPropertyETKeyNavMany(2)")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .n()
- .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, false)
- .isKeyPredicate(0, "PropertyInt16", "2");
-
- testUri.run("ESKeyNav(PropertyInt16=1)/NavPropertyETKeyNavMany(PropertyInt16=2)")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .n()
- .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, false)
- .isKeyPredicate(0, "PropertyInt16", "2");
-
- testUri.run("ESKeyNav(1)/NavPropertyETKeyNavMany(2)/PropertyInt16")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .n()
- .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, false)
- .isKeyPredicate(0, "PropertyInt16", "2")
- .n()
- .isPrimitiveProperty("PropertyInt16", PropertyProvider.nameInt16, false);
-
- testUri.run("ESKeyNav(1)/NavPropertyETKeyNavMany(2)/PropertyComp")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .n()
- .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, false)
- .isKeyPredicate(0, "PropertyInt16", "2")
- .n()
- .isComplex("PropertyComp");
-
- testUri.run("ESKeyNav(1)/NavPropertyETKeyNavMany(2)/NavPropertyETKeyNavOne")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .n()
- .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, false)
- .isKeyPredicate(0, "PropertyInt16", "2")
- .n()
- .isNavProperty("NavPropertyETKeyNavOne", EntityTypeProvider.nameETKeyNav, false);
-
- testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=2,PropertyString='3')"
- + "/NavPropertyETKeyNavMany(4)")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .n()
- .isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, false)
- .isKeyPredicate(0, "PropertyInt16", "2")
- .isKeyPredicate(1, "PropertyString", "'3'")
- .n()
- .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, false)
- .isKeyPredicate(0, "PropertyInt16", "4");
-
- testUri.run("ESKeyNav(1)/PropertyComp/NavPropertyETTwoKeyNavOne")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .n()
- .isComplex("PropertyComp")
- .n()
- .isNavProperty("NavPropertyETTwoKeyNavOne", EntityTypeProvider.nameETTwoKeyNav, false);
-
- testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=2,PropertyString='(3)')"
- + "/PropertyComp/PropertyComp/PropertyInt16")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .n()
- .isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, false)
- .isKeyPredicate(0, "PropertyInt16", "2")
- .isKeyPredicate(1, "PropertyString", "'(3)'")
- .n()
- .isComplex("PropertyComp")
- .n()
- .isComplex("PropertyComp")
- .n()
- .isPrimitiveProperty("PropertyInt16", PropertyProvider.nameInt16, false);
-
- testUri.run("ESKeyNav(1)/NavPropertyETMediaMany(2)/$value")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .n()
- .isNavProperty("NavPropertyETMediaMany", EntityTypeProvider.nameETMedia, false)
- .isKeyPredicate(0, "PropertyInt16", "2")
- .n()
- .isValue();
-
- testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=2,PropertyString='3')"
- + "/NavPropertyETKeyNavOne/NavPropertyETMediaOne/$value")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .n()
- .isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, false)
- .isKeyPredicate(0, "PropertyInt16", "2")
- .isKeyPredicate(1, "PropertyString", "'3'")
- .n()
- .isNavProperty("NavPropertyETKeyNavOne", EntityTypeProvider.nameETKeyNav, false)
- .n()
- .isNavProperty("NavPropertyETMediaOne", EntityTypeProvider.nameETMedia, false)
- .n()
- .isValue();
-
- testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=2,PropertyString='3')"
- + "/NavPropertyETKeyNavOne/$ref")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .n()
- .isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, false)
- .isKeyPredicate(0, "PropertyInt16", "2")
- .isKeyPredicate(1, "PropertyString", "'3'")
- .n()
- .isNavProperty("NavPropertyETKeyNavOne", EntityTypeProvider.nameETKeyNav, false)
- .n()
- .isRef();
- }
-
- @Test
- public void runEsNamePpNpCast() throws Exception {
- testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/olingo.odata.test1.ETBaseTwoKeyNav"
- + "/NavPropertyETKeyNavMany")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoKeyNav")
- .isType(EntityTypeProvider.nameETTwoKeyNav)
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isKeyPredicate(1, "PropertyString", "'2'")
- .isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav)
- .n()
- .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, true);
-
- testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/olingo.odata.test1.ETBaseTwoKeyNav"
- + "/NavPropertyETKeyNavMany(3)")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoKeyNav")
- .isType(EntityTypeProvider.nameETTwoKeyNav)
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isKeyPredicate(1, "PropertyString", "'2'")
- .isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav)
- .n()
- .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, false)
- .isKeyPredicate(0, "PropertyInt16", "3");
-
- testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/olingo.odata.test1.ETBaseTwoKeyNav"
- + "/NavPropertyETTwoKeyNavMany/olingo.odata.test1.ETTwoBaseTwoKeyNav(PropertyInt16=3,PropertyString='4')")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESTwoKeyNav")
- .isType(EntityTypeProvider.nameETTwoKeyNav)
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isKeyPredicate(1, "PropertyString", "'2'")
- .isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav)
- .n()
- .isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, false)
- .isKeyPredicate(0, "PropertyInt16", "3")
- .isKeyPredicate(1, "PropertyString", "'4'")
- .isTypeFilterOnCollection(EntityTypeProvider.nameETTwoBaseTwoKeyNav);
-
- testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=2,PropertyString='3')"
- + "/NavPropertyETTwoKeyNavMany/olingo.odata.test1.ETBaseTwoKeyNav(PropertyInt16=4,PropertyString='5')"
- + "/olingo.odata.test1.ETTwoBaseTwoKeyNav/NavPropertyETBaseTwoKeyNavMany")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .n()
- .isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, false)
- .isKeyPredicate(0, "PropertyInt16", "2")
- .isKeyPredicate(1, "PropertyString", "'3'")
- .n()
- .isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, false)
- .isType(EntityTypeProvider.nameETTwoKeyNav)
- .isTypeFilterOnCollection(EntityTypeProvider.nameETBaseTwoKeyNav)
- .isKeyPredicate(0, "PropertyInt16", "4")
- .isKeyPredicate(1, "PropertyString", "'5'")
- .isTypeFilterOnEntry(EntityTypeProvider.nameETTwoBaseTwoKeyNav)
- .n()
- .isNavProperty("NavPropertyETBaseTwoKeyNavMany", EntityTypeProvider.nameETBaseTwoKeyNav, true);
-
- testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=2,PropertyString='3')/"
- + "NavPropertyETTwoKeyNavMany/olingo.odata.test1.ETBaseTwoKeyNav(PropertyInt16=4,PropertyString='5')/"
- + "NavPropertyETKeyNavMany")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .n()
- .isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, false)
- .isKeyPredicate(0, "PropertyInt16", "2")
- .isKeyPredicate(1, "PropertyString", "'3'")
- .n()
- .isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, false)
- .isTypeFilterOnCollection(EntityTypeProvider.nameETBaseTwoKeyNav)
- .isKeyPredicate(0, "PropertyInt16", "4")
- .isKeyPredicate(1, "PropertyString", "'5'")
- .n()
- .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, true);
- }
-
- @Test
- public void runEsNamePpNpRc() throws Exception {
- // checks for using referential constrains to fill missing keys
- testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany('2')").goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .n()
- .isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, false)
- .isKeyPredicateRef(0, "PropertyInt16", "PropertyInt16")
- .isKeyPredicate(1, "PropertyString", "'2'");
-
- testUri.run("ESKeyNav(PropertyInt16=1)/NavPropertyETTwoKeyNavMany(PropertyString='2')").goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .n()
- .isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, false)
- .isKeyPredicateRef(0, "PropertyInt16", "PropertyInt16")
- .isKeyPredicate(1, "PropertyString", "'2'");
-
- }
-
- @Test
- public void runEsNamePpSp() throws Exception {
- testUri.run("ESAllPrim(1)/PropertyByte")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESAllPrim")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .n()
- .isPrimitiveProperty("PropertyByte", PropertyProvider.nameByte, false);
-
- testUri.run("ESAllPrim(1)/PropertyByte/$value")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESAllPrim")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .n()
- .isPrimitiveProperty("PropertyByte", PropertyProvider.nameByte, false)
- .n()
- .isValue();
-
- testUri.run("ESMixPrimCollComp(1)/PropertyComp/PropertyString")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESMixPrimCollComp")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .n()
- .isComplex("PropertyComp")
- .n()
- .isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false);
- }
-
- @Test
- public void runEsNamePpSpColl() throws Exception {
- testUri.run("ESCollAllPrim(1)/CollPropertyString")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESCollAllPrim")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .n()
- .isPrimitiveProperty("CollPropertyString", PropertyProvider.nameString, true);
-
- testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=2,PropertyString='3')/CollPropertyString")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .n()
- .isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, false)
- .n()
- .isPrimitiveProperty("CollPropertyString", PropertyProvider.nameString, true);
-
- testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=2,PropertyString='3')/CollPropertyString/$count")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .n()
- .isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, false)
- .isKeyPredicate(0, "PropertyInt16", "2")
- .isKeyPredicate(1, "PropertyString", "'3'")
- .n()
- .isPrimitiveProperty("CollPropertyString", PropertyProvider.nameString, true)
- .n()
- .isCount();
-
- }
-
- @Test
- public void runEsNameRef() throws Exception {
- testUri.run("ESAllPrim/$ref")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESAllPrim")
- .n()
- .isRef();
-
- testUri.run("ESAllPrim(-32768)/$ref")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESAllPrim")
- .isKeyPredicate(0, "PropertyInt16", "-32768")
- .n()
- .isRef();
- testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany/$ref")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .n()
- .isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, true)
- .n()
- .isRef();
- testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=1,PropertyString='2')/$ref")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isEntitySet("ESKeyNav")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .n()
- .isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, false)
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isKeyPredicate(1, "PropertyString", "'2'")
- .n()
- .isRef();
- }
-
- @Test
- public void runFunctionImpBf() throws Exception {
-
- testUri.run("FICRTString()/olingo.odata.test1.BFCStringRTESTwoKeyNav()");
- }
-
- @Test
- public void runFunctionImpCastBf() throws Exception {
-
- testUri.run("FICRTETTwoKeyNavParam(ParameterInt16=1)/olingo.odata.test1.ETBaseTwoKeyNav"
- + "/olingo.odata.test1.BFCETBaseTwoKeyNavRTETTwoKeyNav()")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isFunctionImport("FICRTETTwoKeyNavParam")
- .isFunction("UFCRTETTwoKeyNavParam")
- .isParameter(0, "ParameterInt16", "1")
- .isType(EntityTypeProvider.nameETTwoKeyNav)
- .isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav)
- .n()
- .isFunction("BFCETBaseTwoKeyNavRTETTwoKeyNav");
-
- testUri.run("FICRTESTwoKeyNavParam(ParameterInt16=1)"
- + "/olingo.odata.test1.ETBaseTwoKeyNav(PropertyInt16=2,PropertyString='3')"
- + "/olingo.odata.test1.BFCETBaseTwoKeyNavRTETTwoKeyNav()")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isFunctionImport("FICRTESTwoKeyNavParam")
- .isFunction("UFCRTESTwoKeyNavParam")
- .isParameter(0, "ParameterInt16", "1")
- .isType(EntityTypeProvider.nameETTwoKeyNav)
- .isTypeFilterOnCollection(EntityTypeProvider.nameETBaseTwoKeyNav)
- .isKeyPredicate(0, "PropertyInt16", "2")
- .isKeyPredicate(1, "PropertyString", "'3'")
- .n()
- .isFunction("BFCETBaseTwoKeyNavRTETTwoKeyNav");
- }
-
- @Test
- public void runFunctionImpEntity() throws Exception {
-
- testUri.run("FICRTETKeyNav()")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isFunctionImport("FICRTETKeyNav")
- .isFunction("UFCRTETKeyNav")
- .isType(EntityTypeProvider.nameETKeyNav);
-
- testUri.run("FICRTETTwoKeyNavParam(ParameterInt16=1)(PropertyInt16=2,PropertyString='3')")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isFunctionImport("FICRTETTwoKeyNavParam")
- .isParameter(0, "ParameterInt16", "1")
- .isKeyPredicate(0, "PropertyInt16", "2")
- .isKeyPredicate(1, "PropertyString", "'3'");
-
- testUri.run("FICRTETMedia()/$value")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isFunctionImport("FICRTETMedia")
- .isFunction("UFCRTETMedia")
- .n()
- .isValue();
-
- testUri.run("FICRTETKeyNav()/$ref")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isFunctionImport("FICRTETKeyNav")
- .isFunction("UFCRTETKeyNav")
- .n()
- .isRef();
- testUri.run("FICRTESTwoKeyNavParam(ParameterInt16=1)/$ref")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isFunctionImport("FICRTESTwoKeyNavParam")
- .isFunction("UFCRTESTwoKeyNavParam")
- .n()
- .isRef();
-
- testUri.run("FICRTETTwoKeyNavParam(ParameterInt16=1)/olingo.odata.test1.ETBaseTwoKeyNav")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isFunctionImport("FICRTETTwoKeyNavParam")
- .isFunction("UFCRTETTwoKeyNavParam")
- .isParameter(0, "ParameterInt16", "1")
- .isType(EntityTypeProvider.nameETTwoKeyNav)
- .isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav);
-
- testUri.run("FICRTETTwoKeyNavParam(ParameterInt16=1)(PropertyInt16=2,PropertyString='3')"
- + "/olingo.odata.test1.ETBaseTwoKeyNav")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isFunctionImport("FICRTETTwoKeyNavParam")
- .isFunction("UFCRTETTwoKeyNavParam")
- .isParameter(0, "ParameterInt16", "1")
- .isKeyPredicate(0, "PropertyInt16", "2")
- .isKeyPredicate(1, "PropertyString", "'3'")
- .isType(EntityTypeProvider.nameETTwoKeyNav)
- .isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav);
-
- testUri.run("FICRTESTwoKeyNavParam(ParameterInt16=1)"
- + "/olingo.odata.test1.ETBaseTwoKeyNav(PropertyInt16=2,PropertyString='3')")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isFunctionImport("FICRTESTwoKeyNavParam")
- .isFunction("UFCRTESTwoKeyNavParam")
- .isParameter(0, "ParameterInt16", "1")
- .isType(EntityTypeProvider.nameETTwoKeyNav)
- .isTypeFilterOnCollection(EntityTypeProvider.nameETBaseTwoKeyNav)
- .isKeyPredicate(0, "PropertyInt16", "2")
- .isKeyPredicate(1, "PropertyString", "'3'");
- }
-
- @Test
- public void runFunctionImpEs() throws Exception {
- /**/
- testUri.run("FICRTESMixPrimCollCompTwoParam(ParameterInt16=1,ParameterString='2')")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isFunctionImport("FICRTESMixPrimCollCompTwoParam")
- .isFunction("UFCRTESMixPrimCollCompTwoParam")
- .isParameter(0, "ParameterInt16", "1")
- .isParameter(1, "ParameterString", "'2'")
- .isType(EntityTypeProvider.nameETMixPrimCollComp);
-
- testUri.run("FINRTESMixPrimCollCompTwoParam(ParameterInt16=1,ParameterString='2')")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isFunctionImport("FINRTESMixPrimCollCompTwoParam")
- .isFunction("UFNRTESMixPrimCollCompTwoParam")
- .isParameter(0, "ParameterInt16", "1")
- .isParameter(1, "ParameterString", "'2'")
- .isType(EntityTypeProvider.nameETMixPrimCollComp);
-
- testUri.run("FICRTESMixPrimCollCompTwoParam(ParameterInt16=1,ParameterString='2')/$count")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isFunctionImport("FICRTESMixPrimCollCompTwoParam")
- .isFunction("UFCRTESMixPrimCollCompTwoParam")
- .isParameter(0, "ParameterInt16", "1")
- .isParameter(1, "ParameterString", "'2'")
- .isType(EntityTypeProvider.nameETMixPrimCollComp)
- .n()
- .isCount();
- }
-
- @Test
- public void runFunctionImpError() {
- testUri.runEx("FICRTCollCTTwoPrimParam()")
- .isExSemantic(UriParserSemanticException.MessageKeys.FUNCTION_NOT_FOUND);
- testUri.runEx("FICRTCollCTTwoPrimParam(invalidParam=2)")
- .isExSemantic(UriParserSemanticException.MessageKeys.FUNCTION_NOT_FOUND);
- }
-
- @Test
- public void runFunctionImpEsAlias() throws Exception {
-
- testUri.run("FICRTESTwoKeyNavParam(ParameterInt16=@parameterAlias)", "@parameterAlias=1");
- testUri.run("FICRTESTwoKeyNavParam(ParameterInt16=@parameterAlias)/$count", "@parameterAlias=1");
- testUri.run("FICRTESTwoKeyNavParam(ParameterInt16=@invalidAlias)", "@validAlias=1");
- }
-
- @Test
- public void runFunctionImpEsCast() throws Exception {
-
- testUri.run("FICRTESTwoKeyNavParam(ParameterInt16=1)/olingo.odata.test1.ETBaseTwoKeyNav")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isFunctionImport("FICRTESTwoKeyNavParam")
- .isFunction("UFCRTESTwoKeyNavParam")
- .isParameter(0, "ParameterInt16", "1")
- .isType(EntityTypeProvider.nameETTwoKeyNav)
- .isTypeFilterOnCollection(EntityTypeProvider.nameETBaseTwoKeyNav);
-
- testUri.run("FICRTESTwoKeyNavParam(ParameterInt16=1)/olingo.odata.test1.ETBaseTwoKeyNav/$count")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isFunctionImport("FICRTESTwoKeyNavParam")
- .isFunction("UFCRTESTwoKeyNavParam")
- .isParameter(0, "ParameterInt16", "1")
- .isType(EntityTypeProvider.nameETTwoKeyNav)
- .isTypeFilterOnCollection(EntityTypeProvider.nameETBaseTwoKeyNav)
- .n()
- .isCount();
-
- testUri.run("FICRTESTwoKeyNavParam(ParameterInt16=1)"
- + "/olingo.odata.test1.ETBaseTwoKeyNav(PropertyInt16=2,PropertyString='3')")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isFunctionImport("FICRTESTwoKeyNavParam")
- .isFunction("UFCRTESTwoKeyNavParam")
- .isParameter(0, "ParameterInt16", "1")
- .isType(EntityTypeProvider.nameETTwoKeyNav)
- .isTypeFilterOnCollection(EntityTypeProvider.nameETBaseTwoKeyNav)
- .isKeyPredicate(0, "PropertyInt16", "2")
- .isKeyPredicate(1, "PropertyString", "'3'");
-
- testUri.run("FICRTESTwoKeyNavParam(ParameterInt16=1)"
- + "/olingo.odata.test1.ETBaseTwoKeyNav(PropertyInt16=2,PropertyString='3')"
- + "/olingo.odata.test1.ETTwoBaseTwoKeyNav")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isFunctionImport("FICRTESTwoKeyNavParam")
- .isFunction("UFCRTESTwoKeyNavParam")
- .isParameter(0, "ParameterInt16", "1")
- .isType(EntityTypeProvider.nameETTwoKeyNav)
- .isTypeFilterOnCollection(EntityTypeProvider.nameETBaseTwoKeyNav)
- .isKeyPredicate(0, "PropertyInt16", "2")
- .isKeyPredicate(1, "PropertyString", "'3'")
- .isTypeFilterOnEntry(EntityTypeProvider.nameETTwoBaseTwoKeyNav);
-
- }
-
- @Test
- public void runSingletonEntityValue() throws Exception {
- testUri.run("SIMedia/$value")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isSingleton("SIMedia")
- .n().isValue();
- }
-
- @Test
- public void runSingletonPpNpCast() throws Exception {
- testUri.run("SINav/olingo.odata.test1.ETBaseTwoKeyNav/NavPropertyETKeyNavMany")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isSingleton("SINav")
- .isType(EntityTypeProvider.nameETTwoKeyNav)
- .isTypeFilter(EntityTypeProvider.nameETBaseTwoKeyNav)
- .n()
- .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, true);
-
- testUri.run("SINav/olingo.odata.test1.ETBaseTwoKeyNav/NavPropertyETKeyNavMany(1)")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isSingleton("SINav")
- .isType(EntityTypeProvider.nameETTwoKeyNav)
- .isTypeFilter(EntityTypeProvider.nameETBaseTwoKeyNav)
- .n()
- .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, false)
- .isKeyPredicate(0, "PropertyInt16", "1");
-
- }
-
- @Test
- public void runSingletonPpCpCast() throws Exception {
- testUri.run("SINav/olingo.odata.test1.ETBaseTwoKeyNav/PropertyComp")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isSingleton("SINav")
- .isType(EntityTypeProvider.nameETTwoKeyNav)
- .isTypeFilter(EntityTypeProvider.nameETBaseTwoKeyNav)
- .n()
- .isComplex("PropertyComp");
-
- testUri.run("SINav/olingo.odata.test1.ETBaseTwoKeyNav/PropertyComp/PropertyComp")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isSingleton("SINav")
- .isType(EntityTypeProvider.nameETTwoKeyNav)
- .isTypeFilter(EntityTypeProvider.nameETBaseTwoKeyNav)
- .n()
- .isComplex("PropertyComp")
- .n()
- .isComplex("PropertyComp");
-
- testUri.run("SINav/olingo.odata.test1.ETBaseTwoKeyNav/PropertyCompTwoPrim/olingo.odata.test1.CTBase")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isSingleton("SINav")
- .isType(EntityTypeProvider.nameETTwoKeyNav)
- .isTypeFilter(EntityTypeProvider.nameETBaseTwoKeyNav)
- .n()
- .isComplex("PropertyCompTwoPrim")
- .isType(ComplexTypeProvider.nameCTTwoPrim)
- .isTypeFilter(ComplexTypeProvider.nameCTBase);
-
- }
-
- @Test
- public void runSingletonPpSpCast() throws Exception {
- testUri.run("SINav/olingo.odata.test1.ETBaseTwoKeyNav/PropertyInt16")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isSingleton("SINav")
- .isType(EntityTypeProvider.nameETTwoKeyNav)
- .isTypeFilter(EntityTypeProvider.nameETBaseTwoKeyNav)
- .n()
- .isPrimitiveProperty("PropertyInt16", PropertyProvider.nameInt16, false);
-
- testUri.run("SINav/olingo.odata.test1.ETBaseTwoKeyNav/CollPropertyString")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isSingleton("SINav")
- .isType(EntityTypeProvider.nameETTwoKeyNav)
- .isTypeFilter(EntityTypeProvider.nameETBaseTwoKeyNav)
- .n()
- .isPrimitiveProperty("CollPropertyString", PropertyProvider.nameString, true)
- .isType(PropertyProvider.nameString, true);
-
- }
-
- @Test
- public void runSingletonEntityPpNp() throws Exception {
- testUri.run("SINav/NavPropertyETKeyNavMany")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isSingleton("SINav")
- .n()
- .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, true);
-
- testUri.run("SINav/NavPropertyETTwoKeyNavMany(PropertyInt16=1,PropertyString='2')")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isSingleton("SINav")
- .n()
- .isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, false)
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isKeyPredicate(1, "PropertyString", "'2'");
-
- }
-
- @Test
- public void runSingletonEntityPpCp() throws Exception {
- testUri.run("SINav/PropertyComp")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isSingleton("SINav")
- .n()
- .isComplex("PropertyComp");
-
- testUri.run("SINav/PropertyComp/PropertyComp")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isSingleton("SINav")
- .n()
- .isComplex("PropertyComp")
- .n()
- .isComplex("PropertyComp");
-
- }
-
- @Test
- public void runSingletonEntityPpCpColl() throws Exception {
- testUri.run("SINav/CollPropertyComp")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isSingleton("SINav")
- .n()
- .isComplex("CollPropertyComp")
- .isType(ComplexTypeProvider.nameCTPrimComp, true);
-
- testUri.run("SINav/CollPropertyComp/$count")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isSingleton("SINav")
- .n()
- .isComplex("CollPropertyComp")
- .isType(ComplexTypeProvider.nameCTPrimComp, true)
- .n()
- .isCount();
- }
-
- @Test
- public void runSingletonEntityPpSp() throws Exception {
- testUri.run("SINav/PropertyString")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isSingleton("SINav")
- .n()
- .isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false);
- }
-
- @Test
- public void runSingletonEntityPpSpColl() throws Exception {
- testUri.run("SINav/CollPropertyString")
-
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isSingleton("SINav")
- .n()
- .isPrimitiveProperty("CollPropertyString", PropertyProvider.nameString, true);
- testUri.run("SINav/CollPropertyString/$count")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isSingleton("SINav")
- .n()
- .isPrimitiveProperty("CollPropertyString", PropertyProvider.nameString, true)
- .n()
- .isCount();
- }
-
- @Test
- public void runExpand() throws Exception {
-
- testUri.run("ESKeyNav(1)", "$expand=*")
- .isKind(UriInfoKind.resource).goPath().goExpand()
- .first()
- .isSegmentStar();
-
- testUri.run("ESKeyNav(1)", "$expand=*/$ref")
- .isKind(UriInfoKind.resource).goPath().goExpand()
- .first()
- .isSegmentStar()
- .isSegmentRef();
-
- testUri.run("ESKeyNav(1)", "$expand=*/$ref,NavPropertyETKeyNavMany")
- .isKind(UriInfoKind.resource).goPath().goExpand()
- .first()
- .isSegmentStar().isSegmentRef()
- .next()
- .goPath().first()
- .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, true);
-
- testUri.run("ESKeyNav(1)", "$expand=*($levels=3)")
- .isKind(UriInfoKind.resource).goPath().goExpand()
- .first()
- .isSegmentStar()
- .isLevelText("3");
-
- testUri.run("ESKeyNav(1)", "$expand=*($levels=max)")
- .isKind(UriInfoKind.resource).goPath().goExpand()
- .first()
- .isSegmentStar()
- .isLevelText("max");
-
- testUri.run("ESKeyNav(1)", "$expand=NavPropertyETKeyNavMany/$ref")
- .isKind(UriInfoKind.resource).goPath().goExpand()
- .first()
- .goPath().first()
- .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, true)
- .isType(EntityTypeProvider.nameETKeyNav, true)
- .n().isRef();
-
- testUri.run("ESKeyNav(1)", "$expand=NavPropertyETKeyNavOne/$ref")
- .isKind(UriInfoKind.resource).goPath().goExpand()
- .first()
- .goPath().first()
- .isNavProperty("NavPropertyETKeyNavOne", EntityTypeProvider.nameETKeyNav, false)
- .isType(EntityTypeProvider.nameETKeyNav, false)
- .n().isRef();
-
- testUri.run("ESKeyNav(1)", "$expand=NavPropertyETKeyNavMany/$ref($filter=PropertyInt16 eq 1)")
- .isKind(UriInfoKind.resource).goPath().goExpand()
- .first()
- .goPath().first()
- .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, true)
- .isType(EntityTypeProvider.nameETKeyNav, true)
- .n().isRef()
- .goUpExpandValidator().isFilterSerialized("<<PropertyInt16> eq <1>>");
-
- testUri.run("ESKeyNav(1)", "$expand=NavPropertyETKeyNavMany/$ref($orderby=PropertyInt16)")
- .isKind(UriInfoKind.resource).goPath().goExpand()
- .first()
- .goPath().first()
- .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, true)
- .isType(EntityTypeProvider.nameETKeyNav, true)
- .n().isRef()
- .goUpExpandValidator()
- .isSortOrder(0, false)
- .goOrder(0).goPath().isPrimitiveProperty("PropertyInt16", PropertyProvider.nameInt16, false);
-
- testUri.run("ESKeyNav(1)", "$expand=NavPropertyETKeyNavMany/$ref($skip=1)")
- .isKind(UriInfoKind.resource).goPath().goExpand()
- .first()
- .goPath().first()
- .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, true)
- .isType(EntityTypeProvider.nameETKeyNav, true)
- .n().isRef()
- .goUpExpandValidator()
- .isSkipText("1");
-
- testUri.run("ESKeyNav(1)", "$expand=NavPropertyETKeyNavMany/$ref($top=2)")
- .isKind(UriInfoKind.resource).goPath().goExpand()
- .first()
- .goPath().first()
- .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, true)
- .isType(EntityTypeProvider.nameETKeyNav, true)
- .n().isRef()
- .goUpExpandValidator()
- .isTopText("2");
-
- testUri.run("ESKeyNav(1)", "$expand=NavPropertyETKeyNavMany/$ref($count=true)")
- .isKind(UriInfoKind.resource).goPath().goExpand()
- .first()
- .goPath().first()
- .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, true)
- .isType(EntityTypeProvider.nameETKeyNav, true)
- .n().isRef()
- .goUpExpandValidator()
- .isInlineCountText("true");
-
- testUri.run("ESKeyNav(1)", "$expand=NavPropertyETKeyNavMany/$ref($skip=1;$top=3)")
- .isKind(UriInfoKind.resource).goPath().goExpand()
- .first()
- .goPath().first()
- .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, true)
- .isType(EntityTypeProvider.nameETKeyNav, true)
- .n().isRef()
- .goUpExpandValidator()
- .isSkipText("1")
- .isTopText("3");
-
- testUri.run("ESKeyNav(1)", "$expand=NavPropertyETKeyNavMany/$ref($skip=1%3b$top=3)")
- .isKind(UriInfoKind.resource).goPath().goExpand()
- .first()
- .goPath().first()
- .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, true)
- .isType(EntityTypeProvider.nameETKeyNav, true)
- .n().isRef()
- .goUpExpandValidator()
- .isSkipText("1")
- .isTopText("3");
-
- testUri.run("ESKeyNav(1)", "$expand=NavPropertyETKeyNavMany/$count")
- .isKind(UriInfoKind.resource).goPath().goExpand()
- .first()
- .goPath().first()
- .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, true)
- .isType(EntityTypeProvider.nameETKeyNav, true)
- .n().isCount();
-
- testUri.run("ESKeyNav(1)", "$expand=NavPropertyETKeyNavOne/$count")
- .isKind(UriInfoKind.resource).goPath().goExpand()
- .first()
- .goPath().first()
- .isNavProperty("NavPropertyETKeyNavOne", EntityTypeProvider.nameETKeyNav, false)
- .isType(EntityTypeProvider.nameETKeyNav, false)
- .n().isCount();
-
- testUri.run("ESKeyNav(1)", "$expand=NavPropertyETKeyNavMany/$count($filter=PropertyInt16 gt 1)")
- .isKind(UriInfoKind.resource).goPath().goExpand()
- .first()
- .goPath().first()
- .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, true)
- .isType(EntityTypeProvider.nameETKeyNav, true)
- .n().isCount()
- .goUpExpandValidator()
- .isFilterSerialized("<<PropertyInt16> gt <1>>");
-
- testUri.run("ESKeyNav(1)", "$expand=NavPropertyETKeyNavMany($filter=PropertyInt16 eq 1)")
- .isKind(UriInfoKind.resource).goPath().goExpand()
- .first()
- .goPath().first()
- .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, true)
- .isType(EntityTypeProvider.nameETKeyNav, true)
- .goUpExpandValidator()
- .isFilterSerialized("<<PropertyInt16> eq <1>>");
-
- testUri.run("ESKeyNav(1)", "$expand=NavPropertyETKeyNavMany($orderby=PropertyInt16)")
- .isKind(UriInfoKind.resource).goPath().goExpand()
- .first()
- .goPath().first()
- .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, true)
- .isType(EntityTypeProvider.nameETKeyNav, true)
- .goUpExpandValidator()
- .isSortOrder(0, false)
- .goOrder(0).goPath().isPrimitiveProperty("PropertyInt16", PropertyProvider.nameInt16, false);
-
- testUri.run("ESKeyNav(1)", "$expand=NavPropertyETKeyNavMany($skip=1)")
- .isKind(UriInfoKind.resource).goPath().goExpand()
- .first()
- .goPath().first()
- .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, true)
- .isType(EntityTypeProvider.nameETKeyNav, true)
- .goUpExpandValidator()
- .isSkipText("1");
-
- testUri.run("ESKeyNav(1)", "$expand=NavPropertyETKeyNavMany($top=2)")
- .isKind(UriInfoKind.resource).goPath().goExpand()
- .first()
- .goPath().first()
- .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, true)
- .isType(EntityTypeProvider.nameETKeyNav, true)
- .goUpExpandValidator()
- .isTopText("2");
-
- testUri.run("ESKeyNav(1)", "$expand=NavPropertyETKeyNavMany($count=true)")
- .isKind(UriInfoKind.resource).goPath().goExpand()
- .first()
- .goPath().first()
- .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, true)
- .isType(EntityTypeProvider.nameETKeyNav, true)
- .goUpExpandValidator()
- .isInlineCountText("true");
-
- testUri.run("ESKeyNav(1)", "$expand=NavPropertyETKeyNavMany($select=PropertyString)")
- .isKind(UriInfoKind.resource).goPath().goExpand()
- .first()
- .goPath().first()
- .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, true)
- .isType(EntityTypeProvider.nameETKeyNav, true)
- .goUpExpandValidator()
- .isSelectText("PropertyString")
- .goSelectItem(0).isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false);
-
- testUri.run("ESKeyNav(1)", "$expand=NavPropertyETKeyNavMany($expand=NavPropertyETTwoKeyNavOne)")
- .isKind(UriInfoKind.resource).goPath().goExpand()
- .first()
- .goPath().first()
- .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, true)
- .isType(EntityTypeProvider.nameETKeyNav, true)
- .goUpExpandValidator()
- .goExpand()
- .goPath().first()
- .isNavProperty("NavPropertyETTwoKeyNavOne", EntityTypeProvider.nameETTwoKeyNav, false);
-
- testUri.run("ESKeyNav(1)", "$expand=NavPropertyETKeyNavMany($expand=NavPropertyETKeyNavMany)")
- .isKind(UriInfoKind.resource).goPath().goExpand()
- .first()
- .goPath().first()
- .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, true)
- .isType(EntityTypeProvider.nameETKeyNav, true)
- .goUpExpandValidator()
- .goExpand()
- .goPath().first()
- .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, true);
-
- testUri.run("ESKeyNav(1)", "$expand=NavPropertyETKeyNavOne($levels=5)")
- .isKind(UriInfoKind.resource).goPath().goExpand()
- .first()
- .goPath().first()
- .isNavProperty("NavPropertyETKeyNavOne", EntityTypeProvider.nameETKeyNav, false)
- .isType(EntityTypeProvider.nameETKeyNav, false)
- .goUpExpandValidator()
- .isLevelText("5");
-
- testUri.run("ESKeyNav(1)", "$expand=NavPropertyETKeyNavMany($select=PropertyString)")
- .isKind(UriInfoKind.resource).goPath().goExpand()
- .first()
- .goPath().first()
- .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, true)
- .isType(EntityTypeProvider.nameETKeyNav, true)
- .goUpExpandValidator()
- .isSelectText("PropertyString")
- .goSelectItem(0).isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false);
-
- testUri.run("ESKeyNav(1)", "$expand=NavPropertyETKeyNavOne($levels=max)")
- .isKind(UriInfoKind.resource).goPath().goExpand()
- .first()
- .goPath().first()
- .isNavProperty("NavPropertyETKeyNavOne", EntityTypeProvider.nameETKeyNav, false)
- .isType(EntityTypeProvider.nameETKeyNav, false)
- .goUpExpandValidator()
- .isLevelText("max");
-
- testUri.run("ESKeyNav(1)", "$expand=NavPropertyETKeyNavMany($skip=1;$top=2)")
- .isKind(UriInfoKind.resource).goPath().goExpand()
- .first()
- .goPath().first()
- .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, true)
- .isType(EntityTypeProvider.nameETKeyNav, true)
- .goUpExpandValidator()
- .isSkipText("1")
- .isTopText("2");
-
- testUri.run("ESKeyNav(1)", "$expand=NavPropertyETKeyNavMany($skip=1%3b$top=2)")
- .isKind(UriInfoKind.resource).goPath().goExpand()
- .first()
- .goPath().first()
- .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, true)
- .isType(EntityTypeProvider.nameETKeyNav, true)
- .goUpExpandValidator()
- .isSkipText("1")
- .isTopText("2");
-
- testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='Hugo')", "$expand=NavPropertyETKeyNavMany")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isKeyPredicate(1, "PropertyString", "'Hugo'")
- .goExpand()
- .first()
- .goPath().first()
- .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, true)
- .isType(EntityTypeProvider.nameETKeyNav, true);
-
- testUri.run("ESTwoKeyNav", "$expand=olingo.odata.test1.ETBaseTwoKeyNav/NavPropertyETKeyNavMany")
- .isKind(UriInfoKind.resource).goPath().first()
- .goExpand().first()
- .isExpandStartType(EntityTypeProvider.nameETBaseTwoKeyNav)
- .goPath().first()
- // .isType(EntityTypeProvider.nameETTwoKeyNav)
- // .isTypeFilterOnCollection(EntityTypeProvider.nameETBaseTwoKeyNav)
- // .n()
- .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, true);
-
- testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='Hugo')",
- "$expand=olingo.odata.test1.ETBaseTwoKeyNav/NavPropertyETKeyNavMany")
- .isKind(UriInfoKind.resource).goPath().first()
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isKeyPredicate(1, "PropertyString", "'Hugo'")
- .goExpand().first()
- .isExpandStartType(EntityTypeProvider.nameETBaseTwoKeyNav)
- .goPath().first()
- // .isType(EntityTypeProvider.nameETTwoKeyNav)
- // .isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav)
- // .n()
- .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, true);
-
- testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')",
- "$expand=olingo.odata.test1.ETBaseTwoKeyNav/NavPropertyETTwoKeyNavMany")
- .isKind(UriInfoKind.resource).goPath().first()
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isKeyPredicate(1, "PropertyString", "'2'")
- .goExpand().first()
- .isExpandStartType(EntityTypeProvider.nameETBaseTwoKeyNav)
- .goPath().first()
- // .isType(EntityTypeProvider.nameETTwoKeyNav)
- // .isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav)
- // .n()
- .isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, true);
-
- testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')",
- "$expand=olingo.odata.test1.ETBaseTwoKeyNav"
- + "/NavPropertyETTwoKeyNavMany/olingo.odata.test1.ETTwoBaseTwoKeyNav")
- .isKind(UriInfoKind.resource).goPath().first()
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isKeyPredicate(1, "PropertyString", "'2'")
- .goExpand().first()
- .isExpandStartType(EntityTypeProvider.nameETBaseTwoKeyNav)
- .goPath().first()
- // .isType(EntityTypeProvider.nameETTwoKeyNav)
- // .isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav)
- // .n()
- .isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, true)
- .isTypeFilterOnCollection(EntityTypeProvider.nameETTwoBaseTwoKeyNav);
-
- testUri.run("ESTwoKeyNav", "$expand=olingo.odata.test1.ETBaseTwoKeyNav/PropertyCompNav/NavPropertyETTwoKeyNavOne")
- .isKind(UriInfoKind.resource).goPath().first()
- .goExpand().first()
- .isExpandStartType(EntityTypeProvider.nameETBaseTwoKeyNav)
- .goPath().first()
- // .isType(EntityTypeProvider.nameETTwoKeyNav)
- // .isTypeFilterOnCollection(EntityTypeProvider.nameETBaseTwoKeyNav)
- // .n()
- .isComplex("PropertyCompNav")
- .isType(ComplexTypeProvider.nameCTBasePrimCompNav)
- .n()
- .isNavProperty("NavPropertyETTwoKeyNavOne", EntityTypeProvider.nameETTwoKeyNav, false);
-
- testUri.run("ESTwoKeyNav", "$expand=olingo.odata.test1.ETBaseTwoKeyNav/PropertyCompNav"
- + "/olingo.odata.test1.CTTwoBasePrimCompNav/NavPropertyETTwoKeyNavOne")
- .isKind(UriInfoKind.resource).goPath().first()
- .goExpand().first()
- .isExpandStartType(EntityTypeProvider.nameETBaseTwoKeyNav)
- .goPath().first()
- // .isType(EntityTypeProvider.nameETTwoKeyNav)
- // .isTypeFilterOnCollection(EntityTypeProvider.nameETBaseTwoKeyNav)
- // .n()
- .isComplex("PropertyCompNav")
- .isType(ComplexTypeProvider.nameCTBasePrimCompNav)
- .n()
- .isNavProperty("NavPropertyETTwoKeyNavOne", EntityTypeProvider.nameETTwoKeyNav, false);
-
- testUri.run("ESKeyNav(1)", "$expand=NavPropertyETKeyNavMany/$ref,NavPropertyETTwoKeyNavMany($skip=2;$top=1)")
- .isKind(UriInfoKind.resource).goPath().first()
- .goExpand().first()
- .goPath()
- .first()
- .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, true)
- .n().isRef()
- .goUpExpandValidator()
- .next()
- .goPath()
- .first().isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, true)
- .goUpExpandValidator()
- .isSkipText("2")
- .isTopText("1");
-
- testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')", "$expand=olingo.odata.test1.ETBaseTwoKeyNav"
- + "/NavPropertyETTwoKeyNavMany/olingo.odata.test1.ETTwoBaseTwoKeyNav($select=PropertyString)")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isKeyPredicate(1, "PropertyString", "'2'")
- .goExpand().first()
- .isExpandStartType(EntityTypeProvider.nameETBaseTwoKeyNav)
- .goPath().first()
- // .isUriPathInfoKind(UriResourceKind.startingTypeFilter)
- // .isType(EntityTypeProvider.nameETTwoKeyNav)
- // .isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav)
- // .n().isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, true)
- .isType(EntityTypeProvider.nameETTwoKeyNav)
- .isTypeFilterOnCollection(EntityTypeProvider.nameETTwoBaseTwoKeyNav)
- .goUpExpandValidator()
- .goSelectItem(0).isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false);
-
- testUri.run("ESKeyNav", "$expand=NavPropertyETKeyNavOne($expand=NavPropertyETKeyNavMany("
- + "$expand=NavPropertyETKeyNavOne))")
- .isKind(UriInfoKind.resource)
- .goPath().first()
- .goExpand().first()
- .goPath().first()
- .isNavProperty("NavPropertyETKeyNavOne", EntityTypeProvider.nameETKeyNav, false)
- .isType(EntityTypeProvider.nameETKeyNav)
- .goUpExpandValidator()
- .goExpand().first()
- .goPath().first()
- .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, true)
- .isType(EntityTypeProvider.nameETKeyNav)
- .goUpExpandValidator()
- .goExpand().first()
- .goPath().first()
- .isNavProperty("NavPropertyETKeyNavOne", EntityTypeProvider.nameETKeyNav, false)
- .isType(EntityTypeProvider.nameETKeyNav);
-
- testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')", "$select=olingo.odata.test1.ETBaseTwoKeyNav"
- + "/PropertyInt16")
- .isKind(UriInfoKind.resource).goPath()
- .first()
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isKeyPredicate(1, "PropertyString", "'2'")
- .isSelectStartType(0, EntityTypeProvider.nameETBaseTwoKeyNav)
- .goSelectItem(0)
- .first()
- .isPrimitiveProperty("PropertyInt16", PropertyProvider.nameInt16, false);
-
- testUri.run("ESKeyNav", "$expand=NavPropertyETKeyNavOne($select=PropertyInt16)")
- .isKind(UriInfoKind.resource)
- .goPath().first()
- .goExpand().first()
- .goPath().first()
- .isNavProperty("NavPropertyETKeyNavOne", EntityTypeProvider.nameETKeyNav, false)
- .isType(EntityTypeProvider.nameETKeyNav)
- .goUpExpandValidator()
- .isSelectText("PropertyInt16")
- .goSelectItem(0).isPrimitiveProperty("PropertyInt16", PropertyProvider.nameInt16, false);
-
- testUri.run("ESKeyNav", "$expand=NavPropertyETKeyNavOne($select=PropertyComp/PropertyInt16)")
- .isKind(UriInfoKind.resource)
- .goPath().first()
- .goExpand().first()
- .goPath().first()
- .isNavProperty("NavPropertyETKeyNavOne", EntityTypeProvider.nameETKeyNav, false)
- .isType(EntityTypeProvider.nameETKeyNav)
- .goUpExpandValidator()
- .isSelectText("PropertyComp/PropertyInt16");
-
- testUri.runEx("ESKeyNav", "$expand=undefined")
- .isExSemantic(UriParserSemanticException.MessageKeys.EXPRESSION_PROPERTY_NOT_IN_TYPE);
- testUri.runEx("ESTwoKeyNav", "$expand=PropertyCompNav/undefined")
- .isExSemantic(UriParserSemanticException.MessageKeys.EXPRESSION_PROPERTY_NOT_IN_TYPE);
- }
-
- @Test
- public void runTop() throws Exception {
- // top
- testUri.run("ESKeyNav", "$top=1")
- .isKind(UriInfoKind.resource).goPath()
- .isEntitySet("ESKeyNav")
- .isTopText("1");
-
- testUri.run("ESKeyNav", "$top=0")
- .isKind(UriInfoKind.resource).goPath()
- .isEntitySet("ESKeyNav")
- .isTopText("0");
-
- testUri.run("ESKeyNav", "$top=-3")
- .isKind(UriInfoKind.resource).goPath()
- .isEntitySet("ESKeyNav")
- .isTopText("-3");
-
- testUri.runEx("ESKeyNav", "$top=undefined")
- .isExSyntax(UriParserSyntaxException.MessageKeys.WRONG_VALUE_FOR_SYSTEM_QUERY_OPTION);
- testUri.runEx("ESKeyNav", "$top=")
- .isExSyntax(UriParserSyntaxException.MessageKeys.WRONG_VALUE_FOR_SYSTEM_QUERY_OPTION);
- }
-
- @Test
- public void runFormat() throws Exception {
- // format
- testUri.run("ESKeyNav(1)", "$format=atom")
- .isKind(UriInfoKind.resource).goPath()
- .isFormatText("atom");
- testUri.run("ESKeyNav(1)", "$format=json")
- .isKind(UriInfoKind.resource).goPath()
- .isFormatText("json");
- testUri.run("ESKeyNav(1)", "$format=xml")
- .isKind(UriInfoKind.resource).goPath()
- .isFormatText("xml");
- testUri.run("ESKeyNav(1)", "$format=IANA_content_type/must_contain_a_slash")
- .isKind(UriInfoKind.resource).goPath()
- .isFormatText("IANA_content_type/must_contain_a_slash");
- testUri.run("ESKeyNav(1)", "$format=Test_all_valid_signsSpecified_for_format_signs%26-._~$@%27/Aa123%26-._~$@%27")
- .isKind(UriInfoKind.resource).goPath()
- .isFormatText("Test_all_valid_signsSpecified_for_format_signs&-._~$@'/Aa123&-._~$@'");
- testUri.run("ESKeyNav(1)", "$format=" + HttpContentType.APPLICATION_ATOM_XML_ENTRY_UTF8)
- .isKind(UriInfoKind.resource).goPath()
- .isFormatText(HttpContentType.APPLICATION_ATOM_XML_ENTRY_UTF8);
- testUri.runEx("ESKeyNav(1)", "$format=noSlash")
- .isExSyntax(UriParserSyntaxException.MessageKeys.WRONG_VALUE_FOR_SYSTEM_QUERY_OPTION_FORMAT);
- testUri.runEx("ESKeyNav(1)", "$format=slashAtEnd/")
- .isExSyntax(UriParserSyntaxException.MessageKeys.WRONG_VALUE_FOR_SYSTEM_QUERY_OPTION_FORMAT);
- testUri.runEx("ESKeyNav(1)", "$format=/startsWithSlash")
- .isExSyntax(UriParserSyntaxException.MessageKeys.WRONG_VALUE_FOR_SYSTEM_QUERY_OPTION_FORMAT);
- testUri.runEx("ESKeyNav(1)", "$format=two/Slashes/tooMuch")
- .isExSyntax(UriParserSyntaxException.MessageKeys.WRONG_VALUE_FOR_SYSTEM_QUERY_OPTION_FORMAT);
- testUri.runEx("ESKeyNav(1)", "$format=")
- .isExSyntax(UriParserSyntaxException.MessageKeys.WRONG_VALUE_FOR_SYSTEM_QUERY_OPTION_FORMAT);
- }
-
- @Test
- public void runCount() throws Exception {
- // count
- testUri.run("ESAllPrim", "$count=true")
- .isKind(UriInfoKind.resource).goPath()
- .isInlineCountText("true");
- testUri.run("ESAllPrim", "$count=false")
- .isKind(UriInfoKind.resource).goPath()
- .isInlineCountText("false");
- testUri.runEx("ESAllPrim", "$count=undefined")
- .isExSyntax(UriParserSyntaxException.MessageKeys.WRONG_VALUE_FOR_SYSTEM_QUERY_OPTION);
- testUri.runEx("ESAllPrim", "$count=")
- .isExSyntax(UriParserSyntaxException.MessageKeys.WRONG_VALUE_FOR_SYSTEM_QUERY_OPTION);
- }
-
- @Test
- public void skip() throws Exception {
- // skip
- testUri.run("ESAllPrim", "$skip=3")
- .isKind(UriInfoKind.resource).goPath()
- .isSkipText("3");
- testUri.run("ESAllPrim", "$skip=0")
- .isKind(UriInfoKind.resource).goPath()
- .isSkipText("0");
- testUri.run("ESAllPrim", "$skip=-3")
- .isKind(UriInfoKind.resource).goPath()
- .isSkipText("-3");
- testUri.runEx("ESAllPrim", "$skip=F")
- .isExSyntax(UriParserSyntaxException.MessageKeys.WRONG_VALUE_FOR_SYSTEM_QUERY_OPTION);
- testUri.runEx("ESAllPrim", "$skip=")
- .isExSyntax(UriParserSyntaxException.MessageKeys.WRONG_VALUE_FOR_SYSTEM_QUERY_OPTION);
- }
-
- @Test
- public void skiptoken() throws Exception {
- testUri.run("ESAllPrim", "$skiptoken=foo")
- .isKind(UriInfoKind.resource).goPath()
- .isSkipTokenText("foo");
- }
-
- @Test
- public void notExistingSystemQueryOption() throws Exception {
- testUri.runEx("ESAllPrim", "$wrong=error")
- .isExSyntax(UriParserSyntaxException.MessageKeys.UNKNOWN_SYSTEM_QUERY_OPTION);
- }
-
- @Test
- public void misc() throws Exception {
-
- testUri.run("")
- .isKind(UriInfoKind.service);
- testUri.run("/")
- .isKind(UriInfoKind.service);
-
- testUri.run("$all")
- .isKind(UriInfoKind.all);
-
- testUri.run("$metadata")
- .isKind(UriInfoKind.metadata);
-
- testUri.run("$batch")
- .isKind(UriInfoKind.batch);
-
- testUri.run("$crossjoin(ESKeyNav)")
- .isKind(UriInfoKind.crossjoin)
- .isCrossJoinEntityList(Arrays.asList("ESKeyNav"));
-
- testUri.runEx("$metadata/$ref").isExSyntax(UriParserSyntaxException.MessageKeys.MUST_BE_LAST_SEGMENT);
- testUri.runEx("$batch/$ref").isExSyntax(UriParserSyntaxException.MessageKeys.MUST_BE_LAST_SEGMENT);
- testUri.runEx("$crossjoin(ESKeyNav)/$ref").isExSyntax(UriParserSyntaxException.MessageKeys.MUST_BE_LAST_SEGMENT);
- testUri.runEx("$all/$ref").isExSyntax(UriParserSyntaxException.MessageKeys.MUST_BE_LAST_SEGMENT);
- testUri.runEx("$entity/olingo.odata.test1.ETKeyNav/$ref")
- .isExSyntax(UriParserSyntaxException.MessageKeys.MUST_BE_LAST_SEGMENT);
-
- testUri.runEx("$wrong").isExSyntax(UriParserSyntaxException.MessageKeys.SYNTAX);
- testUri.runEx("", "$wrong").isExSyntax(UriParserSyntaxException.MessageKeys.UNKNOWN_SYSTEM_QUERY_OPTION);
-
- testUri.run("ESKeyNav")
- .isKind(UriInfoKind.resource)
- .goPath().first()
- .isEntitySet("ESKeyNav");
- testUri.run("ESKeyNav(1)")
- .isKind(UriInfoKind.resource)
- .goPath().first()
- .isEntitySet("ESKeyNav")
- .isKeyPredicate(0, "PropertyInt16", "1");
- testUri.runEx("ESKeyNav()").isExSemantic(UriParserSemanticException.MessageKeys.WRONG_NUMBER_OF_KEY_PROPERTIES);
-
- testUri.run("SINav")
- .isKind(UriInfoKind.resource)
- .goPath().first()
- .isSingleton("SINav");
-
- testUri.run("FICRTESMixPrimCollCompTwoParam(ParameterInt16=1,ParameterString='2')")
- .isKind(UriInfoKind.resource)
- .goPath()
- .isFunctionImport("FICRTESMixPrimCollCompTwoParam")
- .isType(EntityTypeProvider.nameETMixPrimCollComp)
- .isParameter(0, "ParameterInt16", "1")
- .isParameter(1, "ParameterString", "'2'");
-
- testUri.run("FICRTETKeyNav()")
- .isKind(UriInfoKind.resource)
- .goPath().first()
- .isFunctionImport("FICRTETKeyNav")
- .isType(EntityTypeProvider.nameETKeyNav);
-
- testUri.run("FICRTCollCTTwoPrim()")
- .isKind(UriInfoKind.resource)
- .goPath().first()
- .isFunctionImport("FICRTCollCTTwoPrim")
- .isType(ComplexTypeProvider.nameCTTwoPrim);
-
- testUri.run("FICRTCTAllPrimTwoParam(ParameterInt16=1,ParameterString='2')")
- .isKind(UriInfoKind.resource)
- .goPath().first()
- .isFunctionImport("FICRTCTAllPrimTwoParam")
- .isType(ComplexTypeProvider.nameCTAllPrim)
- .isParameter(0, "ParameterInt16", "1")
- .isParameter(1, "ParameterString", "'2'");
-
- testUri.run("FICRTCollStringTwoParam(ParameterInt16=1,ParameterString='2')")
- .isKind(UriInfoKind.resource)
- .goPath().first()
- .isFunctionImport("FICRTCollStringTwoParam")
- .isType(PropertyProvider.nameString)
- .isParameter(0, "ParameterInt16", "1")
- .isParameter(1, "ParameterString", "'2'");
-
- testUri.run("FICRTStringTwoParam(ParameterInt16=1)")
- .isKind(UriInfoKind.resource)
- .goPath().first()
- .isFunctionImport("FICRTStringTwoParam")
- .isFunction("UFCRTStringTwoParam")
- .isType(PropertyProvider.nameString)
- .isParameter(0, "ParameterInt16", "1");
-
- testUri.run("FICRTStringTwoParam(ParameterInt16=1,ParameterString='2')")
- .isKind(UriInfoKind.resource)
- .goPath().first()
- .isFunctionImport("FICRTStringTwoParam")
- .isFunction("UFCRTStringTwoParam")
- .isType(PropertyProvider.nameString)
- .isParameter(0, "ParameterInt16", "1");
-
- testUri.run(ContainerProvider.AIRT_STRING)
- .isKind(UriInfoKind.resource)
- .goPath().first()
- .isActionImport(ContainerProvider.AIRT_STRING);
-
- testUri.run(ContainerProvider.AIRT_COLL_ES_ALL_PRIM_PARAM)
- .isKind(UriInfoKind.resource)
- .goPath().first()
- .isActionImport(ContainerProvider.AIRT_COLL_ES_ALL_PRIM_PARAM);
-
- testUri.run("ESKeyNav/$count")
- .isKind(UriInfoKind.resource)
- .goPath().first()
- .isEntitySet("ESKeyNav")
- .n().isCount();
-
- testUri.run("ESKeyNav/$ref")
- .isKind(UriInfoKind.resource)
- .goPath().first()
- .isEntitySet("ESKeyNav")
- .n().isRef();
-
- testUri.run("ESTwoKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav()")
- .isKind(UriInfoKind.resource)
- .goPath().first()
- .isEntitySet("ESTwoKeyNav")
- .n().isFunction("BFCESTwoKeyNavRTESTwoKeyNav");
-
- testUri.run("ESAllPrim/olingo.odata.test1.BAESAllPrimRTETAllPrim")
- .isKind(UriInfoKind.resource)
- .goPath().first()
- .isEntitySet("ESAllPrim")
- .n().isAction("BAESAllPrimRTETAllPrim");
-
- testUri.run("ESTwoKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav()")
- .isKind(UriInfoKind.resource)
- .goPath().first()
- .isEntitySet("ESTwoKeyNav")
- .n().isFunction("BFCESTwoKeyNavRTESTwoKeyNav");
-
- testUri.run("ESTwoKeyNav/olingo.odata.test1.ETBaseTwoKeyNav")
- .isKind(UriInfoKind.resource)
- .goPath().first()
- .isEntitySet("ESTwoKeyNav")
- .isTypeFilterOnCollection(EntityTypeProvider.nameETBaseTwoKeyNav);
-
- testUri.run("ESTwoKeyNav/$count")
- .isKind(UriInfoKind.resource)
- .goPath().first()
- .isEntitySet("ESTwoKeyNav")
- .n()
- .isCount();
-
- testUri.run("ESTwoKeyNav/$ref")
- .isKind(UriInfoKind.resource)
- .goPath().first()
- .isEntitySet("ESTwoKeyNav")
- .n()
- .isRef();
-
- testUri.run("ESKeyNav(1)")
- .isKind(UriInfoKind.resource)
- .goPath().first()
- .isEntitySet("ESKeyNav")
- .isKeyPredicate(0, "PropertyInt16", "1");
-
- testUri.run("ESKeyNav(1)/$ref")
- .isKind(UriInfoKind.resource)
- .goPath().first()
- .isEntitySet("ESKeyNav")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .n()
- .isRef();
-
- testUri.run("ESMedia(1)/$value")
- .isKind(UriInfoKind.resource)
- .goPath().first()
- .isEntitySet("ESMedia")
- .n()
- .isValue();
-
- testUri.run("ESAllPrim/olingo.odata.test1.BAESAllPrimRTETAllPrim")
- .isKind(UriInfoKind.resource)
- .goPath().first()
- .isEntitySet("ESAllPrim")
- .n().isAction("BAESAllPrimRTETAllPrim");
-
- testUri.run("ESTwoKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav()")
- .isKind(UriInfoKind.resource)
- .goPath().first()
- .isEntitySet("ESTwoKeyNav")
- .n().isFunction("BFCESTwoKeyNavRTESTwoKeyNav");
-
- testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/olingo.odata.test1.ETBaseTwoKeyNav")
- .isKind(UriInfoKind.resource)
- .goPath().first()
- .isEntitySet("ESTwoKeyNav")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isKeyPredicate(1, "PropertyString", "'2'")
- .isType(EntityTypeProvider.nameETTwoKeyNav)
- .isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav);
-
- testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/olingo.odata.test1.ETBaseTwoKeyNav/$ref")
- .isKind(UriInfoKind.resource)
- .goPath().first()
- .isEntitySet("ESTwoKeyNav")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isKeyPredicate(1, "PropertyString", "'2'")
- .isType(EntityTypeProvider.nameETTwoKeyNav)
- .isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav)
- .n().isRef();
-
- testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/olingo.odata.test1.ETBaseTwoKeyNav/$value")
- .goPath().first()
- .isEntitySet("ESTwoKeyNav")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isKeyPredicate(1, "PropertyString", "'2'")
- .isType(EntityTypeProvider.nameETTwoKeyNav)
- .isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav)
- .n().isValue();
-
- }
-
- @Test
- public void testFilter() throws UriParserException {
-
- testFilter.runOnETTwoKeyNav("PropertyString")
- .is("<PropertyString>")
- .isType(PropertyProvider.nameString);
-
- testFilter.runOnETTwoKeyNav("PropertyComp/PropertyInt16")
- .is("<PropertyComp/PropertyInt16>")
- .isType(PropertyProvider.nameInt16);
-
- testFilter.runOnETTwoKeyNav("PropertyComp/PropertyComp/PropertyDate")
- .is("<PropertyComp/PropertyComp/PropertyDate>")
- .isType(PropertyProvider.nameDate);
-
- testFilter.runOnETTwoKeyNav("NavPropertyETTwoKeyNavOne")
- .is("<NavPropertyETTwoKeyNavOne>")
- .isType(EntityTypeProvider.nameETTwoKeyNav);
-
- testFilter.runOnETTwoKeyNav("NavPropertyETTwoKeyNavOne/PropertyString")
- .is("<NavPropertyETTwoKeyNavOne/PropertyString>")
- .isType(PropertyProvider.nameString);
-
- testFilter.runOnETTwoKeyNav("NavPropertyETTwoKeyNavOne/PropertyComp")
- .is("<NavPropertyETTwoKeyNavOne/PropertyComp>")
- .isType(ComplexTypeProvider.nameCTPrimComp);
-
- testFilter.runOnETTwoKeyNav("NavPropertyETTwoKeyNavOne/PropertyComp/PropertyComp")
- .is("<NavPropertyETTwoKeyNavOne/PropertyComp/PropertyComp>")
- .isType(ComplexTypeProvider.nameCTAllPrim);
-
- testFilter.runOnETTwoKeyNav("NavPropertyETTwoKeyNavOne/PropertyComp/PropertyInt16")
- .is("<NavPropertyETTwoKeyNavOne/PropertyComp/PropertyInt16>")
- .isType(PropertyProvider.nameInt16);
-
- testFilter.runOnETTwoKeyNav("NavPropertyETTwoKeyNavOne/PropertyComp/PropertyInt16 eq 1")
- .is("<<NavPropertyETTwoKeyNavOne/PropertyComp/PropertyInt16> eq <1>>")
- .root().left()
- .isType(PropertyProvider.nameInt16)
- .root().right()
- .isLiteral("1");
-
- testFilter.runOnETTwoKeyNav("NavPropertyETKeyNavMany(1)/NavPropertyETTwoKeyNavMany(PropertyString='2')/"
- + "PropertyString eq 'SomeString'")
- .is("<<NavPropertyETKeyNavMany/NavPropertyETTwoKeyNavMany/PropertyString> eq <'SomeString'>>")
- .root().left()
- .isType(PropertyProvider.nameString)
- .isMember().goPath()
- .first()
- .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, false)
- .isKeyPredicate(0, "PropertyInt16", "1")
- .n()
- .isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, false)
- .isKeyPredicateRef(0, "PropertyInt16", "PropertyInt16")
- .isKeyPredicate(1, "PropertyString", "'2'")
- .n()
- .isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false)
- .goUpFilterValidator()
- .root().right();
-
- testFilter.runOnETTwoKeyNav("olingo.odata.test1.ETBaseTwoKeyNav/PropertyDate eq 2013-11-12")
- .is("<<PropertyDate> eq <2013-11-12>>")
- .root().left()
- .isType(PropertyProvider.nameDate)
- .isMember().isMemberStartType(EntityTypeProvider.nameETBaseTwoKeyNav).goPath()
- // .first().isUriPathInfoKind(UriResourceKind.startingTypeFilter)
- // .isType(EntityTypeProvider.nameETTwoKeyNav).isTypeFilterOnCollection(EntityTypeProvider.nameETBaseTwoKeyNav)
- // .n().isPrimitiveProperty("PropertyDate", PropertyProvider.nameDate, false)
- .first().isPrimitiveProperty("PropertyDate", PropertyProvider.nameDate, false)
- .goUpFilterValidator()
- .root().right()
- .isLiteral("2013-11-12");
-
- testFilter.runOnCTTwoPrim("olingo.odata.test1.CTBase/AdditionalPropString eq 'SomeString'")
- .is("<<AdditionalPropString> eq <'SomeString'>>")
- .root().left()
- .isType(PropertyProvider.nameString)
- .isMember().isMemberStartType(ComplexTypeProvider.nameCTBase).goPath()
- // .first().isUriPathInfoKind(UriResourceKind.startingTypeFilter)
- // .isType(EntityTypeProvider.nameCTTwoPrim).isTypeFilterOnEntry(ComplexTypeProvider.nameCTBase)
- // .n().isPrimitiveProperty("AdditionalPropString", PropertyProvider.nameString, false)
- .first().isPrimitiveProperty("AdditionalPropString", PropertyProvider.nameString, false)
- .goUpFilterValidator()
- .root().right()
- .isLiteral("'SomeString'");
-
- testFilter
- .runOnETTwoKeyNav("NavPropertyETTwoKeyNavOne/olingo.odata.test1.ETBaseTwoKeyNav/PropertyDate eq 2013-11-12")
- .is("<<NavPropertyETTwoKeyNavOne/olingo.odata.test1.ETBaseTwoKeyNav/PropertyDate> eq <2013-11-12>>")
- .root().left()
- .isType(PropertyProvider.nameDate)
- .root().right()
- .isLiteral("2013-11-12");
-
- testFilter
- .runOnETTwoKeyNav("PropertyCompTwoPrim/olingo.odata.test1.CTTwoBase/AdditionalPropString eq 'SomeString'")
- .is("<<PropertyCompTwoPrim/olingo.odata.test1.CTTwoBase/AdditionalPropString> eq <'SomeString'>>")
- .root().left()
- .isType(PropertyProvider.nameString)
- .root().right()
- .isLiteral("'SomeString'");
-
- testFilter.runOnETTwoKeyNavEx("invalid")
- .isExSemantic(UriParserSemanticException.MessageKeys.EXPRESSION_PROPERTY_NOT_IN_TYPE);
- testFilter.runOnETTwoKeyNavEx("PropertyComp")
- .isExSemantic(UriParserSemanticException.MessageKeys.EXPRESSION_PROPERTY_NOT_IN_TYPE);
- testFilter.runOnETTwoKeyNavEx("PropertyComp/invalid")
- .isExSemantic(UriParserSemanticException.MessageKeys.EXPRESSION_PROPERTY_NOT_IN_TYPE);
- testFilter.runOnETTwoKeyNavEx("concat('a','b')/invalid").isExSyntax(UriParserSyntaxException.MessageKeys.SYNTAX);
- testFilter.runOnETTwoKeyNavEx("PropertyComp/concat('a','b')")
- .isExSyntax(UriParserSyntaxException.MessageKeys.SYNTAX);
- testFilter.runOnETTwoKeyNavEx("PropertyComp/PropertyInt16 eq '1'")
- .isExSyntax(UriParserSyntaxException.MessageKeys.SYNTAX);
- testFilter.runOnETTwoKeyNavEx("PropertyComp/PropertyComp/PropertyDate eq 1")
- .isExSyntax(UriParserSyntaxException.MessageKeys.SYNTAX);
- testFilter.runOnETTwoKeyNavEx("PropertyComp/PropertyComp/PropertyString eq 1")
- .isExSyntax(UriParserSyntaxException.MessageKeys.SYNTAX);
- testFilter.runOnETTwoKeyNavEx("PropertyComp/PropertyInt64 eq 1")
- .isExSemantic(UriParserSemanticException.MessageKeys.EXPRESSION_PROPERTY_NOT_IN_TYPE);
-
- testFilter.runOnETAllPrim("PropertySByte eq PropertySByte")
- .is("<<PropertySByte> eq <PropertySByte>>")
- .isBinary(BinaryOperatorKind.EQ)
- .root().left()
- .isType(PropertyProvider.nameSByte)
- .root().right()
- .isType(PropertyProvider.nameSByte);
-
- testFilter.runOnETAllPrim("PropertySByte ne PropertySByte")
- .is("<<PropertySByte> ne <PropertySByte>>")
- .isBinary(BinaryOperatorKind.NE)
- .root().left()
- .isType(PropertyProvider.nameSByte)
- .root().right()
- .isType(PropertyProvider.nameSByte);
-
- testFilter.runOnETAllPrim("PropertySByte add PropertySByte")
- .is("<<PropertySByte> add <PropertySByte>>")
- .root().left()
- .isType(PropertyProvider.nameSByte)
- .root().right()
- .isType(PropertyProvider.nameSByte);
-
- testFilter.runOnETAllPrim("PropertyByte add PropertyByte")
- .is("<<PropertyByte> add <PropertyByte>>")
- .root().left()
- .isType(PropertyProvider.nameByte)
- .root().right()
- .isType(PropertyProvider.nameByte);
- testFilter.runOnETAllPrim("PropertyInt16 add PropertyInt16")
- .is("<<PropertyInt16> add <PropertyInt16>>")
- .root().left()
- .isType(PropertyProvider.nameInt16)
- .root().right()
- .isType(PropertyProvider.nameInt16);
- testFilter.runOnETAllPrim("PropertyInt32 add PropertyInt32")
- .is("<<PropertyInt32> add <PropertyInt32>>")
- .root().left()
- .isType(PropertyProvider.nameInt32)
- .root().right()
- .isType(PropertyProvider.nameInt32);
-
- testFilter.runOnETAllPrim("PropertyInt64 add PropertyInt64")
- .is("<<PropertyInt64> add <PropertyInt64>>")
- .root().left()
- .isType(PropertyProvider.nameInt64)
- .root().right()
- .isType(PropertyProvider.nameInt64);
- testFilter.runOnETAllPrim("PropertySingle add PropertySingle")
- .is("<<PropertySingle> add <PropertySingle>>")
- .root().left()
- .isType(PropertyProvider.nameSingle)
- .root().right()
- .isType(PropertyProvider.nameSingle);
- testFilter.runOnETAllPrim("PropertyDouble add PropertyDouble")
- .is("<<PropertyDouble> add <PropertyDouble>>")
- .root().left()
- .isType(PropertyProvider.nameDouble)
- .root().right()
- .isType(PropertyProvider.nameDouble);
- testFilter.runOnETAllPrim("PropertyDecimal add PropertyDecimal")
- .is("<<PropertyDecimal> add <PropertyDecimal>>")
- .root().left()
- .isType(PropertyProvider.nameDecimal)
- .root().right()
- .isType(PropertyProvider.nameDecimal);
- testFilter.runOnETAllPrim("PropertySByte add PropertyDecimal")
- .is("<<PropertySByte> add <PropertyDecimal>>")
- .root().left()
- .isType(PropertyProvider.nameSByte)
- .root().right()
- .isType(PropertyProvider.nameDecimal);
- testFilter.runOnETAllPrim("PropertySByte add PropertyInt32")
- .is("<<PropertySByte> add <PropertyInt32>>")
- .root().left()
- .isType(PropertyProvider.nameSByte)
- .root().right()
- .isType(PropertyProvider.nameInt32);
- testFilter.runOnETAllPrim("PropertySByte add PropertyInt64")
- .is("<<PropertySByte> add <PropertyInt64>>")
- .root().left()
- .isType(PropertyProvider.nameSByte)
- .root().right()
- .isType(PropertyProvider.nameInt64);
- testFilter.runOnETAllPrim("PropertyDateTimeOffset add PropertyDuration")
- .is("<<PropertyDateTimeOffset> add <PropertyDuration>>")
- .root().left()
- .isType(PropertyProvider.nameDateTimeOffset)
- .root().right()
- .isType(PropertyProvider.nameDuration);
- testFilter.runOnETAllPrim("PropertyDuration add PropertyDuration")
- .is("<<PropertyDuration> add <PropertyDuration>>")
- .root().left()
- .isType(PropertyProvider.nameDuration)
- .root().right()
- .isType(PropertyProvider.nameDuration);
- testFilter.runOnETAllPrim("PropertyDate add PropertyDuration")
- .is("<<PropertyDate> add <PropertyDuration>>")
- .root().left()
- .isType(PropertyProvider.nameDate)
- .root().right()
- .isType(PropertyProvider.nameDuration);
- testFilter.runOnETAllPrim("PropertySByte sub PropertySByte")
- .is("<<PropertySByte> sub <PropertySByte>>")
- .root().left()
- .isType(PropertyProvider.nameSByte)
- .root().right()
- .isType(PropertyProvider.nameSByte);
- testFilter.runOnETAllPrim("PropertyByte sub PropertyByte")
- .is("<<PropertyByte> sub <PropertyByte>>")
- .root().left()
- .isType(PropertyProvider.nameByte)
- .root().right()
- .isType(PropertyProvider.nameByte);
- testFilter.runOnETAllPrim("PropertyInt16 sub PropertyInt16")
- .is("<<PropertyInt16> sub <PropertyInt16>>")
- .root().left()
- .isType(PropertyProvider.nameInt16)
- .root().right()
- .isType(PropertyProvider.nameInt16);
- testFilter.runOnETAllPrim("PropertyInt32 sub PropertyInt32")
- .is("<<PropertyInt32> sub <PropertyInt32>>")
- .root().left()
- .isType(PropertyProvider.nameInt32)
- .root().right()
- .isType(PropertyProvider.nameInt32);
- testFilter.runOnETAllPrim("PropertyInt64 sub PropertyInt64")
- .is("<<PropertyInt64> sub <PropertyInt64>>")
- .root().left()
- .isType(PropertyProvider.nameInt64)
- .root().right()
- .isType(PropertyProvider.nameInt64);
- testFilter.runOnETAllPrim("PropertySingle sub PropertySingle")
- .is("<<PropertySingle> sub <PropertySingle>>")
- .root().left()
- .isType(PropertyProvider.nameSingle)
- .root().right()
- .isType(PropertyProvider.nameSingle);
- testFilter.runOnETAllPrim("PropertyDouble sub PropertyDouble")
- .is("<<PropertyDouble> sub <PropertyDouble>>")
- .root().left()
- .isType(PropertyProvider.nameDouble)
- .root().right()
- .isType(PropertyProvider.nameDouble);
- testFilter.runOnETAllPrim("PropertyDecimal sub PropertyDecimal")
- .is("<<PropertyDecimal> sub <PropertyDecimal>>")
- .root().left()
- .isType(PropertyProvider.nameDecimal)
- .root().right()
- .isType(PropertyProvider.nameDecimal);
- testFilter.runOnETAllPrim("PropertyDecimal sub PropertyInt32")
- .is("<<PropertyDecimal> sub <PropertyInt32>>")
- .root().left()
- .isType(PropertyProvider.nameDecimal)
- .root().right()
- .isType(PropertyProvider.nameInt32);
- testFilter.runOnETAllPrim("PropertyDecimal sub PropertyInt64")
- .is("<<PropertyDecimal> sub <PropertyInt64>>")
- .root().left()
- .isType(PropertyProvider.nameDecimal)
- .root().right()
- .isType(PropertyProvider.nameInt64);
- testFilter.runOnETAllPrim("PropertyDecimal sub PropertyByte")
- .is("<<PropertyDecimal> sub <PropertyByte>>")
- .root().left()
- .isType(PropertyProvider.nameDecimal)
- .root().right()
- .isType(PropertyProvider.nameByte);
- testFilter.runOnETAllPrim("PropertyDateTimeOffset sub PropertyDuration")
- .is("<<PropertyDateTimeOffset> sub <PropertyDuration>>")
- .root().left()
- .isType(PropertyProvider.nameDateTimeOffset)
- .root().right()
- .isType(PropertyProvider.nameDuration);
- testFilter.runOnETAllPrim("PropertyDuration sub PropertyDuration")
- .is("<<PropertyDuration> sub <PropertyDuration>>")
- .root().left()
- .isType(PropertyProvider.nameDuration)
- .root().right()
- .isType(PropertyProvider.nameDuration);
- testFilter.runOnETAllPrim("PropertyDateTimeOffset sub PropertyDateTimeOffset")
- .is("<<PropertyDateTimeOffset> sub <PropertyDateTimeOffset>>")
- .root().left()
- .isType(PropertyProvider.nameDateTimeOffset)
- .root().right()
- .isType(PropertyProvider.nameDateTimeOffset);
- testFilter.runOnETAllPrim("PropertyDate sub PropertyDuration")
- .is("<<PropertyDate> sub <PropertyDuration>>")
- .root().left()
- .isType(PropertyProvider.nameDate)
- .root().right()
- .isType(PropertyProvider.nameDuration);
- testFilter.runOnETAllPrim("PropertyDate sub PropertyDate")
- .is("<<PropertyDate> sub <PropertyDate>>")
- .root().left()
- .isType(PropertyProvider.nameDate)
- .root().right()
- .isType(PropertyProvider.nameDate);
- testFilter.runOnETAllPrim("PropertySByte mul PropertySByte")
- .is("<<PropertySByte> mul <PropertySByte>>")
- .root().left()
- .isType(PropertyProvider.nameSByte)
- .root().right()
- .isType(PropertyProvider.nameSByte);
- testFilter.runOnETAllPrim("PropertyByte mul PropertyByte")
- .is("<<PropertyByte> mul <PropertyByte>>")
- .root().left()
- .isType(PropertyProvider.nameByte)
- .root().right()
- .isType(PropertyProvider.nameByte);
- testFilter.runOnETAllPrim("PropertyInt16 mul PropertyInt16")
- .is("<<PropertyInt16> mul <PropertyInt16>>")
- .root().left()
- .isType(PropertyProvider.nameInt16)
- .root().right()
- .isType(PropertyProvider.nameInt16);
- testFilter.runOnETAllPrim("PropertyInt32 mul PropertyInt32")
- .is("<<PropertyInt32> mul <PropertyInt32>>")
- .root().left()
- .isType(PropertyProvider.nameInt32)
- .root().right()
- .isType(PropertyProvider.nameInt32);
- testFilter.runOnETAllPrim("PropertyInt64 mul PropertyInt64")
- .is("<<PropertyInt64> mul <PropertyInt64>>")
- .root().left()
- .isType(PropertyProvider.nameInt64)
- .root().right()
- .isType(PropertyProvider.nameInt64);
- testFilter.runOnETAllPrim("PropertySingle mul PropertySingle")
- .is("<<PropertySingle> mul <PropertySingle>>")
- .root().left()
- .isType(PropertyProvider.nameSingle)
- .root().right()
- .isType(PropertyProvider.nameSingle);
- testFilter.runOnETAllPrim("PropertyDouble mul PropertyDouble")
- .is("<<PropertyDouble> mul <PropertyDouble>>")
- .root().left()
- .isType(PropertyProvider.nameDouble)
- .root().right()
- .isType(PropertyProvider.nameDouble);
- testFilter.runOnETAllPrim("PropertyDecimal mul PropertyDecimal")
- .is("<<PropertyDecimal> mul <PropertyDecimal>>")
- .root().left()
- .isType(PropertyProvider.nameDecimal)
- .root().right()
- .isType(PropertyProvider.nameDecimal);
- testFilter.runOnETAllPrim("PropertyInt64 mul PropertyInt32")
- .is("<<PropertyInt64> mul <PropertyInt32>>")
- .root().left()
- .isType(PropertyProvider.nameInt64)
- .root().right()
- .isType(PropertyProvider.nameInt32);
- testFilter.runOnETAllPrim("PropertyInt64 mul PropertySByte")
- .is("<<PropertyInt64> mul <PropertySByte>>")
- .root().left()
- .isType(PropertyProvider.nameInt64)
- .root().right()
- .isType(PropertyProvider.nameSByte);
- testFilter.runOnETAllPrim("PropertyInt64 mul PropertyDecimal")
- .is("<<PropertyInt64> mul <PropertyDecimal>>")
- .root().left()
- .isType(PropertyProvider.nameInt64)
- .root().right()
- .isType(PropertyProvider.nameDecimal);
- testFilter.runOnETAllPrim("PropertySByte div PropertySByte")
- .is("<<PropertySByte> div <PropertySByte>>")
- .root().left()
- .isType(PropertyProvider.nameSByte)
- .root().right()
- .isType(PropertyProvider.nameSByte);
- testFilter.runOnETAllPrim("PropertyByte div PropertyByte")
- .is("<<PropertyByte> div <PropertyByte>>")
- .root().left()
- .isType(PropertyProvider.nameByte)
- .root().right()
- .isType(PropertyProvider.nameByte);
- testFilter.runOnETAllPrim("PropertyInt16 div PropertyInt16")
- .is("<<PropertyInt16> div <PropertyInt16>>")
- .root().left()
- .isType(PropertyProvider.nameInt16)
- .root().right()
- .isType(PropertyProvider.nameInt16);
- testFilter.runOnETAllPrim("PropertyInt32 div PropertyInt32")
- .is("<<PropertyInt32> div <PropertyInt32>>")
- .root().left()
- .isType(PropertyProvider.nameInt32)
- .root().right()
- .isType(PropertyProvider.nameInt32);
- testFilter.runOnETAllPrim("PropertyInt64 div PropertyInt64")
- .is("<<PropertyInt64> div <PropertyInt64>>")
- .root().left()
- .isType(PropertyProvider.nameInt64)
- .root().right()
- .isType(PropertyProvider.nameInt64);
- testFilter.runOnETAllPrim("PropertySingle div PropertySingle")
- .is("<<PropertySingle> div <PropertySingle>>")
- .root().left()
- .isType(PropertyProvider.nameSingle)
- .root().right()
- .isType(PropertyProvider.nameSingle);
- testFilter.runOnETAllPrim("PropertyDouble div PropertyDouble")
- .is("<<PropertyDouble> div <PropertyDouble>>")
- .root().left()
- .isType(PropertyProvider.nameDouble)
- .root().right()
- .isType(PropertyProvider.nameDouble);
- testFilter.runOnETAllPrim("PropertyDecimal div PropertyDecimal")
- .is("<<PropertyDecimal> div <PropertyDecimal>>")
- .root().left()
- .isType(PropertyProvider.nameDecimal)
- .root().right()
- .isType(PropertyProvider.nameDecimal);
- testFilter.runOnETAllPrim("PropertyByte div PropertyInt32")
- .is("<<PropertyByte> div <PropertyInt32>>")
- .root().left()
- .isType(PropertyProvider.nameByte)
- .root().right()
- .isType(PropertyProvider.nameInt32);
- testFilter.runOnETAllPrim("PropertyByte div PropertyDecimal")
- .is("<<PropertyByte> div <PropertyDecimal>>")
- .root().left()
- .isType(PropertyProvider.nameByte)
- .root().right()
- .isType(PropertyProvider.nameDecimal);
- testFilter.runOnETAllPrim("PropertyByte div PropertySByte")
- .is("<<PropertyByte> div <PropertySByte>>")
- .root().left()
- .isType(PropertyProvider.nameByte)
- .root().right()
- .isType(PropertyProvider.nameSByte);
-
- testFilter.runOnETAllPrim("PropertyByte div 0")
- .is("<<PropertyByte> div <0>>");
-
- testFilter.runOnETAllPrim("0 div 0")
- .is("<<0> div <0>>");
-
- testFilter.runOnETAllPrim("PropertySByte mod PropertySByte")
- .is("<<PropertySByte> mod <PropertySByte>>")
- .root().left()
- .isType(PropertyProvider.nameSByte)
- .root().right()
- .isType(PropertyProvider.nameSByte);
- testFilter.runOnETAllPrim("PropertyByte mod PropertyByte")
- .is("<<PropertyByte> mod <PropertyByte>>")
- .root().left()
- .isType(PropertyProvider.nameByte)
- .root().right()
- .isType(PropertyProvider.nameByte);
- testFilter.runOnETAllPrim("PropertyInt16 mod PropertyInt16")
- .is("<<PropertyInt16> mod <PropertyInt16>>")
- .root().left()
- .isType(PropertyProvider.nameInt16)
- .root().right()
- .isType(PropertyProvider.nameInt16);
- testFilter.runOnETAllPrim("PropertyInt32 mod PropertyInt32")
- .is("<<PropertyInt32> mod <PropertyInt32>>")
- .root().left()
- .isType(PropertyProvider.nameInt32)
- .root().right()
- .isType(PropertyProvider.nameInt32);
- testFilter.runOnETAllPrim("PropertyInt64 mod PropertyInt64")
- .is("<<PropertyInt64> mod <PropertyInt64>>")
- .root().left()
- .isType(PropertyProvider.nameInt64)
- .root().right()
- .isType(PropertyProvider.nameInt64);
- testFilter.runOnETAllPrim("PropertySingle mod PropertySingle")
- .is("<<PropertySingle> mod <PropertySingle>>")
- .root().left()
- .isType(PropertyProvider.nameSingle)
- .root().right()
- .isType(PropertyProvider.nameSingle);
- testFilter.runOnETAllPrim("PropertyDouble mod PropertyDouble")
- .is("<<PropertyDouble> mod <PropertyDouble>>")
- .root().left()
- .isType(PropertyProvider.nameDouble)
- .root().right()
- .isType(PropertyProvider.nameDouble);
- testFilter.runOnETAllPrim("PropertyDecimal mod PropertyDecimal")
- .is("<<PropertyDecimal> mod <PropertyDecimal>>")
- .root().left()
- .isType(PropertyProvider.nameDecimal)
- .root().right()
- .isType(PropertyProvider.nameDecimal);
-
- //
- testFilter.runOnETAllPrim("PropertyDecimal ge PropertyDecimal")
- .is("<<PropertyDecimal> ge <PropertyDecimal>>")
- .isBinary(BinaryOperatorKind.GE)
- .root().left()
- .isType(PropertyProvider.nameDecimal)
- .root().right()
- .isType(PropertyProvider.nameDecimal);
- testFilter.runOnETAllPrim("PropertyDecimal lt PropertyDecimal")
- .is("<<PropertyDecimal> lt <PropertyDecimal>>")
- .isBinary(BinaryOperatorKind.LT)
- .root().left()
- .isType(PropertyProvider.nameDecimal)
- .root().right()
- .isType(PropertyProvider.nameDecimal);
- testFilter.runOnETAllPrim("PropertyDecimal le PropertyDecimal")
- .is("<<PropertyDecimal> le <PropertyDecimal>>")
- .isBinary(BinaryOperatorKind.LE)
- .root().left()
- .isType(PropertyProvider.nameDecimal)
- .root().right()
- .isType(PropertyProvider.nameDecimal);
-
- testFilter.runOnETAllPrim("PropertyDecimal sub NaN")
- .right().isLiteral("NaN").isType(PropertyProvider.nameDecimal);
- testFilter.runOnETAllPrim("PropertyDecimal sub -INF")
- .right().isLiteral("-INF").isType(PropertyProvider.nameDecimal);
- testFilter.runOnETAllPrim("PropertyDecimal sub INF")
- .right().isLiteral("INF").isType(PropertyProvider.nameDecimal);
- }
-
- @Test
- public void testFilterProperties() throws UriParserException {
- testFilter.runOnETAllPrim("PropertyByte mod 0")
- .is("<<PropertyByte> mod <0>>");
-
- testFilter.runOnETAllPrim("olingo.odata.test1.UFCRTETTwoKeyNavParamCTTwoPrim(ParameterCTTwoPrim=@ParamAlias)")
- .is("<UFCRTETTwoKeyNavParamCTTwoPrim>")
- .goPath()
- .first()
- .isFunction("UFCRTETTwoKeyNavParamCTTwoPrim")
- .isParameterAlias(0, "ParameterCTTwoPrim", "@ParamAlias");
-
- testFilter.runOnETTwoKeyNav("PropertyComp/olingo.odata.test1.BFCCTPrimCompRTESTwoKeyNavParam"
- + "(ParameterString=PropertyComp/PropertyComp/PropertyString)(PropertyInt16=1,PropertyString='2')"
- + "/PropertyString eq 'SomeString'")
- .is("<<PropertyComp/BFCCTPrimCompRTESTwoKeyNavParam/PropertyString> eq <'SomeString'>>")
- .root().left().goPath()
- .first()
- .isComplexProperty("PropertyComp", ComplexTypeProvider.nameCTPrimComp, false)
- .n()
- .isFunction("BFCCTPrimCompRTESTwoKeyNavParam")
- .isParameter(0, "ParameterString", "PropertyComp/PropertyComp/PropertyString")
- .goParameter(0)
- .isMember()
- .goPath()
- .first().isComplex("PropertyComp")
- .n().isComplex("PropertyComp")
- .n().isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false).goUpFilterValidator()
- .goUpToResourceValidator()
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isKeyPredicate(1, "PropertyString", "'2'")
- .n()
- .isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false);
-
- testFilter.runOnETTwoKeyNav("PropertyComp/olingo.odata.test1.BFCCTPrimCompRTETTwoKeyNavParam"
- + "(ParameterString=null)/PropertyString eq 'SomeString'")
- .is("<<PropertyComp/BFCCTPrimCompRTETTwoKeyNavParam/PropertyString> eq <'SomeString'>>")
- .root().left().goPath()
- .first()
- .isComplexProperty("PropertyComp", ComplexTypeProvider.nameCTPrimComp, false)
- .n()
- .isFunction("BFCCTPrimCompRTETTwoKeyNavParam")
- .goParameter(0)
- .isNull()
- .goUpToResourceValidator()
- .n()
- .isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false);
-
- testFilter.runOnETTwoKeyNav("NavPropertyETTwoKeyNavMany/olingo.odata.test1.BFCESTwoKeyNavRTString()"
- + " eq 'SomeString'")
- .is("<<NavPropertyETTwoKeyNavMany/BFCESTwoKeyNavRTString> eq <'SomeString'>>")
- .root().left().goPath()
- .first()
- .isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, true)
- .n()
- .isFunction("BFCESTwoKeyNavRTString");
-
- testFilter.runOnETTwoKeyNav("$it/olingo.odata.test1.BFESTwoKeyNavRTESTwoKeyNav()/PropertyString eq 'SomeString'")
- .is("<<$it/BFESTwoKeyNavRTESTwoKeyNav/PropertyString> eq <'SomeString'>>")
- .root().left().goPath()
- .first()
- .isIt()
- .n()
- .isFunction("BFESTwoKeyNavRTESTwoKeyNav")
- .n()
- .isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false);
-
- testFilter.runOnETTwoKeyNav("olingo.odata.test1.BFESTwoKeyNavRTESTwoKeyNav()/PropertyString eq 'SomeString'")
- .is("<<BFESTwoKeyNavRTESTwoKeyNav/PropertyString> eq <'SomeString'>>")
- .root().left().goPath()
- .first()
- .isFunction("BFESTwoKeyNavRTESTwoKeyNav")
- .n()
- .isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false);
-
- testFilter.runOnETTwoKeyNav("NavPropertyETTwoKeyNavOne/olingo.odata.test1.BFCETTwoKeyNavRTETTwoKeyNav()"
- + "/PropertyComp/PropertyComp/PropertyString eq 'Walldorf'")
- .is("<<NavPropertyETTwoKeyNavOne/BFCETTwoKeyNavRTETTwoKeyNav/PropertyComp/PropertyComp/PropertyString> "
- + "eq <'Walldorf'>>")
- .root().left().goPath()
- .first()
- .isNavProperty("NavPropertyETTwoKeyNavOne", EntityTypeProvider.nameETTwoKeyNav, false)
- .n()
- .isFunction("BFCETTwoKeyNavRTETTwoKeyNav")
- .n()
- .isComplexProperty("PropertyComp", ComplexTypeProvider.nameCTPrimComp, false)
- .n()
- .isComplexProperty("PropertyComp", ComplexTypeProvider.nameCTAllPrim, false)
- .n()
- .isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false);
-
- testFilter.runOnETTwoKeyNav("PropertyComp/olingo.odata.test1.BFCCTPrimCompRTESTwoKeyNavParam"
- + "(ParameterString='1')"
- + "/olingo.odata.test1.ETBaseTwoKeyNav(PropertyInt16=2,PropertyString='3')"
- + "/PropertyString eq 'SomeString'")
- .is("<<PropertyComp/BFCCTPrimCompRTESTwoKeyNavParam/olingo.odata.test1.ETBaseTwoKeyNav/PropertyString> "
- + "eq <'SomeString'>>")
- .root().left().goPath()
- .first()
- .isComplexProperty("PropertyComp", ComplexTypeProvider.nameCTPrimComp, false)
- .n()
- .isFunction("BFCCTPrimCompRTESTwoKeyNavParam")
- .isTypeFilterOnCollection(EntityTypeProvider.nameETBaseTwoKeyNav)
- .isKeyPredicate(0, "PropertyInt16", "2")
- .isKeyPredicate(1, "PropertyString", "'3'")
- .n()
- .isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false);
-
- testFilter.runOnETTwoKeyNavSingle("$it/olingo.odata.test1.BFCETTwoKeyNavRTCTTwoPrim()/olingo.odata.test1.CTBase"
- + "/PropertyString eq 'SomeString'")
- .is("<<$it/BFCETTwoKeyNavRTCTTwoPrim/olingo.odata.test1.CTBase/PropertyString> eq <'SomeString'>>")
- .root().left().goPath()
- .first()
- .isIt()
- .n()
- .isFunction("BFCETTwoKeyNavRTCTTwoPrim")
- .isTypeFilterOnEntry(ComplexTypeProvider.nameCTBase)
- .n()
- .isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false);
-
- testFilter.runOnETTwoKeyNav("olingo.odata.test1.UFCRTETTwoKeyNavParam(ParameterInt16=1)/PropertyInt16 eq 2")
- .is("<<UFCRTETTwoKeyNavParam/PropertyInt16> eq <2>>")
- .root().left().goPath()
- .first()
- .isFunction("UFCRTETTwoKeyNavParam")
- .isParameter(0, "ParameterInt16", "1")
- .n()
- .isPrimitiveProperty("PropertyInt16", PropertyProvider.nameInt16, false);
-
- testFilter.runOnETTwoKeyNav("olingo.odata.test1.UFCRTETTwoKeyNavParam(ParameterInt16=@Param1Alias)"
- + "/PropertyInt16 eq 2")
- .root().left().goPath()
- .first()
- .isFunction("UFCRTETTwoKeyNavParam")
- .isParameterAlias(0, "ParameterInt16", "@Param1Alias")
- .n()
- .isPrimitiveProperty("PropertyInt16", PropertyProvider.nameInt16, false);
-
- testFilter.runOnETTwoKeyNav("olingo.odata.test1.UFCRTETTwoKeyNavParam(ParameterInt16=1)"
- + "/PropertyComp/PropertyComp/PropertyString eq 'SomeString'")
- .root().left().goPath()
- .first()
- .isFunction("UFCRTETTwoKeyNavParam")
- .isParameter(0, "ParameterInt16", "1")
- .n()
- .isComplexProperty("PropertyComp", ComplexTypeProvider.nameCTPrimComp, false)
- .n()
- .isComplexProperty("PropertyComp", ComplexTypeProvider.nameCTAllPrim, false)
- .n()
- .isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false);
-
- testFilter.runOnETTwoKeyNav("olingo.odata.test1.UFCRTETTwoKeyNavParam(ParameterInt16=PropertyInt16)"
- + "/PropertyComp/PropertyComp/PropertyString eq 'SomeString'")
- .root().left().goPath()
- .first()
- .isFunction("UFCRTETTwoKeyNavParam")
- .isParameter(0, "ParameterInt16", "PropertyInt16")
- .n()
- .isComplexProperty("PropertyComp", ComplexTypeProvider.nameCTPrimComp, false)
- .n()
- .isComplexProperty("PropertyComp", ComplexTypeProvider.nameCTAllPrim, false)
- .n()
- .isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false);
- }
-
- @Test
- public void testFilterPMethods() throws ExpressionVisitException, ODataApplicationException, UriParserException {
-
- testFilter.runOnETKeyNav("indexof(PropertyString,'47') eq 5")
- .is("<<indexof(<PropertyString>,<'47'>)> eq <5>>")
- .root().left()
- .isMethod(MethodKind.INDEXOF, 2)
- .isParameterText(0, "<PropertyString>")
- .isParameterText(1, "<'47'>");
-
- testFilter.runOnETKeyNav("tolower(PropertyString) eq 'foo'")
- .is("<<tolower(<PropertyString>)> eq <'foo'>>")
- .root().left()
- .isMethod(MethodKind.TOLOWER, 1)
- .isParameterText(0, "<PropertyString>");
-
- testFilter.runOnETKeyNav("toupper(PropertyString) eq 'FOO'")
- .is("<<toupper(<PropertyString>)> eq <'FOO'>>")
- .root().left()
- .isMethod(MethodKind.TOUPPER, 1)
- .isParameterText(0, "<PropertyString>");
-
- testFilter.runOnETKeyNav("trim(PropertyString) eq 'fooba'")
- .is("<<trim(<PropertyString>)> eq <'fooba'>>")
- .root().left()
- .isMethod(MethodKind.TRIM, 1)
- .isParameterText(0, "<PropertyString>");
-
- testFilter.runOnETKeyNav("substring(PropertyString,4) eq 'foo'")
- .is("<<substring(<PropertyString>,<4>)> eq <'foo'>>")
- .root().left()
- .isMethod(MethodKind.SUBSTRING, 2)
- .isParameterText(0, "<PropertyString>")
- .isParameterText(1, "<4>");
-
- testFilter.runOnETKeyNav("substring(PropertyString,4) eq 'foo'")
- .is("<<substring(<PropertyString>,<4>)> eq <'foo'>>")
- .root().left()
- .isMethod(MethodKind.SUBSTRING, 2)
- .isParameterText(0, "<PropertyString>")
- .isParameterText(1, "<4>");
-
- testFilter.runOnETKeyNav("substring(PropertyString,2,4) eq 'foo'")
- .is("<<substring(<PropertyString>,<2>,<4>)> eq <'foo'>>")
- .root().left()
- .isMethod(MethodKind.SUBSTRING, 3)
- .isParameterText(0, "<PropertyString>")
- .isParameterText(1, "<2>")
- .isParameterText(2, "<4>");
-
- testFilter.runOnETKeyNav("concat(PropertyString,PropertyCompTwoPrim/PropertyString) eq 'foo'")
- .is("<<concat(<PropertyString>,<PropertyCompTwoPrim/PropertyString>)> eq <'foo'>>")
- .root().left()
- .isMethod(MethodKind.CONCAT, 2)
- .isParameterText(0, "<PropertyString>")
- .isParameterText(1, "<PropertyCompTwoPrim/PropertyString>");
-
- testFilter.runOnETKeyNav("concat(PropertyString,'bar') eq 'foobar'")
- .is("<<concat(<PropertyString>,<'bar'>)> eq <'foobar'>>")
- .root().left()
- .isMethod(MethodKind.CONCAT, 2)
- .isParameterText(0, "<PropertyString>")
- .isParameterText(1, "<'bar'>");
-
- testFilter.runOnETKeyNav("concat(PropertyString,'bar') eq 'foobar'")
- .is("<<concat(<PropertyString>,<'bar'>)> eq <'foobar'>>")
- .root().left()
- .isMethod(MethodKind.CONCAT, 2)
- .isParameterText(0, "<PropertyString>")
- .isParameterText(1, "<'bar'>");
-
- testFilter.runOnETKeyNav("concat(PropertyString, cast(PropertyCompAllPrim/PropertyInt16,Edm.String))")
- .is("<concat(<PropertyString>,<cast(<PropertyCompAllPrim/PropertyInt16>,<Edm.String>)>)>")
- .isMethod(MethodKind.CONCAT, 2)
- .isParameterText(0, "<PropertyString>")
- .isParameterText(1, "<cast(<PropertyCompAllPrim/PropertyInt16>,<Edm.String>)>")
- .goParameter(1)
- .isMethod(MethodKind.CAST, 2)
- .isParameterText(0, "<PropertyCompAllPrim/PropertyInt16>")
- .isParameterText(1, "<Edm.String>");
-
- testFilter.runOnETKeyNav("length(PropertyString) eq 32")
- .is("<<length(<PropertyString>)> eq <32>>")
- .root().left()
- .isMethod(MethodKind.LENGTH, 1)
- .isParameterText(0, "<PropertyString>");
-
- testFilter.runOnETAllPrim("year(PropertyDate) eq 2013")
- .is("<<year(<PropertyDate>)> eq <2013>>")
- .root().left()
- .isMethod(MethodKind.YEAR, 1)
- .isParameterText(0, "<PropertyDate>");
-
- testFilter.runOnETAllPrim("year(2013-09-25) eq 2013")
- .is("<<year(<2013-09-25>)> eq <2013>>")
- .root().left()
- .isMethod(MethodKind.YEAR, 1)
- .isParameterText(0, "<2013-09-25>");
-
- testFilter.runOnETAllPrim("year(PropertyDateTimeOffset) eq 2013")
- .is("<<year(<PropertyDateTimeOffset>)> eq <2013>>")
- .root().left()
- .isMethod(MethodKind.YEAR, 1)
- .isParameterText(0, "<PropertyDateTimeOffset>");
-
- testFilter.runOnETAllPrim("year(2013-09-25T12:34:56.123456789012-10:24) eq 2013")
- .is("<<year(<2013-09-25T12:34:56.123456789012-10:24>)> eq <2013>>")
- .root().left()
- .isMethod(MethodKind.YEAR, 1)
- .isParameterText(0, "<2013-09-25T12:34:56.123456789012-10:24>");
-
- testFilter.runOnETAllPrim("month(PropertyDate) eq 9")
- .is("<<month(<PropertyDate>)> eq <9>>")
- .root().left()
- .isMethod(MethodKind.MONTH, 1)
- .isParameterText(0, "<PropertyDate>");
-
- testFilter.runOnETAllPrim("month(2013-09-25) eq 9")
- .is("<<month(<2013-09-25>)> eq <9>>")
- .root().left()
- .isMethod(MethodKind.MONTH, 1)
- .isParameterText(0, "<2013-09-25>");
-
- testFilter.runOnETAllPrim("month(PropertyDateTimeOffset) eq 9")
- .is("<<month(<PropertyDateTimeOffset>)> eq <9>>")
- .root().left()
- .isMethod(MethodKind.MONTH, 1)
- .isParameterText(0, "<PropertyDateTimeOffset>");
-
- testFilter.runOnETAllPrim("month(2013-09-25T12:34:56.123456789012-10:24) eq 9")
- .is("<<month(<2013-09-25T12:34:56.123456789012-10:24>)> eq <9>>")
- .root().left()
- .isMethod(MethodKind.MONTH, 1)
- .isParameterText(0, "<2013-09-25T12:34:56.123456789012-10:24>");
-
- testFilter.runOnETAllPrim("day(PropertyDate) eq 25")
- .is("<<day(<PropertyDate>)> eq <25>>")
- .root().left()
- .isMethod(MethodKind.DAY, 1)
- .isParameterText(0, "<PropertyDate>");
-
- testFilter.runOnETAllPrim("day(2013-09-25) eq 25")
- .is("<<day(<2013-09-25>)> eq <25>>")
- .root().left()
- .isMethod(MethodKind.DAY, 1)
- .isParameterText(0, "<2013-09-25>");
-
- testFilter.runOnETAllPrim("day(PropertyDateTimeOffset) eq 25")
- .is("<<day(<PropertyDateTimeOffset>)> eq <25>>")
- .root().left()
- .isMethod(MethodKind.DAY, 1)
- .isParameterText(0, "<PropertyDateTimeOffset>");
-
- testFilter.runOnETAllPrim("day(2013-09-25T12:34:56.123456789012-10:24) eq 25")
- .is("<<day(<2013-09-25T12:34:56.123456789012-10:24>)> eq <25>>")
- .root().left()
- .isMethod(MethodKind.DAY, 1)
- .isParameterText(0, "<2013-09-25T12:34:56.123456789012-10:24>");
-
- testFilter.runOnETAllPrim("hour(PropertyDateTimeOffset) eq 2")
- .is("<<hour(<PropertyDateTimeOffset>)> eq <2>>")
- .root().left()
- .isMethod(MethodKind.HOUR, 1)
- .isParameterText(0, "<PropertyDateTimeOffset>");
-
- testFilter.runOnETAllPrim("hour(PropertyDateTimeOffset) eq 2")
- .is("<<hour(<PropertyDateTimeOffset>)> eq <2>>")
- .root().left()
- .isMethod(MethodKind.HOUR, 1)
- .isParameterText(0, "<PropertyDateTimeOffset>");
-
- testFilter.runOnETAllPrim("hour(2013-09-25T12:34:56.123456789012-10:24) eq 2")
- .is("<<hour(<2013-09-25T12:34:56.123456789012-10:24>)> eq <2>>")
- .root().left()
- .isMethod(MethodKind.HOUR, 1)
- .isParameterText(0, "<2013-09-25T12:34:56.123456789012-10:24>");
-
- testFilter.runOnETAllPrim("hour(PropertyTimeOfDay) eq 2")
- .is("<<hour(<PropertyTimeOfDay>)> eq <2>>")
- .root().left()
- .isMethod(MethodKind.HOUR, 1)
- .isParameterText(0, "<PropertyTimeOfDay>");
-
- testFilter.runOnETAllPrim("hour(12:34:55.123456789012) eq 12")
- .is("<<hour(<12:34:55.123456789012>)> eq <12>>")
- .root().left()
- .isMethod(MethodKind.HOUR, 1)
- .isParameterText(0, "<12:34:55.123456789012>");
-
- testFilter.runOnETAllPrim("minute(PropertyDateTimeOffset) eq 34")
- .is("<<minute(<PropertyDateTimeOffset>)> eq <34>>")
- .root().left()
- .isMethod(MethodKind.MINUTE, 1)
- .isParameterText(0, "<PropertyDateTimeOffset>");
-
- testFilter.runOnETAllPrim("minute(2013-09-25T12:34:56.123456789012-10:24) eq 34")
- .is("<<minute(<2013-09-25T12:34:56.123456789012-10:24>)> eq <34>>")
- .root().left()
- .isMethod(MethodKind.MINUTE, 1)
- .isParameterText(0, "<2013-09-25T12:34:56.123456789012-10:24>");
-
- testFilter.runOnETAllPrim("minute(PropertyTimeOfDay) eq 34")
- .is("<<minute(<PropertyTimeOfDay>)> eq <34>>")
- .root().left()
- .isMethod(MethodKind.MINUTE, 1)
- .isParameterText(0, "<PropertyTimeOfDay>");
-
- testFilter.runOnETAllPrim("minute(12:34:55.123456789012) eq 34")
- .is("<<minute(<12:34:55.123456789012>)> eq <34>>")
- .root().left()
- .isMethod(MethodKind.MINUTE, 1)
- .isParameterText(0, "<12:34:55.123456789012>");
-
- testFilter.runOnETAllPrim("second(PropertyDateTimeOffset) eq 56")
- .is("<<second(<PropertyDateTimeOffset>)> eq <56>>")
- .root().left()
- .isMethod(MethodKind.SECOND, 1)
- .isParameterText(0, "<PropertyDateTimeOffset>");
-
- testFilter.runOnETAllPrim("second(2013-09-25T12:34:56.123456789012-10:24) eq 56")
- .is("<<second(<2013-09-25T12:34:56.123456789012-10:24>)> eq <56>>")
- .root().left()
- .isMethod(MethodKind.SECOND, 1)
- .isParameterText(0, "<2013-09-25T12:34:56.123456789012-10:24>");
-
- testFilter.runOnETAllPrim("second(PropertyTimeOfDay) eq 56")
- .is("<<second(<PropertyTimeOfDay>)> eq <56>>")
- .root().left()
- .isMethod(MethodKind.SECOND, 1)
- .isParameterText(0, "<PropertyTimeOfDay>");
-
- testFilter.runOnETAllPrim("second(12:34:55.123456789012) eq 56")
- .is("<<second(<12:34:55.123456789012>)> eq <56>>")
- .root().left()
- .isMethod(MethodKind.SECOND, 1)
- .isParameterText(0, "<12:34:55.123456789012>");
-
- testFilter.runOnETAllPrim("fractionalseconds(PropertyDateTimeOffset) eq 123456789012")
- .is("<<fractionalseconds(<PropertyDateTimeOffset>)> eq <123456789012>>")
- .root().left()
- .isMethod(MethodKind.FRACTIONALSECONDS, 1)
- .isParameterText(0, "<PropertyDateTimeOffset>");
-
- testFilter.runOnETAllPrim("fractionalseconds(2013-09-25T12:34:56.123456789012-10:24) eq 123456789012")
- .is("<<fractionalseconds(<2013-09-25T12:34:56.123456789012-10:24>)> eq <123456789012>>")
- .root().left()
- .isMethod(MethodKind.FRACTIONALSECONDS, 1)
- .isParameterText(0, "<2013-09-25T12:34:56.123456789012-10:24>");
-
- testFilter.runOnETAllPrim("fractionalseconds(PropertyTimeOfDay) eq 123456789012")
- .is("<<fractionalseconds(<PropertyTimeOfDay>)> eq <123456789012>>")
- .root().left()
- .isMethod(MethodKind.FRACTIONALSECONDS, 1)
- .isParameterText(0, "<PropertyTimeOfDay>");
-
- testFilter.runOnETAllPrim("fractionalseconds(12:34:55.123456789012) eq 123456789012")
- .is("<<fractionalseconds(<12:34:55.123456789012>)> eq <123456789012>>")
- .root().left()
- .isMethod(MethodKind.FRACTIONALSECONDS, 1)
- .isParameterText(0, "<12:34:55.123456789012>");
-
- testFilter.runOnETAllPrim("totalseconds(PropertyDuration) eq 4711")
- .is("<<totalseconds(<PropertyDuration>)> eq <4711>>")
- .root().left()
- .isMethod(MethodKind.TOTALSECONDS, 1)
- .isParameterText(0, "<PropertyDuration>");
-
- testFilter.runOnETAllPrim("totalseconds(duration'P10DT5H34M21.123456789012S') eq 4711")
- .is("<<totalseconds(<duration'P10DT5H34M21.123456789012S'>)> eq <4711>>")
- .root().left()
- .isMethod(MethodKind.TOTALSECONDS, 1)
- .isParameterText(0, "<duration'P10DT5H34M21.123456789012S'>");
-
- testFilter.runOnETAllPrim("date(PropertyDateTimeOffset) eq 2013-09-25")
- .is("<<date(<PropertyDateTimeOffset>)> eq <2013-09-25>>")
- .root().left()
- .isMethod(MethodKind.DATE, 1)
- .isParameterText(0, "<PropertyDateTimeOffset>");
-
- testFilter.runOnETAllPrim("date(2013-09-25T12:34:56.123456789012-10:24) eq 2013-09-25")
- .is("<<date(<2013-09-25T12:34:56.123456789012-10:24>)> eq <2013-09-25>>")
- .root().left()
- .isMethod(MethodKind.DATE, 1)
- .isParameterText(0, "<2013-09-25T12:34:56.123456789012-10:24>");
-
- testFilter.runOnETAllPrim("time(PropertyDateTimeOffset) eq 12:34:55.123456789012")
- .is("<<time(<PropertyDateTimeOffset>)> eq <12:34:55.123456789012>>")
- .root().left()
- .isMethod(MethodKind.TIME, 1)
- .isParameterText(0, "<PropertyDateTimeOffset>");
-
- testFilter.runOnETAllPrim("time(2013-09-25T12:34:56.123456789012-10:24) eq 12:34:55.123456789012")
- .is("<<time(<2013-09-25T12:34:56.123456789012-10:24>)> eq <12:34:55.123456789012>>")
- .root().left()
- .isMethod(MethodKind.TIME, 1)
- .isParameterText(0, "<2013-09-25T12:34:56.123456789012-10:24>");
-
- testFilter.runOnETAllPrim("round(PropertyDouble) eq 17")
- .is("<<round(<PropertyDouble>)> eq <17>>")
- .root().left()
- .isMethod(MethodKind.ROUND, 1)
- .isParameterText(0, "<PropertyDouble>");
-
- testFilter.runOnETAllPrim("round(17.45e1) eq 17")
- .is("<<round(<17.45e1>)> eq <17>>")
- .root().left()
- .isMethod(MethodKind.ROUND, 1)
- .isParameterText(0, "<17.45e1>");
-
- testFilter.runOnETAllPrim("round(PropertyDecimal) eq 17")
- .is("<<round(<PropertyDecimal>)> eq <17>>")
- .root().left()
- .isMethod(MethodKind.ROUND, 1)
- .isParameterText(0, "<PropertyDecimal>");
-
- testFilter.runOnETAllPrim("round(17.45) eq 17")
- .is("<<round(<17.45>)> eq <17>>")
- .root().left()
- .isMethod(MethodKind.ROUND, 1)
- .isParameterText(0, "<17.45>");
-
- testFilter.runOnETAllPrim("floor(PropertyDouble) eq 17")
- .is("<<floor(<PropertyDouble>)> eq <17>>")
- .root().left()
- .isMethod(MethodKind.FLOOR, 1)
- .isParameterText(0, "<PropertyDouble>");
-
- testFilter.runOnETAllPrim("floor(17.45e1) eq 17")
- .is("<<floor(<17.45e1>)> eq <17>>")
- .root().left()
- .isMethod(MethodKind.FLOOR, 1)
- .isParameterText(0, "<17.45e1>");
-
- testFilter.runOnETAllPrim("floor(PropertyDecimal) eq 17")
- .is("<<floor(<PropertyDecimal>)> eq <17>>")
- .root().left()
- .isMethod(MethodKind.FLOOR, 1)
- .isParameterText(0, "<PropertyDecimal>");
-
- testFilter.runOnETAllPrim("floor(17.45) eq 17")
- .is("<<floor(<17.45>)> eq <17>>")
- .root().left()
- .isMethod(MethodKind.FLOOR, 1)
- .isParameterText(0, "<17.45>");
-
- testFilter.runOnETAllPrim("ceiling(PropertyDouble) eq 18")
- .is("<<ceiling(<PropertyDouble>)> eq <18>>")
- .root().left()
- .isMethod(MethodKind.CEILING, 1)
- .isParameterText(0, "<PropertyDouble>");
-
- testFilter.runOnETAllPrim("ceiling(17.55e1) eq 18")
- .is("<<ceiling(<17.55e1>)> eq <18>>")
- .root().left()
- .isMethod(MethodKind.CEILING, 1)
- .isParameterText(0, "<17.55e1>");
-
- testFilter.runOnETAllPrim("ceiling(PropertyDecimal) eq 18")
- .is("<<ceiling(<PropertyDecimal>)> eq <18>>")
- .root().left()
- .isMethod(MethodKind.CEILING, 1)
- .isParameterText(0, "<PropertyDecimal>");
-
- testFilter.runOnETAllPrim("ceiling(17.55) eq 18")
- .is("<<ceiling(<17.55>)> eq <18>>")
- .root().left()
- .isMethod(MethodKind.CEILING, 1)
- .isParameterText(0, "<17.55>");
-
- testFilter.runOnETAllPrim("totaloffsetminutes(PropertyDateTimeOffset) eq 4711")
- .is("<<totaloffsetminutes(<PropertyDateTimeOffset>)> eq <4711>>")
- .root().left()
- .isMethod(MethodKind.TOTALOFFSETMINUTES, 1)
- .isParameterText(0, "<PropertyDateTimeOffset>");
-
- testFilter.runOnETAllPrim("totaloffsetminutes(2013-09-25T12:34:56.123456789012-10:24) eq 4711")
- .is("<<totaloffsetminutes(<2013-09-25T12:34:56.123456789012-10:24>)> eq <4711>>")
- .root().left()
- .isMethod(MethodKind.TOTALOFFSETMINUTES, 1)
- .isParameterText(0, "<2013-09-25T12:34:56.123456789012-10:24>");
-
- testFilter.runOnETAllPrim("mindatetime()")
- .is("<mindatetime()>")
- .isMethod(MethodKind.MINDATETIME, 0);
-
- testFilter.runOnETAllPrim("mindatetime() eq 2013-09-25T12:34:56.123456789012-10:24")
- .is("<<mindatetime()> eq <2013-09-25T12:34:56.123456789012-10:24>>")
- .root().left()
- .isMethod(MethodKind.MINDATETIME, 0);
-
- testFilter.runOnETAllPrim("maxdatetime()")
- .is("<maxdatetime()>")
- .isMethod(MethodKind.MAXDATETIME, 0);
-
- testFilter.runOnETAllPrim("maxdatetime() eq 2013-09-25T12:34:56.123456789012-10:24")
- .is("<<maxdatetime()> eq <2013-09-25T12:34:56.123456789012-10:24>>")
- .root().left()
- .isMethod(MethodKind.MAXDATETIME, 0);
-
- testFilter.runOnETAllPrim("now()")
- .is("<now()>")
- .isMethod(MethodKind.NOW, 0);
-
- testFilter.runOnETAllPrim("now() eq 2013-09-25T12:34:56.123456789012-10:24")
- .is("<<now()> eq <2013-09-25T12:34:56.123456789012-10:24>>")
- .root().left()
- .isMethod(MethodKind.NOW, 0);
-
- testFilter.runOnETTwoKeyNav("$it/PropertyString eq 'SomeString'")
- .is("<<$it/PropertyString> eq <'SomeString'>>")
- .root().left()
- .goPath()
- .first().isUriPathInfoKind(UriResourceKind.it)
- .isType(EntityTypeProvider.nameETTwoKeyNav, true)
- .n().isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false);
-
- testFilter.runOnCTTwoPrim("$it/PropertyString eq 'SomeString'")
- .is("<<$it/PropertyString> eq <'SomeString'>>")
- .root().left()
- .goPath()
- .first().isUriPathInfoKind(UriResourceKind.it)
- .isType(ComplexTypeProvider.nameCTTwoPrim, false)
- .n().isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false);
-
- testFilter.runOnString("$it eq 'Walldorf'")
- .is("<<$it> eq <'Walldorf'>>")
- .root().left()
- .goPath()
- .first().isUriPathInfoKind(UriResourceKind.it)
- .isType(PropertyProvider.nameString, false);
-
- testFilter.runOnString("endswith($it,'sap.com')")
- .is("<endswith(<$it>,<'sap.com'>)>")
- .isMethod(MethodKind.ENDSWITH, 2)
- .isParameterText(0, "<$it>")
- .isParameterText(1, "<'sap.com'>")
- .goParameter(0)
- .goPath()
- .first().isUriPathInfoKind(UriResourceKind.it)
- .isType(PropertyProvider.nameString, false);
-
- testFilter.runOnString("endswith($it,'sap.com') eq false")
- .is("<<endswith(<$it>,<'sap.com'>)> eq <false>>")
- .root().left()
- .isMethod(MethodKind.ENDSWITH, 2)
- .isParameterText(0, "<$it>")
- .isParameterText(1, "<'sap.com'>")
- .goParameter(0)
- .goPath()
- .first().isUriPathInfoKind(UriResourceKind.it)
- .isType(PropertyProvider.nameString, false);
-
- testFilter.runOnETTwoKeyNav("endswith($it/CollPropertyString,'sap.com')")
- .is("<endswith(<$it/CollPropertyString>,<'sap.com'>)>")
- .isMethod(MethodKind.ENDSWITH, 2)
- .isParameterText(0, "<$it/CollPropertyString>")
- .isParameterText(1, "<'sap.com'>")
- .goParameter(0)
- .goPath()
- .first().isUriPathInfoKind(UriResourceKind.it)
- .isType(EntityTypeProvider.nameETTwoKeyNav, true)
- .n().isPrimitiveProperty("CollPropertyString", PropertyProvider.nameString, true);
-
- testFilter.runOnETTwoKeyNav("PropertyComp/PropertyComp/PropertyInt16 eq $root"
- + "/ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/PropertyInt16")
- .is("<<PropertyComp/PropertyComp/PropertyInt16> eq <$root/ESTwoKeyNav/PropertyInt16>>")
- .root().left()
- .goPath()
- .first().isComplex("PropertyComp").isType(ComplexTypeProvider.nameCTPrimComp, false)
- .n().isComplex("PropertyComp").isType(ComplexTypeProvider.nameCTAllPrim, false)
- .n().isPrimitiveProperty("PropertyInt16", PropertyProvider.nameInt16, false)
- .goUpFilterValidator()
- .root().right()
- .goPath()
- .first().isUriPathInfoKind(UriResourceKind.root)
- .n().isEntitySet("ESTwoKeyNav")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isKeyPredicate(1, "PropertyString", "'2'")
- .n().isPrimitiveProperty("PropertyInt16", PropertyProvider.nameInt16, false);
-
- testFilter.runOnETKeyNav("cast(olingo.odata.test1.ETBaseTwoKeyNav)")
- .is("<cast(<olingo.odata.test1.ETBaseTwoKeyNav>)>")
- .root()
- .isMethod(MethodKind.CAST, 1)
- .isParameterText(0, "<olingo.odata.test1.ETBaseTwoKeyNav>")
- .goParameter(0)
- .isTypedLiteral(EntityTypeProvider.nameETBaseTwoKeyNav);
-
- testFilter.runOnETKeyNav("cast(PropertyCompTwoPrim,olingo.odata.test1.CTBase)")
- .is("<cast(<PropertyCompTwoPrim>,<olingo.odata.test1.CTBase>)>")
- .root()
- .isMethod(MethodKind.CAST, 2)
- .isParameterText(0, "<PropertyCompTwoPrim>")
- .isParameterText(1, "<olingo.odata.test1.CTBase>")
- .goParameter(0).goPath().first()
- .isComplex("PropertyCompTwoPrim").isType(ComplexTypeProvider.nameCTTwoPrim, false)
- .goUpFilterValidator()
- .root()
- .goParameter(1)
- .isTypedLiteral(ComplexTypeProvider.nameCTBase);
-
- testFilter.runOnETKeyNav("cast($it,olingo.odata.test1.CTBase)")
- .is("<cast(<$it>,<olingo.odata.test1.CTBase>)>")
- .root()
- .isMethod(MethodKind.CAST, 2)
- .isParameterText(0, "<$it>")
- .isParameterText(1, "<olingo.odata.test1.CTBase>")
- .goParameter(0).goPath().first()
- .isIt().isType(EntityTypeProvider.nameETKeyNav, false)
- .goUpFilterValidator()
- .root()
- .goParameter(1).isTypedLiteral(ComplexTypeProvider.nameCTBase);
-
- testFilter.runOnETKeyNav("cast($it,olingo.odata.test1.CTBase) eq cast($it,olingo.odata.test1.CTBase)"
- )
- .is("<<cast(<$it>,<olingo.odata.test1.CTBase>)> eq <cast(<$it>,<olingo.odata.test1.CTBase>)>>")
- .root().left()
- .isMethod(MethodKind.CAST, 2)
- .isParameterText(0, "<$it>")
- .isParameterText(1, "<olingo.odata.test1.CTBase>")
- .goParameter(0).goPath().first()
- .isIt().isType(EntityTypeProvider.nameETKeyNav, false)
- .goUpFilterValidator()
- .root().left()
- .goParameter(1).isTypedLiteral(ComplexTypeProvider.nameCTBase)
- .root().right()
- .isMethod(MethodKind.CAST, 2)
- .isParameterText(0, "<$it>")
- .isParameterText(1, "<olingo.odata.test1.CTBase>")
- .goParameter(0).goPath().first()
- .isIt().isType(EntityTypeProvider.nameETKeyNav, false)
- .goUpFilterValidator()
- .root().right()
- .goParameter(1).isTypedLiteral(ComplexTypeProvider.nameCTBase);
-
- testFilter.runOnInt32("cast(Edm.Int32)")
- .is("<cast(<Edm.Int32>)>")
- .isMethod(MethodKind.CAST, 1)
- .goParameter(0).isTypedLiteral(PropertyProvider.nameInt32);
-
- testFilter.runOnDateTimeOffset("cast(Edm.DateTimeOffset)")
- .is("<cast(<Edm.DateTimeOffset>)>")
- .isMethod(MethodKind.CAST, 1)
- .goParameter(0).isTypedLiteral(PropertyProvider.nameDateTimeOffset);
-
- testFilter.runOnDuration("cast(Edm.Duration)")
- .is("<cast(<Edm.Duration>)>")
- .isMethod(MethodKind.CAST, 1)
- .goParameter(0).isTypedLiteral(PropertyProvider.nameDuration);
-
- testFilter.runOnTimeOfDay("cast(Edm.TimeOfDay)")
- .is("<cast(<Edm.TimeOfDay>)>")
- .isMethod(MethodKind.CAST, 1)
- .goParameter(0).isTypedLiteral(PropertyProvider.nameTimeOfDay);
-
- testFilter.runOnETKeyNav("cast(CollPropertyInt16,Edm.Int32)")
- .is("<cast(<CollPropertyInt16>,<Edm.Int32>)>")
- .isMethod(MethodKind.CAST, 2)
- .goParameter(0).goPath().first()
- .isPrimitiveProperty("CollPropertyInt16", PropertyProvider.nameInt16, true)
- .goUpFilterValidator().root()
- .goParameter(1).isTypedLiteral(PropertyProvider.nameInt32);
-
- testFilter.runOnETTwoKeyNav(
- "cast(PropertyComp/PropertyComp/PropertyDateTimeOffset,Edm.DateTimeOffset)")
- .is("<cast(<PropertyComp/PropertyComp/PropertyDateTimeOffset>,<Edm.DateTimeOffset>)>")
- .isMethod(MethodKind.CAST, 2)
- .goParameter(0).goPath()
- .first().isComplexProperty("PropertyComp", ComplexTypeProvider.nameCTPrimComp, false)
- .n().isComplexProperty("PropertyComp", ComplexTypeProvider.nameCTAllPrim, false)
- .n().isPrimitiveProperty("PropertyDateTimeOffset", PropertyProvider.nameDateTimeOffset, false)
- .goUpFilterValidator().root()
- .goParameter(1).isTypedLiteral(PropertyProvider.nameDateTimeOffset);
-
- testFilter.runOnETTwoKeyNav("cast(PropertyComp/PropertyComp/PropertyDuration,Edm.Duration)")
- .is("<cast(<PropertyComp/PropertyComp/PropertyDuration>,<Edm.Duration>)>")
- .isMethod(MethodKind.CAST, 2)
- .goParameter(0).goPath()
- .first().isComplexProperty("PropertyComp", ComplexTypeProvider.nameCTPrimComp, false)
- .n().isComplexProperty("PropertyComp", ComplexTypeProvider.nameCTAllPrim, false)
- .n().isPrimitiveProperty("PropertyDuration", PropertyProvider.nameDuration, false)
- .goUpFilterValidator().root()
- .goParameter(1).isTypedLiteral(PropertyProvider.nameDuration);
-
- testFilter.runOnETTwoKeyNav("cast(PropertyComp/PropertyComp/PropertyTimeOfDay,Edm.TimeOfDay)")
- .is("<cast(<PropertyComp/PropertyComp/PropertyTimeOfDay>,<Edm.TimeOfDay>)>")
- .isMethod(MethodKind.CAST, 2)
- .goParameter(0).goPath()
- .first().isComplexProperty("PropertyComp", ComplexTypeProvider.nameCTPrimComp, false)
- .n().isComplexProperty("PropertyComp", ComplexTypeProvider.nameCTAllPrim, false)
- .n().isPrimitiveProperty("PropertyTimeOfDay", PropertyProvider.nameTimeOfDay, false)
- .goUpFilterValidator().root()
- .goParameter(1).isTypedLiteral(PropertyProvider.nameTimeOfDay);
-
- testFilter.runOnETKeyNav("cast(PropertyCompAllPrim,olingo.odata.test1.CTTwoPrim)")
- .is("<cast(<PropertyCompAllPrim>,<olingo.odata.test1.CTTwoPrim>)>")
- .isMethod(MethodKind.CAST, 2)
- .goParameter(0).goPath()
- .first().isComplexProperty("PropertyCompAllPrim", ComplexTypeProvider.nameCTAllPrim, false)
- .goUpFilterValidator().root()
- .goParameter(1).isTypedLiteral(ComplexTypeProvider.nameCTTwoPrim);
-
- // testFilter.runOnETKeyNav(" Xcast(PropertyCompTwoPrim,olingo.odata.test1.CTAllPrim)");
-
- testFilter.runOnETKeyNav("cast(NavPropertyETKeyNavOne,olingo.odata.test1.ETKeyPrimNav)")
- .is("<cast(<NavPropertyETKeyNavOne>,<olingo.odata.test1.ETKeyPrimNav>)>")
- .isMethod(MethodKind.CAST, 2)
- .goParameter(0).goPath()
- .first().isNavProperty("NavPropertyETKeyNavOne", EntityTypeProvider.nameETKeyNav, false)
- .goUpFilterValidator().root()
- .goParameter(1).isTypedLiteral(EntityTypeProvider.nameETKeyPrimNav);
-
- testFilter.runOnETKeyNavEx("cast(NavPropertyETKeyPrimNavOne,olingo.odata.test1.ETKeyNav)")
- .isExSemantic(UriParserSemanticException.MessageKeys.EXPRESSION_PROPERTY_NOT_IN_TYPE);
- testFilter.runOnETKeyNav("any()")
- .isMember().goPath().first().isUriPathInfoKind(UriResourceKind.lambdaAny);
- }
-
- @Test
- public void runLamdbaFunctions() throws ExpressionVisitException, ODataApplicationException, UriParserException {
-
- testFilter.runOnETKeyNav("any(d:d/PropertyInt16 eq 1)")
- .is("<<ANY;<<d/PropertyInt16> eq <1>>>>")
- .root().goPath()
- .first().isUriPathInfoKind(UriResourceKind.lambdaAny)
- .goLambdaExpression()
- .isBinary(BinaryOperatorKind.EQ)
- .left().goPath()
- .first().isUriPathInfoKind(UriResourceKind.lambdaVariable)
- .isType(EntityTypeProvider.nameETKeyNav, false)
- .n().isPrimitiveProperty("PropertyInt16", PropertyProvider.nameInt16, false);
-
- testFilter.runOnETKeyNav("NavPropertyETTwoKeyNavMany/any(d:d/PropertyString eq 'SomeString')")
- .is("<NavPropertyETTwoKeyNavMany/<ANY;<<d/PropertyString> eq <'SomeString'>>>>")
- .root().goPath()
- .first().isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, true)
- .n().isUriPathInfoKind(UriResourceKind.lambdaAny)
- .goLambdaExpression()
- .isBinary(BinaryOperatorKind.EQ)
- .left().goPath()
- .first().isUriPathInfoKind(UriResourceKind.lambdaVariable)
- .isType(EntityTypeProvider.nameETTwoKeyNav, false)
- .n().isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false);
-
- // TODO planned: lambda does not check if the previous path segment is a collection
- // testFilter.runOnETKeyNav("NavPropertyETTwoKeyNavOne/any(d:d/PropertyString eq 'SomeString')");
-
- testFilter.runOnETKeyNav("NavPropertyETTwoKeyNavMany/any()")
- .is("<NavPropertyETTwoKeyNavMany/<ANY;>>");
-
- testFilter.runOnETKeyNav("NavPropertyETTwoKeyNavOne/CollPropertyString/any(d:d eq 'SomeString')")
- .is("<NavPropertyETTwoKeyNavOne/CollPropertyString/<ANY;<<d> eq <'SomeString'>>>>")
- .root().goPath()
- .first().isNavProperty("NavPropertyETTwoKeyNavOne", EntityTypeProvider.nameETTwoKeyNav, false)
- .n().isPrimitiveProperty("CollPropertyString", PropertyProvider.nameString, true)
- .n().isUriPathInfoKind(UriResourceKind.lambdaAny)
- .goLambdaExpression()
- .isBinary(BinaryOperatorKind.EQ)
- .left().goPath()
- .first().isUriPathInfoKind(UriResourceKind.lambdaVariable)
- .isType(PropertyProvider.nameString, false);
-
- testFilter.runOnETKeyNav(" NavPropertyETTwoKeyNavOne/olingo.odata.test1.BFCETTwoKeyNavRTESTwoKeyNav()"
- + "/any(d:d/PropertyComp/PropertyInt16 eq 6)")
- .is("<NavPropertyETTwoKeyNavOne/BFCETTwoKeyNavRTESTwoKeyNav/<ANY;<<d/PropertyComp/PropertyInt16> eq <6>>>>")
- .root().goPath()
- .first().isNavProperty("NavPropertyETTwoKeyNavOne", EntityTypeProvider.nameETTwoKeyNav, false)
- .n().isFunction("BFCETTwoKeyNavRTESTwoKeyNav")
- .n().isUriPathInfoKind(UriResourceKind.lambdaAny)
- .goLambdaExpression()
- .isBinary(BinaryOperatorKind.EQ)
- .left().goPath()
- .first().isUriPathInfoKind(UriResourceKind.lambdaVariable)
- .isType(EntityTypeProvider.nameETTwoKeyNav, false)
- .n().isComplex("PropertyComp")
- .n().isPrimitiveProperty("PropertyInt16", PropertyProvider.nameInt16, false);
-
- testFilter.runOnETKeyNav("NavPropertyETTwoKeyNavMany/any(d:d/PropertyInt16 eq 1 or d/any"
- + "(e:e/CollPropertyString eq 'SomeString'))")
- .is("<NavPropertyETTwoKeyNavMany/<ANY;<<<d/PropertyInt16> eq <1>> or "
- + "<d/<ANY;<<e/CollPropertyString> eq <'SomeString'>>>>>>>")
- .root().goPath()
- .first().isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, true)
- .n().isUriPathInfoKind(UriResourceKind.lambdaAny)
- .goLambdaExpression()
- .root().isBinary(BinaryOperatorKind.OR)
- .root().left()
- .isBinary(BinaryOperatorKind.EQ)
- .left()
- .goPath()
- .first().isUriPathInfoKind(UriResourceKind.lambdaVariable)
- .isType(EntityTypeProvider.nameETTwoKeyNav, false)
- .n().isPrimitiveProperty("PropertyInt16", PropertyProvider.nameInt16, false)
- .goUpFilterValidator()
- .root().right()
- .goPath()
- .first().isUriPathInfoKind(UriResourceKind.lambdaVariable)
- .isType(EntityTypeProvider.nameETTwoKeyNav, false)
- .n().isUriPathInfoKind(UriResourceKind.lambdaAny)
- .goLambdaExpression()
- .root().left().goPath()
- .first().isUriPathInfoKind(UriResourceKind.lambdaVariable)
- .isType(EntityTypeProvider.nameETTwoKeyNav, false)
- .n().isPrimitiveProperty("CollPropertyString", PropertyProvider.nameString, true);
-
- testFilter.runOnETKeyNav("NavPropertyETTwoKeyNavMany/any(d:d/PropertyInt16 eq 1 or d/CollPropertyString/any"
- + "(e:e eq 'SomeString'))")
- .is("<NavPropertyETTwoKeyNavMany/<ANY;<<<d/PropertyInt16> eq <1>> or "
- + "<d/CollPropertyString/<ANY;<<e> eq <'SomeString'>>>>>>>")
- .root().goPath()
- .first().isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, true)
- .n().isUriPathInfoKind(UriResourceKind.lambdaAny)
- .goLambdaExpression()
- .root().isBinary(BinaryOperatorKind.OR)
- .root().left()
- .isBinary(BinaryOperatorKind.EQ)
- .left()
- .goPath()
- .first().isUriPathInfoKind(UriResourceKind.lambdaVariable)
- .isType(EntityTypeProvider.nameETTwoKeyNav, false)
- .n().isPrimitiveProperty("PropertyInt16", PropertyProvider.nameInt16, false)
- .goUpFilterValidator()
- .root().right()
- .goPath()
- .first().isUriPathInfoKind(UriResourceKind.lambdaVariable)
- .isType(EntityTypeProvider.nameETTwoKeyNav, false)
- .n().isType(PropertyProvider.nameString, true)
- .n().isUriPathInfoKind(UriResourceKind.lambdaAny)
- .goLambdaExpression()
- .root().left().goPath()
- .first().isUriPathInfoKind(UriResourceKind.lambdaVariable)
- .isType(PropertyProvider.nameString, false);
-
- testFilter
- .runOnETKeyNav("NavPropertyETTwoKeyNavMany/any(d:d/PropertyString eq 'SomeString' and d/CollPropertyString/any"
- + "(e:e eq d/PropertyString))")
- .is("<NavPropertyETTwoKeyNavMany/<ANY;<<<d/PropertyString> eq <'SomeString'>> and "
- + "<d/CollPropertyString/<ANY;<<e> eq <d/PropertyString>>>>>>>")
- .root().goPath()
- .first().isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, true)
- .n().isUriPathInfoKind(UriResourceKind.lambdaAny)
- .goLambdaExpression()
- .root().isBinary(BinaryOperatorKind.AND)
- .root().left()
- .isBinary(BinaryOperatorKind.EQ)
- .left()
- .goPath()
- .first().isUriPathInfoKind(UriResourceKind.lambdaVariable)
- .isType(EntityTypeProvider.nameETTwoKeyNav, false)
- .n().isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false)
- .goUpFilterValidator()
- .root().right()
- .goPath()
- .first().isUriPathInfoKind(UriResourceKind.lambdaVariable)
- .isType(EntityTypeProvider.nameETTwoKeyNav, false)
- .n().isType(PropertyProvider.nameString, true)
- .n().isUriPathInfoKind(UriResourceKind.lambdaAny)
- .goLambdaExpression()
- .root().left().goPath()
- .first().isUriPathInfoKind(UriResourceKind.lambdaVariable)
- .isType(PropertyProvider.nameString, false)
- .goUpFilterValidator()
- .root().right().goPath()
- .first().isUriPathInfoKind(UriResourceKind.lambdaVariable)
- .n().isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false);
-
- }
-
- @Test
- public void runIsOf() throws ExpressionVisitException, ODataApplicationException, UriParserException {
-
- testFilter.runOnETKeyNav("isof(olingo.odata.test1.ETTwoKeyNav)")
- .is("<isof(<olingo.odata.test1.ETTwoKeyNav>)>")
- .root()
- .isMethod(MethodKind.ISOF, 1)
- .goParameter(0).isTypedLiteral(EntityTypeProvider.nameETTwoKeyNav);
-
- testFilter.runOnETKeyNav("isof(olingo.odata.test1.ETBaseTwoKeyNav) eq true")
- .is("<<isof(<olingo.odata.test1.ETBaseTwoKeyNav>)> eq <true>>")
- .root().isBinary(BinaryOperatorKind.EQ)
- .left()
- .isMethod(MethodKind.ISOF, 1)
- .goParameter(0).isTypedLiteral(EntityTypeProvider.nameETBaseTwoKeyNav);
-
- testFilter
- .runOnETKeyNav("isof(olingo.odata.test1.ETBaseTwoKeyNav) eq true and PropertyComp/PropertyInt16 eq 1")
- .is("<<<isof(<olingo.odata.test1.ETBaseTwoKeyNav>)> eq <true>> and <<PropertyComp/PropertyInt16> eq <1>>>")
- .root().isBinary(BinaryOperatorKind.AND)
- .left().isBinary(BinaryOperatorKind.EQ)
- .left().isMethod(MethodKind.ISOF, 1)
- .goParameter(0).isTypedLiteral(EntityTypeProvider.nameETBaseTwoKeyNav);
-
- testFilter.runOnETKeyNav("isof(NavPropertyETKeyNavOne, olingo.odata.test1.ETKeyNav) eq true")
- .is("<<isof(<NavPropertyETKeyNavOne>,<olingo.odata.test1.ETKeyNav>)> eq <true>>")
- .root().isBinary(BinaryOperatorKind.EQ)
- .left().isMethod(MethodKind.ISOF, 2)
- .goParameter(0).goPath().isNavProperty("NavPropertyETKeyNavOne", EntityTypeProvider.nameETKeyNav, false)
- .goUpFilterValidator()
- .root().left().goParameter(1).isTypedLiteral(EntityTypeProvider.nameETKeyNav);
-
- testFilter.runOnETKeyNav("isof(PropertyCompTwoPrim,olingo.odata.test1.CTTwoPrim)")
- .is("<isof(<PropertyCompTwoPrim>,<olingo.odata.test1.CTTwoPrim>)>")
- .root().isMethod(MethodKind.ISOF, 2)
- .goParameter(0).goPath().isComplex("PropertyCompTwoPrim").goUpFilterValidator()
- .root().goParameter(1).isTypedLiteral(ComplexTypeProvider.nameCTTwoPrim);
-
- testFilter.runOnETKeyNav("isof(PropertyCompTwoPrim,olingo.odata.test1.CTTwoBase)")
- .is("<isof(<PropertyCompTwoPrim>,<olingo.odata.test1.CTTwoBase>)>")
- .root().isMethod(MethodKind.ISOF, 2)
- .goParameter(0).goPath().isComplex("PropertyCompTwoPrim").goUpFilterValidator()
- .root().goParameter(1).isTypedLiteral(ComplexTypeProvider.nameCTTwoBase);
-
- testFilter.runOnETKeyNav("isof(PropertyCompTwoPrim,olingo.odata.test1.CTTwoPrim) eq true")
- .is("<<isof(<PropertyCompTwoPrim>,<olingo.odata.test1.CTTwoPrim>)> eq <true>>")
- .root().left().isMethod(MethodKind.ISOF, 2)
- .goParameter(0).goPath().isComplex("PropertyCompTwoPrim").goUpFilterValidator()
- .root().left().goParameter(1).isTypedLiteral(ComplexTypeProvider.nameCTTwoPrim);
-
- testFilter.runOnETKeyNav("isof($it,olingo.odata.test1.CTTwoPrim)")
- .is("<isof(<$it>,<olingo.odata.test1.CTTwoPrim>)>")
- .root()
- .isMethod(MethodKind.ISOF, 2)
- .goParameter(0).goPath().isIt().goUpFilterValidator()
- .root().goParameter(1).isTypedLiteral(ComplexTypeProvider.nameCTTwoPrim);
-
- testFilter.runOnETKeyNav("isof($it,olingo.odata.test1.CTTwoBase) eq false")
- .is("<<isof(<$it>,<olingo.odata.test1.CTTwoBase>)> eq <false>>")
- .isBinary(BinaryOperatorKind.EQ)
- .root().left()
- .isMethod(MethodKind.ISOF, 2)
- .goParameter(0).goPath().isIt().goUpFilterValidator()
- .root().left().goParameter(1).isTypedLiteral(ComplexTypeProvider.nameCTTwoBase);
-
- testFilter.runOnETKeyNav("isof(PropertyComp/PropertyInt16,Edm.Int32)")
- .is("<isof(<PropertyComp/PropertyInt16>,<Edm.Int32>)>")
- .root()
- .isMethod(MethodKind.ISOF, 2)
- .goParameter(0).goPath()
- .first().isComplex("PropertyComp")
- .n().isPrimitiveProperty("PropertyInt16", PropertyProvider.nameInt16, false)
- .goUpFilterValidator()
- .root().goParameter(1).isTypedLiteral(PropertyProvider.nameInt32);
-
- testFilter.runOnETTwoKeyNav("isof(PropertyComp/PropertyComp/PropertyDateTimeOffset,Edm.DateTimeOffset)")
- .is("<isof(<PropertyComp/PropertyComp/PropertyDateTimeOffset>,<Edm.DateTimeOffset>)>")
- .root()
- .isMethod(MethodKind.ISOF, 2)
- .goParameter(0).goPath()
- .first().isComplex("PropertyComp")
- .n().isComplex("PropertyComp")
- .n().isPrimitiveProperty("PropertyDateTimeOffset", PropertyProvider.nameDateTimeOffset, false)
- .goUpFilterValidator()
- .root().goParameter(1).isTypedLiteral(PropertyProvider.nameDateTimeOffset);
-
- testFilter.runOnETTwoKeyNav("isof(PropertyComp/PropertyComp/PropertyTimeOfDay,Edm.TimeOfDay)")
- .is("<isof(<PropertyComp/PropertyComp/PropertyTimeOfDay>,<Edm.TimeOfDay>)>")
- .root()
- .isMethod(MethodKind.ISOF, 2)
- .goParameter(0).goPath()
- .first().isComplex("PropertyComp")
- .n().isComplex("PropertyComp")
- .n().isPrimitiveProperty("PropertyTimeOfDay", PropertyProvider.nameTimeOfDay, false)
- .goUpFilterValidator()
- .root().goParameter(1).isTypedLiteral(PropertyProvider.nameTimeOfDay);
-
- testFilter.runOnETTwoKeyNav(" isof(PropertyComp/PropertyComp/PropertyDuration,Edm.Duration)")
- .is("<isof(<PropertyComp/PropertyComp/PropertyDuration>,<Edm.Duration>)>")
- .root()
- .isMethod(MethodKind.ISOF, 2)
- .goParameter(0).goPath()
- .first().isComplex("PropertyComp")
- .n().isComplex("PropertyComp")
- .n().isPrimitiveProperty("PropertyDuration", PropertyProvider.nameDuration, false)
- .goUpFilterValidator()
- .root().goParameter(1).isTypedLiteral(PropertyProvider.nameDuration);
-
- testFilter.runOnETTwoKeyNav("isof(PropertyComp/PropertyComp/PropertyString,Edm.String)")
- .is("<isof(<PropertyComp/PropertyComp/PropertyString>,<Edm.String>)>")
- .root()
- .isMethod(MethodKind.ISOF, 2)
- .goParameter(0).goPath()
- .first().isComplex("PropertyComp")
- .n().isComplex("PropertyComp")
- .n().isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false)
- .goUpFilterValidator()
- .root().goParameter(1).isTypedLiteral(PropertyProvider.nameString);
-
- testFilter.runOnETTwoKeyNav("isof(PropertyComp/PropertyComp/PropertyString,Edm.Guid)")
- .is("<isof(<PropertyComp/PropertyComp/PropertyString>,<Edm.Guid>)>")
- .root()
- .isMethod(MethodKind.ISOF, 2)
- .goParameter(0).goPath()
- .first().isComplex("PropertyComp")
- .n().isComplex("PropertyComp")
- .n().isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false)
- .goUpFilterValidator()
- .root().goParameter(1).isTypedLiteral(PropertyProvider.nameGuid);
- }
-
- @Test
- public void testHas() throws ExpressionVisitException, ODataApplicationException, UriParserException {
-
- testFilter.runOnETMixEnumDefCollComp("PropertyEnumString has olingo.odata.test1.ENString'String1'")
- .is("<<PropertyEnumString> has <olingo.odata.test1.ENString<String1>>>")
- .isBinary(BinaryOperatorKind.HAS)
- .root().left().goPath().isComplex("PropertyEnumString").isType(EnumTypeProvider.nameENString)
- .goUpFilterValidator()
- .root().right().isEnum(EnumTypeProvider.nameENString, Arrays.asList("String1"));
-
- testFilter.runOnETMixEnumDefCollComp(
- "PropertyCompMixedEnumDef/PropertyEnumString has olingo.odata.test1.ENString'String2'")
- .is("<<PropertyCompMixedEnumDef/PropertyEnumString> has <olingo.odata.test1.ENString<String2>>>")
- .isBinary(BinaryOperatorKind.HAS)
- .root().left().goPath()
- .first().isComplex("PropertyCompMixedEnumDef")
- .n().isComplex("PropertyEnumString").isType(EnumTypeProvider.nameENString)
- .isType(EnumTypeProvider.nameENString)
- .goUpFilterValidator()
- .root().right().isEnum(EnumTypeProvider.nameENString, Arrays.asList("String2"));
-
- testFilter
- .runOnETMixEnumDefCollComp(
- "PropertyCompMixedEnumDef/PropertyEnumString has olingo.odata.test1.ENString'String2' eq true")
- .is("<<<PropertyCompMixedEnumDef/PropertyEnumString> has " +
- "<olingo.odata.test1.ENString<String2>>> eq <true>>")
- .isBinary(BinaryOperatorKind.EQ)
- .root().left()
- .isBinary(BinaryOperatorKind.HAS)
- .root().left().left().goPath()
- .first().isComplex("PropertyCompMixedEnumDef")
- .n().isComplex("PropertyEnumString").isType(EnumTypeProvider.nameENString)
- .goUpFilterValidator()
- .root().left().right().isEnum(EnumTypeProvider.nameENString, Arrays.asList("String2"));
-
- testFilter.runOnETMixEnumDefCollComp("PropertyEnumString has olingo.odata.test1.ENString'String3'")
- .is("<<PropertyEnumString> has <olingo.odata.test1.ENString<String3>>>")
- .isBinary(BinaryOperatorKind.HAS)
- .root().left().goPath()
- .first().isComplex("PropertyEnumString").isType(EnumTypeProvider.nameENString)
- .isType(EnumTypeProvider.nameENString)
- .goUpFilterValidator()
- .root().right().isEnum(EnumTypeProvider.nameENString, Arrays.asList("String3"));
-
- testFilter.runOnETMixEnumDefCollComp("PropertyEnumString has olingo.odata.test1.ENString'String,String3'")
- .is("<<PropertyEnumString> has <olingo.odata.test1.ENString<String,String3>>>")
- .isBinary(BinaryOperatorKind.HAS)
- .root().left().goPath()
- .first().isComplex("PropertyEnumString").isType(EnumTypeProvider.nameENString)
- .isType(EnumTypeProvider.nameENString)
- .goUpFilterValidator()
- .root().right().isEnum(EnumTypeProvider.nameENString, Arrays.asList("String", "String3"));
-
- testFilter.runOnETMixEnumDefCollComp("PropertyEnumString has null")
- .is("<<PropertyEnumString> has <null>>")
- .root()
- .isBinary(BinaryOperatorKind.HAS)
- .root().left().goPath()
- .first().isComplex("PropertyEnumString").isType(EnumTypeProvider.nameENString).goUpFilterValidator()
- .root().right().isNull();
-
- testFilter.runOnETTwoKeyNav("endswith(PropertyComp/PropertyComp/PropertyString,'dorf')")
- .is("<endswith(<PropertyComp/PropertyComp/PropertyString>,<'dorf'>)>")
- .isMethod(MethodKind.ENDSWITH, 2)
- .goParameter(0).goPath()
- .first().isComplex("PropertyComp")
- .n().isComplex("PropertyComp")
- .n().isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false).goUpFilterValidator()
- .root().goParameter(1).isLiteral("'dorf'");
-
- testFilter.runOnETTwoKeyNav("endswith(PropertyComp/PropertyComp/PropertyString,'dorf') eq true")
- .is("<<endswith(<PropertyComp/PropertyComp/PropertyString>,<'dorf'>)> eq <true>>")
- .isBinary(BinaryOperatorKind.EQ)
- .left().isMethod(MethodKind.ENDSWITH, 2)
- .goParameter(0).goPath()
- .first().isComplex("PropertyComp")
- .n().isComplex("PropertyComp")
- .n().isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false).goUpFilterValidator()
- .root().left().goParameter(1).isLiteral("'dorf'");
-
- testFilter.runOnETTwoKeyNav("endswith('Walldorf','dorf')")
- .is("<endswith(<'Walldorf'>,<'dorf'>)>")
- .isMethod(MethodKind.ENDSWITH, 2)
- .goParameter(0).isLiteral("'Walldorf'")
- .root().goParameter(1).isLiteral("'dorf'");
-
- testFilter.runOnETTwoKeyNav("endswith('Walldorf','dorf') eq true")
- .is("<<endswith(<'Walldorf'>,<'dorf'>)> eq <true>>")
- .isBinary(BinaryOperatorKind.EQ)
- .left().isMethod(MethodKind.ENDSWITH, 2)
- .goParameter(0).isLiteral("'Walldorf'")
- .root().left().goParameter(1).isLiteral("'dorf'");
-
- testFilter.runOnETKeyNav("startswith(PropertyCompAllPrim/PropertyString,'Wall')")
- .is("<startswith(<PropertyCompAllPrim/PropertyString>,<'Wall'>)>")
- .isMethod(MethodKind.STARTSWITH, 2)
- .goParameter(0).goPath()
- .first().isComplex("PropertyCompAllPrim")
- .n().isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false).goUpFilterValidator()
- .root().goParameter(1).isLiteral("'Wall'");
-
- testFilter.runOnETKeyNav("startswith(PropertyCompAllPrim/PropertyString,'Wall') eq true")
- .is("<<startswith(<PropertyCompAllPrim/PropertyString>,<'Wall'>)> eq <true>>")
- .isBinary(BinaryOperatorKind.EQ)
- .left().isMethod(MethodKind.STARTSWITH, 2)
- .goParameter(0).goPath()
- .first().isComplex("PropertyCompAllPrim")
- .n().isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false).goUpFilterValidator()
- .root().left().goParameter(1).isLiteral("'Wall'");
-
- testFilter.runOnETKeyNav("startswith('Walldorf','Wall')")
- .is("<startswith(<'Walldorf'>,<'Wall'>)>")
- .isMethod(MethodKind.STARTSWITH, 2)
- .goParameter(0).isLiteral("'Walldorf'")
- .root().goParameter(1).isLiteral("'Wall'");
-
- testFilter.runOnETKeyNav("startswith('Walldorf','Wall') eq true")
- .is("<<startswith(<'Walldorf'>,<'Wall'>)> eq <true>>")
- .isBinary(BinaryOperatorKind.EQ)
- .left().isMethod(MethodKind.STARTSWITH, 2)
- .goParameter(0).isLiteral("'Walldorf'")
- .root().left().goParameter(1).isLiteral("'Wall'");
-
- testFilter.runOnETTwoKeyNav("contains(PropertyComp/PropertyComp/PropertyString,'Wall')")
- .is("<contains(<PropertyComp/PropertyComp/PropertyString>,<'Wall'>)>")
- .isMethod(MethodKind.CONTAINS, 2)
- .goParameter(0).goPath()
- .first().isComplex("PropertyComp")
- .n().isComplex("PropertyComp")
- .n().isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false).goUpFilterValidator()
- .root().goParameter(1).isLiteral("'Wall'");
-
- testFilter.runOnETTwoKeyNav("contains(PropertyComp/PropertyComp/PropertyString,'Wall') eq true")
- .is("<<contains(<PropertyComp/PropertyComp/PropertyString>,<'Wall'>)> eq <true>>")
- .isBinary(BinaryOperatorKind.EQ)
- .left().isMethod(MethodKind.CONTAINS, 2)
- .goParameter(0).goPath()
- .first().isComplex("PropertyComp")
- .n().isComplex("PropertyComp")
- .n().isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false).goUpFilterValidator()
- .root().left().goParameter(1).isLiteral("'Wall'");
-
- testFilter.runOnETTwoKeyNav("contains('Walldorf','Wall')")
- .is("<contains(<'Walldorf'>,<'Wall'>)>")
- .isMethod(MethodKind.CONTAINS, 2)
- .goParameter(0).isLiteral("'Walldorf'")
- .root().goParameter(1).isLiteral("'Wall'");
-
- testFilter.runOnETTwoKeyNav("contains('Walldorf','Wall') eq true")
- .is("<<contains(<'Walldorf'>,<'Wall'>)> eq <true>>")
- .isBinary(BinaryOperatorKind.EQ)
- .left().isMethod(MethodKind.CONTAINS, 2)
- .goParameter(0).isLiteral("'Walldorf'")
- .root().left().goParameter(1).isLiteral("'Wall'");
-
- testFilter.runOnETAllPrim("olingo.odata.test1.UFCRTCTTwoPrimParam(ParameterInt16=null,ParameterString=null)")
- .goPath()
- .isFunction("UFCRTCTTwoPrimParam")
- .isParameter(0, "ParameterInt16", "null")
- .isParameter(1, "ParameterString", "null");
-
- testFilter.runOnETAllPrim("PropertyBoolean eq true")
- .is("<<PropertyBoolean> eq <true>>")
- .isBinary(BinaryOperatorKind.EQ)
- .root().left().goPath().isPrimitiveProperty("PropertyBoolean", PropertyProvider.nameBoolean, false)
- .goUpFilterValidator()
- .root().right().isTrue();
-
- testFilter.runOnETAllPrim("PropertyBoolean eq 2")
- .is("<<PropertyBoolean> eq <2>>");
-
- testFilter.runOnETAllPrim("PropertyDecimal eq 1.25")
- .is("<<PropertyDecimal> eq <1.25>>")
- .isBinary(BinaryOperatorKind.EQ)
- .root().left().goPath().isPrimitiveProperty("PropertyDecimal", PropertyProvider.nameDecimal, false)
- .goUpFilterValidator()
- .root().right().isLiteral("1.25");
-
- testFilter.runOnETAllPrim("PropertyDouble eq 1.5")
- .is("<<PropertyDouble> eq <1.5>>")
- .isBinary(BinaryOperatorKind.EQ)
- .root().left().goPath().isPrimitiveProperty("PropertyDouble", PropertyProvider.nameDouble, false)
- .goUpFilterValidator()
- .root().right().isLiteral("1.5");
-
- testFilter.runOnETAllPrim("PropertySingle eq 1.5")
- .is("<<PropertySingle> eq <1.5>>")
- .isBinary(BinaryOperatorKind.EQ)
- .root().left().goPath().isPrimitiveProperty("PropertySingle", PropertyProvider.nameSingle, false)
- .goUpFilterValidator()
- .root().right().isLiteral("1.5");
-
- testFilter.runOnETAllPrim("PropertySByte eq -128")
- .is("<<PropertySByte> eq <-128>>")
- .isBinary(BinaryOperatorKind.EQ)
- .root().left().goPath().isPrimitiveProperty("PropertySByte", PropertyProvider.nameSByte, false)
- .goUpFilterValidator()
- .root().right().isLiteral("-128");
-
- testFilter.runOnETAllPrim("PropertyByte eq 255")
- .is("<<PropertyByte> eq <255>>")
- .isBinary(BinaryOperatorKind.EQ)
- .root().left().goPath().isPrimitiveProperty("PropertyByte",
- PropertyProvider.nameByte, false).goUpFilterValidator()
- .root().right().isLiteral("255");
-
- testFilter.runOnETAllPrim("PropertyInt16 eq 32767")
- .is("<<PropertyInt16> eq <32767>>")
- .isBinary(BinaryOperatorKind.EQ)
- .root().left().goPath().isPrimitiveProperty("PropertyInt16", PropertyProvider.nameInt16, false)
- .goUpFilterValidator()
- .root().right().isLiteral("32767");
-
- testFilter.runOnETAllPrim("PropertyInt32 eq 2147483647")
- .is("<<PropertyInt32> eq <2147483647>>")
- .isBinary(BinaryOperatorKind.EQ)
- .root().left().goPath().isPrimitiveProperty("PropertyInt32", PropertyProvider.nameInt32, false)
- .goUpFilterValidator()
- .root().right().isLiteral("2147483647");
-
- testFilter.runOnETAllPrim("PropertyInt64 eq 9223372036854775807")
- .is("<<PropertyInt64> eq <9223372036854775807>>")
- .isBinary(BinaryOperatorKind.EQ)
- .root().left().goPath().isPrimitiveProperty("PropertyInt64", PropertyProvider.nameInt64, false)
- .goUpFilterValidator()
- .root().right().isLiteral("9223372036854775807");
-
- testFilter.runOnETAllPrim("PropertyDate eq 2013-09-25")
- .is("<<PropertyDate> eq <2013-09-25>>")
- .isBinary(BinaryOperatorKind.EQ)
- .root().left().goPath().isPrimitiveProperty("PropertyDate", PropertyProvider.nameDate, false)
- .goUpFilterValidator()
- .root().right().isLiteral("2013-09-25");
-
- testFilter.runOnETAllPrim("PropertyDateTimeOffset eq 2013-09-25T12:34:56.123456789012-10:24")
- .is("<<PropertyDateTimeOffset> eq <2013-09-25T12:34:56.123456789012-10:24>>")
- .isBinary(BinaryOperatorKind.EQ)
- .root().left().goPath()
- .isPrimitiveProperty("PropertyDateTimeOffset", PropertyProvider.nameDateTimeOffset, false)
- .goUpFilterValidator()
- .root().right().isLiteral("2013-09-25T12:34:56.123456789012-10:24");
-
- testFilter.runOnETAllPrim("PropertyDuration eq duration'P10DT5H34M21.123456789012S'")
- .is("<<PropertyDuration> eq <duration'P10DT5H34M21.123456789012S'>>")
- .isBinary(BinaryOperatorKind.EQ)
- .root().left().goPath().isPrimitiveProperty("PropertyDuration", PropertyProvider.nameDuration, false)
- .goUpFilterValidator()
- .root().right().isLiteral("duration'P10DT5H34M21.123456789012S'");
-
- testFilter.runOnETAllPrim("PropertyGuid eq 005056A5-09B1-1ED3-89BD-FB81372CCB33")
- .is("<<PropertyGuid> eq <005056A5-09B1-1ED3-89BD-FB81372CCB33>>")
- .isBinary(BinaryOperatorKind.EQ)
- .root().left().goPath().isPrimitiveProperty("PropertyGuid", PropertyProvider.nameGuid, false)
- .goUpFilterValidator()
- .root().right().isLiteral("005056A5-09B1-1ED3-89BD-FB81372CCB33");
-
- testFilter.runOnETAllPrim("PropertyString eq 'somestring'")
- .is("<<PropertyString> eq <'somestring'>>")
- .isBinary(BinaryOperatorKind.EQ)
- .root().left().goPath().isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false)
- .goUpFilterValidator()
- .root().right().isLiteral("'somestring'");
-
- testFilter.runOnETAllPrim("PropertyTimeOfDay eq 12:34:55.12345678901")
- .is("<<PropertyTimeOfDay> eq <12:34:55.12345678901>>")
- .isBinary(BinaryOperatorKind.EQ)
- .root().left().goPath().isPrimitiveProperty("PropertyTimeOfDay", PropertyProvider.nameTimeOfDay, false)
- .goUpFilterValidator()
- .root().right().isLiteral("12:34:55.12345678901");
-
- testFilter.runOnETMixEnumDefCollComp("PropertyEnumString eq olingo.odata.test1.ENString'String1'")
- .is("<<PropertyEnumString> eq <olingo.odata.test1.ENString<String1>>>")
- .isBinary(BinaryOperatorKind.EQ)
- .root().left().goPath().isComplex("PropertyEnumString").isType(EnumTypeProvider.nameENString)
- .goUpFilterValidator()
- .root().right().isEnum(EnumTypeProvider.nameENString, Arrays.asList("String1"));
-
- testFilter.runOnETMixEnumDefCollComp("PropertyEnumString eq olingo.odata.test1.ENString'String2'")
- .is("<<PropertyEnumString> eq <olingo.odata.test1.ENString<String2>>>")
- .isBinary(BinaryOperatorKind.EQ)
- .root().left().goPath().isComplex("PropertyEnumString").isType(EnumTypeProvider.nameENString)
- .goUpFilterValidator()
- .root().right().isEnum(EnumTypeProvider.nameENString, Arrays.asList("String2"));
-
- testFilter.runOnETMixEnumDefCollComp(
- "PropertyCompMixedEnumDef/PropertyEnumString eq olingo.odata.test1.ENString'String3'")
- .is("<<PropertyCompMixedEnumDef/PropertyEnumString> eq <olingo.odata.test1.ENString<String3>>>")
- .isBinary(BinaryOperatorKind.EQ)
- .root().left().goPath()
- .first().isComplex("PropertyCompMixedEnumDef")
- .n().isComplex("PropertyEnumString").isType(EnumTypeProvider.nameENString).goUpFilterValidator()
- .root().right().isEnum(EnumTypeProvider.nameENString, Arrays.asList("String3"));
-
- testFilter
- .runOnETMixEnumDefCollComp(
- "PropertyCompMixedEnumDef/PropertyEnumString eq " +
- "PropertyCompMixedEnumDef/PropertyEnumString")
- .is("<<PropertyCompMixedEnumDef/PropertyEnumString> eq " +
- "<PropertyCompMixedEnumDef/PropertyEnumString>>")
- .isBinary(BinaryOperatorKind.EQ)
- .root().left().goPath()
- .first().isComplex("PropertyCompMixedEnumDef")
- .n().isComplex("PropertyEnumString").isType(EnumTypeProvider.nameENString).goUpFilterValidator()
- .root().right().goPath()
- .first().isComplex("PropertyCompMixedEnumDef")
- .n().isComplex("PropertyEnumString").isType(EnumTypeProvider.nameENString).goUpFilterValidator();
-
- }
-
- @Test
- public void testOrderby() throws UriParserException, UnsupportedEncodingException {
-
- testFilter.runOrderByOnETTwoKeyNav("olingo.odata.test1.UFCRTETAllPrimTwoParam("
- + "ParameterString=@ParamStringAlias,ParameterInt16=@ParamInt16Alias)/PropertyString eq 'SomeString'")
- .isSortOrder(0, false)
- .goOrder(0).isBinary(BinaryOperatorKind.EQ).left().goPath()
- .first().isFunction("UFCRTETAllPrimTwoParam").goUpFilterValidator()
- .goOrder(0).right().isLiteral("'SomeString'");
-
- testFilter.runOrderByOnETTwoKeyNav("olingo.odata.test1.UFCRTETAllPrimTwoParam("
- + "ParameterString=@ParamStringAlias,ParameterInt16=@ParamInt16Alias)/PropertyString eq 'SomeString' asc")
- .isSortOrder(0, false)
- .goOrder(0).isBinary(BinaryOperatorKind.EQ).left().goPath()
- .first().isFunction("UFCRTETAllPrimTwoParam").goUpFilterValidator()
- .goOrder(0).right().isLiteral("'SomeString'");
-
- testFilter.runOrderByOnETTwoKeyNav("olingo.odata.test1.UFCRTETAllPrimTwoParam("
- + "ParameterString=@ParamStringAlias,ParameterInt16=@ParamInt16Alias)/PropertyString eq 'SomeString' desc")
- .isSortOrder(0, true)
- .goOrder(0).isBinary(BinaryOperatorKind.EQ).left().goPath()
- .first().isFunction("UFCRTETAllPrimTwoParam").goUpFilterValidator()
- .goOrder(0).right().isLiteral("'SomeString'");
-
- testFilter.runOrderByOnETTwoKeyNav("olingo.odata.test1.UFCRTETAllPrimTwoParam("
- + "ParameterString=@ParamStringAlias,ParameterInt16=@ParamInt16Alias)/PropertyString eq 'SomeString' desc"
- + ", PropertyString eq '1'")
- .isSortOrder(0, true)
- .goOrder(0).isBinary(BinaryOperatorKind.EQ).left().goPath()
- .first().isFunction("UFCRTETAllPrimTwoParam").goUpFilterValidator()
- .goOrder(0).right().isLiteral("'SomeString'")
- .isSortOrder(1, false)
- .goOrder(1).isBinary(BinaryOperatorKind.EQ).left().goPath()
- .first().isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false).goUpFilterValidator()
- .goOrder(1).right().isLiteral("'1'");
-
- testFilter.runOrderByOnETTwoKeyNav("PropertyComp/PropertyComp/PropertyDate eq "
- + "$root/ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/PropertyComp/PropertyComp/PropertyDate")
- .isSortOrder(0, false)
- .goOrder(0).isBinary(BinaryOperatorKind.EQ).left().goPath()
- .first().isComplex("PropertyComp")
- .n().isComplex("PropertyComp")
- .n().isPrimitiveProperty("PropertyDate", PropertyProvider.nameDate, false)
- .goUpFilterValidator()
- .goOrder(0).right().goPath()
- .first().isUriPathInfoKind(UriResourceKind.root)
- .n().isEntitySet("ESTwoKeyNav")
- .n().isComplex("PropertyComp")
- .n().isComplex("PropertyComp")
- .n().isPrimitiveProperty("PropertyDate", PropertyProvider.nameDate, false);
-
- testFilter.runOrderByOnETTwoKeyNav("PropertyString")
- .isSortOrder(0, false)
- .goOrder(0).goPath()
- .first().isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false);
-
- testFilter.runOrderByOnETTwoKeyNav("PropertyComp/PropertyComp/PropertyDate")
- .isSortOrder(0, false)
- .goOrder(0).goPath()
- .first().isComplex("PropertyComp")
- .n().isComplex("PropertyComp")
- .n().isPrimitiveProperty("PropertyDate", PropertyProvider.nameDate, false);
-
- testFilter.runOrderByOnETTwoKeyNav("PropertyComp/PropertyComp/PropertyDate "
- + "eq 2013-11-12 desc, PropertyString eq 'SomeString' desc")
- .isSortOrder(0, true)
- .goOrder(0).isBinary(BinaryOperatorKind.EQ)
- .left().goPath()
- .first().isComplex("PropertyComp")
- .n().isComplex("PropertyComp")
- .n().isPrimitiveProperty("PropertyDate", PropertyProvider.nameDate, false).goUpFilterValidator()
- .goOrder(0).right().isLiteral("2013-11-12")
- .isSortOrder(1, true)
- .goOrder(1).left().goPath().first().isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false)
- .goUpFilterValidator()
- .goOrder(1).right().isLiteral("'SomeString'");
-
- testFilter.runOrderByOnETTwoKeyNav("PropertyComp")
- .isSortOrder(0, false)
- .goOrder(0).goPath()
- .first().isComplex("PropertyComp");
- testFilter.runOrderByOnETTwoKeyNav("PropertyComp/PropertyComp")
- .isSortOrder(0, false)
- .goOrder(0).goPath()
- .first().isComplex("PropertyComp")
- .n().isComplex("PropertyComp");
-
- testFilter.runOrderByOnETTwoKeyNav("PropertyComp desc, PropertyComp/PropertyInt16 eq 1")
- .isSortOrder(0, true)
- .goOrder(0).goPath()
- .first().isComplex("PropertyComp").goUpFilterValidator()
- .isSortOrder(1, false)
- .goOrder(1).isBinary(BinaryOperatorKind.EQ)
- .left().goPath()
- .first().isComplex("PropertyComp")
- .n().isPrimitiveProperty("PropertyInt16", PropertyProvider.nameInt16, false).goUpFilterValidator()
- .goOrder(1).right().isLiteral("1");
-
- testFilter.runOrderByOnETTwoKeyNav("NavPropertyETKeyNavOne")
- .isSortOrder(0, false).goOrder(0).goPath()
- .first().isNavProperty("NavPropertyETKeyNavOne", EntityTypeProvider.nameETKeyNav, false);
-
- testFilter.runOrderByOnETTwoKeyNav("NavPropertyETKeyNavOne/PropertyString")
- .isSortOrder(0, false).goOrder(0).goPath()
- .first().isNavProperty("NavPropertyETKeyNavOne", EntityTypeProvider.nameETKeyNav, false)
- .n().isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false);
-
- testFilter.runOrderByOnETTwoKeyNav("NavPropertyETKeyNavOne/PropertyComp")
- .isSortOrder(0, false).goOrder(0).goPath()
- .first().isNavProperty("NavPropertyETKeyNavOne", EntityTypeProvider.nameETKeyNav, false)
- .n().isComplex("PropertyComp");
-
- testFilter.runOrderByOnETTwoKeyNav("PropertyComp/PropertyComp/PropertyInt16 eq 1")
- .isSortOrder(0, false).goOrder(0).left().goPath()
- .first().isComplex("PropertyComp")
- .n().isComplex("PropertyComp")
- .n().isPrimitiveProperty("PropertyInt16", PropertyProvider.nameInt16, false);
-
- testFilter.runOrderByOnETTwoKeyNav("NavPropertyETKeyNavMany(1)/NavPropertyETTwoKeyNavMany(PropertyString='2')"
- + "/PropertyString eq 'SomeString'")
- .isSortOrder(0, false).goOrder(0).left().goPath()
- .first().isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, false)
- .n().isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, false)
- .n().isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false);
-
- testFilter.runOrderByOnETTwoKeyNav("NavPropertyETKeyNavMany(1)/NavPropertyETTwoKeyNavMany(PropertyString='2')"
- + "/PropertyString eq 'SomeString1' desc,PropertyString eq 'SomeString2' asc")
- .isSortOrder(0, true).goOrder(0).left().goPath()
- .first().isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, false)
- .n().isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, false)
- .n().isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false).goUpFilterValidator()
- .isSortOrder(1, false).goOrder(1).left().goPath()
- .first().isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false);
-
- testFilter.runOrderByOnETAllPrim("PropertyBoolean eq true")
- .isSortOrder(0, false)
- .goOrder(0).left().goPath().isPrimitiveProperty("PropertyBoolean", PropertyProvider.nameBoolean, false)
- .goUpFilterValidator()
- .goOrder(0).right().isTrue();
-
- testFilter.runOrderByOnETAllPrim("PropertyBoolean eq true desc")
- .isSortOrder(0, true)
- .goOrder(0).left().goPath().isPrimitiveProperty("PropertyBoolean", PropertyProvider.nameBoolean, false)
- .goUpFilterValidator()
- .goOrder(0).right().isTrue();
-
- testFilter.runOrderByOnETAllPrim(encode("PropertyDouble eq 3.5E+38"))
- .isSortOrder(0, false)
- .goOrder(0).left().goPath().isPrimitiveProperty("PropertyDouble", PropertyProvider.nameDouble, false)
- .goUpFilterValidator()
- .goOrder(0).right().isLiteral("3.5E+38");
-
- testFilter.runOrderByOnETAllPrim(encode("PropertyDouble eq 3.5E+38 desc")).isSortOrder(0, true)
- .goOrder(0).left().goPath().isPrimitiveProperty("PropertyDouble", PropertyProvider.nameDouble, false)
- .goUpFilterValidator()
- .goOrder(0).right().isLiteral("3.5E+38");
-
- testFilter.runOrderByOnETAllPrim("PropertySingle eq 1.5")
- .isSortOrder(0, false)
- .goOrder(0).left().goPath().isPrimitiveProperty("PropertySingle", PropertyProvider.nameSingle, false)
- .goUpFilterValidator()
- .goOrder(0).right().isLiteral("1.5");
-
- testFilter.runOrderByOnETAllPrim("PropertySingle eq 1.5 desc")
- .isSortOrder(0, true)
- .goOrder(0).left().goPath().isPrimitiveProperty("PropertySingle", PropertyProvider.nameSingle, false)
- .goUpFilterValidator()
- .goOrder(0).right().isLiteral("1.5");
-
- testFilter.runOrderByOnETAllPrim("PropertySByte eq -128")
- .isSortOrder(0, false)
- .goOrder(0).left().goPath().isPrimitiveProperty("PropertySByte", PropertyProvider.nameSByte, false)
- .goUpFilterValidator()
- .goOrder(0).right().isLiteral("-128");
-
- testFilter.runOrderByOnETAllPrim("PropertySByte eq -128 desc")
- .isSortOrder(0, true)
- .goOrder(0).left().goPath().isPrimitiveProperty("PropertySByte", PropertyProvider.nameSByte, false)
- .goUpFilterValidator()
- .goOrder(0).right().isLiteral("-128");
-
- testFilter.runOrderByOnETAllPrim("PropertyByte eq 255")
- .isSortOrder(0, false)
- .goOrder(0).left().goPath().isPrimitiveProperty("PropertyByte", PropertyProvider.nameByte, false)
- .goUpFilterValidator()
- .goOrder(0).right().isLiteral("255");
-
- testFilter.runOrderByOnETAllPrim("PropertyByte eq 255 desc")
- .isSortOrder(0, true)
- .goOrder(0).left().goPath().isPrimitiveProperty("PropertyByte", PropertyProvider.nameByte, false)
- .goUpFilterValidator()
- .goOrder(0).right().isLiteral("255");
-
- testFilter.runOrderByOnETAllPrim("PropertyInt16 eq 32767")
- .isSortOrder(0, false)
- .goOrder(0).left().goPath().isPrimitiveProperty("PropertyInt16", PropertyProvider.nameInt16, false)
- .goUpFilterValidator()
- .goOrder(0).right().isLiteral("32767");
-
- testFilter.runOrderByOnETAllPrim("PropertyInt16 eq 32767 desc")
- .isSortOrder(0, true)
- .goOrder(0).left().goPath().isPrimitiveProperty("PropertyInt16", PropertyProvider.nameInt16, false)
- .goUpFilterValidator()
- .goOrder(0).right().isLiteral("32767");
-
- testFilter.runOrderByOnETAllPrim("PropertyInt32 eq 2147483647")
- .isSortOrder(0, false)
- .goOrder(0).left().goPath().isPrimitiveProperty("PropertyInt32", PropertyProvider.nameInt32, false)
- .goUpFilterValidator()
- .goOrder(0).right().isLiteral("2147483647");
-
- testFilter.runOrderByOnETAllPrim("PropertyInt32 eq 2147483647 desc")
- .isSortOrder(0, true)
- .goOrder(0).left().goPath().isPrimitiveProperty("PropertyInt32", PropertyProvider.nameInt32, false)
- .goUpFilterValidator()
- .goOrder(0).right().isLiteral("2147483647");
-
- testFilter.runOrderByOnETAllPrim("PropertyInt64 eq 9223372036854775807")
- .isSortOrder(0, false)
- .goOrder(0).left().goPath().isPrimitiveProperty("PropertyInt64", PropertyProvider.nameInt64, false)
- .goUpFilterValidator()
- .goOrder(0).right().isLiteral("9223372036854775807");
-
- testFilter.runOrderByOnETAllPrim("PropertyInt64 eq 9223372036854775807 desc")
- .isSortOrder(0, true)
- .goOrder(0).left().goPath().isPrimitiveProperty("PropertyInt64", PropertyProvider.nameInt64, false)
- .goUpFilterValidator()
- .goOrder(0).right().isLiteral("9223372036854775807");
-
- testFilter.runOrderByOnETAllPrim("PropertyBinary eq binary'0FAB7B'")
- .isSortOrder(0, false)
- .goOrder(0).left().goPath().isPrimitiveProperty("PropertyBinary", PropertyProvider.nameBinary, false)
- .goUpFilterValidator()
- .goOrder(0).right().isLiteral("binary'0FAB7B'");
-
- testFilter.runOrderByOnETAllPrim("PropertyBinary eq binary'0FAB7B' desc")
- .isSortOrder(0, true)
- .goOrder(0).left().goPath().isPrimitiveProperty("PropertyBinary", PropertyProvider.nameBinary, false)
- .goUpFilterValidator()
- .goOrder(0).right().isLiteral("binary'0FAB7B'");
-
- testFilter.runOrderByOnETAllPrim("PropertyDate eq 2013-09-25")
- .isSortOrder(0, false)
- .goOrder(0).left().goPath().isPrimitiveProperty("PropertyDate", PropertyProvider.nameDate, false)
- .goUpFilterValidator()
- .goOrder(0).right().isLiteral("2013-09-25");
-
- testFilter.runOrderByOnETAllPrim("PropertyDate eq 2013-09-25 desc")
- .isSortOrder(0, true)
- .goOrder(0).left().goPath().isPrimitiveProperty("PropertyDate", PropertyProvider.nameDate, false)
- .goUpFilterValidator()
- .goOrder(0).right().isLiteral("2013-09-25");
-
- testFilter.runOrderByOnETAllPrim("PropertyDateTimeOffset eq 2013-09-25T12:34:56.123456789012-10:24")
- .isSortOrder(0, false)
- .goOrder(0).left().goPath().isPrimitiveProperty("PropertyDateTimeOffset", PropertyProvider.nameDateTimeOffset,
- false)
- .goUpFilterValidator()
- .goOrder(0).right().isLiteral("2013-09-25T12:34:56.123456789012-10:24");
-
- testFilter.runOrderByOnETAllPrim("PropertyDateTimeOffset eq 2013-09-25T12:34:56.123456789012-10:24 desc")
- .isSortOrder(0, true)
- .goOrder(0).left().goPath().isPrimitiveProperty("PropertyDateTimeOffset", PropertyProvider.nameDateTimeOffset,
- false)
- .goUpFilterValidator()
- .goOrder(0).right().isLiteral("2013-09-25T12:34:56.123456789012-10:24");
-
- testFilter.runOrderByOnETAllPrim("PropertyDuration eq duration'P10DT5H34M21.123456789012S'")
- .isSortOrder(0, false)
- .goOrder(0).left().goPath().isPrimitiveProperty("PropertyDuration", PropertyProvider.nameDuration, false)
- .goUpFilterValidator()
- .goOrder(0).right().isLiteral("duration'P10DT5H34M21.123456789012S'");
-
- testFilter.runOrderByOnETAllPrim("PropertyDuration eq duration'P10DT5H34M21.123456789012S' desc")
- .isSortOrder(0, true)
- .goOrder(0).left().goPath().isPrimitiveProperty("PropertyDuration", PropertyProvider.nameDuration, false)
- .goUpFilterValidator()
- .goOrder(0).right().isLiteral("duration'P10DT5H34M21.123456789012S'");
-
- testFilter.runOrderByOnETAllPrim("PropertyGuid eq 005056A5-09B1-1ED3-89BD-FB81372CCB33")
- .isSortOrder(0, false)
- .goOrder(0).left().goPath().isPrimitiveProperty("PropertyGuid", PropertyProvider.nameGuid, false)
- .goUpFilterValidator()
- .goOrder(0).right().isLiteral("005056A5-09B1-1ED3-89BD-FB81372CCB33");
-
- testFilter.runOrderByOnETAllPrim("PropertyGuid eq 005056A5-09B1-1ED3-89BD-FB81372CCB33 desc")
- .isSortOrder(0, true)
- .goOrder(0).left().goPath().isPrimitiveProperty("PropertyGuid", PropertyProvider.nameGuid, false)
- .goUpFilterValidator()
- .goOrder(0).right().isLiteral("005056A5-09B1-1ED3-89BD-FB81372CCB33");
-
- testFilter.runOrderByOnETAllPrim("PropertyString eq 'somestring'")
- .isSortOrder(0, false)
- .goOrder(0).left().goPath().isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false)
- .goUpFilterValidator()
- .goOrder(0).right().isLiteral("'somestring'");
-
- testFilter.runOrderByOnETAllPrim("PropertyString eq 'somestring' desc")
- .isSortOrder(0, true)
- .goOrder(0).left().goPath().isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false)
- .goUpFilterValidator()
- .goOrder(0).right().isLiteral("'somestring'");
-
- testFilter.runOrderByOnETAllPrim("PropertyTimeOfDay eq 12:34:55.123456789012")
- .isSortOrder(0, false)
- .goOrder(0).left().goPath().isPrimitiveProperty("PropertyTimeOfDay", PropertyProvider.nameTimeOfDay, false)
- .goUpFilterValidator()
- .goOrder(0).right().isLiteral("12:34:55.123456789012");
-
- testFilter.runOrderByOnETAllPrim("PropertyTimeOfDay eq 12:34:55.123456789012 desc")
- .isSortOrder(0, true)
- .goOrder(0).left().goPath().isPrimitiveProperty("PropertyTimeOfDay", PropertyProvider.nameTimeOfDay, false)
- .goUpFilterValidator()
- .goOrder(0).right().isLiteral("12:34:55.123456789012");
-
- testFilter.runOrderByOnETMixEnumDefCollComp("PropertyEnumString eq olingo.odata.test1.ENString'String1'")
- .isSortOrder(0, false)
- .goOrder(0).left().goPath().isComplex("PropertyEnumString").goUpFilterValidator()
- .goOrder(0).right().isEnum(EnumTypeProvider.nameENString, Arrays.asList("String1"));
-
- testFilter.runOrderByOnETMixEnumDefCollComp("PropertyEnumString eq olingo.odata.test1.ENString'String1' desc")
- .isSortOrder(0, true)
- .goOrder(0).left().goPath().isComplex("PropertyEnumString").goUpFilterValidator()
- .goOrder(0).right().isEnum(EnumTypeProvider.nameENString, Arrays.asList("String1"));
-
- testFilter.runOrderByOnETTwoKeyNavEx("PropertyInt16 1")
- .isExSyntax(UriParserSyntaxException.MessageKeys.SYNTAX);
- testFilter.runOrderByOnETTwoKeyNavEx("PropertyInt16, PropertyInt32 PropertyDuration")
- .isExSyntax(UriParserSyntaxException.MessageKeys.SYNTAX);
- testFilter.runOrderByOnETTwoKeyNavEx("PropertyInt16 PropertyInt32, PropertyDuration desc")
- .isExSyntax(UriParserSyntaxException.MessageKeys.SYNTAX);
- testFilter.runOrderByOnETTwoKeyNavEx("PropertyInt16 asc, PropertyInt32 PropertyDuration desc")
- .isExSyntax(UriParserSyntaxException.MessageKeys.SYNTAX);
- testFilter.runOrderByOnETTwoKeyNavEx("PropertyInt16 asc desc")
- .isExSyntax(UriParserSyntaxException.MessageKeys.SYNTAX);
- testFilter.runOrderByOnETTwoKeyNavEx("undefined")
- .isExSemantic(UriParserSemanticException.MessageKeys.EXPRESSION_PROPERTY_NOT_IN_TYPE);
- testFilter.runOrderByOnETTwoKeyNavEx("PropertyComp/undefined")
- .isExSemantic(UriParserSemanticException.MessageKeys.EXPRESSION_PROPERTY_NOT_IN_TYPE);
- }
-
- @Test
- @Ignore("$search currently not implemented")
- public void testSearch() throws Exception {
-
- testUri.run("ESTwoKeyNav", "$search=abc");
- testUri.run("ESTwoKeyNav", "$search=NOT abc");
-
- testUri.run("ESTwoKeyNav", "$search=abc AND def");
- testUri.run("ESTwoKeyNav", "$search=abc OR def");
- testUri.run("ESTwoKeyNav", "$search=abc def");
-
- testUri.run("ESTwoKeyNav", "$search=abc AND def AND ghi");
- testUri.run("ESTwoKeyNav", "$search=abc AND def OR ghi");
- testUri.run("ESTwoKeyNav", "$search=abc AND def ghi");
-
- testUri.run("ESTwoKeyNav", "$search=abc OR def AND ghi");
- testUri.run("ESTwoKeyNav", "$search=abc OR def OR ghi");
- testUri.run("ESTwoKeyNav", "$search=abc OR def ghi");
-
- testUri.run("ESTwoKeyNav", "$search=abc def AND ghi");
- testUri.run("ESTwoKeyNav", "$search=abc def OR ghi");
- testUri.run("ESTwoKeyNav", "$search=abc def ghi");
-
- // mixed not
- testUri.run("ESTwoKeyNav", "$search= abc def AND ghi");
- testUri.run("ESTwoKeyNav", "$search=NOT abc NOT def OR NOT ghi");
- testUri.run("ESTwoKeyNav", "$search= abc def NOT ghi");
-
- // parenthesis
- testUri.run("ESTwoKeyNav", "$search= (abc)");
- testUri.run("ESTwoKeyNav", "$search= (abc AND def)");
- testUri.run("ESTwoKeyNav", "$search= (abc AND def) OR ghi ");
- testUri.run("ESTwoKeyNav", "$search= (abc AND def) ghi ");
- testUri.run("ESTwoKeyNav", "$search= abc AND (def OR ghi)");
- testUri.run("ESTwoKeyNav", "$search= abc AND (def ghi)");
- }
-
- @Test
- public void testErrors() {
- testUri.runEx("FICRTString(wrong1='ABC')/olingo.odata.test1.BFCStringRTESTwoKeyNav()")
- .isExSemantic(UriParserSemanticException.MessageKeys.FUNCTION_NOT_FOUND);
- testUri.runEx("FICRTString(wrong1='ABC', wrong2=1)/olingo.odata.test1.BFCStringRTESTwoKeyNav()")
- .isExSemantic(UriParserSemanticException.MessageKeys.FUNCTION_NOT_FOUND);
-
- // type filter for entity incompatible
- testUri.runEx("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/olingo.odata.test1.ETBase")
- .isExSemantic(UriParserSemanticException.MessageKeys.INCOMPATIBLE_TYPE_FILTER);
-
- // type filter for entity double on entry
- testUri.runEx("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')"
- + "/olingo.odata.test1.ETBaseTwoKeyNav/olingo.odata.test1.ETBaseTwoKeyNav")
- .isExSemantic(UriParserSemanticException.MessageKeys.TYPE_FILTER_NOT_CHAINABLE);
- // type filter for entity double on collection
- testUri.runEx("ESTwoKeyNav/olingo.odata.test1.ETBaseTwoKeyNav/olingo.odata.test1.ETBaseTwoKeyNav")
- .isExSemantic(UriParserSemanticException.MessageKeys.TYPE_FILTER_NOT_CHAINABLE);
- // type filter for entity double on non key pred
- testUri.runEx("SINav/olingo.odata.test1.ETBaseTwoKeyNav/olingo.odata.test1.ETBaseTwoKeyNav")
- .isExSemantic(UriParserSemanticException.MessageKeys.TYPE_FILTER_NOT_CHAINABLE);
-
- // type filter for complex incompatible
- testUri.runEx("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/PropertyCompTwoPrim"
- + "/olingo.odata.test1.CTCollAllPrim")
- .isExSemantic(UriParserSemanticException.MessageKeys.INCOMPATIBLE_TYPE_FILTER);
-
- // type filter for complex double on entry
- testUri.runEx("FICRTCTTwoPrimParam(ParameterInt16=1,ParameterString='2')"
- + "/olingo.odata.test1.CTBase/olingo.odata.test1.CTBase")
- .isExSemantic(UriParserSemanticException.MessageKeys.TYPE_FILTER_NOT_CHAINABLE);
-
- // type filter for complex double on collection
- testUri.runEx("FICRTCollCTTwoPrimParam(ParameterInt16=1,ParameterString='2')"
- + "/olingo.odata.test1.CTBase/olingo.odata.test1.CTBase")
- .isExSemantic(UriParserSemanticException.MessageKeys.TYPE_FILTER_NOT_CHAINABLE);
-
- // type filter for complex double on non key pred
- testUri.runEx("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/PropertyCompTwoPrim"
- + "/olingo.odata.test1.CTBase/olingo.odata.test1.CTBase")
- .isExSemantic(UriParserSemanticException.MessageKeys.TYPE_FILTER_NOT_CHAINABLE);
-
- testUri.runEx("ESTwoKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav")
- .isExSemantic(UriParserSemanticException.MessageKeys.FUNCTION_PARAMETERS_EXPECTED);
-
- // $ref
- testUri.runEx("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/PropertyCompTwoPrim/$ref")
- .isExSemantic(UriParserSemanticException.MessageKeys.ONLY_FOR_ENTITY_TYPES);
- testUri.runEx("ESTwoKeyNav(PropertyInt16=1,PropertyString='2')/PropertyCompTwoPrim/$count")
- .isExSemantic(UriParserSemanticException.MessageKeys.ONLY_FOR_COLLECTIONS);
- }
-
- @Test
- public void testAlias() throws Exception {
- testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString=@A)", "@A='2'").goPath()
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isKeyPredicateAlias(1, "PropertyString", "@A")
- .isInAliasToValueMap("@A", "'2'")
- .goUpUriValidator()
- .isCustomParameter(0, "@A", "'2'");
- }
-
- public static String encode(final String decoded) throws UnsupportedEncodingException {
- return Encoder.encode(decoded);
- }
-}
diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/antlr/TestLexer.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/antlr/TestLexer.java
deleted file mode 100644
index 76c11aa..0000000
--- a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/antlr/TestLexer.java
+++ /dev/null
@@ -1,253 +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.uri.antlr;
-
-import org.antlr.v4.runtime.Lexer;
-import org.apache.olingo.server.core.uri.testutil.TokenValidator;
-import org.junit.Test;
-
-public class TestLexer {
-
- private TokenValidator test = null;
-
- private static final String cPCT_ENCODED = "%45%46%47" + "%22" + "%5C";// last two chars are not in
- // cPCT_ENCODED_UNESCAPED
- private static final String cUNRESERVED = "ABCabc123-._~";
- private static final String cOTHER_DELIMS = "!()*+,;";
- private static final String cSUB_DELIMS = "$&'=" + cOTHER_DELIMS;
-
- private static final String cPCHAR = cUNRESERVED + cPCT_ENCODED + cSUB_DELIMS + ":@";
-
- public TestLexer() {
- test = new TokenValidator();
- }
-
- @Test
- public void test() {
-
- // test.log(1).run("ESAllPrim?$orderby=PropertyDouble eq 3.5E+38");
- }
-
- // ;------------------------------------------------------------------------------
- // ; 0. URI
- // ;------------------------------------------------------------------------------
-
- @Test
- public void testUnary() {
- test.run("- a eq a").isAllInput();
- }
-
- @Test
- public void testUriTokens() {
- test.globalMode(UriLexer.MODE_QUERY);
- test.run("#").isText("#").isType(UriLexer.FRAGMENT);
- test.run("$count").isText("$count").isType(UriLexer.COUNT);
- test.run("$ref").isText("$ref").isType(UriLexer.REF);
- test.run("$value").isText("$value").isType(UriLexer.VALUE);
- }
-
- // ;------------------------------------------------------------------------------
- // ; 2. Query Options
- // ;------------------------------------------------------------------------------
- @Test
- public void testQueryOptionsTokens() {
-
- test.globalMode(UriLexer.MODE_QUERY);
- test.run("$skip=1").isAllText("$skip=1").isType(UriLexer.SKIP);
- test.run("$skip=2").isAllText("$skip=2").isType(UriLexer.SKIP);
- test.run("$skip=123").isAllText("$skip=123").isType(UriLexer.SKIP);
-
- test.run("$top=1").isAllText("$top=1").isType(UriLexer.TOP);
- test.run("$top=2").isAllText("$top=2").isType(UriLexer.TOP);
- test.run("$top=123").isAllText("$top=123").isType(UriLexer.TOP);
-
- test.run("$levels=1").isAllText("$levels=1").isType(UriLexer.LEVELS);
- test.run("$levels=2").isAllText("$levels=2").isType(UriLexer.LEVELS);
- test.run("$levels=123").isAllText("$levels=123").isType(UriLexer.LEVELS);
- test.run("$levels=max").isAllText("$levels=max").isType(UriLexer.LEVELS);
-
- test.run("$format=atom").isAllText("$format=atom").isType(UriLexer.FORMAT);
- test.run("$format=json").isAllText("$format=json").isType(UriLexer.FORMAT);
- test.run("$format=xml").isAllText("$format=xml").isType(UriLexer.FORMAT);
- test.run("$format=abc/def").isAllText("$format=abc/def").isType(UriLexer.FORMAT);
-
- test.run("$id=123").isAllText("$id=123").isType(UriLexer.ID);
- test.run("$id=ABC").isAllText("$id=ABC").isType(UriLexer.ID);
-
- test.run("$skiptoken=ABC").isAllText("$skiptoken=ABC").isType(UriLexer.SKIPTOKEN);
- test.run("$skiptoken=ABC").isAllText("$skiptoken=ABC").isType(UriLexer.SKIPTOKEN);
-
- test.run("$search=\"ABC\"").isAllText("$search=\"ABC\"").isType(UriLexer.SEARCH);
- test.run("$search=ABC").isAllText("$search=ABC").isType(UriLexer.SEARCH);
- test.run("$search=\"A%20B%20C\"").isAllText("$search=\"A%20B%20C\"").isType(UriLexer.SEARCH);
- }
-
- // ;------------------------------------------------------------------------------
- // ; 4. Expressions
- // ;------------------------------------------------------------------------------
- @Test
- public void testQueryExpressions() {
- test.globalMode(Lexer.DEFAULT_MODE);
-
- test.run("$it").isText("$it").isType(UriLexer.IT);
-
- test.run("$filter=contains(").at(2).isText("contains(").isType(UriLexer.CONTAINS_WORD);
-
- test.run("$filter=containsabc").at(2).isText("containsabc")
- .isType(UriLexer.ODATAIDENTIFIER); // test that this is a ODI
-
- test.run("$filter=startswith(").at(2).isText("startswith(").isType(UriLexer.STARTSWITH_WORD);
- test.run("$filter=endswith(").at(2).isText("endswith(").isType(UriLexer.ENDSWITH_WORD);
- test.run("$filter=length(").at(2).isText("length(").isType(UriLexer.LENGTH_WORD);
- test.run("$filter=indexof(").at(2).isText("indexof(").isType(UriLexer.INDEXOF_WORD);
- test.run("$filter=substring(").at(2).isText("substring(").isType(UriLexer.SUBSTRING_WORD);
- test.run("$filter=tolower(").at(2).isText("tolower(").isType(UriLexer.TOLOWER_WORD);
- test.run("$filter=toupper(").at(2).isText("toupper(").isType(UriLexer.TOUPPER_WORD);
- test.run("$filter=trim(").at(2).isText("trim(").isType(UriLexer.TRIM_WORD);
- test.run("$filter=concat(").at(2).isText("concat(").isType(UriLexer.CONCAT_WORD);
-
- }
-
- // ;------------------------------------------------------------------------------
- // ; 7. Literal Data Values
- // ;------------------------------------------------------------------------------
-
- @Test
- public void testLiteralDataValues() {
- test.globalMode(Lexer.DEFAULT_MODE);
- // null
- test.run("null").isInput().isType(UriLexer.NULLVALUE);
-
- // binary
- test.run("binary'ABCD'").isInput().isType(UriLexer.BINARY);
- test.run("BiNaRy'ABCD'").isInput().isType(UriLexer.BINARY);
-
- // boolean
- test.run("true").isInput().isType(UriLexer.TRUE);
- test.run("false").isInput().isType(UriLexer.FALSE);
- test.run("TrUe").isInput().isType(UriLexer.BOOLEAN);
- test.run("FaLsE").isInput().isType(UriLexer.BOOLEAN);
-
- // Lexer rule INT
- test.run("123").isInput().isType(UriLexer.INT);
- test.run("123456789").isInput().isType(UriLexer.INT);
- test.run("+123").isInput().isType(UriLexer.INT);
- test.run("+123456789").isInput().isType(UriLexer.INT);
- test.run("-123").isInput().isType(UriLexer.INT);
- test.run("-123456789").isInput().isType(UriLexer.INT);
-
- // Lexer rule DECIMAL
- test.run("0.1").isInput().isType(UriLexer.DECIMAL);
- test.run("1.1").isInput().isType(UriLexer.DECIMAL);
- test.run("+0.1").isInput().isType(UriLexer.DECIMAL);
- test.run("+1.1").isInput().isType(UriLexer.DECIMAL);
- test.run("-0.1").isInput().isType(UriLexer.DECIMAL);
- test.run("-1.1").isInput().isType(UriLexer.DECIMAL);
-
- // Lexer rule EXP
- test.run("1.1e+1").isInput().isType(UriLexer.DECIMAL);
- test.run("1.1e-1").isInput().isType(UriLexer.DECIMAL);
-
- test.run("NaN").isInput().isType(UriLexer.NANINFINITY);
- test.run("-INF").isInput().isType(UriLexer.NANINFINITY);
- test.run("INF").isInput().isType(UriLexer.NANINFINITY);
-
- // Lexer rule GUID
- test.run("1234ABCD-12AB-23CD-45EF-123456780ABC").isInput().isType(UriLexer.GUID);
- test.run("1234ABCD-12AB-23CD-45EF-123456780ABC").isInput().isType(UriLexer.GUID);
-
- // Lexer rule DATE
- test.run("2013-11-15").isInput().isType(UriLexer.DATE);
-
- // Lexer rule DATETIMEOFFSET
- test.run("2013-11-15T13:35Z").isInput().isType(UriLexer.DATETIMEOFFSET);
- test.run("2013-11-15T13:35:10Z").isInput().isType(UriLexer.DATETIMEOFFSET);
- test.run("2013-11-15T13:35:10.1234Z").isInput().isType(UriLexer.DATETIMEOFFSET);
-
- test.run("2013-11-15T13:35:10.1234+01:30").isInput().isType(UriLexer.DATETIMEOFFSET);
- test.run("2013-11-15T13:35:10.1234-01:12").isInput().isType(UriLexer.DATETIMEOFFSET);
-
- test.run("2013-11-15T13:35Z").isInput().isType(UriLexer.DATETIMEOFFSET);
-
- // Lexer rule DURATION
- test.run("duration'PT67S'").isInput().isType(UriLexer.DURATION);
- test.run("duration'PT67.89S'").isInput().isType(UriLexer.DURATION);
-
- test.run("duration'PT5M'").isInput().isType(UriLexer.DURATION);
- test.run("duration'PT5M67S'").isInput().isType(UriLexer.DURATION);
- test.run("duration'PT5M67.89S'").isInput().isType(UriLexer.DURATION);
-
- test.run("duration'PT4H'").isInput().isType(UriLexer.DURATION);
- test.run("duration'PT4H67S'").isInput().isType(UriLexer.DURATION);
- test.run("duration'PT4H67.89S'").isInput().isType(UriLexer.DURATION);
- test.run("duration'PT4H5M'").isInput().isType(UriLexer.DURATION);
- test.run("duration'PT4H5M67S'").isInput().isType(UriLexer.DURATION);
- test.run("duration'PT4H5M67.89S'").isInput().isType(UriLexer.DURATION);
-
- test.run("duration'P3D'");
- test.run("duration'P3DT67S'").isInput().isType(UriLexer.DURATION);
- test.run("duration'P3DT67.89S'").isInput().isType(UriLexer.DURATION);
- test.run("duration'P3DT5M'").isInput().isType(UriLexer.DURATION);
- test.run("duration'P3DT5M67S'").isInput().isType(UriLexer.DURATION);
- test.run("duration'P3DT5M67.89S'").isInput().isType(UriLexer.DURATION);
- test.run("duration'P3DT4H'").isInput().isType(UriLexer.DURATION);
- test.run("duration'P3DT4H67S'").isInput().isType(UriLexer.DURATION);
- test.run("duration'P3DT4H67.89S'").isInput().isType(UriLexer.DURATION);
- test.run("duration'P3DT4H5M'").isInput().isType(UriLexer.DURATION);
- test.run("duration'P3DT4H5M67S'").isInput().isType(UriLexer.DURATION);
- test.run("duration'P3DT4H5M67.89S'").isInput().isType(UriLexer.DURATION);
-
- test.run("DuRaTiOn'P3DT4H5M67.89S'").isInput().isType(UriLexer.DURATION);
- test.run("DuRaTiOn'-P3DT4H5M67.89S'").isInput().isType(UriLexer.DURATION);
-
- test.run("20:00").isInput().isType(UriLexer.TIMEOFDAY);
- test.run("20:15:01").isInput().isType(UriLexer.TIMEOFDAY);
- test.run("20:15:01.02").isInput().isType(UriLexer.TIMEOFDAY);
-
- test.run("20:15:01.02").isInput().isType(UriLexer.TIMEOFDAY);
-
- // String
- test.run("'ABC'").isText("'ABC'").isType(UriLexer.STRING);
- test.run("'A%20C'").isInput().isType(UriLexer.STRING);
- test.run("'%20%20%20ABC'").isInput().isType(UriLexer.STRING);
-
- }
-
- @Test
- public void testDelims() {
- String reserved = "/";
- test.globalMode(UriLexer.MODE_QUERY);
- // Test lexer rule UNRESERVED
- test.run("$format=A/" + cUNRESERVED).isAllInput().isType(UriLexer.FORMAT);
- test.run("$format=A/" + cUNRESERVED + reserved).isType(UriLexer.FORMAT).at(4).isText(cUNRESERVED);
- // Test lexer rule PCT_ENCODED
- test.run("$format=A/" + cPCT_ENCODED).isAllInput().isType(UriLexer.FORMAT);
- test.run("$format=A/" + cPCT_ENCODED + reserved).isType(UriLexer.FORMAT).at(4).isText(cPCT_ENCODED);
- // Test lexer rule SUB_DELIMS
- test.run("$format=A/" + cSUB_DELIMS).isAllInput().isType(UriLexer.FORMAT);
- test.run("$format=A/" + cSUB_DELIMS + reserved).isType(UriLexer.FORMAT).at(4).isText("$");
- // Test lexer rule PCHAR rest
- test.run("$format=A/:@").isAllText("$format=A/:@").isType(UriLexer.FORMAT);
- test.run("$format=A/:@" + reserved).isType(UriLexer.FORMAT).at(4).isText(":@");
- // Test lexer rule PCHAR all
- test.run("$format=" + cPCHAR + "/" + cPCHAR).isAllInput().isType(UriLexer.FORMAT);
-
- }
-
-}
diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/antlr/TestUriParserImpl.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/antlr/TestUriParserImpl.java
deleted file mode 100644
index 9157d2a..0000000
--- a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/antlr/TestUriParserImpl.java
+++ /dev/null
@@ -1,1170 +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.uri.antlr;
-
-import java.io.UnsupportedEncodingException;
-import java.net.URLEncoder;
-import java.util.Arrays;
-
-import org.apache.olingo.commons.api.edm.Edm;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-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.uri.parser.UriParserException;
-import org.apache.olingo.server.core.uri.parser.UriParserSemanticException;
-import org.apache.olingo.server.core.uri.parser.UriParserSyntaxException;
-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.core.uri.validator.UriValidationException;
-import org.apache.olingo.server.tecsvc.provider.ActionProvider;
-import org.apache.olingo.server.tecsvc.provider.ComplexTypeProvider;
-import org.apache.olingo.server.tecsvc.provider.ContainerProvider;
-import org.apache.olingo.server.tecsvc.provider.EntityTypeProvider;
-import org.apache.olingo.server.tecsvc.provider.PropertyProvider;
-import org.junit.Test;
-
-public class TestUriParserImpl {
- Edm edm = null;
- private final String PropertyBoolean = "PropertyBoolean=true";
- private final String PropertyByte = "PropertyByte=1";
-
- private final String PropertyDate = "PropertyDate=2013-09-25";
- private final String PropertyDateTimeOffset = "PropertyDateTimeOffset=2002-10-10T12:00:00-05:00";
- private final String PropertyDecimal = "PropertyDecimal=12";
- private final String PropertyDuration = "PropertyDuration=duration'P50903316DT2H25M4S'";
- private final String PropertyGuid = "PropertyGuid=12345678-1234-1234-1234-123456789012";
- private final String PropertyInt16 = "PropertyInt16=1";
- private final String PropertyInt32 = "PropertyInt32=12";
- private final String PropertyInt64 = "PropertyInt64=64";
- private final String PropertySByte = "PropertySByte=1";
- private final String PropertyString = "PropertyString='ABC'";
- private final String PropertyTimeOfDay = "PropertyTimeOfDay=12:34:55";
-
- private final String allKeys = PropertyString + "," + PropertyInt16 + "," + PropertyBoolean + "," + PropertyByte
- + "," + PropertySByte + "," + PropertyInt32 + "," + PropertyInt64 + "," + PropertyDecimal + "," + PropertyDate
- + "," + PropertyDateTimeOffset + "," + PropertyDuration + "," + PropertyGuid + "," + PropertyTimeOfDay;
-
- TestUriValidator testUri = null;
- ResourceValidator testRes = null;
- FilterValidator testFilter = null;
-
- public TestUriParserImpl() {
- edm = new EdmProviderImpl(new EdmTechTestProvider());
- testUri = new TestUriValidator().setEdm(edm);
- testRes = new ResourceValidator().setEdm(edm);
- testFilter = new FilterValidator().setEdm(edm);
- }
-
- @Test
- public void testBoundFunctionImport_VarParameters() {
-
- // no input
- testRes.run("ESKeyNav(1)/olingo.odata.test1.BFCETKeyNavRTETKeyNav()")
- .at(0).isUriPathInfoKind(UriResourceKind.entitySet)
- .at(1).isUriPathInfoKind(UriResourceKind.function);
-
- // one input
- testRes.run("ESTwoKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTESTwoKeyNav(ParameterString='ABC')")
- .at(0).isUriPathInfoKind(UriResourceKind.entitySet)
- .at(1).isUriPathInfoKind(UriResourceKind.function)
- .isParameter(0, "ParameterString", "'ABC'");
-
- // two input
- testRes.run("FICRTESMixPrimCollCompTwoParam(ParameterInt16=1,ParameterString='2')")
- .at(0)
- .isUriPathInfoKind(UriResourceKind.function)
- .isParameter(0, "ParameterInt16", "1")
- .isParameter(1, "ParameterString", "'2'");
- }
-
- @Test
- public void testFunctionBound_varReturnType() {
-
- String esTwoKeyNav = "ESTwoKeyNav(PropertyInt16=1,PropertyString='ABC')";
-
- // returning primitive
- testRes.run("ESTwoKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTString()")
- .at(0)
- .isUriPathInfoKind(UriResourceKind.entitySet)
- .isType(EntityTypeProvider.nameETTwoKeyNav, true)
- .at(1)
- .isUriPathInfoKind(UriResourceKind.function)
- .isType(PropertyProvider.nameString, false);
-
- // returning collection of primitive
- testRes.run("ESTwoKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTCollString()")
- .at(0)
- .isUriPathInfoKind(UriResourceKind.entitySet)
- .isType(EntityTypeProvider.nameETTwoKeyNav, true)
- .at(1)
- .isUriPathInfoKind(UriResourceKind.function)
- .isType(PropertyProvider.nameString, true);
-
- // returning single complex
- testRes.run("ESTwoKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTCTTwoPrim()")
- .at(0)
- .isUriPathInfoKind(UriResourceKind.entitySet)
- .isType(EntityTypeProvider.nameETTwoKeyNav, true)
- .at(1)
- .isUriPathInfoKind(UriResourceKind.function)
- .isType(ComplexTypeProvider.nameCTTwoPrim, false);
-
- // returning collection of complex
- testRes.run("ESTwoKeyNav/olingo.odata.test1.BFCESTwoKeyNavRTCollCTTwoPrim()")
- .at(0)
- .isUriPathInfoKind(UriResourceKind.entitySet)
- .isType(EntityTypeProvider.nameETTwoKeyNav, true)
- .at(1)
- .isUriPathInfoKind(UriResourceKind.function)
- .isType(ComplexTypeProvider.nameCTTwoPrim, true);
-
- // returning single entity
- testRes.run(
- esTwoKeyNav + "/olingo.odata.test1.ETBaseTwoKeyNav/olingo.odata.test1.BFCETBaseTwoKeyNavRTETTwoKeyNav()")
- .at(0)
- .isUriPathInfoKind(UriResourceKind.entitySet)
- .isType(EntityTypeProvider.nameETTwoKeyNav, false)
- .isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav)
- .at(1)
- .isUriPathInfoKind(UriResourceKind.function)
- .isType(EntityTypeProvider.nameETTwoKeyNav, false);
-
- // returning collection of entity (aka entitySet)
- testRes.run(esTwoKeyNav + "/olingo.odata.test1.BFCSINavRTESTwoKeyNav()")
- .at(0)
- .isUriPathInfoKind(UriResourceKind.entitySet)
- .isType(EntityTypeProvider.nameETTwoKeyNav, false)
- .at(1)
- .isUriPathInfoKind(UriResourceKind.function)
- .isType(EntityTypeProvider.nameETTwoKeyNav, true);
- }
-
- @Test
- public void runActionImport_VarReturnType() {
-
- testRes.run(ContainerProvider.AIRT_STRING).isKind(UriInfoKind.resource)
- .first()
- .isActionImport(ContainerProvider.AIRT_STRING)
- .isAction(ActionProvider.nameUARTString.getName())
- .isType(PropertyProvider.nameString, false);
-
- testRes.run(ContainerProvider.AIRT_COLL_STRING_TWO_PARAM).isKind(UriInfoKind.resource)
- .first()
- .isActionImport(ContainerProvider.AIRT_COLL_STRING_TWO_PARAM)
- .isAction(ActionProvider.nameUARTCollStringTwoParam.getName())
- .isType(PropertyProvider.nameString, true);
-
- testRes.run(ContainerProvider.AIRTCT_TWO_PRIM_PARAM).isKind(UriInfoKind.resource)
- .first()
- .isActionImport(ContainerProvider.AIRTCT_TWO_PRIM_PARAM)
- .isAction(ActionProvider.nameUARTCTTwoPrimParam.getName())
- .isType(ComplexTypeProvider.nameCTTwoPrim, false);
-
- testRes.run(ContainerProvider.AIRT_COLL_CT_TWO_PRIM_PARAM).isKind(UriInfoKind.resource)
- .first()
- .isActionImport(ContainerProvider.AIRT_COLL_CT_TWO_PRIM_PARAM)
- .isAction(ActionProvider.nameUARTCollCTTwoPrimParam.getName())
- .isType(ComplexTypeProvider.nameCTTwoPrim, true);
-
- testRes.run(ContainerProvider.AIRTET_TWO_KEY_TWO_PRIM_PARAM).isKind(UriInfoKind.resource)
- .first()
- .isActionImport(ContainerProvider.AIRTET_TWO_KEY_TWO_PRIM_PARAM)
- .isAction(ActionProvider.nameUARTETTwoKeyTwoPrimParam.getName())
- .isType(EntityTypeProvider.nameETTwoKeyTwoPrim, false);
-
- testUri.runEx(ContainerProvider.AIRT_STRING + "/invalidElement")
- .isExSemantic(UriParserSemanticException.MessageKeys.RESOURCE_PART_MUST_BE_PRECEDED_BY_STRUCTURAL_TYPE);
- }
-
- @Test
- public void runCount() {
-
- // count entity set
- testRes.run("ESAllPrim/$count")
- .at(0)
- .isUriPathInfoKind(UriResourceKind.entitySet)
- .isType(EntityTypeProvider.nameETAllPrim, true)
- .at(1)
- .isUriPathInfoKind(UriResourceKind.count);
-
- // count on collection of complex
- testRes.run("ESKeyNav(1)/CollPropertyComp/$count")
- .at(0)
- .isType(EntityTypeProvider.nameETKeyNav)
- .at(1)
- .isType(ComplexTypeProvider.nameCTPrimComp, true)
- .at(2)
- .isUriPathInfoKind(UriResourceKind.count);
-
- // count on collection of primitive
- testRes.run("ESCollAllPrim(1)/CollPropertyString/$count")
- .at(1)
- .isType(PropertyProvider.nameString, true)
- .at(2)
- .isUriPathInfoKind(UriResourceKind.count);
- }
-
- @Test
- public void runCrossJoin() throws Exception {
- testUri.run("$crossjoin(ESAllKey)")
- .isKind(UriInfoKind.crossjoin)
- .isCrossJoinEntityList(Arrays.asList("ESAllKey"));
-
- testUri.run("$crossjoin(ESAllKey,ESTwoPrim)")
- .isKind(UriInfoKind.crossjoin)
- .isCrossJoinEntityList(Arrays.asList("ESAllKey", "ESTwoPrim"));
- }
-
- @Test(expected = UriValidationException.class)
- public void testEntityFailOnValidation1() throws Exception {
- // simple entity set; with qualifiedentityTypeName; with filter
- testUri.run("$entity/olingo.odata.test1.ETTwoPrim", "$filter=PropertyInt16 eq 123&$id=ESAllKey")
- .isIdText("ESAllKey")
- .goFilter().is("<<PropertyInt16> eq <123>>");
- }
-
- @Test(expected = UriParserSyntaxException.class)
- public void testEntityFailOnValidation2() throws Exception {
- // simple entity set; with qualifiedentityTypeName; with 2xformat(before and after), expand, filter
- testUri.run("$entity/olingo.odata.test1.ETTwoPrim",
- "$format=xml&$expand=*&abc=123&$id=ESBase&xyz=987&$filter=PropertyInt16 eq 123&$format=atom&$select=*")
- .isFormatText("atom")
- .isCustomParameter(0, "abc", "123")
- .isIdText("ESBase")
- .isCustomParameter(1, "xyz", "987")
- .isSelectItemStar(0);
- }
-
- @Test
- public void testEntity() throws Exception {
-
- // simple entity set
- testUri.run("$entity", "$id=ESAllPrim").isKind(UriInfoKind.entityId)
- .isKind(UriInfoKind.entityId)
- .isIdText("ESAllPrim");
-
- // simple entity set; $format before $id
- testUri.run("$entity", "$format=xml&$id=ETAllPrim").isKind(UriInfoKind.entityId)
- .isFormatText("xml")
- .isIdText("ETAllPrim");
-
- testUri.run("$entity", "$format=xml&abc=123&$id=ESAllKey").isKind(UriInfoKind.entityId)
- .isFormatText("xml")
- .isCustomParameter(0, "abc", "123")
- .isIdText("ESAllKey");
-
- // simple entity set; $format after $id
- testUri.run("$entity", "$id=ETAllPrim&$format=xml").isKind(UriInfoKind.entityId)
- .isIdText("ETAllPrim")
- .isFormatText("xml");
-
- // simple entity set; $format and custom parameter after $id
- testUri.run("$entity", "$id=ETAllPrim&$format=xml&abc=123").isKind(UriInfoKind.entityId)
- .isIdText("ETAllPrim")
- .isFormatText("xml")
- .isCustomParameter(0, "abc", "123");
-
- // simple entity set; $format before $id and custom parameter after $id
- testUri.run("$entity", "$format=xml&$id=ETAllPrim&abc=123").isKind(UriInfoKind.entityId)
- .isFormatText("xml")
- .isIdText("ETAllPrim")
- .isCustomParameter(0, "abc", "123");
-
- // simple entity set; with qualifiedentityTypeName
- testUri.run("$entity/olingo.odata.test1.ETTwoPrim", "$id=ESBase")
- .isEntityType(EntityTypeProvider.nameETTwoPrim)
- .isIdText("ESBase");
-
- // simple entity set; with qualifiedentityTypeName;
- testUri.run("$entity/olingo.odata.test1.ETBase", "$id=ESTwoPrim")
- .isEntityType(EntityTypeProvider.nameETBase)
- .isKind(UriInfoKind.entityId)
- .isIdText("ESTwoPrim");
-
- // simple entity set; with qualifiedentityTypeName; with format
- testUri.run("$entity/olingo.odata.test1.ETBase", "$id=ESTwoPrim&$format=atom")
- .isKind(UriInfoKind.entityId)
- .isEntityType(EntityTypeProvider.nameETBase)
- .isIdText("ESTwoPrim")
- .isFormatText("atom");
-
- // simple entity set; with qualifiedentityTypeName; with select
- testUri.run("$entity/olingo.odata.test1.ETBase", "$id=ESTwoPrim&$select=*")
- .isKind(UriInfoKind.entityId)
- .isEntityType(EntityTypeProvider.nameETBase)
- .isIdText("ESTwoPrim")
- .isSelectItemStar(0);
-
- // simple entity set; with qualifiedentityTypeName; with expand
- testUri.run("$entity/olingo.odata.test1.ETBase", "$id=ESTwoPrim&$expand=*")
- .isKind(UriInfoKind.entityId)
- .isEntityType(EntityTypeProvider.nameETBase)
- .isIdText("ESTwoPrim")
- .isExpandText("*")
- .goExpand().first().isSegmentStar();
-
- }
-
- @Test
- public void testEntitySet() throws UnsupportedEncodingException {
-
- // plain entity set
- testRes.run("ESAllPrim")
- .isEntitySet("ESAllPrim")
- .isType(EntityTypeProvider.nameETAllPrim);
-
- // with one key; simple key notation
- testRes.run("ESAllPrim(1)")
- .isEntitySet("ESAllPrim")
- .isType(EntityTypeProvider.nameETAllPrim)
- .isKeyPredicate(0, "PropertyInt16", "1");
-
- // with one key; name value key notation
- testRes.run("ESAllPrim(PropertyInt16=1)")
- .isEntitySet("ESAllPrim")
- .isKeyPredicate(0, "PropertyInt16", "1");
-
- // with two keys
- testRes.run("ESTwoKeyTwoPrim(PropertyInt16=1, PropertyString='ABC')")
- .isEntitySet("ESTwoKeyTwoPrim")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isKeyPredicate(1, "PropertyString", "'ABC'");
-
- // with all keys
- testRes.run("ESAllKey(" + encode(allKeys) + ")")
- .isEntitySet("ESAllKey")
- .isKeyPredicate(0, "PropertyString", "'ABC'")
- .isKeyPredicate(1, "PropertyInt16", "1")
- .isKeyPredicate(2, "PropertyBoolean", "true")
- .isKeyPredicate(3, "PropertyByte", "1")
- .isKeyPredicate(4, "PropertySByte", "1")
- .isKeyPredicate(5, "PropertyInt32", "12")
- .isKeyPredicate(6, "PropertyInt64", "64")
- .isKeyPredicate(7, "PropertyDecimal", "12")
- .isKeyPredicate(8, "PropertyDate", "2013-09-25")
- .isKeyPredicate(9, "PropertyDateTimeOffset", "2002-10-10T12:00:00-05:00")
- .isKeyPredicate(10, "PropertyDuration", "duration'P50903316DT2H25M4S'")
- .isKeyPredicate(11, "PropertyGuid", "12345678-1234-1234-1234-123456789012")
- .isKeyPredicate(12, "PropertyTimeOfDay", "12:34:55");
- }
-
- @Test
- public void testEntitySet_NavigationProperty() {
-
- // plain entity set ...
-
- // with navigation property
- testRes.run("ESKeyNav(1)/NavPropertyETTwoKeyNavOne")
- .at(0)
- .isEntitySet("ESKeyNav")
- .isType(EntityTypeProvider.nameETKeyNav)
- .isKeyPredicate(0, "PropertyInt16", "1")
- .at(1)
- .isNavProperty("NavPropertyETTwoKeyNavOne", EntityTypeProvider.nameETTwoKeyNav, false)
- .isType(EntityTypeProvider.nameETTwoKeyNav);
-
- // with navigation property -> property
- testRes.run("ESKeyNav(1)/NavPropertyETTwoKeyNavOne/PropertyString")
- .at(0)
- .isEntitySet("ESKeyNav")
- .isType(EntityTypeProvider.nameETKeyNav, false)
- .isKeyPredicate(0, "PropertyInt16", "1")
- .at(1)
- .isNavProperty("NavPropertyETTwoKeyNavOne", EntityTypeProvider.nameETTwoKeyNav, false)
- .at(2)
- .isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false);
-
- // with navigation property -> navigation property -> navigation property
- testRes.run("ESKeyNav(1)/NavPropertyETTwoKeyNavOne/NavPropertyETKeyNavOne")
- .at(0)
- .isEntitySet("ESKeyNav")
- .isType(EntityTypeProvider.nameETKeyNav)
- .isKeyPredicate(0, "PropertyInt16", "1")
- .at(1)
- .isNavProperty("NavPropertyETTwoKeyNavOne", EntityTypeProvider.nameETTwoKeyNav, false)
- .isType(EntityTypeProvider.nameETTwoKeyNav)
- .at(2)
- .isNavProperty("NavPropertyETKeyNavOne", EntityTypeProvider.nameETKeyNav, false)
- .isType(EntityTypeProvider.nameETKeyNav);
-
- // with navigation property(key)
- testRes.run("ESKeyNav(1)/NavPropertyETKeyNavMany(1)")
- .at(0)
- .isEntitySet("ESKeyNav")
- .at(1)
- .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, false)
- .isKeyPredicate(0, "PropertyInt16", "1");
-
- // with navigation property(key) -> property
- testRes.run("ESKeyNav(1)/NavPropertyETKeyNavMany(1)/PropertyString").at(0)
- .at(0)
- .isEntitySet("ESKeyNav")
- .at(1)
- .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, false)
- .isKeyPredicate(0, "PropertyInt16", "1")
- .at(2)
- .isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false);
-
- // with navigation property(key) -> navigation property
- testRes.run("ESKeyNav(1)/NavPropertyETKeyNavMany(1)/NavPropertyETKeyNavOne")
- .isEntitySet("ESKeyNav")
- .at(1)
- .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, false)
- .isKeyPredicate(0, "PropertyInt16", "1")
- .at(2)
- .isNavProperty("NavPropertyETKeyNavOne", EntityTypeProvider.nameETKeyNav, false);
-
- // with navigation property(key) -> navigation property(key)
- testRes.run("ESKeyNav(1)/NavPropertyETKeyNavMany(1)/NavPropertyETKeyNavMany(1)")
- .isEntitySet("ESKeyNav")
- .isType(EntityTypeProvider.nameETKeyNav)
- .at(1)
- .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, false)
- .isKeyPredicate(0, "PropertyInt16", "1")
- .at(2)
- .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, false)
- .isKeyPredicate(0, "PropertyInt16", "1");
-
- // with navigation property(key) -> navigation property -> property
- testRes.run("ESKeyNav(1)/NavPropertyETKeyNavMany(1)/NavPropertyETKeyNavOne/PropertyString")
- .at(0)
- .isEntitySet("ESKeyNav")
- .isType(EntityTypeProvider.nameETKeyNav)
- .at(1)
- .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, false)
- .isKeyPredicate(0, "PropertyInt16", "1")
- .at(2)
- .isNavProperty("NavPropertyETKeyNavOne", EntityTypeProvider.nameETKeyNav, false)
- .isType(EntityTypeProvider.nameETKeyNav)
- .at(3)
- .isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false);
-
- // with navigation property(key) -> navigation property(key) -> property
- testRes.run("ESKeyNav(1)/NavPropertyETKeyNavMany(1)/NavPropertyETKeyNavMany(1)/PropertyString")
- .at(0)
- .isEntitySet("ESKeyNav")
- .isType(EntityTypeProvider.nameETKeyNav)
- .at(1)
- .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, false)
- .isKeyPredicate(0, "PropertyInt16", "1")
- .at(2)
- .isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, false)
- .isKeyPredicate(0, "PropertyInt16", "1")
- .at(3)
- .isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false);
-
- }
-
- @Test
- public void testEntitySet_Property() {
-
- // plain entity set ...
-
- // with property
- testRes.run("ESAllPrim(1)/PropertyString")
- .at(0)
- .isEntitySet("ESAllPrim")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .at(1)
- .isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false);
-
- // with complex property
- testRes.run("ESCompAllPrim(1)/PropertyComp")
- .at(0)
- .isEntitySet("ESCompAllPrim")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .at(1)
- .isComplexProperty("PropertyComp", ComplexTypeProvider.nameCTAllPrim, false);
-
- // with two properties
- testRes.run("ESCompAllPrim(1)/PropertyComp/PropertyString")
- .at(0)
- .isEntitySet("ESCompAllPrim")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .at(1)
- .isComplexProperty("PropertyComp", ComplexTypeProvider.nameCTAllPrim, false)
- .at(2)
- .isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false);
- }
-
- @Test
- public void testEntitySet_TypeFilter() {
-
- // filter
- testRes.run("ESTwoPrim/olingo.odata.test1.ETBase")
- .at(0)
- .isEntitySet("ESTwoPrim")
- .isType(EntityTypeProvider.nameETTwoPrim, true)
- .isTypeFilterOnCollection(EntityTypeProvider.nameETBase)
- .isTypeFilterOnEntry(null);
-
- // filter before key predicate
- testRes.run("ESTwoPrim/olingo.odata.test1.ETBase(PropertyInt16=1)")
- .at(0)
- .isEntitySet("ESTwoPrim")
- .isUriPathInfoKind(UriResourceKind.entitySet)
- .isType(EntityTypeProvider.nameETTwoPrim)
- .isTypeFilterOnCollection(EntityTypeProvider.nameETBase)
- .isTypeFilterOnEntry(null)
- .at(0)
- .isType(EntityTypeProvider.nameETTwoPrim, false)
- .isKeyPredicate(0, "PropertyInt16", "1");
-
- // filter before key predicate; property of sub type
- testRes.run("ESTwoPrim/olingo.odata.test1.ETBase(PropertyInt16=1)/AdditionalPropertyString_5")
- .at(0)
- .isEntitySet("ESTwoPrim")
- .isUriPathInfoKind(UriResourceKind.entitySet)
- .isType(EntityTypeProvider.nameETTwoPrim)
- .isTypeFilterOnCollection(EntityTypeProvider.nameETBase)
- .isTypeFilterOnEntry(null)
- .isKeyPredicate(0, "PropertyInt16", "1")
- .at(1)
- .isType(PropertyProvider.nameString)
- .isPrimitiveProperty("AdditionalPropertyString_5", PropertyProvider.nameString, false);
-
- // filter after key predicate
- testRes.run("ESTwoPrim(PropertyInt16=1)/olingo.odata.test1.ETBase")
- .at(0)
- .isEntitySet("ESTwoPrim")
- .isUriPathInfoKind(UriResourceKind.entitySet)
- .isType(EntityTypeProvider.nameETTwoPrim, false)
- .isTypeFilterOnCollection(null)
- .isTypeFilterOnEntry(EntityTypeProvider.nameETBase)
- .isKeyPredicate(0, "PropertyInt16", "1");
-
- // filter after key predicate; property of sub type
- testRes.run("ESTwoPrim(PropertyInt16=1)/olingo.odata.test1.ETBase/AdditionalPropertyString_5")
- .at(0)
- .isEntitySet("ESTwoPrim")
- .isUriPathInfoKind(UriResourceKind.entitySet)
- .isType(EntityTypeProvider.nameETTwoPrim)
- .isTypeFilterOnCollection(null)
- .isTypeFilterOnEntry(EntityTypeProvider.nameETBase)
- .isKeyPredicate(0, "PropertyInt16", "1")
- .at(1)
- .isPrimitiveProperty("AdditionalPropertyString_5", PropertyProvider.nameString, false)
- .isType(PropertyProvider.nameString);
-
- }
-
- @Test
- public void testUnary() throws UriParserException {
- testFilter.runESabc("not a").isCompr("<not <a>>");
- testFilter.runESabc("- a eq a").isCompr("<<- <a>> eq <a>>");
- testFilter.runESabc("-a eq a").isCompr("<<- <a>> eq <a>>");
- }
-
- @Test
- public void testFilterComplexMixedPriority() throws UriParserException {
- testFilter.runESabc("a or c and e ").isCompr("< <a> or < <c> and <e> >>");
- testFilter.runESabc("a or c and e eq f").isCompr("< <a> or < <c> and <<e> eq <f>>>>");
- testFilter.runESabc("a or c eq d and e ").isCompr("< <a> or <<<c> eq <d>> and <e> >>");
- testFilter.runESabc("a or c eq d and e eq f").isCompr("< <a> or <<<c> eq <d>> and <<e> eq <f>>>>");
- testFilter.runESabc("a eq b or c and e ").isCompr("<<<a> eq <b>> or < <c> and <e> >>");
- testFilter.runESabc("a eq b or c and e eq f").isCompr("<<<a> eq <b>> or < <c> and <<e> eq <f>>>>");
- testFilter.runESabc("a eq b or c eq d and e ").isCompr("<<<a> eq <b>> or <<<c> eq <d>> and <e> >>");
- testFilter.runESabc("a eq b or c eq d and e eq f").isCompr("<<<a> eq <b>> or <<<c> eq <d>> and <<e> eq <f>>>>");
- }
-
- @Test
- public void testFilterSimpleSameBinaryBinaryBinaryPriority() throws UriParserException {
-
- testFilter.runESabc("1 add 2 add 3 add 4").isCompr("<<< <1> add <2>> add <3>> add <4>>");
- testFilter.runESabc("1 add 2 add 3 div 4").isCompr("<< <1> add <2>> add <<3> div <4>>>");
- testFilter.runESabc("1 add 2 div 3 add 4").isCompr("<< <1> add <<2> div <3>>> add <4>>");
- testFilter.runESabc("1 add 2 div 3 div 4").isCompr("< <1> add <<<2> div <3>> div <4>>>");
- testFilter.runESabc("1 div 2 add 3 add 4").isCompr("<<< <1> div <2>> add <3>> add <4>>");
- testFilter.runESabc("1 div 2 add 3 div 4").isCompr("<< <1> div <2>> add <<3> div <4>>>");
- testFilter.runESabc("1 div 2 div 3 add 4").isCompr("<<< <1> div <2>> div <3>> add <4>>");
- testFilter.runESabc("1 div 2 div 3 div 4").isCompr("<<< <1> div <2>> div <3>> div <4>>");
- }
-
- @Test
- public void testFunctionImport_VarParameters() {
-
- // no input
- testRes.run("FINRTInt16()")
- .isFunctionImport("FINRTInt16")
- .isFunction("UFNRTInt16")
- .isType(PropertyProvider.nameInt16);
-
- // one input
- testRes.run("FICRTETTwoKeyNavParam(ParameterInt16=1)")
- .isFunctionImport("FICRTETTwoKeyNavParam")
- .isFunction("UFCRTETTwoKeyNavParam")
- .isType(EntityTypeProvider.nameETTwoKeyNav);
-
- // two input
- testRes.run("FICRTStringTwoParam(ParameterString='ABC',ParameterInt16=1)")
- .isFunctionImport("FICRTStringTwoParam")
- .isFunction("UFCRTStringTwoParam")
- .isType(PropertyProvider.nameString);
- }
-
- @Test
- public void testFunctionImport_VarReturning() {
- // returning primitive
- testRes.run("FINRTInt16()")
- .isFunctionImport("FINRTInt16")
- .isFunction("UFNRTInt16")
- .isType(PropertyProvider.nameInt16, false);
-
- // returning collection of primitive
- testRes.run("FICRTCollStringTwoParam(ParameterString='ABC',ParameterInt16=1)")
- .isFunctionImport("FICRTCollStringTwoParam")
- .isFunction("UFCRTCollStringTwoParam")
- .isType(PropertyProvider.nameString, true);
-
- // returning single complex
- testRes.run("FICRTCTAllPrimTwoParam(ParameterString='ABC',ParameterInt16=1)")
- .isFunctionImport("FICRTCTAllPrimTwoParam")
- .isFunction("UFCRTCTAllPrimTwoParam")
- .isType(ComplexTypeProvider.nameCTAllPrim, false);
-
- // returning collection of complex
- testRes.run("FICRTCollCTTwoPrim()")
- .isFunctionImport("FICRTCollCTTwoPrim")
- .isFunction("UFCRTCollCTTwoPrim")
- .isType(ComplexTypeProvider.nameCTTwoPrim, true);
-
- // returning single entity
- testRes.run("FICRTETTwoKeyNavParam(ParameterInt16=1)")
- .isFunctionImport("FICRTETTwoKeyNavParam")
- .isFunction("UFCRTETTwoKeyNavParam")
- .isType(EntityTypeProvider.nameETTwoKeyNav, false);
-
- // returning collection of entity (aka entitySet)
- testRes.run("FICRTESTwoKeyNavParam(ParameterInt16=1)")
- .isFunctionImport("FICRTESTwoKeyNavParam")
- .isFunction("UFCRTESTwoKeyNavParam")
- .isType(EntityTypeProvider.nameETTwoKeyNav, true);
- }
-
- @Test
- public void testFunctionImportChain() {
-
- // test chain; returning single complex
- testRes.run("FICRTCTAllPrimTwoParam(ParameterString='ABC',ParameterInt16=1)/PropertyInt16")
- .at(0)
- .isFunctionImport("FICRTCTAllPrimTwoParam")
- .isFunction("UFCRTCTAllPrimTwoParam")
- .isType(ComplexTypeProvider.nameCTAllPrim, false)
- .isParameter(0, "ParameterString", "'ABC'")
- .isParameter(1, "ParameterInt16", "1")
- .at(1)
- .isPrimitiveProperty("PropertyInt16", PropertyProvider.nameInt16, false);
-
- // test chains; returning single entity
- testRes.run("FICRTETTwoKeyNavParam(ParameterInt16=1)/PropertyInt16")
- .at(0)
- .isFunctionImport("FICRTETTwoKeyNavParam")
- .isFunction("UFCRTETTwoKeyNavParam")
- .isType(EntityTypeProvider.nameETTwoKeyNav, false)
- .isParameter(0, "ParameterInt16", "1")
- .at(1)
- .isPrimitiveProperty("PropertyInt16", PropertyProvider.nameInt16, false);
-
- // test chains; returning collection of entity (aka entitySet)
- testRes.run("FICRTESTwoKeyNavParam(ParameterInt16=1)(PropertyInt16=1,PropertyString='ABC')")
- .at(0)
- .isFunctionImport("FICRTESTwoKeyNavParam")
- .isFunction("UFCRTESTwoKeyNavParam")
- .isType(EntityTypeProvider.nameETTwoKeyNav, false)
- .isParameter(0, "ParameterInt16", "1")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isKeyPredicate(1, "PropertyString", "'ABC'");
-
- // test chains; returning collection of entity (aka entitySet)
- testRes.run("FICRTESTwoKeyNavParam(ParameterInt16=1)(PropertyInt16=1,PropertyString='ABC')/PropertyInt16")
- .at(0)
- .isFunctionImport("FICRTESTwoKeyNavParam")
- .isFunction("UFCRTESTwoKeyNavParam")
- .isType(EntityTypeProvider.nameETTwoKeyNav, false)
- .isParameter(0, "ParameterInt16", "1")
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isKeyPredicate(1, "PropertyString", "'ABC'")
- .at(1)
- .isPrimitiveProperty("PropertyInt16", PropertyProvider.nameInt16, false);
-
- }
-
- @Test
- public void testMetaData() throws Exception {
-
- // Parsing the fragment may be used if a uri has to be parsed on the consumer side.
- // On the producer side this feature is currently not supported, so the context fragment
- // part is only available as text.
-
- testUri.run("$metadata")
- .isKind(UriInfoKind.metadata);
-
- testUri.run("$metadata", "$format=atom")
- .isKind(UriInfoKind.metadata)
- .isFormatText("atom");
-
- // with context (client usage)
-
- testUri.run("$metadata", null, "$ref")
- .isKind(UriInfoKind.metadata)
- .isFragmentText("$ref");
-
- testUri.run("$metadata", "$format=atom", "$ref")
- .isKind(UriInfoKind.metadata)
- .isFormatText("atom")
- .isFragmentText("$ref");
-
- testUri.run("$metadata", "$format=atom", "Collection($ref)")
- .isKind(UriInfoKind.metadata)
- .isFormatText("atom")
- .isFragmentText("Collection($ref)");
-
- testUri.run("$metadata", "$format=atom", "Collection(Edm.EntityType)")
- .isKind(UriInfoKind.metadata)
- .isFormatText("atom")
- .isFragmentText("Collection(Edm.EntityType)");
-
- testUri.run("$metadata", "$format=atom", "Collection(Edm.ComplexType)")
- .isKind(UriInfoKind.metadata)
- .isFormatText("atom")
- .isFragmentText("Collection(Edm.ComplexType)");
-
- testUri.run("$metadata", "$format=atom", "SINav")
- .isKind(UriInfoKind.metadata)
- .isFormatText("atom")
- .isFragmentText("SINav");
-
- testUri.run("$metadata", "$format=atom", "SINav/PropertyInt16")
- .isKind(UriInfoKind.metadata)
- .isFormatText("atom")
- .isFragmentText("SINav/PropertyInt16");
-
- testUri.run("$metadata", "$format=atom", "SINav/NavPropertyETKeyNavOne")
- .isKind(UriInfoKind.metadata)
- .isFormatText("atom")
- .isFragmentText("SINav/NavPropertyETKeyNavOne");
-
- testUri.run("$metadata", "$format=atom", "SINav/NavPropertyETKeyNavMany(1)")
- .isKind(UriInfoKind.metadata)
- .isFormatText("atom")
- .isFragmentText("SINav/NavPropertyETKeyNavMany(1)");
-
- testUri.run("$metadata", "$format=atom", "SINav/NavPropertyETKeyNavOne/PropertyInt16")
- .isKind(UriInfoKind.metadata)
- .isFormatText("atom")
- .isFragmentText("SINav/NavPropertyETKeyNavOne/PropertyInt16");
-
- testUri.run("$metadata", "$format=atom", "SINav/NavPropertyETKeyNavMany(1)/PropertyInt16")
- .isKind(UriInfoKind.metadata)
- .isFormatText("atom")
- .isFragmentText("SINav/NavPropertyETKeyNavMany(1)/PropertyInt16");
-
- testUri.run("$metadata", "$format=atom", "SINav/olingo.odata.test1.ETTwoPrim/NavPropertyETKeyNavOne/PropertyInt16")
- .isKind(UriInfoKind.metadata)
- .isFormatText("atom")
- .isFragmentText("SINav/olingo.odata.test1.ETTwoPrim/NavPropertyETKeyNavOne/PropertyInt16");
-
- testUri.run("$metadata", "$format=atom",
- "SINav/olingo.odata.test1.ETTwoPrim/NavPropertyETKeyNavMany(1)/PropertyInt16")
- .isKind(UriInfoKind.metadata)
- .isFormatText("atom")
- .isFragmentText("SINav/olingo.odata.test1.ETTwoPrim/NavPropertyETKeyNavMany(1)/PropertyInt16");
-
- testUri.run("$metadata", "$format=atom", "olingo.odata.test1.ETAllKey")
- .isKind(UriInfoKind.metadata)
- .isFormatText("atom")
- .isFragmentText("olingo.odata.test1.ETAllKey");
-
- testUri.run("$metadata", "$format=atom", "ESTwoPrim/$deletedEntity")
- .isKind(UriInfoKind.metadata)
- .isFormatText("atom")
- .isFragmentText("ESTwoPrim/$deletedEntity");
-
- testUri.run("$metadata", "$format=atom", "ESTwoPrim/$link")
- .isKind(UriInfoKind.metadata)
- .isFormatText("atom")
- .isFragmentText("ESTwoPrim/$link");
-
- testUri.run("$metadata", "$format=atom", "ESTwoPrim/$deletedLink")
- .isKind(UriInfoKind.metadata)
- .isFormatText("atom")
- .isFragmentText("ESTwoPrim/$deletedLink");
-
- testUri.run("$metadata", "$format=atom", "ESKeyNav")
- .isKind(UriInfoKind.metadata)
- .isFormatText("atom")
- .isFragmentText("ESKeyNav");
-
- testUri.run("$metadata", "$format=atom", "ESKeyNav/PropertyInt16")
- .isKind(UriInfoKind.metadata)
- .isFormatText("atom")
- .isFragmentText("ESKeyNav/PropertyInt16");
-
- testUri.run("$metadata", "$format=atom", "ESKeyNav/NavPropertyETKeyNavOne")
- .isKind(UriInfoKind.metadata)
- .isFormatText("atom")
- .isFragmentText("ESKeyNav/NavPropertyETKeyNavOne");
-
- testUri.run("$metadata", "$format=atom", "ESKeyNav/NavPropertyETKeyNavMany(1)")
- .isKind(UriInfoKind.metadata)
- .isFormatText("atom")
- .isFragmentText("ESKeyNav/NavPropertyETKeyNavMany(1)");
-
- testUri.run("$metadata", "$format=atom", "ESKeyNav/NavPropertyETKeyNavOne/PropertyInt16")
- .isKind(UriInfoKind.metadata)
- .isFormatText("atom")
- .isFragmentText("ESKeyNav/NavPropertyETKeyNavOne/PropertyInt16");
-
- testUri.run("$metadata", "$format=atom", "ESKeyNav/NavPropertyETKeyNavMany(1)/PropertyInt16")
- .isKind(UriInfoKind.metadata)
- .isFormatText("atom")
- .isFragmentText("ESKeyNav/NavPropertyETKeyNavMany(1)/PropertyInt16");
-
- testUri.run("$metadata", "$format=atom",
- "ESKeyNav/olingo.odata.test1.ETTwoPrim/NavPropertyETKeyNavOne/PropertyInt16")
- .isKind(UriInfoKind.metadata)
- .isFormatText("atom")
- .isFragmentText("ESKeyNav/olingo.odata.test1.ETTwoPrim/NavPropertyETKeyNavOne/PropertyInt16");
-
- testUri.run(
- "$metadata", "$format=atom", "ESKeyNav/olingo.odata.test1.ETTwoPrim/NavPropertyETKeyNavMany(1)/PropertyInt16")
- .isKind(UriInfoKind.metadata)
- .isFormatText("atom")
- .isFragmentText("ESKeyNav/olingo.odata.test1.ETTwoPrim/NavPropertyETKeyNavMany(1)/PropertyInt16");
-
- testUri.run("$metadata", "$format=atom", "ESKeyNav(PropertyInt16,PropertyString)")
- .isKind(UriInfoKind.metadata)
- .isFormatText("atom")
- .isFragmentText("ESKeyNav(PropertyInt16,PropertyString)");
-
- testUri.run("$metadata", "$format=atom", "ESKeyNav/$entity")
- .isKind(UriInfoKind.metadata)
- .isFormatText("atom")
- .isFragmentText("ESKeyNav/$entity");
-
- testUri.run("$metadata", "$format=atom", "ESKeyNav/$delta")
- .isKind(UriInfoKind.metadata)
- .isFormatText("atom")
- .isFragmentText("ESKeyNav/$delta");
-
- testUri.run("$metadata", "$format=atom", "ESKeyNav/(PropertyInt16,PropertyString)/$delta")
- .isKind(UriInfoKind.metadata)
- .isFormatText("atom")
- .isFragmentText("ESKeyNav/(PropertyInt16,PropertyString)/$delta");
-
- }
-
- @Test
- public void testRef() throws Exception {
- testUri.run("ESKeyNav(1)/NavPropertyETTwoKeyNavOne/$ref");
- }
-
- @Test
- public void testSingleton() {
- // plain singleton
- testRes.run("SINav")
- .isSingleton("SINav")
- .isType(EntityTypeProvider.nameETTwoKeyNav);
- }
-
- @Test
- public void testNavigationProperty() {
-
- // plain entity set ...
-
- // with navigation property
- testRes.run("ESKeyNav(1)/NavPropertyETTwoKeyNavOne")
- .at(0).isEntitySet("ESKeyNav")
- .at(1).isNavProperty("NavPropertyETTwoKeyNavOne", EntityTypeProvider.nameETTwoKeyNav, false);
-
- // with navigation property -> property
- testRes.run("ESKeyNav(1)/NavPropertyETTwoKeyNavOne/PropertyString")
- .at(0).isEntitySet("ESKeyNav")
- .at(1).isNavProperty("NavPropertyETTwoKeyNavOne", EntityTypeProvider.nameETTwoKeyNav, false)
- .at(2).isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false);
-
- // with navigation property -> navigation property -> navigation property
- testRes.run("ESKeyNav(1)/NavPropertyETTwoKeyNavOne/NavPropertyETKeyNavOne")
- .at(0).isEntitySet("ESKeyNav")
- .at(1).isNavProperty("NavPropertyETTwoKeyNavOne", EntityTypeProvider.nameETTwoKeyNav, false)
- .at(2).isNavProperty("NavPropertyETKeyNavOne", EntityTypeProvider.nameETKeyNav, false);
-
- // with navigation property(key)
- testRes.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=1,PropertyString='1')")
- .at(0).isEntitySet("ESKeyNav")
- .at(1).isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, false)
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isKeyPredicate(1, "PropertyString", "'1'");
-
- // with navigation property(key) -> property
- testRes.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=1,PropertyString='1')/PropertyString")
- .at(0).isEntitySet("ESKeyNav")
- .at(1).isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, false)
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isKeyPredicate(1, "PropertyString", "'1'")
- .at(2).isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false);
-
- // with navigation property(key) -> navigation property
- testRes.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=1,PropertyString='1')/NavPropertyETKeyNavOne")
- .at(0).isEntitySet("ESKeyNav")
- .at(1).isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, false)
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isKeyPredicate(1, "PropertyString", "'1'")
- .at(2).isNavProperty("NavPropertyETKeyNavOne", EntityTypeProvider.nameETKeyNav, false);
-
- // with navigation property(key) -> navigation property(key)
- testRes.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=1,PropertyString='1')"
- + "/NavPropertyETKeyNavMany(1)")
- .at(0).isEntitySet("ESKeyNav")
- .at(1).isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, false)
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isKeyPredicate(1, "PropertyString", "'1'")
- .at(2).isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, false)
- .isKeyPredicate(0, "PropertyInt16", "1");
-
- // with navigation property(key) -> navigation property -> property
- testRes.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=1,PropertyString='1')"
- + "/NavPropertyETKeyNavOne/PropertyString")
- .at(0).isEntitySet("ESKeyNav")
- .at(1).isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, false)
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isKeyPredicate(1, "PropertyString", "'1'")
- .at(2).isNavProperty("NavPropertyETKeyNavOne", EntityTypeProvider.nameETKeyNav, false)
- .at(3).isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false);
-
- // with navigation property(key) -> navigation property(key) -> property
- testRes.run("ESKeyNav(1)/NavPropertyETTwoKeyNavMany(PropertyInt16=1,PropertyString='1')"
- + "/NavPropertyETKeyNavMany(1)/PropertyString")
- .at(0).isEntitySet("ESKeyNav")
- .at(1).isNavProperty("NavPropertyETTwoKeyNavMany", EntityTypeProvider.nameETTwoKeyNav, false)
- .isKeyPredicate(0, "PropertyInt16", "1")
- .isKeyPredicate(1, "PropertyString", "'1'")
- .at(2).isNavProperty("NavPropertyETKeyNavMany", EntityTypeProvider.nameETKeyNav, false)
- .isKeyPredicate(0, "PropertyInt16", "1")
- .at(3).isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false);
- }
-
- @Test
- public void testSingleton_Property() {
-
- // plain singleton ...
-
- // with property
- testRes.run("SINav/PropertyInt16")
- .at(0)
- .isSingleton("SINav")
- .isType(EntityTypeProvider.nameETTwoKeyNav)
- .at(1)
- .isPrimitiveProperty("PropertyInt16", PropertyProvider.nameInt16, false);
-
- // with complex property
- testRes.run("SINav/PropertyComp")
- .at(0)
- .isSingleton("SINav")
- .isType(EntityTypeProvider.nameETTwoKeyNav)
- .at(1)
- .isComplexProperty("PropertyComp", ComplexTypeProvider.nameCTPrimComp, false);
-
- // with two properties
- testRes.run("SINav/PropertyComp/PropertyInt16")
- .at(0)
- .isSingleton("SINav")
- .isType(EntityTypeProvider.nameETTwoKeyNav)
- .at(1)
- .isComplexProperty("PropertyComp", ComplexTypeProvider.nameCTPrimComp, false)
- .at(2)
- .isPrimitiveProperty("PropertyInt16", PropertyProvider.nameInt16, false);
-
- }
-
- @Test
- public void testValue() throws Exception {
- testUri.run("ESAllPrim(1)/PropertyString/$value");
- }
-
- @Test(expected = UriValidationException.class)
- public void testMemberStartingWithCastFailOnValidation1() throws Exception {
- // on EntityType entry
- testUri.run("ESTwoKeyNav(ParameterInt16=1,PropertyString='ABC')",
- "$filter=olingo.odata.test1.ETBaseTwoKeyNav/PropertyDate")
- .goFilter().root().isMember()
- .isMemberStartType(EntityTypeProvider.nameETBaseTwoKeyNav).goPath()
- // .at(0)
- // .isUriPathInfoKind(UriResourceKind.startingTypeFilter)
- // .isType(EntityTypeProvider.nameETTwoKeyNav, false)
- // .isTypeFilterOnEntry(EntityTypeProvider.nameETBaseTwoKeyNav)
- .at(0).isType(PropertyProvider.nameDate);
- }
-
- @Test(expected = UriValidationException.class)
- public void testMemberStartingWithCastFailOnValidation2() throws Exception {
- testUri.run("FICRTCTTwoPrimParam(ParameterInt16=1,ParameterString='2')",
- "$filter=olingo.odata.test1.CTBase/AdditionalPropString")
- .goFilter().root().isMember()
- .isMemberStartType(ComplexTypeProvider.nameCTBase).goPath()
- // .at(0)
- // .isUriPathInfoKind(UriResourceKind.startingTypeFilter)
- // .isType(ComplexTypeProvider.nameCTTwoPrim, false)
- // .isTypeFilterOnEntry(ComplexTypeProvider.nameCTBase)
- .at(0).isType(PropertyProvider.nameString);
- }
-
- @Test
- public void testMemberStartingWithCast() throws Exception {
-
- // on EntityType collection
- testUri.run("ESTwoKeyNav", "$filter=olingo.odata.test1.ETBaseTwoKeyNav/PropertyDate")
- .goFilter().root().isMember()
- .isMemberStartType(EntityTypeProvider.nameETBaseTwoKeyNav).goPath()
- // .at(0)
- // .isUriPathInfoKind(UriResourceKind.startingTypeFilter)
- // .isType(EntityTypeProvider.nameETTwoKeyNav, true)
- // .isTypeFilterOnCollection(EntityTypeProvider.nameETBaseTwoKeyNav)
- .at(0).isType(PropertyProvider.nameDate);
-
- // on Complex collection
- testUri.run("FICRTCollCTTwoPrimParam(ParameterInt16=1,ParameterString='2')",
- "$filter=olingo.odata.test1.CTBase/AdditionalPropString")
- .goFilter().root().isMember()
- .isMemberStartType(ComplexTypeProvider.nameCTBase).goPath()
- // .at(0)
- // .isUriPathInfoKind(UriResourceKind.startingTypeFilter)
- // .isType(ComplexTypeProvider.nameCTTwoPrim, true)
- // .isTypeFilterOnCollection(ComplexTypeProvider.nameCTBase)
- .at(0).isType(PropertyProvider.nameString);
-
- }
-
- @Test
- public void testComplexTypeCastFollowingAsCollection() throws Exception {
- testUri.run("FICRTCollCTTwoPrimParam(ParameterInt16=1,ParameterString='2')/olingo.odata.test1.CTBase");
- }
-
- @Test
- public void testAlias() throws Exception {
- testUri.run("ESAllPrim", "$filter=PropertyInt16 eq @p1&@p1=1)")
- .goFilter().is("<<PropertyInt16> eq <@p1>>");
- }
-
- @Test
- public void testLambda() throws Exception {
- testUri.run("ESTwoKeyNav", "$filter=CollPropertyComp/all( l : true )")
- .goFilter().is("<CollPropertyComp/<ALL;<true>>>");
-
- testUri.run("ESTwoKeyNav", "$filter=CollPropertyComp/any( l : true )")
- .goFilter().is("<CollPropertyComp/<ANY;<true>>>");
- testUri.run("ESTwoKeyNav", "$filter=CollPropertyComp/any( )")
- .goFilter().is("<CollPropertyComp/<ANY;>>");
-
- testUri.run("ESTwoKeyNav", "$filter=all( l : true )")
- .goFilter().is("<<ALL;<true>>>");
- testUri.run("ESTwoKeyNav", "$filter=any( l : true )")
- .goFilter().is("<<ANY;<true>>>");
- testUri.run("ESTwoKeyNav", "$filter=any( )")
- .goFilter().is("<<ANY;>>");
- }
-
- @Test
- public void testCustomQueryOption() throws Exception {
- testUri.run("ESTwoKeyNav", "custom")
- .isCustomParameter(0, "custom", "");
- testUri.run("ESTwoKeyNav", "custom=ABC")
- .isCustomParameter(0, "custom", "ABC");
- }
-
- @Test
- public void testGeo() throws UriParserException {
- // TODO sync
- testFilter.runOnETAllPrim("geo.distance(PropertySByte,PropertySByte)")
- .is("<geo.distance(<PropertySByte>,<PropertySByte>)>")
- .isMethod(MethodKind.GEODISTANCE, 2);
- testFilter.runOnETAllPrim("geo.length(PropertySByte)")
- .is("<geo.length(<PropertySByte>)>")
- .isMethod(MethodKind.GEOLENGTH, 1);
- testFilter.runOnETAllPrim("geo.intersects(PropertySByte,PropertySByte)")
- .is("<geo.intersects(<PropertySByte>,<PropertySByte>)>")
- .isMethod(MethodKind.GEOINTERSECTS, 2);
- }
-
- @Test
- public void testSelect() throws Exception {
- testUri.run("ESTwoKeyNav", "$select=*")
- .isSelectItemStar(0);
-
- testUri.run("ESTwoKeyNav", "$select=olingo.odata.test1.*")
- .isSelectItemAllOp(0, new FullQualifiedName("olingo.odata.test1", "*"));
-
- testUri.run("ESTwoKeyNav", "$select=PropertyString")
- .goSelectItemPath(0).isPrimitiveProperty("PropertyString", PropertyProvider.nameString, false);
-
- testUri.run("ESTwoKeyNav", "$select=PropertyComp")
- .goSelectItemPath(0).isComplexProperty("PropertyComp", ComplexTypeProvider.nameCTPrimComp, false);
-
- testUri.run("ESTwoKeyNav", "$select=PropertyComp/PropertyInt16")
- .goSelectItemPath(0)
- .first()
- .isComplexProperty("PropertyComp", ComplexTypeProvider.nameCTPrimComp, false)
- .n()
- .isPrimitiveProperty("PropertyInt16", PropertyProvider.nameInt16, false);
-
- testUri.run("ESTwoKeyNav", "$select=PropertyComp/PropertyComp")
- .goSelectItemPath(0)
- .first()
- .isComplexProperty("PropertyComp", ComplexTypeProvider.nameCTPrimComp, false)
- .n()
- .isComplexProperty("PropertyComp", ComplexTypeProvider.nameCTAllPrim, false);
-
- testUri.run("ESTwoKeyNav", "$select=olingo.odata.test1.ETBaseTwoKeyNav")
- .isSelectStartType(0, EntityTypeProvider.nameETBaseTwoKeyNav);
-
- testUri.run("ESTwoKeyNav(PropertyInt16=1,PropertyString='1')/PropertyCompNav",
- "$select=olingo.odata.test1.CTTwoBasePrimCompNav")
- .isSelectStartType(0, ComplexTypeProvider.nameCTTwoBasePrimCompNav);
-
- testUri.run("ESTwoKeyNav", "$select=PropertyCompNav/olingo.odata.test1.CTTwoBasePrimCompNav")
- .goSelectItemPath(0)
- .first()
- .isComplexProperty("PropertyCompNav", ComplexTypeProvider.nameCTBasePrimCompNav, false)
- .n()
- .isTypeFilterOnCollection(ComplexTypeProvider.nameCTTwoBasePrimCompNav);
-
- testUri.run("ESAllPrim", "$select=PropertyTimeOfDay,PropertyDate,PropertyTimeOfDay")
- .isKind(UriInfoKind.resource)
- .goSelectItemPath(0).first().isPrimitiveProperty("PropertyTimeOfDay", PropertyProvider.nameTimeOfDay, false)
- .goUpUriValidator()
- .goSelectItemPath(1).first().isPrimitiveProperty("PropertyDate", PropertyProvider.nameDate, false);
-
- testUri.runEx("ESMixPrimCollComp", "$select=wrong")
- .isExSemantic(UriParserSemanticException.MessageKeys.EXPRESSION_PROPERTY_NOT_IN_TYPE);
- testUri.runEx("ESMixPrimCollComp", "$select=PropertyComp/wrong")
- .isExSemantic(UriParserSemanticException.MessageKeys.EXPRESSION_PROPERTY_NOT_IN_TYPE);
- testUri.runEx("ESMixPrimCollComp", "$select=PropertyComp///PropertyInt16")
- .isExSyntax(UriParserSyntaxException.MessageKeys.SYNTAX);
- testUri.runEx("ESMixPrimCollComp", "$select=/PropertyInt16")
- .isExSyntax(UriParserSyntaxException.MessageKeys.SYNTAX);
- }
-
- public static String encode(final String decoded) throws UnsupportedEncodingException {
- return URLEncoder.encode(decoded, "UTF-8");
- }
-}
diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/queryoption/QueryOptionTest.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/queryoption/QueryOptionTest.java
deleted file mode 100644
index cde718f..0000000
--- a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/queryoption/QueryOptionTest.java
+++ /dev/null
@@ -1,303 +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.uri.queryoption;
-
-import org.apache.olingo.commons.api.edm.Edm;
-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.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;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import static org.junit.Assert.assertEquals;
-
-//TOOD add getKind check to all
-public class QueryOptionTest {
-
- Edm edm = new EdmProviderImpl(new EdmTechTestProvider());
-
- @Test
- public void testAliasQueryOption() {
- AliasQueryOptionImpl option = new AliasQueryOptionImpl();
-
- ExpressionImpl expression = new LiteralImpl();
-
- option.setAliasValue(expression);
- assertEquals(expression, option.getValue());
- }
-
- @Test
- public void testExpandItemImpl() {
- ExpandItemImpl option = new ExpandItemImpl();
-
- // input options
- ExpandOptionImpl expand = new ExpandOptionImpl();
- FilterOptionImpl filter = new FilterOptionImpl();
- CountOptionImpl inlinecount = new CountOptionImpl();
- OrderByOptionImpl orderby = new OrderByOptionImpl();
- SearchOptionImpl search = new SearchOptionImpl();
- SelectOptionImpl select = new SelectOptionImpl();
- SkipOptionImpl skip = new SkipOptionImpl();
- TopOptionImpl top = new TopOptionImpl();
- LevelsOptionImpl levels = new LevelsOptionImpl();
-
- option.setSystemQueryOption(expand);
- option.setSystemQueryOption(filter);
- option.setSystemQueryOption(inlinecount);
- option.setSystemQueryOption(orderby);
- option.setSystemQueryOption(search);
- option.setSystemQueryOption(select);
- option.setSystemQueryOption(skip);
- option.setSystemQueryOption(top);
- option.setSystemQueryOption(levels);
-
- assertEquals(expand, option.getExpandOption());
- assertEquals(filter, option.getFilterOption());
- assertEquals(inlinecount, option.getCountOption());
- assertEquals(orderby, option.getOrderByOption());
- assertEquals(search, option.getSearchOption());
- assertEquals(select, option.getSelectOption());
- assertEquals(skip, option.getSkipOption());
- assertEquals(top, option.getTopOption());
- assertEquals(levels, option.getLevelsOption());
-
- // just for completeness
- option = new ExpandItemImpl();
- option.setSystemQueryOption(new IdOptionImpl());
-
- option = new ExpandItemImpl();
- List<SystemQueryOptionImpl> list = new ArrayList<SystemQueryOptionImpl>();
- list.add(expand);
- list.add(filter);
- option.setSystemQueryOptions(list);
- assertEquals(expand, option.getExpandOption());
- assertEquals(filter, option.getFilterOption());
-
- option = new ExpandItemImpl();
- assertEquals(false, option.isRef());
- option.setIsRef(true);
- assertEquals(true, option.isRef());
-
- option = new ExpandItemImpl();
- assertEquals(false, option.isStar());
- option.setIsStar(true);
- assertEquals(true, option.isStar());
-
- option = new ExpandItemImpl();
- UriInfoResource resource = new UriInfoImpl().asUriInfoResource();
- option.setResourcePath(resource);
- assertEquals(resource, option.getResourcePath());
-
- }
-
- @Test
- public void testExpandOptionImpl() {
- ExpandOptionImpl option = new ExpandOptionImpl();
- assertEquals(SystemQueryOptionKind.EXPAND, option.getKind());
-
- ExpandItemImpl item1 = new ExpandItemImpl();
- ExpandItemImpl item2 = new ExpandItemImpl();
- option.addExpandItem(item1);
- option.addExpandItem(item2);
- assertEquals(item1, option.getExpandItems().get(0));
- assertEquals(item2, option.getExpandItems().get(1));
- }
-
- @Test
- public void testFilterOptionImpl() {
- FilterOptionImpl option = new FilterOptionImpl();
- assertEquals(SystemQueryOptionKind.FILTER, option.getKind());
-
- AliasImpl expression = new AliasImpl();
-
- option.setExpression(expression);
- assertEquals(expression, option.getExpression());
- }
-
- @Test
- public void testFormatOptionImpl() {
- FormatOptionImpl option = new FormatOptionImpl();
- assertEquals(SystemQueryOptionKind.FORMAT, option.getKind());
-
- option.setFormat("A");
-
- assertEquals("A", option.getFormat());
- }
-
- @Test
- public void testIdOptionImpl() {
- IdOptionImpl option = new IdOptionImpl();
- assertEquals(SystemQueryOptionKind.ID, option.getKind());
-
- option.setValue("A");
-
- assertEquals("A", option.getValue());
- }
-
- @Test
- public void testInlineCountImpl() {
- CountOptionImpl option = new CountOptionImpl();
- assertEquals(SystemQueryOptionKind.COUNT, option.getKind());
-
- assertEquals(false, option.getValue());
- option.setValue(true);
- assertEquals(true, option.getValue());
- }
-
- @Test
- public void testLevelsExpandOptionImpl() {
- LevelsOptionImpl option = new LevelsOptionImpl();
- assertEquals(SystemQueryOptionKind.LEVELS, option.getKind());
-
- assertEquals(0, option.getValue());
- option.setValue(1);
- assertEquals(1, option.getValue());
-
- option = new LevelsOptionImpl();
- option.setMax();
- assertEquals(true, option.isMax());
- }
-
- @Test
- public void testOrderByItemImpl() {
- OrderByItemImpl option = new OrderByItemImpl();
-
- AliasImpl expression = new AliasImpl();
- option.setExpression(expression);
- assertEquals(expression, option.getExpression());
-
- assertEquals(false, option.isDescending());
- option.setDescending(true);
- assertEquals(true, option.isDescending());
- }
-
- @Test
- public void testOrderByOptionImpl() {
- OrderByOptionImpl option = new OrderByOptionImpl();
-
- OrderByItemImpl order0 = new OrderByItemImpl();
- OrderByItemImpl order1 = new OrderByItemImpl();
- option.addOrder(order0);
- option.addOrder(order1);
-
- assertEquals(order0, option.getOrders().get(0));
- assertEquals(order1, option.getOrders().get(1));
- }
-
- @Test
- public void testQueryOptionImpl() {
- QueryOptionImpl option = new AliasQueryOptionImpl();
-
- option.setName("A");
- option.setText("B");
- assertEquals("A", option.getName());
- assertEquals("B", option.getText());
- }
-
- @Test
- public void testSearchOptionImpl() {
- SearchOptionImpl option = new SearchOptionImpl();
- assertEquals(SystemQueryOptionKind.SEARCH, option.getKind());
- // TODO $search is not supported yet
- }
-
- @Test
- public void testSelectItemImpl() {
- SelectItemImpl option = new SelectItemImpl();
-
- // no typed collection else case ( e.g. if not path is added)
- option = new SelectItemImpl();
-
- option = new SelectItemImpl();
- assertEquals(false, option.isStar());
- option.setStar(true);
- assertEquals(true, option.isStar());
-
- option = new SelectItemImpl();
- assertEquals(false, option.isAllOperationsInSchema());
- FullQualifiedName fqName = new FullQualifiedName("Namespace", "Name");
- option.addAllOperationsInSchema(fqName);
- assertEquals(true, option.isAllOperationsInSchema());
- assertEquals(fqName, option.getAllOperationsInSchemaNameSpace());
-
- }
-
- @Test
- public void testSelectOptionImpl() {
- SelectOptionImpl option = new SelectOptionImpl();
- assertEquals(SystemQueryOptionKind.SELECT, option.getKind());
-
- SelectItemImpl item0 = new SelectItemImpl();
- SelectItemImpl item1 = new SelectItemImpl();
-
- ArrayList<SelectItemImpl> list = new ArrayList<SelectItemImpl>();
- list.add(item0);
- list.add(item1);
- option.setSelectItems(list);
-
- assertEquals(item0, option.getSelectItems().get(0));
- assertEquals(item1, option.getSelectItems().get(1));
-
- }
-
- @Test
- public void testSkipOptionImpl() {
- SkipOptionImpl option = new SkipOptionImpl();
- assertEquals(SystemQueryOptionKind.SKIP, option.getKind());
-
- option.setValue(10);
- assertEquals(10, option.getValue());
- }
-
- @Test
- public void testSkipTokenOptionImpl() {
- SkipTokenOptionImpl option = new SkipTokenOptionImpl();
- assertEquals(SystemQueryOptionKind.SKIPTOKEN, option.getKind());
-
- option.setValue("A");
- assertEquals("A", option.getValue());
- }
-
- @Test
- public void testSystemQueryOptionImpl() {
- SystemQueryOptionImpl option = new SystemQueryOptionImpl();
-
- option.setKind(SystemQueryOptionKind.EXPAND);
- assertEquals(SystemQueryOptionKind.EXPAND, option.getKind());
-
- assertEquals("$expand", option.getName());
- }
-
- @Test
- public void testTopOptionImpl() {
- TopOptionImpl option = new TopOptionImpl();
- assertEquals(SystemQueryOptionKind.TOP, option.getKind());
-
- option.setValue(11);
- assertEquals(11, option.getValue());
- }
-}
diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/queryoption/expression/ExpressionTest.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/queryoption/expression/ExpressionTest.java
deleted file mode 100644
index 51e5a83..0000000
--- a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/queryoption/expression/ExpressionTest.java
+++ /dev/null
@@ -1,239 +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.uri.queryoption.expression;
-
-import org.apache.olingo.commons.api.edm.Edm;
-import org.apache.olingo.commons.api.edm.EdmAction;
-import org.apache.olingo.commons.api.edm.EdmEntityType;
-import org.apache.olingo.commons.api.edm.EdmEnumType;
-import org.apache.olingo.commons.api.edm.EdmFunction;
-import org.apache.olingo.server.api.ODataApplicationException;
-import org.apache.olingo.server.api.uri.UriInfoKind;
-import org.apache.olingo.server.api.uri.UriInfoResource;
-import org.apache.olingo.server.api.uri.queryoption.expression.BinaryOperatorKind;
-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.api.uri.queryoption.expression.UnaryOperatorKind;
-import org.apache.olingo.server.core.edm.provider.EdmProviderImpl;
-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.tecsvc.provider.ActionProvider;
-import org.apache.olingo.server.tecsvc.provider.EntityTypeProvider;
-import org.apache.olingo.server.tecsvc.provider.EnumTypeProvider;
-import org.apache.olingo.server.tecsvc.provider.FunctionProvider;
-import org.junit.Test;
-
-import java.util.Arrays;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-public class ExpressionTest {
- Edm edm = new EdmProviderImpl(new EdmTechTestProvider());
-
- @Test
- public void testSupportedOperators() {
- assertEquals(UnaryOperatorKind.MINUS, UnaryOperatorKind.get("-"));
- assertEquals(null, UnaryOperatorKind.get("XXX"));
-
- assertEquals(BinaryOperatorKind.MOD, BinaryOperatorKind.get("mod"));
- assertEquals(null, BinaryOperatorKind.get("XXX"));
-
- assertEquals(MethodKind.CONCAT, MethodKind.get("concat"));
- assertEquals(null, MethodKind.get("XXX"));
- }
-
- @Test
- public void testAliasExpression() throws ExpressionVisitException, ODataApplicationException {
- AliasImpl expression = new AliasImpl();
-
- expression.setParameter("Test");
-
- assertEquals("Test", expression.getParameterName());
-
- String output = expression.accept(new FilterTreeToText());
- assertEquals("<Test>", output);
-
- }
-
- @Test
- public void testBinaryExpression() throws ExpressionVisitException, ODataApplicationException {
- BinaryImpl expression = new BinaryImpl();
-
- ExpressionImpl expressionLeft = new LiteralImpl().setText("A");
- ExpressionImpl expressionRight = new LiteralImpl().setText("B");
-
- expression.setLeftOperand(expressionLeft);
- expression.setRightOperand(expressionRight);
- expression.setOperator(BinaryOperatorKind.SUB);
-
- assertEquals(expressionLeft, expression.getLeftOperand());
- assertEquals(expressionRight, expression.getRightOperand());
- assertEquals(BinaryOperatorKind.SUB, expression.getOperator());
-
- String output = expression.accept(new FilterTreeToText());
- assertEquals("<<A> sub <B>>", output);
- }
-
- @Test
- public void testEnumerationExpression() throws ExpressionVisitException, ODataApplicationException {
- EnumerationImpl expression = new EnumerationImpl();
- EdmEnumType type = edm.getEnumType(EnumTypeProvider.nameENString);
- assertNotNull(type);
- expression.setType(type);
-
- assertEquals(type, expression.getType());
-
- expression.addValue("A");
- expression.addValue("B");
- assertEquals("A", expression.getValues().get(0));
- assertEquals("B", expression.getValues().get(1));
- assertEquals("<olingo.odata.test1.ENString<A,B>>", expression.accept(new FilterTreeToText()));
- }
-
- @Test
- public void testLambdaRefExpression() throws ExpressionVisitException, ODataApplicationException {
- LambdaRefImpl expression = new LambdaRefImpl();
- expression.setVariableText("A");
- assertEquals("A", expression.getVariableName());
-
- assertEquals("<A>", expression.accept(new FilterTreeToText()));
-
- }
-
- @Test
- public void testLiteralExpresion() throws ExpressionVisitException, ODataApplicationException {
- LiteralImpl expression = new LiteralImpl();
- expression.setText("A");
- assertEquals("A", expression.getText());
-
- assertEquals("<A>", expression.accept(new FilterTreeToText()));
- }
-
- @Test
- public void testMemberExpression() throws ExpressionVisitException, ODataApplicationException {
- MemberImpl expression = new MemberImpl();
- EdmEntityType entityType = edm.getEntityType(EntityTypeProvider.nameETKeyNav);
-
- // UriResourceImplTyped
- EdmAction action = edm.getUnboundAction(ActionProvider.nameUARTString);
- UriInfoResource uriInfo = new UriInfoImpl().setKind(UriInfoKind.resource).addResourcePart(
- new UriResourceActionImpl().setAction(action)).asUriInfoResource();
- expression.setResourcePath(uriInfo);
- assertEquals(action.getReturnType().getType(), expression.getType());
-
- // check accept and path
- assertEquals(uriInfo, expression.getResourcePath());
- assertEquals("<UARTString>", expression.accept(new FilterTreeToText()));
-
- // UriResourceImplTyped check collection = false case
- assertEquals(false, expression.isCollection());
-
- // UriResourceImplTyped check collection = true case
- action = edm.getUnboundAction(ActionProvider.nameUARTCollStringTwoParam);
- expression.setResourcePath(new UriInfoImpl().setKind(UriInfoKind.resource).addResourcePart(
- new UriResourceActionImpl().setAction(action))
- .asUriInfoResource());
- assertEquals(true, expression.isCollection());
-
- // UriResourceImplTyped with filter
- action = edm.getUnboundAction(ActionProvider.nameUARTString);
- expression.setResourcePath(new UriInfoImpl().setKind(UriInfoKind.resource).addResourcePart(
- new UriResourceActionImpl().setAction(action).setTypeFilter(entityType))
- .asUriInfoResource());
- assertEquals(entityType, expression.getType());
-
- // UriResourceImplKeyPred
- EdmFunction function = edm.getUnboundFunction(FunctionProvider.nameUFCRTETKeyNav, null);
- expression.setResourcePath(new UriInfoImpl().setKind(UriInfoKind.resource).addResourcePart(
- new UriResourceFunctionImpl().setFunction(function))
- .asUriInfoResource());
- assertEquals(function.getReturnType().getType(), expression.getType());
-
- // UriResourceImplKeyPred typeFilter on entry
- EdmEntityType entityBaseType = edm.getEntityType(EntityTypeProvider.nameETBaseTwoKeyNav);
- function = edm.getUnboundFunction(FunctionProvider.nameUFCRTESTwoKeyNavParam, Arrays.asList("ParameterInt16"));
- expression.setResourcePath(new UriInfoImpl().setKind(UriInfoKind.resource).addResourcePart(
- new UriResourceFunctionImpl().setFunction(function).setEntryTypeFilter(entityBaseType))
- .asUriInfoResource());
- assertEquals(entityBaseType, expression.getType());
-
- // UriResourceImplKeyPred typeFilter on entry
- entityBaseType = edm.getEntityType(EntityTypeProvider.nameETBaseTwoKeyNav);
- function = edm.getUnboundFunction(FunctionProvider.nameUFCRTESTwoKeyNavParam, Arrays.asList("ParameterInt16"));
- expression.setResourcePath(new UriInfoImpl().setKind(UriInfoKind.resource).addResourcePart(
- new UriResourceFunctionImpl().setFunction(function).setCollectionTypeFilter(entityBaseType))
- .asUriInfoResource());
- assertEquals(entityBaseType, expression.getType());
-
- // no typed
- entityBaseType = edm.getEntityType(EntityTypeProvider.nameETBaseTwoKeyNav);
- function = edm.getUnboundFunction(FunctionProvider.nameUFCRTESTwoKeyNavParam, Arrays.asList("ParameterInt16"));
- expression.setResourcePath(new UriInfoImpl().setKind(UriInfoKind.all));
- assertEquals(null, expression.getType());
-
- // no typed collection else case
- assertEquals(false, expression.isCollection());
- }
-
- @Test
- public void testMethodCallExpression() throws ExpressionVisitException, ODataApplicationException {
- MethodImpl expression = new MethodImpl();
- expression.setMethod(MethodKind.CONCAT);
-
- ExpressionImpl p0 = new LiteralImpl().setText("A");
- ExpressionImpl p1 = new LiteralImpl().setText("B");
- expression.addParameter(p0);
- expression.addParameter(p1);
-
- assertEquals(MethodKind.CONCAT, expression.getMethod());
- assertEquals("<concat(<A>,<B>)>", expression.accept(new FilterTreeToText()));
-
- assertEquals(p0, expression.getParameters().get(0));
- assertEquals(p1, expression.getParameters().get(1));
- }
-
- @Test
- public void testTypeLiteralExpression() throws ExpressionVisitException, ODataApplicationException {
- TypeLiteralImpl expression = new TypeLiteralImpl();
- EdmEntityType entityBaseType = edm.getEntityType(EntityTypeProvider.nameETBaseTwoKeyNav);
- expression.setType(entityBaseType);
-
- assertEquals(entityBaseType, expression.getType());
- assertEquals("<olingo.odata.test1.ETBaseTwoKeyNav>", expression.accept(new FilterTreeToText()));
- }
-
- @Test
- public void testUnaryExpression() throws ExpressionVisitException, ODataApplicationException {
- UnaryImpl expression = new UnaryImpl();
- expression.setOperator(UnaryOperatorKind.MINUS);
-
- ExpressionImpl operand = new LiteralImpl().setText("A");
- expression.setOperand(operand);
-
- assertEquals(UnaryOperatorKind.MINUS, expression.getOperator());
- assertEquals(operand, expression.getOperand());
-
- assertEquals("<- <A>>", expression.accept(new FilterTreeToText()));
- }
-
-}
diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/EdmTechTestProvider.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/EdmTechTestProvider.java
deleted file mode 100644
index a5d2e0f..0000000
--- a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/EdmTechTestProvider.java
+++ /dev/null
@@ -1,100 +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.uri.testutil;
-
-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.server.api.edm.provider.ComplexType;
-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.tecsvc.provider.EdmTechProvider;
-
-import java.util.Arrays;
-import java.util.List;
-
-/**
- * Implement the EdmTechProvider and
- * <li>adds a entity type <b>ETabc with</b> properties a,b,c,d,e,f</li>
- * <li>adds a complex type <b>CTabc</b> with properties a,b,c,d,e,f</li>
- * <li>adds a <b>abc</b> entity set of type <b>ETabc</b></li>
- */
-public class EdmTechTestProvider extends EdmTechProvider {
-
- private static final FullQualifiedName nameInt16 = EdmPrimitiveTypeKind.Int16.getFullQualifiedName();
- public static final String NAMESPACE = "olingo.odata.test1";
- public static final FullQualifiedName nameContainer = new FullQualifiedName(NAMESPACE, "Container");
-
- Property propertyAInt16 = new Property().setName("a").setType(nameInt16);
- Property propertyBInt16 = new Property().setName("b").setType(nameInt16);
- Property propertyCInt16 = new Property().setName("c").setType(nameInt16);
- Property propertyDInt16 = new Property().setName("d").setType(nameInt16);
- Property propertyEInt16 = new Property().setName("e").setType(nameInt16);
- Property propertyFInt16 = new Property().setName("f").setType(nameInt16);
-
- public static final FullQualifiedName nameCTabc = new FullQualifiedName(NAMESPACE, "CTabc");
- public static final FullQualifiedName nameETabc = new FullQualifiedName(NAMESPACE, "ETabc");
-
- @Override
- public ComplexType getComplexType(final FullQualifiedName complexTypeName) throws ODataException {
- if (complexTypeName.equals(nameCTabc)) {
- return new ComplexType()
- .setName("CTabc")
- .setProperties(Arrays.asList(
- propertyAInt16, propertyBInt16, propertyCInt16,
- propertyDInt16, propertyEInt16, propertyFInt16
- ));
-
- }
-
- return super.getComplexType(complexTypeName);
- }
-
- @Override
- public EntitySet getEntitySet(final FullQualifiedName entityContainer, final String name) throws ODataException {
- if (nameContainer.equals(entityContainer)) {
- if (name.equals("ESabc")) {
- return new EntitySet()
- .setName("ESabc")
- .setType(nameETabc);
- }
- }
-
- return super.getEntitySet(entityContainer, name);
- }
-
- @Override
- public EntityType getEntityType(final FullQualifiedName entityTypeName) throws ODataException {
- List<PropertyRef> oneKeyPropertyInt16 = Arrays.asList(new PropertyRef().setPropertyName("a"));
-
- if (entityTypeName.equals(nameETabc)) {
- return new EntityType()
- .setName("ETabc")
- .setProperties(Arrays.asList(
- propertyAInt16, propertyBInt16, propertyCInt16,
- propertyDInt16, propertyEInt16, propertyFInt16))
- .setKey(oneKeyPropertyInt16);
- }
-
- return super.getEntityType(entityTypeName);
- }
-
-}
diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/ExpandValidator.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/ExpandValidator.java
deleted file mode 100644
index d79dfd3..0000000
--- a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/ExpandValidator.java
+++ /dev/null
@@ -1,231 +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.uri.testutil;
-
-import org.apache.olingo.commons.api.edm.Edm;
-import org.apache.olingo.commons.api.edm.EdmType;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.server.api.ODataApplicationException;
-import org.apache.olingo.server.api.uri.UriInfoKind;
-import org.apache.olingo.server.api.uri.queryoption.ExpandItem;
-import org.apache.olingo.server.api.uri.queryoption.FilterOption;
-import org.apache.olingo.server.api.uri.queryoption.QueryOption;
-import org.apache.olingo.server.api.uri.queryoption.SelectItem;
-import org.apache.olingo.server.api.uri.queryoption.SelectOption;
-import org.apache.olingo.server.api.uri.queryoption.expression.ExpressionVisitException;
-import org.apache.olingo.server.core.uri.UriInfoImpl;
-import org.apache.olingo.server.core.uri.queryoption.ExpandOptionImpl;
-import org.apache.olingo.server.core.uri.queryoption.OrderByOptionImpl;
-import org.apache.olingo.server.core.uri.queryoption.QueryOptionImpl;
-import org.apache.olingo.server.core.uri.queryoption.SelectOptionImpl;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-public class ExpandValidator implements TestValidator {
- private Edm edm;
- private TestValidator invokedByValidator;
-
- private int expandItemIndex;
- private ExpandOptionImpl expandOption;
- private ExpandItem expandItem;
-
- // --- Setup ---
-
- public ExpandValidator setUpValidator(final TestValidator validator) {
- invokedByValidator = validator;
- return this;
- }
-
- public ExpandValidator setExpand(final ExpandOptionImpl expand) {
- expandOption = expand;
- first();
- return this;
- }
-
- public ExpandValidator setEdm(final Edm edm) {
- this.edm = edm;
- return this;
- }
-
- // --- Navigation ---
-
- public ExpandValidator goUpToExpandValidator() {
- return (ExpandValidator) invokedByValidator;
- }
-
- public ResourceValidator goUpToUriResourceValidator() {
- return (ResourceValidator) invokedByValidator;
- }
-
- public ResourceValidator goPath() {
- UriInfoImpl uriInfo = (UriInfoImpl) expandItem.getResourcePath();
-
- if (uriInfo.getKind() != UriInfoKind.resource) {
- fail("goPath() can only be used on UriInfoKind.resource");
- }
-
- return new ResourceValidator()
- .setUpValidator(this)
- .setEdm(edm)
- .setUriInfoImplPath(uriInfo);
-
- }
-
- public FilterValidator goOrder(final int index) {
- OrderByOptionImpl orderBy = (OrderByOptionImpl) expandItem.getOrderByOption();
-
- return new FilterValidator()
- .setValidator(this)
- .setEdm(edm)
- .setExpression(orderBy.getOrders().get(index).getExpression());
- }
-
- public ResourceValidator goSelectItem(final int index) {
- SelectOptionImpl select = (SelectOptionImpl) expandItem.getSelectOption();
-
- SelectItem item = select.getSelectItems().get(index);
- UriInfoImpl uriInfo = (UriInfoImpl) item.getResourcePath();
-
- return new ResourceValidator()
- .setUpValidator(this)
- .setEdm(edm)
- .setUriInfoImplPath(uriInfo);
-
- }
-
- public ExpandValidator goExpand() {
- ExpandValidator val = new ExpandValidator()
- .setExpand((ExpandOptionImpl) expandItem.getExpandOption())
- .setUpValidator(this);
- return val;
- }
-
- public ExpandValidator first() {
- expandItemIndex = 0;
- expandItem = expandOption.getExpandItems().get(expandItemIndex);
- return this;
- }
-
- public ExpandValidator next() {
- expandItemIndex++;
-
- try {
- expandItem = expandOption.getExpandItems().get(expandItemIndex);
- } catch (IndexOutOfBoundsException ex) {
- fail("not enough segments");
- }
- return this;
-
- }
-
- public ExpandValidator isSegmentStar() {
- assertTrue(expandItem.isStar());
- return this;
- }
-
- public ExpandValidator isSegmentRef() {
- assertTrue(expandItem.isRef());
- return this;
- }
-
- public ExpandValidator isLevelText(final String text) {
- QueryOptionImpl option = (QueryOptionImpl) expandItem.getLevelsOption();
- assertEquals(text, option.getText());
- return this;
- }
-
- public ExpandValidator isSkipText(final String text) {
- QueryOptionImpl option = (QueryOptionImpl) expandItem.getSkipOption();
- assertEquals(text, option.getText());
- return this;
- }
-
- public ExpandValidator isTopText(final String text) {
- QueryOptionImpl option = (QueryOptionImpl) expandItem.getTopOption();
- assertEquals(text, option.getText());
- return this;
- }
-
- public ExpandValidator isInlineCountText(final String text) {
- QueryOptionImpl option = (QueryOptionImpl) expandItem.getCountOption();
- assertEquals(text, option.getText());
- return this;
- }
-
- public ExpandValidator isSelectText(final String text) {
- QueryOptionImpl option = (QueryOptionImpl) expandItem.getSelectOption();
- assertEquals(text, option.getText());
- return this;
- }
-
- public ExpandValidator isSelectItemStar(final int index) {
- SelectOption select = expandItem.getSelectOption();
- SelectItem item = select.getSelectItems().get(index);
- assertTrue(item.isStar());
- return this;
- }
-
- public ExpandValidator isSelectItemAllOperations(final int index, final FullQualifiedName fqn) {
- SelectOption select = expandItem.getSelectOption();
- SelectItem item = select.getSelectItems().get(index);
- assertEquals(fqn.toString(), item.getAllOperationsInSchemaNameSpace().toString());
- return this;
- }
-
- public ExpandValidator isFilterOptionText(final String text) {
- QueryOption option = expandItem.getFilterOption();
- assertEquals(text, option.getText());
- return this;
- }
-
- public ExpandValidator isFilterSerialized(final String serialized) {
- FilterOption filter = expandItem.getFilterOption();
-
- try {
- String tmp = FilterTreeToText.Serialize(filter);
- assertEquals(serialized, tmp);
- } catch (ExpressionVisitException e) {
- fail("Exception occurred while converting the filterTree into text" + "\n"
- + " Exception: " + e.getMessage());
- } catch (ODataApplicationException e) {
- fail("Exception occurred while converting the filterTree into text" + "\n"
- + " Exception: " + e.getMessage());
- }
-
- return this;
- }
-
- public ExpandValidator isSortOrder(final int index, final boolean descending) {
- OrderByOptionImpl orderBy = (OrderByOptionImpl) expandItem.getOrderByOption();
- assertEquals(descending, orderBy.getOrders().get(index).isDescending());
- return this;
- }
-
- public ExpandValidator isExpandStartType(final FullQualifiedName fullName) {
- EdmType actualType = expandItem.getStartTypeFilter();
-
- FullQualifiedName actualName = new FullQualifiedName(actualType.getNamespace(), actualType.getName());
- assertEquals(fullName, actualName);
- return this;
-
- }
-
-}
diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/FilterTreeToText.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/FilterTreeToText.java
deleted file mode 100644
index 9664b7e..0000000
--- a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/FilterTreeToText.java
+++ /dev/null
@@ -1,154 +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.uri.testutil;
-
-import org.apache.olingo.commons.api.edm.EdmEnumType;
-import org.apache.olingo.commons.api.edm.EdmType;
-import org.apache.olingo.server.api.ODataApplicationException;
-import org.apache.olingo.server.api.uri.UriInfoResource;
-import org.apache.olingo.server.api.uri.UriResource;
-import org.apache.olingo.server.api.uri.UriResourceLambdaAll;
-import org.apache.olingo.server.api.uri.UriResourceLambdaAny;
-import org.apache.olingo.server.api.uri.UriResourcePartTyped;
-import org.apache.olingo.server.api.uri.queryoption.FilterOption;
-import org.apache.olingo.server.api.uri.queryoption.expression.BinaryOperatorKind;
-import org.apache.olingo.server.api.uri.queryoption.expression.Expression;
-import org.apache.olingo.server.api.uri.queryoption.expression.ExpressionVisitException;
-import org.apache.olingo.server.api.uri.queryoption.expression.ExpressionVisitor;
-import org.apache.olingo.server.api.uri.queryoption.expression.MethodKind;
-import org.apache.olingo.server.api.uri.queryoption.expression.UnaryOperatorKind;
-
-import java.util.List;
-
-public class FilterTreeToText implements ExpressionVisitor<String> {
-
- public static String Serialize(final FilterOption filter)
- throws ExpressionVisitException, ODataApplicationException {
-
- Expression expression = filter.getExpression();
- return expression.accept(new FilterTreeToText());
- }
-
- public static String Serialize(final Expression expression)
- throws ExpressionVisitException, ODataApplicationException {
-
- return expression.accept(new FilterTreeToText());
- }
-
- @Override
- public String visitBinaryOperator(final BinaryOperatorKind operator, final String left, final String right)
- throws ExpressionVisitException {
-
- return "<" + left + " " + operator.toString() + " " + right + ">";
- }
-
- @Override
- public String visitUnaryOperator(final UnaryOperatorKind operator, final String operand)
- throws ExpressionVisitException {
-
- return "<" + operator + " " + operand.toString() + ">";
- }
-
- @Override
- public String visitMethodCall(final MethodKind methodCall, final List<String> parameters)
- throws ExpressionVisitException {
-
- String text = "<" + methodCall + "(";
- int i = 0;
- while (i < parameters.size()) {
- if (i > 0) {
- text += ",";
- }
- text += parameters.get(i);
- i++;
- }
- return text + ")>";
- }
-
- @Override
- public String visitLiteral(final String literal) throws ExpressionVisitException {
- return "<" + literal + ">";
- }
-
- @Override
- public String visitMember(final UriInfoResource resource) throws ExpressionVisitException, ODataApplicationException {
- String ret = "";
-
- UriInfoResource path = resource;
-
- for (UriResource item : path.getUriResourceParts()) {
- String tmp = "";
- if (item instanceof UriResourceLambdaAll) {
- UriResourceLambdaAll all = (UriResourceLambdaAll) item;
- tmp = visitLambdaExpression("ALL", all.getLambdaVariable(), all.getExpression());
- } else if (item instanceof UriResourceLambdaAny) {
- UriResourceLambdaAny any = (UriResourceLambdaAny) item;
- tmp = visitLambdaExpression("ANY", any.getLamdaVariable(), any.getExpression());
- } else if (item instanceof UriResourcePartTyped) {
- UriResourcePartTyped typed = (UriResourcePartTyped) item;
- tmp = typed.toString(true);
- }
-
- if (ret.length() != 0) {
- ret += "/";
- }
- ret += tmp;
-
- }
- return "<" + ret + ">";
- }
-
- @Override
- public String visitAlias(final String referenceName) throws ExpressionVisitException {
- return "<" + referenceName + ">";
- }
-
- @Override
- public String visitLambdaExpression(final String functionText, final String string, final Expression expression)
- throws ExpressionVisitException, ODataApplicationException {
-
- return "<" + functionText + ";" + ((expression == null) ? "" : expression.accept(this)) + ">";
- }
-
- @Override
- public String visitTypeLiteral(final EdmType type) {
- return "<" + type.getNamespace() + "." + type.getName() + ">";
- }
-
- @Override
- public String visitLambdaReference(final String variableText) {
- return "<" + variableText + ">";
- }
-
- @Override
- public String visitEnum(final EdmEnumType type, final List<String> enumValues)
- throws ExpressionVisitException, ODataApplicationException {
- String tmp = "";
-
- for (String item : enumValues) {
- if (tmp.length() > 0) {
- tmp += ",";
- }
- tmp += item;
- }
-
- return "<" + type.getNamespace() + "." + type.getName() + "<" + tmp + ">>";
- }
-
-}
diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/FilterValidator.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/FilterValidator.java
deleted file mode 100644
index f530456..0000000
--- a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/FilterValidator.java
+++ /dev/null
@@ -1,529 +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.uri.testutil;
-
-import org.apache.olingo.commons.api.edm.Edm;
-import org.apache.olingo.commons.api.edm.EdmType;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.server.api.ODataApplicationException;
-import org.apache.olingo.server.api.uri.UriInfo;
-import org.apache.olingo.server.api.uri.UriInfoKind;
-import org.apache.olingo.server.api.uri.queryoption.expression.BinaryOperatorKind;
-import org.apache.olingo.server.api.uri.queryoption.expression.Expression;
-import org.apache.olingo.server.api.uri.queryoption.expression.ExpressionVisitException;
-import org.apache.olingo.server.api.uri.queryoption.expression.Member;
-import org.apache.olingo.server.api.uri.queryoption.expression.MethodKind;
-import org.apache.olingo.server.core.uri.UriInfoImpl;
-import org.apache.olingo.server.core.uri.parser.Parser;
-import org.apache.olingo.server.core.uri.parser.UriParserException;
-import org.apache.olingo.server.core.uri.parser.UriParserSemanticException;
-import org.apache.olingo.server.core.uri.parser.UriParserSyntaxException;
-import org.apache.olingo.server.core.uri.queryoption.FilterOptionImpl;
-import org.apache.olingo.server.core.uri.queryoption.OrderByOptionImpl;
-import org.apache.olingo.server.core.uri.queryoption.expression.BinaryImpl;
-import org.apache.olingo.server.core.uri.queryoption.expression.EnumerationImpl;
-import org.apache.olingo.server.core.uri.queryoption.expression.LiteralImpl;
-import org.apache.olingo.server.core.uri.queryoption.expression.MemberImpl;
-import org.apache.olingo.server.core.uri.queryoption.expression.MethodImpl;
-import org.apache.olingo.server.core.uri.queryoption.expression.TypeLiteralImpl;
-
-import java.util.List;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
-
-public class FilterValidator implements TestValidator {
- private Edm edm;
-
- private TestValidator invokedByValidator;
- private FilterOptionImpl filter;
-
- private Expression curExpression;
- private Expression rootExpression;
-
- private OrderByOptionImpl orderBy;
-
- private UriParserException exception;
-
- // --- Setup ---
- public FilterValidator setUriResourcePathValidator(final ResourceValidator uriResourcePathValidator) {
- invokedByValidator = uriResourcePathValidator;
- return this;
- }
-
- public FilterValidator setUriValidator(final TestUriValidator uriValidator) {
- invokedByValidator = uriValidator;
- return this;
- }
-
- public FilterValidator setValidator(final TestValidator uriValidator) {
- invokedByValidator = uriValidator;
- return this;
- }
-
- public FilterValidator setEdm(final Edm edm) {
- this.edm = edm;
- return this;
- }
-
- public FilterValidator setFilter(final FilterOptionImpl filter) {
- this.filter = filter;
-
- if (filter.getExpression() == null) {
- fail("FilterValidator: no filter found");
- }
- setExpression(filter.getExpression());
- return this;
- }
-
- public FilterValidator setOrderBy(final OrderByOptionImpl orderBy) {
- this.orderBy = orderBy;
-
- return this;
- }
-
- public FilterValidator setExpression(final Expression expression) {
- rootExpression = curExpression = expression;
- return this;
- }
-
- // --- Execution ---
-
- public FilterValidator runOrderByOnETAllPrim(final String orderBy) throws UriParserException {
- return runUriOrderBy("ESAllPrim", "$orderby=" + orderBy.trim());
- }
-
- public FilterValidator runOrderByOnETTwoKeyNav(final String orderBy) throws UriParserException {
- return runUriOrderBy("ESTwoKeyNav", "$orderby=" + orderBy.trim());
- }
-
- public FilterValidator runOrderByOnETMixEnumDefCollComp(final String orderBy) throws UriParserException {
- return runUriOrderBy("ESMixEnumDefCollComp", "$orderby=" + orderBy.trim());
- }
-
- public FilterValidator runOrderByOnETTwoKeyNavEx(final String orderBy) throws UriParserException {
- return runUriOrderByEx("ESTwoKeyNav", "$orderby=" + orderBy.trim());
- }
-
- public FilterValidator runOnETTwoKeyNav(final String filter) throws UriParserException {
- return runUri("ESTwoKeyNav", "$filter=" + filter.trim());
- }
-
- public FilterValidator runOnETMixEnumDefCollComp(final String filter) throws UriParserException {
- return runUri("ESMixEnumDefCollComp", "$filter=" + filter.trim());
- }
-
- public FilterValidator runOnETTwoKeyNavSingle(final String filter) throws UriParserException {
- return runUri("SINav", "$filter=" + filter.trim());
- }
-
- public FilterValidator runOnETTwoKeyNavEx(final String filter) throws UriParserException {
- return runUriEx("ESTwoKeyNav", "$filter=" + filter.trim());
- }
-
- public FilterValidator runOnETAllPrim(final String filter) throws UriParserException {
- return runUri("ESAllPrim(1)", "$filter=" + filter.trim());
- }
-
- public FilterValidator runOnETKeyNav(final String filter) throws UriParserException {
- return runUri("ESKeyNav(1)", "$filter=" + filter.trim());
- }
-
- public FilterValidator runOnETKeyNavEx(final String filter) throws UriParserException {
- return runUriEx("ESKeyNav(1)", "$filter=" + filter.trim());
- }
-
- public FilterValidator runOnCTTwoPrim(final String filter) throws UriParserException {
- return runUri("SINav/PropertyCompTwoPrim", "$filter=" + filter.trim());
- }
-
- public FilterValidator runOnString(final String filter) throws UriParserException {
- return runUri("SINav/PropertyString", "$filter=" + filter.trim());
- }
-
- public FilterValidator runOnInt32(final String filter) throws UriParserException {
- return runUri("ESCollAllPrim(1)/CollPropertyInt32", "$filter=" + filter.trim());
- }
-
- public FilterValidator runOnDateTimeOffset(final String filter) throws UriParserException {
- return runUri("ESCollAllPrim(1)/CollPropertyDateTimeOffset", "$filter=" + filter.trim());
- }
-
- public FilterValidator runOnDuration(final String filter) throws UriParserException {
- return runUri("ESCollAllPrim(1)/CollPropertyDuration", "$filter=" + filter.trim());
- }
-
- public FilterValidator runOnTimeOfDay(final String filter) throws UriParserException {
- return runUri("ESCollAllPrim(1)/CollPropertyTimeOfDay", "$filter=" + filter.trim());
- }
-
- public FilterValidator runESabc(final String filter) throws UriParserException {
- return runUri("ESabc", "$filter=" + filter.trim());
- }
-
- public FilterValidator runUri(final String path, final String query) throws UriParserException {
- Parser parser = new Parser();
- UriInfo uriInfo = null;
-
- uriInfo = parser.parseUri(path, query, null, edm);
-
- if (uriInfo.getKind() != UriInfoKind.resource) {
- fail("Filtervalidator can only be used on resourcePaths");
- }
-
- setFilter((FilterOptionImpl) uriInfo.getFilterOption());
- curExpression = filter.getExpression();
- return this;
- }
-
- public FilterValidator runUriEx(final String path, final String query) {
- Parser parser = new Parser();
- UriInfo uriInfo = null;
-
- try {
- uriInfo = parser.parseUri(path, query, null, edm);
- } catch (UriParserException e) {
- exception = e;
- return this;
- }
-
- if (uriInfo.getKind() != UriInfoKind.resource) {
- fail("Filtervalidator can only be used on resourcePaths");
- }
-
- setFilter((FilterOptionImpl) uriInfo.getFilterOption());
- curExpression = filter.getExpression();
- return this;
- }
-
- public FilterValidator runUriOrderBy(final String path, final String query) throws UriParserException {
- Parser parser = new Parser();
- UriInfo uriInfo = null;
-
- uriInfo = parser.parseUri(path, query, null, edm);
-
- if (uriInfo.getKind() != UriInfoKind.resource) {
- fail("Filtervalidator can only be used on resourcePaths");
- }
-
- setOrderBy((OrderByOptionImpl) uriInfo.getOrderByOption());
- return this;
- }
-
- public FilterValidator runUriOrderByEx(final String path, final String query) {
- Parser parser = new Parser();
- UriInfo uriInfo = null;
-
- try {
- uriInfo = parser.parseUri(path, query, null, edm);
- fail("Expected exception not thrown.");
- } catch (UriParserException e) {
- exception = e;
- return this;
- }
-
- if (uriInfo.getKind() != UriInfoKind.resource) {
- fail("Filtervalidator can only be used on resourcePaths");
- }
-
- setOrderBy((OrderByOptionImpl) uriInfo.getOrderByOption());
- return this;
- }
-
- // --- Navigation ---
-
- public ExpandValidator goUpToExpandValidator() {
- return (ExpandValidator) invokedByValidator;
- }
-
- public ResourceValidator goUpToResourceValidator() {
- return (ResourceValidator) invokedByValidator;
- }
-
- public ResourceValidator goPath() {
- if (!(curExpression instanceof MemberImpl)) {
- fail("Current expression not a member");
- }
-
- MemberImpl member = (MemberImpl) curExpression;
-
- return new ResourceValidator()
- .setEdm(edm)
- .setUriInfoImplPath((UriInfoImpl) member.getResourcePath())
- .setUpValidator(this);
-
- }
-
- public FilterValidator goParameter(final int parameterIndex) {
- if (curExpression instanceof MethodImpl) {
- MethodImpl methodCall = (MethodImpl) curExpression;
- curExpression = methodCall.getParameters().get(parameterIndex);
- } else {
- fail("Current expression not a methodCall");
- }
- return this;
- }
-
- // --- Validation ---
-
- /**
- * Validates the serialized filterTree against a given filterString
- * The given expected filterString is compressed before to allow better readable code in the unit tests
- * @param toBeCompr
- * @return
- */
- public FilterValidator isCompr(final String toBeCompr) {
- return is(compress(toBeCompr));
- }
-
- public FilterValidator is(final String expectedFilterAsString) {
- try {
- String actualFilterAsText = FilterTreeToText.Serialize(filter);
- assertEquals(expectedFilterAsString, actualFilterAsText);
- } catch (ExpressionVisitException e) {
- fail("Exception occured while converting the filterTree into text" + "\n"
- + " Exception: " + e.getMessage());
- } catch (ODataApplicationException e) {
- fail("Exception occured while converting the filterTree into text" + "\n"
- + " Exception: " + e.getMessage());
- }
-
- return this;
- }
-
- // --- Helper ---
-
- private String compress(final String expected) {
- String ret = expected.replaceAll("\\s+", " ");
- ret = ret.replaceAll("< ", "<");
- ret = ret.replaceAll(" >", ">");
- return ret;
- }
-
- public FilterValidator isType(final FullQualifiedName fullName) {
- EdmType actualType = null;
-
- if (curExpression instanceof MemberImpl) {
- Member member = (Member) curExpression;
- actualType = member.getType();
- } else if (curExpression instanceof TypeLiteralImpl) {
- TypeLiteralImpl typeLiteral = (TypeLiteralImpl) curExpression;
- actualType = typeLiteral.getType();
- } else if (curExpression instanceof LiteralImpl) {
- LiteralImpl typeLiteral = (LiteralImpl) curExpression;
- actualType = typeLiteral.getType();
- }
-
- if (actualType == null) {
- fail("Current expression not typed");
- }
-
- FullQualifiedName actualName = new FullQualifiedName(actualType.getNamespace(), actualType.getName());
- assertEquals(fullName, actualName);
- return this;
- }
-
- public FilterValidator left() {
- if (!(curExpression instanceof BinaryImpl)) {
- fail("Current expression not a binary operator");
- }
-
- curExpression = ((BinaryImpl) curExpression).getLeftOperand();
-
- return this;
- }
-
- public FilterValidator root() {
- if (filter != null) {
- curExpression = filter.getExpression();
- } else {
- curExpression = rootExpression;
- }
-
- return this;
- }
-
- public FilterValidator right() {
- if (!(curExpression instanceof BinaryImpl)) {
- fail("Current expression is not a binary operator");
- }
-
- curExpression = ((BinaryImpl) curExpression).getRightOperand();
-
- return this;
-
- }
-
- public FilterValidator isLiteral(final String literalText) {
- if (!(curExpression instanceof LiteralImpl)) {
- fail("Current expression is not a literal");
- }
-
- String actualLiteralText = ((LiteralImpl) curExpression).getText();
- assertEquals(literalText, actualLiteralText);
-
- return this;
- }
-
- public FilterValidator isMethod(final MethodKind methodKind, final int parameterCount) {
- if (!(curExpression instanceof MethodImpl)) {
- fail("Current expression is not a methodCall");
- }
-
- MethodImpl methodCall = (MethodImpl) curExpression;
- assertEquals(methodKind, methodCall.getMethod());
- assertEquals(parameterCount, methodCall.getParameters().size());
-
- return this;
- }
-
- public FilterValidator isParameterText(final int parameterIndex, final String parameterText)
- throws ExpressionVisitException, ODataApplicationException {
-
- if (!(curExpression instanceof MethodImpl)) {
- fail("Current expression is not a method");
- }
-
- MethodImpl methodCall = (MethodImpl) curExpression;
-
- Expression parameter = methodCall.getParameters().get(parameterIndex);
- String actualParameterText = FilterTreeToText.Serialize(parameter);
- assertEquals(parameterText, actualParameterText);
-
- return this;
- }
-
- public FilterValidator isBinary(final BinaryOperatorKind binaryOperator) {
- if (!(curExpression instanceof BinaryImpl)) {
- fail("Current expression is not a binary operator");
- }
-
- BinaryImpl binary = (BinaryImpl) curExpression;
- assertEquals(binaryOperator, binary.getOperator());
-
- return this;
- }
-
- public FilterValidator isTypedLiteral(final FullQualifiedName fullName) {
- if (!(curExpression instanceof TypeLiteralImpl)) {
- fail("Current expression not a typeLiteral");
- }
-
- isType(fullName);
-
- return this;
- }
-
- public FilterValidator isMember() {
- if (!(curExpression instanceof MemberImpl)) {
- fail("Current expression not a member");
- }
-
- return this;
- }
-
- public FilterValidator isMemberStartType(final FullQualifiedName fullName) {
- if (!(curExpression instanceof MemberImpl)) {
- fail("Current expression not a member");
- }
-
- MemberImpl member = (MemberImpl) curExpression;
- EdmType actualType = member.getStartTypeFilter();
-
- FullQualifiedName actualName = new FullQualifiedName(actualType.getNamespace(), actualType.getName());
- assertEquals(fullName, actualName);
- return this;
- }
-
- public FilterValidator isEnum(final FullQualifiedName nameenstring, final List<String> enumValues) {
- if (!(curExpression instanceof EnumerationImpl)) {
- fail("Current expression not a enumeration");
- }
-
- EnumerationImpl enumeration = (EnumerationImpl) curExpression;
-
- FullQualifiedName actualName =
- new FullQualifiedName(enumeration.getType().getNamespace(), enumeration.getType().getName());
-
- // check name
- assertEquals(nameenstring.toString(), actualName.toString());
-
- // check values
- int i = 0;
- for (String item : enumValues) {
- assertEquals(item, enumeration.getValues().get(i));
- i++;
- }
-
- return this;
- }
-
- public FilterValidator isSortOrder(final int index, final boolean descending) {
- assertEquals(descending, orderBy.getOrders().get(index).isDescending());
- return this;
- }
-
- public FilterValidator goOrder(final int index) {
- curExpression = orderBy.getOrders().get(index).getExpression();
- return this;
- }
-
- public FilterValidator isExSyntax(final UriParserSyntaxException.MessageKeys messageKey) {
- assertEquals(UriParserSyntaxException.class, exception.getClass());
- assertEquals(messageKey, exception.getMessageKey());
- return this;
- }
-
- public FilterValidator isExSemantic(final UriParserSemanticException.MessageKeys messageKey) {
- assertEquals(UriParserSemanticException.class, exception.getClass());
- assertEquals(messageKey, exception.getMessageKey());
- return this;
- }
-
- public FilterValidator isNull() {
- if (!(curExpression instanceof LiteralImpl)) {
- fail("Current expression is not a literal");
- }
-
- String actualLiteralText = ((LiteralImpl) curExpression).getText();
- assertEquals("null", actualLiteralText);
- return this;
- }
-
- public FilterValidator isTrue() {
- if (!(curExpression instanceof LiteralImpl)) {
- fail("Current expression is not a literal");
- }
-
- String actualLiteralText = ((LiteralImpl) curExpression).getText();
- assertEquals("true", actualLiteralText);
- return this;
- }
-
- public FilterValidator isFalse() {
- if (!(curExpression instanceof LiteralImpl)) {
- fail("Current expression is not a literal");
- }
-
- String actualLiteralText = ((LiteralImpl) curExpression).getText();
- assertEquals("false", actualLiteralText);
- return this;
- }
-
-}
diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/ParseTreeToText.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/ParseTreeToText.java
deleted file mode 100644
index 1859ea2..0000000
--- a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/ParseTreeToText.java
+++ /dev/null
@@ -1,82 +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.uri.testutil;
-
-import org.antlr.v4.runtime.Token;
-import org.antlr.v4.runtime.misc.NotNull;
-import org.antlr.v4.runtime.misc.Nullable;
-import org.antlr.v4.runtime.misc.Utils;
-import org.antlr.v4.runtime.tree.ErrorNode;
-import org.antlr.v4.runtime.tree.RuleNode;
-import org.antlr.v4.runtime.tree.TerminalNode;
-import org.antlr.v4.runtime.tree.Tree;
-
-import java.util.Arrays;
-import java.util.List;
-
-public class ParseTreeToText {
-
- public static String getTreeAsText(final Tree contextTree, final String[] ruleNames) {
- return toStringTree(contextTree, Arrays.asList(ruleNames));
- }
-
- private static String toStringTree(final Tree t, @Nullable final List<String> ruleNames) {
-
- if (t.getChildCount() == 0) {
- return Utils.escapeWhitespace(getNodeText(t, ruleNames), false);
- }
-
- StringBuilder buf = new StringBuilder();
- String s = Utils.escapeWhitespace(getNodeText(t, ruleNames), false);
- buf.append(s);
- buf.append("(");
-
- for (int i = 0; i < t.getChildCount(); i++) {
- if (i > 0) {
- buf.append(' ');
- }
- buf.append(toStringTree(t.getChild(i), ruleNames));
- }
- buf.append(")");
- return buf.toString();
- }
-
- private static String getNodeText(@NotNull final Tree t, @Nullable final List<String> ruleNames) {
- if (ruleNames != null) {
- if (t instanceof RuleNode) {
- int ruleIndex = ((RuleNode) t).getRuleContext().getRuleIndex();
- return ruleNames.get(ruleIndex);
- } else if (t instanceof ErrorNode) {
- return t.toString();
- } else if (t instanceof TerminalNode) {
- Token symbol = ((TerminalNode) t).getSymbol();
- if (symbol != null) {
- String s = symbol.getText();
- return s;
- }
- }
- }
- // no recog for rule names
- Object payload = t.getPayload();
- if (payload instanceof Token) {
- return ((Token) payload).getText();
- }
- return t.getPayload().toString();
- }
-}
diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/ParserValidator.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/ParserValidator.java
deleted file mode 100644
index aeb1309..0000000
--- a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/ParserValidator.java
+++ /dev/null
@@ -1,162 +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.uri.testutil;
-
-import org.antlr.v4.runtime.ParserRuleContext;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import static org.junit.Assert.assertEquals;
-
-public class ParserValidator {
-
- private String input = null;
- private ParserRuleContext root;
-
- int logLevel = 0;
- private int lexerLogLevel = 0;
-
- boolean allowFullContext;
- boolean allowContextSensitifity;
- boolean allowAmbiguity;
-
- List<Exception> exceptions = new ArrayList<Exception>();
- private Exception curException = null;
-
- // --- Setup ---
-
- public ParserValidator log(final int logLevel) {
- this.logLevel = logLevel;
- return this;
- }
-
- public ParserValidator lexerLog(final int logLevel) {
- lexerLogLevel = logLevel;
- return this;
- }
-
- /**
- * Used in fast LL Parsing:
- * Don't stop the parsing process when the slower full context parsing (with prediction mode SLL) is
- * required
- * @return
- */
- public ParserValidator aFC() {
- allowFullContext = true;
- return this;
- }
-
- /**
- * Used in fast LL Parsing:
- * Allows ContextSensitifity Errors which occur often when using the slower full context parsing
- * and indicate that there is a context sensitivity ( which may not be an error).
- * @return
- */
- public ParserValidator aCS() {
- allowContextSensitifity = true;
- return this;
- }
-
- /**
- * Used in fast LL Parsing:
- * Allows ambiguities
- * @return
- */
- public ParserValidator aAM() {
- allowAmbiguity = true;
- return this;
- }
-
- // --- Execution ---
-
- public ParserValidator run(final String uri) {
- input = uri;
-
- // just run a short lexer step. E.g. to print the tokens
- if (lexerLogLevel > 0) {
- (new TokenValidator()).log(lexerLogLevel).run(input);
- }
-
- /**/// root = parseInput(uri);
-
- // if LOG > 0 - Write serialized tree
- if (logLevel > 0) {
- if (root != null) {
- System.out.println(ParseTreeToText.getTreeAsText(root, new UriParserParser(null).getRuleNames()));
- } else {
- System.out.println("root == null");
- }
- }
-
- // reset for next test
- allowFullContext = false;
- allowContextSensitifity = false;
- allowAmbiguity = false;
- logLevel = 0;
-
- return this;
- }
-
- // --- Navigation ---
-
- public ParserValidator exFirst() {
- try {
- // curWeakException = exceptions.get(0);
- } catch (IndexOutOfBoundsException ex) {
- // curWeakException = null;
- }
- return this;
-
- }
-
- public ParserValidator exLast() {
- // curWeakException = exceptions.get(exceptions.size() - 1);
- return this;
- }
-
- public ParserValidator exAt(final int index) {
- try {
- // curWeakException = exceptions.get(index);
- } catch (IndexOutOfBoundsException ex) {
- // curWeakException = null;
- }
- return this;
- }
-
- // --- Validation ---
-
- public ParserValidator isText(final String expected) {
-
- assertEquals(null, curException);
- assertEquals(0, exceptions.size());
-
- String actualTreeAsText = ParseTreeToText.getTreeAsText(root, new UriParserParser(null).getRuleNames());
-
- assertEquals(expected, actualTreeAsText);
- return this;
- }
-
- public ParserValidator isExeptionType(final Class<?> exClass) {
- assertEquals(exClass, curException.getClass());
- return this;
- }
-
-}
\ No newline at end of file
diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/ParserWithLogging.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/ParserWithLogging.java
deleted file mode 100644
index 524a38a..0000000
--- a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/ParserWithLogging.java
+++ /dev/null
@@ -1,56 +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.uri.testutil;
-
-import org.antlr.v4.runtime.DefaultErrorStrategy;
-import org.antlr.v4.runtime.DiagnosticErrorListener;
-import org.apache.olingo.server.core.uri.antlr.UriParserParser;
-import org.apache.olingo.server.core.uri.parser.Parser;
-
-public class ParserWithLogging extends Parser {
- TestErrorLogger errorCollector1;
- TestErrorLogger errorCollector2;
-
- public ParserWithLogging() {
- errorCollector1 = new TestErrorLogger("Stage 1", 1);
- errorCollector2 = new TestErrorLogger("Stage 2", 1);
- }
-
- @Override
- protected void addStage2ErrorStategy(final UriParserParser parser) {
- // Don't throw an at first syntax error, so the error listener will be called
- parser.setErrorHandler(new DefaultErrorStrategy());
- }
-
- @Override
- protected void addStage1ErrorListener(final UriParserParser parser) {
- // Log error to console
- parser.removeErrorListeners();
- parser.addErrorListener(errorCollector1);
- parser.addErrorListener(new DiagnosticErrorListener());
- }
-
- @Override
- protected void addStage2ErrorListener(final UriParserParser parser) {
- // Log error to console
- parser.removeErrorListeners();
- parser.addErrorListener(errorCollector2);
- parser.addErrorListener(new DiagnosticErrorListener());
- }
-}
diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/ResourceValidator.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/ResourceValidator.java
deleted file mode 100644
index 5459c84..0000000
--- a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/ResourceValidator.java
+++ /dev/null
@@ -1,612 +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.uri.testutil;
-
-import org.apache.olingo.commons.api.edm.Edm;
-import org.apache.olingo.commons.api.edm.EdmElement;
-import org.apache.olingo.commons.api.edm.EdmType;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.api.http.HttpMethod;
-import org.apache.olingo.server.api.ODataApplicationException;
-import org.apache.olingo.server.api.uri.UriInfo;
-import org.apache.olingo.server.api.uri.UriInfoKind;
-import org.apache.olingo.server.api.uri.UriParameter;
-import org.apache.olingo.server.api.uri.UriResourceKind;
-import org.apache.olingo.server.api.uri.UriResourcePartTyped;
-import org.apache.olingo.server.api.uri.queryoption.CustomQueryOption;
-import org.apache.olingo.server.api.uri.queryoption.SelectItem;
-import org.apache.olingo.server.api.uri.queryoption.expression.ExpressionVisitException;
-import org.apache.olingo.server.core.uri.UriInfoImpl;
-import org.apache.olingo.server.core.uri.UriResourceActionImpl;
-import org.apache.olingo.server.core.uri.UriResourceComplexPropertyImpl;
-import org.apache.olingo.server.core.uri.UriResourceEntitySetImpl;
-import org.apache.olingo.server.core.uri.UriResourceFunctionImpl;
-import org.apache.olingo.server.core.uri.UriResourceImpl;
-import org.apache.olingo.server.core.uri.UriResourceLambdaAllImpl;
-import org.apache.olingo.server.core.uri.UriResourceLambdaAnyImpl;
-import org.apache.olingo.server.core.uri.UriResourceNavigationPropertyImpl;
-import org.apache.olingo.server.core.uri.UriResourcePrimitivePropertyImpl;
-import org.apache.olingo.server.core.uri.UriResourceSingletonImpl;
-import org.apache.olingo.server.core.uri.UriResourceWithKeysImpl;
-import org.apache.olingo.server.core.uri.parser.UriParserException;
-import org.apache.olingo.server.core.uri.queryoption.CustomQueryOptionImpl;
-import org.apache.olingo.server.core.uri.queryoption.ExpandOptionImpl;
-import org.apache.olingo.server.core.uri.queryoption.SelectOptionImpl;
-import org.apache.olingo.server.core.uri.queryoption.expression.ExpressionImpl;
-import org.apache.olingo.server.core.uri.validator.UriValidationException;
-import org.apache.olingo.server.core.uri.validator.UriValidator;
-
-import java.util.List;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.fail;
-
-public class ResourceValidator implements TestValidator {
- private Edm edm;
- private TestValidator invokedBy;
- private UriInfo uriInfo = null;
-
- private UriResourceImpl uriPathInfo = null;
- private int uriResourceIndex;
-
- // --- Setup ---
-
- public ResourceValidator setUpValidator(final TestValidator uriValidator) {
- invokedBy = uriValidator;
- return this;
- }
-
- public ResourceValidator setEdm(final Edm edm) {
- this.edm = edm;
- return this;
- }
-
- public ResourceValidator setUriInfoImplPath(final UriInfo uriInfoPath) {
- uriInfo = uriInfoPath;
- last();
- return this;
- }
-
- // --- Execution ---
-
- public ResourceValidator run(final String path) {
- ParserWithLogging testParser = new ParserWithLogging();
-
- UriInfo uriInfoTmp = null;
- uriPathInfo = null;
- try {
- uriInfoTmp = testParser.parseUri(path, null, null, edm);
- } catch (final UriParserException e) {
- fail("Exception occurred while parsing the URI: " + path + "\n"
- + " Message: " + e.getMessage());
- }
-
- try {
- new UriValidator().validate(uriInfoTmp, HttpMethod.GET);
- } catch (final UriValidationException e) {
- fail("Exception occurred while validating the URI: " + path + "\n"
- + " Message: " + e.getMessage());
- }
-
- if (uriInfoTmp.getKind() != UriInfoKind.resource) {
- fail("Invalid UriInfoKind: " + uriInfoTmp.getKind().toString());
- }
- uriInfo = uriInfoTmp;
-
- first();
- return this;
- }
-
- // --- Navigation ---
-
- public TestUriValidator goUpUriValidator() {
- return (TestUriValidator) invokedBy;
- }
-
- public ExpandValidator goUpExpandValidator() {
- return (ExpandValidator) invokedBy;
- }
-
- public FilterValidator goUpFilterValidator() {
- return (FilterValidator) invokedBy;
- }
-
- public FilterValidator goParameter(final int index) {
- assertEquals(UriResourceKind.function, uriPathInfo.getKind());
- UriResourceFunctionImpl function = (UriResourceFunctionImpl) uriPathInfo;
-
- return new FilterValidator()
- .setEdm(edm)
- .setExpression(function.getParameters().get(index).getExpression())
- .setValidator(this);
- }
-
- public FilterValidator goLambdaExpression() {
- if (uriPathInfo.getKind() == UriResourceKind.lambdaAll) {
- return new FilterValidator()
- .setEdm(edm)
- .setExpression(((UriResourceLambdaAllImpl) uriPathInfo).getExpression());
-
- } else if (uriPathInfo.getKind() == UriResourceKind.lambdaAny) {
- return new FilterValidator()
- .setEdm(edm)
- .setExpression(((UriResourceLambdaAnyImpl) uriPathInfo).getExpression());
- } else {
- fail("invalid resource kind: " + uriPathInfo.getKind().toString());
- }
- return null;
- }
-
- public ResourceValidator goSelectItem(final int index) {
- SelectOptionImpl select = (SelectOptionImpl) uriInfo.getSelectOption();
-
- SelectItem item = select.getSelectItems().get(index);
- UriInfoImpl uriInfo1 = (UriInfoImpl) item.getResourcePath();
-
- return new ResourceValidator()
- .setUpValidator(this)
- .setEdm(edm)
- .setUriInfoImplPath(uriInfo1);
-
- }
-
- public ExpandValidator goExpand() {
- ExpandOptionImpl expand = (ExpandOptionImpl) uriInfo.getExpandOption();
- if (expand == null) {
- fail("invalid resource kind: " + uriPathInfo.getKind().toString());
- }
-
- return new ExpandValidator().setUpValidator(this).setExpand(expand);
- }
-
- public ResourceValidator first() {
- uriResourceIndex = 0;
- uriPathInfo = (UriResourceImpl) uriInfo.getUriResourceParts().get(0);
- return this;
- }
-
- public ResourceValidator last() {
- uriResourceIndex = 0;
-
- try {
- uriPathInfo = (UriResourceImpl) uriInfo.getUriResourceParts().get(uriInfo.getUriResourceParts().size() - 1);
- uriResourceIndex = uriInfo.getUriResourceParts().size() - 1;
- } catch (IndexOutOfBoundsException ex) {
- fail("not enough segments");
- }
-
- return this;
- }
-
- public ResourceValidator n() {
- uriResourceIndex++;
-
- try {
- uriPathInfo = (UriResourceImpl) uriInfo.getUriResourceParts().get(uriResourceIndex);
- } catch (IndexOutOfBoundsException ex) {
- fail("not enough segments");
- }
-
- return this;
- }
-
- public ResourceValidator at(final int index) {
- uriResourceIndex = index;
- try {
- uriPathInfo = (UriResourceImpl) uriInfo.getUriResourceParts().get(index);
- } catch (IndexOutOfBoundsException ex) {
- fail("not enough segments");
- }
- return this;
- }
-
- // --- Validation ---
-
- public ResourceValidator isLambdaVar(final String var) {
- String actualVar = null;
- if (uriPathInfo.getKind() == UriResourceKind.lambdaAll) {
- actualVar = ((UriResourceLambdaAllImpl) uriPathInfo).getLambdaVariable();
- } else if (uriPathInfo.getKind() == UriResourceKind.lambdaAny) {
- actualVar = ((UriResourceLambdaAnyImpl) uriPathInfo).getLamdaVariable();
- } else {
- fail("invalid resource kind: " + uriPathInfo.getKind().toString());
- }
-
- assertEquals(var, actualVar);
- return this;
- }
-
- public ResourceValidator isTypeFilter(final FullQualifiedName expectedType) {
-
- if (uriPathInfo.getKind() != UriResourceKind.complexProperty &&
- uriPathInfo.getKind() != UriResourceKind.singleton) {
- fail("invalid resource kind: " + uriPathInfo.getKind().toString());
- }
-
- EdmType actualType = null;
- if (uriPathInfo instanceof UriResourceComplexPropertyImpl) {
- actualType = ((UriResourceComplexPropertyImpl) uriPathInfo).getComplexTypeFilter();
- } else if (uriPathInfo instanceof UriResourceSingletonImpl) {
- actualType = ((UriResourceSingletonImpl) uriPathInfo).getEntityTypeFilter();
- }
-
- if (actualType == null) {
- fail("type information not set");
- }
-
- FullQualifiedName actualName = new FullQualifiedName(actualType.getNamespace(), actualType.getName());
-
- assertEquals(expectedType.toString(), actualName.toString());
- return this;
- }
-
- public ResourceValidator isType(final FullQualifiedName type) {
- if (!(uriPathInfo instanceof UriResourcePartTyped)) {
- fail("invalid resource kind: " + uriPathInfo.getKind().toString());
- }
- UriResourcePartTyped uriPathInfoTyped = (UriResourcePartTyped) uriPathInfo;
-
- EdmType actualType = uriPathInfoTyped.getType();
- if (actualType == null) {
- fail("type information not set");
- }
-
- FullQualifiedName actualName = new FullQualifiedName(actualType.getNamespace(), actualType.getName());
-
- assertEquals(type.toString(), actualName.toString());
-
- return this;
- }
-
- public ResourceValidator isType(final FullQualifiedName type, final boolean isFinallyACollection) {
- isType(type);
- assertEquals(isFinallyACollection, ((UriResourcePartTyped) uriPathInfo).isCollection());
- return this;
- }
-
- public ResourceValidator isTypeFilterOnEntry(final FullQualifiedName type) {
- if (!(uriPathInfo instanceof UriResourceWithKeysImpl)) {
- fail("invalid resource kind: " + uriPathInfo.getKind().toString());
- }
-
- UriResourceWithKeysImpl uriPathInfoKeyPred = (UriResourceWithKeysImpl) uriPathInfo;
-
- // input parameter type may be null in order to assert that the singleTypeFilter is not set
- EdmType actualType = uriPathInfoKeyPred.getTypeFilterOnEntry();
- if (type == null) {
- assertEquals(type, actualType);
- } else {
- assertEquals(type.toString(), new FullQualifiedName(actualType.getNamespace(), actualType.getName()).toString());
- }
-
- return this;
- }
-
- public ResourceValidator isTypeFilterOnCollection(final FullQualifiedName expectedType) {
- if (!(uriPathInfo instanceof UriResourceWithKeysImpl)) {
- fail("invalid resource kind: " + uriPathInfo.getKind().toString());
- }
- UriResourceWithKeysImpl uriPathInfoKeyPred = (UriResourceWithKeysImpl) uriPathInfo;
-
- // input parameter type may be null in order to assert that the collectionTypeFilter is not set
- EdmType actualType = uriPathInfoKeyPred.getTypeFilterOnCollection();
- if (expectedType == null) {
- assertEquals(expectedType, actualType);
- } else {
- FullQualifiedName actualName = new FullQualifiedName(actualType.getNamespace(), actualType.getName());
- assertEquals(expectedType.toString(), actualName.toString());
- }
-
- return this;
- }
-
- // other functions
- public ResourceValidator checkCustomParameter(final int index, final String name, final String value) {
- if (uriInfo == null) {
- fail("hasQueryParameter: uriInfo == null");
- }
-
- List<CustomQueryOption> list = uriInfo.getCustomQueryOptions();
- if (list.size() <= index) {
- fail("not enough queryParameters");
- }
-
- CustomQueryOptionImpl option = (CustomQueryOptionImpl) list.get(index);
- assertEquals(name, option.getName());
- assertEquals(value, option.getText());
- return this;
- }
-
- // TODO remove
- /*
- * public ResourceValidator isCollection(final boolean isCollection) {
- * if (!(uriPathInfo instanceof UriResourcePartTyped)) {
- * fail("invalid resource kind: " + uriPathInfo.getKind().toString());
- * }
- * UriResourcePartTyped uriPathInfoTyped = (UriResourcePartTyped) uriPathInfo;
- *
- * EdmType type = uriPathInfoTyped.getType();
- * if (type == null) {
- * fail("isCollection: type == null");
- * }
- * assertEquals(isCollection, uriPathInfoTyped.isCollection());
- * return this;
- * }
- */
-
- public ResourceValidator isFilterString(final String expectedFilterTreeAsString) {
-
- ExpressionImpl filterTree = (ExpressionImpl) uriInfo.getFilterOption().getExpression();
- try {
- String filterTreeAsString = filterTree.accept(new FilterTreeToText());
- assertEquals(expectedFilterTreeAsString, filterTreeAsString);
- } catch (ExpressionVisitException e) {
- fail("isFilterString: Exception " + e.getMessage() + " occured");
- } catch (ODataApplicationException e) {
- fail("isFilterString: Exception " + e.getMessage() + " occured");
- }
-
- return this;
- }
-
- public ResourceValidator isKeyPredicateRef(final int index, final String name, final String refencedProperty) {
- if (!(uriPathInfo instanceof UriResourceWithKeysImpl)) {
- fail("invalid resource kind: " + uriPathInfo.getKind().toString());
- }
-
- UriResourceWithKeysImpl info = (UriResourceWithKeysImpl) uriPathInfo;
- List<UriParameter> keyPredicates = info.getKeyPredicates();
- assertEquals(name, keyPredicates.get(index).getName());
- assertEquals(refencedProperty, keyPredicates.get(index).getReferencedProperty());
- return this;
-
- }
-
- public ResourceValidator isKeyPredicateAlias(final int index, final String name, final String alias) {
- if (!(uriPathInfo instanceof UriResourceWithKeysImpl)) {
- fail("invalid resource kind: " + uriPathInfo.getKind().toString());
- }
-
- UriResourceWithKeysImpl info = (UriResourceWithKeysImpl) uriPathInfo;
- List<UriParameter> keyPredicates = info.getKeyPredicates();
- assertEquals(name, keyPredicates.get(index).getName());
- assertEquals(alias, keyPredicates.get(index).getAlias());
- return this;
-
- }
-
- public ResourceValidator isKeyPredicate(final int index, final String name, final String text) {
- if (!(uriPathInfo instanceof UriResourceWithKeysImpl)) {
- fail("invalid resource kind: " + uriPathInfo.getKind().toString());
- }
-
- UriResourceWithKeysImpl info = (UriResourceWithKeysImpl) uriPathInfo;
- List<UriParameter> keyPredicates = info.getKeyPredicates();
- assertEquals(name, keyPredicates.get(index).getName());
- assertEquals(text, keyPredicates.get(index).getText());
- return this;
-
- }
-
- public ResourceValidator isParameter(final int index, final String name, final String text) {
- if (!(uriPathInfo instanceof UriResourceFunctionImpl)) {
- fail("invalid resource kind: " + uriPathInfo.getKind().toString());
- }
-
- UriResourceFunctionImpl info = (UriResourceFunctionImpl) uriPathInfo;
- List<UriParameter> keyPredicates = info.getParameters();
- assertEquals(name, keyPredicates.get(index).getName());
- assertEquals(text, keyPredicates.get(index).getText());
- return this;
-
- }
-
- public ResourceValidator isParameterAlias(final int index, final String name, final String alias) {
- if (!(uriPathInfo instanceof UriResourceFunctionImpl)) {
- fail("invalid resource kind: " + uriPathInfo.getKind().toString());
- }
-
- UriResourceFunctionImpl info = (UriResourceFunctionImpl) uriPathInfo;
- List<UriParameter> keyPredicates = info.getParameters();
- assertEquals(name, keyPredicates.get(index).getName());
- assertEquals(alias, keyPredicates.get(index).getAlias());
- return this;
-
- }
-
- public ResourceValidator isKind(final UriInfoKind kind) {
- assertEquals(kind, uriInfo.getKind());
- return this;
- }
-
- public ResourceValidator isPrimitiveProperty(final String name,
- final FullQualifiedName type, final boolean isCollection) {
- if (!(uriPathInfo instanceof UriResourcePrimitivePropertyImpl)) {
- fail("invalid resource kind: " + uriPathInfo.getKind().toString());
- }
-
- UriResourcePrimitivePropertyImpl uriPathInfoProp = (UriResourcePrimitivePropertyImpl) uriPathInfo;
-
- EdmElement property = uriPathInfoProp.getProperty();
-
- assertEquals(name, property.getName());
- assertEquals(type, new FullQualifiedName(property.getType().getNamespace(), property.getType().getName()));
- assertEquals(isCollection, property.isCollection());
- return this;
- }
-
- public ResourceValidator
- isComplexProperty(final String name, final FullQualifiedName type, final boolean isCollection) {
- if (!(uriPathInfo instanceof UriResourceComplexPropertyImpl)) {
- fail("invalid resource kind: " + uriPathInfo.getKind().toString());
- }
-
- UriResourceComplexPropertyImpl uriPathInfoProp = (UriResourceComplexPropertyImpl) uriPathInfo;
-
- EdmElement property = uriPathInfoProp.getProperty();
-
- assertEquals(name, property.getName());
- assertEquals(type, new FullQualifiedName(property.getType().getNamespace(), property.getType().getName()));
- assertEquals(isCollection, property.isCollection());
- return this;
- }
-
- public ResourceValidator isNavProperty(final String name, final FullQualifiedName type, final boolean isCollection) {
- if (!(uriPathInfo instanceof UriResourceNavigationPropertyImpl)) {
- fail("invalid resource kind: " + uriPathInfo.getKind().toString());
- }
-
- UriResourceNavigationPropertyImpl uriPathInfoProp = (UriResourceNavigationPropertyImpl) uriPathInfo;
-
- EdmElement property = uriPathInfoProp.getProperty();
-
- assertEquals(name, property.getName());
- assertEquals(type, new FullQualifiedName(property.getType().getNamespace(), property.getType().getName()));
- assertEquals(isCollection, uriPathInfoProp.isCollection());
- return this;
- }
-
- public ResourceValidator isUriPathInfoKind(final UriResourceKind infoType) {
- assertNotNull(uriPathInfo);
- assertEquals(infoType, uriPathInfo.getKind());
- return this;
- }
-
- public ResourceValidator isAction(final String name) {
- assertEquals(UriResourceKind.action, uriPathInfo.getKind());
- assertEquals(name, ((UriResourceActionImpl) uriPathInfo).getAction().getName());
- return this;
- }
-
- public ResourceValidator isFunction(final String name) {
- assertEquals(UriResourceKind.function, uriPathInfo.getKind());
- assertEquals(name, ((UriResourceFunctionImpl) uriPathInfo).getFunction().getName());
- return this;
- }
-
- public ResourceValidator isFunctionImport(final String name) {
- assertEquals(UriResourceKind.function, uriPathInfo.getKind());
- assertEquals(name, ((UriResourceFunctionImpl) uriPathInfo).getFunctionImport().getName());
- return this;
- }
-
- public ResourceValidator isEntitySet(final String name) {
- assertEquals(UriResourceKind.entitySet, uriPathInfo.getKind());
- assertEquals(name, ((UriResourceEntitySetImpl) uriPathInfo).getEntitySet().getName());
- return this;
- }
-
- public ResourceValidator isComplex(final String name) {
- assertEquals(UriResourceKind.complexProperty, uriPathInfo.getKind());
- assertEquals(name, ((UriResourceComplexPropertyImpl) uriPathInfo).getProperty().getName());
- return this;
- }
-
- public ResourceValidator isSingleton(final String name) {
- assertEquals(UriResourceKind.singleton, uriPathInfo.getKind());
- assertEquals(name, ((UriResourceSingletonImpl) uriPathInfo).getSingleton().getName());
- return this;
- }
-
- public ResourceValidator isValue() {
- assertEquals(UriResourceKind.value, uriPathInfo.getKind());
- return this;
- }
-
- public ResourceValidator isCount() {
- assertEquals(UriResourceKind.count, uriPathInfo.getKind());
- return this;
- }
-
- public ResourceValidator isRef() {
- assertEquals(UriResourceKind.ref, uriPathInfo.getKind());
- return this;
- }
-
- public ResourceValidator isActionImport(final String actionName) {
- assertEquals(UriResourceKind.action, uriPathInfo.getKind());
- assertEquals(actionName, ((UriResourceActionImpl) uriPathInfo).getActionImport().getName());
- return this;
- }
-
- public ResourceValidator isIt() {
- assertEquals(UriResourceKind.it, uriPathInfo.getKind());
- return this;
- }
-
- public ResourceValidator isTopText(final String topText) {
- assertEquals(topText, uriInfo.getTopOption().getText());
- return this;
- }
-
- public ResourceValidator isFormatText(final String formatText) {
- assertEquals(formatText, uriInfo.getFormatOption().getText());
- return this;
- }
-
- public ResourceValidator isInlineCountText(final String inlineCountText) {
- assertEquals(inlineCountText, uriInfo.getCountOption().getText());
- return this;
- }
-
- public ResourceValidator isSkipText(final String skipText) {
- assertEquals(skipText, uriInfo.getSkipOption().getText());
- return this;
- }
-
- public ResourceValidator isSkipTokenText(final String skipTokenText) {
- assertEquals(skipTokenText, uriInfo.getSkipTokenOption().getText());
- return this;
- }
-
- public ResourceValidator isSelectItemStar(final int index) {
- SelectOptionImpl select = (SelectOptionImpl) uriInfo.getSelectOption();
-
- SelectItem item = select.getSelectItems().get(index);
- assertEquals(true, item.isStar());
- return this;
- }
-
- public ResourceValidator isSelectItemAllOp(final int index, final FullQualifiedName fqn) {
- SelectOptionImpl select = (SelectOptionImpl) uriInfo.getSelectOption();
-
- SelectItem item = select.getSelectItems().get(index);
- assertEquals(fqn.toString(), item.getAllOperationsInSchemaNameSpace().toString());
- return this;
- }
-
- public ResourceValidator isSelectStartType(final int index, final FullQualifiedName fullName) {
- SelectOptionImpl select = (SelectOptionImpl) uriInfo.getSelectOption();
- SelectItem item = select.getSelectItems().get(index);
-
- EdmType actualType = item.getStartTypeFilter();
-
- FullQualifiedName actualName = new FullQualifiedName(actualType.getNamespace(), actualType.getName());
- assertEquals(fullName, actualName);
- return this;
- }
-
- public ResourceValidator isInAliasToValueMap(String alias, String value) {
- String valueForAlias = uriInfo.getValueForAlias(alias);
- assertEquals(value, valueForAlias);
- return this;
- }
-
-}
diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/TestErrorLogger.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/TestErrorLogger.java
deleted file mode 100644
index fda6683..0000000
--- a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/TestErrorLogger.java
+++ /dev/null
@@ -1,105 +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.uri.testutil;
-
-import org.antlr.v4.runtime.ANTLRErrorListener;
-import org.antlr.v4.runtime.Parser;
-import org.antlr.v4.runtime.RecognitionException;
-import org.antlr.v4.runtime.Recognizer;
-import org.antlr.v4.runtime.atn.ATNConfigSet;
-import org.antlr.v4.runtime.dfa.DFA;
-import org.apache.olingo.server.core.uri.antlr.UriLexer;
-
-import java.util.BitSet;
-import java.util.Collections;
-import java.util.List;
-
-class TestErrorLogger implements ANTLRErrorListener {
-
- private String prefix;
- private int logLevel = 0;
-
- public TestErrorLogger(final String prefix, final int logLevel) {
- this.prefix = prefix;
- this.logLevel = logLevel;
- }
-
- @Override
- public void syntaxError(final Recognizer<?, ?> recognizer, final Object offendingSymbol, final int line,
- final int charPositionInLine,
- final String msg, final RecognitionException e) {
-
- if (logLevel > 0) {
- System.out.println("\n" + prefix + " -- SyntaxError");
- trace(recognizer, offendingSymbol, line, charPositionInLine, msg, e);
- }
-
- }
-
- @Override
- public void reportAmbiguity(final Parser recognizer, final DFA dfa, final int startIndex, final int stopIndex,
- final boolean exact,
- final BitSet ambigAlts, final ATNConfigSet configs) {
-
- }
-
- @Override
- public void reportAttemptingFullContext(final Parser recognizer, final DFA dfa, final int startIndex,
- final int stopIndex,
- final BitSet conflictingAlts, final ATNConfigSet configs) {
-
- }
-
- @Override
- public void reportContextSensitivity(final Parser recognizer, final DFA dfa, final int startIndex,
- final int stopIndex, final int prediction,
- final ATNConfigSet configs) {
-
- }
-
- private void printStack(final Recognizer<?, ?> recognizer) {
- List<String> stack = ((Parser) recognizer).getRuleInvocationStack();
- Collections.reverse(stack);
- System.out.println(" rule stack: " + stack);
- }
-
- public void trace(final Recognizer<?, ?> recognizer, final Object offendingSymbol,
- final int line, final int charPositionInLine, final String msg, final RecognitionException e) {
-
- System.out.println("Error message: " + msg);
-
- printStack(recognizer);
-
- System.out.println(" line/char :" + line + " / " + charPositionInLine);
- System.out.println(" sym :" + offendingSymbol);
- if (e != null && e.getOffendingToken() != null) {
-
- String lexerTokenName = "";
- try {
- lexerTokenName = UriLexer.tokenNames[e.getOffendingToken().getType()];
- } catch (ArrayIndexOutOfBoundsException es) {
- lexerTokenName = "token error";
- }
-
- System.out.println(" tokenname:" + lexerTokenName);
- }
-
- }
-
-}
\ No newline at end of file
diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/TestUriValidator.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/TestUriValidator.java
deleted file mode 100644
index 2339cc2..0000000
--- a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/TestUriValidator.java
+++ /dev/null
@@ -1,267 +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.uri.testutil;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
-
-import java.util.List;
-
-import org.apache.olingo.commons.api.edm.Edm;
-import org.apache.olingo.commons.api.edm.EdmEntityType;
-import org.apache.olingo.commons.api.edm.EdmType;
-import org.apache.olingo.commons.api.edm.FullQualifiedName;
-import org.apache.olingo.commons.api.http.HttpMethod;
-import org.apache.olingo.server.api.ODataTranslatedException;
-import org.apache.olingo.server.api.uri.UriInfo;
-import org.apache.olingo.server.api.uri.UriInfoKind;
-import org.apache.olingo.server.api.uri.queryoption.CustomQueryOption;
-import org.apache.olingo.server.api.uri.queryoption.SelectItem;
-import org.apache.olingo.server.core.uri.UriInfoImpl;
-import org.apache.olingo.server.core.uri.parser.Parser;
-import org.apache.olingo.server.core.uri.parser.UriParserException;
-import org.apache.olingo.server.core.uri.parser.UriParserSemanticException;
-import org.apache.olingo.server.core.uri.parser.UriParserSyntaxException;
-import org.apache.olingo.server.core.uri.queryoption.CustomQueryOptionImpl;
-import org.apache.olingo.server.core.uri.queryoption.ExpandOptionImpl;
-import org.apache.olingo.server.core.uri.queryoption.FilterOptionImpl;
-import org.apache.olingo.server.core.uri.queryoption.SelectOptionImpl;
-import org.apache.olingo.server.core.uri.validator.UriValidationException;
-import org.apache.olingo.server.core.uri.validator.UriValidator;
-
-public class TestUriValidator implements TestValidator {
- private Edm edm;
-
- private UriInfo uriInfo;
- private ODataTranslatedException exception;
-
- // Setup
- public TestUriValidator setEdm(final Edm edm) {
- this.edm = edm;
- return this;
- }
-
- // Execution
- public TestUriValidator run(final String path) throws UriParserException, UriValidationException {
- return run(path, null);
- }
-
- public TestUriValidator run(final String path, final String query)
- throws UriParserException, UriValidationException {
- Parser parser = new Parser();
- UriValidator validator = new UriValidator();
-
- uriInfo = parser.parseUri(path, query, null, edm);
- validator.validate(uriInfo, HttpMethod.GET);
- return this;
- }
-
- public TestUriValidator run(final String path, final String query, final String fragment)
- throws UriParserException, UriValidationException {
- uriInfo = new Parser().parseUri(path, query, fragment, edm);
- new UriValidator().validate(uriInfo, HttpMethod.GET);
- return this;
- }
-
- public TestUriValidator runEx(final String path) {
- return runEx(path, null);
- }
-
- public TestUriValidator runEx(final String path, final String query) {
- Parser parser = new Parser();
- uriInfo = null;
- try {
- uriInfo = parser.parseUri(path, query, null, edm);
- new UriValidator().validate(uriInfo, HttpMethod.GET);
- fail("Exception expected");
- } catch (UriParserException e) {
- exception = e;
- } catch (UriValidationException e) {
- exception = e;
- }
-
- return this;
- }
-
- // Navigation
- public ResourceValidator goPath() {
- if (uriInfo.getKind() != UriInfoKind.resource) {
- fail("invalid resource kind: " + uriInfo.getKind().toString());
- }
-
- return new ResourceValidator()
- .setUpValidator(this)
- .setEdm(edm)
- .setUriInfoImplPath(uriInfo);
- }
-
- public FilterValidator goFilter() {
- FilterOptionImpl filter = (FilterOptionImpl) uriInfo.getFilterOption();
- if (filter == null) {
- fail("no filter found");
- }
- return new FilterValidator().setUriValidator(this).setFilter(filter);
-
- }
-
- public ExpandValidator goExpand() {
- ExpandOptionImpl expand = (ExpandOptionImpl) uriInfo.getExpandOption();
- if (expand == null) {
- fail("invalid resource kind: " + uriInfo.getKind().toString());
- }
-
- return new ExpandValidator().setUpValidator(this).setExpand(expand);
- }
-
- public ResourceValidator goSelectItemPath(final int index) {
- SelectOptionImpl select = (SelectOptionImpl) uriInfo.getSelectOption();
-
- SelectItem item = select.getSelectItems().get(index);
- UriInfoImpl uriInfo1 = (UriInfoImpl) item.getResourcePath();
-
- return new ResourceValidator()
- .setUpValidator(this)
- .setEdm(edm)
- .setUriInfoImplPath(uriInfo1);
-
- }
-
- public TestUriValidator isSelectStartType(final int index, final FullQualifiedName fullName) {
- SelectOptionImpl select = (SelectOptionImpl) uriInfo.getSelectOption();
- SelectItem item = select.getSelectItems().get(index);
- EdmType actualType = item.getStartTypeFilter();
-
- FullQualifiedName actualName = new FullQualifiedName(actualType.getNamespace(), actualType.getName());
- assertEquals(fullName, actualName);
- return this;
-
- }
-
- // Validation
- public TestUriValidator isKind(final UriInfoKind kind) {
- assertEquals(kind, uriInfo.getKind());
- return this;
- }
-
- public TestUriValidator isCustomParameter(final int index, final String name, final String value) {
- if (uriInfo == null) {
- fail("hasQueryParameter: uriInfo == null");
- }
-
- List<CustomQueryOption> list = uriInfo.getCustomQueryOptions();
- if (list.size() <= index) {
- fail("not enough queryParameters");
- }
-
- CustomQueryOptionImpl option = (CustomQueryOptionImpl) list.get(index);
- assertEquals(name, option.getName());
- assertEquals(value, option.getText());
- return this;
- }
-
- public void isCrossJoinEntityList(final List<String> entitySets) {
- if (uriInfo.getKind() != UriInfoKind.crossjoin) {
- fail("invalid resource kind: " + uriInfo.getKind().toString());
- }
-
- int i = 0;
- for (String entitySet : entitySets) {
- assertEquals(entitySet, uriInfo.getEntitySetNames().get(i));
- i++;
- }
-
- }
-
- public TestUriValidator isExSyntax(final UriParserSyntaxException.MessageKeys messageKey) {
- assertEquals(UriParserSyntaxException.class, exception.getClass());
- assertEquals(messageKey, exception.getMessageKey());
- return this;
- }
-
- public TestUriValidator isExSemantic(final UriParserSemanticException.MessageKeys messageKey) {
- assertEquals(UriParserSemanticException.class, exception.getClass());
- assertEquals(messageKey, exception.getMessageKey());
- return this;
- }
-
- public TestUriValidator isExValidation(final UriValidationException.MessageKeys messageKey) {
- assertEquals(UriValidationException.class, exception.getClass());
- assertEquals(messageKey, exception.getMessageKey());
- return this;
- }
-
- public TestUriValidator isIdText(final String text) {
- assertEquals(text, uriInfo.getIdOption().getText());
- return this;
- }
-
- public TestUriValidator isExpandText(final String text) {
- assertEquals(text, uriInfo.getExpandOption().getText());
- return this;
- }
-
- public TestUriValidator isSelectText(final String text) {
- assertEquals(text, uriInfo.getSelectOption().getText());
- return this;
- }
-
- public TestUriValidator isFormatText(final String text) {
- assertEquals(text, uriInfo.getFormatOption().getText());
- return this;
- }
-
- public TestUriValidator isFragmentText(final String text) {
- if (uriInfo.getKind() != UriInfoKind.metadata) {
- fail("invalid resource kind: " + uriInfo.getKind().toString());
- }
-
- assertEquals(text, uriInfo.getFragment());
-
- return this;
- }
-
- public TestUriValidator isEntityType(final FullQualifiedName fullName) {
- if (uriInfo.getKind() != UriInfoKind.entityId) {
- fail("invalid resource kind: " + uriInfo.getKind().toString());
- }
-
- assertEquals(fullName.toString(), fullName(uriInfo.getEntityTypeCast()));
- return this;
- }
-
- private String fullName(final EdmEntityType type) {
- return type.getNamespace() + "." + type.getName();
- }
-
- public TestUriValidator isSelectItemStar(final int index) {
- SelectOptionImpl select = (SelectOptionImpl) uriInfo.getSelectOption();
-
- SelectItem item = select.getSelectItems().get(index);
- assertEquals(true, item.isStar());
- return this;
- }
-
- public TestUriValidator isSelectItemAllOp(final int index, final FullQualifiedName fqn) {
- SelectOptionImpl select = (SelectOptionImpl) uriInfo.getSelectOption();
-
- SelectItem item = select.getSelectItems().get(index);
- assertEquals(fqn.toString(), item.getAllOperationsInSchemaNameSpace().toString());
- return this;
- }
-}
diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/TestValidator.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/TestValidator.java
deleted file mode 100644
index 7e64f86..0000000
--- a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/TestValidator.java
+++ /dev/null
@@ -1,23 +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.uri.testutil;
-
-public interface TestValidator {
-
-}
diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/TokenValidator.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/TokenValidator.java
deleted file mode 100644
index 4632eff..0000000
--- a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/TokenValidator.java
+++ /dev/null
@@ -1,194 +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.uri.testutil;
-
-import org.antlr.v4.runtime.ANTLRInputStream;
-import org.antlr.v4.runtime.Token;
-import org.apache.olingo.server.core.uri.antlr.UriLexer;
-
-import java.util.List;
-
-import static org.junit.Assert.assertEquals;
-
-//TODO extend to test also exception which can occure while paring
-public class TokenValidator {
-
- private String input = null;
-
- private List<? extends Token> tokens = null;
- private Token curToken = null;
- private Exception curException = null;
-
- private int startMode;
- private int logLevel = 0;
-
- // --- Setup ---
-
- public TokenValidator log(final int logLevel) {
- this.logLevel = logLevel;
- return this;
- }
-
- // --- Execution ---
-
- public TokenValidator run(final String uri) {
- input = uri;
-
- tokens = parseInput(uri);
- if (logLevel > 0) {
- showTokens();
- }
-
- first();
- exFirst();
- logLevel = 0;
-
- return this;
- }
-
- // --- Navigation ---
-
- // navigate within the tokenlist
- public TokenValidator first() {
- try {
- curToken = tokens.get(0);
- } catch (IndexOutOfBoundsException ex) {
- curToken = null;
- }
- return this;
- }
-
- public TokenValidator last() {
- curToken = tokens.get(tokens.size() - 1);
- return this;
- }
-
- public TokenValidator at(final int index) {
- try {
- curToken = tokens.get(index);
- } catch (IndexOutOfBoundsException ex) {
- curToken = null;
- }
- return this;
- }
-
- public TokenValidator exLast() {
- // curException = exceptions.get(exceptions.size() - 1);
- return this;
- }
-
- // navigate within the exception list
- public TokenValidator exFirst() {
- try {
- // curException = exceptions.get(0);
- } catch (IndexOutOfBoundsException ex) {
- curException = null;
- }
- return this;
-
- }
-
- public TokenValidator exAt(final int index) {
- try {
- // curException = exceptions.get(index);
- } catch (IndexOutOfBoundsException ex) {
- curException = null;
- }
- return this;
- }
-
- // --- Validation ---
-
- public TokenValidator isText(final String expected) {
- assertEquals(expected, curToken.getText());
- return this;
- }
-
- public TokenValidator isAllText(final String expected) {
- String actual = "";
-
- for (Token curToken : tokens) {
- actual += curToken.getText();
- }
- assertEquals(expected, actual);
- return this;
- }
-
- public TokenValidator isAllInput() {
- String actual = "";
-
- for (Token curToken : tokens) {
- actual += curToken.getText();
- }
- assertEquals(input, actual);
- return this;
- }
-
- public TokenValidator isInput() {
- assertEquals(input, curToken.getText());
- return this;
- }
-
- public TokenValidator isType(final int expected) {
- assertEquals(UriLexer.tokenNames[expected], UriLexer.tokenNames[curToken.getType()]);
- return this;
- }
-
- public TokenValidator isExType(final Class<?> exClass) {
- assertEquals(exClass, curException.getClass());
- return this;
- }
-
- public void globalMode(final int mode) {
- startMode = mode;
- }
-
- // --- Helper ---
-
- private List<? extends Token> parseInput(final String input) {
- ANTLRInputStream inputStream = new ANTLRInputStream(input);
-
- UriLexer lexer = new UriLexerWithTrace(inputStream, logLevel, startMode);
- // lexer.addErrorListener(new ErrorCollector(this));
- return lexer.getAllTokens();
- }
-
- public TokenValidator showTokens() {
- boolean first = true;
- System.out.println("input: " + input);
- String nL = "\n";
- String out = "[" + nL;
- for (Token token : tokens) {
- if (!first) {
- out += ",";
- first = false;
- }
- int index = token.getType();
- if (index != -1) {
- out += "\"" + token.getText() + "\"" + " " + UriLexer.tokenNames[index] + nL;
- } else {
- out += "\"" + token.getText() + "\"" + " " + index + nL;
- }
- }
- out += ']';
- System.out.println("tokens: " + out);
- return this;
- }
-
-}
diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/UriLexerWithTrace.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/UriLexerWithTrace.java
deleted file mode 100644
index 9005080..0000000
--- a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/UriLexerWithTrace.java
+++ /dev/null
@@ -1,85 +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.uri.testutil;
-
-import org.antlr.v4.runtime.ANTLRInputStream;
-import org.antlr.v4.runtime.Token;
-import org.apache.olingo.server.core.uri.antlr.UriLexer;
-
-public class UriLexerWithTrace extends UriLexer {
- int logLevel = 0;
-
- public UriLexerWithTrace(final ANTLRInputStream antlrInputStream, final int logLevel) {
- super(antlrInputStream);
- this.logLevel = logLevel;
- }
-
- public UriLexerWithTrace(final ANTLRInputStream antlrInputStream, final int logLevel, final int mode) {
- super(antlrInputStream);
- super.mode(mode);
- this.logLevel = logLevel;
- }
-
- @Override
- public void emit(final Token token) {
- if (logLevel > 1) {
- String out = String.format("%1$-" + 20 + "s", token.getText());
-
- int tokenType = token.getType();
- if (tokenType == -1) {
- out += "-1/EOF";
- } else {
- out += UriLexer.tokenNames[tokenType];
- }
- System.out.println("Lexer.emit(...):" + out);
- }
-
- super.emit(token);
- }
-
- @Override
- public void pushMode(final int m) {
-
- String out = UriLexer.modeNames[_mode] + "-->";
-
- super.pushMode(m);
-
- out += UriLexer.modeNames[_mode];
-
- if (logLevel > 1) {
- System.out.println(out + " ");
- }
- }
-
- @Override
- public int popMode() {
-
- String out = UriLexer.modeNames[_mode] + "-->";
-
- int m = super.popMode();
-
- out += UriLexer.modeNames[_mode];
-
- if (logLevel > 1) {
- System.out.println(out + " ");
- }
-
- return m;
- }
-}
diff --git a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/validator/UriValidatorTest.java b/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/validator/UriValidatorTest.java
deleted file mode 100644
index bdde9ce..0000000
--- a/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/validator/UriValidatorTest.java
+++ /dev/null
@@ -1,390 +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.uri.validator;
-
-import org.apache.olingo.commons.api.edm.Edm;
-import org.apache.olingo.commons.api.http.HttpMethod;
-import org.apache.olingo.server.api.uri.UriInfo;
-import org.apache.olingo.server.core.edm.provider.EdmProviderImpl;
-import org.apache.olingo.server.core.uri.parser.Parser;
-import org.apache.olingo.server.core.uri.parser.UriParserException;
-import org.apache.olingo.server.core.uri.parser.UriParserSemanticException;
-import org.apache.olingo.server.core.uri.parser.UriParserSyntaxException;
-import org.apache.olingo.server.core.uri.testutil.TestUriValidator;
-import org.apache.olingo.server.tecsvc.provider.ContainerProvider;
-import org.apache.olingo.server.tecsvc.provider.EdmTechProvider;
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
-
-public class UriValidatorTest {
-
- private static final String URI_ALL = "$all";
- private static final String URI_BATCH = "$batch";
- private static final String URI_CROSSJOIN = "$crossjoin(ESAllPrim)";
- private static final String URI_ENTITY_ID = "/$entity";
- private static final String URI_METADATA = "$metadata";
- private static final String URI_SERVICE = "";
- private static final String URI_ENTITY_SET = "/ESAllPrim";
- private static final String URI_ENTITY_SET_COUNT = "/ESAllPrim/$count";
- private static final String URI_ENTITY = "/ESAllPrim(1)";
- private static final String URI_MEDIA_STREAM = "/ESMedia(1)/$value";
- private static final String URI_REFERENCES = "/ESAllPrim/$ref";
- private static final String URI_REFERENCE = "/ESAllPrim(1)/$ref";
- private static final String URI_PROPERTY_COMPLEX = "/ESCompComp(1)/PropertyComp";
- private static final String URI_PROPERTY_COMPLEX_COLLECTION =
- "/ESCompCollComp(1)/PropertyComp/CollPropertyComp";
- private static final String URI_PROPERTY_COMPLEX_COLLECTION_COUNT =
- "/ESCompCollComp(1)/PropertyComp/CollPropertyComp/$count";
- private static final String URI_PROPERTY_PRIMITIVE = "/ESAllPrim(1)/PropertyString";
- private static final String URI_PROPERTY_PRIMITIVE_COLLECTION = "/ESCollAllPrim(1)/CollPropertyString";
- private static final String URI_PROPERTY_PRIMITIVE_COLLECTION_COUNT =
- "/ESCollAllPrim(1)/CollPropertyString/$count";
- private static final String URI_PROPERTY_PRIMITIVE_VALUE = "/ESAllPrim(1)/PropertyString/$value";
- private static final String URI_SINGLETON = "/SI";
- private static final String URI_NAV_ENTITY = "/ESKeyNav(1)/NavPropertyETKeyNavOne";
- private static final String URI_NAV_ENTITY_SET = "/ESKeyNav(1)/NavPropertyETKeyNavMany";
-
- private static final String QO_FILTER = "$filter='1' eq '1'";
- private static final String QO_FORMAT = "$format=bla/bla";
- private static final String QO_EXPAND = "$expand=*";
- private static final String QO_ID = "$id=Products(0)";
- private static final String QO_COUNT = "$count=true";
- private static final String QO_ORDERBY = "$orderby=true";
- // private static final String QO_SEARCH = "$search='bla'";
- private static final String QO_SELECT = "$select=*";
- private static final String QO_SKIP = "$skip=3";
- private static final String QO_SKIPTOKEN = "$skiptoken=123";
- private static final String QO_LEVELS = "$expand=*($levels=1)";
- private static final String QO_TOP = "$top=1";
-
- private String[][] urisWithValidSystemQueryOptions = {
- { URI_ALL, QO_FILTER }, { URI_ALL, QO_FORMAT }, { URI_ALL, QO_EXPAND }, { URI_ALL, QO_COUNT },
- { URI_ALL, QO_ORDERBY }, /* { URI_ALL, QO_SEARCH }, */{ URI_ALL, QO_SELECT }, { URI_ALL, QO_SKIP },
- { URI_ALL, QO_SKIPTOKEN }, { URI_ALL, QO_LEVELS },
-
- { URI_CROSSJOIN, QO_FILTER }, { URI_CROSSJOIN, QO_FORMAT },
- { URI_CROSSJOIN, QO_EXPAND }, { URI_CROSSJOIN, QO_COUNT }, { URI_CROSSJOIN, QO_ORDERBY },
- /* { URI_CROSSJOIN, QO_SEARCH }, */{ URI_CROSSJOIN, QO_SELECT }, { URI_CROSSJOIN, QO_SKIP },
- { URI_CROSSJOIN, QO_SKIPTOKEN }, { URI_CROSSJOIN, QO_LEVELS }, { URI_CROSSJOIN, QO_TOP },
-
- { URI_ENTITY_ID, QO_ID, QO_FORMAT }, { URI_ENTITY_ID, QO_ID }, { URI_ENTITY_ID, QO_ID, QO_EXPAND },
- { URI_ENTITY_ID, QO_ID, QO_SELECT }, { URI_ENTITY_ID, QO_ID, QO_LEVELS },
-
- { URI_METADATA, QO_FORMAT },
-
- { URI_SERVICE, QO_FORMAT },
-
- { URI_ENTITY_SET, QO_FILTER }, { URI_ENTITY_SET, QO_FORMAT }, { URI_ENTITY_SET, QO_EXPAND },
- { URI_ENTITY_SET, QO_COUNT }, { URI_ENTITY_SET, QO_ORDERBY }, /* { URI_ENTITY_SET, QO_SEARCH }, */
- { URI_ENTITY_SET, QO_SELECT },
- { URI_ENTITY_SET, QO_SKIP }, { URI_ENTITY_SET, QO_SKIPTOKEN }, { URI_ENTITY_SET, QO_LEVELS },
- { URI_ENTITY_SET, QO_TOP },
-
- { URI_ENTITY_SET_COUNT, QO_FILTER }, /* { URI_ENTITY_SET_COUNT, QO_SEARCH }, */
-
- { URI_ENTITY, QO_FORMAT }, { URI_ENTITY, QO_EXPAND }, { URI_ENTITY, QO_SELECT }, { URI_ENTITY, QO_LEVELS },
-
- { URI_MEDIA_STREAM, QO_FORMAT },
-
- { URI_REFERENCES, QO_FILTER }, { URI_REFERENCES, QO_FORMAT }, { URI_REFERENCES, QO_ORDERBY },
- /* { URI_REFERENCES, QO_SEARCH }, */{ URI_REFERENCES, QO_SKIP }, { URI_REFERENCES, QO_SKIPTOKEN },
- { URI_REFERENCES, QO_TOP },
-
- { URI_REFERENCE, QO_FORMAT },
-
- { URI_PROPERTY_COMPLEX, QO_FORMAT }, { URI_PROPERTY_COMPLEX, QO_SELECT }, { URI_PROPERTY_COMPLEX, QO_EXPAND },
- { URI_PROPERTY_COMPLEX, QO_LEVELS },
-
- { URI_PROPERTY_COMPLEX_COLLECTION, QO_FILTER }, { URI_PROPERTY_COMPLEX_COLLECTION, QO_FORMAT },
- { URI_PROPERTY_COMPLEX_COLLECTION, QO_EXPAND }, { URI_PROPERTY_COMPLEX_COLLECTION, QO_COUNT },
- { URI_PROPERTY_COMPLEX_COLLECTION, QO_SKIP }, { URI_PROPERTY_COMPLEX_COLLECTION, QO_SKIPTOKEN },
- { URI_PROPERTY_COMPLEX_COLLECTION, QO_LEVELS }, { URI_PROPERTY_COMPLEX_COLLECTION, QO_TOP },
- { URI_PROPERTY_COMPLEX_COLLECTION, QO_ORDERBY },
-
- { URI_PROPERTY_COMPLEX_COLLECTION_COUNT, QO_FILTER }, /* { URI_PROPERTY_COMPLEX_COLLECTION_COUNT, QO_SEARCH }, */
-
- { URI_PROPERTY_PRIMITIVE, QO_FORMAT },
-
- { URI_PROPERTY_PRIMITIVE_COLLECTION, QO_FILTER }, { URI_PROPERTY_PRIMITIVE_COLLECTION, QO_FORMAT },
- { URI_PROPERTY_PRIMITIVE_COLLECTION, QO_ORDERBY }, { URI_PROPERTY_PRIMITIVE_COLLECTION, QO_SKIP },
- { URI_PROPERTY_PRIMITIVE_COLLECTION, QO_SKIPTOKEN }, { URI_PROPERTY_PRIMITIVE_COLLECTION, QO_TOP },
-
- { URI_PROPERTY_PRIMITIVE_COLLECTION_COUNT, QO_FILTER },
- /* { URI_PROPERTY_PRIMITIVE_COLLECTION_COUNT, QO_SEARCH }, */
-
- { URI_PROPERTY_PRIMITIVE_VALUE, QO_FORMAT },
-
- { URI_SINGLETON, QO_FORMAT }, { URI_SINGLETON, QO_EXPAND }, { URI_SINGLETON, QO_SELECT },
- { URI_SINGLETON, QO_LEVELS },
-
- { URI_NAV_ENTITY, QO_FORMAT }, { URI_NAV_ENTITY, QO_EXPAND }, { URI_NAV_ENTITY, QO_SELECT },
- { URI_NAV_ENTITY, QO_LEVELS },
-
- { URI_NAV_ENTITY_SET, QO_FILTER }, { URI_NAV_ENTITY_SET, QO_FORMAT }, { URI_NAV_ENTITY_SET, QO_EXPAND },
- { URI_NAV_ENTITY_SET, QO_COUNT }, { URI_NAV_ENTITY_SET, QO_ORDERBY },
- /* { URI_NAV_ENTITY_SET, QO_SEARCH }, */{ URI_NAV_ENTITY_SET, QO_SELECT }, { URI_NAV_ENTITY_SET, QO_SKIP },
- { URI_NAV_ENTITY_SET, QO_SKIPTOKEN }, { URI_NAV_ENTITY_SET, QO_LEVELS }, { URI_NAV_ENTITY_SET, QO_TOP },
-
- { "FINRTInt16()" },
- { "FICRTETKeyNav()" },
- { "FICRTESTwoKeyNavParam(ParameterInt16=1)" },
- { "FICRTCollString()" },
- { "FICRTCTTwoPrim()" },
- { "FICRTCollCTTwoPrim()" },
- { "FICRTETMedia()" },
-
- { "ESTwoKeyNav/olingo.odata.test1.BAESTwoKeyNavRTESTwoKeyNav" },
- { "ESAllPrim/olingo.odata.test1.BAESAllPrimRTETAllPrim" },
- { ContainerProvider.AIRT_COLL_STRING_TWO_PARAM },
- { ContainerProvider.AIRTET_TWO_KEY_TWO_PRIM_PARAM },
- { ContainerProvider.AIRT_STRING }
- };
-
- private String[][] urisWithNonValidSystemQueryOptions = {
- { URI_ALL, QO_ID }, { URI_ALL, QO_TOP },
-
- { URI_BATCH, QO_FILTER }, { URI_BATCH, QO_FORMAT }, { URI_BATCH, QO_ID }, { URI_BATCH, QO_EXPAND },
- { URI_BATCH, QO_COUNT }, { URI_BATCH, QO_ORDERBY }, /* { URI_BATCH, QO_SEARCH }, */{ URI_BATCH, QO_SELECT },
- { URI_BATCH, QO_SKIP }, { URI_BATCH, QO_SKIPTOKEN }, { URI_BATCH, QO_LEVELS }, { URI_BATCH, QO_TOP },
-
- { URI_CROSSJOIN, QO_ID },
-
- { URI_ENTITY_ID, QO_ID, QO_FILTER },
- { URI_ENTITY_ID, QO_ID, QO_COUNT }, { URI_ENTITY_ID, QO_ORDERBY }, /* { URI_ENTITY_ID, QO_SEARCH }, */
-
- { URI_ENTITY_ID, QO_ID, QO_SKIP }, { URI_ENTITY_ID, QO_ID, QO_SKIPTOKEN }, { URI_ENTITY_ID, QO_ID, QO_TOP },
-
- { URI_METADATA, QO_FILTER }, { URI_METADATA, QO_ID }, { URI_METADATA, QO_EXPAND },
- { URI_METADATA, QO_COUNT }, { URI_METADATA, QO_ORDERBY }, /* { URI_METADATA, QO_SEARCH }, */
- { URI_METADATA, QO_SELECT }, { URI_METADATA, QO_SKIP }, { URI_METADATA, QO_SKIPTOKEN },
- { URI_METADATA, QO_LEVELS }, { URI_METADATA, QO_TOP },
-
- { URI_SERVICE, QO_FILTER }, { URI_SERVICE, QO_ID }, { URI_SERVICE, QO_EXPAND }, { URI_SERVICE, QO_COUNT },
- { URI_SERVICE, QO_ORDERBY }, /* { URI_SERVICE, QO_SEARCH }, */{ URI_SERVICE, QO_SELECT },
- { URI_SERVICE, QO_SKIP }, { URI_SERVICE, QO_SKIPTOKEN }, { URI_SERVICE, QO_LEVELS }, { URI_SERVICE, QO_TOP },
-
- { URI_ENTITY_SET, QO_ID },
-
- { URI_ENTITY_SET_COUNT, QO_FORMAT }, { URI_ENTITY_SET_COUNT, QO_ID },
- { URI_ENTITY_SET_COUNT, QO_EXPAND }, { URI_ENTITY_SET_COUNT, QO_COUNT },
- { URI_ENTITY_SET_COUNT, QO_ORDERBY },
- { URI_ENTITY_SET_COUNT, QO_SELECT }, { URI_ENTITY_SET_COUNT, QO_SKIP }, { URI_ENTITY_SET_COUNT, QO_SKIPTOKEN },
- { URI_ENTITY_SET_COUNT, QO_LEVELS }, { URI_ENTITY_SET_COUNT, QO_TOP },
-
- { URI_ENTITY, QO_FILTER }, { URI_ENTITY, QO_ID }, { URI_ENTITY, QO_COUNT }, /* { URI_ENTITY, QO_ORDERBY }, */
- /* { URI_ENTITY, QO_SEARCH }, */{ URI_ENTITY, QO_SKIP }, { URI_ENTITY, QO_SKIPTOKEN }, { URI_ENTITY, QO_TOP },
-
- { URI_MEDIA_STREAM, QO_FILTER }, { URI_MEDIA_STREAM, QO_ID }, { URI_MEDIA_STREAM, QO_EXPAND },
- { URI_MEDIA_STREAM, QO_COUNT }, { URI_MEDIA_STREAM, QO_ORDERBY }, /* { URI_MEDIA_STREAM, QO_SEARCH }, */
- { URI_MEDIA_STREAM, QO_SELECT }, { URI_MEDIA_STREAM, QO_SKIP }, { URI_MEDIA_STREAM, QO_SKIPTOKEN },
- { URI_MEDIA_STREAM, QO_LEVELS }, { URI_MEDIA_STREAM, QO_TOP },
-
- { URI_REFERENCES, QO_ID }, { URI_REFERENCES, QO_EXPAND }, { URI_REFERENCES, QO_COUNT },
- { URI_REFERENCES, QO_SELECT }, { URI_REFERENCES, QO_LEVELS },
-
- { URI_REFERENCE, QO_FILTER }, { URI_REFERENCE, QO_ID }, { URI_REFERENCE, QO_EXPAND },
- { URI_REFERENCE, QO_COUNT }, { URI_REFERENCE, QO_ORDERBY }, /* { URI_REFERENCE, QO_SEARCH }, */
- { URI_REFERENCE, QO_SELECT }, { URI_REFERENCE, QO_SKIP }, { URI_REFERENCE, QO_SKIPTOKEN },
- { URI_REFERENCE, QO_LEVELS }, { URI_REFERENCE, QO_TOP },
-
- { URI_PROPERTY_COMPLEX, QO_FILTER }, { URI_PROPERTY_COMPLEX, QO_ID }, { URI_PROPERTY_COMPLEX, QO_COUNT },
- { URI_PROPERTY_COMPLEX, QO_ORDERBY }, /* { URI_PROPERTY_COMPLEX, QO_SEARCH }, */
- { URI_PROPERTY_COMPLEX, QO_SKIP }, { URI_PROPERTY_COMPLEX, QO_SKIPTOKEN }, { URI_PROPERTY_COMPLEX, QO_TOP },
-
- { URI_PROPERTY_COMPLEX_COLLECTION, QO_ID },
- /* { URI_PROPERTY_COMPLEX_COLLECTION, QO_SEARCH }, */{ URI_PROPERTY_COMPLEX_COLLECTION, QO_SELECT },
-
- { URI_PROPERTY_COMPLEX_COLLECTION_COUNT, QO_FORMAT },
- { URI_PROPERTY_COMPLEX_COLLECTION_COUNT, QO_ID }, { URI_PROPERTY_COMPLEX_COLLECTION_COUNT, QO_EXPAND },
- { URI_PROPERTY_COMPLEX_COLLECTION_COUNT, QO_COUNT }, { URI_PROPERTY_COMPLEX_COLLECTION_COUNT, QO_ORDERBY },
- { URI_PROPERTY_COMPLEX_COLLECTION_COUNT, QO_SELECT },
- { URI_PROPERTY_COMPLEX_COLLECTION_COUNT, QO_SKIP }, { URI_PROPERTY_COMPLEX_COLLECTION_COUNT, QO_SKIPTOKEN },
- { URI_PROPERTY_COMPLEX_COLLECTION_COUNT, QO_LEVELS }, { URI_PROPERTY_COMPLEX_COLLECTION_COUNT, QO_TOP },
-
- { URI_PROPERTY_PRIMITIVE, QO_FILTER }, { URI_PROPERTY_PRIMITIVE, QO_ID }, { URI_PROPERTY_PRIMITIVE, QO_EXPAND },
- { URI_PROPERTY_PRIMITIVE, QO_COUNT }, { URI_PROPERTY_PRIMITIVE, QO_ORDERBY },
- /* { URI_PROPERTY_PRIMITIVE, QO_SEARCH }, */{ URI_PROPERTY_PRIMITIVE, QO_SELECT },
- { URI_PROPERTY_PRIMITIVE, QO_SKIP }, { URI_PROPERTY_PRIMITIVE, QO_SKIPTOKEN },
- { URI_PROPERTY_PRIMITIVE, QO_LEVELS }, { URI_PROPERTY_PRIMITIVE, QO_TOP },
-
- { URI_PROPERTY_PRIMITIVE_COLLECTION, QO_ID }, { URI_PROPERTY_PRIMITIVE_COLLECTION, QO_EXPAND },
- { URI_PROPERTY_PRIMITIVE_COLLECTION, QO_COUNT }, /* { URI_PROPERTY_PRIMITIVE_COLLECTION, QO_SEARCH }, */
- { URI_PROPERTY_PRIMITIVE_COLLECTION, QO_SELECT }, { URI_PROPERTY_PRIMITIVE_COLLECTION, QO_LEVELS },
-
- { URI_PROPERTY_PRIMITIVE_COLLECTION_COUNT, QO_FORMAT },
- { URI_PROPERTY_PRIMITIVE_COLLECTION_COUNT, QO_ID }, { URI_PROPERTY_PRIMITIVE_COLLECTION_COUNT, QO_EXPAND },
- { URI_PROPERTY_PRIMITIVE_COLLECTION_COUNT, QO_COUNT },
- { URI_PROPERTY_PRIMITIVE_COLLECTION_COUNT, QO_ORDERBY },
- { URI_PROPERTY_PRIMITIVE_COLLECTION_COUNT, QO_SELECT }, { URI_PROPERTY_PRIMITIVE_COLLECTION_COUNT, QO_SKIP },
- { URI_PROPERTY_PRIMITIVE_COLLECTION_COUNT, QO_SKIPTOKEN },
- { URI_PROPERTY_PRIMITIVE_COLLECTION_COUNT, QO_LEVELS }, { URI_PROPERTY_PRIMITIVE_COLLECTION_COUNT, QO_TOP },
-
- { URI_PROPERTY_PRIMITIVE_VALUE, QO_FILTER }, { URI_PROPERTY_PRIMITIVE_VALUE, QO_ID },
- { URI_PROPERTY_PRIMITIVE_VALUE, QO_EXPAND }, { URI_PROPERTY_PRIMITIVE_VALUE, QO_COUNT },
- { URI_PROPERTY_PRIMITIVE_VALUE, QO_ORDERBY },/* { URI_PROPERTY_PRIMITIVE_VALUE, QO_SEARCH }, */
- { URI_PROPERTY_PRIMITIVE_VALUE, QO_SELECT }, { URI_PROPERTY_PRIMITIVE_VALUE, QO_SKIP },
- { URI_PROPERTY_PRIMITIVE_VALUE, QO_SKIPTOKEN }, { URI_PROPERTY_PRIMITIVE_VALUE, QO_LEVELS },
- { URI_PROPERTY_PRIMITIVE_VALUE, QO_TOP },
-
- { URI_SINGLETON, QO_FILTER }, { URI_SINGLETON, QO_ID }, { URI_SINGLETON, QO_COUNT },
- { URI_SINGLETON, QO_ORDERBY }, /* { URI_SINGLETON, QO_SEARCH }, */{ URI_SINGLETON, QO_SKIP },
- { URI_SINGLETON, QO_SKIPTOKEN }, { URI_SINGLETON, QO_TOP },
-
- { URI_NAV_ENTITY, QO_FILTER }, { URI_NAV_ENTITY, QO_ID }, { URI_NAV_ENTITY, QO_COUNT },
- { URI_NAV_ENTITY, QO_ORDERBY }, /* { URI_NAV_ENTITY, QO_SEARCH }, */{ URI_NAV_ENTITY, QO_SKIP },
- { URI_NAV_ENTITY, QO_SKIPTOKEN }, { URI_SINGLETON, QO_TOP },
-
- { URI_NAV_ENTITY_SET, QO_ID }
- };
-
- private static final Edm edm = new EdmProviderImpl(new EdmTechProvider());
-
- @Test
- public void validateForHttpMethods() throws Exception {
- final UriInfo uri = new Parser().parseUri(URI_ENTITY, null, null, edm);
- final UriValidator validator = new UriValidator();
-
- validator.validate(uri, HttpMethod.GET);
- validator.validate(uri, HttpMethod.POST);
- validator.validate(uri, HttpMethod.PUT);
- validator.validate(uri, HttpMethod.DELETE);
- validator.validate(uri, HttpMethod.PATCH);
- }
-
- @Test
- public void validateSelect() throws Exception {
- new TestUriValidator().setEdm(edm).run(URI_ENTITY, "$select=PropertyString");
- }
-
- @Test
- public void validateOrderBy() throws Exception {
- final TestUriValidator testUri = new TestUriValidator().setEdm(edm);
-
- testUri.run(URI_ENTITY_SET, "$orderby=PropertyString");
-
- testUri.runEx(URI_ENTITY, "$orderby=XXXX")
- .isExSemantic(UriParserSemanticException.MessageKeys.EXPRESSION_PROPERTY_NOT_IN_TYPE);
- }
-
- @Test
- public void validateCountInvalid() throws Exception {
- new TestUriValidator().setEdm(edm).runEx(URI_ENTITY_SET, "$count=foo")
- .isExSyntax(UriParserSyntaxException.MessageKeys.WRONG_VALUE_FOR_SYSTEM_QUERY_OPTION);
- }
-
- @Test
- public void validateTopInvalid() throws Exception {
- new TestUriValidator().setEdm(edm).runEx(URI_ENTITY_SET, "$top=foo")
- .isExSyntax(UriParserSyntaxException.MessageKeys.WRONG_VALUE_FOR_SYSTEM_QUERY_OPTION);
- }
-
- @Test
- public void validateSkipInvalid() throws Exception {
- new TestUriValidator().setEdm(edm).runEx(URI_ENTITY_SET, "$skip=foo")
- .isExSyntax(UriParserSyntaxException.MessageKeys.WRONG_VALUE_FOR_SYSTEM_QUERY_OPTION);
- }
-
- @Test
- public void validateDoubleSystemOptions() throws Exception {
- new TestUriValidator().setEdm(edm).runEx(URI_ENTITY_SET, "$skip=1&$skip=2")
- .isExSyntax(UriParserSyntaxException.MessageKeys.DOUBLE_SYSTEM_QUERY_OPTION);
- }
-
- @Test
- public void checkKeys() throws Exception {
- final TestUriValidator testUri = new TestUriValidator().setEdm(edm);
-
- testUri.run("ESTwoKeyNav(PropertyInt16=1, PropertyString='abc')");
-
- testUri.runEx("ESTwoKeyNav(xxx=1, yyy='abc')")
- .isExValidation(UriValidationException.MessageKeys.INVALID_KEY_PROPERTY);
- testUri.runEx("ESCollAllPrim(null)").isExValidation(UriValidationException.MessageKeys.INVALID_KEY_PROPERTY);
- testUri.runEx("ESAllPrim(PropertyInt16='1')")
- .isExValidation(UriValidationException.MessageKeys.INVALID_KEY_PROPERTY);
- testUri.runEx("ESAllPrim(12345678901234567890)")
- .isExValidation(UriValidationException.MessageKeys.INVALID_KEY_PROPERTY);
- testUri.runEx("ESTwoKeyNav(PropertyInt16=1,PropertyString=1)")
- .isExValidation(UriValidationException.MessageKeys.INVALID_KEY_PROPERTY);
- testUri.runEx("ESTwoKeyNav(PropertyInt16=1,PropertyInt16=1)")
- .isExValidation(UriValidationException.MessageKeys.DOUBLE_KEY_PROPERTY);
- }
-
- @Test
- public void checkValidSystemQueryOption() throws Exception {
- for (final String[] uriArray : urisWithValidSystemQueryOptions) {
- final String[] uri = constructUri(uriArray);
- try {
- new UriValidator().validate(
- new Parser().parseUri(uri[0], uri[1], null, edm),
- HttpMethod.GET);
- } catch (final UriParserException e) {
- fail("Failed for uri: " + uri[0] + '?' + uri[1]);
- } catch (final UriValidationException e) {
- fail("Failed for uri: " + uri[0] + '?' + uri[1]);
- }
- }
- }
-
- @Test
- public void checkNonValidSystemQueryOption() throws Exception {
- for (final String[] uriArray : urisWithNonValidSystemQueryOptions) {
- final String[] uri = constructUri(uriArray);
- validateWrong(uri[0], uri[1], HttpMethod.GET,
- UriValidationException.MessageKeys.SYSTEM_QUERY_OPTION_NOT_ALLOWED);
- }
- }
-
- @Test
- public void propertyOperations() throws Exception {
- validateWrong(URI_PROPERTY_PRIMITIVE_COLLECTION, null, HttpMethod.PATCH,
- UriValidationException.MessageKeys.UNSUPPORTED_HTTP_METHOD);
- validateWrong(URI_PROPERTY_COMPLEX_COLLECTION, null, HttpMethod.PATCH,
- UriValidationException.MessageKeys.UNSUPPORTED_HTTP_METHOD);
- validateWrong("ESKeyNav(1)/PropertyString", null, HttpMethod.DELETE,
- UriValidationException.MessageKeys.UNSUPPORTED_HTTP_METHOD);
- validateWrong("ESKeyNav(1)/PropertyString/$value", null, HttpMethod.DELETE,
- UriValidationException.MessageKeys.UNSUPPORTED_HTTP_METHOD);
- }
-
- private String[] constructUri(final String[] uriParameterArray) {
- final String path = uriParameterArray[0];
- String query = "";
- for (int i = 1; i < uriParameterArray.length; i++) {
- if (i > 1) {
- query += '&';
- }
- query += uriParameterArray[i];
- }
- return new String[] { path, query };
- }
-
- private void validateWrong(final String path, final String query, final HttpMethod method,
- final UriValidationException.MessageKeys expectedMessageKey) {
- try {
- new UriValidator().validate(new Parser().parseUri(path, query, null, edm), method);
- fail("Validation Exception not thrown: " + method + ' ' + path + '?' + query);
- } catch (final UriParserException e) {
- fail("Wrong Exception thrown: " + method + ' ' + path + '?' + query);
- } catch (final UriValidationException e) {
- assertEquals(expectedMessageKey, e.getMessageKey());
- }
- }
-}
diff --git a/lib/server-test/src/test/resources/ESAllPrim.json b/lib/server-test/src/test/resources/ESAllPrim.json
deleted file mode 100644
index 75a6a22..0000000
--- a/lib/server-test/src/test/resources/ESAllPrim.json
+++ /dev/null
@@ -1,56 +0,0 @@
-{
- "@odata.context" : "$metadata#ESAllPrim",
- "value" : [{
- "PropertyInt16" : 32767,
- "PropertyString" : "First Resource - positive values",
- "PropertyBoolean" : true,
- "PropertyByte" : 255,
- "PropertySByte" : 127,
- "PropertyInt32" : 2147483647,
- "PropertyInt64" : 9223372036854775807,
- "PropertySingle" : 1.79000000E+20,
- "PropertyDouble" : -1.7900000000000000E+19,
- "PropertyDecimal" : 34,
- "PropertyBinary" : "ASNFZ4mrze8=",
- "PropertyDate" : "2012-12-03",
- "PropertyDateTimeOffset" : "2012-12-03T07:16:23Z",
- "PropertyDuration" : "P0DT0H0M6S",
- "PropertyGuid" : "01234567-89ab-cdef-0123-456789abcdef",
- "PropertyTimeOfDay" : "03:26:05"
- }, {
- "PropertyInt16" : -32768,
- "PropertyString" : "Second Resource - negative values",
- "PropertyBoolean" : false,
- "PropertyByte" : 0,
- "PropertySByte" : -128,
- "PropertyInt32" : -2147483648,
- "PropertyInt64" : -9223372036854775808,
- "PropertySingle" : -1.79000000E+08,
- "PropertyDouble" : -1.7900000000000000E+05,
- "PropertyDecimal" : -34,
- "PropertyBinary" : "ASNFZ4mrze8=",
- "PropertyDate" : "2015-11-05",
- "PropertyDateTimeOffset" : "2005-12-03T07:17:08Z",
- "PropertyDuration" : "P0DT0H0M9S",
- "PropertyGuid" : "76543201-23ab-cdef-0123-456789dddfff",
- "PropertyTimeOfDay" : "23:49:14"
- }, {
- "PropertyInt16" : 0,
- "PropertyString" : "",
- "PropertyBoolean" : false,
- "PropertyByte" : 0,
- "PropertySByte" : 0,
- "PropertyInt32" : 0,
- "PropertyInt64" : 0,
- "PropertySingle" : 0.00000000E+00,
- "PropertyDouble" : 0.0000000000000000E+00,
- "PropertyDecimal" : 0,
- "PropertyBinary" : "",
- "PropertyDate" : "1970-01-01",
- "PropertyDateTimeOffset" : "2005-12-03T00:00:00Z",
- "PropertyDuration" : "P0DT0H0M0S",
- "PropertyGuid" : "76543201-23ab-cdef-0123-456789cccddd",
- "PropertyTimeOfDay" : "00:01:01"
- }
- ]
-}
diff --git a/lib/server-test/src/test/resources/ESAllPrimWithCustomAnnotations.json b/lib/server-test/src/test/resources/ESAllPrimWithCustomAnnotations.json
deleted file mode 100644
index 915a3f0..0000000
--- a/lib/server-test/src/test/resources/ESAllPrimWithCustomAnnotations.json
+++ /dev/null
@@ -1,57 +0,0 @@
-{
- "@odata.context" : "$metadata#ESAllPrim",
- "@custom.annotation" : "customValue",
- "value" : [{
- "PropertyInt16" : 32767,
- "PropertyString" : "First Resource - positive values",
- "PropertyBoolean" : true,
- "PropertyByte" : 255,
- "PropertySByte" : 127,
- "PropertyInt32" : 2147483647,
- "PropertyInt64" : 9223372036854775807,
- "PropertySingle" : 1.79000000E+20,
- "PropertyDouble" : -1.7900000000000000E+19,
- "PropertyDecimal" : 34,
- "PropertyBinary" : "ASNFZ4mrze8=",
- "PropertyDate" : "2012-12-03",
- "PropertyDateTimeOffset" : "2012-12-03T07:16:23Z",
- "PropertyDuration" : "P0DT0H0M6S",
- "PropertyGuid" : "01234567-89ab-cdef-0123-456789abcdef",
- "PropertyTimeOfDay" : "03:26:05"
- }, {
- "PropertyInt16" : -32768,
- "PropertyString" : "Second Resource - negative values",
- "PropertyBoolean" : false,
- "PropertyByte" : 0,
- "PropertySByte" : -128,
- "PropertyInt32" : -2147483648,
- "PropertyInt64" : -9223372036854775808,
- "PropertySingle" : -1.79000000E+08,
- "PropertyDouble" : -1.7900000000000000E+05,
- "PropertyDecimal" : -34,
- "PropertyBinary" : "ASNFZ4mrze8=",
- "PropertyDate" : "2015-11-05",
- "PropertyDateTimeOffset" : "2005-12-03T07:17:08Z",
- "PropertyDuration" : "P0DT0H0M9S",
- "PropertyGuid" : "76543201-23ab-cdef-0123-456789dddfff",
- "PropertyTimeOfDay" : "23:49:14"
- }, {
- "PropertyInt16" : 0,
- "PropertyString" : "",
- "PropertyBoolean" : false,
- "PropertyByte" : 0,
- "PropertySByte" : 0,
- "PropertyInt32" : 0,
- "PropertyInt64" : 0,
- "PropertySingle" : 0.00000000E+00,
- "PropertyDouble" : 0.0000000000000000E+00,
- "PropertyDecimal" : 0,
- "PropertyBinary" : "",
- "PropertyDate" : "1970-01-01",
- "PropertyDateTimeOffset" : "2005-12-03T00:00:00Z",
- "PropertyDuration" : "P0DT0H0M0S",
- "PropertyGuid" : "76543201-23ab-cdef-0123-456789cccddd",
- "PropertyTimeOfDay" : "00:01:01"
- }
- ]
-}
diff --git a/lib/server-test/src/test/resources/ESAllPrimWithDoubleKey.json b/lib/server-test/src/test/resources/ESAllPrimWithDoubleKey.json
deleted file mode 100644
index 6c12ca1..0000000
--- a/lib/server-test/src/test/resources/ESAllPrimWithDoubleKey.json
+++ /dev/null
@@ -1,57 +0,0 @@
-{
- "@odata.context" : "$metadata#ESAllPrim",
- "value" : [],
- "value" : [{
- "PropertyInt16" : 32767,
- "PropertyString" : "First Resource - positive values",
- "PropertyBoolean" : true,
- "PropertyByte" : 255,
- "PropertySByte" : 127,
- "PropertyInt32" : 2147483647,
- "PropertyInt64" : 9223372036854775807,
- "PropertySingle" : 1.79000000E+20,
- "PropertyDouble" : -1.7900000000000000E+19,
- "PropertyDecimal" : 34,
- "PropertyBinary" : "ASNFZ4mrze8=",
- "PropertyDate" : "2012-12-03",
- "PropertyDateTimeOffset" : "2012-12-03T07:16:23Z",
- "PropertyDuration" : "P0DT0H0M6S",
- "PropertyGuid" : "01234567-89ab-cdef-0123-456789abcdef",
- "PropertyTimeOfDay" : "03:26:05"
- }, {
- "PropertyInt16" : -32768,
- "PropertyString" : "Second Resource - negative values",
- "PropertyBoolean" : false,
- "PropertyByte" : 0,
- "PropertySByte" : -128,
- "PropertyInt32" : -2147483648,
- "PropertyInt64" : -9223372036854775808,
- "PropertySingle" : -1.79000000E+08,
- "PropertyDouble" : -1.7900000000000000E+05,
- "PropertyDecimal" : -34,
- "PropertyBinary" : "ASNFZ4mrze8=",
- "PropertyDate" : "2015-11-05",
- "PropertyDateTimeOffset" : "2005-12-03T07:17:08Z",
- "PropertyDuration" : "P0DT0H0M9S",
- "PropertyGuid" : "76543201-23ab-cdef-0123-456789dddfff",
- "PropertyTimeOfDay" : "23:49:14"
- }, {
- "PropertyInt16" : 0,
- "PropertyString" : "",
- "PropertyBoolean" : false,
- "PropertyByte" : 0,
- "PropertySByte" : 0,
- "PropertyInt32" : 0,
- "PropertyInt64" : 0,
- "PropertySingle" : 0.00000000E+00,
- "PropertyDouble" : 0.0000000000000000E+00,
- "PropertyDecimal" : 0,
- "PropertyBinary" : "",
- "PropertyDate" : "1970-01-01",
- "PropertyDateTimeOffset" : "2005-12-03T00:00:00Z",
- "PropertyDuration" : "P0DT0H0M0S",
- "PropertyGuid" : "76543201-23ab-cdef-0123-456789cccddd",
- "PropertyTimeOfDay" : "00:01:01"
- }
- ]
-}
diff --git a/lib/server-test/src/test/resources/ESAllPrimWithODataAnnotations.json b/lib/server-test/src/test/resources/ESAllPrimWithODataAnnotations.json
deleted file mode 100644
index ce3ae40..0000000
--- a/lib/server-test/src/test/resources/ESAllPrimWithODataAnnotations.json
+++ /dev/null
@@ -1,59 +0,0 @@
-{
- "@odata.context" : "$metadata#ESAllPrim",
- "@odata.count" : 3,
- "@odata.nextLink" : "http://localhost:8080/nextLink",
- "@odata.deltaLink" : "http://localhost:8080/deltaLink",
- "value" : [{
- "PropertyInt16" : 32767,
- "PropertyString" : "First Resource - positive values",
- "PropertyBoolean" : true,
- "PropertyByte" : 255,
- "PropertySByte" : 127,
- "PropertyInt32" : 2147483647,
- "PropertyInt64" : 9223372036854775807,
- "PropertySingle" : 1.79000000E+20,
- "PropertyDouble" : -1.7900000000000000E+19,
- "PropertyDecimal" : 34,
- "PropertyBinary" : "ASNFZ4mrze8=",
- "PropertyDate" : "2012-12-03",
- "PropertyDateTimeOffset" : "2012-12-03T07:16:23Z",
- "PropertyDuration" : "P0DT0H0M6S",
- "PropertyGuid" : "01234567-89ab-cdef-0123-456789abcdef",
- "PropertyTimeOfDay" : "03:26:05"
- }, {
- "PropertyInt16" : -32768,
- "PropertyString" : "Second Resource - negative values",
- "PropertyBoolean" : false,
- "PropertyByte" : 0,
- "PropertySByte" : -128,
- "PropertyInt32" : -2147483648,
- "PropertyInt64" : -9223372036854775808,
- "PropertySingle" : -1.79000000E+08,
- "PropertyDouble" : -1.7900000000000000E+05,
- "PropertyDecimal" : -34,
- "PropertyBinary" : "ASNFZ4mrze8=",
- "PropertyDate" : "2015-11-05",
- "PropertyDateTimeOffset" : "2005-12-03T07:17:08Z",
- "PropertyDuration" : "P0DT0H0M9S",
- "PropertyGuid" : "76543201-23ab-cdef-0123-456789dddfff",
- "PropertyTimeOfDay" : "23:49:14"
- }, {
- "PropertyInt16" : 0,
- "PropertyString" : "",
- "PropertyBoolean" : false,
- "PropertyByte" : 0,
- "PropertySByte" : 0,
- "PropertyInt32" : 0,
- "PropertyInt64" : 0,
- "PropertySingle" : 0.00000000E+00,
- "PropertyDouble" : 0.0000000000000000E+00,
- "PropertyDecimal" : 0,
- "PropertyBinary" : "",
- "PropertyDate" : "1970-01-01",
- "PropertyDateTimeOffset" : "2005-12-03T00:00:00Z",
- "PropertyDuration" : "P0DT0H0M0S",
- "PropertyGuid" : "76543201-23ab-cdef-0123-456789cccddd",
- "PropertyTimeOfDay" : "00:01:01"
- }
- ]
-}
diff --git a/lib/server-test/src/test/resources/ESCompCollComp.json b/lib/server-test/src/test/resources/ESCompCollComp.json
deleted file mode 100644
index fa02338..0000000
--- a/lib/server-test/src/test/resources/ESCompCollComp.json
+++ /dev/null
@@ -1,35 +0,0 @@
-{
- "@odata.context" : "$metadata#ESCompCollComp",
- "value" : [{
- "PropertyInt16" : 32767,
- "PropertyComp" : {
- "CollPropertyComp" : [{
- "PropertyInt16" : 555,
- "PropertyString" : "1 Test Complex in Complex Property"
- }, {
- "PropertyInt16" : 666,
- "PropertyString" : "2 Test Complex in Complex property"
- }, {
- "PropertyInt16" : 777,
- "PropertyString" : "3 Test Complex in Complex property"
- }
- ]
- }
- }, {
- "PropertyInt16" : 12345,
- "PropertyComp" : {
- "CollPropertyComp" : [{
- "PropertyInt16" : 888,
- "PropertyString" : "11 Test Complex in Complex property"
- }, {
- "PropertyInt16" : 999,
- "PropertyString" : "12 Test Complex in Complex property"
- }, {
- "PropertyInt16" : 0,
- "PropertyString" : "13 Test Complex in Complex property"
- }
- ]
- }
- }
- ]
-}
diff --git a/lib/server-test/src/test/resources/EntityESAllPrimExpandedNavPropertyETTwoPrimMany.json b/lib/server-test/src/test/resources/EntityESAllPrimExpandedNavPropertyETTwoPrimMany.json
deleted file mode 100644
index b15788f..0000000
--- a/lib/server-test/src/test/resources/EntityESAllPrimExpandedNavPropertyETTwoPrimMany.json
+++ /dev/null
@@ -1,24 +0,0 @@
-{
- "@odata.context" : "$metadata#ESAllPrim/$entity",
- "PropertyInt16" : 32767,
- "PropertyString" : "First Resource - positive values",
- "PropertyBoolean" : true,
- "PropertyByte" : 255,
- "PropertySByte" : 127,
- "PropertyInt32" : 2147483647,
- "PropertyInt64" : 9223372036854775807,
- "PropertySingle" : 1.79000000E+20,
- "PropertyDouble" : -1.7900000000000000E+19,
- "PropertyDecimal" : 34,
- "PropertyBinary" : "ASNFZ4mrze8=",
- "PropertyDate" : "2012-12-03",
- "PropertyDateTimeOffset" : "2012-12-03T07:16:23Z",
- "PropertyDuration" : "P0DT0H0M6S",
- "PropertyGuid" : "01234567-89ab-cdef-0123-456789abcdef",
- "PropertyTimeOfDay" : "03:26:05",
- "NavPropertyETTwoPrimMany" : [{
- "PropertyInt16" : -365,
- "PropertyString" : "Test String2"
- }
- ]
-}
diff --git a/lib/server-test/src/test/resources/EntityESAllPrimExpandedNavPropertyETTwoPrimManyWithCustomAnnotations.json b/lib/server-test/src/test/resources/EntityESAllPrimExpandedNavPropertyETTwoPrimManyWithCustomAnnotations.json
deleted file mode 100644
index edcc3ad..0000000
--- a/lib/server-test/src/test/resources/EntityESAllPrimExpandedNavPropertyETTwoPrimManyWithCustomAnnotations.json
+++ /dev/null
@@ -1,25 +0,0 @@
-{
- "@odata.context" : "$metadata#ESAllPrim/$entity",
- "PropertyInt16" : 32767,
- "PropertyString" : "First Resource - positive values",
- "PropertyBoolean" : true,
- "PropertyByte" : 255,
- "PropertySByte" : 127,
- "PropertyInt32" : 2147483647,
- "PropertyInt64" : 9223372036854775807,
- "PropertySingle" : 1.79000000E+20,
- "PropertyDouble" : -1.7900000000000000E+19,
- "PropertyDecimal" : 34,
- "PropertyBinary" : "ASNFZ4mrze8=",
- "PropertyDate" : "2012-12-03",
- "PropertyDateTimeOffset" : "2012-12-03T07:16:23Z",
- "PropertyDuration" : "P0DT0H0M6S",
- "PropertyGuid" : "01234567-89ab-cdef-0123-456789abcdef",
- "PropertyTimeOfDay" : "03:26:05",
- "NavPropertyETTwoPrimMany@custom.annotation" : "customValue",
- "NavPropertyETTwoPrimMany" : [{
- "PropertyInt16" : -365,
- "PropertyString" : "Test String2"
- }
- ]
-}
diff --git a/lib/server-test/src/test/resources/EntityESAllPrimExpandedNavPropertyETTwoPrimManyWithODataAnnotations.json b/lib/server-test/src/test/resources/EntityESAllPrimExpandedNavPropertyETTwoPrimManyWithODataAnnotations.json
deleted file mode 100644
index 4cbf650..0000000
--- a/lib/server-test/src/test/resources/EntityESAllPrimExpandedNavPropertyETTwoPrimManyWithODataAnnotations.json
+++ /dev/null
@@ -1,27 +0,0 @@
-{
- "@odata.context" : "$metadata#ESAllPrim/$entity",
- "PropertyInt16" : 32767,
- "PropertyString" : "First Resource - positive values",
- "PropertyBoolean" : true,
- "PropertyByte" : 255,
- "PropertySByte" : 127,
- "PropertyInt32" : 2147483647,
- "PropertyInt64" : 9223372036854775807,
- "PropertySingle" : 1.79000000E+20,
- "PropertyDouble" : -1.7900000000000000E+19,
- "PropertyDecimal" : 34,
- "PropertyBinary" : "ASNFZ4mrze8=",
- "PropertyDate" : "2012-12-03",
- "PropertyDateTimeOffset" : "2012-12-03T07:16:23Z",
- "PropertyDuration" : "P0DT0H0M6S",
- "PropertyGuid" : "01234567-89ab-cdef-0123-456789abcdef",
- "PropertyTimeOfDay" : "03:26:05",
- "NavPropertyETTwoPrimMany@odata.context" : "http://localhost:8080/context",
- "NavPropertyETTwoPrimMany@odata.count" : 12,
- "NavPropertyETTwoPrimMany@odata.nextLink" : "http://localhost:8080/nextLink",
- "NavPropertyETTwoPrimMany" : [{
- "PropertyInt16" : -365,
- "PropertyString" : "Test String2"
- }
- ]
-}
diff --git a/lib/server-test/src/test/resources/EntityESAllPrimExpandedNavPropertyETTwoPrimOne.json b/lib/server-test/src/test/resources/EntityESAllPrimExpandedNavPropertyETTwoPrimOne.json
deleted file mode 100644
index a68a554..0000000
--- a/lib/server-test/src/test/resources/EntityESAllPrimExpandedNavPropertyETTwoPrimOne.json
+++ /dev/null
@@ -1,23 +0,0 @@
-{
- "@odata.context" : "$metadata#ESAllPrim/$entity",
- "PropertyInt16" : 32767,
- "PropertyString" : "First Resource - positive values",
- "PropertyBoolean" : true,
- "PropertyByte" : 255,
- "PropertySByte" : 127,
- "PropertyInt32" : 2147483647,
- "PropertyInt64" : 9223372036854775807,
- "PropertySingle" : 1.79000000E+20,
- "PropertyDouble" : -1.7900000000000000E+19,
- "PropertyDecimal" : 34,
- "PropertyBinary" : "ASNFZ4mrze8=",
- "PropertyDate" : "2012-12-03",
- "PropertyDateTimeOffset" : "2012-12-03T07:16:23Z",
- "PropertyDuration" : "P0DT0H0M6S",
- "PropertyGuid" : "01234567-89ab-cdef-0123-456789abcdef",
- "PropertyTimeOfDay" : "03:26:05",
- "NavPropertyETTwoPrimOne" : {
- "PropertyInt16" : 32767,
- "PropertyString" : "Test String4"
- }
-}
diff --git a/lib/server-test/src/test/resources/EntityESAllPrimExpandedNavPropertyETTwoPrimOneWithCustomAnnotations.json b/lib/server-test/src/test/resources/EntityESAllPrimExpandedNavPropertyETTwoPrimOneWithCustomAnnotations.json
deleted file mode 100644
index 85c55e7..0000000
--- a/lib/server-test/src/test/resources/EntityESAllPrimExpandedNavPropertyETTwoPrimOneWithCustomAnnotations.json
+++ /dev/null
@@ -1,24 +0,0 @@
-{
- "@odata.context" : "$metadata#ESAllPrim/$entity",
- "PropertyInt16" : 32767,
- "PropertyString" : "First Resource - positive values",
- "PropertyBoolean" : true,
- "PropertyByte" : 255,
- "PropertySByte" : 127,
- "PropertyInt32" : 2147483647,
- "PropertyInt64" : 9223372036854775807,
- "PropertySingle" : 1.79000000E+20,
- "PropertyDouble" : -1.7900000000000000E+19,
- "PropertyDecimal" : 34,
- "PropertyBinary" : "ASNFZ4mrze8=",
- "PropertyDate" : "2012-12-03",
- "PropertyDateTimeOffset" : "2012-12-03T07:16:23Z",
- "PropertyDuration" : "P0DT0H0M6S",
- "PropertyGuid" : "01234567-89ab-cdef-0123-456789abcdef",
- "PropertyTimeOfDay" : "03:26:05",
- "NavPropertyETTwoPrimOne@custom.annotation" : "customValue",
- "NavPropertyETTwoPrimOne" : {
- "PropertyInt16" : 32767,
- "PropertyString" : "Test String4"
- }
-}
diff --git a/lib/server-test/src/test/resources/EntityESAllPrimExpandedNavPropertyETTwoPrimOneWithODataAnnotations.json b/lib/server-test/src/test/resources/EntityESAllPrimExpandedNavPropertyETTwoPrimOneWithODataAnnotations.json
deleted file mode 100644
index e778f58..0000000
--- a/lib/server-test/src/test/resources/EntityESAllPrimExpandedNavPropertyETTwoPrimOneWithODataAnnotations.json
+++ /dev/null
@@ -1,26 +0,0 @@
-{
- "@odata.context" : "$metadata#ESAllPrim/$entity",
- "PropertyInt16" : 32767,
- "PropertyString" : "First Resource - positive values",
- "PropertyBoolean" : true,
- "PropertyByte" : 255,
- "PropertySByte" : 127,
- "PropertyInt32" : 2147483647,
- "PropertyInt64" : 9223372036854775807,
- "PropertySingle" : 1.79000000E+20,
- "PropertyDouble" : -1.7900000000000000E+19,
- "PropertyDecimal" : 34,
- "PropertyBinary" : "ASNFZ4mrze8=",
- "PropertyDate" : "2012-12-03",
- "PropertyDateTimeOffset" : "2012-12-03T07:16:23Z",
- "PropertyDuration" : "P0DT0H0M6S",
- "PropertyGuid" : "01234567-89ab-cdef-0123-456789abcdef",
- "PropertyTimeOfDay" : "03:26:05",
- "NavPropertyETTwoPrimOne@odata.context" : "http://localhost:8080/context",
- "NavPropertyETTwoPrimOne@odata.count" : 12,
- "NavPropertyETTwoPrimOne@odata.nextLink" : "http://localhost:8080/nextLink",
- "NavPropertyETTwoPrimOne" : {
- "PropertyInt16" : 32767,
- "PropertyString" : "Test String4"
- }
-}
diff --git a/lib/server-test/src/test/resources/EntityETMixEnumDefCollComp.json b/lib/server-test/src/test/resources/EntityETMixEnumDefCollComp.json
deleted file mode 100644
index c56a809..0000000
--- a/lib/server-test/src/test/resources/EntityETMixEnumDefCollComp.json
+++ /dev/null
@@ -1,24 +0,0 @@
-{
- "PropertyEnumString" : 2,
- "PropertyDefString" : "string",
- "CollPropertyEnumString" : [1, 2],
- "CollPropertyDefString" : ["string1", "string2"],
- "PropertyCompMixedEnumDef" : {
- "PropertyEnumString" : 2,
- "PropertyDefString" : "string",
- "CollPropertyEnumString" : [1, 2],
- "CollPropertyDefString" : ["string1", "string2"]
- },
- "CollPropertyCompMixedEnumDef" : [{
- "PropertyEnumString" : 2,
- "PropertyDefString" : "string",
- "CollPropertyEnumString" : [1, 2],
- "CollPropertyDefString" : ["string1", "string2"]
- }, {
- "PropertyEnumString" : 2,
- "PropertyDefString" : "string",
- "CollPropertyEnumString" : [1, 2],
- "CollPropertyDefString" : ["string1", "string2"]
- }
- ]
-}
diff --git a/lib/server-test/src/test/resources/simplelogger.properties b/lib/server-test/src/test/resources/simplelogger.properties
deleted file mode 100644
index 2a3350c..0000000
--- a/lib/server-test/src/test/resources/simplelogger.properties
+++ /dev/null
@@ -1,20 +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.
-#
-org.slf4j.simpleLogger.defaultLogLevel=debug
-org.slf4j.simpleLogger.logFile=System.out
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 2cc979d..4cbfda1 100644
--- a/pom.xml
+++ b/pom.xml
@@ -25,7 +25,7 @@
<groupId>org.apache.olingo</groupId>
<artifactId>odata-parent</artifactId>
- <version>4.0.0-beta-02</version>
+ <version>3.0.0-beta-01-SNAPSHOT</version>
<packaging>pom</packaging>
<name>Olingo-OData</name>
@@ -35,7 +35,7 @@
<parent>
<groupId>org.apache</groupId>
<artifactId>apache</artifactId>
- <version>14</version>
+ <version>16</version>
</parent>
<licenses>
diff --git a/samples/client/pom.xml b/samples/client/pom.xml
index bec3b14..aabde1d 100644
--- a/samples/client/pom.xml
+++ b/samples/client/pom.xml
@@ -31,7 +31,7 @@
<parent>
<groupId>org.apache.olingo</groupId>
<artifactId>odata-samples</artifactId>
- <version>4.0.0-beta-02</version>
+ <version>3.0.0-beta-01-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
diff --git a/samples/pom.xml b/samples/pom.xml
index fa90c00..8d801e6 100644
--- a/samples/pom.xml
+++ b/samples/pom.xml
@@ -31,11 +31,7 @@
<parent>
<groupId>org.apache.olingo</groupId>
<artifactId>odata-parent</artifactId>
- <version>4.0.0-beta-02</version>
+ <version>3.0.0-beta-01-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
-
- <modules>
- <module>server</module>
- </modules>
</project>
diff --git a/samples/server/pom.xml b/samples/server/pom.xml
deleted file mode 100644
index b15c7f1..0000000
--- a/samples/server/pom.xml
+++ /dev/null
@@ -1,76 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
- 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.
-
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <artifactId>odata-server-sample</artifactId>
- <packaging>war</packaging>
- <name>${project.artifactId}</name>
-
- <parent>
- <groupId>org.apache.olingo</groupId>
- <artifactId>odata-samples</artifactId>
- <version>4.0.0-beta-02</version>
- <relativePath>..</relativePath>
- </parent>
-
- <dependencies>
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- <version>2.5</version>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.olingo</groupId>
- <artifactId>odata-server-api</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.olingo</groupId>
- <artifactId>odata-server-core</artifactId>
- <version>${project.version}</version>
- <scope>runtime</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.olingo</groupId>
- <artifactId>odata-commons-api</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.olingo</groupId>
- <artifactId>odata-commons-core</artifactId>
- <version>${project.version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-simple</artifactId>
- <version>1.7.7</version>
- <scope>runtime</scope>
- </dependency>
- </dependencies>
-
-</project>
diff --git a/samples/server/src/main/java/org/apache/olingo/server/sample/CarsServlet.java b/samples/server/src/main/java/org/apache/olingo/server/sample/CarsServlet.java
deleted file mode 100644
index f6a17dc..0000000
--- a/samples/server/src/main/java/org/apache/olingo/server/sample/CarsServlet.java
+++ /dev/null
@@ -1,67 +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.sample;
-
-import java.io.IOException;
-import java.util.ArrayList;
-
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.HttpSession;
-
-import org.apache.olingo.server.api.OData;
-import org.apache.olingo.server.api.ODataHttpHandler;
-import org.apache.olingo.server.api.ServiceMetadata;
-import org.apache.olingo.server.api.edmx.EdmxReference;
-import org.apache.olingo.server.sample.data.DataProvider;
-import org.apache.olingo.server.sample.edmprovider.CarsEdmProvider;
-import org.apache.olingo.server.sample.processor.CarsProcessor;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class CarsServlet extends HttpServlet {
-
- private static final long serialVersionUID = 1L;
- private static final Logger LOG = LoggerFactory.getLogger(CarsServlet.class);
-
- @Override
- protected void service(final HttpServletRequest req, final HttpServletResponse resp)
- throws ServletException, IOException {
- try {
- HttpSession session = req.getSession(true);
- DataProvider dataProvider = (DataProvider) session.getAttribute(DataProvider.class.getName());
- if (dataProvider == null) {
- dataProvider = new DataProvider();
- session.setAttribute(DataProvider.class.getName(), dataProvider);
- LOG.info("Created new data provider.");
- }
-
- OData odata = OData.newInstance();
- ServiceMetadata edm = odata.createServiceMetadata(new CarsEdmProvider(), new ArrayList<EdmxReference>());
- ODataHttpHandler handler = odata.createHandler(edm);
- handler.register(new CarsProcessor(dataProvider));
- handler.process(req, resp);
- } catch (RuntimeException e) {
- LOG.error("Server Error", e);
- throw new ServletException(e);
- }
- }
-}
diff --git a/samples/server/src/main/java/org/apache/olingo/server/sample/data/DataProvider.java b/samples/server/src/main/java/org/apache/olingo/server/sample/data/DataProvider.java
deleted file mode 100644
index d59d251..0000000
--- a/samples/server/src/main/java/org/apache/olingo/server/sample/data/DataProvider.java
+++ /dev/null
@@ -1,167 +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.sample.data;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.olingo.commons.api.ODataException;
-import org.apache.olingo.commons.api.data.Entity;
-import org.apache.olingo.commons.api.data.EntitySet;
-import org.apache.olingo.commons.api.data.Property;
-import org.apache.olingo.commons.api.data.ValueType;
-import org.apache.olingo.commons.api.edm.EdmEntitySet;
-import org.apache.olingo.commons.api.edm.EdmEntityType;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveTypeException;
-import org.apache.olingo.commons.api.edm.EdmProperty;
-import org.apache.olingo.commons.core.data.EntityImpl;
-import org.apache.olingo.commons.core.data.EntitySetImpl;
-import org.apache.olingo.commons.core.data.PropertyImpl;
-import org.apache.olingo.server.api.uri.UriParameter;
-
-public class DataProvider {
-
- private Map<String, EntitySet> data;
-
- public DataProvider() {
- data = new HashMap<String, EntitySet>();
- data.put("Cars", createCars());
- data.put("Manufacturers", createManufacturers());
- }
-
- public EntitySet readAll(EdmEntitySet edmEntitySet) {
- return data.get(edmEntitySet.getName());
- }
-
- public Entity read(final EdmEntitySet edmEntitySet, final List<UriParameter> keys) throws DataProviderException {
- final EdmEntityType entityType = edmEntitySet.getEntityType();
- final EntitySet entitySet = data.get(edmEntitySet.getName());
- if (entitySet == null) {
- return null;
- } else {
- try {
- for (final Entity entity : entitySet.getEntities()) {
- boolean found = true;
- for (final UriParameter key : keys) {
- final EdmProperty property = (EdmProperty) entityType.getProperty(key.getName());
- final EdmPrimitiveType type = (EdmPrimitiveType) property.getType();
- if (!type.valueToString(entity.getProperty(key.getName()).getValue(),
- property.isNullable(), property.getMaxLength(), property.getPrecision(), property.getScale(),
- property.isUnicode())
- .equals(key.getText())) {
- found = false;
- break;
- }
- }
- if (found) {
- return entity;
- }
- }
- return null;
- } catch (final EdmPrimitiveTypeException e) {
- throw new DataProviderException("Wrong key!", e);
- }
- }
- }
-
- public static class DataProviderException extends ODataException {
- private static final long serialVersionUID = 5098059649321796156L;
-
- public DataProviderException(String message, Throwable throwable) {
- super(message, throwable);
- }
-
- public DataProviderException(String message) {
- super(message);
- }
- }
-
- private EntitySet createCars() {
- EntitySet entitySet = new EntitySetImpl();
-
- entitySet.getEntities().add(new EntityImpl()
- .addProperty(createPrimitive("Id", 1))
- .addProperty(createPrimitive("Model", "F1 W03"))
- .addProperty(createPrimitive("ModelYear", "2012"))
- .addProperty(createPrimitive("Price", 189189.43))
- .addProperty(createPrimitive("Currency", "EUR")));
-
- entitySet.getEntities().add(new EntityImpl()
- .addProperty(createPrimitive("Id", 2))
- .addProperty(createPrimitive("Model", "F1 W04"))
- .addProperty(createPrimitive("ModelYear", "2013"))
- .addProperty(createPrimitive("Price", 199999.99))
- .addProperty(createPrimitive("Currency", "EUR")));
-
- entitySet.getEntities().add(new EntityImpl()
- .addProperty(createPrimitive("Id", 3))
- .addProperty(createPrimitive("Model", "F2012"))
- .addProperty(createPrimitive("ModelYear", "2012"))
- .addProperty(createPrimitive("Price", 137285.33))
- .addProperty(createPrimitive("Currency", "EUR")));
-
- entitySet.getEntities().add(new EntityImpl()
- .addProperty(createPrimitive("Id", 4))
- .addProperty(createPrimitive("Model", "F2013"))
- .addProperty(createPrimitive("ModelYear", "2013"))
- .addProperty(createPrimitive("Price", 145285.00))
- .addProperty(createPrimitive("Currency", "EUR")));
-
- entitySet.getEntities().add(new EntityImpl()
- .addProperty(createPrimitive("Id", 5))
- .addProperty(createPrimitive("Model", "F1 W02"))
- .addProperty(createPrimitive("ModelYear", "2011"))
- .addProperty(createPrimitive("Price", 167189.00))
- .addProperty(createPrimitive("Currency", "EUR")));
-
- return entitySet;
- }
-
- private EntitySet createManufacturers() {
- EntitySet entitySet = new EntitySetImpl();
-
- entitySet.getEntities().add(new EntityImpl()
- .addProperty(createPrimitive("Id", 1))
- .addProperty(createPrimitive("Name", "Star Powered Racing"))
- .addProperty(createAddress("Star Street 137", "Stuttgart", "70173", "Germany")));
-
- entitySet.getEntities().add(new EntityImpl()
- .addProperty(createPrimitive("Id", 2))
- .addProperty(createPrimitive("Name", "Horse Powered Racing"))
- .addProperty(createAddress("Horse Street 1", "Maranello", "41053", "Italy")));
-
- return entitySet;
- }
-
- private Property createAddress(final String street, final String city, final String zipCode, final String country) {
- List<Property> addressProperties = new ArrayList<Property>();
- addressProperties.add(createPrimitive("Street", street));
- addressProperties.add(createPrimitive("City", city));
- addressProperties.add(createPrimitive("ZipCode", zipCode));
- addressProperties.add(createPrimitive("Country", country));
- return new PropertyImpl(null, "Address", ValueType.COMPLEX, addressProperties);
- }
-
- private Property createPrimitive(final String name, final Object value) {
- return new PropertyImpl(null, name, ValueType.PRIMITIVE, value);
- }
-}
diff --git a/samples/server/src/main/java/org/apache/olingo/server/sample/edmprovider/CarsEdmProvider.java b/samples/server/src/main/java/org/apache/olingo/server/sample/edmprovider/CarsEdmProvider.java
deleted file mode 100644
index 8f1b248..0000000
--- a/samples/server/src/main/java/org/apache/olingo/server/sample/edmprovider/CarsEdmProvider.java
+++ /dev/null
@@ -1,183 +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.sample.edmprovider;
-
-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.ComplexType;
-import org.apache.olingo.server.api.edm.provider.EdmProvider;
-import org.apache.olingo.server.api.edm.provider.EntityContainer;
-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.NavigationProperty;
-import org.apache.olingo.server.api.edm.provider.NavigationPropertyBinding;
-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.Schema;
-
-public class CarsEdmProvider extends EdmProvider {
-
- // Service Namespace
- public static final String NAMESPACE = "olingo.odata.sample";
-
- // EDM Container
- public static final String CONTAINER_NAME = "Container";
- public static final FullQualifiedName CONTAINER_FQN = new FullQualifiedName(NAMESPACE, CONTAINER_NAME);
-
- // Entity Types Names
- public static final FullQualifiedName ET_CAR = new FullQualifiedName(NAMESPACE, "Car");
- public static final FullQualifiedName ET_MANUFACTURER = new FullQualifiedName(NAMESPACE, "Manufacturer");
-
- // Complex Type Names
- public static final FullQualifiedName CT_ADDRESS = new FullQualifiedName(NAMESPACE, "Address");
-
- // Entity Set Names
- public static final String ES_CARS_NAME = "Cars";
- public static final String ES_MANUFACTURER_NAME = "Manufacturers";
-
- @Override
- public EntityType getEntityType(final FullQualifiedName entityTypeName) throws ODataException {
- if (ET_CAR.equals(entityTypeName)) {
- return new EntityType()
- .setName(ET_CAR.getName())
- .setKey(Arrays.asList(
- new PropertyRef().setPropertyName("Id")))
- .setProperties(
- Arrays.asList(
- new Property().setName("Id").setType(EdmPrimitiveTypeKind.Int16.getFullQualifiedName()),
- new Property().setName("Model").setType(EdmPrimitiveTypeKind.String.getFullQualifiedName()),
- new Property().setName("ModelYear").setType(EdmPrimitiveTypeKind.String.getFullQualifiedName())
- .setMaxLength(4),
- new Property().setName("Price").setType(EdmPrimitiveTypeKind.Decimal.getFullQualifiedName())
- .setScale(2),
- new Property().setName("Currency").setType(EdmPrimitiveTypeKind.String.getFullQualifiedName())
- .setMaxLength(3)
- )
- ).setNavigationProperties(Arrays.asList(
- new NavigationProperty().setName("Manufacturer").setType(ET_MANUFACTURER)
- )
- );
-
- } else if (ET_MANUFACTURER.equals(entityTypeName)) {
- return new EntityType()
- .setName(ET_MANUFACTURER.getName())
- .setKey(Arrays.asList(
- new PropertyRef().setPropertyName("Id")))
- .setProperties(Arrays.asList(
- new Property().setName("Id").setType(EdmPrimitiveTypeKind.Int16.getFullQualifiedName()),
- new Property().setName("Name").setType(EdmPrimitiveTypeKind.String.getFullQualifiedName()),
- new Property().setName("Address").setType(CT_ADDRESS))
- ).setNavigationProperties(Arrays.asList(
- new NavigationProperty().setName("Cars").setType(ET_CAR).setCollection(true)
- )
- );
- }
-
- return null;
- }
-
- public ComplexType getComplexType(final FullQualifiedName complexTypeName) throws ODataException {
- if (CT_ADDRESS.equals(complexTypeName)) {
- return new ComplexType().setName(CT_ADDRESS.getName()).setProperties(Arrays.asList(
- new Property().setName("Street").setType(EdmPrimitiveTypeKind.String.getFullQualifiedName()),
- new Property().setName("City").setType(EdmPrimitiveTypeKind.String.getFullQualifiedName()),
- new Property().setName("ZipCode").setType(EdmPrimitiveTypeKind.String.getFullQualifiedName()),
- new Property().setName("Country").setType(EdmPrimitiveTypeKind.String.getFullQualifiedName())
- ));
- }
- return null;
- }
-
- @Override
- public EntitySet getEntitySet(final FullQualifiedName entityContainer, final String entitySetName)
- throws ODataException {
- if (CONTAINER_FQN.equals(entityContainer)) {
- if (ES_CARS_NAME.equals(entitySetName)) {
- return new EntitySet()
- .setName(ES_CARS_NAME)
- .setType(ET_CAR)
- .setNavigationPropertyBindings(
- Arrays.asList(
- new NavigationPropertyBinding().setPath("Manufacturer").setTarget(
- new Target().setTargetName(ES_MANUFACTURER_NAME).setEntityContainer(CONTAINER_FQN))));
- } else if (ES_MANUFACTURER_NAME.equals(entitySetName)) {
- return new EntitySet()
- .setName(ES_MANUFACTURER_NAME)
- .setType(ET_MANUFACTURER).setNavigationPropertyBindings(
- Arrays.asList(
- new NavigationPropertyBinding().setPath("Cars").setTarget(
- new Target().setTargetName(ES_CARS_NAME).setEntityContainer(CONTAINER_FQN))));
- }
- }
-
- return null;
- }
-
- @Override
- public List<Schema> getSchemas() throws ODataException {
- List<Schema> schemas = new ArrayList<Schema>();
- Schema schema = new Schema();
- schema.setNamespace(NAMESPACE);
- // EntityTypes
- List<EntityType> entityTypes = new ArrayList<EntityType>();
- entityTypes.add(getEntityType(ET_CAR));
- entityTypes.add(getEntityType(ET_MANUFACTURER));
- schema.setEntityTypes(entityTypes);
-
- // ComplexTypes
- List<ComplexType> complexTypes = new ArrayList<ComplexType>();
- complexTypes.add(getComplexType(CT_ADDRESS));
- schema.setComplexTypes(complexTypes);
-
- // EntityContainer
- schema.setEntityContainer(getEntityContainer());
- schemas.add(schema);
-
- return schemas;
- }
-
- @Override
- public EntityContainer getEntityContainer() throws ODataException {
- EntityContainer container = new EntityContainer();
- container.setName(CONTAINER_FQN.getName());
-
- // EntitySets
- List<EntitySet> entitySets = new ArrayList<EntitySet>();
- container.setEntitySets(entitySets);
- entitySets.add(getEntitySet(CONTAINER_FQN, ES_CARS_NAME));
- entitySets.add(getEntitySet(CONTAINER_FQN, ES_MANUFACTURER_NAME));
-
- return container;
- }
-
- @Override
- public EntityContainerInfo getEntityContainerInfo(final FullQualifiedName entityContainerName) throws ODataException {
- if (entityContainerName == null || CONTAINER_FQN.equals(entityContainerName)) {
- return new EntityContainerInfo().setContainerName(CONTAINER_FQN);
- }
- return null;
- }
-}
diff --git a/samples/server/src/main/java/org/apache/olingo/server/sample/processor/CarsProcessor.java b/samples/server/src/main/java/org/apache/olingo/server/sample/processor/CarsProcessor.java
deleted file mode 100644
index 891acbb..0000000
--- a/samples/server/src/main/java/org/apache/olingo/server/sample/processor/CarsProcessor.java
+++ /dev/null
@@ -1,353 +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.sample.processor;
-
-import java.io.ByteArrayInputStream;
-import java.io.InputStream;
-import java.nio.charset.Charset;
-import java.util.List;
-import java.util.Locale;
-
-import org.apache.olingo.commons.api.data.ContextURL;
-import org.apache.olingo.commons.api.data.ContextURL.Suffix;
-import org.apache.olingo.commons.api.data.Entity;
-import org.apache.olingo.commons.api.data.EntitySet;
-import org.apache.olingo.commons.api.data.Property;
-import org.apache.olingo.commons.api.edm.EdmComplexType;
-import org.apache.olingo.commons.api.edm.EdmEntitySet;
-import org.apache.olingo.commons.api.edm.EdmPrimitiveType;
-import org.apache.olingo.commons.api.edm.EdmProperty;
-import org.apache.olingo.commons.api.format.ContentType;
-import org.apache.olingo.commons.api.format.ODataFormat;
-import org.apache.olingo.commons.api.http.HttpContentType;
-import org.apache.olingo.commons.api.http.HttpHeader;
-import org.apache.olingo.commons.api.http.HttpStatusCode;
-import org.apache.olingo.server.api.OData;
-import org.apache.olingo.server.api.ODataApplicationException;
-import org.apache.olingo.server.api.ODataRequest;
-import org.apache.olingo.server.api.ODataResponse;
-import org.apache.olingo.server.api.ServiceMetadata;
-import org.apache.olingo.server.api.deserializer.DeserializerException;
-import org.apache.olingo.server.api.processor.ComplexProcessor;
-import org.apache.olingo.server.api.processor.EntityCollectionProcessor;
-import org.apache.olingo.server.api.processor.EntityProcessor;
-import org.apache.olingo.server.api.processor.PrimitiveProcessor;
-import org.apache.olingo.server.api.processor.PrimitiveValueProcessor;
-import org.apache.olingo.server.api.serializer.ComplexSerializerOptions;
-import org.apache.olingo.server.api.serializer.EntityCollectionSerializerOptions;
-import org.apache.olingo.server.api.serializer.EntitySerializerOptions;
-import org.apache.olingo.server.api.serializer.ODataSerializer;
-import org.apache.olingo.server.api.serializer.PrimitiveSerializerOptions;
-import org.apache.olingo.server.api.serializer.SerializerException;
-import org.apache.olingo.server.api.uri.UriInfo;
-import org.apache.olingo.server.api.uri.UriInfoResource;
-import org.apache.olingo.server.api.uri.UriResource;
-import org.apache.olingo.server.api.uri.UriResourceEntitySet;
-import org.apache.olingo.server.api.uri.UriResourceProperty;
-import org.apache.olingo.server.api.uri.queryoption.ExpandOption;
-import org.apache.olingo.server.api.uri.queryoption.SelectOption;
-import org.apache.olingo.server.sample.data.DataProvider;
-import org.apache.olingo.server.sample.data.DataProvider.DataProviderException;
-
-/**
- * This processor will deliver entity collections, single entities as well as properties of an entity.
- * This is a very simple example which should give you a rough guideline on how to implement such an processor.
- * See the JavaDoc of the server.api interfaces for more information.
- */
-public class CarsProcessor implements EntityCollectionProcessor, EntityProcessor,
- PrimitiveProcessor, PrimitiveValueProcessor, ComplexProcessor {
-
- private OData odata;
- private DataProvider dataProvider;
-
- // This constructor is application specific and not mandatory for the Olingo library. We use it here to simulate the
- // database access
- public CarsProcessor(final DataProvider dataProvider) {
- this.dataProvider = dataProvider;
- }
-
- @Override
- public void init(OData odata, ServiceMetadata edm) {
- this.odata = odata;
- }
-
- @Override
- public void readEntityCollection(final ODataRequest request, ODataResponse response, final UriInfo uriInfo,
- final ContentType requestedContentType) throws ODataApplicationException, SerializerException {
- // First we have to figure out which entity set to use
- final EdmEntitySet edmEntitySet = getEdmEntitySet(uriInfo.asUriInfoResource());
-
- // Second we fetch the data for this specific entity set from the mock database and transform it into an EntitySet
- // object which is understood by our serialization
- EntitySet entitySet = dataProvider.readAll(edmEntitySet);
-
- // Next we create a serializer based on the requested format. This could also be a custom format but we do not
- // support them in this example
- final ODataFormat format = ODataFormat.fromContentType(requestedContentType);
- ODataSerializer serializer = odata.createSerializer(format);
-
- // Now the content is serialized using the serializer.
- final ExpandOption expand = uriInfo.getExpandOption();
- final SelectOption select = uriInfo.getSelectOption();
- InputStream serializedContent = serializer.entityCollection(edmEntitySet.getEntityType(), entitySet,
- EntityCollectionSerializerOptions.with()
- .contextURL(format == ODataFormat.JSON_NO_METADATA ? null :
- getContextUrl(edmEntitySet, false, expand, select, null))
- .count(uriInfo.getCountOption())
- .expand(expand).select(select)
- .build());
-
- // Finally we set the response data, headers and status code
- response.setContent(serializedContent);
- response.setStatusCode(HttpStatusCode.OK.getStatusCode());
- response.setHeader(HttpHeader.CONTENT_TYPE, requestedContentType.toContentTypeString());
- }
-
- @Override
- public void readEntity(final ODataRequest request, ODataResponse response, final UriInfo uriInfo,
- final ContentType requestedContentType) throws ODataApplicationException, SerializerException {
- // First we have to figure out which entity set the requested entity is in
- final EdmEntitySet edmEntitySet = getEdmEntitySet(uriInfo.asUriInfoResource());
-
- // Next we fetch the requested entity from the database
- Entity entity;
- try {
- entity = readEntityInternal(uriInfo.asUriInfoResource(), edmEntitySet);
- } catch (DataProviderException e) {
- throw new ODataApplicationException(e.getMessage(), 500, Locale.ENGLISH);
- }
-
- if (entity == null) {
- // If no entity was found for the given key we throw an exception.
- throw new ODataApplicationException("No entity found for this key", HttpStatusCode.NOT_FOUND
- .getStatusCode(), Locale.ENGLISH);
- } else {
- // If an entity was found we proceed by serializing it and sending it to the client.
- final ODataFormat format = ODataFormat.fromContentType(requestedContentType);
- ODataSerializer serializer = odata.createSerializer(format);
- final ExpandOption expand = uriInfo.getExpandOption();
- final SelectOption select = uriInfo.getSelectOption();
- InputStream serializedContent = serializer.entity(edmEntitySet.getEntityType(), entity,
- EntitySerializerOptions.with()
- .contextURL(format == ODataFormat.JSON_NO_METADATA ? null :
- getContextUrl(edmEntitySet, true, expand, select, null))
- .expand(expand).select(select)
- .build());
- response.setContent(serializedContent);
- response.setStatusCode(HttpStatusCode.OK.getStatusCode());
- response.setHeader(HttpHeader.CONTENT_TYPE, requestedContentType.toContentTypeString());
- }
- }
-
- @Override
- public void createEntity(ODataRequest request, ODataResponse response, UriInfo uriInfo,
- ContentType requestFormat, ContentType responseFormat)
- throws ODataApplicationException, DeserializerException, SerializerException {
- throw new ODataApplicationException("Entity create is not supported yet.",
- HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ENGLISH);
- }
-
- @Override
- public void deleteEntity(ODataRequest request, ODataResponse response, UriInfo uriInfo)
- throws ODataApplicationException {
- throw new ODataApplicationException("Entity delete is not supported yet.",
- HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ENGLISH);
- }
-
- @Override
- public void readPrimitive(ODataRequest request, ODataResponse response, UriInfo uriInfo, ContentType format)
- throws ODataApplicationException, SerializerException {
- readProperty(response, uriInfo, format, false);
- }
-
- @Override
- public void readComplex(ODataRequest request, ODataResponse response, UriInfo uriInfo, ContentType format)
- throws ODataApplicationException, SerializerException {
- readProperty(response, uriInfo, format, true);
- }
-
- @Override
- public void readPrimitiveValue(ODataRequest request, ODataResponse response, UriInfo uriInfo, ContentType format)
- throws ODataApplicationException, SerializerException {
- // First we have to figure out which entity set the requested entity is in
- final EdmEntitySet edmEntitySet = getEdmEntitySet(uriInfo.asUriInfoResource());
- // Next we fetch the requested entity from the database
- final Entity entity;
- try {
- entity = readEntityInternal(uriInfo.asUriInfoResource(), edmEntitySet);
- } catch (DataProviderException e) {
- throw new ODataApplicationException(e.getMessage(), 500, Locale.ENGLISH);
- }
- if (entity == null) {
- // If no entity was found for the given key we throw an exception.
- throw new ODataApplicationException("No entity found for this key", HttpStatusCode.NOT_FOUND
- .getStatusCode(), Locale.ENGLISH);
- } else {
- // Next we get the property value from the entity and pass the value to serialization
- UriResourceProperty uriProperty = (UriResourceProperty) uriInfo
- .getUriResourceParts().get(uriInfo.getUriResourceParts().size() - 1);
- EdmProperty edmProperty = uriProperty.getProperty();
- Property property = entity.getProperty(edmProperty.getName());
- if (property == null) {
- throw new ODataApplicationException("No property found", HttpStatusCode.NOT_FOUND
- .getStatusCode(), Locale.ENGLISH);
- } else {
- if (property.getValue() == null) {
- response.setStatusCode(HttpStatusCode.NO_CONTENT.getStatusCode());
- } else {
- String value = String.valueOf(property.getValue());
- ByteArrayInputStream serializerContent = new ByteArrayInputStream(
- value.getBytes(Charset.forName("UTF-8")));
- response.setContent(serializerContent);
- response.setStatusCode(HttpStatusCode.OK.getStatusCode());
- response.setHeader(HttpHeader.CONTENT_TYPE, HttpContentType.TEXT_PLAIN);
- }
- }
- }
- }
-
- private void readProperty(ODataResponse response, UriInfo uriInfo, ContentType contentType,
- boolean complex) throws ODataApplicationException, SerializerException {
- // To read a property we have to first get the entity out of the entity set
- final EdmEntitySet edmEntitySet = getEdmEntitySet(uriInfo.asUriInfoResource());
- Entity entity;
- try {
- entity = readEntityInternal(uriInfo.asUriInfoResource(), edmEntitySet);
- } catch (DataProviderException e) {
- throw new ODataApplicationException(e.getMessage(),
- HttpStatusCode.INTERNAL_SERVER_ERROR.getStatusCode(), Locale.ENGLISH);
- }
-
- if (entity == null) {
- // If no entity was found for the given key we throw an exception.
- throw new ODataApplicationException("No entity found for this key",
- HttpStatusCode.NOT_FOUND.getStatusCode(), Locale.ENGLISH);
- } else {
- // Next we get the property value from the entity and pass the value to serialization
- UriResourceProperty uriProperty = (UriResourceProperty) uriInfo
- .getUriResourceParts().get(uriInfo.getUriResourceParts().size() - 1);
- EdmProperty edmProperty = uriProperty.getProperty();
- Property property = entity.getProperty(edmProperty.getName());
- if (property == null) {
- throw new ODataApplicationException("No property found",
- HttpStatusCode.NOT_FOUND.getStatusCode(), Locale.ENGLISH);
- } else {
- if (property.getValue() == null) {
- response.setStatusCode(HttpStatusCode.NO_CONTENT.getStatusCode());
- } else {
- final ODataFormat format = ODataFormat.fromContentType(contentType);
- ODataSerializer serializer = odata.createSerializer(format);
- final ContextURL contextURL = format == ODataFormat.JSON_NO_METADATA ? null :
- getContextUrl(edmEntitySet, true, null, null, edmProperty.getName());
- InputStream serializerContent = complex ?
- serializer.complex((EdmComplexType) edmProperty.getType(), property,
- ComplexSerializerOptions.with().contextURL(contextURL).build()) :
- serializer.primitive((EdmPrimitiveType) edmProperty.getType(), property,
- PrimitiveSerializerOptions.with()
- .contextURL(contextURL)
- .scale(edmProperty.getScale())
- .nullable(edmProperty.isNullable())
- .precision(edmProperty.getPrecision())
- .maxLength(edmProperty.getMaxLength())
- .unicode(edmProperty.isUnicode()).build());
- response.setContent(serializerContent);
- response.setStatusCode(HttpStatusCode.OK.getStatusCode());
- response.setHeader(HttpHeader.CONTENT_TYPE, contentType.toContentTypeString());
- }
- }
- }
- }
-
- private Entity readEntityInternal(final UriInfoResource uriInfo, final EdmEntitySet entitySet)
- throws DataProvider.DataProviderException {
- // This method will extract the key values and pass them to the data provider
- final UriResourceEntitySet resourceEntitySet = (UriResourceEntitySet) uriInfo.getUriResourceParts().get(0);
- return dataProvider.read(entitySet, resourceEntitySet.getKeyPredicates());
- }
-
- private EdmEntitySet getEdmEntitySet(final UriInfoResource uriInfo) throws ODataApplicationException {
- final List<UriResource> resourcePaths = uriInfo.getUriResourceParts();
- /*
- * To get the entity set we have to interpret all URI segments
- */
- if (!(resourcePaths.get(0) instanceof UriResourceEntitySet)) {
- throw new ODataApplicationException("Invalid resource type for first segment.",
- HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ENGLISH);
- }
-
- /*
- * Here we should interpret the whole URI but in this example we do not support navigation so we throw an exception
- */
-
- final UriResourceEntitySet uriResource = (UriResourceEntitySet) resourcePaths.get(0);
- return uriResource.getEntitySet();
- }
-
- private ContextURL getContextUrl(final EdmEntitySet entitySet, final boolean isSingleEntity,
- final ExpandOption expand, final SelectOption select, final String navOrPropertyPath)
- throws SerializerException {
-
- return ContextURL.with().entitySet(entitySet)
- .selectList(odata.createUriHelper().buildContextURLSelectList(entitySet.getEntityType(), expand, select))
- .suffix(isSingleEntity ? Suffix.ENTITY : null)
- .navOrPropertyPath(navOrPropertyPath)
- .build();
- }
-
- @Override
- public void updatePrimitive(final ODataRequest request, final ODataResponse response,
- final UriInfo uriInfo, final ContentType requestFormat,
- final ContentType responseFormat)
- throws ODataApplicationException, DeserializerException, SerializerException {
- throw new ODataApplicationException("Primitive property update is not supported yet.",
- HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ENGLISH);
- }
-
- @Override
- public void deletePrimitive(ODataRequest request, ODataResponse response, UriInfo uriInfo) throws
- ODataApplicationException {
- throw new ODataApplicationException("Primitive property delete is not supported yet.",
- HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ENGLISH);
- }
-
- @Override
- public void updateComplex(final ODataRequest request, final ODataResponse response,
- final UriInfo uriInfo, final ContentType requestFormat,
- final ContentType responseFormat)
- throws ODataApplicationException, DeserializerException, SerializerException {
- throw new ODataApplicationException("Complex property update is not supported yet.",
- HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ENGLISH);
- }
-
- @Override
- public void deleteComplex(final ODataRequest request, final ODataResponse response, final UriInfo uriInfo)
- throws ODataApplicationException {
- throw new ODataApplicationException("Complex property delete is not supported yet.",
- HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ENGLISH);
- }
-
- @Override
- public void updateEntity(final ODataRequest request, final ODataResponse response,
- final UriInfo uriInfo, final ContentType requestFormat,
- final ContentType responseFormat)
- throws ODataApplicationException, DeserializerException, SerializerException {
- throw new ODataApplicationException("Entity update is not supported yet.",
- HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ENGLISH);
- }
-}
\ No newline at end of file
diff --git a/samples/server/src/main/resources/META-INF/LICENSE b/samples/server/src/main/resources/META-INF/LICENSE
deleted file mode 100644
index 715ff30..0000000
--- a/samples/server/src/main/resources/META-INF/LICENSE
+++ /dev/null
@@ -1,331 +0,0 @@
-Licenses for TecSvc artifact
-
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
-TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
-1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
-2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
-3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
-4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
-5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
-6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
-7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
-8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
-9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
-END OF TERMS AND CONDITIONS
-
-APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
-Copyright [yyyy] [name of copyright owner]
-
-Licensed 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.
-
-
-From: 'abego Software GmbH, Germany' (http://abego-software.de) - abego
-TreeLayout Core (http://code.google.com/p/treelayout/)
-org.abego.treelayout:org.abego.treelayout.core:jar:1.0.1 License: BSD 3-Clause
-"New" or "Revised" License (BSD-3-Clause)
-(http://treelayout.googlecode.com/files/LICENSE.TXT)
-
-[The "BSD license"]
-Copyright (c) 2011, abego Software GmbH, Germany (http://www.abego.org)
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
-1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-3. Neither the name of the abego Software GmbH nor the names of its
- contributors may be used to endorse or promote products derived from this
- software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGE.
-
-
-From: 'ANTLR' (http://www.antlr.org) - ANTLR 4 Runtime
-(http://www.antlr.org/antlr4-runtime) org.antlr:antlr4-runtime:jar:4.1 License:
-The BSD License (http://www.antlr.org/license.html)
-
-[The BSD License]
-Copyright (c) 2012 Terence Parr and Sam Harwell
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- Redistributions of source code must retain the above copyright notice, this
- list of conditions and the following disclaimer. Redistributions in binary
- form must reproduce the above copyright notice, this list of conditions and
- the following disclaimer in the documentation and/or other materials
- provided with the distribution. Neither the name of the author nor the
- names of its contributors may be used to endorse or promote products
- derived from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
-ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-
-From: 'fasterxml.com' (http://fasterxml.com) - Stax2 API
-(http://wiki.fasterxml.com/WoodstoxStax2)
-org.codehaus.woodstox:stax2-api:bundle:3.1.4 License: The BSD License
-(http://www.opensource.org/licenses/bsd-license.php)
-
-Copyright (c) 2004-2010, Woodstox Project (http://woodstox.codehaus.org/)
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
-1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-3. Neither the name of the Woodstox XML Processor nor the names
- of its contributors may be used to endorse or promote products derived
- from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGE.
-
-
-From: 'QOS.ch' (http://www.qos.ch)
- - SLF4J API Module (http://www.slf4j.org) org.slf4j:slf4j-api:jar:1.7.7
- License: MIT License (http://www.opensource.org/licenses/mit-license.php)
- - SLF4J Simple Binding (http://www.slf4j.org) org.slf4j:slf4j-simple:jar:1.7.7
- License: MIT License (http://www.opensource.org/licenses/mit-license.php)
-
-
-Copyright (c) 2004-2013 QOS.ch
-
-All rights reserved. Permission is hereby granted, free of charge, to any
-person obtaining a copy of this software and associated documentation files
-(the "Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish, distribute,
-sublicense, and/or sell copies of the Software, and to permit persons to whom
-the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
diff --git a/samples/server/src/main/resources/simplelogger.properties b/samples/server/src/main/resources/simplelogger.properties
deleted file mode 100644
index 2a3350c..0000000
--- a/samples/server/src/main/resources/simplelogger.properties
+++ /dev/null
@@ -1,20 +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.
-#
-org.slf4j.simpleLogger.defaultLogLevel=debug
-org.slf4j.simpleLogger.logFile=System.out
\ No newline at end of file
diff --git a/samples/server/src/main/version/version.html b/samples/server/src/main/version/version.html
deleted file mode 100644
index 7bc2ddd..0000000
--- a/samples/server/src/main/version/version.html
+++ /dev/null
@@ -1,37 +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.
--->
-
-<table>
- <thead>
- <tr><th colspan=2>Version Information</th></tr>
- </thead>
-
- <tfoot>
- <tr>
- <td>Home</td>
- <td><a href="http://olingo.apache.org/" target="self">Apache Olingo</a></td>
- </tr>
- </tfoot>
-
- <tbody>
- <tr><td>name</td><td>${name}</td></tr>
- <tr><td>version</td><td>${version}</td></tr>
- <tr><td>timestamp</td><td>${timestamp}</td></tr>
- </tbody>
-</table>
diff --git a/samples/server/src/main/webapp/WEB-INF/web.xml b/samples/server/src/main/webapp/WEB-INF/web.xml
deleted file mode 100644
index 2a26367..0000000
--- a/samples/server/src/main/webapp/WEB-INF/web.xml
+++ /dev/null
@@ -1,42 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
--->
-<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
- xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
- id="WebApp_ID" version="2.5">
-
- <display-name>Apache Olingo OData 4.0 Sample Service</display-name>
-
- <welcome-file-list>
- <welcome-file>index.jsp</welcome-file>
- </welcome-file-list>
-
- <servlet>
- <servlet-name>CarsServlet</servlet-name>
- <servlet-class>org.apache.olingo.server.sample.CarsServlet</servlet-class>
- <load-on-startup>1</load-on-startup>
- </servlet>
-
- <servlet-mapping>
- <servlet-name>CarsServlet</servlet-name>
- <url-pattern>/cars.svc/*</url-pattern>
- </servlet-mapping>
-
-</web-app>
diff --git a/samples/server/src/main/webapp/css/olingo.css b/samples/server/src/main/webapp/css/olingo.css
deleted file mode 100644
index 5b9deec..0000000
--- a/samples/server/src/main/webapp/css/olingo.css
+++ /dev/null
@@ -1,91 +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.
-*/
-body {
- font-family: Arial, sans-serif;
- font-size: 13px;
- line-height: 18px;
- color: #8904B1;
- background-color: #ffffff;
-}
-
-a {
- color: #8904B1;
-}
-
-a:VISITED {
- color: #D358F7;
-}
-
-td {
- padding: 5px;
-}
-
-h1,h2,h3,h4,h5,h6 {
- font-family: inherit;
- font-weight: bold;
- line-height: 1;
- color: #8904B1;
-}
-
-h1 {
- font-size: 36px;
- line-height: 40px;
-}
-
-h2 {
- font-size: 30px;
- line-height: 40px;
-}
-
-h3 {
- font-size: 24px;
- line-height: 40px;
-}
-
-h4 {
- font-size: 18px;
- line-height: 20px;
-}
-
-h5 {
- font-size: 14px;
- line-height: 20px;
-}
-
-h6 {
- font-size: 12px;
- line-height: 20px;
-}
-
-.logo {
- float: right;
-}
-
-hr, thead, tfoot {
- margin: 9px 0;
- border-top: 1px solid #8904B1;
- border-bottom: 1px solid #8904B1;
-}
-
-table { border-collapse: collapse; border: 1px solid #8904B1; }
-
-.version {
- font-family: "Courier New", monospace;
- font-size: 10px;
-}
\ No newline at end of file
diff --git a/samples/server/src/main/webapp/img/OlingoOrangeTM.png b/samples/server/src/main/webapp/img/OlingoOrangeTM.png
deleted file mode 100644
index 4878e8a..0000000
--- a/samples/server/src/main/webapp/img/OlingoOrangeTM.png
+++ /dev/null
Binary files differ
diff --git a/samples/server/src/main/webapp/index.jsp b/samples/server/src/main/webapp/index.jsp
deleted file mode 100644
index 2940a76..0000000
--- a/samples/server/src/main/webapp/index.jsp
+++ /dev/null
@@ -1,56 +0,0 @@
-<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
-
-<!--
- 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.
--->
-
-<!DOCTYPE html>
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
- <title>Apache Olingo - OData 4.0</title>
- <link type="text/css" rel="stylesheet" href="css/olingo.css">
-</head>
-
-<body>
- <div class="logo">
- <img height="40" src="img/OlingoOrangeTM.png" />
- </div>
- <h1>Olingo OData 4.0</h1>
- <hr>
- <h2>Cars Sample Service</h2>
- <ul>
- <li><a href="cars.svc/">Service Document</a></li>
- <li><a href="cars.svc/$metadata">Metadata</a></li>
- <li>Entity Set: <a href="cars.svc/Cars">Cars</a></li>
- <li>Entity: <a href="cars.svc/Cars(1)">Cars(1)</a></li>
- <li>Primitive Property: <a href="cars.svc/Cars(1)/Price">Cars(1)/Price</a></li>
- </ul>
- <hr>
- <div class="version">
- <% String version = "gen/version.html";
- try {
- %>
- <jsp:include page='<%=version%>' />
- <%} catch (Exception e) {
- %>
- <p>IDE Build</p>
- <%}%>
- </div>
-</body>
-</html>