New Upstream Snapshot - com-hypirion-io-clojure
Ready changes
Summary
Merged new upstream version: 0.3.1+git20170901.1.b757b7d (was: 0.3.1).
Resulting package
Built on 2023-01-19T15:58 (took 4m7s)
The resulting binary packages can be installed (if you have the apt repository enabled) by running one of:
apt install -t fresh-snapshots libcom-hypirion-io-clojure
Diff
diff --git a/.gitignore b/.gitignore
deleted file mode 100644
index c8bea18..0000000
--- a/.gitignore
+++ /dev/null
@@ -1,13 +0,0 @@
-/target
-/lib
-/classes
-/checkouts
-pom.xml
-pom.xml.asc
-*.jar
-*.class
-.lein-deps-sum
-.lein-failures
-.lein-plugins
-.lein-repl-history
-*~
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..d1b4aed
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,10 @@
+language: clojure
+lein: lein2
+branches:
+ only:
+ - master
+jdk:
+ - openjdk6
+ - openjdk7
+ - oraclejdk7
+ - oraclejdk8
diff --git a/README.md b/README.md
index 2e274e4..d3837ec 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,11 @@
# com.hypirion.io
Java library which contain I/O classes for those with specific needs. For the
-API documentation, see <http://hypirion.github.com/com.hypirion.io/>.
+API documentation, see
+<http://hypirion.github.com/com.hypirion.io/0.3.0/index.html>.
+
+This library is stable, and will mostly not change much. Bugs will be highly
+prioritised, and sensible feature requests may be added in the library.
## Usage
diff --git a/debian/changelog b/debian/changelog
index dc411db..4807273 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,9 +1,12 @@
-com-hypirion-io-clojure (0.3.1-5) UNRELEASED; urgency=normal
+com-hypirion-io-clojure (0.3.1+git20170901.1.b757b7d-1) UNRELEASED; urgency=normal
[ Louis-Philippe Véronneau ]
* d/control: New email for the Clojure Team.
- -- Louis-Philippe Véronneau <pollo@debian.org> Sat, 08 Jan 2022 18:32:26 -0500
+ [ Debian Janitor ]
+ * New upstream snapshot.
+
+ -- Louis-Philippe Véronneau <pollo@debian.org> Thu, 19 Jan 2023 15:56:24 -0000
com-hypirion-io-clojure (0.3.1-4) unstable; urgency=medium
diff --git a/project.clj b/project.clj
index ae4d738..37f783d 100644
--- a/project.clj
+++ b/project.clj
@@ -1,4 +1,4 @@
-(defproject com.hypirion/io "0.3.1"
+(defproject com.hypirion/io "0.4-0-SNAPSHOT"
:description "I/O classes in Java for those with specific needs."
:url "https://github.com/hyPiRion/com.hypirion.io"
:license {:name "Eclipse Public License"
@@ -7,7 +7,13 @@
:java-source-paths ["src"]
:javac-options ["-target" "1.6" "-source" "1.6" "-Xlint:-options"]
:deploy-branches ["stable"]
- :profiles
- {:dev {:plugins [[lein-shell "0.2.0"]]
- :aliases {"javadoc" ["shell" "javadoc" "-d" "0.4.0-SNAPSHOT"
- "-sourcepath" "src/" "com.hypirion.io"]}}})
+ :aliases {"test" "junit"
+ "javadoc" ["shell" "javadoc" "-d" "0.4.0-SNAPSHOT"
+ "-sourcepath" "src/" "com.hypirion.io"]}
+ :plugins [[lein-shell "0.2.0"]
+ [lein-junit "1.1.3"]]
+ :profiles {:dev {:java-source-paths ["test"]
+ :junit ["test"]
+ :dependencies [[junit/junit "4.11"]
+ [org.apache.commons/commons-lang3 "3.1"]
+ [commons-io/commons-io "2.4"]]}})
diff --git a/src/com/hypirion/io/Pipe.java b/src/com/hypirion/io/Pipe.java
index de73549..3127396 100644
--- a/src/com/hypirion/io/Pipe.java
+++ b/src/com/hypirion/io/Pipe.java
@@ -138,7 +138,7 @@ public class Pipe {
* Pauses this pipe. Will block until the current blocking read by this pipe
* has finished, regardless of whether this pipe has been stopped or not. If
* this pipe has already been paused or stopped, and there is no blocking
- * read waiting, will immediatly return.
+ * read waiting, will immediately return.
*
* @exception InterruptedException if this thread is interrupted while
* waiting.
diff --git a/test/com/hypirion/io/ClosingPipeTest.java b/test/com/hypirion/io/ClosingPipeTest.java
new file mode 100644
index 0000000..55d9d41
--- /dev/null
+++ b/test/com/hypirion/io/ClosingPipeTest.java
@@ -0,0 +1,116 @@
+/*
+ * Copyright (c) 2013 Jean Niklas L'orange. All rights reserved.
+ *
+ * The use and distribution terms for this software are covered by the
+ * Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
+ * which can be found in the file LICENSE at the root of this distribution.
+ *
+ * By using this software in any fashion, you are agreeing to be bound by
+ * the terms of this license.
+ *
+ * You must not remove this notice, or any other, from this software.
+ */
+
+package com.hypirion.io;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.Reader;
+import java.io.Writer;
+import java.io.StringWriter;
+import java.io.StringReader;
+
+import org.apache.commons.io.IOUtils;
+import org.apache.commons.lang3.RandomStringUtils;
+
+import com.hypirion.io.ClosingPipe;
+
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+public class ClosingPipeTest {
+
+ /**
+ * Tests that a ClosingPipe closes an OutputStream after the InputStream is
+ * properly consumed.
+ */
+ @Test(timeout=1000)
+ public void testBasicStreamClosingCapabilities() throws Exception {
+ String input = RandomStringUtils.random(4023);
+ InputStream in = IOUtils.toInputStream(input, "UTF-8");
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ CloseCheckingOutputStream wrapper = new CloseCheckingOutputStream(out);
+ Pipe p = new ClosingPipe(in, wrapper);
+ p.start();
+ p.join();
+ in.close();
+ String output = out.toString("UTF-8");
+ assertEquals(input, output);
+ assertTrue(String.format("Failed to close for %s", input),
+ wrapper.isClosed);
+ }
+
+ /**
+ * Tests that a ClosingPipe closes a Writer after the Reader is properly
+ * consumed.
+ */
+ @Test(timeout=1000)
+ public void testBasicWriteClosingCapabilities() throws Exception {
+ String input = RandomStringUtils.random(4023);
+ Reader in = new StringReader(input);
+ StringWriter out = new StringWriter();
+ CloseCheckingReader wrapper = new CloseCheckingReader(out);
+ Pipe p = new ClosingPipe(in, wrapper);
+ p.start();
+ p.join();
+ in.close();
+ String output = out.toString();
+ assertEquals(input, output);
+ assertTrue(String.format("Failed to close for %s", input),
+ wrapper.isClosed);
+ }
+
+ public static class CloseCheckingOutputStream extends OutputStream {
+ volatile boolean isClosed;
+ final OutputStream out;
+
+ public CloseCheckingOutputStream(OutputStream out) {
+ this.out = out;
+ }
+
+ synchronized public void write(int b) throws IOException {
+ out.write(b);
+ }
+
+ synchronized public void close() throws IOException {
+ out.close();
+ isClosed = true;
+ }
+ }
+
+ public static class CloseCheckingReader extends Writer {
+ volatile boolean isClosed;
+ final Writer out;
+
+ public CloseCheckingReader(Writer out) {
+ this.out = out;
+ }
+
+ synchronized public void close() throws IOException {
+ out.close();
+ isClosed = true;
+ }
+
+ synchronized public void flush() throws IOException {
+ out.flush();
+ }
+
+ synchronized public void write(char[] cbuf, int off, int len)
+ throws IOException {
+ out.write(cbuf, off, len);
+ }
+ }
+}
diff --git a/test/com/hypirion/io/PipeTest.java b/test/com/hypirion/io/PipeTest.java
new file mode 100644
index 0000000..9370146
--- /dev/null
+++ b/test/com/hypirion/io/PipeTest.java
@@ -0,0 +1,265 @@
+/*
+ * Copyright (c) 2013 Jean Niklas L'orange. All rights reserved.
+ *
+ * The use and distribution terms for this software are covered by the
+ * Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
+ * which can be found in the file LICENSE at the root of this distribution.
+ *
+ * By using this software in any fashion, you are agreeing to be bound by
+ * the terms of this license.
+ *
+ * You must not remove this notice, or any other, from this software.
+ */
+
+package com.hypirion.io;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.Reader;
+import java.io.Writer;
+import java.io.StringWriter;
+import java.io.StringReader;
+
+import org.apache.commons.io.IOUtils;
+import org.apache.commons.lang3.RandomStringUtils;
+
+import com.hypirion.io.Pipe;
+
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+public class PipeTest {
+
+ /**
+ * Tests that an InputStream with random ascii characters will be completely
+ * piped through the pipe.
+ */
+ @Test(timeout=1000)
+ public void testBasicStreamCapabilities() throws Exception {
+ String input = RandomStringUtils.random(3708);
+ InputStream in = IOUtils.toInputStream(input, "UTF-8");
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ Pipe p = new Pipe(in, out);
+ p.start();
+ p.join();
+ in.close();
+ String output = out.toString("UTF-8");
+ out.close();
+ assertEquals(input, output);
+ }
+
+ /**
+ * Test that multiple InputStreams with random ascii characters will be
+ * completely piped through the pipe, and not close the OutputStream.
+ */
+ @Test(timeout=1000)
+ public void testStreamConcatenation() throws Exception {
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ String input = "";
+ for (int i = 0; i < 10; i++) {
+ String inString = RandomStringUtils.random(3708);
+ input += inString;
+ InputStream in = IOUtils.toInputStream(inString, "UTF-8");
+ Pipe p = new Pipe(in, out);
+ p.start();
+ p.join();
+ in.close();
+ }
+ String output = out.toString("UTF-8");
+ out.close();
+ assertEquals(input, output);
+ }
+
+ /**
+ * Test that multiple pipes running concurrently won't leave any chars
+ * behind.
+ */
+ @Test(timeout = 1000)
+ public void testConcurrentStreamPiping() throws Exception {
+ final int charCount = 30;
+ final char[] vals = "123456789".toCharArray();
+ final int n = vals.length;
+ InputStream[] istreams = new InputStream[n];
+
+ // Generate n istreams with charCount equal elements in them.
+ for (int i = 0; i < n; i++) {
+ String s = "";
+ for (int j = 0; j < charCount; j++) {
+ s += vals[i];
+ }
+ InputStream is = IOUtils.toInputStream(s, "UTF-8");
+ istreams[i] = new SlowInputStream(is);
+ }
+ ByteArrayOutputStream wrt = new ByteArrayOutputStream();
+ Pipe[] pipes = new Pipe[n];
+ for (int i = 0; i < n; i++) {
+ pipes[i] = new Pipe(istreams[i], wrt);
+ }
+ for (int i = 0; i < n; i++) {
+ pipes[i].start();
+ }
+ for (int i = 0; i < n; i++) {
+ pipes[i].join();
+ istreams[i].close();
+ }
+
+ // Count up elements and ensure that we've got the correct amount of
+ // characters of each type.
+ String out = wrt.toString("UTF-8");
+ char[] output = out.toCharArray();
+ wrt.close();
+ for (char v : vals) {
+ int sum = 0;
+ for (char c : output) {
+ if (c == v) {
+ sum++;
+ }
+ }
+ assertEquals(charCount, sum);
+ }
+ }
+
+
+ /**
+ * Test that basic reader/writer capabilities work as expected.
+ */
+ @Test(timeout=1000)
+ public void testBasicReaderCapabilities() throws Exception {
+ String input = RandomStringUtils.random(3708);
+ StringReader rdr = new StringReader(input);
+ StringWriter wrt = new StringWriter();
+ Pipe p = new Pipe(rdr, wrt);
+ p.start();
+ p.join();
+ String output = wrt.toString();
+ rdr.close();
+ wrt.close();
+ assertEquals(input, output);
+ }
+
+ /**
+ * Test that reading from multiple readers doesn't change or stop the
+ * writer.
+ */
+ @Test(timeout=1000)
+ public void testReaderConcatenation() throws Exception {
+ String input = "";
+ StringWriter wrt = new StringWriter();
+ for (int i = 0; i < 10; i++) {
+ String thisInput = RandomStringUtils.random(3708);
+ input += thisInput;
+ StringReader rdr = new StringReader(thisInput);
+ Pipe p = new Pipe(rdr, wrt);
+ p.start();
+ p.join();
+ rdr.close();
+ }
+ String output = wrt.toString();
+ wrt.close();
+ assertEquals(input, output);
+ }
+
+ /**
+ * Test that multiple pipes running concurrently won't leave any chars
+ * behind.
+ */
+ @Test(timeout = 1000)
+ public void testConcurrentReaderPiping() throws Exception {
+ final int charCount = 30;
+ final char[] vals = "123456789".toCharArray();
+ final int n = vals.length;
+ Reader[] readers = new Reader[n];
+ // Generate n readers with charCount equal elements in them.
+ for (int i = 0; i < n; i++) {
+ String s = "";
+ for (int j = 0; j < charCount; j++) {
+ s += vals[i];
+ }
+ StringReader sr = new StringReader(s);
+ readers[i] = new SlowReader(sr);
+ }
+ StringWriter wrt = new StringWriter();
+ Pipe[] pipes = new Pipe[n];
+ for (int i = 0; i < n; i++) {
+ pipes[i] = new Pipe(readers[i], wrt);
+ }
+ for (int i = 0; i < n; i++) {
+ pipes[i].start();
+ }
+ for (int i = 0; i < n; i++) {
+ pipes[i].join();
+ readers[i].close();
+ }
+
+ // Count up elements and ensure that we've got the correct amount of
+ // characters of each type.
+ String out = wrt.toString();
+ char[] output = out.toCharArray();
+ wrt.close();
+ for (char v : vals) {
+ int sum = 0;
+ for (char c : output) {
+ if (c == v) {
+ sum++;
+ }
+ }
+ assertEquals(charCount, sum);
+ }
+ }
+
+ static class SlowInputStream extends InputStream {
+ final InputStream is;
+
+ public SlowInputStream(InputStream is) {
+ this.is = is;
+ }
+
+ @Override
+ synchronized public void close() throws IOException {
+ is.close();
+ }
+
+ @Override
+ synchronized public int read(byte[] bbuf, int off, int len)
+ throws IOException {
+ try {
+ Thread.yield();
+ } catch (Exception e) {}
+ return is.read(bbuf, off, 1);
+ }
+
+ @Override
+ synchronized public int read() throws IOException {
+ try {
+ Thread.yield();
+ } catch (Exception e) {}
+ return is.read();
+ }
+ }
+
+
+ static class SlowReader extends Reader {
+ final Reader r;
+
+ public SlowReader(Reader r) {
+ this.r = r;
+ }
+
+ @Override
+ synchronized public void close() throws IOException {
+ r.close();
+ }
+
+ @Override
+ synchronized public int read(char[] cbuf, int off, int len)
+ throws IOException {
+ try {
+ Thread.yield();
+ } catch (Exception e) {}
+ return r.read(cbuf, off, 1);
+ }
+ }
+}
Debdiff
[The following lists of changes regard files as different if they have different names, permissions or owners.]
Files in second set of .debs but not in first
-rw-r--r-- root/root /usr/share/java/hypirion-io-0.3.1+git20170901.1.b757b7d.jar
No differences were encountered in the control files