Skip to content

Commit

Permalink
Latest MySQL driver
Browse files Browse the repository at this point in the history
  • Loading branch information
badgerwithagun committed Dec 26, 2023
1 parent 11071b5 commit 9d96f86
Show file tree
Hide file tree
Showing 9 changed files with 37 additions and 32 deletions.
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,9 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.33</version>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
<version>8.2.0</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
4 changes: 2 additions & 2 deletions transactionoutbox-acceptance/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@
<artifactId>ojdbc11</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
Expand Down
4 changes: 2 additions & 2 deletions transactionoutbox-jooq/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@
<artifactId>ojdbc11</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.gruelbox.transactionoutbox.testing;

import static java.util.concurrent.TimeUnit.SECONDS;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.containsInAnyOrder;
import static org.hamcrest.Matchers.empty;
import static org.junit.jupiter.api.Assertions.*;
Expand All @@ -23,7 +25,6 @@
import java.util.stream.IntStream;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.hamcrest.MatcherAssert;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Assumptions;
import org.junit.jupiter.api.Test;
Expand Down Expand Up @@ -89,15 +90,15 @@ public void success(TransactionOutboxEntry entry) {
outbox.schedule(InterfaceProcessor.class).process(3, "Whee");
try {
// Should not be fired until after commit
assertFalse(latch.await(2, TimeUnit.SECONDS));
assertFalse(latch.await(2, SECONDS));
} catch (InterruptedException e) {
fail("Interrupted");
}
});

// Should be fired after commit
assertTrue(chainedLatch.await(2, TimeUnit.SECONDS));
assertTrue(latch.await(1, TimeUnit.SECONDS));
assertTrue(chainedLatch.await(2, SECONDS));
assertTrue(latch.await(1, SECONDS));
assertTrue(gotScheduled.get());
}

Expand Down Expand Up @@ -226,7 +227,7 @@ public void success(TransactionOutboxEntry entry) {
.schedule(ClassProcessor.class)
.process("6"));

MatcherAssert.assertThat(ids, containsInAnyOrder("1", "2", "4", "6"));
assertThat(ids, containsInAnyOrder("1", "2", "4", "6"));
}

/**
Expand Down Expand Up @@ -254,7 +255,7 @@ final void dataSourceConnectionProviderReflectionInstantiatorConcreteClass()

transactionManager.inTransaction(() -> outbox.schedule(ClassProcessor.class).process(myId));

assertTrue(latch.await(2, TimeUnit.SECONDS));
assertTrue(latch.await(2, SECONDS));
assertEquals(List.of(myId), ClassProcessor.PROCESSED);
}
}
Expand Down Expand Up @@ -346,7 +347,7 @@ public <T, E extends Exception> T requireTransactionReturns(
}
postCommitHooks.forEach(Runnable::run);

assertTrue(latch.await(2, TimeUnit.SECONDS));
assertTrue(latch.await(2, SECONDS));
assertEquals(List.of(myId), ClassProcessor.PROCESSED);
}
}
Expand Down Expand Up @@ -377,7 +378,7 @@ final void retryBehaviour() throws Exception {
() -> {
transactionManager.inTransaction(
() -> outbox.schedule(InterfaceProcessor.class).process(3, "Whee"));
assertTrue(latch.await(15, TimeUnit.SECONDS));
assertTrue(latch.await(15, SECONDS));
});
}

Expand Down Expand Up @@ -449,12 +450,12 @@ final void lastAttemptTime_updatesEveryTime() throws Exception {
() -> {
transactionManager.inTransaction(
() -> outbox.schedule(InterfaceProcessor.class).process(3, "Whee"));
assertTrue(blockLatch.await(10, TimeUnit.SECONDS));
assertTrue(blockLatch.await(10, SECONDS));
assertTrue(
(Boolean)
transactionManager.inTransactionReturns(
tx -> outbox.unblock(orderedEntryListener.getBlocked().getId())));
assertTrue(successLatch.await(10, TimeUnit.SECONDS));
assertTrue(successLatch.await(10, SECONDS));
var orderedEntryEvents = orderedEntryListener.getOrderedEntries();
log.info("The entry life cycle is: {}", orderedEntryEvents);

Expand Down Expand Up @@ -503,12 +504,12 @@ final void blockAndThenUnblockForRetry() throws Exception {
() -> {
transactionManager.inTransaction(
() -> outbox.schedule(InterfaceProcessor.class).process(3, "Whee"));
assertTrue(blockLatch.await(3, TimeUnit.SECONDS));
assertTrue(blockLatch.await(3, SECONDS));
assertTrue(
(Boolean)
transactionManager.inTransactionReturns(
tx -> outbox.unblock(latchListener.getBlocked().getId())));
assertTrue(successLatch.await(3, TimeUnit.SECONDS));
assertTrue(successLatch.await(3, SECONDS));
});
}

Expand Down Expand Up @@ -556,12 +557,12 @@ public void success(TransactionOutboxEntry entry) {
outbox.schedule(InterfaceProcessor.class).process(i * 10 + j, "Whee");
}
}));
assertTrue(latch.await(30, TimeUnit.SECONDS), "Latch not opened in time");
assertTrue(latch.await(30, SECONDS), "Latch not opened in time");
});

MatcherAssert.assertThat(
assertThat(
"Should never get duplicates running to full completion", duplicates.keySet(), empty());
MatcherAssert.assertThat(
assertThat(
"Only got: " + results.keySet(),
results.keySet(),
containsInAnyOrder(IntStream.range(0, count * 10).boxed().toArray()));
Expand Down
4 changes: 2 additions & 2 deletions transactionoutbox-virtthreads/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@
<artifactId>ojdbc11</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.gruelbox.transactionoutbox.virtthreads;

import com.gruelbox.transactionoutbox.Dialect;
import static com.gruelbox.transactionoutbox.Dialect.MY_SQL_5;

import java.time.Duration;
import org.junit.jupiter.api.Disabled;
import org.testcontainers.containers.JdbcDatabaseContainer;
Expand All @@ -21,7 +22,7 @@ class TestVirtualThreadsMySql5 extends AbstractVirtualThreadsTest {
@Override
protected ConnectionDetails connectionDetails() {
return ConnectionDetails.builder()
.dialect(Dialect.MY_SQL_5)
.dialect(MY_SQL_5)
.driverClassName("com.mysql.cj.jdbc.Driver")
.url(container.getJdbcUrl())
.user(container.getUsername())
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.gruelbox.transactionoutbox.virtthreads;

import com.gruelbox.transactionoutbox.Dialect;
import static com.gruelbox.transactionoutbox.Dialect.MY_SQL_8;

import java.time.Duration;
import org.junit.jupiter.api.Disabled;
import org.testcontainers.containers.JdbcDatabaseContainer;
Expand All @@ -21,7 +22,7 @@ class TestVirtualThreadsMySql8 extends AbstractVirtualThreadsTest {
@Override
protected ConnectionDetails connectionDetails() {
return ConnectionDetails.builder()
.dialect(Dialect.MY_SQL_8)
.dialect(MY_SQL_8)
.driverClassName("com.mysql.cj.jdbc.Driver")
.url(container.getJdbcUrl())
.user(container.getUsername())
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.gruelbox.transactionoutbox.virtthreads;

import com.gruelbox.transactionoutbox.Dialect;
import static com.gruelbox.transactionoutbox.Dialect.ORACLE;

import java.time.Duration;
import org.testcontainers.containers.JdbcDatabaseContainer;
import org.testcontainers.containers.OracleContainer;
Expand All @@ -19,7 +20,7 @@ class TestVirtualThreadsOracle21 extends AbstractVirtualThreadsTest {
@Override
protected ConnectionDetails connectionDetails() {
return ConnectionDetails.builder()
.dialect(Dialect.ORACLE)
.dialect(ORACLE)
.driverClassName("oracle.jdbc.OracleDriver")
.url(container.getJdbcUrl())
.user(container.getUsername())
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.gruelbox.transactionoutbox.virtthreads;

import com.gruelbox.transactionoutbox.Dialect;
import static com.gruelbox.transactionoutbox.Dialect.POSTGRESQL_9;

import java.time.Duration;
import org.testcontainers.containers.JdbcDatabaseContainer;
import org.testcontainers.containers.PostgreSQLContainer;
Expand All @@ -20,7 +21,7 @@ class TestVirtualThreadsPostgres16 extends AbstractVirtualThreadsTest {
@Override
protected ConnectionDetails connectionDetails() {
return ConnectionDetails.builder()
.dialect(Dialect.POSTGRESQL_9)
.dialect(POSTGRESQL_9)
.driverClassName("org.postgresql.Driver")
.url(container.getJdbcUrl())
.user(container.getUsername())
Expand Down

0 comments on commit 9d96f86

Please sign in to comment.