Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
*.iml
/.idea
*.ipr
*.iws
*.log
Expand Down
2 changes: 2 additions & 0 deletions VERSION.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
1.2.0 (not yet released)

#60: Convert tests to JUnit 5 & refactor tests
(contributed by @Marcono1234)
#61: Prevent user code from subclassing `UnsafeChunkEncoder`
(contributed by @Marcono1234)
- Updated `oss-parent` dep to latest (v72)
Expand Down
169 changes: 91 additions & 78 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,30 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<!-- 13-Mar-2017, tatu: use FasterXML oss-parent over sonatype's, more
likely to get settings that work for releases
-->
<parent>
<groupId>com.fasterxml</groupId>
<artifactId>oss-parent</artifactId>
<version>72</version>
<groupId>com.fasterxml</groupId>
<artifactId>oss-parent</artifactId>
<version>72</version>
</parent>
<groupId>com.ning</groupId>
<artifactId>compress-lzf</artifactId>
<name>Compress-LZF</name>
<version>1.2.0-SNAPSHOT</version>
<packaging>bundle</packaging>
<description>
Compression codec for LZF encoding for particularly encoding/decoding, with reasonable compression.
Compressor is basic Lempel-Ziv codec, without Huffman (deflate/gzip) or statistical post-encoding.
See "http://oldhome.schmorp.de/marc/liblzf.html" for more on original LZF package.
<description>
Compression codec for LZF encoding for particularly encoding/decoding, with reasonable compression.
Compressor is basic Lempel-Ziv codec, without Huffman (deflate/gzip) or statistical post-encoding.
See "http://oldhome.schmorp.de/marc/liblzf.html" for more on original LZF package.
</description>
<url>https://github.com/ning/compress</url>
<scm>
<connection>scm:git:[email protected]:ning/compress.git</connection>
<developerConnection>scm:git:[email protected]:ning/compress.git</developerConnection>
<url>https://github.com/ning/compress</url>
<tag>compress-lzf-1.1</tag>
<tag>HEAD</tag>
</scm>
<issueManagement>
<url>https://github.com/ning/compress/issues</url>
Expand All @@ -41,14 +42,14 @@ See "http://oldhome.schmorp.de/marc/liblzf.html" for more on original LZF packag
</developer>
</developers>
<contributors>
<contributor>
<name>Jon Hartlaub</name>
<email>[email protected]</email>
</contributor>
<contributor>
<name>Cédrik Lime</name>
<email>[email protected]</email>
</contributor>
<contributor>
<name>Jon Hartlaub</name>
<email>[email protected]</email>
</contributor>
<contributor>
<name>Cédrik Lime</name>
<email>[email protected]</email>
</contributor>
</contributors>
<licenses>
<license>
Expand All @@ -57,23 +58,34 @@ See "http://oldhome.schmorp.de/marc/liblzf.html" for more on original LZF packag
<distribution>repo</distribution>
</license>
</licenses>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.junit</groupId>
<artifactId>junit-bom</artifactId>
<version>${version.junit5}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>7.5.1</version>
<type>jar</type>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<defaultGoal>install</defaultGoal>
<plugins>
<plugin>
<groupId>org.sonatype.central</groupId>
<artifactId>central-publishing-maven-plugin</artifactId>
</plugin>
<plugin>
<plugin>
<groupId>org.sonatype.central</groupId>
<artifactId>central-publishing-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<!-- 1.6 since 0.9.7 -->
Expand All @@ -89,7 +101,6 @@ See "http://oldhome.schmorp.de/marc/liblzf.html" for more on original LZF packag
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
<encoding>UTF-8</encoding>
<links>
<link>https://docs.oracle.com/javase/8/docs/api/</link>
Expand All @@ -109,62 +120,62 @@ See "http://oldhome.schmorp.de/marc/liblzf.html" for more on original LZF packag
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<configuration>
<mavenExecutorId>forked-path</mavenExecutorId>
<mavenExecutorId>forked-path</mavenExecutorId>
</configuration>
</plugin>
<!-- Plus, let's make jars OSGi bundles as well -->
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions><!-- note: artifact id, name, version and description use defaults (which are fine) -->
<Bundle-Vendor>http://ning.com</Bundle-Vendor>
<!-- if using high-perf decoder: -->
<Import-Package>
sun.misc;resolution:=optional, *
</Import-Package>
<Private-Package>
com.ning.compress.lzf.impl
</Private-Package>
<!-- Export-Package default: set of packages in local Java sources, excluding the default package '.' and any packages containing 'impl' or 'internal' -->
<!-- 06-Jan-2021, tatu: Commented out, I think, since bundle plugin can figure it out? -->
<!--Export-Package>
com.ning.compress,
com.ning.compress.gzip,
com.ning.compress.lzf,
com.ning.compress.lzf.parallel,
com.ning.compress.lzf.util
</Export-Package-->
<Main-Class>com.ning.compress.lzf.LZF</Main-Class>
</instructions>
</configuration>
</plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions><!-- note: artifact id, name, version and description use defaults (which are fine) -->
<Bundle-Vendor>http://ning.com</Bundle-Vendor>
<!-- if using high-perf decoder: -->
<Import-Package>
sun.misc;resolution:=optional, *
</Import-Package>
<Private-Package>
com.ning.compress.lzf.impl
</Private-Package>
<!-- Export-Package default: set of packages in local Java sources, excluding the default package '.' and any packages containing 'impl' or 'internal' -->
<!-- 06-Jan-2021, tatu: Commented out, I think, since bundle plugin can figure it out? -->
<!--Export-Package>
com.ning.compress,
com.ning.compress.gzip,
com.ning.compress.lzf,
com.ning.compress.lzf.parallel,
com.ning.compress.lzf.util
</Export-Package-->
<Main-Class>com.ning.compress.lzf.LZF</Main-Class>
</instructions>
</configuration>
</plugin>

<!-- 06-Jan-2021, tatu: Add rudimentary JDK9+ module info. To build with JDK 8
will have to use `moduleInfoFile` which isn't great but will have to do
-->
<plugin>
<groupId>org.moditect</groupId>
<artifactId>moditect-maven-plugin</artifactId>
<executions>
<execution>
<id>add-module-infos</id>
<phase>package</phase>
<goals>
<goal>add-module-info</goal>
</goals>
<configuration>
<overwriteExistingFiles>true</overwriteExistingFiles>
<module>
<moduleInfoFile>src/moditect/module-info.java</moduleInfoFile>
</module>
</configuration>
</execution>
</executions>
</plugin>
<!-- 06-Jan-2021, tatu: Add rudimentary JDK9+ module info. To build with JDK 8
will have to use `moduleInfoFile` which isn't great but will have to do
-->
<plugin>
<groupId>org.moditect</groupId>
<artifactId>moditect-maven-plugin</artifactId>
<executions>
<execution>
<id>add-module-infos</id>
<phase>package</phase>
<goals>
<goal>add-module-info</goal>
</goals>
<configuration>
<overwriteExistingFiles>true</overwriteExistingFiles>
<module>
<moduleInfoFile>src/moditect/module-info.java</moduleInfoFile>
</module>
</configuration>
</execution>
</executions>
</plugin>

<!-- EVEN BETTER; make executable! -->
<!-- EVEN BETTER; make executable! -->

<!-- 08-Sep-2014, tatu: except, doesn't quite work yet. Sigh.
<plugin>
Expand Down Expand Up @@ -208,7 +219,7 @@ com.ning.compress.lzf.util
<programFile>lzf</programFile>
<flags>-Xmx200m</flags>
</configuration>

<executions>
<execution>
<phase>package</phase>
Expand All @@ -220,8 +231,10 @@ com.ning.compress.lzf.util
</plugin>
-->


</plugins>
</build>

<profiles>
<profile>
<id>release-sign-artifacts</id>
Expand Down
13 changes: 7 additions & 6 deletions src/test/java/com/ning/compress/gzip/TestGzipStreams.java
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
package com.ning.compress.gzip;

import java.io.*;
import java.nio.charset.StandardCharsets;
import java.util.zip.*;

import org.testng.Assert;
import org.testng.annotations.Test;

import com.ning.compress.BaseForTests;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertArrayEquals;

public class TestGzipStreams extends BaseForTests
{
private final static String INPUT_STR = "Some somewhat short text string -- but enough repetition to overcome shortness of input";
private final static byte[] INPUT_BYTES;
static {
try {
INPUT_BYTES = INPUT_STR.getBytes("UTF-8");
INPUT_BYTES = INPUT_STR.getBytes(StandardCharsets.UTF_8);
} catch (Exception e) {
throw new RuntimeException(e);
}
Expand All @@ -33,7 +34,7 @@ public void testReusableInputStreams() throws IOException
byte[] raw = bytes.toByteArray();
OptimizedGZIPInputStream re = new OptimizedGZIPInputStream(new ByteArrayInputStream(raw));
byte[] b = _readAll(re);
Assert.assertEquals(INPUT_BYTES, b);
assertArrayEquals(INPUT_BYTES, b);
re.close();
}

Expand All @@ -48,7 +49,7 @@ public void testReusableOutputStreams() throws IOException

byte[] raw = bytes.toByteArray();
byte[] b = _readAll(new GZIPInputStream(new ByteArrayInputStream(raw)));
Assert.assertEquals(INPUT_BYTES, b);
assertArrayEquals(INPUT_BYTES, b);
}

private byte[] _readAll(InputStream in) throws IOException
Expand Down
26 changes: 13 additions & 13 deletions src/test/java/com/ning/compress/gzip/TestGzipUncompressor.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
import java.io.*;
import java.util.Random;

import org.testng.Assert;
import org.testng.annotations.Test;

import com.ning.compress.BaseForTests;
import com.ning.compress.DataHandler;
import com.ning.compress.UncompressorOutputStream;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertArrayEquals;

public class TestGzipUncompressor extends BaseForTests
{
@Test
@Test
public void testSimpleSmall1by1() throws IOException
{
byte[] fluff = constructFluff(4000);
Expand All @@ -25,8 +25,8 @@ public void testSimpleSmall1by1() throws IOException
}
uncomp.complete();
byte[] result = co.getBytes();
Assert.assertEquals(fluff, result);

assertArrayEquals(fluff, result);
}

@Test
Expand All @@ -41,7 +41,7 @@ public void testSimpleSmallAsChunk() throws IOException
uncomp.feedCompressedData(comp, 0, comp.length);
uncomp.complete();
byte[] result = co.getBytes();
Assert.assertEquals(fluff, result);
assertArrayEquals(fluff, result);
}

@Test
Expand All @@ -61,8 +61,8 @@ public void testSimpleBiggerVarLength() throws IOException
}
uncomp.complete();
byte[] result = co.getBytes();
Assert.assertEquals(fluff, result);

assertArrayEquals(fluff, result);
}

@Test
Expand All @@ -77,8 +77,8 @@ public void testSimpleBiggerOneChunk() throws IOException
uncomp.feedCompressedData(comp, 0, comp.length);
uncomp.complete();
byte[] result = co.getBytes();
Assert.assertEquals(fluff, result);

assertArrayEquals(fluff, result);
}

@Test
Expand All @@ -91,8 +91,8 @@ public void testSimpleBiggerAsStream() throws IOException
out.write(comp, 0, comp.length);
out.close();
byte[] result = co.getBytes();
Assert.assertEquals(fluff, result);

assertArrayEquals(fluff, result);
}

/*
Expand Down
Loading