Skip to content

Commit

Permalink
Merge branch 'master' into issue2868
Browse files Browse the repository at this point in the history
  • Loading branch information
bresciamattia committed May 13, 2024
2 parents 6f69ffc + 08a3913 commit 9f6dc43
Show file tree
Hide file tree
Showing 46 changed files with 79 additions and 50 deletions.
2 changes: 1 addition & 1 deletion factcast-bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.factcast</groupId>
<artifactId>factcast</artifactId>
<version>0.7.7-SNAPSHOT</version>
<version>0.7.8-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>factcast-bom</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion factcast-client-grpc-cli/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.factcast</groupId>
<artifactId>factcast</artifactId>
<version>0.7.7-SNAPSHOT</version>
<version>0.7.8-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>factcast-client-grpc-cli</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion factcast-client-grpc/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.factcast</groupId>
<artifactId>factcast</artifactId>
<version>0.7.7-SNAPSHOT</version>
<version>0.7.8-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>factcast-client-grpc</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion factcast-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.factcast</groupId>
<artifactId>factcast</artifactId>
<version>0.7.7-SNAPSHOT</version>
<version>0.7.8-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>factcast-core</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion factcast-docker-dep/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.factcast</groupId>
<artifactId>factcast</artifactId>
<version>0.7.7-SNAPSHOT</version>
<version>0.7.8-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>factcast-docker-dep</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion factcast-docker/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.factcast</groupId>
<artifactId>factcast</artifactId>
<version>0.7.7-SNAPSHOT</version>
<version>0.7.8-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>factcast-docker</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.factcast</groupId>
<artifactId>factcast-examples</artifactId>
<version>0.7.7-SNAPSHOT</version>
<version>0.7.8-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>factcast-example-client-basicauth</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.factcast</groupId>
<artifactId>factcast-examples</artifactId>
<version>0.7.7-SNAPSHOT</version>
<version>0.7.8-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>factcast-example-client-spring-boot2</artifactId>
Expand Down
4 changes: 2 additions & 2 deletions factcast-examples/factcast-example-schema-registry/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.factcast</groupId>
<artifactId>factcast-examples</artifactId>
<version>0.7.7-SNAPSHOT</version>
<version>0.7.8-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand All @@ -27,7 +27,7 @@
<plugin>
<groupId>org.factcast</groupId>
<artifactId>factcast-schema-registry-maven-plugin</artifactId>
<version>0.7.7-SNAPSHOT</version>
<version>0.7.8-SNAPSHOT</version>
<executions>
<execution>
<id>build</id>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.factcast</groupId>
<artifactId>factcast-examples</artifactId>
<version>0.7.7-SNAPSHOT</version>
<version>0.7.8-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>factcast-example-server-basicauth</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion factcast-examples/factcast-example-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.factcast</groupId>
<artifactId>factcast-examples</artifactId>
<version>0.7.7-SNAPSHOT</version>
<version>0.7.8-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>factcast-example-server</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion factcast-examples/factcast-example-tls-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.factcast</groupId>
<artifactId>factcast-examples</artifactId>
<version>0.7.7-SNAPSHOT</version>
<version>0.7.8-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>factcast-example-tls-client</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion factcast-examples/factcast-example-tls-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.factcast</groupId>
<artifactId>factcast-examples</artifactId>
<version>0.7.7-SNAPSHOT</version>
<version>0.7.8-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>factcast-example-tls-server</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion factcast-examples/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.factcast</groupId>
<artifactId>factcast</artifactId>
<version>0.7.7-SNAPSHOT</version>
<version>0.7.8-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>factcast-examples</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion factcast-factus-bin-snapser/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.factcast</groupId>
<artifactId>factcast</artifactId>
<version>0.7.7-SNAPSHOT</version>
<version>0.7.8-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>factcast-factus-bin-snapser</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion factcast-factus-event/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.factcast</groupId>
<artifactId>factcast</artifactId>
<version>0.7.7-SNAPSHOT</version>
<version>0.7.8-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>factcast-factus-event</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion factcast-factus-redis/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.factcast</groupId>
<artifactId>factcast</artifactId>
<version>0.7.7-SNAPSHOT</version>
<version>0.7.8-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>factcast-factus-redis</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion factcast-factus-spring-tx/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.factcast</groupId>
<artifactId>factcast</artifactId>
<version>0.7.7-SNAPSHOT</version>
<version>0.7.8-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>factcast-factus-spring-tx</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion factcast-factus/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.factcast</groupId>
<artifactId>factcast</artifactId>
<version>0.7.7-SNAPSHOT</version>
<version>0.7.8-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>factcast-factus</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,11 @@ public void onFastForward(@NonNull FactStreamPosition factIdToFfwdTo) {
if (projection instanceof FactStreamPositionAware) {
((FactStreamPositionAware) projection).factStreamPosition(factIdToFfwdTo);
}
positionOfLastFactApplied.set(factIdToFfwdTo);

// only persist ffwd if we ever had a state or applied facts in this catchup
if (stateOrNull != null || positionOfLastFactApplied.get() != null) {
positionOfLastFactApplied.set(factIdToFfwdTo);
}
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,12 @@
import org.factcast.factus.snapshot.SnapshotSerializerSupplier;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.*;
import org.mockito.junit.jupiter.MockitoExtension;

@ExtendWith(MockitoExtension.class)
@Tag("integration") // technically unit, but it takes some time due to waiting
class FactusImplTest {

@Mock private FactCast fc;
Expand Down Expand Up @@ -1394,6 +1392,33 @@ void createSnapshot(SnapshotProjection projection, UUID state) {
@SuppressWarnings("resource")
@Nested
class WhenCatchingUp {
@Test
@SneakyThrows
void returnsFactIdOfFastForward() {
Projector pro = mock(Projector.class);
Subscription sub = mock(Subscription.class);
FactSpec spec1 = FactSpec.from(NameEvent.class);
CompletableFuture<Void> cf = new CompletableFuture<>();

Fact f = new TestFact();
UUID id = f.id();
FactStreamPosition pos = FactStreamPosition.of(id, 42L);

when(ehFactory.create(any())).thenReturn(pro);
when(fc.subscribe(any(SubscriptionRequest.class), any(FactObserver.class)))
.thenAnswer(
i -> {
FactObserver fo = i.getArgument(1);
fo.onFastForward(pos);
return sub;
});
when(pro.createFactSpecs()).thenReturn(Lists.newArrayList(spec1));

SomeSnapshotProjection p = new SomeSnapshotProjection();
UUID ret = underTest.catchupProjection(p, UUID.randomUUID(), null);

Assertions.assertThat(ret).isNotNull().isEqualTo(id);
}

@Test
@SneakyThrows
Expand Down Expand Up @@ -1423,7 +1448,7 @@ void returnsFactIdOfLastFactApplied() {
}

@Test
void returnsFactIdForwardTarget() {
void returnsNoFactIdForwardTarget() {

Projector pro = mock(Projector.class);
Subscription sub = mock(Subscription.class);
Expand All @@ -1446,7 +1471,7 @@ void returnsFactIdForwardTarget() {
SomeSnapshotProjection p = new SomeSnapshotProjection();
UUID ret = underTest.catchupProjection(p, null, null);

Assertions.assertThat(ret).isNotNull().isEqualTo(id);
Assertions.assertThat(ret).isNull();
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion factcast-grpc-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.factcast</groupId>
<artifactId>factcast</artifactId>
<version>0.7.7-SNAPSHOT</version>
<version>0.7.8-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>factcast-grpc-api</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion factcast-internal-dep-boot/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.factcast</groupId>
<artifactId>factcast</artifactId>
<version>0.7.7-SNAPSHOT</version>
<version>0.7.8-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>factcast-internal-dep-boot</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion factcast-internal-dep/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.factcast</groupId>
<artifactId>factcast</artifactId>
<version>0.7.7-SNAPSHOT</version>
<version>0.7.8-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>factcast-internal-dep</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion factcast-itests/factcast-itests-doc/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.factcast</groupId>
<artifactId>factcast-itests</artifactId>
<version>0.7.7-SNAPSHOT</version>
<version>0.7.8-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>factcast-itests-doc</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion factcast-itests/factcast-itests-exception-handling/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.factcast</groupId>
<artifactId>factcast-itests</artifactId>
<version>0.7.7-SNAPSHOT</version>
<version>0.7.8-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>factcast-itests-exception-handling</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion factcast-itests/factcast-itests-factus/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.factcast</groupId>
<artifactId>factcast-itests</artifactId>
<version>0.7.7-SNAPSHOT</version>
<version>0.7.8-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>factcast-itests-factus</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion factcast-itests/factcast-itests-novalidation/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.factcast</groupId>
<artifactId>factcast-itests</artifactId>
<version>0.7.7-SNAPSHOT</version>
<version>0.7.8-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>factcast-itests-novalidation</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion factcast-itests/factcast-itests-security/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.factcast</groupId>
<artifactId>factcast-itests</artifactId>
<version>0.7.7-SNAPSHOT</version>
<version>0.7.8-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>factcast-itests-security</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion factcast-itests/factcast-itests-store/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.factcast</groupId>
<artifactId>factcast-itests</artifactId>
<version>0.7.7-SNAPSHOT</version>
<version>0.7.8-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>factcast-itests-store</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion factcast-itests/factcast-itests-tls/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.factcast</groupId>
<artifactId>factcast-itests</artifactId>
<version>0.7.7-SNAPSHOT</version>
<version>0.7.8-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>factcast-itests-tls</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion factcast-itests/factcast-itests-transformation/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.factcast</groupId>
<artifactId>factcast-itests</artifactId>
<version>0.7.7-SNAPSHOT</version>
<version>0.7.8-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>factcast-itests-transformation</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion factcast-itests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.factcast</groupId>
<artifactId>factcast</artifactId>
<version>0.7.7-SNAPSHOT</version>
<version>0.7.8-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>factcast-itests</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion factcast-schema-registry-cli/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>org.factcast</groupId>
<artifactId>factcast</artifactId>
<version>0.7.7-SNAPSHOT</version>
<version>0.7.8-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<properties>
Expand Down
2 changes: 1 addition & 1 deletion factcast-schema-registry-maven-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>org.factcast</groupId>
<artifactId>factcast</artifactId>
<version>0.7.7-SNAPSHOT</version>
<version>0.7.8-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion factcast-server-grpc/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.factcast</groupId>
<artifactId>factcast</artifactId>
<version>0.7.7-SNAPSHOT</version>
<version>0.7.8-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>factcast-server-grpc</artifactId>
Expand Down

0 comments on commit 9f6dc43

Please sign in to comment.