You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by he...@apache.org on 2022/06/27 12:52:29 UTC

[brooklyn-server] branch master updated (258aef521e -> e027d155ec)

This is an automated email from the ASF dual-hosted git repository.

heneveld pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/brooklyn-server.git


    from 258aef521e Merge remote-tracking branch 'nakomis/add-api-response'
     add 5e0d94c37b Use toURI on resource URLs to fix Windows path issues
     new 8e99219dd2 Merge remote-tracking branch 'grkvlt/fix/windows-uri-path'
     new e027d155ec fix windows portability using streams rather than toURI

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../org/apache/brooklyn/util/io/FileUtilTest.java  | 32 ++++++++++++----------
 1 file changed, 18 insertions(+), 14 deletions(-)


[brooklyn-server] 02/02: fix windows portability using streams rather than toURI

Posted by he...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

heneveld pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/brooklyn-server.git

commit e027d155ec346c4f8bb62b14af892043aa01bfba
Author: Alex Heneveld <al...@cloudsoft.io>
AuthorDate: Mon Jun 27 13:52:07 2022 +0100

    fix windows portability using streams rather than toURI
---
 .../test/java/org/apache/brooklyn/util/io/FileUtilTest.java | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/utils/common/src/test/java/org/apache/brooklyn/util/io/FileUtilTest.java b/utils/common/src/test/java/org/apache/brooklyn/util/io/FileUtilTest.java
index e00e589c19..de84a6466f 100644
--- a/utils/common/src/test/java/org/apache/brooklyn/util/io/FileUtilTest.java
+++ b/utils/common/src/test/java/org/apache/brooklyn/util/io/FileUtilTest.java
@@ -33,6 +33,7 @@ import com.google.common.io.Files;
 
 import org.apache.brooklyn.util.os.Os;
 import org.apache.brooklyn.util.stream.InputStreamSource;
+import org.apache.brooklyn.util.stream.Streams;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
@@ -127,29 +128,25 @@ public class FileUtilTest {
 
     @Test
     public void testIsJavaFileText() throws IOException, URISyntaxException {
-        byte[] bytes = java.nio.file.Files.readAllBytes(
-               Paths.get(this.getClass().getClassLoader().getResource("brooklyn/osgi/brooklyn-osgi-test-a_0.1.0.txt").toURI()));
+        byte[] bytes = Streams.readFully(getClass().getResourceAsStream("/brooklyn/osgi/brooklyn-osgi-test-a_0.1.0.txt"));
         assertFalse(FileUtil.doesZipContainJavaBinaries(InputStreamSource.of("Test bom file", bytes)));
     }
 
     @Test
     public void testIsJavaNoClassesJar() throws IOException, URISyntaxException {
-        byte[] bytes = java.nio.file.Files.readAllBytes(
-                Paths.get(this.getClass().getClassLoader().getResource("brooklyn/files/testNoJava-0.1.0-SNAPSHOT.jar").toURI()));
+        byte[] bytes = Streams.readFully(getClass().getResourceAsStream("/brooklyn/files/testNoJava-0.1.0-SNAPSHOT.jar"));
         assertFalse(FileUtil.doesZipContainJavaBinaries(InputStreamSource.of("Test Jar without Java classes", bytes)));
     }
 
     @Test
     public void testIsFakeJavaWithClassesJar() throws IOException, URISyntaxException {
-        byte[] bytes = java.nio.file.Files.readAllBytes(
-                Paths.get(this.getClass().getClassLoader().getResource("brooklyn/files/testWithJava-0.1.0-SNAPSHOT.jar").toURI()));
+        byte[] bytes = Streams.readFully(getClass().getResourceAsStream("/brooklyn/files/testWithJava-0.1.0-SNAPSHOT.jar"));
         assertTrue(FileUtil.doesZipContainJavaBinaries(InputStreamSource.of("Test fail JAR with files renamed as .class", bytes)));
     }
 
     @Test
     public void testIsRealJavaFileText() throws IOException, URISyntaxException {
-        byte[] bytes = java.nio.file.Files.readAllBytes(
-                Paths.get(this.getClass().getClassLoader().getResource("brooklyn/osgi/brooklyn-osgi-test-a_0.1.0.jar").toURI()));
+        byte[] bytes = Streams.readFully(getClass().getResourceAsStream("/brooklyn/osgi/brooklyn-osgi-test-a_0.1.0.jar"));
         assertTrue(FileUtil.doesZipContainJavaBinaries(InputStreamSource.of("Test real JAR with Java classes", bytes)));
     }
 }


[brooklyn-server] 01/02: Merge remote-tracking branch 'grkvlt/fix/windows-uri-path'

Posted by he...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

heneveld pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/brooklyn-server.git

commit 8e99219dd2f472e47aad3ff39ea8c290f279ca56
Merge: 258aef521e 5e0d94c37b
Author: Alex Heneveld <al...@cloudsoft.io>
AuthorDate: Mon Jun 27 13:49:34 2022 +0100

    Merge remote-tracking branch 'grkvlt/fix/windows-uri-path'

 .../org/apache/brooklyn/util/io/FileUtilTest.java  | 35 +++++++++++++---------
 1 file changed, 21 insertions(+), 14 deletions(-)