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/02/19 14:41:50 UTC
[10/29] [OLINGO-170] Moved provider and implementation to server
module
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/e8dccaf0/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriInfoImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriInfoImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriInfoImpl.java
index 0626c90..9dadfc4 100644
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriInfoImpl.java
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriInfoImpl.java
@@ -154,7 +154,7 @@ public class UriInfoImpl implements UriInfo {
public EdmEntityType getEntityTypeCast() {
return entityTypeCast;
}
-
+
public UriInfoImpl setEntityTypeCast(final EdmEntityType type) {
entityTypeCast = type;
return this;
@@ -189,7 +189,7 @@ public class UriInfoImpl implements UriInfo {
public UriInfoKind getKind() {
return kind;
}
-
+
public UriInfoImpl setKind(final UriInfoKind kind) {
this.kind = kind;
return this;
@@ -230,14 +230,11 @@ public class UriInfoImpl implements UriInfo {
return topOption;
}
-
-
-
public UriInfoImpl setQueryOptions(final List<QueryOptionImpl> list) {
for (QueryOptionImpl item : list) {
if (item instanceof SystemQueryOptionImpl) {
- setSystemQueryOption((SystemQueryOptionImpl)item);
+ setSystemQueryOption((SystemQueryOptionImpl) item);
} else if (item instanceof CustomQueryOptionImpl) {
addCustomQueryOption(item);
}
@@ -245,12 +242,12 @@ public class UriInfoImpl implements UriInfo {
return this;
}
- public void addCustomQueryOption(QueryOptionImpl item) {
+ public void addCustomQueryOption(final QueryOptionImpl item) {
customQueryOptions.add((CustomQueryOptionImpl) item);
}
- public UriInfoImpl setSystemQueryOption(SystemQueryOptionImpl systemOption) {
-
+ public UriInfoImpl setSystemQueryOption(final SystemQueryOptionImpl systemOption) {
+
if (systemOption.getKind() == SupportedQueryOptions.EXPAND) {
expandOption = (ExpandOptionImpl) systemOption;
} else if (systemOption.getKind() == SupportedQueryOptions.FILTER) {
@@ -282,12 +279,12 @@ public class UriInfoImpl implements UriInfo {
return this;
}
-
+ @Override
public String getFragment() {
return fragment;
}
- public UriInfoImpl setFragment(String fragment) {
+ public UriInfoImpl setFragment(final String fragment) {
this.fragment = fragment;
return this;
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/e8dccaf0/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriParameterImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriParameterImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriParameterImpl.java
index 06396db..38c6768 100644
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriParameterImpl.java
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriParameterImpl.java
@@ -69,15 +69,15 @@ public class UriParameterImpl implements UriParameter {
this.expression = expression;
return this;
}
-
+
@Override
public String getRefencedProperty() {
- return this.referencedProperty;
+ return referencedProperty;
}
- public UriParameterImpl setRefencedProperty(String referencedProperty) {
+ public UriParameterImpl setRefencedProperty(final String referencedProperty) {
this.referencedProperty = referencedProperty;
return this;
}
-
+
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/e8dccaf0/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceFunctionImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceFunctionImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceFunctionImpl.java
index 143cee2..344faa7 100644
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceFunctionImpl.java
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceFunctionImpl.java
@@ -52,7 +52,7 @@ public class UriResourceFunctionImpl extends UriResourceWithKeysImpl implements
}
public UriResourceFunctionImpl setParameters(final List<UriParameterImpl> parameters) {
- isParameterListFilled = true;
+ isParameterListFilled = true;
this.parameters = parameters;
return this;
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/e8dccaf0/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceItImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceItImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceItImpl.java
index 02b6d28..587345b 100644
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceItImpl.java
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceItImpl.java
@@ -38,7 +38,7 @@ public class UriResourceItImpl extends UriResourceWithKeysImpl implements UriRes
public EdmType getType() {
return type;
}
-
+
public UriResourceItImpl setType(final EdmType type) {
this.type = type;
return this;
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/e8dccaf0/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceTypedImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceTypedImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceTypedImpl.java
index 10330f3..9b2983d 100644
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceTypedImpl.java
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceTypedImpl.java
@@ -20,7 +20,7 @@ package org.apache.olingo.odata4.server.core.uri.apiimpl;
import org.apache.olingo.odata4.commons.api.edm.EdmStructuralType;
import org.apache.olingo.odata4.commons.api.edm.EdmType;
-import org.apache.olingo.odata4.commons.api.edm.provider.FullQualifiedName;
+import org.apache.olingo.odata4.commons.api.edm.FullQualifiedName;
import org.apache.olingo.odata4.server.api.uri.UriResourceKind;
import org.apache.olingo.odata4.server.api.uri.UriResourcePartTyped;
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/e8dccaf0/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceWithKeysImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceWithKeysImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceWithKeysImpl.java
index 66c3867..6fec51e 100644
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceWithKeysImpl.java
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/apiimpl/UriResourceWithKeysImpl.java
@@ -22,7 +22,7 @@ import java.util.ArrayList;
import java.util.List;
import org.apache.olingo.odata4.commons.api.edm.EdmType;
-import org.apache.olingo.odata4.commons.api.edm.provider.FullQualifiedName;
+import org.apache.olingo.odata4.commons.api.edm.FullQualifiedName;
import org.apache.olingo.odata4.server.api.uri.UriParameter;
import org.apache.olingo.odata4.server.api.uri.UriResourceKind;
import org.apache.olingo.odata4.server.api.uri.UriResourcePartTyped;
@@ -68,6 +68,7 @@ public abstract class UriResourceWithKeysImpl extends UriResourceImpl implements
return this;
}
+ @Override
public String toString(final boolean includeFilters) {
if (includeFilters == true) {
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/e8dccaf0/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/Parser.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/Parser.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/Parser.java
index ad1b2de..ccee276 100644
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/Parser.java
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/Parser.java
@@ -24,6 +24,7 @@ import java.util.List;
import org.antlr.v4.runtime.ANTLRInputStream;
import org.antlr.v4.runtime.BailErrorStrategy;
import org.antlr.v4.runtime.CommonTokenStream;
+import org.antlr.v4.runtime.Lexer;
import org.antlr.v4.runtime.ParserRuleContext;
import org.antlr.v4.runtime.Token;
import org.antlr.v4.runtime.atn.PredictionMode;
@@ -37,7 +38,16 @@ import org.apache.olingo.odata4.server.core.uri.UriParserException;
import org.apache.olingo.odata4.server.core.uri.UriParserSyntaxException;
import org.apache.olingo.odata4.server.core.uri.antlr.UriLexer;
import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser;
-import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.*;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.AllEOFContext;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.BatchEOFContext;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.CrossjoinEOFContext;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.EntityEOFContext;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.ExpandItemsEOFContext;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.FilterExpressionEOFContext;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.MetadataEOFContext;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.OrderByEOFContext;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.PathSegmentEOFContext;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.SelectEOFContext;
import org.apache.olingo.odata4.server.core.uri.apiimpl.UriInfoImpl;
import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceImpl;
import org.apache.olingo.odata4.server.core.uri.queryoption.CustomQueryOptionImpl;
@@ -60,20 +70,20 @@ public class Parser {
All, Batch, CrossJoin, Entity, ExpandItems, FilterExpression, Metadata, PathSegment, Orderby, Select
};
- public Parser setLogLevel(int logLevel) {
+ public Parser setLogLevel(final int logLevel) {
this.logLevel = logLevel;
return this;
}
- public UriInfo parseUri(final String input, Edm edm)
+ public UriInfo parseUri(final String input, final Edm edm)
throws UriParserException {
-
+
boolean readQueryParameter = false;
boolean readFragment = false;
UriContext context = new UriContext();
- UriParseTreeVisitor uriParseTreeVisitor = new UriParseTreeVisitor(edm,context );
-
+ UriParseTreeVisitor uriParseTreeVisitor = new UriParseTreeVisitor(edm, context);
+
try {
RawUri uri = UriDecoder.decodeUri(input, 0); // -> 0 segments are before the service url
@@ -266,7 +276,7 @@ public class Parser {
return null;
}
- private ParserRuleContext parseRule(final String input, ParserEntryRules entryPoint)
+ private ParserRuleContext parseRule(final String input, final ParserEntryRules entryPoint)
throws UriParserSyntaxException {
UriParserParser parser = null;
UriLexer lexer = null;
@@ -314,15 +324,15 @@ public class Parser {
ret = parser.pathSegmentEOF();
break;
case FilterExpression:
- lexer.mode(UriLexer.DEFAULT_MODE);
+ lexer.mode(Lexer.DEFAULT_MODE);
ret = parser.filterExpressionEOF();
break;
case Orderby:
- lexer.mode(UriLexer.DEFAULT_MODE);
+ lexer.mode(Lexer.DEFAULT_MODE);
ret = parser.orderByEOF();
break;
case ExpandItems:
- lexer.mode(UriLexer.DEFAULT_MODE);
+ lexer.mode(Lexer.DEFAULT_MODE);
ret = parser.expandItemsEOF();
break;
case Entity:
@@ -371,15 +381,15 @@ public class Parser {
ret = parser.pathSegmentEOF();
break;
case FilterExpression:
- lexer.mode(UriLexer.DEFAULT_MODE);
+ lexer.mode(Lexer.DEFAULT_MODE);
ret = parser.filterExpressionEOF();
break;
case Orderby:
- lexer.mode(UriLexer.DEFAULT_MODE);
+ lexer.mode(Lexer.DEFAULT_MODE);
ret = parser.orderByEOF();
break;
case ExpandItems:
- lexer.mode(UriLexer.DEFAULT_MODE);
+ lexer.mode(Lexer.DEFAULT_MODE);
ret = parser.expandItemsEOF();
break;
case Entity:
@@ -404,28 +414,28 @@ public class Parser {
return ret;
}
- protected void addStage1ErrorStategy(UriParserParser parser) {
+ protected void addStage1ErrorStategy(final UriParserParser parser) {
// Throw exception at first syntax error
parser.setErrorHandler(new BailErrorStrategy());
}
- protected void addStage2ErrorStategy(UriParserParser parser) {
+ protected void addStage2ErrorStategy(final UriParserParser parser) {
// Throw exception at first syntax error
parser.setErrorHandler(new BailErrorStrategy());
}
- protected void addStage1ErrorListener(UriParserParser parser) {
+ protected void addStage1ErrorListener(final UriParserParser parser) {
// No error logging to System.out or System.err, only exceptions used (depending on ErrorStrategy)
parser.removeErrorListeners();
}
- protected void addStage2ErrorListener(UriParserParser parser) {
+ protected void addStage2ErrorListener(final UriParserParser parser) {
// No error logging to System.out or System.err, only exceptions used (depending on ErrorStrategy)
parser.removeErrorListeners();
}
- public void showTokens(String input, List<? extends Token> list) {
+ public void showTokens(final String input, final List<? extends Token> list) {
boolean first = true;
System.out.println("input: " + input);
String nL = "\n";
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/e8dccaf0/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/RawUri.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/RawUri.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/RawUri.java
index a4d93c1..1293271 100644
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/RawUri.java
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/RawUri.java
@@ -36,11 +36,11 @@ public class RawUri {
public static class QueryOption {
public String name;
public String value;
-
- QueryOption(String name, String value) {
+
+ QueryOption(final String name, final String value) {
this.name = name;
this.value = value;
}
-
+
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/e8dccaf0/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/UriContext.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/UriContext.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/UriContext.java
index 52f9cf2..b752649 100644
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/UriContext.java
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/UriContext.java
@@ -20,23 +20,24 @@ package org.apache.olingo.odata4.server.core.uri.parser;
import java.util.Stack;
-import org.apache.olingo.odata4.commons.api.edm.Edm;
-import org.apache.olingo.odata4.commons.api.edm.EdmEntityContainer;
import org.apache.olingo.odata4.commons.api.edm.EdmType;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.ExpandPathContext;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.ExpandPathExtensionContext;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.SelectItemContext;
+import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.SelectSegmentContext;
import org.apache.olingo.odata4.server.core.uri.apiimpl.UriInfoImpl;
import org.apache.olingo.odata4.server.core.uri.parser.UriParseTreeVisitor.TypeInformation;
import org.apache.olingo.odata4.server.core.uri.queryoption.ExpandItemImpl;
import org.apache.olingo.odata4.server.core.uri.queryoption.SelectItemImpl;
public class UriContext {
-
+
public static class LambdaVariables {
public boolean isCollection;
public String name;
public EdmType type;
}
-
-
+
/**
* Hold all currently allowed lambda variables
* As lambda functions can be nested there may be more than one allowed lambda variables at a time while parsing a
@@ -68,12 +69,12 @@ public class UriContext {
public boolean contextReadingFunctionParameters;
public UriContext() {
-
- this.contextExpandItemPath = null;
- this.contextReadingFunctionParameters = false;
- this.contextSelectItem = null;
- this.contextTypes = new Stack<UriParseTreeVisitor.TypeInformation>();
- this.allowedLambdaVariables = new Stack<UriContext.LambdaVariables>();
-
+
+ contextExpandItemPath = null;
+ contextReadingFunctionParameters = false;
+ contextSelectItem = null;
+ contextTypes = new Stack<UriParseTreeVisitor.TypeInformation>();
+ allowedLambdaVariables = new Stack<UriContext.LambdaVariables>();
+
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/e8dccaf0/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/UriDecoder.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/UriDecoder.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/UriDecoder.java
index 28876c2..6aa87b1 100644
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/UriDecoder.java
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/UriDecoder.java
@@ -34,7 +34,7 @@ public class UriDecoder {
static Pattern uriPattern = Pattern.compile("^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?");
- public static RawUri decodeUri(String uri, int scipSegments) throws UriParserSyntaxException {
+ public static RawUri decodeUri(final String uri, final int scipSegments) throws UriParserSyntaxException {
RawUri rawUri = new RawUri();
Matcher m = uriPattern.matcher(uri);
@@ -53,21 +53,21 @@ public class UriDecoder {
return rawUri;
}
- private static void decode(RawUri rawUri) throws UriParserSyntaxException {
+ private static void decode(final RawUri rawUri) throws UriParserSyntaxException {
rawUri.pathSegmentListDecoded = new ArrayList<String>();
- for ( String segment: rawUri.pathSegmentList) {
+ for (String segment : rawUri.pathSegmentList) {
rawUri.pathSegmentListDecoded.add(decode(segment));
}
-
+
rawUri.queryOptionListDecoded = new ArrayList<QueryOption>();
- for ( QueryOption optionPair: rawUri.queryOptionList) {
+ for (QueryOption optionPair : rawUri.queryOptionList) {
rawUri.queryOptionListDecoded.add(new QueryOption(
decode(optionPair.name),
decode(optionPair.value)));
}
}
- private static void splittOptions(RawUri rawUri) {
+ private static void splittOptions(final RawUri rawUri) {
rawUri.queryOptionList = new ArrayList<RawUri.QueryOption>();
if (rawUri.queryOptionString == null) {
@@ -85,7 +85,7 @@ public class UriDecoder {
}
}
- private static List<String> splittFirst(String input, char c) {
+ private static List<String> splittFirst(final String input, final char c) {
int pos = input.indexOf(c, 0);
if (pos >= 0) {
return Arrays.asList(input.substring(0, pos), input.substring(pos + 1));
@@ -94,7 +94,7 @@ public class UriDecoder {
}
}
- public static void splittPath(RawUri rawUri, int scipSegments) {
+ public static void splittPath(final RawUri rawUri, int scipSegments) {
List<String> list = splitt(rawUri.path, '/');
if (list.size() > 0) {
@@ -110,7 +110,7 @@ public class UriDecoder {
}
}
- public static List<String> splitt(String input, char c) {
+ public static List<String> splitt(final String input, final char c) {
List<String> list = new LinkedList<String>();
@@ -129,7 +129,7 @@ public class UriDecoder {
return list;
}
- public static String decode(String encoded) throws UriParserSyntaxException {
+ public static String decode(final String encoded) throws UriParserSyntaxException {
try {
return URLDecoder.decode(encoded, "UTF-8");
} catch (UnsupportedEncodingException e) {
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/e8dccaf0/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/UriParseTreeVisitor.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/UriParseTreeVisitor.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/UriParseTreeVisitor.java
index 967d794..5d748cc 100644
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/UriParseTreeVisitor.java
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/parser/UriParseTreeVisitor.java
@@ -20,7 +20,6 @@
package org.apache.olingo.odata4.server.core.uri.parser;
-import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.List;
@@ -43,7 +42,7 @@ import org.apache.olingo.odata4.commons.api.edm.EdmProperty;
import org.apache.olingo.odata4.commons.api.edm.EdmSingleton;
import org.apache.olingo.odata4.commons.api.edm.EdmStructuralType;
import org.apache.olingo.odata4.commons.api.edm.EdmType;
-import org.apache.olingo.odata4.commons.api.edm.provider.FullQualifiedName;
+import org.apache.olingo.odata4.commons.api.edm.FullQualifiedName;
import org.apache.olingo.odata4.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
import org.apache.olingo.odata4.server.api.uri.UriInfoKind;
import org.apache.olingo.odata4.server.api.uri.UriResource;
@@ -53,7 +52,6 @@ import org.apache.olingo.odata4.server.api.uri.queryoption.expression.SupportedC
import org.apache.olingo.odata4.server.api.uri.queryoption.expression.SupportedMethodCalls;
import org.apache.olingo.odata4.server.core.uri.UriParserException;
import org.apache.olingo.odata4.server.core.uri.UriParserSemanticException;
-import org.apache.olingo.odata4.server.core.uri.UriParserSyntaxException;
import org.apache.olingo.odata4.server.core.uri.antlr.UriLexer;
import org.apache.olingo.odata4.server.core.uri.antlr.UriParserBaseVisitor;
import org.apache.olingo.odata4.server.core.uri.antlr.UriParserParser.AliasAndValueContext;
@@ -165,7 +163,6 @@ import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceStartingTypeF
import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceTypedImpl;
import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceValueImpl;
import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceWithKeysImpl;
-import org.apache.olingo.odata4.server.core.uri.parser.UriParseTreeVisitor.TypeInformation;
import org.apache.olingo.odata4.server.core.uri.queryoption.AliasQueryOptionImpl;
import org.apache.olingo.odata4.server.core.uri.queryoption.ExpandItemImpl;
import org.apache.olingo.odata4.server.core.uri.queryoption.ExpandOptionImpl;
@@ -234,7 +231,7 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
// --- class ---
- public void setContext(UriContext context) {
+ public void setContext(final UriContext context) {
this.context = context;
}
@@ -242,14 +239,14 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
return context.contextUriInfo;
}
- public UriParseTreeVisitor(final Edm edm, UriContext context) {
+ public UriParseTreeVisitor(final Edm edm, final UriContext context) {
this.edm = edm;
this.context = context;
edmEntityContainer = edm.getEntityContainer(null);
}
@Override
- protected Object aggregateResult(Object aggregate, Object nextResult) {
+ protected Object aggregateResult(final Object aggregate, final Object nextResult) {
if (aggregate != null) {
return aggregate;
} else {
@@ -346,10 +343,10 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
if (edmFunctionImport != null) {
// read the URI parameters
- this.context.contextReadingFunctionParameters = true;
+ context.contextReadingFunctionParameters = true;
@SuppressWarnings("unchecked")
List<UriParameterImpl> parameters = (List<UriParameterImpl>) ctx.vlNVO.get(0).accept(this);
- this.context.contextReadingFunctionParameters = false;
+ context.contextReadingFunctionParameters = false;
// mark parameters as consumed
ctx.vlNVO.remove(0);
@@ -601,10 +598,10 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
+ "'"));
}
- this.context.contextReadingFunctionParameters = true;
+ context.contextReadingFunctionParameters = true;
@SuppressWarnings("unchecked")
List<UriParameterImpl> parameters = (List<UriParameterImpl>) ctx.vlNVO.get(0).accept(this);
- this.context.contextReadingFunctionParameters = false;
+ context.contextReadingFunctionParameters = false;
// get names of function parameters
List<String> names = new ArrayList<String>();
@@ -643,7 +640,7 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
}
}
- private String getName(EdmType type) {
+ private String getName(final EdmType type) {
return type.getNamespace() + "." + type.getName();
}
@@ -847,8 +844,6 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
return binary;
}
-
-
@Override
public Object visitAnyExpr(final AnyExprContext ctx) {
UriResourceLambdaAnyImpl any = new UriResourceLambdaAnyImpl();
@@ -872,7 +867,7 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
}
@Override
- public Object visitBooleanNonCase(BooleanNonCaseContext ctx) {
+ public Object visitBooleanNonCase(final BooleanNonCaseContext ctx) {
String text = ctx.getText().toLowerCase();
if (text.equals("false")) {
@@ -893,7 +888,7 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
String namespace = ctx.vNS.getText();
namespace = namespace.substring(0, namespace.length() - 1);
- FullQualifiedName fullName = new FullQualifiedName(namespace,ctx.vODI.getText());
+ FullQualifiedName fullName = new FullQualifiedName(namespace, ctx.vODI.getText());
EdmType type = getType(fullName);
method.setMethod(SupportedMethodCalls.CAST);
method.addParameter(new TypeLiteralImpl().setType(type));
@@ -1317,7 +1312,7 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
}
@Override
- public Object visitLevels(LevelsContext ctx) {
+ public Object visitLevels(final LevelsContext ctx) {
LevelsOptionImpl levels = new LevelsOptionImpl();
@@ -1571,7 +1566,7 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
}
@Override
- public Object visitNullrule(NullruleContext ctx) {
+ public Object visitNullrule(final NullruleContext ctx) {
return new ConstantImpl().setKind(SupportedConstants.NULL);
}
@@ -1610,7 +1605,7 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
}
@Override
- public Object visitOrderByItem(OrderByItemContext ctx) {
+ public Object visitOrderByItem(final OrderByItemContext ctx) {
OrderByItemImpl oItem = new OrderByItemImpl();
if (ctx.vD != null) {
oItem.setDescending(true);
@@ -1997,7 +1992,7 @@ public class UriParseTreeVisitor extends UriParserBaseVisitor<Object> {
SkipTokenOptionImpl skiptoken = new SkipTokenOptionImpl();
String text = ctx.children.get(2).getText();
-
+
return skiptoken.setValue(text).setText(text);
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/e8dccaf0/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/AliasQueryOptionImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/AliasQueryOptionImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/AliasQueryOptionImpl.java
index 6158168..8217d8d 100644
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/AliasQueryOptionImpl.java
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/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/e8dccaf0/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/OrderByOptionImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/OrderByOptionImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/OrderByOptionImpl.java
index 1f7cf07..b2519a1 100644
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/OrderByOptionImpl.java
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/OrderByOptionImpl.java
@@ -27,7 +27,7 @@ import org.apache.olingo.odata4.server.api.uri.queryoption.SupportedQueryOptions
public class OrderByOptionImpl extends SystemQueryOptionImpl implements OrderByOption {
- private List<OrderByItemImpl> orders= new ArrayList<OrderByItemImpl>();
+ private List<OrderByItemImpl> orders = new ArrayList<OrderByItemImpl>();
public OrderByOptionImpl() {
setKind(SupportedQueryOptions.ORDERBY);
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/e8dccaf0/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/SearchOptionImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/SearchOptionImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/SearchOptionImpl.java
index 5ed729e..fcaee17 100644
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/SearchOptionImpl.java
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/SearchOptionImpl.java
@@ -35,7 +35,5 @@ public class SearchOptionImpl extends SystemQueryOptionImpl implements SearchOpt
// TODO $search not supported yet
return null;
}
-
-
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/e8dccaf0/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/SelectItemImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/SelectItemImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/SelectItemImpl.java
index 24f6562..060bc7a 100644
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/SelectItemImpl.java
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/SelectItemImpl.java
@@ -18,7 +18,7 @@
******************************************************************************/
package org.apache.olingo.odata4.server.core.uri.queryoption;
-import org.apache.olingo.odata4.commons.api.edm.provider.FullQualifiedName;
+import org.apache.olingo.odata4.commons.api.edm.FullQualifiedName;
import org.apache.olingo.odata4.server.api.uri.UriInfoResource;
import org.apache.olingo.odata4.server.api.uri.queryoption.SelectItem;
@@ -29,13 +29,13 @@ public class SelectItemImpl implements SelectItem {
private boolean isStar;
private FullQualifiedName addOperationsInSchemaNameSpace;
- @Override
+ @Override
public UriInfoResource getResourceInfo() {
return path;
}
- public SelectItemImpl setResourceInfo(UriInfoResource path) {
+ public SelectItemImpl setResourceInfo(final UriInfoResource path) {
this.path = path;
return this;
}
@@ -67,6 +67,5 @@ public class SelectItemImpl implements SelectItem {
public void addAllOperationsInSchema(final FullQualifiedName addOperationsInSchemaNameSpace) {
this.addOperationsInSchemaNameSpace = addOperationsInSchemaNameSpace;
}
-
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/e8dccaf0/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/TopOptionImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/TopOptionImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/TopOptionImpl.java
index f7f0cfc..69acb8d 100644
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/TopOptionImpl.java
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/TopOptionImpl.java
@@ -40,6 +40,4 @@ public class TopOptionImpl extends SystemQueryOptionImpl implements TopOption {
return this;
}
-
-
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/e8dccaf0/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/AliasImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/AliasImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/AliasImpl.java
index 1ce145f..1e2abff 100644
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/AliasImpl.java
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/AliasImpl.java
@@ -18,22 +18,22 @@
******************************************************************************/
package org.apache.olingo.odata4.server.core.uri.queryoption.expression;
-import org.apache.olingo.odata4.commons.api.exception.ODataApplicationException;
+import org.apache.olingo.odata4.commons.api.ODataApplicationException;
import org.apache.olingo.odata4.server.api.uri.queryoption.expression.AliasExpression;
import org.apache.olingo.odata4.server.api.uri.queryoption.expression.ExceptionVisitExpression;
import org.apache.olingo.odata4.server.api.uri.queryoption.expression.ExpressionVisitor;
-public class AliasImpl extends ExpressionImpl implements AliasExpression {
+public class AliasImpl extends ExpressionImpl implements AliasExpression {
private String parameterName;
-
+
@Override
public String getParameterName() {
return parameterName;
}
public void setParameter(final String ParameterName) {
- this.parameterName = ParameterName;
+ parameterName = ParameterName;
}
@Override
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/e8dccaf0/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/BinaryImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/BinaryImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/BinaryImpl.java
index fb1c5a2..73b7eb8 100644
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/BinaryImpl.java
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/BinaryImpl.java
@@ -18,7 +18,7 @@
******************************************************************************/
package org.apache.olingo.odata4.server.core.uri.queryoption.expression;
-import org.apache.olingo.odata4.commons.api.exception.ODataApplicationException;
+import org.apache.olingo.odata4.commons.api.ODataApplicationException;
import org.apache.olingo.odata4.server.api.uri.queryoption.expression.BinaryExpression;
import org.apache.olingo.odata4.server.api.uri.queryoption.expression.ExceptionVisitExpression;
import org.apache.olingo.odata4.server.api.uri.queryoption.expression.Expression;
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/e8dccaf0/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/ConstantImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/ConstantImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/ConstantImpl.java
index 8d4567c..08d97aa 100644
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/ConstantImpl.java
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/ConstantImpl.java
@@ -18,8 +18,8 @@
******************************************************************************/
package org.apache.olingo.odata4.server.core.uri.queryoption.expression;
+import org.apache.olingo.odata4.commons.api.ODataApplicationException;
import org.apache.olingo.odata4.commons.api.edm.EdmType;
-import org.apache.olingo.odata4.commons.api.exception.ODataApplicationException;
import org.apache.olingo.odata4.server.api.uri.queryoption.expression.Constant;
import org.apache.olingo.odata4.server.api.uri.queryoption.expression.ExceptionVisitExpression;
import org.apache.olingo.odata4.server.api.uri.queryoption.expression.ExpressionVisitor;
@@ -31,7 +31,7 @@ public class ConstantImpl extends ExpressionImpl implements Constant {
SupportedConstants kind;
@Override
- public <T> T accept(ExpressionVisitor<T> visitor) throws ExceptionVisitExpression, ODataApplicationException {
+ public <T> T accept(final ExpressionVisitor<T> visitor) throws ExceptionVisitExpression, ODataApplicationException {
return visitor.visitConstant(kind);
}
@@ -55,7 +55,7 @@ public class ConstantImpl extends ExpressionImpl implements Constant {
return type;
}
- public ConstantImpl setType(EdmType type) {
+ public ConstantImpl setType(final EdmType type) {
this.type = type;
return this;
}
@@ -65,7 +65,7 @@ public class ConstantImpl extends ExpressionImpl implements Constant {
return kind;
}
- public ConstantImpl setKind(SupportedConstants kind) {
+ public ConstantImpl setKind(final SupportedConstants kind) {
this.kind = kind;
return this;
}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/e8dccaf0/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/EnumerationImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/EnumerationImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/EnumerationImpl.java
index f47d164..549cb3b 100644
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/EnumerationImpl.java
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/EnumerationImpl.java
@@ -21,8 +21,8 @@ package org.apache.olingo.odata4.server.core.uri.queryoption.expression;
import java.util.ArrayList;
import java.util.List;
+import org.apache.olingo.odata4.commons.api.ODataApplicationException;
import org.apache.olingo.odata4.commons.api.edm.EdmEnumType;
-import org.apache.olingo.odata4.commons.api.exception.ODataApplicationException;
import org.apache.olingo.odata4.server.api.uri.queryoption.expression.Enumeration;
import org.apache.olingo.odata4.server.api.uri.queryoption.expression.ExceptionVisitExpression;
import org.apache.olingo.odata4.server.api.uri.queryoption.expression.ExpressionVisitor;
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/e8dccaf0/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/LambdaRefImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/LambdaRefImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/LambdaRefImpl.java
index ec2cd0a..fcf5f50 100644
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/LambdaRefImpl.java
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/LambdaRefImpl.java
@@ -18,7 +18,7 @@
******************************************************************************/
package org.apache.olingo.odata4.server.core.uri.queryoption.expression;
-import org.apache.olingo.odata4.commons.api.exception.ODataApplicationException;
+import org.apache.olingo.odata4.commons.api.ODataApplicationException;
import org.apache.olingo.odata4.server.api.uri.queryoption.expression.ExceptionVisitExpression;
import org.apache.olingo.odata4.server.api.uri.queryoption.expression.ExpressionVisitor;
import org.apache.olingo.odata4.server.api.uri.queryoption.expression.LambdaRef;
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/e8dccaf0/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/LiteralImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/LiteralImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/LiteralImpl.java
index 7de63f2..5709d53 100644
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/LiteralImpl.java
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/LiteralImpl.java
@@ -18,7 +18,7 @@
******************************************************************************/
package org.apache.olingo.odata4.server.core.uri.queryoption.expression;
-import org.apache.olingo.odata4.commons.api.exception.ODataApplicationException;
+import org.apache.olingo.odata4.commons.api.ODataApplicationException;
import org.apache.olingo.odata4.server.api.uri.queryoption.expression.ExceptionVisitExpression;
import org.apache.olingo.odata4.server.api.uri.queryoption.expression.ExpressionVisitor;
import org.apache.olingo.odata4.server.api.uri.queryoption.expression.Literal;
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/e8dccaf0/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/MemberImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/MemberImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/MemberImpl.java
index 1d3c345..f97bad2 100644
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/MemberImpl.java
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/MemberImpl.java
@@ -18,8 +18,8 @@
******************************************************************************/
package org.apache.olingo.odata4.server.core.uri.queryoption.expression;
+import org.apache.olingo.odata4.commons.api.ODataApplicationException;
import org.apache.olingo.odata4.commons.api.edm.EdmType;
-import org.apache.olingo.odata4.commons.api.exception.ODataApplicationException;
import org.apache.olingo.odata4.server.api.uri.UriInfoResource;
import org.apache.olingo.odata4.server.api.uri.queryoption.expression.ExceptionVisitExpression;
import org.apache.olingo.odata4.server.api.uri.queryoption.expression.ExpressionVisitor;
@@ -30,7 +30,6 @@ import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceImpl;
import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceTypedImpl;
import org.apache.olingo.odata4.server.core.uri.apiimpl.UriResourceWithKeysImpl;
-
public class MemberImpl extends ExpressionImpl implements Member, VisitableExression {
private UriInfoResource path;
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/e8dccaf0/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/MethodCallImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/MethodCallImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/MethodCallImpl.java
index 4bd1555..ef34daf 100644
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/MethodCallImpl.java
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/MethodCallImpl.java
@@ -21,7 +21,7 @@ package org.apache.olingo.odata4.server.core.uri.queryoption.expression;
import java.util.ArrayList;
import java.util.List;
-import org.apache.olingo.odata4.commons.api.exception.ODataApplicationException;
+import org.apache.olingo.odata4.commons.api.ODataApplicationException;
import org.apache.olingo.odata4.server.api.uri.queryoption.expression.ExceptionVisitExpression;
import org.apache.olingo.odata4.server.api.uri.queryoption.expression.Expression;
import org.apache.olingo.odata4.server.api.uri.queryoption.expression.ExpressionVisitor;
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/e8dccaf0/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/TypeLiteralImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/TypeLiteralImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/TypeLiteralImpl.java
index 14fae5d..538e25f 100644
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/TypeLiteralImpl.java
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/TypeLiteralImpl.java
@@ -18,8 +18,8 @@
******************************************************************************/
package org.apache.olingo.odata4.server.core.uri.queryoption.expression;
+import org.apache.olingo.odata4.commons.api.ODataApplicationException;
import org.apache.olingo.odata4.commons.api.edm.EdmType;
-import org.apache.olingo.odata4.commons.api.exception.ODataApplicationException;
import org.apache.olingo.odata4.server.api.uri.queryoption.expression.ExceptionVisitExpression;
import org.apache.olingo.odata4.server.api.uri.queryoption.expression.ExpressionVisitor;
import org.apache.olingo.odata4.server.api.uri.queryoption.expression.TypeLiteral;
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/e8dccaf0/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/UnaryImpl.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/UnaryImpl.java b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/UnaryImpl.java
index e2b2f5f..879324c 100644
--- a/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/UnaryImpl.java
+++ b/odata4-lib/odata4-server-core/src/main/java/org/apache/olingo/odata4/server/core/uri/queryoption/expression/UnaryImpl.java
@@ -18,7 +18,7 @@
******************************************************************************/
package org.apache.olingo.odata4.server.core.uri.queryoption.expression;
-import org.apache.olingo.odata4.commons.api.exception.ODataApplicationException;
+import org.apache.olingo.odata4.commons.api.ODataApplicationException;
import org.apache.olingo.odata4.server.api.uri.queryoption.expression.ExceptionVisitExpression;
import org.apache.olingo.odata4.server.api.uri.queryoption.expression.Expression;
import org.apache.olingo.odata4.server.api.uri.queryoption.expression.ExpressionVisitor;
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/e8dccaf0/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/edm/provider/EdmActionImplTest.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/edm/provider/EdmActionImplTest.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/edm/provider/EdmActionImplTest.java
new file mode 100644
index 0000000..9cb51e1
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/edm/provider/EdmActionImplTest.java
@@ -0,0 +1,156 @@
+/*******************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.server.core.edm.provider;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import java.util.ArrayList;
+import java.util.List;
+
+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.EdmException;
+import org.apache.olingo.odata4.commons.api.edm.EdmParameter;
+import org.apache.olingo.odata4.commons.api.edm.EdmSingleton;
+import org.apache.olingo.odata4.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.odata4.commons.api.edm.constants.EdmTypeKind;
+import org.apache.olingo.odata4.server.api.edm.provider.Action;
+import org.apache.olingo.odata4.server.api.edm.provider.EntitySetPath;
+import org.apache.olingo.odata4.server.api.edm.provider.Parameter;
+import org.apache.olingo.odata4.server.api.edm.provider.ReturnType;
+import org.junit.Before;
+import org.junit.Test;
+
+public class EdmActionImplTest {
+
+ private EdmAction actionImpl1;
+ private EdmAction actionImpl2;
+ private EdmAction actionImpl3;
+
+ @Before
+ public void setup() {
+ EdmProviderImpl provider = mock(EdmProviderImpl.class);
+ List<Parameter> parameters = new ArrayList<Parameter>();
+ parameters.add(new Parameter().setName("Id").setType(new FullQualifiedName("namespace", "name")));
+ FullQualifiedName action1Name = new FullQualifiedName("namespace", "action1");
+ Action action1 = new Action().setName("action1").setBound(true).setParameters(parameters);
+ actionImpl1 = new EdmActionImpl(provider, action1Name, action1);
+
+ FullQualifiedName action2Name = new FullQualifiedName("namespace", "action2");
+ FullQualifiedName returnTypeName = new FullQualifiedName("Edm", "String");
+ ReturnType returnType = new ReturnType().setType(returnTypeName);
+ Action action2 = new Action().setName("action2").setParameters(parameters).setReturnType(returnType);
+ actionImpl2 = new EdmActionImpl(provider, action2Name, action2);
+
+ FullQualifiedName action3Name = new FullQualifiedName("namespace", "action3");
+ EntitySetPath entitySetPath = new EntitySetPath().setBindingParameter("Id").setPath("path");
+ Action action3 =
+ new Action().setName("action3").setParameters(parameters).setReturnType(returnType).setEntitySetPath(
+ entitySetPath);
+ actionImpl3 = new EdmActionImpl(provider, action3Name, action3);
+ }
+
+ @Test
+ public void action1BasicMethodCalls() {
+ assertTrue(actionImpl1.isBound());
+ assertEquals(EdmTypeKind.ACTION, actionImpl1.getKind());
+ assertNull(actionImpl1.getReturnType());
+ // assertEquals("returnName", actionImpl1.getReturnType().getType().getName());
+ assertNotNull(actionImpl1.getParameterNames());
+
+ for (String name : actionImpl1.getParameterNames()) {
+ EdmParameter parameter = actionImpl1.getParameter(name);
+ assertNotNull(parameter);
+ assertEquals(name, parameter.getName());
+ }
+
+ assertNull(actionImpl1.getReturnedEntitySet(null));
+ assertNull(actionImpl1.getReturnedEntitySet(mock(EdmEntitySet.class)));
+ }
+
+ @Test
+ public void action2BasicMethodCalls() {
+ assertFalse(actionImpl2.isBound());
+ assertEquals(EdmTypeKind.ACTION, actionImpl2.getKind());
+ assertEquals("String", actionImpl2.getReturnType().getType().getName());
+ assertNotNull(actionImpl2.getParameterNames());
+
+ for (String name : actionImpl2.getParameterNames()) {
+ EdmParameter parameter = actionImpl2.getParameter(name);
+ assertNotNull(parameter);
+ assertEquals(name, parameter.getName());
+ }
+
+ assertNull(actionImpl2.getReturnedEntitySet(null));
+ assertNull(actionImpl2.getReturnedEntitySet(mock(EdmEntitySet.class)));
+ }
+
+ @Test
+ public void action3BasicMethodCalls() {
+ assertFalse(actionImpl3.isBound());
+ assertEquals(EdmTypeKind.ACTION, actionImpl3.getKind());
+ assertEquals("String", actionImpl3.getReturnType().getType().getName());
+ assertNotNull(actionImpl3.getParameterNames());
+
+ for (String name : actionImpl3.getParameterNames()) {
+ EdmParameter parameter = actionImpl3.getParameter(name);
+ assertNotNull(parameter);
+ assertEquals(name, parameter.getName());
+ }
+
+ actionImpl3.getReturnedEntitySet(null);
+ }
+
+ @Test
+ public void action3getReturnedEntitySetWithEntitySet() {
+ EdmEntitySet set = mock(EdmEntitySet.class);
+ when(set.getRelatedBindingTarget("path")).thenReturn(set);
+
+ EdmEntitySet returnedEntitySet = actionImpl3.getReturnedEntitySet(set);
+
+ assertEquals(set, returnedEntitySet);
+ }
+
+ @Test(expected = EdmException.class)
+ public void action3getReturnedEntitySetWithNullReturn() {
+ EdmEntitySet set = mock(EdmEntitySet.class);
+ when(set.getRelatedBindingTarget("path")).thenReturn(null);
+
+ actionImpl3.getReturnedEntitySet(set);
+ fail();
+ }
+
+ @Test(expected = EdmException.class)
+ public void action3getReturnedEntitySetWithSingleton() {
+ EdmSingleton singleton = mock(EdmSingleton.class);
+ EdmEntitySet set = mock(EdmEntitySet.class);
+ when(set.getRelatedBindingTarget("path")).thenReturn(singleton);
+
+ actionImpl3.getReturnedEntitySet(set);
+ fail();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/e8dccaf0/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/edm/provider/EdmActionImportImplTest.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/edm/provider/EdmActionImportImplTest.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/edm/provider/EdmActionImportImplTest.java
new file mode 100644
index 0000000..d7a963e
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/edm/provider/EdmActionImportImplTest.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.odata4.server.core.edm.provider;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import org.apache.olingo.odata4.commons.api.edm.EdmAction;
+import org.apache.olingo.odata4.commons.api.edm.EdmActionImport;
+import org.apache.olingo.odata4.commons.api.edm.EdmEntityContainer;
+import org.apache.olingo.odata4.commons.api.edm.EdmEntitySet;
+import org.apache.olingo.odata4.commons.api.edm.EdmException;
+import org.apache.olingo.odata4.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.odata4.server.api.edm.provider.ActionImport;
+import org.apache.olingo.odata4.server.api.edm.provider.Target;
+import org.junit.Before;
+import org.junit.Test;
+
+public class EdmActionImportImplTest {
+
+ EdmEntityContainer container;
+ EdmActionImport actionImport;
+ private EdmAction action;
+ private EdmEntitySet entitySet;
+
+ @Before
+ public void setup() {
+ FullQualifiedName actionFqn = new FullQualifiedName("namespace", "actionName");
+ FullQualifiedName entityContainerFqn = new FullQualifiedName("namespace", "containerName");
+ Target target = new Target().setEntityContainer(entityContainerFqn).setTargetName("entitySetName");
+ ActionImport providerActionImport =
+ new ActionImport().setName("actionImportName").setAction(actionFqn).setEntitySet(target);
+
+ EdmProviderImpl edm = mock(EdmProviderImpl.class);
+ container = mock(EdmEntityContainer.class);
+ when(edm.getEntityContainer(entityContainerFqn)).thenReturn(container);
+ action = mock(EdmAction.class);
+ when(edm.getAction(actionFqn, null, null)).thenReturn(action);
+
+ entitySet = mock(EdmEntitySet.class);
+ when(container.getEntitySet("entitySetName")).thenReturn(entitySet);
+ actionImport = new EdmActionImportImpl(edm, "actionImportName", container, providerActionImport);
+ }
+
+ @Test
+ public void simpleActionTest() {
+ assertEquals("actionImportName", actionImport.getName());
+ assertTrue(container == actionImport.getEntityContainer());
+ assertTrue(action == actionImport.getAction());
+ }
+
+ @Test
+ public void getReturnedEntitySet() {
+ EdmEntitySet returnedEntitySet = actionImport.getReturnedEntitySet();
+ assertNotNull(returnedEntitySet);
+ assertTrue(returnedEntitySet == entitySet);
+
+ // Chaching
+ assertTrue(returnedEntitySet == actionImport.getReturnedEntitySet());
+ }
+
+ @Test(expected = EdmException.class)
+ public void getReturnedEntitySetNonExistingContainer() {
+ Target target = new Target();
+ ActionImport providerActionImport = new ActionImport().setName("actionImportName").setEntitySet(target);
+ EdmActionImport actionImport =
+ new EdmActionImportImpl(mock(EdmProviderImpl.class), "actionImportName", container, providerActionImport);
+ actionImport.getReturnedEntitySet();
+ }
+
+ @Test(expected = EdmException.class)
+ public void getReturnedEntitySetNonExistingEntitySet() {
+ Target target = new Target();
+ ActionImport providerActionImport = new ActionImport().setName("actionImportName").setEntitySet(target);
+ EdmProviderImpl edm = mock(EdmProviderImpl.class);
+ when(edm.getEntityContainer(null)).thenReturn(container);
+ EdmActionImport actionImport = new EdmActionImportImpl(edm, "actionImportName", container, providerActionImport);
+ actionImport.getReturnedEntitySet();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/e8dccaf0/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/edm/provider/EdmComplexTypeImplTest.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/edm/provider/EdmComplexTypeImplTest.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/edm/provider/EdmComplexTypeImplTest.java
new file mode 100644
index 0000000..0da3e41
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/edm/provider/EdmComplexTypeImplTest.java
@@ -0,0 +1,163 @@
+/*******************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.server.core.edm.provider;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.olingo.odata4.commons.api.edm.EdmComplexType;
+import org.apache.olingo.odata4.commons.api.edm.EdmElement;
+import org.apache.olingo.odata4.commons.api.edm.EdmException;
+import org.apache.olingo.odata4.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.odata4.commons.core.edm.primitivetype.EdmPrimitiveTypeKind;
+import org.apache.olingo.odata4.server.api.edm.provider.ComplexType;
+import org.apache.olingo.odata4.server.api.edm.provider.EdmProvider;
+import org.apache.olingo.odata4.server.api.edm.provider.NavigationProperty;
+import org.apache.olingo.odata4.server.api.edm.provider.Property;
+import org.junit.Before;
+import org.junit.Test;
+
+public class EdmComplexTypeImplTest {
+
+ private EdmComplexType baseType;
+ private EdmComplexType type;
+
+ @Before
+ public void setupTypes() throws Exception {
+ EdmProvider provider = mock(EdmProvider.class);
+ EdmProviderImpl edm = new EdmProviderImpl(provider);
+
+ FullQualifiedName baseName = new FullQualifiedName("namespace", "BaseTypeName");
+ ComplexType baseComplexType = new ComplexType();
+ List<Property> baseProperties = new ArrayList<Property>();
+ baseProperties.add(new Property().setName("prop1").setType(EdmPrimitiveTypeKind.String.getFullQualifiedName()));
+ List<NavigationProperty> baseNavigationProperties = new ArrayList<NavigationProperty>();
+ baseNavigationProperties.add(new NavigationProperty().setName("nav1"));
+ baseComplexType.setName("BaseTypeName").setAbstract(false).setOpenType(false).setProperties(baseProperties)
+ .setNavigationProperties(baseNavigationProperties);
+ when(provider.getComplexType(baseName)).thenReturn(baseComplexType);
+
+ baseType = new EdmComplexTypeImpl(edm, baseName, baseComplexType);
+
+ FullQualifiedName name = new FullQualifiedName("namespace", "typeName");
+ ComplexType complexType = new ComplexType().setBaseType(baseName);
+ List<Property> properties = new ArrayList<Property>();
+ properties.add(new Property().setName("prop2").setType(EdmPrimitiveTypeKind.String.getFullQualifiedName()));
+ List<NavigationProperty> navigationProperties = new ArrayList<NavigationProperty>();
+ navigationProperties.add(new NavigationProperty().setName("nav2"));
+ complexType.setName("BaseTypeName").setAbstract(false).setOpenType(false).setProperties(properties)
+ .setNavigationProperties(navigationProperties);
+ when(provider.getComplexType(name)).thenReturn(complexType);
+
+ type = new EdmComplexTypeImpl(edm, name, complexType);
+ }
+
+ @Test
+ public void noPropertiesAndNoNavPropertiesMustNotResultInException() {
+ EdmProviderImpl edm = mock(EdmProviderImpl.class);
+ ComplexType complexType = new ComplexType().setName("n");
+ new EdmComplexTypeImpl(edm, new FullQualifiedName("n", "n"), complexType);
+ }
+
+ @Test
+ public void typeMustBeCompatibletoBasetype() {
+ assertTrue(type.compatibleTo(baseType));
+ }
+
+ @Test
+ public void baseTypeMustNotBeCompatibleToType() {
+ assertFalse(baseType.compatibleTo(type));
+ }
+
+ @Test(expected = EdmException.class)
+ public void nullForCompatibleTypeMustResultInEdmException() {
+ assertFalse(type.compatibleTo(null));
+ }
+
+ @Test
+ public void getBaseType() {
+ assertNull(baseType.getBaseType());
+ assertNotNull(type.getBaseType());
+ }
+
+ @Test
+ public void propertiesBehaviour() {
+ List<String> propertyNames = baseType.getPropertyNames();
+ assertEquals(1, propertyNames.size());
+ assertEquals("prop1", baseType.getProperty("prop1").getName());
+ }
+
+ @Test
+ public void propertiesBehaviourWithBaseType() {
+ List<String> propertyNames = type.getPropertyNames();
+ assertEquals(2, propertyNames.size());
+ assertEquals("prop1", type.getProperty("prop1").getName());
+ assertEquals("prop2", type.getProperty("prop2").getName());
+ }
+
+ @Test
+ public void navigationPropertiesBehaviour() {
+ List<String> navigationPropertyNames = baseType.getNavigationPropertyNames();
+ assertEquals(1, navigationPropertyNames.size());
+ assertEquals("nav1", baseType.getProperty("nav1").getName());
+ }
+
+ @Test
+ public void navigationPropertiesBehaviourWithBaseType() {
+ List<String> navigationPropertyNames = type.getNavigationPropertyNames();
+ assertEquals(2, navigationPropertyNames.size());
+ assertEquals("nav1", type.getProperty("nav1").getName());
+ assertEquals("nav2", type.getProperty("nav2").getName());
+ }
+
+ @Test
+ public void propertyCaching() {
+ EdmElement property = type.getProperty("prop1");
+ assertTrue(property == type.getProperty("prop1"));
+
+ property = type.getProperty("prop2");
+ assertTrue(property == type.getProperty("prop2"));
+
+ property = type.getProperty("nav1");
+ assertTrue(property == type.getProperty("nav1"));
+
+ property = type.getProperty("nav2");
+ assertTrue(property == type.getProperty("nav2"));
+ }
+
+ @Test(expected = EdmException.class)
+ public void nonExistingBaseType() throws Exception {
+ EdmProvider provider = mock(EdmProvider.class);
+ EdmProviderImpl edm = new EdmProviderImpl(provider);
+ FullQualifiedName typeWithNonexistingBaseTypeName = new FullQualifiedName("namespace", "typeName");
+ ComplexType complexTypeForNonexistingBaseType =
+ new ComplexType().setBaseType(new FullQualifiedName("wrong", "wrong"));
+ complexTypeForNonexistingBaseType.setName("typeName");
+ when(provider.getComplexType(typeWithNonexistingBaseTypeName)).thenReturn(complexTypeForNonexistingBaseType);
+ new EdmComplexTypeImpl(edm, typeWithNonexistingBaseTypeName, complexTypeForNonexistingBaseType);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/e8dccaf0/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/edm/provider/EdmEntityContainerImplTest.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/edm/provider/EdmEntityContainerImplTest.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/edm/provider/EdmEntityContainerImplTest.java
new file mode 100644
index 0000000..6c65b28
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/edm/provider/EdmEntityContainerImplTest.java
@@ -0,0 +1,205 @@
+/*******************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.server.core.edm.provider;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import org.apache.olingo.odata4.commons.api.ODataException;
+import org.apache.olingo.odata4.commons.api.edm.EdmActionImport;
+import org.apache.olingo.odata4.commons.api.edm.EdmEntityContainer;
+import org.apache.olingo.odata4.commons.api.edm.EdmEntitySet;
+import org.apache.olingo.odata4.commons.api.edm.EdmException;
+import org.apache.olingo.odata4.commons.api.edm.EdmFunctionImport;
+import org.apache.olingo.odata4.commons.api.edm.EdmSingleton;
+import org.apache.olingo.odata4.commons.api.edm.FullQualifiedName;
+import org.apache.olingo.odata4.server.api.edm.provider.ActionImport;
+import org.apache.olingo.odata4.server.api.edm.provider.EdmProvider;
+import org.apache.olingo.odata4.server.api.edm.provider.EntityContainerInfo;
+import org.apache.olingo.odata4.server.api.edm.provider.EntitySet;
+import org.apache.olingo.odata4.server.api.edm.provider.FunctionImport;
+import org.apache.olingo.odata4.server.api.edm.provider.Singleton;
+import org.junit.Before;
+import org.junit.Test;
+
+public class EdmEntityContainerImplTest {
+
+ EdmEntityContainer container;
+
+ @Before
+ public void setup() {
+ EdmProvider provider = new CustomProvider();
+ EdmProviderImpl edm = new EdmProviderImpl(provider);
+ EntityContainerInfo entityContainerInfo =
+ new EntityContainerInfo().setContainerName(new FullQualifiedName("space", "name"));
+ container = new EdmEntityContainerImpl(edm, provider, entityContainerInfo);
+ }
+
+ @Test
+ public void checkEdmExceptionConversion() throws Exception {
+ EdmProvider provider = mock(EdmProvider.class);
+ FullQualifiedName containerName = new FullQualifiedName("space", "name");
+ when(provider.getEntitySet(containerName, null)).thenThrow(new ODataException("msg"));
+ when(provider.getSingleton(containerName, null)).thenThrow(new ODataException("msg"));
+ when(provider.getFunctionImport(containerName, null)).thenThrow(new ODataException("msg"));
+ when(provider.getActionImport(containerName, null)).thenThrow(new ODataException("msg"));
+ EdmProviderImpl edm = new EdmProviderImpl(provider);
+ EntityContainerInfo entityContainerInfo =
+ new EntityContainerInfo().setContainerName(containerName);
+ EdmEntityContainer container = new EdmEntityContainerImpl(edm, provider, entityContainerInfo);
+ boolean thrown = false;
+ try {
+ container.getEntitySet(null);
+ } catch (EdmException e) {
+ thrown = true;
+ }
+ if (!thrown) {
+ fail("Expected EdmException not thrown");
+ }
+ try {
+ container.getSingleton(null);
+ } catch (EdmException e) {
+ thrown = true;
+ }
+ if (!thrown) {
+ fail("Expected EdmException not thrown");
+ }
+ try {
+ container.getActionImport(null);
+ } catch (EdmException e) {
+ thrown = true;
+ }
+ if (!thrown) {
+ fail("Expected EdmException not thrown");
+ }
+ try {
+ container.getFunctionImport(null);
+ } catch (EdmException e) {
+ thrown = true;
+ }
+ if (!thrown) {
+ fail("Expected EdmException not thrown");
+ }
+ }
+
+ @Test
+ public void simpleContainerGetter() {
+ assertEquals("name", container.getName());
+ assertEquals("space", container.getNamespace());
+ }
+
+ @Test
+ public void getExistingFunctionImport() {
+ EdmFunctionImport functionImport = container.getFunctionImport("functionImportName");
+ assertNotNull(functionImport);
+ assertEquals("functionImportName", functionImport.getName());
+ // Caching
+ assertTrue(functionImport == container.getFunctionImport("functionImportName"));
+ }
+
+ @Test
+ public void getNonExistingFunctionImport() {
+ assertNull(container.getFunctionImport(null));
+ }
+
+ @Test
+ public void getExistingActionImport() {
+ EdmActionImport actionImport = container.getActionImport("actionImportName");
+ assertNotNull(actionImport);
+ assertEquals("actionImportName", actionImport.getName());
+ // Caching
+ assertTrue(actionImport == container.getActionImport("actionImportName"));
+ }
+
+ @Test
+ public void getNonExistingActionImport() {
+ assertNull(container.getActionImport(null));
+ }
+
+ @Test
+ public void getExistingSingleton() {
+ EdmSingleton singleton = container.getSingleton("singletonName");
+ assertNotNull(singleton);
+ assertEquals("singletonName", singleton.getName());
+ // Caching
+ assertTrue(singleton == container.getSingleton("singletonName"));
+ }
+
+ @Test
+ public void getNonExistingSingleton() {
+ assertNull(container.getSingleton(null));
+ }
+
+ @Test
+ public void getExistingEntitySet() {
+ EdmEntitySet entitySet = container.getEntitySet("entitySetName");
+ assertNotNull(entitySet);
+ assertEquals("entitySetName", entitySet.getName());
+ // Caching
+ assertTrue(entitySet == container.getEntitySet("entitySetName"));
+ }
+
+ @Test
+ public void getNonExistingEntitySet() {
+ assertNull(container.getEntitySet(null));
+ }
+
+ private class CustomProvider extends EdmProvider {
+ @Override
+ public EntitySet getEntitySet(final FullQualifiedName entityContainer, final String entitySetName)
+ throws ODataException {
+ if (entitySetName != null) {
+ return new EntitySet().setName("entitySetName");
+ }
+ return null;
+ }
+
+ @Override
+ public Singleton getSingleton(final FullQualifiedName entityContainer, final String singletonName)
+ throws ODataException {
+ if (singletonName != null) {
+ return new Singleton().setName("singletonName");
+ }
+ return null;
+ }
+
+ @Override
+ public ActionImport getActionImport(final FullQualifiedName entityContainer, final String actionImportName)
+ throws ODataException {
+ if (actionImportName != null) {
+ return new ActionImport().setName("singletonName");
+ }
+ return null;
+ }
+
+ @Override
+ public FunctionImport getFunctionImport(final FullQualifiedName entityContainer, final String functionImportName)
+ throws ODataException {
+ if (functionImportName != null) {
+ return new FunctionImport().setName("singletonName");
+ }
+ return null;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/e8dccaf0/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/edm/provider/EdmEntitySetImplTest.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/edm/provider/EdmEntitySetImplTest.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/edm/provider/EdmEntitySetImplTest.java
new file mode 100644
index 0000000..58a7180
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/edm/provider/EdmEntitySetImplTest.java
@@ -0,0 +1,81 @@
+/*******************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ ******************************************************************************/
+package org.apache.olingo.odata4.server.core.edm.provider;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import java.util.Arrays;
+
+import org.apache.olingo.odata4.commons.api.edm.EdmBindingTarget;
+import org.apache.olingo.odata4.commons.api.edm.EdmEntityContainer;
+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.FullQualifiedName;
+import org.apache.olingo.odata4.server.api.edm.provider.EdmProvider;
+import org.apache.olingo.odata4.server.api.edm.provider.EntityContainerInfo;
+import org.apache.olingo.odata4.server.api.edm.provider.EntitySet;
+import org.apache.olingo.odata4.server.api.edm.provider.EntityType;
+import org.apache.olingo.odata4.server.api.edm.provider.NavigationPropertyBinding;
+import org.apache.olingo.odata4.server.api.edm.provider.PropertyRef;
+import org.apache.olingo.odata4.server.api.edm.provider.Target;
+import org.junit.Test;
+
+public class EdmEntitySetImplTest {
+
+ @Test
+ public void entitySet() throws Exception {
+ EdmProvider provider = mock(EdmProvider.class);
+ EdmProviderImpl edm = new EdmProviderImpl(provider);
+
+ final FullQualifiedName typeName = new FullQualifiedName("ns", "entityType");
+ final EntityType entityTypeProvider = new EntityType()
+ .setName(typeName.getName())
+ .setKey(Arrays.asList(new PropertyRef().setPropertyName("Id")));
+ when(provider.getEntityType(typeName)).thenReturn(entityTypeProvider);
+
+ final FullQualifiedName containerName = new FullQualifiedName("ns", "container");
+ final EntityContainerInfo containerInfo = new EntityContainerInfo().setContainerName(containerName);
+ when(provider.getEntityContainerInfo(containerName)).thenReturn(containerInfo);
+ final EdmEntityContainer entityContainer = new EdmEntityContainerImpl(edm, provider, containerInfo);
+
+ final String entitySetName = "entitySet";
+ final EntitySet entitySetProvider = new EntitySet()
+ .setName(entitySetName)
+ .setType(typeName)
+ .setIncludeInServiceDocument(true)
+ .setNavigationPropertyBindings(Arrays.asList(
+ new NavigationPropertyBinding().setPath("path")
+ .setTarget(new Target().setEntityContainer(containerName).setTargetName(entitySetName))));
+ when(provider.getEntitySet(containerName, entitySetName)).thenReturn(entitySetProvider);
+
+ final EdmEntitySet entitySet = new EdmEntitySetImpl(edm, entityContainer, entitySetProvider);
+ assertEquals(entitySetName, entityContainer.getEntitySet(entitySetName).getName());
+ assertEquals(entitySetName, entitySet.getName());
+ final EdmEntityType entityType = entitySet.getEntityType();
+ assertEquals(typeName.getNamespace(), entityType.getNamespace());
+ assertEquals(typeName.getName(), entityType.getName());
+ assertEquals(entityContainer, entitySet.getEntityContainer());
+ assertNull(entitySet.getRelatedBindingTarget(null));
+ final EdmBindingTarget target = entitySet.getRelatedBindingTarget("path");
+ assertEquals(entitySetName, target.getName());
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-olingo-odata4/blob/e8dccaf0/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/edm/provider/EdmEntitySetInfoImplTest.java
----------------------------------------------------------------------
diff --git a/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/edm/provider/EdmEntitySetInfoImplTest.java b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/edm/provider/EdmEntitySetInfoImplTest.java
new file mode 100644
index 0000000..bbf3dd5
--- /dev/null
+++ b/odata4-lib/odata4-server-core/src/test/java/org/apache/olingo/odata4/server/core/edm/provider/EdmEntitySetInfoImplTest.java
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.server.core.edm.provider;
+
+import static org.junit.Assert.assertEquals;
+
+import org.apache.olingo.odata4.commons.api.edm.EdmEntitySetInfo;
+import org.apache.olingo.odata4.commons.api.edm.EdmException;
+import org.apache.olingo.odata4.server.api.edm.provider.EntityContainer;
+import org.apache.olingo.odata4.server.api.edm.provider.EntitySet;
+import org.junit.Test;
+
+public class EdmEntitySetInfoImplTest {
+
+ @Test
+ public void entitySetTest() {
+ EntitySet providerEntitySet = new EntitySet().setName("name");
+ EntityContainer providerContainer = new EntityContainer().setName("container");
+
+ EdmEntitySetInfo info = new EdmEntitySetInfoImpl(providerContainer, providerEntitySet);
+
+ assertEquals("name", info.getEntitySetName());
+ assertEquals("container", info.getEntityContainerName());
+ }
+
+ @Test(expected = EdmException.class)
+ public void getUriTest() {
+ EntitySet providerEntitySet = new EntitySet().setName("name");
+ EntityContainer providerContainer = new EntityContainer().setName("container");
+
+ EdmEntitySetInfo info = new EdmEntitySetInfoImpl(providerContainer, providerEntitySet);
+ info.getEntitySetUri();
+ }
+
+}