diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml
new file mode 100644
index 000000000..7caf5dd0a
--- /dev/null
+++ b/.github/workflows/nightly.yml
@@ -0,0 +1,47 @@
+# ---------------------------------------------------------------------------
+# Copyright the original author or authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ---------------------------------------------------------------------------
+
+name: nightly
+
+on:
+ workflow_dispatch:
+ schedule:
+ - cron: "0 0 * * *"
+
+jobs:
+ nightly:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Set up JDK
+ uses: actions/setup-java@v4
+ with:
+ java-version: '17'
+ distribution: 'temurin'
+ - name: Checkout code
+ uses: actions/checkout@v4
+ - name: Cache Maven cache
+ uses: actions/cache@v4
+ with:
+ path: ~/.m2
+ key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
+ restore-keys: ${{ runner.os }}-m2
+ - name: Info
+ run: |
+ java -version
+ ./mvnw -version
+ - name: Simulator Dependency Report
+ run: |
+ ./mvnw --no-transfer-progress versions:display-dependency-updates
diff --git a/pom.xml b/pom.xml
index 2d96926dd..894c7edcd 100644
--- a/pom.xml
+++ b/pom.xml
@@ -24,10 +24,10 @@
1.6.13
1.18.30
- 4.2.1
+ 4.3.1
- 3.3.0
- 6.3.0
+ 3.3.2
+ 6.3.2
7.10.2
1.6.3
2.12.2
@@ -38,8 +38,8 @@
1.5.6
- v20.12.1
- 10.5.0
+ v22.4.1
+ 10.8.1
false
true
@@ -216,7 +216,7 @@
org.apache.xmlbeans
xmlbeans
- 3.1.0
+ 5.2.0
diff --git a/simulator-spring-boot/src/main/java/org/citrusframework/simulator/ws/WsdlScenarioGenerator.java b/simulator-spring-boot/src/main/java/org/citrusframework/simulator/ws/WsdlScenarioGenerator.java
index 3625b49d0..6b42bddfa 100644
--- a/simulator-spring-boot/src/main/java/org/citrusframework/simulator/ws/WsdlScenarioGenerator.java
+++ b/simulator-spring-boot/src/main/java/org/citrusframework/simulator/ws/WsdlScenarioGenerator.java
@@ -23,7 +23,6 @@
import org.apache.xmlbeans.XmlException;
import org.apache.xmlbeans.XmlObject;
import org.apache.xmlbeans.XmlOptions;
-import org.apache.xmlbeans.impl.xsd2inst.SampleXmlUtil;
import org.citrusframework.exceptions.CitrusRuntimeException;
import org.citrusframework.simulator.exception.SimulatorException;
import org.citrusframework.spi.CitrusResourceWrapper;
@@ -52,6 +51,9 @@
import java.util.ArrayList;
import java.util.List;
+import static org.apache.xmlbeans.impl.xsd2inst.SampleXmlUtil.createSampleForType;
+import static org.springframework.beans.factory.support.BeanDefinitionBuilder.genericBeanDefinition;
+
/**
* @author Christoph Deppisch
*/
@@ -127,13 +129,13 @@ public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory)
case SOAP_ACTION -> soapAction;
};
- if (beanFactory instanceof BeanDefinitionRegistry) {
- logger.info("Register auto generated scenario as bean definition: " + scenarioName);
- BeanDefinitionBuilder beanDefinitionBuilder = BeanDefinitionBuilder.genericBeanDefinition(WsdlOperationScenario.class)
+ if (beanFactory instanceof BeanDefinitionRegistry beanDefinitionRegistry) {
+ logger.info("Register auto generated scenario as bean definition: {}", scenarioName);
+ BeanDefinitionBuilder beanDefinitionBuilder = genericBeanDefinition(WsdlOperationScenario.class)
.addConstructorArgValue(operation)
.addPropertyValue("soapAction", soapAction)
- .addPropertyValue("input", generateRequest(operation, SampleXmlUtil.createSampleForType(requestElem)))
- .addPropertyValue("output", generateResponse(operation, SampleXmlUtil.createSampleForType(responseElem)));
+ .addPropertyValue("input", generateRequest(operation, createSampleForType(requestElem)))
+ .addPropertyValue("output", generateResponse(operation, createSampleForType(responseElem)));
if (beanFactory.containsBeanDefinition("inboundXmlDataDictionary")) {
beanDefinitionBuilder.addPropertyReference("inboundDataDictionary", "inboundXmlDataDictionary");
@@ -143,10 +145,10 @@ public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory)
beanDefinitionBuilder.addPropertyReference("outboundDataDictionary", "outboundXmlDataDictionary");
}
- ((BeanDefinitionRegistry) beanFactory).registerBeanDefinition(scenarioName, beanDefinitionBuilder.getBeanDefinition());
+ beanDefinitionRegistry.registerBeanDefinition(scenarioName, beanDefinitionBuilder.getBeanDefinition());
} else {
- logger.info("Register auto generated scenario as singleton: " + scenarioName);
- WsdlOperationScenario scenario = createScenario(operation, soapAction, generateRequest(operation, SampleXmlUtil.createSampleForType(requestElem)), generateResponse(operation, SampleXmlUtil.createSampleForType(responseElem)));
+ logger.info("Register auto generated scenario as singleton: {}", scenarioName);
+ WsdlOperationScenario scenario = createScenario(operation, soapAction, generateRequest(operation, createSampleForType(requestElem)), generateResponse(operation, createSampleForType(responseElem)));
beanFactory.registerSingleton(scenarioName, scenario);
}
}
diff --git a/simulator-spring-boot/src/test/java/org/citrusframework/simulator/ws/WsdlScenarioGeneratorTest.java b/simulator-spring-boot/src/test/java/org/citrusframework/simulator/ws/WsdlScenarioGeneratorTest.java
index 61c54de37..4a4860341 100644
--- a/simulator-spring-boot/src/test/java/org/citrusframework/simulator/ws/WsdlScenarioGeneratorTest.java
+++ b/simulator-spring-boot/src/test/java/org/citrusframework/simulator/ws/WsdlScenarioGeneratorTest.java
@@ -29,11 +29,18 @@
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
+import java.util.regex.Pattern;
import java.util.stream.Stream;
+import static java.lang.String.format;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.citrusframework.simulator.ws.WsdlScenarioGenerator.WsdlScenarioNamingStrategy.INPUT;
+import static org.citrusframework.simulator.ws.WsdlScenarioGenerator.WsdlScenarioNamingStrategy.OPERATION;
+import static org.citrusframework.simulator.ws.WsdlScenarioGenerator.WsdlScenarioNamingStrategy.SOAP_ACTION;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.params.provider.Arguments.arguments;
import static org.mockito.Mockito.any;
import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.doReturn;
@@ -46,38 +53,35 @@
@ExtendWith(MockitoExtension.class)
class WsdlScenarioGeneratorTest {
- private static final String SCENARIO_INPUT = String.format("%n" +
+ private static final String SCENARIO_INPUT = format("%n" +
" string%n" +
" 100%n" +
- " true%n" +
+ " (true|false)%n" +
" stringstri%n" +
"");
+ public static final Pattern SCENARIO_INPUT_PATTERN = Pattern.compile(SCENARIO_INPUT);
- private static final String SCENARIO_OUTPUT = String.format("%n" +
+ private static final String SCENARIO_OUTPUT = format("%n" +
" string%n" +
" 100%n" +
- " true%n" +
+ " (true|false)%n" +
" stringstri%n" +
"");
+ public static final Pattern SCENARIO_OUTPUT_PATTERN = Pattern.compile(SCENARIO_OUTPUT);
+
@Mock
private ConfigurableListableBeanFactory beanFactoryMock;
+
@Mock
private DefaultListableBeanFactory beanRegistryMock;
- private WsdlScenarioGenerator fixture;
- static Stream testGenerateScenarios() {
- return data();
- }
-
- static Stream testGenerateScenariosWithRegistry() {
- return data();
- }
+ private WsdlScenarioGenerator fixture;
static Stream data() {
return Stream.of(
- Arguments.of("TestRequest", WsdlScenarioGenerator.WsdlScenarioNamingStrategy.INPUT, "/TestService/test", SCENARIO_INPUT, SCENARIO_OUTPUT),
- Arguments.of("test", WsdlScenarioGenerator.WsdlScenarioNamingStrategy.OPERATION, "/TestService/test", SCENARIO_INPUT, SCENARIO_OUTPUT),
- Arguments.of("/TestService/test", WsdlScenarioGenerator.WsdlScenarioNamingStrategy.SOAP_ACTION, "/TestService/test", SCENARIO_INPUT, SCENARIO_OUTPUT)
+ arguments("TestRequest", INPUT, "/TestService/test", SCENARIO_INPUT, SCENARIO_OUTPUT),
+ arguments("test", OPERATION, "/TestService/test", SCENARIO_INPUT, SCENARIO_OUTPUT),
+ arguments("/TestService/test", SOAP_ACTION, "/TestService/test", SCENARIO_INPUT, SCENARIO_OUTPUT)
);
}
@@ -86,17 +90,17 @@ void beforeEachSetup() {
fixture = new WsdlScenarioGenerator(new Resources.ClasspathResource("schema/TestService.wsdl"));
}
- @MethodSource
@ParameterizedTest
+ @MethodSource("data")
void testGenerateScenarios(String scenarioName, WsdlScenarioGenerator.WsdlScenarioNamingStrategy namingStrategy, String soapAction, String input, String output) {
fixture.setNamingStrategy(namingStrategy);
doAnswer(invocation -> {
WsdlOperationScenario scenario = (WsdlOperationScenario) invocation.getArguments()[1];
- assertEquals(scenario.getSoapAction(), soapAction);
- assertEquals(scenario.getInput(), input);
- assertEquals(scenario.getOutput(), output);
+ assertEquals(soapAction, scenario.getSoapAction());
+ assertThat(scenario.getInput()).matches(SCENARIO_INPUT_PATTERN);
+ assertThat(scenario.getOutput()).matches(SCENARIO_OUTPUT_PATTERN);
return null;
}).when(beanFactoryMock).registerSingleton(eq(scenarioName), any(WsdlOperationScenario.class));
@@ -106,17 +110,17 @@ void testGenerateScenarios(String scenarioName, WsdlScenarioGenerator.WsdlScenar
verify(beanFactoryMock).registerSingleton(eq(scenarioName), any(WsdlOperationScenario.class));
}
- @MethodSource
@ParameterizedTest
+ @MethodSource("data")
void testGenerateScenariosWithRegistry(String scenarioName, WsdlScenarioGenerator.WsdlScenarioNamingStrategy namingStrategy, String soapAction, String input, String output) {
fixture.setNamingStrategy(namingStrategy);
doAnswer(invocation -> {
BeanDefinition scenario = (BeanDefinition) invocation.getArguments()[1];
- assertEquals(scenario.getPropertyValues().get("soapAction"), soapAction);
- assertEquals(scenario.getPropertyValues().get("input"), input);
- assertEquals(scenario.getPropertyValues().get("output"), output);
+ assertEquals(soapAction, scenario.getPropertyValues().get("soapAction"));
+ assertThat(scenario.getPropertyValues().get("input")).asString().matches(SCENARIO_INPUT_PATTERN);
+ assertThat(scenario.getPropertyValues().get("output")).asString().matches(SCENARIO_OUTPUT_PATTERN);
assertNull(scenario.getPropertyValues().get("inboundDataDictionary"));
assertNull(scenario.getPropertyValues().get("outboundDataDictionary"));
@@ -136,9 +140,9 @@ void generateScenariosWithDataDictionaries() {
doAnswer(invocation -> {
BeanDefinition scenario = (BeanDefinition) invocation.getArguments()[1];
- assertEquals(scenario.getPropertyValues().get("soapAction"), "/TestService/test");
- assertEquals(scenario.getPropertyValues().get("input"), SCENARIO_INPUT);
- assertEquals(scenario.getPropertyValues().get("output"), SCENARIO_OUTPUT);
+ assertEquals("/TestService/test", scenario.getPropertyValues().get("soapAction"));
+ assertThat(scenario.getPropertyValues().get("input")).asString().matches(SCENARIO_INPUT_PATTERN);
+ assertThat(scenario.getPropertyValues().get("output")).asString().matches(SCENARIO_OUTPUT_PATTERN);
assertNotNull(scenario.getPropertyValues().get("inboundDataDictionary"));
assertNotNull(scenario.getPropertyValues().get("outboundDataDictionary"));