You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by sk...@apache.org on 2014/05/09 14:28:57 UTC
[09/15] [OLINGO-266] refactor ref module to server-ref
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/8ca9b3c6/lib/ref/src/test/java/org/apache/olingo/server/core/uri/testutil/UriLexerWithTrace.java
----------------------------------------------------------------------
diff --git a/lib/ref/src/test/java/org/apache/olingo/server/core/uri/testutil/UriLexerWithTrace.java b/lib/ref/src/test/java/org/apache/olingo/server/core/uri/testutil/UriLexerWithTrace.java
deleted file mode 100644
index 9005080..0000000
--- a/lib/ref/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;
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/8ca9b3c6/lib/ref/src/test/java/org/apache/olingo/server/core/uri/validator/UriValidatorTest.java
----------------------------------------------------------------------
diff --git a/lib/ref/src/test/java/org/apache/olingo/server/core/uri/validator/UriValidatorTest.java b/lib/ref/src/test/java/org/apache/olingo/server/core/uri/validator/UriValidatorTest.java
deleted file mode 100644
index 0374b25..0000000
--- a/lib/ref/src/test/java/org/apache/olingo/server/core/uri/validator/UriValidatorTest.java
+++ /dev/null
@@ -1,378 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * 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 static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import java.util.ArrayList;
-
-import org.apache.olingo.commons.api.edm.Edm;
-import org.apache.olingo.server.api.uri.UriInfo;
-import org.apache.olingo.server.core.edm.provider.EdmProviderImpl;
-import org.apache.olingo.server.core.testutil.techprovider.EdmTechProvider;
-import org.apache.olingo.server.core.uri.parser.Parser;
-import org.apache.olingo.server.core.uri.parser.UriParserException;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
-
-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)/PropertyComplex";
- private static final String URI_PROPERTY_COMPLEX_COLLECTION =
- "/ESCompCollComp(1)/PropertyComplex/CollPropertyComplex";
- private static final String URI_PROPERTY_COMPLEX_COLLECTION_COUNT =
- "/ESCompCollComp(1)/PropertyComplex/CollPropertyComplex/$count";
- private static final String URI_PROPERTY_PRIMITIVE = "/ESAllPrim(1)/PropertyString";
- private static final String URI_PROPERTY_PRIMITIVE_COLLECTION = "/ESCollAllPrim/CollPropertyString";
- private static final String URI_PROPERTY_PRIMITIVE_COLLECTION_COUNT =
- "/ESCollAllPrim/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/NavPropertyETKeyNavOne";
- private static final String URI_NAV_ENTITY_SET = "/ESKeyNav/NavPropertyETKeyNavMany";
-
- private static final String QO_FILTER = "$filter='1' eq '1'";
- private static final String QO_FORMAT = "$format=bla";
- private static final String QO_EXPAND = "$expand=*";
- private static final String QO_ID = "$id=Products(0)";
- private static final String QO_COUNT = "$count";
- 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/com.sap.odata.test1.BAESTwoKeyNavRTESTwoKeyNav" },
- { "ESAllPrim/com.sap.odata.test1.BAESAllPrimRTETAllPrim" },
- { "AIRTPrimCollParam" },
- { "AIRTETParam" },
- { "AIRTPrimParam" },
-
- };
-
- 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 Parser parser;
- private Edm edm;
-
- @Before
- public void before() {
- parser = new Parser();
- edm = new EdmProviderImpl(new EdmTechProvider());
- }
-
- @Test
- public void validateSelect() throws Exception {
- String[] uris = { "/ESAllPrim(1)?$select=PropertyString" };
- for (String uri : uris) {
- parseAndValidate(uri, "GET");
- }
- }
-
- @Test(expected = UriValidationException.class)
- public void validateForHttpMethodsFail() throws Exception {
- String uri = URI_ENTITY;
- parseAndValidate(uri, "xyz");
- }
-
- @Test
- public void validateForHttpMethods() throws Exception {
- String uri = URI_ENTITY;
- parseAndValidate(uri, "GET");
- parseAndValidate(uri, "POST");
- parseAndValidate(uri, "PUT");
- parseAndValidate(uri, "DELETE");
- parseAndValidate(uri, "PATCH");
- parseAndValidate(uri, "MERGE");
- }
-
- @Test
- public void validateOrderBy() throws Exception {
- String[] uris = { "/ESAllPrim?$orderby=PropertyString" };
- for (String uri : uris) {
- parseAndValidate(uri, "GET");
- }
- }
-
- @Test(expected = UriValidationException.class)
- @Ignore("uri parser doen't support orderby yet")
- public void validateOrderByInvalid() throws Exception {
- String uri = "/ESAllPrim(1)?$orderBy=XXXX";
- parseAndValidate(uri, "GET");
- }
-
- @Test(expected = UriValidationException.class)
- public void validateKeyPredicatesWrongKey() throws Exception {
- String uri = "ESTwoKeyNav(xxx=1, yyy='abc')";
- parseAndValidate(uri, "GET");
- }
-
- @Test
- public void validateKeyPredicates() throws Exception {
- String uri = "ESTwoKeyNav(PropertyInt16=1, PropertyString='abc')";
- parseAndValidate(uri, "GET");
- }
-
- @Test(expected = UriValidationException.class)
- public void validateKeyPredicatesWrongValueType() throws Exception {
- String uri = "ESTwoKeyNav(PropertyInt16='abc', PropertyString=1)";
- parseAndValidate(uri, "GET");
- }
-
- @Test
- public void checkValidSystemQueryOption() throws Exception {
- String[] uris = constructUri(urisWithValidSystemQueryOptions);
-
- for (String uri : uris) {
- try {
- parseAndValidate(uri, "GET");
- } catch (Exception e) {
- throw new Exception("Faild for uri: " + uri, e);
- }
- }
- }
-
- @Test
- public void checkNonValidSystemQueryOption() throws Exception {
- String[] uris = constructUri(urisWithNonValidSystemQueryOptions);
-
- for (String uri : uris) {
- try {
- parseAndValidate(uri, "GET");
- fail("Validation Exception not thrown: " + uri);
- } catch (UriValidationException e) {
- assertTrue(e instanceof UriValidationException);
- }
- }
- }
-
- private String[] constructUri(final String[][] uriParameterMatrix) {
- ArrayList<String> uris = new ArrayList<String>();
- for (String[] uriParameter : uriParameterMatrix) {
- String uri = uriParameter[0];
- if (uriParameter.length > 1) {
- uri += "?";
- }
- for (int i = 1; i < uriParameter.length; i++) {
- uri += uriParameter[i];
- if (i < (uriParameter.length - 1)) {
- uri += "&";
- }
- }
- uris.add(uri);
- }
- return uris.toArray(new String[0]);
- }
-
- private void parseAndValidate(final String uri, String method) throws UriParserException, UriValidationException {
- UriInfo uriInfo = parser.parseUri(uri.trim(), edm);
- UriValidator validator = new UriValidator();
-
- validator.validate(uriInfo, method);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/8ca9b3c6/lib/server-ref/pom.xml
----------------------------------------------------------------------
diff --git a/lib/server-ref/pom.xml b/lib/server-ref/pom.xml
new file mode 100644
index 0000000..fc5cf4e
--- /dev/null
+++ b/lib/server-ref/pom.xml
@@ -0,0 +1,67 @@
+<?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>olingo-server-ref</artifactId>
+ <packaging>war</packaging>
+ <name>${project.artifactId}</name>
+
+ <parent>
+ <groupId>org.apache.olingo</groupId>
+ <artifactId>olingo-lib</artifactId>
+ <version>0.1.0-SNAPSHOT</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>olingo-server-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.olingo</groupId>
+ <artifactId>olingo-server-core</artifactId>
+ <version>${project.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-all</artifactId>
+ </dependency>
+ </dependencies>
+
+</project>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/8ca9b3c6/lib/server-ref/src/main/java/org/apache/olingo/ref/ReferenceServlet.java
----------------------------------------------------------------------
diff --git a/lib/server-ref/src/main/java/org/apache/olingo/ref/ReferenceServlet.java b/lib/server-ref/src/main/java/org/apache/olingo/ref/ReferenceServlet.java
new file mode 100644
index 0000000..a3d30ee
--- /dev/null
+++ b/lib/server-ref/src/main/java/org/apache/olingo/ref/ReferenceServlet.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.ref;
+
+import java.io.IOException;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.olingo.server.api.ODataServer;
+
+public class ReferenceServlet extends HttpServlet {
+
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
+
+ ODataServer server = ODataServer.newInstance();
+ server.handle(req, resp);
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/8ca9b3c6/lib/server-ref/src/main/java/org/apache/olingo/server/core/testutil/EdmTechTestProvider.java
----------------------------------------------------------------------
diff --git a/lib/server-ref/src/main/java/org/apache/olingo/server/core/testutil/EdmTechTestProvider.java b/lib/server-ref/src/main/java/org/apache/olingo/server/core/testutil/EdmTechTestProvider.java
new file mode 100644
index 0000000..bee5f90
--- /dev/null
+++ b/lib/server-ref/src/main/java/org/apache/olingo/server/core/testutil/EdmTechTestProvider.java
@@ -0,0 +1,100 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.server.core.testutil;
+
+import java.util.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.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.core.testutil.techprovider.EdmTechProvider;
+
+/**
+ * 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 = "com.sap.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);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/8ca9b3c6/lib/server-ref/src/main/java/org/apache/olingo/server/core/testutil/StringUtils.java
----------------------------------------------------------------------
diff --git a/lib/server-ref/src/main/java/org/apache/olingo/server/core/testutil/StringUtils.java b/lib/server-ref/src/main/java/org/apache/olingo/server/core/testutil/StringUtils.java
new file mode 100644
index 0000000..8cabcf1
--- /dev/null
+++ b/lib/server-ref/src/main/java/org/apache/olingo/server/core/testutil/StringUtils.java
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.server.core.testutil;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.nio.charset.Charset;
+
+public class StringUtils {
+
+ public static String inputStreamToString(final InputStream in, final boolean preserveLineBreaks) {
+ try {
+ final BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(in, Charset.forName("UTF-8")));
+ final StringBuilder stringBuilder = new StringBuilder();
+ String line = null;
+
+ while ((line = bufferedReader.readLine()) != null) {
+ stringBuilder.append(line);
+ if (preserveLineBreaks) {
+ stringBuilder.append("\n");
+ }
+ }
+
+ bufferedReader.close();
+
+ final String result = stringBuilder.toString();
+
+ return result;
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/8ca9b3c6/lib/server-ref/src/main/java/org/apache/olingo/server/core/testutil/techprovider/ActionProvider.java
----------------------------------------------------------------------
diff --git a/lib/server-ref/src/main/java/org/apache/olingo/server/core/testutil/techprovider/ActionProvider.java b/lib/server-ref/src/main/java/org/apache/olingo/server/core/testutil/techprovider/ActionProvider.java
new file mode 100644
index 0000000..f1748a7
--- /dev/null
+++ b/lib/server-ref/src/main/java/org/apache/olingo/server/core/testutil/techprovider/ActionProvider.java
@@ -0,0 +1,191 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.server.core.testutil.techprovider;
+
+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 nameUARTCompCollParam = new FullQualifiedName(SchemaProvider.nameSpace,
+ "UARTCompCollParam");
+ public static final FullQualifiedName nameUARTCompParam = new FullQualifiedName(SchemaProvider.nameSpace,
+ "UARTCompParam");
+ public static final FullQualifiedName nameUARTESParam =
+ new FullQualifiedName(SchemaProvider.nameSpace, "UARTESParam");
+
+ public static final FullQualifiedName nameUARTETParam =
+ new FullQualifiedName(SchemaProvider.nameSpace, "UARTETParam");
+
+ public static final FullQualifiedName nameUARTPrimParam = new FullQualifiedName(SchemaProvider.nameSpace,
+ "UARTPrimParam");
+ public static final FullQualifiedName nameUARTPrimCollParam = new FullQualifiedName(SchemaProvider.nameSpace,
+ "UARTPrimCollParam");
+
+ 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(PropertyProvider.nameInt16)))
+
+ .setReturnType(new ReturnType().setType(PropertyProvider.nameString))
+ );
+
+ } else if (actionName.equals(nameUARTPrimCollParam)) {
+ return Arrays.asList(
+ new Action().setName("UARTPrimCollParam")
+ .setParameters(Arrays.asList(
+ new Parameter().setName("ParameterInt16").setType(PropertyProvider.nameInt16)))
+
+ .setReturnType(
+ new ReturnType().setType(PropertyProvider.nameString).setCollection(true))
+ );
+
+ } else if (actionName.equals(nameUARTCompParam)) {
+ return Arrays.asList(
+ new Action().setName("UARTCompParam")
+ .setParameters(Arrays.asList(
+ new Parameter().setName("ParameterInt16").setType(PropertyProvider.nameInt16)))
+
+ .setReturnType(
+ new ReturnType().setType(ComplexTypeProvider.nameCTTwoPrim))
+ );
+
+ } else if (actionName.equals(nameUARTCompCollParam)) {
+ return Arrays.asList(
+ new Action().setName("UARTCompCollParam")
+ .setParameters(Arrays.asList(
+ new Parameter().setName("ParameterInt16").setType(PropertyProvider.nameInt16)))
+
+ .setReturnType(
+ new ReturnType().setType(ComplexTypeProvider.nameCTTwoPrim).setCollection(true))
+ );
+
+ } else if (actionName.equals(nameUARTETParam)) {
+ return Arrays.asList(
+ new Action().setName("UARTETParam")
+ .setParameters(Arrays.asList(
+ new Parameter().setName("ParameterInt16").setType(PropertyProvider.nameInt16)))
+ .setReturnType(
+ new ReturnType().setType(EntityTypeProvider.nameETTwoKeyTwoPrim))
+ );
+
+ } else if (actionName.equals(nameUARTESParam)) {
+ return Arrays.asList(
+ new Action().setName("UARTESParam")
+ .setParameters(Arrays.asList(
+ new Parameter().setName("ParameterInt16").setType(PropertyProvider.nameInt16)))
+ .setReturnType(
+ new ReturnType().setType(EntityTypeProvider.nameETKeyNav).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;
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/8ca9b3c6/lib/server-ref/src/main/java/org/apache/olingo/server/core/testutil/techprovider/ComplexTypeProvider.java
----------------------------------------------------------------------
diff --git a/lib/server-ref/src/main/java/org/apache/olingo/server/core/testutil/techprovider/ComplexTypeProvider.java b/lib/server-ref/src/main/java/org/apache/olingo/server/core/testutil/techprovider/ComplexTypeProvider.java
new file mode 100644
index 0000000..2db6d0e
--- /dev/null
+++ b/lib/server-ref/src/main/java/org/apache/olingo/server/core/testutil/techprovider/ComplexTypeProvider.java
@@ -0,0 +1,175 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.server.core.testutil.techprovider;
+
+import java.util.Arrays;
+
+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;
+
+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 nameCTPrimEnum = new FullQualifiedName(SchemaProvider.nameSpace, "CTPrimEnum");
+ 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 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, PropertyProvider.propertyString));
+
+ } else if (complexTypeName.equals(nameCTCompNav)) {
+ return new ComplexType()
+ .setName("CTCompNav")
+ .setProperties(Arrays.asList(PropertyProvider.propertyString,
+ PropertyProvider.propertyComplex_CTNavFiveProp));
+
+ } else if (complexTypeName.equals(nameCTMixPrimCollComp)) {
+ return new ComplexType()
+ .setName("CTMixPrimCollComp")
+ .setProperties(
+ Arrays.asList(PropertyProvider.propertyInt16, PropertyProvider.collPropertyString,
+ PropertyProvider.propertyComplex_CTTwoPrim, PropertyProvider.collPropertyComplex_CTTwoPrim));
+
+ } else if (complexTypeName.equals(nameCTBase)) {
+ return new ComplexType()
+ .setName("CTBase")
+ .setBaseType(nameCTTwoPrim)
+ .setProperties(Arrays.asList(
+ new Property()
+ .setName("AdditionalPropString")
+ .setType(new FullQualifiedName("Edm", "String"))));
+
+ } else if (complexTypeName.equals(nameCTTwoBase)) {
+ return new ComplexType()
+ .setName("CTTwoBase")
+ .setBaseType(nameCTBase);
+
+ } else if (complexTypeName.equals(nameCTCompComp)) {
+ return new ComplexType()
+ .setName("CTCompComp")
+ .setProperties(Arrays.asList(PropertyProvider.propertyComplex_CTTwoPrim));
+
+ } else if (complexTypeName.equals(nameCTCompCollComp)) {
+ return new ComplexType()
+ .setName("CTCompCollComp")
+ .setProperties(Arrays.asList(PropertyProvider.collPropertyComplex_CTTwoPrim));
+
+ } else if (complexTypeName.equals(nameCTPrimComp)) {
+ return new ComplexType()
+ .setName("CTPrimComp")
+ .setProperties(Arrays.asList(PropertyProvider.propertyInt16, PropertyProvider.propertyComplex_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(nameCTPrimEnum)) {
+ return new ComplexType()
+ .setName("CTPrimEnum")
+ .setProperties(Arrays.asList(PropertyProvider.propertyInt16, PropertyProvider.propertyEnumString_ENString));
+
+ } else if (complexTypeName.equals(nameCTTwoBasePrimCompNav)) {
+ return new ComplexType()
+ .setName("CTTwoBasePrimCompNav")
+ .setBaseType(nameCTBasePrimCompNav);
+
+ }
+
+ return null;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/8ca9b3c6/lib/server-ref/src/main/java/org/apache/olingo/server/core/testutil/techprovider/ContainerProvider.java
----------------------------------------------------------------------
diff --git a/lib/server-ref/src/main/java/org/apache/olingo/server/core/testutil/techprovider/ContainerProvider.java b/lib/server-ref/src/main/java/org/apache/olingo/server/core/testutil/techprovider/ContainerProvider.java
new file mode 100644
index 0000000..5b92317
--- /dev/null
+++ b/lib/server-ref/src/main/java/org/apache/olingo/server/core/testutil/techprovider/ContainerProvider.java
@@ -0,0 +1,361 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.server.core.testutil.techprovider;
+
+import java.util.Arrays;
+
+import org.apache.olingo.commons.api.ODataException;
+import org.apache.olingo.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.commons.api.edm.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;
+
+public class ContainerProvider {
+
+ public static final FullQualifiedName nameContainer = new FullQualifiedName(SchemaProvider.nameSpace, "Container");
+
+ EntityContainerInfo entityContainerInfoTest1 =
+ new EntityContainerInfo().setContainerName(nameContainer);
+
+ 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 {
+ return null;
+ }
+
+ 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);
+ }
+ }
+
+ return null;
+ }
+
+ public ActionImport getActionImport(final FullQualifiedName entityContainer, final String name) throws ODataException
+ {
+ if (entityContainer.equals(nameContainer)) {
+ if (name.equals("AIRTPrimParam")) {
+ return new ActionImport()
+ .setName("AIRTPrimParam")
+ .setAction(ActionProvider.nameUARTPrimParam);
+
+ } else if (name.equals("AIRTPrimCollParam")) {
+ return new ActionImport()
+ .setName("AIRTPrimCollParam")
+ .setAction(ActionProvider.nameUARTPrimCollParam);
+
+ } else if (name.equals("AIRTCompParam")) {
+ return new ActionImport()
+ .setName("AIRTCompParam")
+ .setAction(ActionProvider.nameUARTCompParam);
+
+ } else if (name.equals("AIRTCompCollParam")) {
+ return new ActionImport()
+ .setName("AIRTCompCollParam")
+ .setAction(ActionProvider.nameUARTCompCollParam);
+
+ } else if (name.equals("AIRTETParam")) {
+ return new ActionImport()
+ .setName("AIRTETParam")
+ .setAction(ActionProvider.nameUARTETParam);
+
+ } else if (name.equals("AIRTETCollAllPrimParam")) {
+ return new ActionImport()
+ .setName("AIRTETCollAllPrimParam")
+ .setAction(ActionProvider.nameUARTESParam);
+ }
+ }
+
+ 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;
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/8ca9b3c6/lib/server-ref/src/main/java/org/apache/olingo/server/core/testutil/techprovider/EdmTechProvider.java
----------------------------------------------------------------------
diff --git a/lib/server-ref/src/main/java/org/apache/olingo/server/core/testutil/techprovider/EdmTechProvider.java b/lib/server-ref/src/main/java/org/apache/olingo/server/core/testutil/techprovider/EdmTechProvider.java
new file mode 100644
index 0000000..93e9c9d
--- /dev/null
+++ b/lib/server-ref/src/main/java/org/apache/olingo/server/core/testutil/techprovider/EdmTechProvider.java
@@ -0,0 +1,147 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.server.core.testutil.techprovider;
+
+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.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;
+
+public class EdmTechProvider extends EdmProvider {
+
+ public static final String nameSpace = "com.sap.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;
+
+ public EdmTechProvider() {
+ containerProvider = new ContainerProvider();
+ entityTypeProvider = new EntityTypeProvider();
+ complexTypeProvider = new ComplexTypeProvider();
+ enumTypeProvider = new EnumTypeProvider();
+ actionProvider = new ActionProvider();
+ functionProvider = new FunctionProvider();
+ typeDefinitionProvider = new TypeDefinitionProvider();
+ schemaProvider = new SchemaProvider(this);
+ }
+
+ @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);
+ }
+}