-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: prove that scenario completion has been tracked synchonously
integration test that proves that all data has been persisted at end of scenario execution. see [this PR](#223) for more information.
- Loading branch information
Showing
10 changed files
with
183 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
...-boot/src/main/java/org/citrusframework/simulator/repository/MessageHeaderRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
...spring-boot/src/main/java/org/citrusframework/simulator/repository/MessageRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
...boot/src/main/java/org/citrusframework/simulator/repository/ScenarioActionRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
...t/src/main/java/org/citrusframework/simulator/repository/ScenarioExecutionRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
...t/src/main/java/org/citrusframework/simulator/repository/ScenarioParameterRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
...-boot/src/main/java/org/citrusframework/simulator/repository/TestParameterRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
...ing-boot/src/main/java/org/citrusframework/simulator/repository/TestResultRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 39 additions & 3 deletions
42
...t/java/org/citrusframework/simulator/service/runner/DefaultScenarioExecutorServiceIT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,58 @@ | ||
package org.citrusframework.simulator.service.runner; | ||
|
||
import org.citrusframework.simulator.IntegrationTest; | ||
import org.citrusframework.simulator.model.ScenarioExecution; | ||
import org.citrusframework.simulator.repository.ScenarioExecutionRepository; | ||
import org.citrusframework.simulator.scenario.AbstractSimulatorScenario; | ||
import org.citrusframework.simulator.scenario.Scenario; | ||
import org.citrusframework.simulator.service.ScenarioExecutorService; | ||
import org.junit.jupiter.api.Test; | ||
import org.springframework.beans.factory.NoSuchBeanDefinitionException; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.context.ApplicationContext; | ||
|
||
import static java.util.Collections.emptyList; | ||
import static org.assertj.core.api.Assertions.assertThat; | ||
import static org.assertj.core.api.Assertions.assertThatThrownBy; | ||
import static org.citrusframework.simulator.model.ScenarioExecution.Status.SUCCESS; | ||
|
||
@IntegrationTest | ||
class DefaultScenarioExecutorServiceIT { | ||
|
||
private static final String SCENARIO_NAME = "DefaultScenarioExecutorServiceIT#testSimulatorScenario"; | ||
|
||
@Autowired | ||
private ScenarioExecutorService scenarioExecutorService; | ||
|
||
@Autowired | ||
private ApplicationContext applicationContext; | ||
private ScenarioExecutionRepository scenarioExecutionRepository; | ||
|
||
@Test | ||
void isDefaultScenarioExecutorService() { | ||
assertThat(applicationContext.getBean(ScenarioExecutorService.class)) | ||
assertThat(scenarioExecutorService) | ||
.isInstanceOf(DefaultScenarioExecutorService.class); | ||
} | ||
|
||
@Test | ||
void throwsExceptionGivenInexistendScenarioName() { | ||
var beanName = "sherlock"; | ||
|
||
assertThatThrownBy(() -> scenarioExecutorService.run(beanName, emptyList())) | ||
.isInstanceOf(NoSuchBeanDefinitionException.class) | ||
.hasMessage("No bean named '%s' available".formatted(beanName)); | ||
} | ||
|
||
@Test | ||
void resultsBeingPersistedSynchronously() { | ||
var executionId = scenarioExecutorService.run(SCENARIO_NAME, emptyList()); | ||
|
||
assertThat(scenarioExecutionRepository.findOneByExecutionId(executionId)) | ||
.hasValueSatisfying(scenarioExecution -> assertThat(scenarioExecution) | ||
.hasNoNullFieldsOrPropertiesExcept("errorMessage") | ||
.extracting(ScenarioExecution::getStatus) | ||
.isEqualTo(SUCCESS)); | ||
} | ||
|
||
@Scenario(SCENARIO_NAME) | ||
private static class TestSimulatorScenario extends AbstractSimulatorScenario { | ||
} | ||
} |