#2140 - Bump ebean-migration dependency of ebean-ddl-generator to 12.4.0 (update ebean-test)

This commit is contained in:
rob bygrave committed 2020-12-23 20:22:50 +13:00
1 parent 53386e9bf4
commit fe874c946d
5 files changed
+65 -4

No files matched your search

+1 -1
View File
@@ -70,7 +70,7 @@
<dependency> <dependency>
<groupId>io.ebean</groupId> <groupId>io.ebean</groupId>
<artifactId>ebean-migration</artifactId> <artifactId>ebean-migration</artifactId>
<version>12.2.0</version> <version>12.4.0</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
+1 -1
View File
@@ -23,7 +23,7 @@
<dependency> <dependency>
<groupId>io.ebean</groupId> <groupId>io.ebean</groupId>
<artifactId>ebean-migration</artifactId> <artifactId>ebean-migration</artifactId>
<version>12.2.0</version> <version>12.4.0</version>
</dependency> </dependency>
<dependency> <dependency>
+1 -1
View File
@@ -91,7 +91,7 @@
<dependency> <dependency>
<groupId>org.postgresql</groupId> <groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId> <artifactId>postgresql</artifactId>
<version>42.2.12</version> <version>42.2.18</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
@@ -1,7 +1,6 @@
package io.ebean.test; package io.ebean.test;
import io.ebean.DB; import io.ebean.DB;
import io.ebean.migration.util.IOUtils;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
@@ -0,0 +1,62 @@
package io.ebean.test;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.nio.charset.StandardCharsets;
/**
* Utilities for IO.
*/
class IOUtils {
/**
* Reads the entire contents of the specified input stream and return them as UTF-8 string.
*/
static String readUtf8(InputStream in) throws IOException {
return bytesToUtf8(read(in));
}
/**
* Reads the entire contents of the specified input stream and returns them as a byte array.
*/
private static byte[] read(InputStream in) throws IOException {
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
pump(in, buffer);
return buffer.toByteArray();
}
/**
* Returns the UTF-8 string corresponding to the specified bytes.
*/
private static String bytesToUtf8(byte[] data) {
return new String(data, StandardCharsets.UTF_8);
}
/**
* Reads data from the specified input stream and copies it to the specified
* output stream, until the input stream is at EOF. Both streams are then
* closed.
*/
private static void pump(InputStream in, OutputStream out) throws IOException {
if (in == null) throw new IOException("Input stream is null");
if (out == null) throw new IOException("Output stream is null");
try {
try {
byte[] buffer = new byte[4096];
for (; ; ) {
int bytes = in.read(buffer);
if (bytes < 0) {
break;
}
out.write(buffer, 0, bytes);
}
} finally {
in.close();
}
} finally {
out.close();
}
}
}