Skip to content

Commit

Permalink
Adapt integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
zorglube committed Feb 25, 2023
1 parent 00b9061 commit 4a1a60c
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,16 @@ public Object poiStreaming() throws Exception {
@Benchmark
public Object fastExcel() throws IOException {
CountingOutputStream count = new CountingOutputStream(new NullOutputStream());
Workbook wb = new Workbook(count, "Perf", "1.0");
Worksheet ws = wb.newWorksheet("Sheet 1");
for (int r = 0; r < NB_ROWS; ++r) {
ws.value(r, 0, r);
ws.value(r, 1, Integer.toString(r % 1000));
ws.value(r, 2, r / 87.0);
ws.value(r, 3, new Date(1549915044));
try(Workbook wb = new Workbook(count, "Perf", "1.0")){
Worksheet ws = wb.newWorksheet("Sheet 1");
for (int r = 0; r < NB_ROWS; ++r) {
ws.value(r, 0, r);
ws.value(r, 1, Integer.toString(r % 1000));
ws.value(r, 2, r / 87.0);
ws.value(r, 3, new Date(1549915044));
}
ws.range(0, 3, NB_ROWS - 1, 3).style().format("yyyy-mm-dd hh:mm:ss").set();
}
ws.range(0, 3, NB_ROWS - 1, 3).style().format("yyyy-mm-dd hh:mm:ss").set();
wb.finish();
return count.getCount();
}

Expand Down
5 changes: 2 additions & 3 deletions e2e/src/test/java/org/dhatim/fastexcel/EncryptionTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,11 @@ public class EncryptionTest {


void fastexcelWriteProtectTest() throws IOException, GeneralSecurityException, InvalidFormatException {
try (ByteArrayOutputStream bos = new ByteArrayOutputStream(); POIFSFileSystem fs = new POIFSFileSystem()) {
Workbook wb = new Workbook(bos, "Test", "1.0");
try (ByteArrayOutputStream bos = new ByteArrayOutputStream(); POIFSFileSystem fs = new POIFSFileSystem(); Workbook wb = new Workbook(bos, "Test", "1.0");) {
wb.setGlobalDefaultFont("Arial", 15.5);
Worksheet ws = wb.newWorksheet("Worksheet 1");
ws.value(0, 0, testContent);
wb.finish();
wb.close();
byte[] bytes = bos.toByteArray();
EncryptionInfo info = new EncryptionInfo(EncryptionMode.agile);
// EncryptionInfo info = new EncryptionInfo(EncryptionMode.agile, CipherAlgorithm.aes192, HashAlgorithm.sha384, -1, -1, null);
Expand Down
24 changes: 12 additions & 12 deletions e2e/src/test/java/org/dhatim/fastexcel/MemoryUsageE2E.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,21 +40,21 @@ void writeAndReadFile() throws IOException {
}

private void write(OutputStream out) throws IOException {
Workbook wb = new Workbook(out, "test", "1.0");
for (int s = 0; s < SHEETS; s++) {
Worksheet sheet = wb.newWorksheet("sheet " + s);
for (int r = 0; r < ROWS; r++) {
printProgress("writing", s, r);
for (int c = 0; c < COLS; c++) {
sheet.value(r, c, valueFor(r, c));
}
if (r % FLUSH_EVERY_NR_OR_ROWS == 0) {
sheet.flush();
try(Workbook wb = new Workbook(out, "test", "1.0")){
for (int s = 0; s < SHEETS; s++) {
try(Worksheet sheet = wb.newWorksheet("sheet " + s)){
for (int r = 0; r < ROWS; r++) {
printProgress("writing", s, r);
for (int c = 0; c < COLS; c++) {
sheet.value(r, c, valueFor(r, c));
}
if (r % FLUSH_EVERY_NR_OR_ROWS == 0) {
sheet.flush();
}
}
}
}
sheet.finish();
}
wb.finish();
}

private void read(ReadableWorkbook wb) {
Expand Down

0 comments on commit 4a1a60c

Please sign in to comment.