You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@knox.apache.org by lm...@apache.org on 2016/07/21 19:14:57 UTC
knox git commit: KNOX-726 - Clean up Skipped Unit Tests
Repository: knox
Updated Branches:
refs/heads/master b8fc0d77c -> 5750a7cd9
KNOX-726 - Clean up Skipped Unit Tests
Project: http://git-wip-us.apache.org/repos/asf/knox/repo
Commit: http://git-wip-us.apache.org/repos/asf/knox/commit/5750a7cd
Tree: http://git-wip-us.apache.org/repos/asf/knox/tree/5750a7cd
Diff: http://git-wip-us.apache.org/repos/asf/knox/diff/5750a7cd
Branch: refs/heads/master
Commit: 5750a7cd9931c64fc65d116f2718df3d6c173d45
Parents: b8fc0d7
Author: Larry McCay <lm...@hortonworks.com>
Authored: Thu Jul 21 15:14:27 2016 -0400
Committer: Larry McCay <lm...@hortonworks.com>
Committed: Thu Jul 21 15:14:27 2016 -0400
----------------------------------------------------------------------
.../UrlRewriteServletContextListenerTest.java | 10 +-
.../api/UrlRewriteServletFilterTest.java | 126 ++++++++---------
.../hadoop/gateway/audit/JdbmQueueTest.java | 134 +++++++++----------
.../gateway/util/urltemplate/RewriterTest.java | 102 +++++++-------
4 files changed, 186 insertions(+), 186 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/knox/blob/5750a7cd/gateway-provider-rewrite/src/test/java/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteServletContextListenerTest.java
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/test/java/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteServletContextListenerTest.java b/gateway-provider-rewrite/src/test/java/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteServletContextListenerTest.java
index 09584e8..a7b8481 100644
--- a/gateway-provider-rewrite/src/test/java/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteServletContextListenerTest.java
+++ b/gateway-provider-rewrite/src/test/java/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteServletContextListenerTest.java
@@ -82,10 +82,10 @@ public class UrlRewriteServletContextListenerTest {
server.stop();
}
- @Test
- @Ignore("TODO")
- public void testProvider() throws Exception {
- fail( "TODO" );
- }
+// @Test
+// @Ignore("TODO")
+// public void testProvider() throws Exception {
+// fail( "TODO" );
+// }
}
http://git-wip-us.apache.org/repos/asf/knox/blob/5750a7cd/gateway-provider-rewrite/src/test/java/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteServletFilterTest.java
----------------------------------------------------------------------
diff --git a/gateway-provider-rewrite/src/test/java/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteServletFilterTest.java b/gateway-provider-rewrite/src/test/java/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteServletFilterTest.java
index fc544e9..8167d55 100644
--- a/gateway-provider-rewrite/src/test/java/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteServletFilterTest.java
+++ b/gateway-provider-rewrite/src/test/java/org/apache/hadoop/gateway/filter/rewrite/api/UrlRewriteServletFilterTest.java
@@ -184,59 +184,59 @@ public class UrlRewriteServletFilterTest {
assertThat( response.get( HttpHeader.LOCATION ), is( "http://mock-host:1/test-output-path-1" ) );
}
- @Ignore( "Need to figure out how to handle cookies since domain and path are separate." )
- @Test
- public void testRequestCookieRewrite() throws Exception {
- setUp( null );
- // Setup the server side request/response interaction.
- interaction.expect()
- .method( "GET" )
- .requestUrl( "http://mock-host:1/test-output-path-1" )
- .header( "Cookie", "cookie-name=cookie-value; Domain=docs.foo.com; Path=/accounts; Expires=Wed, 13-Jan-2021 22:23:01 GMT; Secure; HttpOnly" );
- interaction.respond()
- .status( 201 );
- interactions.add( interaction );
- // Create the client request.
- request.setMethod( "GET" );
- request.setURI( "/test-input-path" );
- //request.setVersion( "HTTP/1.1" );
- request.setHeader( "Host", "mock-host:1" );
- request.setHeader( "Cookie", "cookie-name=cookie-value; Domain=docs.foo.com; Path=/accounts; Expires=Wed, 13-Jan-2021 22:23:01 GMT; Secure; HttpOnly" );
-
- // Execute the request.
- response = TestUtils.execute( server, request );
-
- // Test the results.
- assertThat( response.getStatus(), is( 201 ) );
- fail( "TODO" );
- }
-
- @Ignore( "Need to figure out how to handle cookies since domain and path are separate." )
- @Test
- public void testResponseCookieRewrite() throws Exception {
- setUp( null );
- // Setup the server side request/response interaction.
- interaction.expect()
- .method( "GET" )
- .requestUrl( "http://mock-host:1/test-output-path-1" );
- interaction.respond()
- .status( 200 )
- .header( "Set-Cookie", "cookie-name=cookie-value; Domain=docs.foo.com; Path=/accounts; Expires=Wed, 13-Jan-2021 22:23:01 GMT; Secure; HttpOnly" );
- interactions.add( interaction );
- // Create the client request.
- request.setMethod( "GET" );
- request.setURI( "/test-input-path" );
- //request.setVersion( "HTTP/1.1" );
- request.setHeader( "Host", "mock-host:1" );
-
- // Execute the request.
- response = TestUtils.execute( server, request );
-
- // Test the results.
- assertThat( response.getStatus(), is( 200 ) );
- assertThat( response.get( HttpHeader.SET_COOKIE ), is( "TODO" ) );
- fail( "TODO" );
- }
+// @Ignore( "Need to figure out how to handle cookies since domain and path are separate." )
+// @Test
+// public void testRequestCookieRewrite() throws Exception {
+// setUp( null );
+// // Setup the server side request/response interaction.
+// interaction.expect()
+// .method( "GET" )
+// .requestUrl( "http://mock-host:1/test-output-path-1" )
+// .header( "Cookie", "cookie-name=cookie-value; Domain=docs.foo.com; Path=/accounts; Expires=Wed, 13-Jan-2021 22:23:01 GMT; Secure; HttpOnly" );
+// interaction.respond()
+// .status( 201 );
+// interactions.add( interaction );
+// // Create the client request.
+// request.setMethod( "GET" );
+// request.setURI( "/test-input-path" );
+// //request.setVersion( "HTTP/1.1" );
+// request.setHeader( "Host", "mock-host:1" );
+// request.setHeader( "Cookie", "cookie-name=cookie-value; Domain=docs.foo.com; Path=/accounts; Expires=Wed, 13-Jan-2021 22:23:01 GMT; Secure; HttpOnly" );
+//
+// // Execute the request.
+// response = TestUtils.execute( server, request );
+//
+// // Test the results.
+// assertThat( response.getStatus(), is( 201 ) );
+// fail( "TODO" );
+// }
+
+// @Ignore( "Need to figure out how to handle cookies since domain and path are separate." )
+// @Test
+// public void testResponseCookieRewrite() throws Exception {
+// setUp( null );
+// // Setup the server side request/response interaction.
+// interaction.expect()
+// .method( "GET" )
+// .requestUrl( "http://mock-host:1/test-output-path-1" );
+// interaction.respond()
+// .status( 200 )
+// .header( "Set-Cookie", "cookie-name=cookie-value; Domain=docs.foo.com; Path=/accounts; Expires=Wed, 13-Jan-2021 22:23:01 GMT; Secure; HttpOnly" );
+// interactions.add( interaction );
+// // Create the client request.
+// request.setMethod( "GET" );
+// request.setURI( "/test-input-path" );
+// //request.setVersion( "HTTP/1.1" );
+// request.setHeader( "Host", "mock-host:1" );
+//
+// // Execute the request.
+// response = TestUtils.execute( server, request );
+//
+// // Test the results.
+// assertThat( response.getStatus(), is( 200 ) );
+// assertThat( response.get( HttpHeader.SET_COOKIE ), is( "TODO" ) );
+// fail( "TODO" );
+// }
@Test
public void testInboundJsonBodyRewrite() throws Exception {
@@ -455,11 +455,11 @@ public class UrlRewriteServletFilterTest {
assertThat( response.getStatus(), is( 200 ) );
}
- @Ignore( "Not Implemented Yet" )
- @Test
- public void testRequestCookieRewriteWithFilterInitParam() {
- fail( "TODO" );
- }
+// @Ignore( "Not Implemented Yet" )
+// @Test
+// public void testRequestCookieRewriteWithFilterInitParam() {
+// fail( "TODO" );
+// }
@Test
public void testRequestJsonBodyRewriteWithFilterInitParam() throws Exception {
@@ -635,11 +635,11 @@ public class UrlRewriteServletFilterTest {
assertThat( the( actual ), hasXPath( "/root/url/text()", equalTo( "http://mock-host:42/test-output-path-1" ) ) );
}
- @Ignore( "Not Implemented Yet" )
- @Test
- public void testResponseCookieRewriteWithFilterInitParam() {
- fail( "TODO" );
- }
+// @Ignore( "Not Implemented Yet" )
+// @Test
+// public void testResponseCookieRewriteWithFilterInitParam() {
+// fail( "TODO" );
+// }
@Test
public void testResponseJsonBodyRewriteWithFilterInitParam() throws Exception {
http://git-wip-us.apache.org/repos/asf/knox/blob/5750a7cd/gateway-util-common/src/test/java/org/apache/hadoop/gateway/audit/JdbmQueueTest.java
----------------------------------------------------------------------
diff --git a/gateway-util-common/src/test/java/org/apache/hadoop/gateway/audit/JdbmQueueTest.java b/gateway-util-common/src/test/java/org/apache/hadoop/gateway/audit/JdbmQueueTest.java
index abe4648..faccb1e 100644
--- a/gateway-util-common/src/test/java/org/apache/hadoop/gateway/audit/JdbmQueueTest.java
+++ b/gateway-util-common/src/test/java/org/apache/hadoop/gateway/audit/JdbmQueueTest.java
@@ -95,74 +95,74 @@ public class JdbmQueueTest {
assertThat( counter.get(), is( 1 ) );
}
- @Ignore
- @Test
- public void testPerformanceAndStorageFootprint() throws IOException, InterruptedException {
- System.out.println( "Running " + Thread.currentThread().getStackTrace()[1].getClassName() + "#" + Thread.currentThread().getStackTrace()[1].getMethodName() );
-
- String fill = createFillString( 100 );
- File dbFile = new File( file.getAbsolutePath() + ".db" );
- File lgFile = new File( file.getAbsolutePath() + ".lg" );
-
- String s = null;
- long writeCount = 0;
- long writeTime = 0;
- long before;
-
- int iterations = 10000;
-
- for( int i=0; i<iterations; i++ ) {
- s = UUID.randomUUID().toString() + ":" + fill;
- before = System.currentTimeMillis();
- queue.enqueue( s );
- writeTime += ( System.currentTimeMillis() - before );
- writeCount++;
- }
-
- System.out.println( String.format( "Line: len=%d", s.length() ) );
- System.out.println( String.format( "Perf: avg=%.4fs, tot=%.2fs, cnt=%d", ( (double)writeTime / (double)writeCount / 1000.0 ), (double)writeTime/1000.0, writeCount ) );
- System.out.println( String.format(
- "File: db=%s, lg=%s, tot=%s, per=%s",
- humanReadableSize( dbFile.length() ),
- humanReadableSize( lgFile.length() ),
- humanReadableSize( dbFile.length() + lgFile.length() ),
- humanReadableSize( ( ( dbFile.length() + lgFile.length() ) / writeCount ) ) ) );
- }
+// @Ignore
+// @Test
+// public void testPerformanceAndStorageFootprint() throws IOException, InterruptedException {
+// System.out.println( "Running " + Thread.currentThread().getStackTrace()[1].getClassName() + "#" + Thread.currentThread().getStackTrace()[1].getMethodName() );
+//
+// String fill = createFillString( 100 );
+// File dbFile = new File( file.getAbsolutePath() + ".db" );
+// File lgFile = new File( file.getAbsolutePath() + ".lg" );
+//
+// String s = null;
+// long writeCount = 0;
+// long writeTime = 0;
+// long before;
+//
+// int iterations = 10000;
+//
+// for( int i=0; i<iterations; i++ ) {
+// s = UUID.randomUUID().toString() + ":" + fill;
+// before = System.currentTimeMillis();
+// queue.enqueue( s );
+// writeTime += ( System.currentTimeMillis() - before );
+// writeCount++;
+// }
+//
+// System.out.println( String.format( "Line: len=%d", s.length() ) );
+// System.out.println( String.format( "Perf: avg=%.4fs, tot=%.2fs, cnt=%d", ( (double)writeTime / (double)writeCount / 1000.0 ), (double)writeTime/1000.0, writeCount ) );
+// System.out.println( String.format(
+// "File: db=%s, lg=%s, tot=%s, per=%s",
+// humanReadableSize( dbFile.length() ),
+// humanReadableSize( lgFile.length() ),
+// humanReadableSize( dbFile.length() + lgFile.length() ),
+// humanReadableSize( ( ( dbFile.length() + lgFile.length() ) / writeCount ) ) ) );
+// }
- @Ignore
- @Test
- public void testFileGrowth() throws IOException, InterruptedException {
- System.out.println( "Running " + Thread.currentThread().getStackTrace()[1].getClassName() + "#" + Thread.currentThread().getStackTrace()[1].getMethodName() );
-
- String fill = createFillString( 100 );
- File dbFile = new File( file.getAbsolutePath() + ".db" );
- File lgFile = new File( file.getAbsolutePath() + ".lg" );
-
- String s = null;
- long writeCount = 0;
- long writeTime = 0;
- long before;
-
- int iterations = 10000;
-
- for( int i=0; i<iterations; i++ ) {
- s = UUID.randomUUID().toString() + ":" + fill;
- before = System.currentTimeMillis();
- queue.enqueue( s );
- assertThat( queue.dequeue(), is( s ) );
- writeTime += ( System.currentTimeMillis() - before );
- writeCount++;
- }
-
- System.out.println( String.format( "Line: len=%d", s.length() ) );
- System.out.println( String.format( "Perf: avg=%.4fs, tot=%.2fs, cnt=%d", ( (double)writeTime / (double)writeCount / 1000.0 ), (double)writeTime/1000.0, writeCount ) );
- System.out.println( String.format(
- "File: db=%s, lg=%s, tot=%s, per=%s",
- humanReadableSize( dbFile.length() ),
- humanReadableSize( lgFile.length() ),
- humanReadableSize( dbFile.length() + lgFile.length() ),
- humanReadableSize( ( ( dbFile.length() + lgFile.length() ) / writeCount ) ) ) );
- }
+// @Ignore
+// @Test
+// public void testFileGrowth() throws IOException, InterruptedException {
+// System.out.println( "Running " + Thread.currentThread().getStackTrace()[1].getClassName() + "#" + Thread.currentThread().getStackTrace()[1].getMethodName() );
+//
+// String fill = createFillString( 100 );
+// File dbFile = new File( file.getAbsolutePath() + ".db" );
+// File lgFile = new File( file.getAbsolutePath() + ".lg" );
+//
+// String s = null;
+// long writeCount = 0;
+// long writeTime = 0;
+// long before;
+//
+// int iterations = 10000;
+//
+// for( int i=0; i<iterations; i++ ) {
+// s = UUID.randomUUID().toString() + ":" + fill;
+// before = System.currentTimeMillis();
+// queue.enqueue( s );
+// assertThat( queue.dequeue(), is( s ) );
+// writeTime += ( System.currentTimeMillis() - before );
+// writeCount++;
+// }
+//
+// System.out.println( String.format( "Line: len=%d", s.length() ) );
+// System.out.println( String.format( "Perf: avg=%.4fs, tot=%.2fs, cnt=%d", ( (double)writeTime / (double)writeCount / 1000.0 ), (double)writeTime/1000.0, writeCount ) );
+// System.out.println( String.format(
+// "File: db=%s, lg=%s, tot=%s, per=%s",
+// humanReadableSize( dbFile.length() ),
+// humanReadableSize( lgFile.length() ),
+// humanReadableSize( dbFile.length() + lgFile.length() ),
+// humanReadableSize( ( ( dbFile.length() + lgFile.length() ) / writeCount ) ) ) );
+// }
@Test( timeout = 120000 )
public void testConcurrentConsumer() throws InterruptedException, IOException {
http://git-wip-us.apache.org/repos/asf/knox/blob/5750a7cd/gateway-util-urltemplate/src/test/java/org/apache/hadoop/gateway/util/urltemplate/RewriterTest.java
----------------------------------------------------------------------
diff --git a/gateway-util-urltemplate/src/test/java/org/apache/hadoop/gateway/util/urltemplate/RewriterTest.java b/gateway-util-urltemplate/src/test/java/org/apache/hadoop/gateway/util/urltemplate/RewriterTest.java
index 645ffd5..a4c44e2 100644
--- a/gateway-util-urltemplate/src/test/java/org/apache/hadoop/gateway/util/urltemplate/RewriterTest.java
+++ b/gateway-util-urltemplate/src/test/java/org/apache/hadoop/gateway/util/urltemplate/RewriterTest.java
@@ -48,57 +48,57 @@ import static org.junit.Assert.assertTrue;
@Category( { UnitTests.class, FastTests.class } )
public class RewriterTest {
- @Ignore( "Not implemented yet." )
- @Test
- public void testParamIndirectionRewrite() throws Exception {
- URI inputUri, outputUri;
- Template inputTemplate, outputTemplate;
- MockParams resolver = new MockParams();
- resolver.addValue( "some-known-host", "some-other-host" );
-
- // This is how it works now.
- // This is the URI like we would get from say a Location HTTP header.
- inputUri = new URI( "http://some-host:80" );
- // This will be used to extract the three values from input URI: scheme='http', host='some-known-host', port='80'
- inputTemplate = Parser.parseTemplate( "{scheme}://{host}:{port}" );
- // The template to build a new URI. The match those in the input template.
- outputTemplate = Parser.parseTemplate( "{scheme}://{host}:{port}" );
- // Copies the values extracted from the input URI via the inputTemplate and inserts them into the outputTemplate.
- // The resolver isn't used in this case.
- outputUri = Rewriter.rewrite( inputUri, inputTemplate, outputTemplate, resolver, null );
- assertThat( outputUri.toString(), equalTo( "http://some-host:80" ) );
-
- // Need a syntax for the URL rewriter to tell it to take the value extracted from the inputUri
- // and lookup it up via the resolver to populate the output template. So from the input template
- // the values of 'some-host' is extracted for the 'host' parameter. The '$' in the output template below
- // would tell the rewriter to look the value 'some-host' up in the resolver and place that in the
- // output URI.
- // I want to discuss the '$' syntax hoping you have a better suggestion.
- // IMPORTANT: The $ ended up being used for function so the syntax below cannot be used. Consider ^ or something else.
- inputUri = new URI( "http://some-known-host:80" );
- inputTemplate = Parser.parseTemplate( "{scheme}://{host}:{port}" );
- outputTemplate = Parser.parseTemplate( "{scheme}://{$host}:{port}" );
- outputUri = Rewriter.rewrite( inputUri, inputTemplate, outputTemplate, resolver, null );
- assertThat( outputUri.toString(), equalTo( "http://some-other-host:80" ) );
-
- // What should happen if the param value cannot be resolved to something else?
- // Right now it uses the empty string.
- // IMPORTANT: The $ ended up being used for function so the syntax below cannot be used. Consider ^ or something else.
- inputUri = new URI( "http://some-unknown-host:80" );
- inputTemplate = Parser.parseTemplate( "{scheme}://{host}:{port}" );
- outputTemplate = Parser.parseTemplate( "{scheme}://{$host}:{port}" );
- outputUri = Rewriter.rewrite( inputUri, inputTemplate, outputTemplate, resolver, null );
- assertThat( outputUri.toString(), equalTo( "http://:80" ) );
-
- // Should there be another syntax that uses the original value if it cannot resolve the extracted value?
- // Should this be the default and only behavior?
- // See the '?' in the output template below.
- inputUri = new URI( "http://some-unknown-host:80" );
- inputTemplate = Parser.parseTemplate( "{scheme}://{host}:{port}" );
- outputTemplate = Parser.parseTemplate( "{scheme}://{?host}:{port}" );
- outputUri = Rewriter.rewrite( inputUri, inputTemplate, outputTemplate, resolver, null );
- assertThat( outputUri.toString(), equalTo( "http://some-unknown-host:80" ) );
- }
+// @Ignore( "Not implemented yet." )
+// @Test
+// public void testParamIndirectionRewrite() throws Exception {
+// URI inputUri, outputUri;
+// Template inputTemplate, outputTemplate;
+// MockParams resolver = new MockParams();
+// resolver.addValue( "some-known-host", "some-other-host" );
+//
+// // This is how it works now.
+// // This is the URI like we would get from say a Location HTTP header.
+// inputUri = new URI( "http://some-host:80" );
+// // This will be used to extract the three values from input URI: scheme='http', host='some-known-host', port='80'
+// inputTemplate = Parser.parseTemplate( "{scheme}://{host}:{port}" );
+// // The template to build a new URI. The match those in the input template.
+// outputTemplate = Parser.parseTemplate( "{scheme}://{host}:{port}" );
+// // Copies the values extracted from the input URI via the inputTemplate and inserts them into the outputTemplate.
+// // The resolver isn't used in this case.
+// outputUri = Rewriter.rewrite( inputUri, inputTemplate, outputTemplate, resolver, null );
+// assertThat( outputUri.toString(), equalTo( "http://some-host:80" ) );
+//
+// // Need a syntax for the URL rewriter to tell it to take the value extracted from the inputUri
+// // and lookup it up via the resolver to populate the output template. So from the input template
+// // the values of 'some-host' is extracted for the 'host' parameter. The '$' in the output template below
+// // would tell the rewriter to look the value 'some-host' up in the resolver and place that in the
+// // output URI.
+// // I want to discuss the '$' syntax hoping you have a better suggestion.
+// // IMPORTANT: The $ ended up being used for function so the syntax below cannot be used. Consider ^ or something else.
+// inputUri = new URI( "http://some-known-host:80" );
+// inputTemplate = Parser.parseTemplate( "{scheme}://{host}:{port}" );
+// outputTemplate = Parser.parseTemplate( "{scheme}://{$host}:{port}" );
+// outputUri = Rewriter.rewrite( inputUri, inputTemplate, outputTemplate, resolver, null );
+// assertThat( outputUri.toString(), equalTo( "http://some-other-host:80" ) );
+//
+// // What should happen if the param value cannot be resolved to something else?
+// // Right now it uses the empty string.
+// // IMPORTANT: The $ ended up being used for function so the syntax below cannot be used. Consider ^ or something else.
+// inputUri = new URI( "http://some-unknown-host:80" );
+// inputTemplate = Parser.parseTemplate( "{scheme}://{host}:{port}" );
+// outputTemplate = Parser.parseTemplate( "{scheme}://{$host}:{port}" );
+// outputUri = Rewriter.rewrite( inputUri, inputTemplate, outputTemplate, resolver, null );
+// assertThat( outputUri.toString(), equalTo( "http://:80" ) );
+//
+// // Should there be another syntax that uses the original value if it cannot resolve the extracted value?
+// // Should this be the default and only behavior?
+// // See the '?' in the output template below.
+// inputUri = new URI( "http://some-unknown-host:80" );
+// inputTemplate = Parser.parseTemplate( "{scheme}://{host}:{port}" );
+// outputTemplate = Parser.parseTemplate( "{scheme}://{?host}:{port}" );
+// outputUri = Rewriter.rewrite( inputUri, inputTemplate, outputTemplate, resolver, null );
+// assertThat( outputUri.toString(), equalTo( "http://some-unknown-host:80" ) );
+// }
@Test
public void testServiceRegistryHostmapUserCase() throws Exception {