[OLINGO-917] Fix $entity request handling

This is a contribution from Ramya in
https://issues.apache.org/jira/browse/OLINGO-917
This commit is contained in:
Christian Amend 2016-11-22 14:17:59 +01:00
parent 84a052dcfa
commit 6a736db10c
19 changed files with 203 additions and 55 deletions

View File

@ -90,7 +90,7 @@ public class ServiceDispatcher extends RequestURLHierarchyVisitor {
executeIdOption(query, odRequest, odResponse);
} else {
UriInfo uriInfo = new Parser(this.metadata.getEdm(), odata)
.parseUri(path, query, null);
.parseUri(path, query, null, odRequest.getRawBaseUri());
contentType = ContentNegotiator.doContentNegotiation(uriInfo.getFormatOption(),
odRequest, this.customContentSupport, RepresentationType.ERROR);

View File

@ -340,7 +340,8 @@ public abstract class ServiceRequest {
rawPath = rawPath.substring(e+path.length());
}
UriInfo uriInfo = new Parser(serviceMetadata.getEdm(), odata).parseUri(rawPath, uri.getQuery(), null);
UriInfo uriInfo = new Parser(serviceMetadata.getEdm(), odata).parseUri(rawPath, uri.getQuery(), null,
getODataRequest().getRawBaseUri());
ServiceDispatcher dispatcher = new ServiceDispatcher(odata, serviceMetadata, null, customContentType);
dispatcher.visit(uriInfo);
dispatcher.request.setUriInfo(uriInfo);

View File

@ -109,6 +109,7 @@ public class ODataDispatcher {
break;
case resource:
case entityId:
handleResourceDispatching(request, response);
break;

View File

@ -136,7 +136,7 @@ public class ODataHandlerImpl implements ODataHandler {
final int measurementUriParser = debugger.startRuntimeMeasurement("Parser", "parseUri");
try {
uriInfo = new Parser(serviceMetadata.getEdm(), odata)
.parseUri(request.getRawODataPath(), request.getRawQueryPath(), null);
.parseUri(request.getRawODataPath(), request.getRawQueryPath(), null, request.getRawBaseUri());
} catch (final ODataLibraryException e) {
debugger.stopRuntimeMeasurement(measurementUriParser);
debugger.stopRuntimeMeasurement(measurementHandle);

View File

@ -146,7 +146,7 @@ public class UriHelperImpl implements UriHelper {
try {
final List<UriResource> uriResourceParts =
new Parser(edm, new ODataImpl()).parseUri(oDataPath, null, null).getUriResourceParts();
new Parser(edm, new ODataImpl()).parseUri(oDataPath, null, null, rawServiceRoot).getUriResourceParts();
if (uriResourceParts.size() == 1 && uriResourceParts.get(0).getKind() == UriResourceKind.entitySet) {
final UriResourceEntitySet entityUriResource = (UriResourceEntitySet) uriResourceParts.get(0);

View File

@ -78,6 +78,8 @@ public class Parser {
private static final String DOLLAR = "$";
private static final String AT = "@";
private static final String NULL = "null";
private static final String ENTITY = "$entity";
private static final String HTTP = "http";
private final Edm edm;
private final OData odata;
@ -87,7 +89,7 @@ public class Parser {
this.odata = odata;
}
public UriInfo parseUri(final String path, final String query, final String fragment)
public UriInfo parseUri(final String path, final String query, final String fragment, String baseUri)
throws UriParserException, UriValidationException {
UriInfoImpl contextUriInfo = new UriInfoImpl();
@ -149,16 +151,55 @@ public class Parser {
contextIsCollection = true;
} else if (firstSegment.equals("$entity")) {
contextUriInfo.setKind(UriInfoKind.entityId);
if (numberOfSegments > 1) {
final String typeCastSegment = pathSegmentsDecoded.get(1);
ensureLastSegment(typeCastSegment, 2, numberOfSegments);
contextType = new ResourcePathParser(edm, contextUriInfo.getAliasMap())
.parseDollarEntityTypeCast(typeCastSegment);
contextUriInfo.setEntityTypeCast((EdmEntityType) contextType);
if (null != contextUriInfo.getIdOption()) {
String idOptionText = contextUriInfo.getIdOption().getText();
if (idOptionText.startsWith(HTTP)) {
baseUri = UriDecoder.decode(baseUri);
if (idOptionText.contains(baseUri)) {
idOptionText = idOptionText.substring(baseUri.length() + 1);
} else {
throw new UriParserSemanticException("$id cannot have an absolute path",
UriParserSemanticException.MessageKeys.NOT_IMPLEMENTED_SYSTEM_QUERY_OPTION);
}
}
if (numberOfSegments > 1) {
/**
* If url is of the form
* http://localhost:8080/odata-server-tecsvc/odata.svc/$entity/
* olingo.odata.test1.ETAllPrim?$id=ESAllPrim(32767)
*/
final ResourcePathParser resourcePathParser = new ResourcePathParser
(edm, contextUriInfo.getAliasMap());
String typeCastSegment = pathSegmentsDecoded.get(1);
ensureLastSegment(typeCastSegment, 2, numberOfSegments);
contextType = resourcePathParser.parseDollarEntityTypeCast(typeCastSegment);
contextUriInfo = (UriInfoImpl) new Parser(edm, odata).
parseUri("/" + idOptionText, query, fragment, baseUri);
contextUriInfo.setEntityTypeCast((EdmEntityType) contextType);
} else if (numberOfSegments == 1) {
/**
* If url is of the form
* http://localhost:8080/odata-server-tecsvc/odata.svc/$entity?$id=ESAllPrim(32527)
*/
contextUriInfo = (UriInfoImpl) new Parser(edm, odata).
parseUri("/" + idOptionText, query, fragment, baseUri);
}
contextType = contextUriInfo.getEntityTypeCast();
contextUriInfo.setKind(UriInfoKind.entityId);
contextIsCollection = false;
} else {
/**
* If url is of the form
* http://localhost:8080/odata-server-tecsvc/odata.svc/$entity/olingo.odata.test1.ETKeyNav/$ref
*/
ensureLastSegment(firstSegment, 2, numberOfSegments);
/**
* If url is of the form
* http://localhost:8080/odata-server-tecsvc/odata.svc/$entity/olingo.odata.test1.ETKeyNav
*/
throw new UriParserSyntaxException("The entity-id MUST be specified using the system query option $id",
UriParserSyntaxException.MessageKeys.ENTITYID_MISSING_SYSTEM_QUERY_OPTION_ID);
}
contextIsCollection = false;
} else if (firstSegment.startsWith("$crossjoin")) {
ensureLastSegment(firstSegment, 1, numberOfSegments);
contextUriInfo.setKind(UriInfoKind.crossjoin);
@ -176,35 +217,49 @@ public class Parser {
UriResource lastSegment = null;
for (final String pathSegment : pathSegmentsDecoded) {
count++;
final UriResource segment = resourcePathParser.parsePathSegment(pathSegment, lastSegment);
if (segment != null) {
if (segment instanceof UriResourceCount
|| segment instanceof UriResourceRef
|| segment instanceof UriResourceValue) {
ensureLastSegment(pathSegment, count, numberOfSegments);
} else if (segment instanceof UriResourceAction
|| segment instanceof UriResourceFunction
&& !((UriResourceFunction) segment).getFunction().isComposable()) {
if (count < numberOfSegments) {
throw new UriValidationException(
"The segment of an action or of a non-composable function must be the last resource-path segment.",
UriValidationException.MessageKeys.UNALLOWED_RESOURCE_PATH,
pathSegmentsDecoded.get(count));
if (pathSegment.startsWith(ENTITY)) {
/**
* If url is of the form
* http://localhost:8080/odata-server-tecsvc/odata.svc/ESAllPrim/$entity
*/
throw new UriParserSyntaxException("The entity-id MUST be specified using the system query option $id",
UriParserSyntaxException.MessageKeys.ENTITYID_MISSING_SYSTEM_QUERY_OPTION_ID);
} else {
final UriResource segment = resourcePathParser.parsePathSegment(pathSegment, lastSegment);
if (segment != null) {
if (segment instanceof UriResourceCount
|| segment instanceof UriResourceRef
|| segment instanceof UriResourceValue) {
ensureLastSegment(pathSegment, count, numberOfSegments);
} else if (segment instanceof UriResourceAction
|| segment instanceof UriResourceFunction
&& !((UriResourceFunction) segment).getFunction().isComposable()) {
if (count < numberOfSegments) {
throw new UriValidationException(
"The segment of an action or of a non-composable function must be the last resource-path segment.",
UriValidationException.MessageKeys.UNALLOWED_RESOURCE_PATH,
pathSegmentsDecoded.get(count));
}
lastSegment = segment;
} else if (segment instanceof UriResourceStartingTypeFilterImpl) {
throw new UriParserSemanticException("First resource-path segment must not be namespace-qualified.",
UriParserSemanticException.MessageKeys.NAMESPACE_NOT_ALLOWED_AT_FIRST_ELEMENT);
} else {
lastSegment = segment;
}
lastSegment = segment;
} else if (segment instanceof UriResourceStartingTypeFilterImpl) {
throw new UriParserSemanticException("First resource-path segment must not be namespace-qualified.",
UriParserSemanticException.MessageKeys.NAMESPACE_NOT_ALLOWED_AT_FIRST_ELEMENT);
} else {
lastSegment = segment;
contextUriInfo.addResourcePart(segment);
}
contextUriInfo.addResourcePart(segment);
}
}
if (lastSegment instanceof UriResourcePartTyped) {
final UriResourcePartTyped typed = (UriResourcePartTyped) lastSegment;
contextType = ParserHelper.getTypeInformation(typed);
if (contextUriInfo.getIdOption() != null && contextType != null) {
if (contextType instanceof EdmEntityType) {
contextUriInfo.setEntityTypeCast((EdmEntityType) contextType);
}
}
contextIsCollection = typed.isCollection();
}
}

View File

@ -78,7 +78,7 @@ public class UriDecoder {
return list;
}
private static String decode(final String encoded) throws UriParserSyntaxException {
public static String decode(final String encoded) throws UriParserSyntaxException {
try {
return Decoder.decode(encoded);
} catch (final IllegalArgumentException e) {

View File

@ -75,7 +75,9 @@ public class UriParserSemanticException extends UriParserException {
ONLY_FOR_PRIMITIVE_TYPES,
/** parameter: function name */
FUNCTION_MUST_USE_COLLECTIONS,
COLLECTION_NOT_ALLOWED;
COLLECTION_NOT_ALLOWED,
/** parameter: not implemented part for system query option $id */
NOT_IMPLEMENTED_SYSTEM_QUERY_OPTION;
@Override
public String getKey() {

View File

@ -37,7 +37,9 @@ public class UriParserSyntaxException extends UriParserException {
SYSTEM_QUERY_OPTION_LEVELS_NOT_ALLOWED_HERE,
SYNTAX,
/** parameter: alias name */
DUPLICATED_ALIAS;
DUPLICATED_ALIAS,
/**Entity id must be followed by system query option id */
ENTITYID_MISSING_SYSTEM_QUERY_OPTION_ID;
@Override
public String getKey() {

View File

@ -36,6 +36,7 @@ UriParserSyntaxException.WRONG_VALUE_FOR_SYSTEM_QUERY_OPTION_FORMAT=The system q
UriParserSyntaxException.SYSTEM_QUERY_OPTION_LEVELS_NOT_ALLOWED_HERE=The system query option '$levels' is not allowed here.
UriParserSyntaxException.SYNTAX=The URI is malformed.
UriParserSyntaxException.DUPLICATED_ALIAS=Duplicated alias. An alias '%1$s' was already specified!.
UriParserSyntaxException.ENTITYID_MISSING_SYSTEM_QUERY_OPTION_ID=The entity-id must be specified using the system query option $id.
SearchParserException.NO_EXPRESSION_FOUND=No expression found.
SearchParserException.TOKENIZER_EXCEPTION=Exception during tokenizer creation with message '%1$s'.
@ -77,6 +78,7 @@ UriParserSemanticException.IS_PROPERTY=The identifier '%1$s' is already used as
UriParserSemanticException.ONLY_FOR_PRIMITIVE_TYPES='%1$s' is only allowed for primitive-type expressions.
UriParserSemanticException.FUNCTION_MUST_USE_COLLECTIONS=Only bound functions with collections of structural types as binding parameter and as return type are allowed; '%1$s' is not such a function.
UriParserSemanticException.COLLECTION_NOT_ALLOWED=A collection expression is not allowed.
UriParserSemanticException.NOT_IMPLEMENTED_SYSTEM_QUERY_OPTION=$id with absolute url different from base url is not implemented!
UriValidationException.UNSUPPORTED_QUERY_OPTION=The query option '%1$s' is not supported.
UriValidationException.UNSUPPORTED_URI_KIND=The URI kind '%1$s' is not supported.

View File

@ -250,7 +250,7 @@ public abstract class TechnicalProcessor implements Processor {
}
protected void validateOptions(final UriInfoResource uriInfo) throws ODataApplicationException {
if (uriInfo.getIdOption() != null || uriInfo.getApplyOption() != null) {
if (uriInfo.getApplyOption() != null) {
throw new ODataApplicationException("Not all of the specified options are supported.",
HttpStatusCode.NOT_IMPLEMENTED.getStatusCode(), Locale.ROOT);
}

View File

@ -141,7 +141,7 @@ public class PreconditionsValidatorTest {
@Test
public void simpleEntityValueValidationNotActiveForMedia() throws Exception {
final UriInfo uriInfo = new Parser(edm, odata).parseUri("ESMedia(1)/$value", null, null);
final UriInfo uriInfo = new Parser(edm, odata).parseUri("ESMedia(1)/$value", null, null, null);
CustomETagSupport support = mock(CustomETagSupport.class);
when(support.hasETag(any(EdmBindingTarget.class))).thenReturn(true);
@ -193,7 +193,7 @@ public class PreconditionsValidatorTest {
private boolean mustValidate(final String uri, final String entitySetName)
throws UriParserException, UriValidationException, PreconditionException {
final UriInfo uriInfo = new Parser(edm, odata).parseUri(uri, null, null);
final UriInfo uriInfo = new Parser(edm, odata).parseUri(uri, null, null, null);
final List<UriResource> parts = uriInfo.getUriResourceParts();
final boolean isMedia = parts.size() >= 2
&& parts.get(parts.size() - 1) instanceof UriResourceValue

View File

@ -498,7 +498,7 @@ public class ApplyParserTest {
private ApplyValidator parse(final String path, final String apply)
throws UriParserException, UriValidationException {
final UriInfo uriInfo = new Parser(edm, odata).parseUri(path, "$apply=" + apply, null);
final UriInfo uriInfo = new Parser(edm, odata).parseUri(path, "$apply=" + apply, null, null);
return new ApplyValidator(uriInfo.getApplyOption());
}

View File

@ -252,7 +252,7 @@ public class ExpandParserTest {
@Test
public void expandNavigationApplyOption() throws Exception {
UriInfo uriInfo = new Parser(edm, oData).parseUri("ESTwoKeyNav",
"$expand=NavPropertyETKeyNavMany($apply=identity),NavPropertyETKeyNavOne", null);
"$expand=NavPropertyETKeyNavMany($apply=identity),NavPropertyETKeyNavOne", null, null);
Assert.assertEquals(ApplyItem.Kind.IDENTITY,
uriInfo.getExpandOption().getExpandItems().get(0).getApplyOption().getApplyItems().get(0).getKind());
Assert.assertEquals("NavPropertyETKeyNavOne",
@ -260,7 +260,7 @@ public class ExpandParserTest {
.getResourcePath().getUriResourceParts().get(0).getSegmentValue());
uriInfo = new Parser(edm, oData).parseUri("ESTwoKeyNav",
"$expand=NavPropertyETKeyNavMany($apply=aggregate(PropertyInt16 with sum as s))", null);
"$expand=NavPropertyETKeyNavMany($apply=aggregate(PropertyInt16 with sum as s))", null, null);
final ApplyItem applyItem =
uriInfo.getExpandOption().getExpandItems().get(0).getApplyOption().getApplyItems().get(0);
Assert.assertEquals(ApplyItem.Kind.AGGREGATE, applyItem.getKind());

View File

@ -71,7 +71,9 @@ public class UriParserTest {
testUri.runEx("$all/$ref").isExSyntax(UriParserSyntaxException.MessageKeys.MUST_BE_LAST_SEGMENT);
testUri.runEx("$entity/olingo.odata.test1.ETKeyNav/$ref")
.isExSyntax(UriParserSyntaxException.MessageKeys.MUST_BE_LAST_SEGMENT);
testUri.runEx("$entity/olingo.odata.test1.ETKeyNav")
.isExSyntax(UriParserSyntaxException.MessageKeys.ENTITYID_MISSING_SYSTEM_QUERY_OPTION_ID);
testUri.runEx("$wrong").isExSyntax(UriParserSyntaxException.MessageKeys.SYNTAX);
testUri.runEx("", "$wrong").isExSyntax(UriParserSyntaxException.MessageKeys.UNKNOWN_SYSTEM_QUERY_OPTION);
@ -252,6 +254,78 @@ public class UriParserTest {
.isEntityType(EntityTypeProvider.nameETBase)
.isIdText("ESTwoPrim(1)")
.goExpand().first().isSegmentStar();
try {
testUri.run("$entity/olingo.odata.test1.ETAllNullable")
.isKind(UriInfoKind.entityId)
.isEntityType(EntityTypeProvider.nameETAllNullable);
} catch (UriParserSyntaxException e) {
testUri.isExSyntax(UriParserSyntaxException.MessageKeys.ENTITYID_MISSING_SYSTEM_QUERY_OPTION_ID);
}
testUri.run("$entity/Namespace1_Alias.ETAllPrim", "$id=ESAllPrim(32767)")
.isKind(UriInfoKind.entityId)
.isEntityType(EntityTypeProvider.nameETAllPrim)
.isIdText("ESAllPrim(32767)");
try {
testUri.run("ESAllPrim/$entity")
.isKind(UriInfoKind.resource);
} catch (UriParserSyntaxException e) {
testUri.isExSyntax(UriParserSyntaxException.MessageKeys.ENTITYID_MISSING_SYSTEM_QUERY_OPTION_ID);
}
try {
testUri.run("ESAllPrim(32767)/NavPropertyETTwoPrimOne/$entity")
.isKind(UriInfoKind.resource);
} catch(UriParserSyntaxException e) {
testUri.isExSyntax(UriParserSyntaxException.MessageKeys.ENTITYID_MISSING_SYSTEM_QUERY_OPTION_ID);
}
testUri.run("$entity", "$id=ESAllPrim(32767)/NavPropertyETTwoPrimOne")
.isKind(UriInfoKind.entityId)
.isEntityType(EntityTypeProvider.nameETTwoPrim)
.isIdText("ESAllPrim(32767)/NavPropertyETTwoPrimOne");
testUri.run("$entity", "$id=ESAllPrim(32767)", "$select=PropertyString", null)
.isKind(UriInfoKind.entityId)
.isEntityType(EntityTypeProvider.nameETAllPrim)
.isIdText("ESAllPrim(32767)");
testUri.run("$entity", "$id=ESAllPrim(32767)", "$expand=NavPropertyETTwoPrimOne", null)
.isKind(UriInfoKind.entityId)
.isEntityType(EntityTypeProvider.nameETAllPrim)
.isIdText("ESAllPrim(32767)");
testUri.run("$entity", "$id=http://localhost:8080/odata-server-tecsvc/odata.svc/"
+ "ESAllPrim(32767)/NavPropertyETTwoPrimOne", null,
"http://localhost:8080/odata-server-tecsvc/odata.svc")
.isKind(UriInfoKind.entityId)
.isEntityType(EntityTypeProvider.nameETTwoPrim)
.isIdText("http://localhost:8080/odata-server-tecsvc/odata.svc/"
+ "ESAllPrim(32767)/NavPropertyETTwoPrimOne");
try {
testUri.run("$entity/olingo.odata.test1.ETKeyNav", "$id=http://localhost:90/tecsvc/ESKeyNav(1)",
null, "http://localhost:80/tecsvc")
.isKind(UriInfoKind.entityId)
.isEntityType(EntityTypeProvider.nameETKeyNav)
.isIdText("http://localhost:90/tecsvc/ESKeyNav(1)");
} catch (UriParserSemanticException e) {
testUri.isExSemantic(UriParserSemanticException.MessageKeys.NOT_IMPLEMENTED_SYSTEM_QUERY_OPTION);
}
try {
testUri.run("$entity/olingo.odata.test1.ETKeyNav", "$id=http://localhost:90/tecs%27v; c/ESKeyNav(1)",
null, "http://localhost:80/tecs%27v; c")
.isKind(UriInfoKind.entityId)
.isEntityType(EntityTypeProvider.nameETKeyNav)
.isIdText("http://localhost:90/tecs%27v; c/ESKeyNav(1)");
} catch (UriParserSemanticException e) {
testUri.isExSemantic(UriParserSemanticException.MessageKeys.NOT_IMPLEMENTED_SYSTEM_QUERY_OPTION);
}
testUri.run("$entity/olingo.odata.test1.ETKeyNav", "$id=http://localhost:90/tecs%27v%20c/ESKeyNav(1)",
null, "http://localhost:90/tecs%27v%20c")
.isKind(UriInfoKind.entityId)
.isEntityType(EntityTypeProvider.nameETKeyNav);
String idOption = UriDecoder.decode("http://localhost:90/tecs%27v%20c/ESKeyNav(1)");
testUri.isIdText(idOption);
testUri.run("$entity/olingo.odata.test1.ETKeyNav", "$id=http://localhost:90/tecs'v c/ESKeyNav(1)",
null, "http://localhost:90/tecs'v c")
.isKind(UriInfoKind.entityId)
.isEntityType(EntityTypeProvider.nameETKeyNav)
.isIdText("http://localhost:90/tecs'v c/ESKeyNav(1)");
}
@Test

View File

@ -168,7 +168,7 @@ public class FilterValidator implements TestValidator {
public FilterValidator runUri(final String path, final String query)
throws UriParserException, UriValidationException {
final UriInfo uriInfo = new Parser(edm, odata).parseUri(path, query, null);
final UriInfo uriInfo = new Parser(edm, odata).parseUri(path, query, null, null);
assertTrue("Filtervalidator can only be used on resourcePaths", uriInfo.getKind() == UriInfoKind.resource);
setFilter(uriInfo.getFilterOption());
curExpression = filter.getExpression();
@ -181,7 +181,7 @@ public class FilterValidator implements TestValidator {
public FilterValidator runUriOrderBy(final String path, final String query)
throws UriParserException, UriValidationException {
final UriInfo uriInfo = new Parser(edm, odata).parseUri(path, query, null);
final UriInfo uriInfo = new Parser(edm, odata).parseUri(path, query, null, null);
assertTrue("Filtervalidator can only be used on resourcePaths", uriInfo.getKind() == UriInfoKind.resource);
orderBy = uriInfo.getOrderByOption();
return this;

View File

@ -83,7 +83,7 @@ public class ResourceValidator implements TestValidator {
public ResourceValidator run(final String path) {
UriInfo uriInfoTmp = null;
try {
uriInfoTmp = new Parser(edm, odata).parseUri(path, null, null);
uriInfoTmp = new Parser(edm, odata).parseUri(path, null, null, null);
} catch (final ODataLibraryException e) {
fail("Exception occurred while parsing the URI: " + path + "\n"
+ " Message: " + e.getMessage());

View File

@ -59,17 +59,28 @@ public class TestUriValidator implements TestValidator {
// Execution
public TestUriValidator run(final String path) throws UriParserException, UriValidationException {
return run(path, null, null);
return run(path, null, null, null);
}
public TestUriValidator run(final String path, final String query)
throws UriParserException, UriValidationException {
return run(path, query, null);
return run(path, query, null, null);
}
public TestUriValidator run(final String path, final String query, final String fragment, final String baseUri)
throws UriParserException, UriValidationException {
try {
uriInfo = new Parser(edm, odata).parseUri(path, query, fragment, baseUri);
new UriValidator().validate(uriInfo, HttpMethod.GET);
return this;
} catch (UriParserException e) {
exception = e;
throw e;
}
}
public TestUriValidator run(final String path, final String query, final String fragment)
throws UriParserException, UriValidationException {
uriInfo = new Parser(edm, odata).parseUri(path, query, fragment);
uriInfo = new Parser(edm, odata).parseUri(path, query, fragment, null);
new UriValidator().validate(uriInfo, HttpMethod.GET);
return this;
}
@ -81,7 +92,7 @@ public class TestUriValidator implements TestValidator {
public TestUriValidator runEx(final String path, final String query) {
uriInfo = null;
try {
run(path, query, null);
run(path, query, null, null);
fail("Exception expected");
} catch (UriParserException e) {
exception = e;

View File

@ -467,7 +467,7 @@ public class UriValidatorTest {
private void validate(final String path, final String query, final HttpMethod method) {
try {
new UriValidator().validate(new Parser(edm, odata).parseUri(path, query, null), method);
new UriValidator().validate(new Parser(edm, odata).parseUri(path, query, null, null), method);
} catch (final UriParserException e) {
fail("Failed for " + method + " on URI: " + path + '?' + query);
} catch (final UriValidationException e) {
@ -478,7 +478,7 @@ public class UriValidatorTest {
private void validateWrong(final String path, final String query, final HttpMethod method,
final UriValidationException.MessageKeys expectedMessageKey) {
try {
new UriValidator().validate(new Parser(edm, odata).parseUri(path, query, null), method);
new UriValidator().validate(new Parser(edm, odata).parseUri(path, query, null, null), method);
fail("Validation Exception not thrown: " + method + ' ' + path + '?' + query);
} catch (final UriParserException e) {
fail("Wrong Exception thrown: " + method + ' ' + path + '?' + query);