Skip to content

Commit

Permalink
chore: removing it profile (#63)
Browse files Browse the repository at this point in the history
* chore: removing 'it' profile

ci, parent pom and moving samples 'it' to 'test'

* renaming '*IntegrationTest' to

* updating docs and updating class names (updating file names wan't enough)

* adding missing failsafe plugin

* Update akka-javasdk-maven/akka-javasdk-parent/pom.xml

Co-authored-by: Renato Cavalcanti <renato@cavalcanti.be>

* Update akka-javasdk-maven/akka-javasdk-parent/pom.xml

Co-authored-by: Renato Cavalcanti <renato@cavalcanti.be>

* Update docs/src/modules/java/pages/event-sourced-entities.adoc

Co-authored-by: Renato Cavalcanti <renato@cavalcanti.be>

* Update docs/src/modules/java/pages/key-value-entities.adoc

Co-authored-by: Renato Cavalcanti <renato@cavalcanti.be>

* Update .github/workflows/ci.yml

Co-authored-by: Renato Cavalcanti <renato@cavalcanti.be>

* docs: add local console to getting started guide (#58)

* docs: review support pages (#64)

* addressing comments

.+ back to IntegrationTest suffix

* Revert "docs: review support pages (#64)"

This reverts commit 493648d.

* Revert "docs: add local console to getting started guide (#58)"

This reverts commit 29311bf.

* fixing import

* removing snapshot version used when testing

* renaming class

---------

Co-authored-by: Renato Cavalcanti <renato@cavalcanti.be>
Co-authored-by: Brent Eritou <brent.eritou@lightbend.com>
Co-authored-by: Enno Runne <458526+ennru@users.noreply.github.com>
  • Loading branch information
4 people authored Dec 11, 2024
1 parent 74aa372 commit ed4bded
Show file tree
Hide file tree
Showing 46 changed files with 70 additions and 60 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ jobs:
fi
if [ true == '${{matrix.it}}' ]; then
${PRE_CMD}
KALIX_TESTKIT_DEBUG=true mvn verify -Pit --no-transfer-progress
KALIX_TESTKIT_DEBUG=true mvn integration-test --no-transfer-progress
fi
- name: ${{ matrix.sample }} rm & test-compile
Expand All @@ -450,5 +450,5 @@ jobs:
export SDK_VERSION=$(cat ~/akka-javasdk-version.txt)
cd samples/${DIR}
echo "==== Verifying that generated unmanaged sources compile ===="
rm -rf src/main/java src/test/java src/it/java
rm -rf src/main/java src/test/java
mvn test-compile --no-transfer-progress
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
</includes>
</fileSet>
<fileSet filtered="true">
<directory>src/it/java</directory>
<directory>src/test/java</directory>
<includes>
<include>**/*</include>
</includes>
Expand Down
57 changes: 35 additions & 22 deletions akka-javasdk-maven/akka-javasdk-parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,6 @@


<build>
<resources>
<resource>
<directory>${basedir}/src/main/resources</directory>
</resource>
</resources>

<extensions>
<extension>
<groupId>kr.motd.maven</groupId>
Expand Down Expand Up @@ -284,7 +278,27 @@
</systemPropertyVariables>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>${maven-failsafe-plugin.version}</version>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
</goals>
<configuration>
<includes>
<include>**/*IntegrationTest.java</include>
<include>**/*IT.java</include>
<include>**/IT*.java</include>
<include>**/*ITCase.java</include>
</includes>
<argLine>-Dlogback.configurationFile=${logback.configurationFile} -Dakka.javasdk.dev-mode.project-artifact-id=${project.artifactId}</argLine>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
Expand Down Expand Up @@ -334,6 +348,11 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand All @@ -359,36 +378,30 @@
<profiles>

<profile>
<!-- run Integration Tests in src/it/java with `mvn verify -Pit`-->
<id>it</id>
<build>
<plugins>
<plugin>
<!-- run *IntegrationTest with failsafe -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>${maven-failsafe-plugin.version}</version>
<groupId>org.codehaus.gmaven</groupId>
<artifactId>groovy-maven-plugin</artifactId>
<version>2.1.1</version>
<executions>
<execution>
<phase>integration-test</phase>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
<goal>execute</goal>
</goals>
<configuration>
<includes>
<include>**/*IntegrationTest</include>
</includes>
<argLine>-Dlogback.configurationFile=${logback.configurationFile} -Dakka.javasdk.dev-mode.project-artifact-id=${project.artifactId}</argLine>
<source>
log.warn('The 'it' profile is deprecated. It will be removed in future versions. Integration tests only need `mvn integration-test` to run.')
</source>
</configuration>
</execution>
</executions>
<configuration>
<classesDirectory>${project.build.outputDirectory}</classesDirectory>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profile>

<profile>
<id>clean-on-missing-descriptor</id>
Expand Down
4 changes: 2 additions & 2 deletions docs/src/modules/java/pages/access-control.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -225,9 +225,9 @@ ACL rules will be applied whenever a call is made using testkit's `HttpClient`.
originating from the internet. You can disable the ACL checks by overriding the `testKitSettings()` method.

[source, java, indent=0]
.{sample-base-url}/doc-snippets/src/it/java/com/example/acl/UserEndpointIntegrationTest.java[UserEndpointIntegrationTest.java]
.{sample-base-url}/doc-snippets/src/test/java/com/example/acl/UserEndpointIntegrationTest.java[UserEndpointIntegrationTest.java]
----
include::example$doc-snippets/src/it/java/com/example/acl/UserEndpointIntegrationTest.java[tag=disable-acl-in-it]
include::example$doc-snippets/src/test/java/com/example/acl/UserEndpointIntegrationTest.java[tag=disable-acl-in-it]
----

Calls made through the `ComponentClient` are internal to the service and therefore no ACL rule is applied.
4 changes: 2 additions & 2 deletions docs/src/modules/java/pages/auth-with-jwts.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,9 @@ When running locally, by default, a dev key with id `dev` is configured for use.
When running integration tests, JWTs will still be enforced but its signature will not be validated, similarly to what is described above for when running locally. Thus, when making calls in the context of integration testing, make sure to inject a proper token with the required claims, as shown below:

[source, java, indent=0]
.{sample-base-url}/endpoint-jwt/src/it/java/hellojwt/api/HelloJwtIntegrationTest.java[HelloJwtIntegrationTest.java]
.{sample-base-url}/endpoint-jwt/src/test/java/hellojwt/api/HelloJwtIntegrationTest.java[HelloJwtIntegrationTest.java]
----
include::example$endpoint-jwt/src/it/java/hellojwt/api/HelloJwtIntegrationTest.java[tag=bearer-token-claims-test]
include::example$endpoint-jwt/src/test/java/hellojwt/api/HelloJwtIntegrationTest.java[tag=bearer-token-claims-test]
----
<1> Use a helper method to create a JWT token with 2 claims: issuer and subject.
<2> Inject the bearer token as header with the key `Authorization`.
Expand Down
20 changes: 10 additions & 10 deletions docs/src/modules/java/pages/consuming-producing.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -234,9 +234,9 @@ In this example:
To test this flow, we will take advantage of the TestKit to be able to push commands into the `event-commands` topic and check what messages are produced to topic `counter-events`.
[source,java]
.{sample-base-url}/event-sourced-counter-brokers/src/it/java/counter/application/CounterIntegrationTest.java[CounterIntegrationTest.java]
.{sample-base-url}/event-sourced-counter-brokers/src/test/java/counter/application/CounterIntegrationTest.java[CounterIntegrationTest.java]
----
include::example$event-sourced-counter-brokers/src/it/java/counter/application/CounterIntegrationTest.java[tags=class;test-topic]
include::example$event-sourced-counter-brokers/src/test/java/counter/application/CounterIntegrationTest.java[tags=class;test-topic]
----
<1> Use the TestKitSupport class.
<2> Get a `IncomingMessages` for topic named `counter-commands` and `OutgoingMessages` for `counter-events` from the TestKit.
Expand All @@ -251,9 +251,9 @@ TIP: In the example above we take advantage of the TestKit to serialize / deseri
Before running your test, make sure to configure the TestKit correctly.
[source, java]
.{sample-base-url}/event-sourced-counter-brokers/src/it/java/counter/application/CounterIntegrationTest.java[CounterIntegrationTest.java]
.{sample-base-url}/event-sourced-counter-brokers/src/test/java/counter/application/CounterIntegrationTest.java[CounterIntegrationTest.java]
----
include::example$event-sourced-counter-brokers/src/it/java/counter/application/CounterIntegrationTest.java[tags=eventing-config]
include::example$event-sourced-counter-brokers/src/test/java/counter/application/CounterIntegrationTest.java[tags=eventing-config]
----
<1> Mock incoming messages from the `counter-commands` topic.
<2> Mock outgoing messages from the `counter-events` topic.
Expand All @@ -263,9 +263,9 @@ include::example$event-sourced-counter-brokers/src/it/java/counter/application/C
Typically, messages are published with associated metadata. If you want to construct your own `Metadata` to be consumed by a service or make sure the messages published out of your service have specific metadata attached, you can do so using the TestKit, as shown below.
[source,java,indent=0]
.{sample-base-url}/event-sourced-counter-brokers/src/it/java/counter/application/CounterIntegrationTest.java[CounterIntegrationTest.java]
.{sample-base-url}/event-sourced-counter-brokers/src/test/java/counter/application/CounterIntegrationTest.java[CounterIntegrationTest.java]
----
include::example$event-sourced-counter-brokers/src/it/java/counter/application/CounterIntegrationTest.java[tags=test-topic-metadata]
include::example$event-sourced-counter-brokers/src/test/java/counter/application/CounterIntegrationTest.java[tags=test-topic-metadata]
----
<1> Build a `CloudEvent` object with the 3 required attributes, respectively: `id`, `source` and `type`.
<2> Add the subject to which the message is related, that is the `counterId`.
Expand All @@ -286,9 +286,9 @@ As an alternative, you can consider using different test suites which will use i
[source,java,indent=0]
.{sample-base-url}/event-sourced-counter-brokers/src/it/java/counter/application/CounterIntegrationTest.java[CounterIntegrationTest.java]
.{sample-base-url}/event-sourced-counter-brokers/src/test/java/counter/application/CounterIntegrationTest.java[CounterIntegrationTest.java]
----
include::example$event-sourced-counter-brokers/src/it/java/counter/application/CounterIntegrationTest.java[tags=clear-topics]
include::example$event-sourced-counter-brokers/src/test/java/counter/application/CounterIntegrationTest.java[tags=clear-topics]
----
<1> Run this before each test.
<2> Clear the topic ignoring any unread messages.
Expand All @@ -300,9 +300,9 @@ NOTE: Despite the example, you are neither forced to clear all topics nor to do
To run an integration test against a real instance of Google PubSub (or its Emulator) or Kafka, use the TestKit settings to override the default eventing support, as shown below:
[source,java]
.{sample-base-url}/event-sourced-counter-brokers/src/it/java/counter/application/CounterWithRealKafkaIntegrationTest.java[CounterWithRealKafkaIntegrationTest.java]
.{sample-base-url}/event-sourced-counter-brokers/src/test/java/counter/application/CounterWithRealKafkaIntegrationTest.java[CounterWithRealKafkaIntegrationTest.java]
----
include::example$event-sourced-counter-brokers/src/it/java/counter/application/CounterWithRealKafkaIntegrationTest.java[tags=kafka]
include::example$event-sourced-counter-brokers/src/test/java/counter/application/CounterWithRealKafkaIntegrationTest.java[tags=kafka]
----
== Multi-region replication
Expand Down
7 changes: 3 additions & 4 deletions docs/src/modules/java/pages/event-sourced-entities.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -229,9 +229,9 @@ For the above example, this class provides access to all the command handlers of
The skeleton of an Integration Test is generated for you if you use the archetype to start your Akka service. Let's see what it could look like to test our `ShoppingCartEntity`:

[source,java]
.{sample-base-url}/shopping-cart-quickstart/src/it/java/shoppingcart/IntegrationTest.java[IntegrationTest.java]
.{sample-base-url}/shopping-cart-quickstart/src/test/java/shoppingcart/ShoppingCartIntegrationTest.java[ShoppingCartIntegrationTest.java]
----
include::example$shopping-cart-quickstart/src/it/java/shoppingcart/IntegrationTest.java[tag=sample-it]
include::example$shopping-cart-quickstart/src/test/java/shoppingcart/ShoppingCartIntegrationTest.java[tag=sample-it]
----
<1> Note the test class must extend `TestKitSupport`.
<2> A built-in component client is provided to interact with the components.
Expand All @@ -240,8 +240,7 @@ include::example$shopping-cart-quickstart/src/it/java/shoppingcart/IntegrationTe
<5> Request to retrieve current status of the shopping cart.
<6> Assert there should only be one item.

NOTE: The integration tests in samples are under a specific project profile `it` and can be run using `mvn verify -Pit`.

NOTE: The integration tests in samples can be run using `mvn integration-test`.
== Exposing entities directly

include::partial$component-endpoint.adoc[]
Expand Down
6 changes: 3 additions & 3 deletions docs/src/modules/java/pages/key-value-entities.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -150,17 +150,17 @@ NOTE: The `KeyValueEntityTestKit` is stateful, and it holds the state of a singl
The skeleton of an Integration Test is generated for you if you use the archetype to start your Akka service. Let's see what it could look like to test our Counter Entity:

[source,java,indent=0]
.{sample-base-url}/key-value-counter/src/it/java/com/example/CounterIntegrationTest.java[CounterIntegrationTest.java]
.{sample-base-url}/key-value-counter/src/test/java/com/example/CounterIntegrationTest.java[CounterIntegrationTest.java]
----
include::example$key-value-counter/src/it/java/com/example/CounterIntegrationTest.java[tags=sample-it]
include::example$key-value-counter/src/test/java/com/example/CounterIntegrationTest.java[tags=sample-it]
----
<1> Note the test class must extend `TestKitSupport`.
<2> A built-in component client is provided to interact with the components.
<3> Get the current value of the counter named `bar`. Initial value of counter is expected to be `0`.
<4> Request to increase the value of counter `bar`. Response should have value `1`.
<5> Explicitly request current value of `bar`. It should be `1`.

NOTE: The integration tests in samples are under a specific project profile `it` and can be run using `mvn verify -Pit`.
NOTE: The integration tests in samples can be run using `mvn integration-test`.

== Exposing entities directly

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,9 @@ The TestKit allows providing a custom `DependencyProvider` through `TestKit.Sett
that mock instances of dependencies can be used in tests.

[source,java]
.{sample-base-url}/doc-snippets/src/it/java/com/example/MyIntegrationTest.java[MyIntegrationTest.java]
.{sample-base-url}/doc-snippets/src/test/java/com/example/MyIntegrationTest.java[MyIntegrationTest.java]
----
include::example$doc-snippets/src/it/java/com/example/MyIntegrationTest.java[tag=test-di-provider]
include::example$doc-snippets/src/test/java/com/example/MyIntegrationTest.java[tag=test-di-provider]
----
<1> Implement a test specific `DependencyProvider`.
<2> Configure the TestKit to use it.
Expand Down
4 changes: 2 additions & 2 deletions docs/src/modules/java/pages/views.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -304,9 +304,9 @@ include::example$key-value-customer-registry/src/main/java/customer/application/
An integration test can be implemented as below.
[source,java,indent=0]
.{sample-base-url}/key-value-customer-registry/src/it/java/customer/application/CustomersByCityIntegrationTest.java[CustomersByCityIntegrationTest.java]
.{sample-base-url}/key-value-customer-registry/src/test/java/customer/application/CustomersByCityIntegrationTest.java[CustomersByCityIntegrationTest.java]
----
include::example$key-value-customer-registry/src/it/java/customer/application/CustomersByCityIntegrationTest.java[tag=view-test]
include::example$key-value-customer-registry/src/test/java/customer/application/CustomersByCityIntegrationTest.java[tag=view-test]
----
<1> Mocks incoming messages from the `customer` Key Value Entity.
<2> Gets an `IncomingMessages` from the `customer` Key Value Entity.
Expand Down
2 changes: 1 addition & 1 deletion samples/event-sourced-counter-brokers/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,5 +102,5 @@ docker-compose up

Then run:
```shell
mvn verify -Pit
mvn integration-test
```
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import org.apache.kafka.common.serialization.ByteArrayDeserializer;
import org.apache.kafka.common.serialization.StringDeserializer;
import org.awaitility.Awaitility;
import org.jetbrains.annotations.NotNull;
import org.junit.jupiter.api.Test;

import java.nio.charset.StandardCharsets;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import akka.http.javadsl.model.ContentTypes;
import akka.http.javadsl.model.StatusCodes;
import akka.javasdk.http.HttpClient;
import akka.javasdk.testkit.TestKitSupport;
import akka.javasdk.testkit.TestKit;
import org.awaitility.Awaitility;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import static org.junit.jupiter.api.Assertions.assertThrows;


public class IntegrationTest extends TestKitSupport {
public class ShoppingCartIntegrationTest extends TestKitSupport {

private Duration timeout = Duration.of(5, SECONDS);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import shoppingcart.domain.ShoppingCart.LineItem;

// tag::sample-it[]
public class IntegrationTest extends TestKitSupport { // <1>
public class ShoppingCartIntegrationTest extends TestKitSupport { // <1>

@Test
public void createAndManageCart() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import static java.time.temporal.ChronoUnit.SECONDS;


public class IntegrationTest extends TestKitSupport {
public class TracingIntegrationTest extends TestKitSupport {

private Duration timeout = Duration.of(5, SECONDS);

Expand Down
4 changes: 2 additions & 2 deletions samples/transfer-workflow-compensation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,10 @@ curl http://localhost:9000/transfer/1

## Run integration tests

To run the integration tests located in `src/it/java`:
To run the integration tests located in `src/test/java`:

```shell
mvn verify -Pit
mvn integration-test
```

## Troubleshooting
Expand Down
4 changes: 2 additions & 2 deletions samples/transfer-workflow/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,10 @@ curl http://localhost:9000/transfer/1

## Run integration tests

To run the integration tests located in `src/it/java`:
To run the integration tests located in `src/test/java`:

```shell
mvn verify -Pit
mvn integration-test
```

## Troubleshooting
Expand Down

0 comments on commit ed4bded

Please sign in to comment.