You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@knox.apache.org by "Kevin Minder (JIRA)" <ji...@apache.org> on 2014/10/16 16:41:39 UTC
[jira] [Updated] (KNOX-447) Incorrect parsing and expansion of
valueless query params
[ https://issues.apache.org/jira/browse/KNOX-447?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Kevin Minder updated KNOX-447:
------------------------------
Description:
Parser.parse produces a result with Query object that contains an array of one null value which is incorrect.
@Test
public void testValuelessQueryParamParsingAndExpansion() throws Exception {
URI inputUri, outputUri;
Matcher<Void> matcher;
Matcher<Void>.Match match;
Template input, pattern, template;
Evaluator evaluator;
inputUri = new URI( "https://knoxHost:8443/gateway/knoxTopo/templeton/v1/?version/hive" );
input = Parser.parse( inputUri.toString() );
pattern = Parser.parse( "*://*:*/**/templeton/v1/?{**}" );
template = Parser.parse( "{$serviceUrl[WEBHCAT]}/v1/?{**}" );
matcher = new Matcher<Void>();
matcher.add( pattern, null );
match = matcher.match( input );
evaluator = new Evaluator() {
@Override
public List<String> evaluate( String function, List<String> parameters ) {
return Arrays.asList( "https://webhcatTestHost.com:50111/templeton" );
}
};
outputUri = Expander.expand( template, match.getParams(), evaluator );
assertThat(
outputUri.toString(),
equalToIgnoringCase( "https://webhcatTestHost.com:50111/templeton/v1/?version/hive" ) );
}
was:
@Test
public void testValuelessQueryParamParsingAndExpansion() throws Exception {
URI inputUri, outputUri;
Matcher<Void> matcher;
Matcher<Void>.Match match;
Template input, pattern, template;
Evaluator evaluator;
inputUri = new URI( "https://knoxHost:8443/gateway/knoxTopo/templeton/v1/?version/hive" );
input = Parser.parse( inputUri.toString() );
pattern = Parser.parse( "*://*:*/**/templeton/v1/?{**}" );
template = Parser.parse( "{$serviceUrl[WEBHCAT]}/v1/?{**}" );
matcher = new Matcher<Void>();
matcher.add( pattern, null );
match = matcher.match( input );
evaluator = new Evaluator() {
@Override
public List<String> evaluate( String function, List<String> parameters ) {
return Arrays.asList( "https://webhcatTestHost.com:50111/templeton" );
}
};
outputUri = Expander.expand( template, match.getParams(), evaluator );
assertThat(
outputUri.toString(),
equalToIgnoringCase( "https://webhcatTestHost.com:50111/templeton/v1/?version/hive" ) );
}
> Incorrect parsing and expansion of valueless query params
> ----------------------------------------------------------
>
> Key: KNOX-447
> URL: https://issues.apache.org/jira/browse/KNOX-447
> Project: Apache Knox
> Issue Type: Bug
> Components: Server
> Affects Versions: 0.4.0
> Reporter: Kevin Minder
> Fix For: 0.5.0
>
>
> Parser.parse produces a result with Query object that contains an array of one null value which is incorrect.
> @Test
> public void testValuelessQueryParamParsingAndExpansion() throws Exception {
> URI inputUri, outputUri;
> Matcher<Void> matcher;
> Matcher<Void>.Match match;
> Template input, pattern, template;
> Evaluator evaluator;
> inputUri = new URI( "https://knoxHost:8443/gateway/knoxTopo/templeton/v1/?version/hive" );
> input = Parser.parse( inputUri.toString() );
> pattern = Parser.parse( "*://*:*/**/templeton/v1/?{**}" );
> template = Parser.parse( "{$serviceUrl[WEBHCAT]}/v1/?{**}" );
> matcher = new Matcher<Void>();
> matcher.add( pattern, null );
> match = matcher.match( input );
> evaluator = new Evaluator() {
> @Override
> public List<String> evaluate( String function, List<String> parameters ) {
> return Arrays.asList( "https://webhcatTestHost.com:50111/templeton" );
> }
> };
> outputUri = Expander.expand( template, match.getParams(), evaluator );
> assertThat(
> outputUri.toString(),
> equalToIgnoringCase( "https://webhcatTestHost.com:50111/templeton/v1/?version/hive" ) );
> }
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)