Skip to content

Commit

Permalink
updating docs and updating class names (updating file names wan't eno…
Browse files Browse the repository at this point in the history
…ugh)
  • Loading branch information
franciscolopezsancho committed Dec 6, 2024
1 parent c816279 commit 8838319
Show file tree
Hide file tree
Showing 34 changed files with 57 additions and 58 deletions.
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/UserEndpointIT.java[UserEndpointIT.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/UserEndpointIT.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/HelloJwtIT.java[HelloJwtIT.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/HelloJwtIT.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/CounterIT.java[CounterIT.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/CounterIT.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/CounterIT.java[CounterIT.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/CounterIT.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/CounterIT.java[CounterIT.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/CounterIT.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/CounterIT.java[CounterIT.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/CounterIT.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/CounterWithRealKafkaIT.java[CounterWithRealKafkaIT.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/CounterWithRealKafkaIT.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/ShoppingCartIT.java[ShoppingCartIT.java]
----
include::example$shopping-cart-quickstart/src/it/java/shoppingcart/IntegrationTest.java[tag=sample-it]
include::example$shopping-cart-quickstart/src/test/java/shoppingcart/ShoppingCartIT.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 verify`.
== 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/CounterIT.java[CounterIT.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/CounterIT.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 verify`.

== 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/MyIT.java[MyIT.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/MyIT.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/CustomersByCityIT.java[CustomersByCityIT.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/CustomersByCityIT.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
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

import static org.assertj.core.api.Assertions.assertThat;

public class UserCreationIntegrationTest extends TestKitSupport {
public class UserCreationIT extends TestKitSupport {

private final Duration timeout = Duration.ofSeconds(6);

Expand Down
2 changes: 1 addition & 1 deletion samples/doc-snippets/src/test/java/com/example/MyIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import static org.junit.jupiter.api.Assertions.assertSame;

// tag::test-di-provider[]
public class MyIntegrationTest extends TestKitSupport {
public class MyIT extends TestKitSupport {

private static final DependencyProvider mockDependencyProvider = new DependencyProvider() { // <1>
@SuppressWarnings("unchecked")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@


// tag::disable-acl-in-it[]
public class UserEndpointIntegrationTest extends TestKitSupport {
public class UserEndpointIT extends TestKitSupport {

@Override
protected TestKit.Settings testKitSettings() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import static org.assertj.core.api.Assertions.assertThat;


public class JwtIntegrationTest extends TestKitSupport {
public class JwtIT extends TestKitSupport {

// tag::bearer-token-claims-test[]
private String bearerTokenWith(Map<String, String> claims) throws JsonProcessingException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import static org.assertj.core.api.Assertions.assertThat;

public class HelloJwtIntegrationTest extends TestKitSupport {
public class HelloJwtIT extends TestKitSupport {

// tag::bearer-token-claims-test[]
@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import static org.junit.jupiter.api.Assertions.assertEquals;

// tag::class[]
public class CounterIntegrationTest extends TestKitSupport { // <1>
public class CounterIT extends TestKitSupport { // <1>

// end::class[]

Expand Down Expand Up @@ -140,7 +140,7 @@ public void verifyCounterCommandsAndPublishWithMetadata() {

var metadata = CloudEvent.of( // <1>
"cmd1",
URI.create("CounterTopicIntegrationTest"),
URI.create("CounterTopicIT"),
increaseCmd.getClass().getName())
.withSubject(counterId) // <2>
.asMetadata()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;

public class CounterWithRealKafkaIntegrationTest extends TestKitSupport { // <1>
public class CounterWithRealKafkaIT extends TestKitSupport { // <1>

// logger
private static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(CounterWithRealKafkaIntegrationTest.class);
private static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(CounterWithRealKafkaIT.class);

// tag::kafka[]
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import static org.junit.jupiter.api.Assertions.assertEquals;

public class CounterWithRealPubSubIntegrationTest extends TestKitSupport { // <1>
public class CounterWithRealPubSubIT extends TestKitSupport { // <1>

// tag::pubsub[]
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* The subscriber service will first create a customer on customer-registry service. The customer will be streamed back
* to the subscriber service and update its view.
*/
public class CustomerIntegrationTest extends CustomerRegistryIntegrationTest {
public class CustomerIT extends CustomerRegistryIT {


// this test relies on a source Akka event-sourced-customer-registry service to which it subscribes.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* Needs to be a base class for all integration tests in this project to avoid port conflict
* since CI will already be running another service on port 9000
*/
public abstract class CustomerRegistryIntegrationTest extends TestKitSupport {
public abstract class CustomerRegistryIT extends TestKitSupport {

@Override
protected TestKit.Settings testKitSettings() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

import static org.assertj.core.api.Assertions.assertThat;

public class CustomersByNameViewIntegrationTest extends CustomerRegistryIntegrationTest {
public class CustomersByNameViewIT extends CustomerRegistryIT {

@Override
protected TestKit.Settings testKitSettings() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import static akka.Done.done;


public class CustomerIntegrationTest extends TestKitSupport {
public class CustomerIT extends TestKitSupport {

@Test
public void create() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import org.junit.jupiter.api.Test;

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

// end::sample-it[]
@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import static java.time.temporal.ChronoUnit.SECONDS;
import static org.assertj.core.api.Assertions.assertThat;

public class CustomerIntegrationTest extends TestKitSupport {
public class CustomerIT extends TestKitSupport {

@Test
public void create() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

// tag::view-test[]

class CustomersByCityIntegrationTest extends TestKitSupport {
class CustomersByCityIT extends TestKitSupport {

@Override
protected TestKit.Settings testKitSettings() {
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 ShoppingCartIntegrationTest extends TestKitSupport {
public class ShoppingCartIT extends TestKitSupport {

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import static java.time.temporal.ChronoUnit.SECONDS;
import static org.assertj.core.api.Assertions.assertThat;

public class OrderEndpointIntegrationTest extends TestKitSupport {
public class OrderEndpointIT extends TestKitSupport {

private Duration timeout = Duration.of(20, 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 ShoppingCartIntegrationTest extends TestKitSupport { // <1>
public class ShoppingCartIT extends TestKitSupport { // <1>

@Test
public void createAndManageCart() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

import static org.assertj.core.api.Assertions.assertThat;

public class CounterIntegrationTest extends TestKitSupport {
public class CounterIT extends TestKitSupport {

@Test
public void verifyIfEmailWasSent() {
Expand Down
2 changes: 1 addition & 1 deletion samples/transfer-workflow-compensation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,6 @@ Congratulations, you've successfully implemented a workflow between two wallets

Now that you've built a basic transfer workflow, consider these next steps:

1. **Study the compensation mechanism**: Examine `TransferWorkflow.java` and `TransferWorkflowIntegrationTest.java` to understand how compensating actions are implemented when the deposit step fails after a successful withdrawal.
1. **Study the compensation mechanism**: Examine `TransferWorkflow.java` and `TransferWorkflowIT.java` to understand how compensating actions are implemented when the deposit step fails after a successful withdrawal.
2. **Explore other Akka components**: Dive deeper into Akka's ecosystem to enhance your application.
3. **Join the community**: Visit the [Support page](https://doc.akka.io/support/index.html) to find resources where you can connect with other Akka developers and expand your knowledge.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import static org.assertj.core.api.Assertions.assertThat;


public class TransferWorkflowIntegrationTest extends TestKitSupport {
public class TransferWorkflowIT extends TestKitSupport {

@Test
public void shouldTransferMoney() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
import com.example.wallet.domain.WalletCommand;
import org.junit.jupiter.api.Test;

import static com.example.transfer.TransferWorkflowIntegrationTest.randomId;
import static com.example.transfer.TransferWorkflowIT.randomId;
import static org.assertj.core.api.Assertions.assertThat;

class WalletEntityIntegrationTest extends TestKitSupport {
class WalletEntityIT extends TestKitSupport {

@Test
public void shouldDeduplicateWithdrawCommand() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import static org.junit.jupiter.api.Assertions.assertEquals;


public class TransferWorkflowIntegrationTest extends TestKitSupport {
public class TransferWorkflowIT extends TestKitSupport {

@Test
public void shouldTransferMoney() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

import static org.junit.jupiter.api.Assertions.assertNotNull;

public abstract class StoreViewIntegrationTest extends TestKitSupport {
public abstract class StoreViewIT extends TestKitSupport {

protected void createProduct(String id, String name, String currency, long units, int cents) {
Product product = new Product(name, new Money(currency, units, cents));
Expand Down
Loading

0 comments on commit 8838319

Please sign in to comment.