Skip to content

Commit

Permalink
chore: Add Test Suites
Browse files Browse the repository at this point in the history
  • Loading branch information
Romuald Rousseau committed Oct 3, 2024
1 parent 3f06b86 commit d21cf39
Show file tree
Hide file tree
Showing 98 changed files with 571 additions and 366 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.github.romualdrousseau.archery.commons.bigdata;
package com.github.romualdrousseau.archery.commons.collections;

import java.util.ArrayList;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.github.romualdrousseau.archery.commons.bigdata;
package com.github.romualdrousseau.archery.commons.collections;

public class ChunkMetaData {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.github.romualdrousseau.archery.commons.bigdata;
package com.github.romualdrousseau.archery.commons.collections;

import java.io.IOException;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.github.romualdrousseau.archery.commons.bigdata;
package com.github.romualdrousseau.archery.commons.collections;

import java.io.IOException;
import java.io.InputStream;
Expand All @@ -11,8 +11,8 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.github.romualdrousseau.archery.commons.bigdata.serializer.ChunkSerializerFury;
import com.github.romualdrousseau.archery.commons.bigdata.serializer.ChunkSerializerJava;
import com.github.romualdrousseau.archery.commons.collections.serializer.ChunkSerializerFury;
import com.github.romualdrousseau.archery.commons.collections.serializer.ChunkSerializerJava;

public class ChunkSerializerFactory {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.github.romualdrousseau.archery.commons.types;
package com.github.romualdrousseau.archery.commons.collections;

import java.util.ArrayList;
import java.util.Collections;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.github.romualdrousseau.archery.commons.bigdata;
package com.github.romualdrousseau.archery.commons.collections;

import java.io.Closeable;
import java.io.IOException;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.github.romualdrousseau.archery.commons.bigdata;
package com.github.romualdrousseau.archery.commons.collections;

import java.util.Iterator;
import java.util.Spliterator;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.github.romualdrousseau.archery.commons.bigdata;
package com.github.romualdrousseau.archery.commons.collections;

import java.io.Closeable;
import java.io.IOException;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.github.romualdrousseau.archery.commons.bigdata;
package com.github.romualdrousseau.archery.commons.collections;

import java.util.Iterator;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.github.romualdrousseau.archery.commons.bigdata;
package com.github.romualdrousseau.archery.commons.collections;

import java.util.Iterator;
import java.util.Spliterator;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.github.romualdrousseau.archery.commons.bigdata;
package com.github.romualdrousseau.archery.commons.collections;

import java.io.Serializable;
import java.util.Iterator;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.github.romualdrousseau.archery.commons.bigdata;
package com.github.romualdrousseau.archery.commons.collections;

import java.util.Iterator;
import java.util.Spliterator;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package com.github.romualdrousseau.archery.commons.bigdata.serializer;
package com.github.romualdrousseau.archery.commons.collections.serializer;

import java.io.IOException;

import org.xerial.snappy.Snappy;

import com.github.romualdrousseau.archery.commons.bigdata.ChunkSerializer;
import com.github.romualdrousseau.archery.commons.bigdata.Row;
import com.github.romualdrousseau.archery.commons.collections.ChunkSerializer;
import com.github.romualdrousseau.archery.commons.collections.Row;

import io.fury.Fury;
import io.fury.config.Language;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package com.github.romualdrousseau.archery.commons.bigdata.serializer;
package com.github.romualdrousseau.archery.commons.collections.serializer;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;

import com.github.romualdrousseau.archery.commons.bigdata.ChunkSerializer;
import com.github.romualdrousseau.archery.commons.bigdata.Row;
import com.github.romualdrousseau.archery.commons.collections.ChunkSerializer;
import com.github.romualdrousseau.archery.commons.collections.Row;

public class ChunkSerializerJava implements ChunkSerializer {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.github.romualdrousseau.archery.util;
package com.github.romualdrousseau.archery.commons.io;

import java.io.File;
import java.io.FileInputStream;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.github.romualdrousseau.archery.util;
package com.github.romualdrousseau.archery.commons.io;

import java.io.Closeable;
import java.io.IOException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import java.util.stream.IntStream;
import java.util.stream.Stream;

import com.github.romualdrousseau.archery.commons.types.CollectionUtils;
import com.github.romualdrousseau.archery.commons.collections.CollectionUtils;
import com.github.romualdrousseau.archery.commons.json.JSON;
import com.github.romualdrousseau.archery.commons.json.JSONArray;
import com.github.romualdrousseau.archery.commons.preprocessing.hasher.DefaultHasher;
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.github.romualdrousseau.archery.commons;

import org.junit.platform.suite.api.IncludeTags;
import org.junit.platform.suite.api.SelectPackages;
import org.junit.platform.suite.api.Suite;

@Suite
@IncludeTags({"unit", "full"})
@SelectPackages("com.github.romualdrousseau.archery.commons")
public class FullTestSuite {
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,26 @@
import static org.junit.Assert.assertThrows;

import java.io.IOException;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.IntStream;

import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.Tag;

import com.github.romualdrousseau.archery.commons.bigdata.ChunkSerializer;
import com.github.romualdrousseau.archery.commons.bigdata.ChunkSerializerFactory;
import com.github.romualdrousseau.archery.commons.bigdata.ChunkSerializerFactory.SerializerType;
import com.github.romualdrousseau.archery.commons.bigdata.DataFrameWriter;
import com.github.romualdrousseau.archery.commons.bigdata.Row;
import com.github.romualdrousseau.archery.commons.collections.ChunkSerializer;
import com.github.romualdrousseau.archery.commons.collections.ChunkSerializerFactory;
import com.github.romualdrousseau.archery.commons.collections.DataFrameWriter;
import com.github.romualdrousseau.archery.commons.collections.Row;
import com.github.romualdrousseau.archery.commons.collections.ChunkSerializerFactory.SerializerType;

public class Test_BigData {
public class Test_Collections {

private final ChunkSerializer serializer = ChunkSerializerFactory.newInstance(SerializerType.FURY);

@Test
@Tag("unit")
public void testSerialize() throws IOException {
final var rows = IntStream.range(0, 10000)
.mapToObj(i -> Row.of(IntStream.range(0, 1000)
Expand All @@ -42,6 +43,7 @@ public void testSerialize() throws IOException {
}

@Test
@Tag("unit")
public void testDataFrameWhole() throws IOException {
try (final var writer = new DataFrameWriter(100, 10)) {
for (int i = 0; i < 10; i++) {
Expand All @@ -60,6 +62,7 @@ public void testDataFrameWhole() throws IOException {
}

@Test
@Tag("unit")
public void testDataFrameFullView() throws IOException {
try (final var writer = new DataFrameWriter(100, 10)) {
for (int i = 0; i < 10; i++) {
Expand All @@ -79,6 +82,7 @@ public void testDataFrameFullView() throws IOException {
}

@Test
@Tag("unit")
public void testDataFramePartialView() throws IOException {
try (final var writer = new DataFrameWriter(100, 100)) {
for (int i = 0; i < 5000; i++) {
Expand All @@ -98,6 +102,7 @@ public void testDataFramePartialView() throws IOException {
}

@Test
@Tag("unit")
public void testDataFrameRandom() throws IOException {
try (final var writer = new DataFrameWriter(100, 100)) {
for (int i = 0; i < 5000; i++) {
Expand All @@ -113,10 +118,8 @@ public void testDataFrameRandom() throws IOException {
}

@Test
@Tag("full")
public void testDataFrameMassive() throws IOException {
if (!Path.of("/mnt/media2").toFile().exists()) {
return;
}
try (final var writer = new DataFrameWriter(10000, 1000)) {
for (int i = 0; i < 10000000; i++) {
writer.write(Row.of(IntStream.range(0, writer.getColumnCount())
Expand All @@ -134,10 +137,8 @@ public void testDataFrameMassive() throws IOException {
}

@Test
@Tag("full")
public void testArrayListMassive() {
if (!Path.of("/mnt/media2").toFile().exists()) {
return;
}
assertThrows(OutOfMemoryError.class, () -> {
final var list = new ArrayList<String[]>();
for (int i = 0; i < 10000000; i++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@
import java.time.ZoneId;
import java.util.Date;

import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.Tag;

import com.github.romualdrousseau.archery.commons.python.PythonSimpleDateFormat;

public class Test_Python {

@Test
@Tag("unit")
public void testPythonSimpleDateformat() throws ParseException {
final PythonSimpleDateFormat formatter = new PythonSimpleDateFormat("%a,%d/%m/%y");
assertEquals("Sun,24/09/23", formatter.format(Date.from(LocalDate.of(2023, 9, 24).atStartOfDay(ZoneId.systemDefault()).toInstant())));
Expand Down

This file was deleted.

Loading

0 comments on commit d21cf39

Please sign in to comment.