Skip to content

Commit

Permalink
improve javadocs and make some tests more robust
Browse files Browse the repository at this point in the history
  • Loading branch information
hmottestad committed Nov 10, 2024
1 parent 8fbb4ee commit c47fe2b
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,8 @@ public byte[] getData(long offset) throws IOException {
(data[2] << 8) & 0x0000ff00 |
(data[3]) & 0x000000ff;

// If the data length is larger than 750MB, we are likely reading the wrong data. Probably data corruption.
// If the data length is larger than 750MB, we are likely reading the wrong data. Probably data corruption. The
// limit of 750MB was chosen based on results from experimenting in the NativeSailStoreCorruptionTest class.
if (dataLength > 128 * 1024 * 1024) {
if (SOFT_FAIL_ON_CORRUPT_DATA_AND_REPAIR_INDEXES) {
logger.error(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.Timeout;
import org.junit.jupiter.api.parallel.Isolated;
import org.slf4j.LoggerFactory;

Expand All @@ -67,6 +68,7 @@ public static void afterAll() {
}

@Test
@Timeout(value = 30, unit = TimeUnit.MINUTES)
public void testDataAndShapes() {
System.out.println("testDataAndShapes");

Expand Down Expand Up @@ -339,6 +341,7 @@ private void remove(String turtle, IRI graph) {
}

@Test
@Timeout(value = 30, unit = TimeUnit.MINUTES)
public void testLotsOfValidationFailuresSnapshot() throws IOException {
System.out.println("testLotsOfValidationFailuresSnapshot");
ShaclSail sail = new ShaclSail(getBaseSail());
Expand All @@ -354,6 +357,7 @@ public void testLotsOfValidationFailuresSnapshot() throws IOException {
}

@Test
@Timeout(value = 30, unit = TimeUnit.MINUTES)
public void testLotsOfValidationFailuresSerializableValidation() throws IOException {
System.out.println("testLotsOfValidationFailuresSerializableValidation");
Logger root = (Logger) LoggerFactory.getLogger(ShaclSailBaseConfiguration.class.getName());
Expand All @@ -371,6 +375,7 @@ public void testLotsOfValidationFailuresSerializableValidation() throws IOExcept
}

@Test
@Timeout(value = 30, unit = TimeUnit.MINUTES)
public void testLotsOfValidationFailuresSerializable() throws IOException {
System.out.println("testLotsOfValidationFailuresSerializable");

Expand All @@ -389,6 +394,7 @@ public void testLotsOfValidationFailuresSerializable() throws IOException {
}

@Test
@Timeout(value = 30, unit = TimeUnit.MINUTES)
public void testLotsOfValidationFailuresReadCommitted() throws IOException {
System.out.println("testLotsOfValidationFailuresReadCommitted");
ShaclSail sail = new ShaclSail(getBaseSail());
Expand All @@ -403,6 +409,7 @@ public void testLotsOfValidationFailuresReadCommitted() throws IOException {
}

@Test
@Timeout(value = 30, unit = TimeUnit.MINUTES)
public void testLotsOfValidationFailuresReadUncommitted() throws IOException {
System.out.println("testLotsOfValidationFailuresReadUncommitted");
ShaclSail sail = new ShaclSail(getBaseSail());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.Timeout;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -155,6 +156,7 @@ public int getSize() {
* @see <a href="https://github.com/eclipse/rdf4j/issues/693">https://github.com/eclipse/rdf4j/issues/693</a>
*/
@Test
@Timeout(value = 30, unit = TimeUnit.MINUTES)
public void testConcurrentAddLargeTxn() throws Exception {
logger.info("executing two large concurrent transactions");
final CountDownLatch runnersDone = new CountDownLatch(2);
Expand Down Expand Up @@ -196,6 +198,7 @@ public void testConcurrentAddLargeTxn() throws Exception {
* one of the transactions rolls back at the end.
*/
@Test
@Timeout(value = 30, unit = TimeUnit.MINUTES)
public void testConcurrentAddLargeTxnRollback() throws Exception {
logger.info("executing two large concurrent transactions");
final CountDownLatch runnersDone = new CountDownLatch(2);
Expand Down Expand Up @@ -237,6 +240,7 @@ public void testConcurrentAddLargeTxnRollback() throws Exception {
}

@Test
@Timeout(value = 30, unit = TimeUnit.MINUTES)
@Disabled("This test takes a long time and accomplishes little extra")
public void testGetContextIDs() throws Exception {
// Create one thread which writes statements to the repository, on a
Expand Down Expand Up @@ -314,6 +318,7 @@ public void testGetContextIDs() throws Exception {
}

@Test
@Timeout(value = 30, unit = TimeUnit.MINUTES)
public void testConcurrentConnectionsShutdown() throws InterruptedException {
if (store instanceof AbstractSail) {
((AbstractSail) store).setConnectionTimeOut(200);
Expand Down Expand Up @@ -356,8 +361,9 @@ public void testConcurrentConnectionsShutdown() throws InterruptedException {

}

// @Disabled
// @Disabled
@Test
@Timeout(value = 30, unit = TimeUnit.MINUTES)
public void testSerialThreads() throws InterruptedException {
if (store instanceof AbstractSail) {
((AbstractSail) store).setConnectionTimeOut(200);
Expand Down Expand Up @@ -438,6 +444,7 @@ public void testSerialThreads() throws InterruptedException {
}

@Test
@Timeout(value = 30, unit = TimeUnit.MINUTES)
public void testConcurrentConnectionsShutdownReadCommitted() throws InterruptedException {
if (store instanceof AbstractSail) {
((AbstractSail) store).setConnectionTimeOut(200);
Expand Down Expand Up @@ -493,6 +500,7 @@ public void testConcurrentConnectionsShutdownReadCommitted() throws InterruptedE
}

@Test
@Timeout(value = 30, unit = TimeUnit.MINUTES)
public void testConcurrentConnectionsShutdownAndClose() throws InterruptedException {
if (store instanceof AbstractSail) {
((AbstractSail) store).setConnectionTimeOut(200);
Expand Down Expand Up @@ -568,6 +576,7 @@ public void testConcurrentConnectionsShutdownAndClose() throws InterruptedExcept
}

@Test
@Timeout(value = 30, unit = TimeUnit.MINUTES)
public void testConcurrentConnectionsShutdownAndCloseRollback() throws InterruptedException {
if (store instanceof AbstractSail) {
((AbstractSail) store).setConnectionTimeOut(200);
Expand Down

0 comments on commit c47fe2b

Please sign in to comment.