Skip to content

Commit 6824528

Browse files
committed
GH-4886 mint new directories for the LmdbStore tests
1 parent 5d82552 commit 6824528

3 files changed

Lines changed: 38 additions & 37 deletions

File tree

compliance/sparql/src/test/java/org/eclipse/rdf4j/sail/lmdb/LmdbPARQL11UpdateComplianceTest.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
package org.eclipse.rdf4j.sail.lmdb;
1212

1313
import java.io.File;
14+
import java.util.UUID;
1415

1516
import org.eclipse.rdf4j.repository.Repository;
1617
import org.eclipse.rdf4j.repository.dataset.DatasetRepository;
@@ -29,7 +30,11 @@ public class LmdbPARQL11UpdateComplianceTest extends SPARQL11UpdateComplianceTes
2930

3031
@Override
3132
protected Repository newRepository() throws Exception {
33+
34+
var temp = new File(folder, UUID.randomUUID().toString());
35+
temp.mkdir();
36+
3237
return new DatasetRepository(
33-
new SailRepository(new LmdbStore(folder, new LmdbStoreConfig("spoc"))));
38+
new SailRepository(new LmdbStore(temp, new LmdbStoreConfig("spoc"))));
3439
}
3540
}

compliance/sparql/src/test/java/org/eclipse/rdf4j/sail/lmdb/LmdbSPARQL11QueryComplianceTest.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
package org.eclipse.rdf4j.sail.lmdb;
1212

1313
import java.io.File;
14+
import java.util.UUID;
1415

1516
import org.eclipse.rdf4j.repository.Repository;
1617
import org.eclipse.rdf4j.repository.dataset.DatasetRepository;
@@ -29,8 +30,10 @@ public class LmdbSPARQL11QueryComplianceTest extends SPARQL11QueryComplianceTest
2930

3031
@Override
3132
protected Repository newRepository() throws Exception {
33+
var temp = new File(folder, UUID.randomUUID().toString());
34+
temp.mkdir();
3235
return new DatasetRepository(
33-
new SailRepository(new LmdbStore(folder, new LmdbStoreConfig("spoc"))));
36+
new SailRepository(new LmdbStore(temp, new LmdbStoreConfig("spoc"))));
3437
}
3538

3639
}

testsuites/sparql/src/main/java/org/eclipse/rdf4j/testsuite/query/parser/sparql/manifest/SPARQL11UpdateComplianceTest.java

Lines changed: 28 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -134,48 +134,41 @@ protected final void runTest() throws Exception {
134134

135135
logger.debug("running {}", getName());
136136

137-
RepositoryConnection con = dataRep.getConnection();
138-
RepositoryConnection erCon = expectedResultRepo.getConnection();
139-
try {
140-
String updateString = readUpdateString();
137+
try (RepositoryConnection con = dataRep.getConnection()) {
138+
try (RepositoryConnection erCon = expectedResultRepo.getConnection()) {
139+
String updateString = readUpdateString();
141140

142-
con.begin();
141+
con.begin();
143142

144-
Update update = con.prepareUpdate(QueryLanguage.SPARQL, updateString, requestFile);
143+
Update update = con.prepareUpdate(QueryLanguage.SPARQL, updateString, requestFile);
145144

146-
assertThatNoException().isThrownBy(() -> {
147-
int hashCode = update.hashCode();
148-
if (hashCode == System.identityHashCode(update)) {
149-
throw new UnsupportedOperationException(
150-
"hashCode() result is the same as the identityHashCode in "
151-
+ update.getClass().getName());
152-
}
153-
});
145+
assertThatNoException().isThrownBy(() -> {
146+
int hashCode = update.hashCode();
147+
if (hashCode == System.identityHashCode(update)) {
148+
throw new UnsupportedOperationException(
149+
"hashCode() result is the same as the identityHashCode in "
150+
+ update.getClass().getName());
151+
}
152+
});
154153

155-
update.setDataset(dataset);
156-
update.execute();
154+
update.setDataset(dataset);
155+
update.execute();
157156

158-
con.commit();
157+
con.commit();
159158

160-
// check default graph
161-
logger.info("checking default graph");
162-
compareGraphs(Iterations.asList(con.getStatements(null, null, null, true, (Resource) null)),
163-
Iterations.asList(erCon.getStatements(null, null, null, true, (Resource) null)));
159+
// check default graph
160+
logger.info("checking default graph");
161+
compareGraphs(Iterations.asList(con.getStatements(null, null, null, true, (Resource) null)),
162+
Iterations.asList(erCon.getStatements(null, null, null, true, (Resource) null)));
163+
164+
for (String namedGraph : inputNamedGraphs.keySet()) {
165+
logger.info("checking named graph {}", namedGraph);
166+
IRI contextURI = con.getValueFactory().createIRI(namedGraph.replaceAll("\"", ""));
167+
compareGraphs(Iterations.asList(con.getStatements(null, null, null, true, contextURI)),
168+
Iterations.asList(erCon.getStatements(null, null, null, true, contextURI)));
169+
}
164170

165-
for (String namedGraph : inputNamedGraphs.keySet()) {
166-
logger.info("checking named graph {}", namedGraph);
167-
IRI contextURI = con.getValueFactory().createIRI(namedGraph.replaceAll("\"", ""));
168-
compareGraphs(Iterations.asList(con.getStatements(null, null, null, true, contextURI)),
169-
Iterations.asList(erCon.getStatements(null, null, null, true, contextURI)));
170-
}
171-
} catch (Exception e) {
172-
if (con.isActive()) {
173-
con.rollback();
174171
}
175-
throw e;
176-
} finally {
177-
con.close();
178-
erCon.close();
179172
}
180173
}
181174

@@ -229,7 +222,7 @@ public void setUp() throws Exception {
229222
}
230223

231224
@Override
232-
public void tearDown() throws Exception {
225+
public void tearDown() {
233226
if (dataRep != null) {
234227
clear(dataRep);
235228
dataRep.shutDown();

0 commit comments

Comments
 (0)