You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by GitBox <gi...@apache.org> on 2020/02/19 18:53:36 UTC

[GitHub] [maven-doxia-sitetools] elharo opened a new pull request #14: fix some warnings

elharo opened a new pull request #14: fix some warnings
URL: https://github.com/apache/maven-doxia-sitetools/pull/14
 
 
   @michael-o 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [maven-doxia-sitetools] elharo commented on a change in pull request #14: fix some warnings

Posted by GitBox <gi...@apache.org>.
elharo commented on a change in pull request #14: fix some warnings
URL: https://github.com/apache/maven-doxia-sitetools/pull/14#discussion_r381518477
 
 

 ##########
 File path: doxia-site-renderer/src/test/java/org/apache/maven/doxia/siterenderer/DefaultSiteRendererTest.java
 ##########
 @@ -290,8 +294,10 @@ public void testVelocityToolManagerForSkin()
         SiteRendererSink sink = new SiteRendererSink( context );
         renderer.mergeDocumentIntoSite( writer, sink, siteRenderingContext );
         String renderResult = writer.toString();
-        String expectedResult = IOUtils.toString( getClass().getResourceAsStream( "velocity-toolmanager.expected.txt" ) );
-        expectedResult = StringUtils.unifyLineSeparators( expectedResult );
+        String expectedResult = StringUtils.unifyLineSeparators(
+            IOUtils.toString(
+                getClass().getResourceAsStream("velocity-toolmanager.expected.txt"),
+                StandardCharsets.UTF_8));
 
 Review comment:
   done

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [maven-doxia-sitetools] elharo commented on a change in pull request #14: fix some warnings

Posted by GitBox <gi...@apache.org>.
elharo commented on a change in pull request #14: fix some warnings
URL: https://github.com/apache/maven-doxia-sitetools/pull/14#discussion_r381518846
 
 

 ##########
 File path: doxia-site-renderer/src/test/java/org/apache/maven/doxia/siterenderer/JavascriptVerifier.java
 ##########
 @@ -60,46 +60,47 @@ public void verify( String file )
         assertTrue( jsTest.exists() );
 
         // HtmlUnit
-        WebClient webClient = new WebClient();
-        webClient.getOptions().setCssEnabled( false );
-
-        final List<String> collectedAlerts = new ArrayList<String>( 4 );
-        webClient.setAlertHandler( new CollectingAlertHandler( collectedAlerts ) );
-
-        HtmlPage page = (HtmlPage) webClient.getPage( jsTest.toURI().toURL() );
-        assertNotNull( page );
-
-        HtmlElement element = page.getHtmlElementById( "contentBox" );
-        assertNotNull( element );
-        HtmlDivision division = (HtmlDivision) element;
-        assertNotNull( division );
-
-        Iterator<HtmlElement> elementIterator = division.getHtmlElementDescendants().iterator();
-
-        // ----------------------------------------------------------------------
-        //
-        // ----------------------------------------------------------------------
-
-        HtmlSection section = (HtmlSection) elementIterator.next();
-        assertNotNull( section );
-
-        HtmlHeading2 h2 = (HtmlHeading2) elementIterator.next();
-        assertNotNull( h2 );
-        assertEquals( "Test", h2.asText().trim() );
-
-        HtmlAnchor a = (HtmlAnchor) elementIterator.next();
-        assertNotNull( a );
-        assertEquals( "Test", a.getAttribute( "name" ) );
-
-        HtmlParagraph p = (HtmlParagraph) elementIterator.next();
-        assertNotNull( p );
-        assertEquals( "You should see a JavaScript alert...", p.asText().trim() );
-
-        HtmlScript script = (HtmlScript) elementIterator.next();
-        assertNotNull( script  );
-        assertEquals( "text/javascript", script.getAttribute( "type" ) );
-        assertEquals( "", script.asText().trim() );
-        final List<String> expectedAlerts = Collections.singletonList( "Hello!" );
-        assertEquals( expectedAlerts, collectedAlerts );
+        try (WebClient webClient = new WebClient()) {
 
 Review comment:
   done

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [maven-doxia-sitetools] elharo merged pull request #14: fix some warnings

Posted by GitBox <gi...@apache.org>.
elharo merged pull request #14: fix some warnings
URL: https://github.com/apache/maven-doxia-sitetools/pull/14
 
 
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [maven-doxia-sitetools] michael-o commented on a change in pull request #14: fix some warnings

Posted by GitBox <gi...@apache.org>.
michael-o commented on a change in pull request #14: fix some warnings
URL: https://github.com/apache/maven-doxia-sitetools/pull/14#discussion_r381525512
 
 

 ##########
 File path: doxia-site-renderer/src/test/java/org/apache/maven/doxia/siterenderer/DefaultSiteRendererTest.java
 ##########
 @@ -290,8 +294,10 @@ public void testVelocityToolManagerForSkin()
         SiteRendererSink sink = new SiteRendererSink( context );
         renderer.mergeDocumentIntoSite( writer, sink, siteRenderingContext );
         String renderResult = writer.toString();
-        String expectedResult = IOUtils.toString( getClass().getResourceAsStream( "velocity-toolmanager.expected.txt" ) );
-        expectedResult = StringUtils.unifyLineSeparators( expectedResult );
+        String expectedResult = StringUtils.unifyLineSeparators(
+            IOUtils.toString(
+                getClass().getResourceAsStream("velocity-toolmanager.expected.txt"),
+                StandardCharsets.UTF_8));
 
 Review comment:
   Still spaces missing after `UTF_8`.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [maven-doxia-sitetools] michael-o commented on a change in pull request #14: fix some warnings

Posted by GitBox <gi...@apache.org>.
michael-o commented on a change in pull request #14: fix some warnings
URL: https://github.com/apache/maven-doxia-sitetools/pull/14#discussion_r381508849
 
 

 ##########
 File path: doxia-site-renderer/src/test/java/org/apache/maven/doxia/siterenderer/DefaultSiteRendererTest.java
 ##########
 @@ -233,7 +234,10 @@ public void testVelocityToolManager()
         renderer.mergeDocumentIntoSite( writer, sink, siteRenderingContext );
 
         String renderResult = writer.toString();
-        String expectedResult = IOUtils.toString( getClass().getResourceAsStream( "velocity-toolmanager.expected.txt" ) );
+        String expectedResult =
+            IOUtils.toString(
+                getClass().getResourceAsStream("velocity-toolmanager.expected.txt"),
+                StandardCharsets.UTF_8);
 
 Review comment:
   Space missing

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [maven-doxia-sitetools] elharo commented on a change in pull request #14: fix some warnings

Posted by GitBox <gi...@apache.org>.
elharo commented on a change in pull request #14: fix some warnings
URL: https://github.com/apache/maven-doxia-sitetools/pull/14#discussion_r381517399
 
 

 ##########
 File path: doxia-site-renderer/src/test/java/org/apache/maven/doxia/siterenderer/AbstractVerifier.java
 ##########
 @@ -51,10 +51,11 @@ protected HtmlPage htmlPage( String htmlFile )
         assertTrue( file.exists() );
 
         // HtmlUnit
-        WebClient webClient = new WebClient();
-        webClient.getOptions().setCssEnabled( false );
-
-        return (HtmlPage) webClient.getPage( file.toURI().toURL() );
+        try (WebClient webClient = new WebClient()) {
 
 Review comment:
   done

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [maven-doxia-sitetools] elharo commented on a change in pull request #14: fix some warnings

Posted by GitBox <gi...@apache.org>.
elharo commented on a change in pull request #14: fix some warnings
URL: https://github.com/apache/maven-doxia-sitetools/pull/14#discussion_r381518265
 
 

 ##########
 File path: doxia-site-renderer/src/test/java/org/apache/maven/doxia/siterenderer/DefaultSiteRendererTest.java
 ##########
 @@ -233,7 +234,10 @@ public void testVelocityToolManager()
         renderer.mergeDocumentIntoSite( writer, sink, siteRenderingContext );
 
         String renderResult = writer.toString();
-        String expectedResult = IOUtils.toString( getClass().getResourceAsStream( "velocity-toolmanager.expected.txt" ) );
+        String expectedResult =
+            IOUtils.toString(
+                getClass().getResourceAsStream("velocity-toolmanager.expected.txt"),
+                StandardCharsets.UTF_8);
 
 Review comment:
   done

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [maven-doxia-sitetools] michael-o commented on a change in pull request #14: fix some warnings

Posted by GitBox <gi...@apache.org>.
michael-o commented on a change in pull request #14: fix some warnings
URL: https://github.com/apache/maven-doxia-sitetools/pull/14#discussion_r381550647
 
 

 ##########
 File path: doxia-site-renderer/src/test/java/org/apache/maven/doxia/siterenderer/DefaultSiteRendererTest.java
 ##########
 @@ -297,7 +297,7 @@ public void testVelocityToolManagerForSkin()
         String expectedResult = StringUtils.unifyLineSeparators(
             IOUtils.toString(
                 getClass().getResourceAsStream( "velocity-toolmanager.expected.txt" ),
-                StandardCharsets.UTF_8));
+                StandardCharsets.UTF_8 ));
 
 Review comment:
   and another one between the parens.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [maven-doxia-sitetools] michael-o commented on a change in pull request #14: fix some warnings

Posted by GitBox <gi...@apache.org>.
michael-o commented on a change in pull request #14: fix some warnings
URL: https://github.com/apache/maven-doxia-sitetools/pull/14#discussion_r381509040
 
 

 ##########
 File path: doxia-site-renderer/src/test/java/org/apache/maven/doxia/siterenderer/DefaultSiteRendererTest.java
 ##########
 @@ -290,8 +294,10 @@ public void testVelocityToolManagerForSkin()
         SiteRendererSink sink = new SiteRendererSink( context );
         renderer.mergeDocumentIntoSite( writer, sink, siteRenderingContext );
         String renderResult = writer.toString();
-        String expectedResult = IOUtils.toString( getClass().getResourceAsStream( "velocity-toolmanager.expected.txt" ) );
-        expectedResult = StringUtils.unifyLineSeparators( expectedResult );
+        String expectedResult = StringUtils.unifyLineSeparators(
+            IOUtils.toString(
+                getClass().getResourceAsStream("velocity-toolmanager.expected.txt"),
+                StandardCharsets.UTF_8));
 
 Review comment:
   here too

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [maven-doxia-sitetools] michael-o commented on a change in pull request #14: fix some warnings

Posted by GitBox <gi...@apache.org>.
michael-o commented on a change in pull request #14: fix some warnings
URL: https://github.com/apache/maven-doxia-sitetools/pull/14#discussion_r381509128
 
 

 ##########
 File path: doxia-site-renderer/src/test/java/org/apache/maven/doxia/siterenderer/JavascriptVerifier.java
 ##########
 @@ -60,46 +60,47 @@ public void verify( String file )
         assertTrue( jsTest.exists() );
 
         // HtmlUnit
-        WebClient webClient = new WebClient();
-        webClient.getOptions().setCssEnabled( false );
-
-        final List<String> collectedAlerts = new ArrayList<String>( 4 );
-        webClient.setAlertHandler( new CollectingAlertHandler( collectedAlerts ) );
-
-        HtmlPage page = (HtmlPage) webClient.getPage( jsTest.toURI().toURL() );
-        assertNotNull( page );
-
-        HtmlElement element = page.getHtmlElementById( "contentBox" );
-        assertNotNull( element );
-        HtmlDivision division = (HtmlDivision) element;
-        assertNotNull( division );
-
-        Iterator<HtmlElement> elementIterator = division.getHtmlElementDescendants().iterator();
-
-        // ----------------------------------------------------------------------
-        //
-        // ----------------------------------------------------------------------
-
-        HtmlSection section = (HtmlSection) elementIterator.next();
-        assertNotNull( section );
-
-        HtmlHeading2 h2 = (HtmlHeading2) elementIterator.next();
-        assertNotNull( h2 );
-        assertEquals( "Test", h2.asText().trim() );
-
-        HtmlAnchor a = (HtmlAnchor) elementIterator.next();
-        assertNotNull( a );
-        assertEquals( "Test", a.getAttribute( "name" ) );
-
-        HtmlParagraph p = (HtmlParagraph) elementIterator.next();
-        assertNotNull( p );
-        assertEquals( "You should see a JavaScript alert...", p.asText().trim() );
-
-        HtmlScript script = (HtmlScript) elementIterator.next();
-        assertNotNull( script  );
-        assertEquals( "text/javascript", script.getAttribute( "type" ) );
-        assertEquals( "", script.asText().trim() );
-        final List<String> expectedAlerts = Collections.singletonList( "Hello!" );
-        assertEquals( expectedAlerts, collectedAlerts );
+        try (WebClient webClient = new WebClient()) {
 
 Review comment:
   same here

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [maven-doxia-sitetools] michael-o commented on a change in pull request #14: fix some warnings

Posted by GitBox <gi...@apache.org>.
michael-o commented on a change in pull request #14: fix some warnings
URL: https://github.com/apache/maven-doxia-sitetools/pull/14#discussion_r381508947
 
 

 ##########
 File path: doxia-site-renderer/src/test/java/org/apache/maven/doxia/siterenderer/AbstractVerifier.java
 ##########
 @@ -51,10 +51,11 @@ protected HtmlPage htmlPage( String htmlFile )
         assertTrue( file.exists() );
 
         // HtmlUnit
-        WebClient webClient = new WebClient();
-        webClient.getOptions().setCssEnabled( false );
-
-        return (HtmlPage) webClient.getPage( file.toURI().toURL() );
+        try (WebClient webClient = new WebClient()) {
 
 Review comment:
   Spaces missing

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services