Skip to content

Commit

Permalink
Merge pull request #50 from ropalka/sync_main_with_331Final
Browse files Browse the repository at this point in the history
Sync main branch with 3.3.1.Final tag
  • Loading branch information
ropalka authored Feb 16, 2024
2 parents 4cc0af3 + ad884e3 commit 2ee76ab
Show file tree
Hide file tree
Showing 5 changed files with 90 additions and 57 deletions.
16 changes: 16 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "maven"
directory: "/"
schedule:
interval: "daily"
open-pull-requests-limit: 10
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
45 changes: 45 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# This workflow will build a Java project with Maven
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven

name: JBoss VFS CI

on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]

jobs:
build-test-matrix:
name: ${{ matrix.jdk-distribution }}-${{ matrix.jdk-version }}-${{ matrix.os }}
runs-on: ${{ matrix.os }}
timeout-minutes: 5
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
jdk-distribution: [temurin, adopt-openj9]
jdk-version: [11, 17]
steps:
- name: Configure runner - Linux
if: contains(matrix.os, 'ubuntu')
run: |
sudo bash -c "echo '127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4' > /etc/hosts"
sudo bash -c "echo '::1 localhost localhost.localdomain localhost6 localhost6.localdomain6' >> /etc/hosts"
- name: Configure Runner - Windows
if: contains(matrix.os, 'windows')
run: |
echo '127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4' > %SystemRoot%\System32\drivers\etc\hosts
echo '::1 localhost localhost.localdomain localhost6 localhost6.localdomain6' >> %SystemRoot%\System32\drivers\etc\hosts
shell: cmd
- uses: actions/checkout@v3
- name: Set up JDK ${{ matrix.jdk-distribution }} ${{ matrix.jdk-version }}
uses: actions/setup-java@v3
with:
distribution: ${{ matrix.jdk-distribution }}
java-version: ${{ matrix.jdk-version }}
- name: Run Tests
run: mvn -ntp -U -B -fae clean install
- uses: actions/upload-artifact@v3
if: failure()
with:
name: surefire-${{ matrix.jdk-distribution }}-${{ matrix.jdk-version }}-${{ matrix.os }}
path: '**/surefire-reports/*.txt'
42 changes: 27 additions & 15 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<parent>
<groupId>org.jboss</groupId>
<artifactId>jboss-parent</artifactId>
<version>36</version>
<version>43</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down Expand Up @@ -61,10 +61,13 @@
</scm>

<properties>
<version.org.jboss.logging.jboss-logging>3.4.1.Final</version.org.jboss.logging.jboss-logging>
<version.org.jboss.logging.jboss-logging-tools>2.2.0.Final</version.org.jboss.logging.jboss-logging-tools>
<version.org.jboss.logging.jboss-logging>3.5.3.Final</version.org.jboss.logging.jboss-logging>
<version.org.jboss.logging.jboss-logging-tools>2.2.1.Final</version.org.jboss.logging.jboss-logging-tools>
<version.jboss.test>1.2.0.Final</version.jboss.test>
<version.junit>4.13.1</version.junit>
<version.junit>4.13.2</version.junit>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<jdk.min.version>11</jdk.min.version>
</properties>

<build>
Expand All @@ -73,6 +76,17 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifestEntries>
<Automatic-Module-Name>org.jboss.vfs</Automatic-Module-Name>
</manifestEntries>
</archive>
</configuration>
</plugin>
</plugins>
<pluginManagement>
<plugins>
Expand Down Expand Up @@ -115,31 +129,35 @@
</plugin>
</plugins>
</pluginManagement>

</build>


<dependencies>
<!-- provided dependencies -->
<dependency>
<groupId>org.jboss.logging</groupId>
<artifactId>jboss-logging</artifactId>
<version>${version.org.jboss.logging.jboss-logging}</version>
<scope>compile</scope>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.jboss.logging</groupId>
<artifactId>jboss-logging-annotations</artifactId>
<version>${version.org.jboss.logging.jboss-logging-tools}</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.jboss.logging</groupId>
<artifactId>jboss-logging-processor</artifactId>
<version>${version.org.jboss.logging.jboss-logging-tools}</version>
<scope>provided</scope>
</dependency>
<!-- test dependencies -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${version.junit}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.test</groupId>
<artifactId>jboss-test</artifactId>
Expand Down Expand Up @@ -176,12 +194,6 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${version.junit}</version>
<scope>test</scope>
</dependency>
</dependencies>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,15 @@
*/
public class VfsUrlStreamHandlerFactory implements URLStreamHandlerFactory {


private static Map<String, URLStreamHandler> handlerMap = new HashMap<String, URLStreamHandler>(2);
private static Map<String, URLStreamHandler> handlerMap = new HashMap<String, URLStreamHandler>(1);

static {
handlerMap.put("file", new FileURLStreamHandler());
handlerMap.put("vfs", new VirtualFileURLStreamHandler());
}


@Override
public URLStreamHandler createURLStreamHandler(final String protocol) {
return handlerMap.get(protocol);
}

}
38 changes: 0 additions & 38 deletions src/test/java/org/jboss/test/vfs/URLConnectionUnitTestCase.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
package org.jboss.test.vfs;

import java.io.ByteArrayOutputStream;
import java.io.Closeable;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
Expand All @@ -27,14 +26,11 @@
import java.net.URLConnection;
import java.nio.file.Files;
import java.util.Arrays;
import java.util.concurrent.Executors;

import junit.framework.Test;
import org.jboss.vfs.TempFileProvider;
import org.jboss.vfs.VFS;
import org.jboss.vfs.VFSUtils;
import org.jboss.vfs.VirtualFile;
import org.jboss.vfs.protocol.FileURLConnection;
import org.jboss.vfs.protocol.VfsUrlStreamHandlerFactory;
import org.junit.Assert;

Expand Down Expand Up @@ -173,40 +169,6 @@ public void testOutsideUrl() throws Exception {
assertEquals(file.lastModified(), conn.getLastModified());
}

public void testFileUrl() throws Exception {
// Hack to ensure VFS.init has been called and has taken over the file: protocol
VFS.getChild("");
URL resourceUrl = getResource("/vfs/test/outer.jar");
// Hack to ensure the URL handler is not passed down by the parent URL context
URL url = new URL("file", resourceUrl.getHost(), resourceUrl.getFile());

// Make sure we are using our handler
URLConnection urlConn = url.openConnection();
assertTrue(urlConn instanceof FileURLConnection);

File file = new File(url.toURI());
assertNotNull(file);

VirtualFile vf = VFS.getChild(url);
assertTrue(vf.isFile());
// Mount a temp dir over the jar location in VFS
TempFileProvider provider = null;
Closeable handle = null;
try {
provider = TempFileProvider.create("temp", Executors.newSingleThreadScheduledExecutor());
handle = VFS.mountTemp(vf, provider);
assertTrue(vf.isDirectory());

File vfsDerivedFile = vf.getPhysicalFile();
File urlDerivedFile = (File) url.getContent();
// Make sure the file returned by the file: URL is not the VFS File (In other words, make sure it does not use the mounts)
assertTrue(urlDerivedFile.isFile());
assertFalse(vfsDerivedFile.equals(urlDerivedFile));
} finally {
VFSUtils.safeClose(handle, provider);
}
}

public void testFileUrlContentType() throws Exception {
VFS.getChild("");
URL url = getResource("/vfs/test/test-web.xml");
Expand Down

0 comments on commit 2ee76ab

Please sign in to comment.