Skip to content

Commit

Permalink
ci(#1195): make sure citrus-quarkus-it tests run
Browse files Browse the repository at this point in the history
  • Loading branch information
bbortt committed Sep 6, 2024
1 parent 4e8f6db commit 0250770
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 36 deletions.
8 changes: 7 additions & 1 deletion runtime/citrus-quarkus/citrus-quarkus-it/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,13 @@
<maven.home>${maven.home}</maven.home>
</systemPropertyVariables>
</configuration>
<dependencies>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-junit-platform</artifactId>
<version>${maven.surefire.plugin.version}</version>
</dependency>
</dependencies>
</plugin>

<!-- Do not deploy this module to Maven central -->
Expand All @@ -118,5 +125,4 @@
</plugin>
</plugins>
</build>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,17 @@
import org.citrusframework.spi.BindToRegistry;
import org.citrusframework.validation.DefaultTextEqualsMessageValidator;
import org.citrusframework.validation.MessageValidator;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

import static org.citrusframework.actions.CreateVariablesAction.Builder.createVariables;
import static org.citrusframework.actions.ReceiveMessageAction.Builder.receive;
import static org.citrusframework.actions.SendMessageAction.Builder.send;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;

@QuarkusTest
@CitrusSupport
public class DemoApplicationTest {
class DemoApplicationTest {

@CitrusFramework
private Citrus citrus;
Expand All @@ -50,9 +51,7 @@ public class DemoApplicationTest {
private final MessageQueue messageQueue = new DefaultMessageQueue("messages");

@CitrusEndpoint
@DirectEndpointConfig(
queue = "messageQueue"
)
@DirectEndpointConfig(queue = "messageQueue")
private DirectEndpoint messages;

@BindToRegistry
Expand All @@ -61,7 +60,7 @@ public class DemoApplicationTest {
.build();

@CitrusResource
private TestCaseRunner t;
private TestCaseRunner testCaseRunner;

@BindToRegistry
private final DefaultTextEqualsMessageValidator textEqualsMessageValidator = new DefaultTextEqualsMessageValidator();
Expand All @@ -71,45 +70,45 @@ public class DemoApplicationTest {

@Test
void shouldInjectCitrusResources() {
Assertions.assertNotNull(citrus);
Assertions.assertNotNull(context);
Assertions.assertNotNull(t);
Assertions.assertNotNull(messages);
Assertions.assertNotNull(moreMessages);
Assertions.assertEquals(context.getReferenceResolver().resolve("textEqualsMessageValidator", MessageValidator.class), textEqualsMessageValidator);
assertNotNull(citrus);
assertNotNull(context);
assertNotNull(testCaseRunner);
assertNotNull(messages);
assertNotNull(moreMessages);
assertEquals(context.getReferenceResolver().resolve("textEqualsMessageValidator", MessageValidator.class), textEqualsMessageValidator);

t.variable("greeting", "Hello!");
testCaseRunner.variable("greeting", "Hello!");

t.given(
createVariables().variable("text", "Citrus rocks!")
testCaseRunner.given(
createVariables().variable("text", "Citrus rocks!")
);

t.when(
send()
.endpoint(messages)
.message()
.body("${text}")
testCaseRunner.when(
send()
.endpoint(messages)
.message()
.body("${text}")
);

t.when(
receive()
.endpoint(messages)
.message()
.body("${text}")
testCaseRunner.then(
receive()
.endpoint(messages)
.message()
.body("${text}")
);

t.when(
send()
.endpoint(moreMessages)
.message()
.body("${greeting}")
testCaseRunner.when(
send()
.endpoint(moreMessages)
.message()
.body("${greeting}")
);

t.when(
receive()
.endpoint(moreMessages)
.message()
.body("${greeting}")
testCaseRunner.then(
receive()
.endpoint(moreMessages)
.message()
.body("${greeting}")
);
}
}

0 comments on commit 0250770

Please sign in to comment.