Repository: olingo-odata4 Updated Branches: refs/heads/master f5757cb4e -> d15074496
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/d1507449/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/TestErrorLogger.java ---------------------------------------------------------------------- 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 index 2ab363d..7d6604f 100644 --- 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 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -18,6 +18,10 @@ */ package org.apache.olingo.server.core.uri.testutil; +import java.util.BitSet; +import java.util.Collections; +import java.util.List; + import org.antlr.v4.runtime.ANTLRErrorListener; import org.antlr.v4.runtime.Parser; import org.antlr.v4.runtime.RecognitionException; @@ -26,10 +30,6 @@ 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; @@ -56,21 +56,21 @@ class TestErrorLogger implements ANTLRErrorListener { public void reportAmbiguity(final Parser recognizer, final DFA dfa, final int startIndex, final int stopIndex, final boolean exact, final BitSet ambigAlts, final ATNConfigSet configs) { - //Test + // Test } @Override public void reportAttemptingFullContext(final Parser recognizer, final DFA dfa, final int startIndex, final int stopIndex, final BitSet conflictingAlts, final ATNConfigSet configs) { - //Test + // Test } @Override public void reportContextSensitivity(final Parser recognizer, final DFA dfa, final int startIndex, final int stopIndex, final int prediction, final ATNConfigSet configs) { - //Test + // Test } private void printStack(final Recognizer<?, ?> recognizer) { http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/d1507449/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/TestUriValidator.java ---------------------------------------------------------------------- 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 index 2339cc2..8614380 100644 --- 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 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -106,9 +106,9 @@ public class TestUriValidator implements TestValidator { } return new ResourceValidator() - .setUpValidator(this) - .setEdm(edm) - .setUriInfoImplPath(uriInfo); + .setUpValidator(this) + .setEdm(edm) + .setUriInfoImplPath(uriInfo); } public FilterValidator goFilter() { @@ -136,9 +136,9 @@ public class TestUriValidator implements TestValidator { UriInfoImpl uriInfo1 = (UriInfoImpl) item.getResourcePath(); return new ResourceValidator() - .setUpValidator(this) - .setEdm(edm) - .setUriInfoImplPath(uriInfo1); + .setUpValidator(this) + .setEdm(edm) + .setUriInfoImplPath(uriInfo1); } http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/d1507449/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/TestValidator.java ---------------------------------------------------------------------- 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 index 4de6fdc..f61b292 100644 --- 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 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -19,5 +19,5 @@ package org.apache.olingo.server.core.uri.testutil; public interface TestValidator { -//No additional methods needed for now. + //No additional methods needed for now. } http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/d1507449/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/TokenValidator.java ---------------------------------------------------------------------- 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 index 3bea5c3..596f0d4 100644 --- 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 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -18,13 +18,13 @@ */ 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 static org.junit.Assert.assertEquals; import java.util.List; -import static org.junit.Assert.assertEquals; +import org.antlr.v4.runtime.ANTLRInputStream; +import org.antlr.v4.runtime.Token; +import org.apache.olingo.server.core.uri.antlr.UriLexer; public class TokenValidator { http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/d1507449/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/testutil/UriLexerWithTrace.java ---------------------------------------------------------------------- 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 index 9005080..3d4cb0f 100644 --- 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 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/d1507449/lib/server-test/src/test/java/org/apache/olingo/server/core/uri/validator/UriValidatorTest.java ---------------------------------------------------------------------- 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 index f04d81c..0f81a05 100644 --- 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 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -71,7 +71,7 @@ public class UriValidatorTest { 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_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"; @@ -196,7 +196,7 @@ public class UriValidatorTest { { URI_MEDIA_STREAM, QO_FILTER }, { URI_MEDIA_STREAM, QO_FORMAT }, { 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_SEARCH }, */{ URI_MEDIA_STREAM, QO_SELECT }, { URI_MEDIA_STREAM, QO_SKIP }, { URI_MEDIA_STREAM, QO_SKIPTOKEN }, { URI_MEDIA_STREAM, QO_TOP }, { URI_REFERENCES, QO_EXPAND }, { URI_REFERENCES, QO_COUNT }, @@ -228,7 +228,7 @@ public class UriValidatorTest { { URI_PROPERTY_PRIMITIVE, QO_TOP }, { URI_PROPERTY_PRIMITIVE_COLLECTION, QO_ID }, { URI_PROPERTY_PRIMITIVE_COLLECTION, QO_EXPAND }, - /* { URI_PROPERTY_PRIMITIVE_COLLECTION, QO_SEARCH }, */ { URI_PROPERTY_PRIMITIVE_COLLECTION, QO_SELECT }, + /* { URI_PROPERTY_PRIMITIVE_COLLECTION, QO_SEARCH }, */{ URI_PROPERTY_PRIMITIVE_COLLECTION, QO_SELECT }, { URI_PROPERTY_PRIMITIVE_COLLECTION_COUNT, QO_FORMAT }, { URI_PROPERTY_PRIMITIVE_COLLECTION_COUNT, QO_ID }, { URI_PROPERTY_PRIMITIVE_COLLECTION_COUNT, QO_EXPAND }, @@ -256,10 +256,10 @@ public class UriValidatorTest { { URI_FI_ENTITY_SET, QO_ID }, { URI_FI_ENTITY, QO_FILTER }, { URI_FI_ENTITY, QO_ID }, { URI_FI_ENTITY, QO_COUNT }, - { URI_FI_ENTITY, QO_ORDERBY }, /* { URI_FI_ENTITY, QO_SEARCH }, */ { URI_FI_ENTITY, QO_SKIP }, + { URI_FI_ENTITY, QO_ORDERBY }, /* { URI_FI_ENTITY, QO_SEARCH }, */{ URI_FI_ENTITY, QO_SKIP }, { URI_FI_ENTITY, QO_SKIPTOKEN }, { URI_FI_ENTITY, QO_TOP }, { URI_FI_ENTITY_SET_KEY, QO_FILTER }, { URI_FI_ENTITY_SET_KEY, QO_ID }, { URI_FI_ENTITY_SET_KEY, QO_COUNT }, - { URI_FI_ENTITY_SET_KEY, QO_ORDERBY }, /* { URI_FI_ENTITY_SET_KEY, QO_SEARCH },*/ + { URI_FI_ENTITY_SET_KEY, QO_ORDERBY }, /* { URI_FI_ENTITY_SET_KEY, QO_SEARCH }, */ { URI_FI_ENTITY_SET_KEY, QO_SKIP }, { URI_FI_ENTITY_SET_KEY, QO_SKIPTOKEN }, { URI_FI_ENTITY_SET_KEY, QO_TOP } }; @@ -289,31 +289,31 @@ public class UriValidatorTest { testUri.run(URI_ENTITY_SET, "$orderby=PropertyString"); testUri.runEx(URI_ENTITY, "$orderby=XXXX") - .isExSemantic(UriParserSemanticException.MessageKeys.EXPRESSION_PROPERTY_NOT_IN_TYPE); + .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); + .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); + .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); + .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); + .isExSyntax(UriParserSyntaxException.MessageKeys.DOUBLE_SYSTEM_QUERY_OPTION); } @Test @@ -323,16 +323,16 @@ public class UriValidatorTest { testUri.run("ESTwoKeyNav(PropertyInt16=1, PropertyString='abc')"); testUri.runEx("ESTwoKeyNav(xxx=1, yyy='abc')") - .isExValidation(UriValidationException.MessageKeys.INVALID_KEY_PROPERTY); + .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); + .isExValidation(UriValidationException.MessageKeys.INVALID_KEY_PROPERTY); testUri.runEx("ESAllPrim(12345678901234567890)") - .isExValidation(UriValidationException.MessageKeys.INVALID_KEY_PROPERTY); + .isExValidation(UriValidationException.MessageKeys.INVALID_KEY_PROPERTY); testUri.runEx("ESTwoKeyNav(PropertyInt16=1,PropertyString=1)") - .isExValidation(UriValidationException.MessageKeys.INVALID_KEY_PROPERTY); + .isExValidation(UriValidationException.MessageKeys.INVALID_KEY_PROPERTY); testUri.runEx("ESTwoKeyNav(PropertyInt16=1,PropertyInt16=1)") - .isExValidation(UriValidationException.MessageKeys.DOUBLE_KEY_PROPERTY); + .isExValidation(UriValidationException.MessageKeys.DOUBLE_KEY_PROPERTY); } @Test @@ -387,7 +387,7 @@ public class UriValidatorTest { 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); + 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);
