|
10 | 10 | *******************************************************************************/ |
11 | 11 | package org.eclipse.rdf4j.sail.memory; |
12 | 12 |
|
| 13 | +import static org.assertj.core.api.Assertions.assertThat; |
| 14 | + |
13 | 15 | import java.io.File; |
14 | 16 |
|
| 17 | +import org.eclipse.rdf4j.common.transaction.IsolationLevels; |
| 18 | +import org.eclipse.rdf4j.model.IRI; |
| 19 | +import org.eclipse.rdf4j.model.vocabulary.RDF; |
15 | 20 | import org.eclipse.rdf4j.repository.Repository; |
16 | 21 | import org.eclipse.rdf4j.repository.sail.SailRepository; |
17 | 22 | import org.eclipse.rdf4j.testsuite.repository.RepositoryConnectionTest; |
| 23 | +import org.junit.jupiter.api.Test; |
18 | 24 |
|
19 | 25 | public class MemoryStoreConnectionTest extends RepositoryConnectionTest { |
20 | 26 | @Override |
21 | 27 | protected Repository createRepository(File dataDir) { |
22 | 28 | return new SailRepository(new MemoryStore()); |
23 | 29 | } |
| 30 | + |
| 31 | + @Test |
| 32 | + public void reallyBigUpdateToTriggerPotentialStackOverflowTest() { |
| 33 | + setupTest(IsolationLevels.NONE); |
| 34 | + |
| 35 | + IRI g1 = vf.createIRI("urn:test:g1"); |
| 36 | + testCon.begin(); |
| 37 | + testCon.add(vf.createBNode(), RDF.TYPE, g1); |
| 38 | + testCon.commit(); |
| 39 | + |
| 40 | + testCon.begin(); |
| 41 | + |
| 42 | + StringBuilder bigUpdate = new StringBuilder(); |
| 43 | + bigUpdate.append("DELETE { ?s ?p ?o } INSERT{\n"); |
| 44 | + |
| 45 | + for (int i = 0; i < 20000; i++) { |
| 46 | + bigUpdate.append(" [] <urn:test:prop> \"").append(i).append("\".\n"); |
| 47 | + } |
| 48 | + bigUpdate.append("\n} WHERE { ?s ?p ?o }"); |
| 49 | + |
| 50 | + testCon.prepareUpdate(bigUpdate.toString()).execute(); |
| 51 | + |
| 52 | + long size = testCon.size(); |
| 53 | + assertThat(size).isEqualTo(20000); |
| 54 | + testCon.commit(); |
| 55 | + } |
24 | 56 | } |
0 commit comments