Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NOID] Cleans up resources after the tests #493

Merged
merged 1 commit into from
Sep 18, 2023
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
6 changes: 6 additions & 0 deletions core/src/test/java/apoc/export/BigGraphTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import apoc.refactor.rename.Rename;
import apoc.util.TestUtil;
import apoc.util.Util;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.ClassRule;
import org.junit.Test;
Expand Down Expand Up @@ -75,6 +76,11 @@ public static void setUp() {
IntStream.range(0, 10000).forEach(__-> db.executeTransactionally(query));
}

@AfterClass
public static void teardown() {
db.shutdown();
}

@Test
public void testTerminateExportCsv() {
checkTerminationGuard(db, "CALL apoc.export.csv.all('testTerminate.csv',{bulkImport: true})");
Expand Down
6 changes: 6 additions & 0 deletions core/src/test/java/apoc/export/ExportCoreSecurityTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import apoc.util.TestUtil;
import apoc.util.Util;
import com.nimbusds.jose.util.Pair;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.ClassRule;
Expand Down Expand Up @@ -91,6 +92,11 @@ public static void setUp() {
TestUtil.registerProcedure(db, ExportCSV.class, ExportJson.class, ExportGraphML.class, ExportCypher.class);
}

@AfterClass
public static void teardown() {
db.shutdown();
}

public static void setFileExport(boolean allowed) {
ApocConfig.apocConfig().setProperty(ApocConfig.APOC_EXPORT_FILE_ENABLED, allowed);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import inet.ipaddr.IPAddressString;
import org.apache.commons.lang3.exception.ExceptionUtils;
import org.assertj.core.api.Assertions;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.ClassRule;
import org.junit.Test;
Expand Down Expand Up @@ -149,7 +150,11 @@ public static void setUp() {
// load procedures (Xml contains both `apoc.load.xml` and `apoc.import.xml` procedures)
LoadJson.class, LoadArrow.class);
}


@AfterClass
public static void teardown() {
db.shutdown();
}

@Test
public void testIllegalFSAccessWithDifferentApocConfs() {
Expand Down
6 changes: 6 additions & 0 deletions core/src/test/java/apoc/export/arrow/ArrowTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import apoc.util.JsonUtil;
import apoc.util.TestUtil;
import com.fasterxml.jackson.core.JsonProcessingException;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.ClassRule;
Expand Down Expand Up @@ -116,6 +117,11 @@ public static void beforeClass() {
TestUtil.registerProcedure(db, ExportArrow.class, LoadArrow.class, Graphs.class, Meta.class);
}

@AfterClass
public static void teardown() {
db.shutdown();
}

@Before
public void before() {
apocConfig().setProperty(APOC_IMPORT_FILE_ENABLED, true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import apoc.util.TestUtil;
import apoc.util.Util;
import com.nimbusds.jose.util.Pair;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.ClassRule;
import org.junit.Test;
Expand Down Expand Up @@ -93,6 +94,11 @@ public static void setUp() {
TestUtil.registerProcedure(db, ExportArrow.class, Meta.class);
}

@AfterClass
public static void teardown() {
db.shutdown();
}

private static Collection<Object[]> getParameterData(List<Pair<String, Consumer<Map>>> fileAndErrors) {
return ExportCoreSecurityTest.getParameterData(fileAndErrors, EXPORT_PROCEDURES, APOC_EXPORT_PROCEDURE_NAME);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import apoc.util.Util;
import apoc.util.collection.Iterators;
import org.apache.commons.lang3.exception.ExceptionUtils;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
Expand Down Expand Up @@ -115,6 +116,11 @@ public void before() {
db.executeTransactionally("CREATE (a:Types {date: date('2018-10-30'), localDateTime: localdatetime('20181030T19:32:24'), dateTime: datetime('2018-10-30T12:50:35.556+0100'), localtime: localtime('12:50:35.556'), duration: duration('P5M1DT12H'), time: time('125035.556+0100'), born_2D: point({ x: 2.3, y: 4.5 }), born_3D:point({ longitude: 56.7, latitude: 12.78, height: 100 })})");
}

@After
public void teardown() {
db.shutdown();
}

@Test
public void testCypherExportCsvForAdminNeo4jImportWithCompressionNone() {
String fileBaseName = "query_nodes_no_compress_and_Ext";
Expand Down
6 changes: 6 additions & 0 deletions core/src/test/java/apoc/export/csv/ExportCsvTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import apoc.util.TestUtil;
import apoc.util.Util;
import apoc.util.collection.Iterators;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.ClassRule;
Expand Down Expand Up @@ -158,6 +159,11 @@ public static void setUp() {
db.executeTransactionally("CREATE (f:Address1:Address {name:'Andrea', city: 'Milano', street:'Via Garibaldi, 7'})-[:NEXT_DELIVERY]->(a:Address {name: 'Bar Sport'}), (b:Address {street: 'via Benni'})");
}

@AfterClass
public static void teardown() {
db.shutdown();
}

private String readFile(String fileName) {
return readFile(fileName, UTF_8, CompressionAlgo.NONE);
}
Expand Down
6 changes: 6 additions & 0 deletions core/src/test/java/apoc/export/csv/ImportCsvLdbcTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

import apoc.csv.CsvTestUtil;
import apoc.util.TestUtil;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Rule;
Expand Down Expand Up @@ -146,6 +147,11 @@ public void setUp() throws Exception {
apocConfig().setProperty(APOC_EXPORT_FILE_ENABLED, true);
}

@After
public void teardown() {
db.shutdown();
}

@Test
public void testLdbc() {
final List<Map<String, Object>> nodes = new ArrayList<>();
Expand Down
6 changes: 6 additions & 0 deletions core/src/test/java/apoc/export/csv/ImportCsvTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import apoc.util.CompressionAlgo;
import apoc.util.TestUtil;
import org.apache.commons.io.FileUtils;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Rule;
Expand Down Expand Up @@ -254,6 +255,11 @@ public void setUp() throws IOException {
apocConfig().setProperty(APOC_IMPORT_FILE_ENABLED, true);
apocConfig().setProperty(APOC_EXPORT_FILE_ENABLED, true);
}

@After
public void teardown() {
db.shutdown();
}

@Test
public void testImportCsvLargeFile() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import apoc.cypher.Cypher;
import apoc.util.TestUtil;
import apoc.util.collection.Iterators;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
Expand Down Expand Up @@ -80,7 +81,12 @@ public void setUp() {
"(pers)-[:IS_TEAM_MEMBER_OF {name: 'eee'}]->(:Team {name: 'two'})");

}


@After
public void teardown() {
db.shutdown();
}

@Test
public void updateAllOptimizationNone() {
String expectedCypherStatement = NODES_MULTI_RELS + SCHEMA_WITH_UNIQUE_IMPORT_ID + RELS_MULTI_RELS + CLEANUP_SMALL_BATCH;
Expand Down
6 changes: 6 additions & 0 deletions core/src/test/java/apoc/export/cypher/ExportCypherTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import apoc.util.MapUtil;
import apoc.util.TestUtil;
import apoc.util.Util;
import org.junit.After;
import org.junit.Assert;

import java.util.ArrayList;
Expand Down Expand Up @@ -105,6 +106,11 @@ public void setUp() {
ExportCypherTestUtils.setUp(db, testName);
}

@After
public void teardown() {
db.shutdown();
}

@Test
public void testRoundTripCypherExportAll() {
final String cypherStatements = Util.readResourceFile("exportAll.cypher");
Expand Down
6 changes: 6 additions & 0 deletions core/src/test/java/apoc/export/graphml/ExportGraphMLTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import junit.framework.TestCase;
import org.apache.commons.lang3.exception.ExceptionUtils;
import org.apache.commons.lang3.StringUtils;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Rule;
Expand Down Expand Up @@ -109,6 +110,11 @@ public void setUp() {
setUpGraphMl(db, testName);
}

@After
public void teardown() {
db.shutdown();
}

@Test
public void testImportGraphML() throws Exception {
db.executeTransactionally("MATCH (n) DETACH DELETE n");
Expand Down
6 changes: 6 additions & 0 deletions core/src/test/java/apoc/export/json/ExportJsonTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import apoc.util.FileTestUtil;
import apoc.util.TestUtil;
import apoc.util.Util;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Rule;
Expand Down Expand Up @@ -99,6 +100,11 @@ public void setup() {
""");
}

@After
public void teardown() {
db.shutdown();
}

@Test
public void testExportAllJson() {
String filename = "all.json";
Expand Down
8 changes: 7 additions & 1 deletion core/src/test/java/apoc/export/json/ImportJsonTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import junit.framework.TestCase;
import org.apache.commons.lang3.exception.ExceptionUtils;
import apoc.util.Utils;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Rule;
Expand Down Expand Up @@ -88,7 +89,12 @@ public void setUp() {
TestUtil.registerProcedure(db, ImportJson.class, Schemas.class, Utils.class);
apocConfig().setProperty(APOC_IMPORT_FILE_ENABLED, true);
}


@After
public void teardown() {
db.shutdown();
}

@Test
public void shouldImportAllJsonWithoutImportId() {
shouldImportAllCommon(map("cleanup", true), 8, 0L);
Expand Down
6 changes: 6 additions & 0 deletions core/src/test/java/apoc/graph/GraphsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.exception.ExceptionUtils;
import org.apache.commons.lang3.math.NumberUtils;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
Expand Down Expand Up @@ -93,6 +94,11 @@ public void setUp() {
});
}

@After
public void teardown() {
db.shutdown();
}

@Test
public void testFromData() {
TestUtil.testCall(db,"MATCH (n)-[r]->(m) CALL apoc.graph.fromData([n,m],[r],'test',{answer:42}) YIELD graph RETURN *",
Expand Down
6 changes: 6 additions & 0 deletions core/src/test/java/apoc/hashing/FingerprintingTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import apoc.util.TestUtil;
import apoc.util.Util;
import org.apache.commons.lang3.exception.ExceptionUtils;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
Expand Down Expand Up @@ -55,6 +56,11 @@ public void setup() {
TestUtil.registerProcedure(db, Fingerprinting.class, Graphs.class, Coll.class);
}

@After
public void teardown() {
db.shutdown();
}

@Test
public void fingerprintScalars() {

Expand Down
6 changes: 6 additions & 0 deletions core/src/test/java/apoc/help/HelpTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import apoc.create.Create;
import apoc.diff.Diff;
import apoc.util.TestUtil;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
Expand All @@ -48,6 +49,11 @@ public void setUp() {
TestUtil.registerProcedure(db, Help.class, BitwiseOperations.class, Coll.class, Diff.class, Create.class);
}

@After
public void teardown() {
db.shutdown();
}

@Test
public void info() {
TestUtil.testCall(db,"CALL apoc.help($text)",map("text","bitwise"), (row) -> {
Expand Down
6 changes: 6 additions & 0 deletions core/src/test/java/apoc/index/SchemaIndexTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
package apoc.index;

import apoc.util.TestUtil;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.ClassRule;
import org.junit.Test;
Expand Down Expand Up @@ -108,6 +109,11 @@ public static void setUp() {
}
}

@AfterClass
public static void teardown() {
db.shutdown();
}

@Test
public void testDistinctPropertiesOnFirstIndex() {
testCall(db,"CALL apoc.schema.properties.distinct($label, $key)",
Expand Down
6 changes: 6 additions & 0 deletions core/src/test/java/apoc/label/LabelTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
package apoc.label;

import apoc.util.TestUtil;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.ClassRule;
import org.junit.Test;
Expand All @@ -38,6 +39,11 @@ public static void setUp() {
TestUtil.registerProcedure(db, Label.class);
}

@AfterClass
public static void teardown() {
db.shutdown();
}

@Test
public void testVerifyNodeLabelExistence() {

Expand Down
1 change: 1 addition & 0 deletions core/src/test/java/apoc/load/LoadJsonTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ public static void stopServer() {
@After
public void cleanup() {
server.stop(0);
db.shutdown();
}

@Test public void testLoadJson() {
Expand Down
Loading