You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by ko...@apache.org on 2014/02/06 14:00:16 UTC

git commit: [OLINGO-63] Uri Parser: add Tests for package org.apache.olingo.odata4.producer.core.uri.queryoption.expression

Updated Branches:
  refs/heads/master 03ea6c74e -> f8d92381a


[OLINGO-63] Uri Parser: add Tests for  package org.apache.olingo.odata4.producer.core.uri.queryoption.expression


Project: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/commit/f8d92381
Tree: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/tree/f8d92381
Diff: http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/diff/f8d92381

Branch: refs/heads/master
Commit: f8d92381a10a6df5ce2bd8a61034bea90337fd48
Parents: 03ea6c7
Author: Sven Kobler <sv...@sap.com>
Authored: Thu Feb 6 13:12:15 2014 +0100
Committer: Sven Kobler <sv...@sap.com>
Committed: Thu Feb 6 13:58:09 2014 +0100

----------------------------------------------------------------------
 .../queryoption/expression/AliasExpression.java |  25 ++
 .../uri/queryoption/expression/Enumeration.java |   2 +-
 .../odata4/producer/core/uri/antlr/UriLexer.g4  |   2 -
 .../odata4/producer/core/uri/UriInfoImpl.java   |   5 +-
 .../producer/core/uri/UriParseTreeVisitor.java  |   8 +-
 .../core/uri/UriResourceImplKeyPred.java        |   8 +-
 .../uri/queryoption/AliasQueryOptionImpl.java   |   2 +-
 .../uri/queryoption/expression/AliasImpl.java   |  17 +-
 .../queryoption/expression/EnumerationImpl.java |  16 +-
 .../queryoption/expression/LambdaRefImpl.java   |   1 -
 .../uri/queryoption/expression/MemberImpl.java  |   5 +-
 .../uri/queryoption/expression/UnaryImpl.java   |  58 ++++
 .../expression/UnaryOperatorImpl.java           |  58 ----
 .../producer/core/testutil/EdmTechProvider.java |   2 +-
 .../producer/core/testutil/FilterValidator.java |   2 +-
 .../producer/core/uri/UriInfoImplTest.java      |  23 ++
 .../core/uri/queryoption/QueryOptiontest.java   |  52 ++++
 .../queryoption/expression/ExpressionTest.java  | 271 +++++++++++++++++++
 18 files changed, 470 insertions(+), 87 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/f8d92381/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/AliasExpression.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/AliasExpression.java b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/AliasExpression.java
new file mode 100644
index 0000000..e7f41af
--- /dev/null
+++ b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/AliasExpression.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ ******************************************************************************/
+package org.apache.olingo.odata4.producer.api.uri.queryoption.expression;
+
+public interface AliasExpression  extends Expression {
+
+  public String getParameterName();
+  
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/f8d92381/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/Enumeration.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/Enumeration.java b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/Enumeration.java
index d973130..d870c56 100644
--- a/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/Enumeration.java
+++ b/odata4-lib/odata4-producer-api/src/main/java/org/apache/olingo/odata4/producer/api/uri/queryoption/expression/Enumeration.java
@@ -24,7 +24,7 @@ import org.apache.olingo.odata4.commons.api.edm.EdmEnumType;
 
 public interface Enumeration extends Expression {
 
-  public List<String> getEnumValues();
+  public List<String> getValues();
   public EdmEnumType getType();
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/f8d92381/odata4-lib/odata4-producer-core/src/main/antlr4/org/apache/olingo/odata4/producer/core/uri/antlr/UriLexer.g4
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/antlr4/org/apache/olingo/odata4/producer/core/uri/antlr/UriLexer.g4 b/odata4-lib/odata4-producer-core/src/main/antlr4/org/apache/olingo/odata4/producer/core/uri/antlr/UriLexer.g4
index 519189c..6bdc824 100644
--- a/odata4-lib/odata4-producer-core/src/main/antlr4/org/apache/olingo/odata4/producer/core/uri/antlr/UriLexer.g4
+++ b/odata4-lib/odata4-producer-core/src/main/antlr4/org/apache/olingo/odata4/producer/core/uri/antlr/UriLexer.g4
@@ -320,8 +320,6 @@ FRAGMENT_sqr  : '#'     -> type(FRAGMENT),  popMode;
 EQ_sqr        : '='     -> type(EQ);
 REST          : ~[&#=] ~[&#]*;
 
-
-
 //;==============================================================================
 mode MODE_SYSTEM_QUERY_SEARCH;
 //;==============================================================================

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/f8d92381/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriInfoImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriInfoImpl.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriInfoImpl.java
index 2ffd9bf..88553f4 100644
--- a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriInfoImpl.java
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriInfoImpl.java
@@ -135,9 +135,10 @@ public class UriInfoImpl implements UriInfo {
     return Collections.unmodifiableList(returnList);
   }
 
-  public void addPathInfo(final UriResourcePartImpl uriPathInfo) {
+  public UriInfoImpl addPathInfo(final UriResourcePartImpl uriPathInfo) {
     pathParts.add(uriPathInfo);
     lastResourcePart = uriPathInfo;
+    return this;
   }
 
   @Override
@@ -229,7 +230,7 @@ public class UriInfoImpl implements UriInfo {
     return this;
   }
 
-  protected UriInfoImpl setKind(final UriInfoKind kind) {
+  public UriInfoImpl setKind(final UriInfoKind kind) {
     this.kind = kind;
     return this;
   }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/f8d92381/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriParseTreeVisitor.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriParseTreeVisitor.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriParseTreeVisitor.java
index 3d8d995..25e6cb7 100644
--- a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriParseTreeVisitor.java
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriParseTreeVisitor.java
@@ -190,6 +190,12 @@ import org.apache.olingo.odata4.producer.core.uri.queryoption.expression.TypeLit
  * <li>Parsing the context of $metadata
  * <li>Evaluation of referential constrains for key predicates
  * 
+ * TODO
+ * <li>clean up
+ * <li>Overview testcases
+ * <li>search
+ * <li>percent decoding
+ * 
  */
 public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
   private Edm edm;
@@ -1107,7 +1113,7 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
 
     String[] values = valueString.split(",");
     for (String item : values) {
-      enum1.addEnumValue(item);
+      enum1.addValue(item);
     }
 
     return enum1;

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/f8d92381/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceImplKeyPred.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceImplKeyPred.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceImplKeyPred.java
index 1f95fad..b83523e 100644
--- a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceImplKeyPred.java
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/UriResourceImplKeyPred.java
@@ -65,12 +65,14 @@ public abstract class UriResourceImplKeyPred extends UriResourceImplTyped {
     return this;
   }
 
-  public void setEntryTypeFilter(final EdmType singleTypeFilter) {
-    entryTypeFilter = singleTypeFilter;
+  public UriResourceImplKeyPred setEntryTypeFilter(final EdmType entryTypeFilter) {
+    this.entryTypeFilter = entryTypeFilter;
+    return this;
   }
 
-  public void setCollectionTypeFilter(final EdmType collectionTypeFilter) {
+  public UriResourceImplKeyPred setCollectionTypeFilter(final EdmType collectionTypeFilter) {
     this.collectionTypeFilter = collectionTypeFilter;
+    return this;
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/f8d92381/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/AliasQueryOptionImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/AliasQueryOptionImpl.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/AliasQueryOptionImpl.java
index 9a35ada..d9fdf26 100644
--- a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/AliasQueryOptionImpl.java
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/AliasQueryOptionImpl.java
@@ -34,5 +34,5 @@ public class AliasQueryOptionImpl extends QueryOptionImpl implements AliasQueryO
     this.aliasValue = aliasValue;
     return this;
   }
-
+  
 }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/f8d92381/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/AliasImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/AliasImpl.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/AliasImpl.java
index 30f7a08..11063ed 100644
--- a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/AliasImpl.java
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/AliasImpl.java
@@ -19,20 +19,27 @@
 package org.apache.olingo.odata4.producer.core.uri.queryoption.expression;
 
 import org.apache.olingo.odata4.commons.api.exception.ODataApplicationException;
+import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.AliasExpression;
+import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.BinaryExpression;
 import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.ExceptionVisitExpression;
 import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.ExpressionVisitor;
 
-public class AliasImpl extends ExpressionImpl {
+public class AliasImpl extends ExpressionImpl  implements AliasExpression {
 
-  private String referenceName;
+  private String parameterName;
+  
+  @Override
+  public String getParameterName() {
+    return parameterName;
+  }
 
-  public void setReference(final String referenceName) {
-    this.referenceName = referenceName;
+  public void setParameter(final String ParameterName) {
+    this.parameterName = ParameterName;
   }
 
   @Override
   public <T> T accept(final ExpressionVisitor<T> visitor) throws ExceptionVisitExpression, ODataApplicationException {
-    return visitor.visitAlias(referenceName);
+    return visitor.visitAlias(parameterName);
   }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/f8d92381/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/EnumerationImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/EnumerationImpl.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/EnumerationImpl.java
index 19fabe9..65baa6d 100644
--- a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/EnumerationImpl.java
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/EnumerationImpl.java
@@ -30,15 +30,15 @@ import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.Expressi
 public class EnumerationImpl extends ExpressionImpl implements Enumeration {
 
   private EdmEnumType type;
-  private List<String> enumValues = new ArrayList<String>();
+  private List<String> values = new ArrayList<String>();
 
   @Override
-  public List<String> getEnumValues() {
-    return enumValues;
+  public List<String> getValues() {
+    return values;
   }
 
-  public EnumerationImpl addEnumValue(final String enumValue) {
-    enumValues.add(enumValue);
+  public EnumerationImpl addValue(final String enumValue) {
+    values.add(enumValue);
     return this;
   }
 
@@ -47,14 +47,14 @@ public class EnumerationImpl extends ExpressionImpl implements Enumeration {
     return type;
   }
 
-  public EnumerationImpl setType(final EdmEnumType enumtype) {
-    type = enumtype;
+  public EnumerationImpl setType(final EdmEnumType type) {
+    this.type = type;
     return this;
   }
 
   @Override
   public <T> T accept(final ExpressionVisitor<T> visitor) throws ExceptionVisitExpression, ODataApplicationException {
-    return visitor.visitEnum(type, enumValues);
+    return visitor.visitEnum(type, values);
   }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/f8d92381/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/LambdaRefImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/LambdaRefImpl.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/LambdaRefImpl.java
index dc9063f..9911099 100644
--- a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/LambdaRefImpl.java
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/LambdaRefImpl.java
@@ -40,7 +40,6 @@ public class LambdaRefImpl extends ExpressionImpl implements LambdaRef, Visitabl
 
   @Override
   public <T> T accept(final ExpressionVisitor<T> visitor) throws ExceptionVisitExpression, ODataApplicationException {
-
     return visitor.visitLambdaReference(variableText);
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/f8d92381/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/MemberImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/MemberImpl.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/MemberImpl.java
index 719964e..3ea75ef 100644
--- a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/MemberImpl.java
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/MemberImpl.java
@@ -51,7 +51,6 @@ public class MemberImpl extends ExpressionImpl implements Member, VisitableExres
 
   @Override
   public EdmType getType() {
-
     UriInfoImpl uriInfo = (UriInfoImpl) path;
     UriResourcePartImpl lastResourcePart = (UriResourcePartImpl) uriInfo.getLastResourcePart();
 
@@ -70,8 +69,9 @@ public class MemberImpl extends ExpressionImpl implements Member, VisitableExres
         return type;
       }
       return lastTyped.getType();
+    } else {
+      return null;
     }
-    return null;
   }
 
   @Override
@@ -82,7 +82,6 @@ public class MemberImpl extends ExpressionImpl implements Member, VisitableExres
       UriResourceImplTyped lastTyped = (UriResourceImplTyped) lastResourcePart;
       return lastTyped.isCollection();
     }
-
     return false;
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/f8d92381/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/UnaryImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/UnaryImpl.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/UnaryImpl.java
new file mode 100644
index 0000000..e2cce17
--- /dev/null
+++ b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/UnaryImpl.java
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ ******************************************************************************/
+package org.apache.olingo.odata4.producer.core.uri.queryoption.expression;
+
+import org.apache.olingo.odata4.commons.api.exception.ODataApplicationException;
+import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.ExceptionVisitExpression;
+import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.Expression;
+import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.ExpressionVisitor;
+import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.SupportedUnaryOperators;
+import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.UnaryOperator;
+import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.VisitableExression;
+
+public class UnaryImpl extends ExpressionImpl implements UnaryOperator, VisitableExression {
+
+  private SupportedUnaryOperators operator;
+  private ExpressionImpl expression;
+
+  @Override
+  public SupportedUnaryOperators getOperator() {
+    return operator;
+  }
+
+  public void setOperator(final SupportedUnaryOperators 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 ExceptionVisitExpression, ODataApplicationException {
+    T operand = expression.accept(visitor);
+    return visitor.visitUnaryOperator(operator, operand);
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/f8d92381/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/UnaryOperatorImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/UnaryOperatorImpl.java b/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/UnaryOperatorImpl.java
deleted file mode 100644
index 8ec6ecb..0000000
--- a/odata4-lib/odata4-producer-core/src/main/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/UnaryOperatorImpl.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.odata4.producer.core.uri.queryoption.expression;
-
-import org.apache.olingo.odata4.commons.api.exception.ODataApplicationException;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.ExceptionVisitExpression;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.Expression;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.ExpressionVisitor;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.SupportedUnaryOperators;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.UnaryOperator;
-import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.VisitableExression;
-
-public class UnaryOperatorImpl extends ExpressionImpl implements UnaryOperator, VisitableExression {
-
-  private SupportedUnaryOperators operator;
-  private ExpressionImpl expression;
-
-  @Override
-  public SupportedUnaryOperators getOperator() {
-    return operator;
-  }
-
-  public void setOperator(final SupportedUnaryOperators 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 ExceptionVisitExpression, ODataApplicationException {
-    T operand = expression.accept(visitor);
-    return visitor.visitUnaryOperator(operator, operand);
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/f8d92381/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/EdmTechProvider.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/EdmTechProvider.java b/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/EdmTechProvider.java
index da1f021..817d6aa 100644
--- a/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/EdmTechProvider.java
+++ b/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/EdmTechProvider.java
@@ -222,8 +222,8 @@ public class EdmTechProvider extends EdmProvider {
       new FullQualifiedName(nameSpace, "UARTETCollAllPrimParam");
 
   public static final FullQualifiedName nameUARTETParam = new FullQualifiedName(nameSpace, "UARTETParam");
-  public static final FullQualifiedName nameUARTPrimCollParam = new FullQualifiedName(nameSpace, "UARTPrimCollParam");
   public static final FullQualifiedName nameUARTPrimParam = new FullQualifiedName(nameSpace, "UARTPrimParam");
+  public static final FullQualifiedName nameUARTPrimCollParam = new FullQualifiedName(nameSpace, "UARTPrimCollParam");
   public static final FullQualifiedName nameUFCRTCollCTTwoPrim =
       new FullQualifiedName(nameSpace, "UFCRTCollCTTwoPrim");
   public static final FullQualifiedName nameUFCRTCollCTTwoPrimParam =

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/f8d92381/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/FilterValidator.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/FilterValidator.java b/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/FilterValidator.java
index 1ace96c..3ce71f4 100644
--- a/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/FilterValidator.java
+++ b/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/testutil/FilterValidator.java
@@ -387,7 +387,7 @@ public class FilterValidator implements Validator {
     // check values
     int i = 0;
     for (String item : enumValues) {
-      assertEquals(item, enumeration.getEnumValues().get(i));
+      assertEquals(item, enumeration.getValues().get(i));
       i++;
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/f8d92381/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/UriInfoImplTest.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/UriInfoImplTest.java b/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/UriInfoImplTest.java
new file mode 100644
index 0000000..d46a459
--- /dev/null
+++ b/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/UriInfoImplTest.java
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ ******************************************************************************/
+package org.apache.olingo.odata4.producer.core.uri;
+
+public class UriInfoImplTest {
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/f8d92381/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/queryoption/QueryOptiontest.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/queryoption/QueryOptiontest.java b/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/queryoption/QueryOptiontest.java
new file mode 100644
index 0000000..7db78dd
--- /dev/null
+++ b/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/queryoption/QueryOptiontest.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.odata4.producer.core.uri.queryoption;
+
+import static org.junit.Assert.assertEquals;
+
+import org.apache.olingo.odata4.commons.api.exception.ODataApplicationException;
+import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.ExceptionVisitExpression;
+import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.SupportedBinaryOperators;
+import org.apache.olingo.odata4.producer.core.testutil.FilterTreeToText;
+import org.apache.olingo.odata4.producer.core.uri.queryoption.expression.AliasImpl;
+import org.apache.olingo.odata4.producer.core.uri.queryoption.expression.BinaryImpl;
+import org.apache.olingo.odata4.producer.core.uri.queryoption.expression.ExpressionImpl;
+import org.apache.olingo.odata4.producer.core.uri.queryoption.expression.LiteralImpl;
+import org.junit.Test;
+
+public class QueryOptiontest {
+
+  @Test
+  public void testAliasQueryOption() {
+    AliasQueryOptionImpl option = new AliasQueryOptionImpl();
+    
+    ExpressionImpl expression = new LiteralImpl();
+    
+    option.setAliasValue(expression);
+    assertEquals( expression, option.getValue());
+  }
+  
+  
+  
+  
+  
+  
+  //
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/f8d92381/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/ExpressionTest.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/ExpressionTest.java b/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/ExpressionTest.java
new file mode 100644
index 0000000..948686e
--- /dev/null
+++ b/odata4-lib/odata4-producer-core/src/test/java/org/apache/olingo/odata4/producer/core/uri/queryoption/expression/ExpressionTest.java
@@ -0,0 +1,271 @@
+/*******************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ ******************************************************************************/
+package org.apache.olingo.odata4.producer.core.uri.queryoption.expression;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.util.Arrays;
+
+import org.apache.olingo.odata4.commons.api.edm.Edm;
+import org.apache.olingo.odata4.commons.api.edm.EdmAction;
+import org.apache.olingo.odata4.commons.api.edm.EdmEntitySet;
+import org.apache.olingo.odata4.commons.api.edm.EdmEntityType;
+import org.apache.olingo.odata4.commons.api.edm.EdmEnumType;
+import org.apache.olingo.odata4.commons.api.edm.EdmFunction;
+import org.apache.olingo.odata4.commons.api.edm.EdmType;
+import org.apache.olingo.odata4.commons.api.exception.ODataApplicationException;
+import org.apache.olingo.odata4.commons.core.edm.provider.EdmEntityTypeImpl;
+import org.apache.olingo.odata4.commons.core.edm.provider.EdmProviderImpl;
+import org.apache.olingo.odata4.commons.core.edm.provider.EdmTypeImpl;
+import org.apache.olingo.odata4.producer.api.uri.UriInfoKind;
+import org.apache.olingo.odata4.producer.api.uri.UriInfoResource;
+import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.ExceptionVisitExpression;
+import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.SupportedBinaryOperators;
+import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.SupportedConstants;
+import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.SupportedMethodCalls;
+import org.apache.olingo.odata4.producer.api.uri.queryoption.expression.SupportedUnaryOperators;
+import org.apache.olingo.odata4.producer.core.testutil.EdmTechProvider;
+import org.apache.olingo.odata4.producer.core.testutil.EdmTechTestProvider;
+import org.apache.olingo.odata4.producer.core.testutil.FilterTreeToText;
+import org.apache.olingo.odata4.producer.core.uri.UriInfoImpl;
+import org.apache.olingo.odata4.producer.core.uri.UriResourceActionImpl;
+import org.apache.olingo.odata4.producer.core.uri.UriResourceEntitySetImpl;
+import org.apache.olingo.odata4.producer.core.uri.UriResourceFunctionImpl;
+import org.junit.Test;
+
+public class ExpressionTest {
+  Edm edm = new EdmProviderImpl(new EdmTechTestProvider());
+
+  @Test
+  public void testAliasExpression() throws ExceptionVisitExpression, 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 ExceptionVisitExpression, 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(SupportedBinaryOperators.SUB);
+
+    assertEquals(expressionLeft, expression.getLeftOperand());
+    assertEquals(expressionRight, expression.getRightOperand());
+    assertEquals(SupportedBinaryOperators.SUB, expression.getOperator());
+
+    String output = expression.accept(new FilterTreeToText());
+    assertEquals("<<A> sub <B>>", output);
+  }
+
+  @Test
+  public void testConstantExpression() throws ExceptionVisitExpression, ODataApplicationException {
+    ConstantImpl expression = new ConstantImpl();
+    EdmType type = edm.getEntityType(EdmTechProvider.nameETKeyNav);
+    assertNotNull(type);
+    expression.setType(type);
+    assertEquals(type, expression.getType());
+
+    expression.setKind(SupportedConstants.FALSE);
+    assertEquals(SupportedConstants.FALSE, expression.getKind());
+    assertEquals(true, expression.isFalse());
+    assertEquals(false, expression.isTrue());
+    assertEquals(false, expression.isNull());
+    assertEquals("<false>", expression.accept(new FilterTreeToText()));
+
+    expression.setKind(SupportedConstants.TRUE);
+    assertEquals(SupportedConstants.TRUE, expression.getKind());
+    assertEquals(false, expression.isFalse());
+    assertEquals(true, expression.isTrue());
+    assertEquals(false, expression.isNull());
+    assertEquals("<true>", expression.accept(new FilterTreeToText()));
+
+    expression.setKind(SupportedConstants.NULL);
+    assertEquals(SupportedConstants.NULL, expression.getKind());
+    assertEquals(false, expression.isFalse());
+    assertEquals(false, expression.isTrue());
+    assertEquals(true, expression.isNull());
+    assertEquals("<null>", expression.accept(new FilterTreeToText()));
+  }
+
+  @Test
+  public void testEnumerationExpression() throws ExceptionVisitExpression, ODataApplicationException {
+    EnumerationImpl expression = new EnumerationImpl();
+    EdmEnumType type = (EdmEnumType) edm.getEnumType(EdmTechProvider.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("<com.sap.odata.test1.ENString<A,B>>", expression.accept(new FilterTreeToText()));
+  }
+
+  @Test
+  public void testLambdaRefExpression() throws ExceptionVisitExpression, ODataApplicationException {
+    LambdaRefImpl expression = new LambdaRefImpl();
+    expression.setVariableText("A");
+    assertEquals("A", expression.getVariableName());
+
+    assertEquals("<A>", expression.accept(new FilterTreeToText()));
+
+  }
+
+  @Test
+  public void testLiteralExpresion() throws ExceptionVisitExpression, ODataApplicationException {
+    LiteralImpl expression = new LiteralImpl();
+    expression.setText("A");
+    assertEquals("A", expression.getText());
+
+    assertEquals("<A>", expression.accept(new FilterTreeToText()));
+  }
+
+  @Test
+  public void testMemberExpression() throws ExceptionVisitExpression, ODataApplicationException {
+    MemberImpl expression = new MemberImpl();
+    EdmEntityType entityType = edm.getEntityType(EdmTechProvider.nameETKeyNav);
+
+    // UriResourceImplTyped
+    UriInfoImpl resource = new UriInfoImpl().setKind(UriInfoKind.resource);
+    EdmAction action = edm.getAction(EdmTechProvider.nameUARTPrimParam, null, null);
+    UriInfoResource uriInfo = new UriInfoImpl().setKind(UriInfoKind.resource).addPathInfo(
+        new UriResourceActionImpl().setAction(action)).asUriInfoResource();
+    expression.setPath(uriInfo);
+    assertEquals(action.getReturnType().getType(), expression.getType());
+
+    // check accept and path
+    assertEquals(uriInfo, expression.getPath());
+    assertEquals("<UARTPrimParam>", expression.accept(new FilterTreeToText()));
+
+    // UriResourceImplTyped check collection = false case
+    assertEquals(false, expression.isCollection());
+
+    // UriResourceImplTyped check collection = true case
+    resource = new UriInfoImpl().setKind(UriInfoKind.resource);
+    action = edm.getAction(EdmTechProvider.nameUARTPrimCollParam, null, null);
+    expression.setPath(new UriInfoImpl().setKind(UriInfoKind.resource).addPathInfo(
+        new UriResourceActionImpl().setAction(action))
+        .asUriInfoResource());
+    assertEquals(true, expression.isCollection());
+
+    // UriResourceImplTyped with filter
+    resource = new UriInfoImpl().setKind(UriInfoKind.resource);
+    action = edm.getAction(EdmTechProvider.nameUARTPrimParam, null, null);
+    expression.setPath(new UriInfoImpl().setKind(UriInfoKind.resource).addPathInfo(
+        new UriResourceActionImpl().setAction(action).setTypeFilter(entityType))
+        .asUriInfoResource());
+    assertEquals(entityType, expression.getType());
+
+    // UriResourceImplKeyPred
+    resource = new UriInfoImpl().setKind(UriInfoKind.resource);
+    EdmFunction function = edm.getFunction(EdmTechProvider.nameUFCRTETKeyNav, null, null, null);
+    expression.setPath(new UriInfoImpl().setKind(UriInfoKind.resource).addPathInfo(
+        new UriResourceFunctionImpl().setFunction(function))
+        .asUriInfoResource());
+    assertEquals(function.getReturnType().getType(), expression.getType());
+
+    // UriResourceImplKeyPred typeFilter on entry
+    resource = new UriInfoImpl().setKind(UriInfoKind.resource);
+    EdmEntityType entityBaseType = edm.getEntityType(EdmTechProvider.nameETBaseTwoKeyNav);
+    function = edm.getFunction(EdmTechProvider.nameUFCRTESTwoKeyNavParam, null, null,
+        Arrays.asList(("ParameterInt16")));
+    expression.setPath(new UriInfoImpl().setKind(UriInfoKind.resource).addPathInfo(
+        new UriResourceFunctionImpl().setFunction(function).setEntryTypeFilter(entityBaseType))
+        .asUriInfoResource());
+    assertEquals(entityBaseType, expression.getType());
+
+    // UriResourceImplKeyPred typeFilter on entry
+    resource = new UriInfoImpl().setKind(UriInfoKind.resource);
+    entityBaseType = edm.getEntityType(EdmTechProvider.nameETBaseTwoKeyNav);
+    function = edm.getFunction(EdmTechProvider.nameUFCRTESTwoKeyNavParam, null, null,
+        Arrays.asList(("ParameterInt16")));
+    expression.setPath(new UriInfoImpl().setKind(UriInfoKind.resource).addPathInfo(
+        new UriResourceFunctionImpl().setFunction(function).setCollectionTypeFilter(entityBaseType))
+        .asUriInfoResource());
+    assertEquals(entityBaseType, expression.getType());
+
+    // no typed
+    resource = new UriInfoImpl().setKind(UriInfoKind.resource);
+    entityBaseType = edm.getEntityType(EdmTechProvider.nameETBaseTwoKeyNav);
+    function = edm.getFunction(EdmTechProvider.nameUFCRTESTwoKeyNavParam, null, null,
+        Arrays.asList(("ParameterInt16")));
+    expression.setPath(new UriInfoImpl().setKind(UriInfoKind.all));
+    assertEquals(null, expression.getType());
+
+    // no typed collection else case
+    assertEquals(false, expression.isCollection());
+  }
+
+  @Test
+  public void testMethodCallExpression() throws ExceptionVisitExpression, ODataApplicationException {
+    MethodCallImpl expression = new MethodCallImpl();
+    expression.setMethod(SupportedMethodCalls.CONCAT);
+
+    ExpressionImpl p0 = new LiteralImpl().setText("A");
+    ExpressionImpl p1 = new LiteralImpl().setText("B");
+    expression.addParameter(p0);
+    expression.addParameter(p1);
+
+    assertEquals(SupportedMethodCalls.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 ExceptionVisitExpression, ODataApplicationException {
+    TypeLiteralImpl expression = new TypeLiteralImpl();
+    EdmEntityType entityBaseType = edm.getEntityType(EdmTechProvider.nameETBaseTwoKeyNav);
+    expression.setType(entityBaseType);
+        
+    assertEquals(entityBaseType, expression.getType());
+    assertEquals("<com.sap.odata.test1.ETBaseTwoKeyNav>", expression.accept(new FilterTreeToText()));
+  }
+  
+  @Test
+  public void testUnaryExpression() throws ExceptionVisitExpression, ODataApplicationException {
+    UnaryImpl expression = new UnaryImpl();
+    expression.setOperator(SupportedUnaryOperators.MINUS);
+    
+    ExpressionImpl operand = new LiteralImpl().setText("A");
+    expression.setOperand(operand);
+        
+    assertEquals(SupportedUnaryOperators.MINUS, expression.getOperator());
+    assertEquals(operand, expression.getOperand());
+    
+    assertEquals("<- <A>>", expression.accept(new FilterTreeToText()));
+  }
+
+
+}