diff options
Diffstat (limited to 'so-simulator/src/main/java')
5 files changed, 119 insertions, 12 deletions
diff --git a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/QueryStackByIdDoubleFailure.java b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/QueryStackByIdDoubleFailure.java index 2311c4c44e..2fa8725d56 100644 --- a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/QueryStackByIdDoubleFailure.java +++ b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/QueryStackByIdDoubleFailure.java @@ -17,10 +17,11 @@ public class QueryStackByIdDoubleFailure extends AbstractSimulatorScenario { @Override public void run(ScenarioDesigner scenario) { - // Get to see if stack exists + // Create Poll Service + scenario.scenarioEndpoint().getEndpointConfiguration().setTimeout(300000L); scenario.http().receive().get().extractFromHeader(DynamicEndpointUriResolver.REQUEST_PATH_HEADER_NAME, "correlationId"); - scenario.echo("${correlationId}"); + scenario.echo("${correlationId}"); // step 2 scenario.correlation().start().onHeader(DynamicEndpointUriResolver.REQUEST_PATH_HEADER_NAME, "${correlationId}"); @@ -30,20 +31,63 @@ public class QueryStackByIdDoubleFailure extends AbstractSimulatorScenario { scenario.variable("tenantId", "872f331350c54e59991a8de2cbffb40c"); scenario.variable("vServerId", "d29f3151-592d-4011-9356-ad047794e236"); scenario.variable("stack_failure_message", "The Flavor ID (nd.c6r16d20) could not be found."); + scenario.http().send().response(HttpStatus.OK) // step 4 + .payload(new ClassPathResource("openstack/gr_api/Stack_Failure.json")); + + // Create Poll Retry + scenario.http().receive().get(); // step 5 + scenario.http().send().response(HttpStatus.OK) + .payload(new ClassPathResource("openstack/gr_api/Stack_Failure.json")); + + // Rollback Delete of the stack + scenario.http().receive().delete(); // step 7 + scenario.action(new DeleteVServers()); + scenario.http().send().response(HttpStatus.NO_CONTENT); + + // Rollback Poll + scenario.http().receive().get(); // step 10 scenario.http().send().response(HttpStatus.OK) .payload(new ClassPathResource("openstack/gr_api/Stack_Failure.json")); + // Rollback Poll Retry + scenario.http().receive().get(); + scenario.http().send().response(HttpStatus.OK) + .payload(new ClassPathResource("openstack/gr_api/Stack_Failure.json")); + + // Create Poll + scenario.http().receive().get(); // step 14 + scenario.http().send().response(HttpStatus.OK) + .payload(new ClassPathResource("openstack/gr_api/Stack_Failure.json")); - // Delete of the stack + // Create Poll Retry + scenario.http().receive().get(); + scenario.http().send().response(HttpStatus.OK) + .payload(new ClassPathResource("openstack/gr_api/Stack_Failure.json")); + + // Rollback Delete scenario.http().receive().delete(); scenario.action(new DeleteVServers()); scenario.http().send().response(HttpStatus.NO_CONTENT); - // Poll Deletion of stack for status + // Rollback Poll + scenario.http().receive().get(); // step 18 + scenario.http().send().response(HttpStatus.OK) + .payload(new ClassPathResource("openstack/gr_api/Stack_Failure.json")); + + // Rollback Poll Retry scenario.http().receive().get(); scenario.http().send().response(HttpStatus.OK) .payload(new ClassPathResource("openstack/gr_api/Stack_Failure.json")); + // Delete + scenario.http().receive().delete(); + scenario.http().send().response(HttpStatus.NO_CONTENT); + + // Delete Poll + scenario.http().receive().get(); + scenario.http().send().response(HttpStatus.OK) + .payload(new ClassPathResource("openstack/gr_api/Stack_Deleted.json")); + } } diff --git a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/QueryStackByIdFailure.java b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/QueryStackByIdFailure.java index 4d0d578831..7f995f2930 100644 --- a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/QueryStackByIdFailure.java +++ b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/QueryStackByIdFailure.java @@ -3,8 +3,6 @@ package org.onap.so.simulator.scenarios.openstack; import org.springframework.core.io.ClassPathResource; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.onap.so.simulator.actions.aai.DeleteVServers; import com.consol.citrus.endpoint.resolver.DynamicEndpointUriResolver; import com.consol.citrus.simulator.scenario.AbstractSimulatorScenario; import com.consol.citrus.simulator.scenario.Scenario; @@ -17,7 +15,9 @@ public class QueryStackByIdFailure extends AbstractSimulatorScenario { @Override public void run(ScenarioDesigner scenario) { - // Get to see if stack exists + scenario.scenarioEndpoint().getEndpointConfiguration().setTimeout(300000L); + + // Create Poll scenario.http().receive().get().extractFromHeader(DynamicEndpointUriResolver.REQUEST_PATH_HEADER_NAME, "correlationId"); scenario.echo("${correlationId}"); @@ -33,13 +33,13 @@ public class QueryStackByIdFailure extends AbstractSimulatorScenario { scenario.http().send().response(HttpStatus.OK) .payload(new ClassPathResource("openstack/gr_api/Stack_Failure.json")); + // Create Poll Retry + scenario.http().receive().get(); + scenario.http().send().response(HttpStatus.OK) + .payload(new ClassPathResource("openstack/gr_api/Stack_Failure.json")); - // Delete of the stack - scenario.http().receive().delete(); - scenario.action(new DeleteVServers()); - scenario.http().send().response(HttpStatus.NO_CONTENT); - // Poll Deletion of stack for status + // Rollback Poll scenario.http().receive().get(); scenario.http().send().response(HttpStatus.OK) .payload(new ClassPathResource("openstack/gr_api/Stack_Deleted.json")); diff --git a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/macro/QueryStackByIdMacro1.java b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/macro/QueryStackByIdMacro1.java index ba6a1a1185..c8c81ebecf 100644 --- a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/macro/QueryStackByIdMacro1.java +++ b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/macro/QueryStackByIdMacro1.java @@ -9,6 +9,10 @@ import com.consol.citrus.simulator.scenario.AbstractSimulatorScenario; import com.consol.citrus.simulator.scenario.Scenario; import com.consol.citrus.simulator.scenario.ScenarioDesigner; +/** + * This scenario is used by the following test cases: Resume Service Instance Macro 3 Modules 1 To Complete + * + */ @Scenario("Openstack-QueryStackByID-Macro1") @RequestMapping(value = "/sim/mockPublicUrl/stacks/macro_module_1/*", method = RequestMethod.GET) public class QueryStackByIdMacro1 extends AbstractSimulatorScenario { @@ -16,6 +20,9 @@ public class QueryStackByIdMacro1 extends AbstractSimulatorScenario { @Override public void run(ScenarioDesigner scenario) { + scenario.scenarioEndpoint().getEndpointConfiguration().setTimeout(300000L); + + // Poll scenario.http().receive().get().extractFromHeader(DynamicEndpointUriResolver.REQUEST_PATH_HEADER_NAME, "correlationId"); scenario.echo("${correlationId}"); @@ -27,8 +34,33 @@ public class QueryStackByIdMacro1 extends AbstractSimulatorScenario { scenario.http().send().response(HttpStatus.OK) .payload(new ClassPathResource("openstack/gr_api/Stack_Created.json")); + // Create (module_2) + scenario.http().receive().get(); + scenario.http().send().response(HttpStatus.OK) + .payload(new ClassPathResource("openstack/gr_api/Stack_Created.json")); + + // Create (module_3) + scenario.http().receive().get(); + scenario.http().send().response(HttpStatus.OK) + .payload(new ClassPathResource("openstack/gr_api/Stack_Created.json")); + + // Create (module_2 recreate) + scenario.http().receive().get(); + scenario.http().send().response(HttpStatus.OK) + .payload(new ClassPathResource("openstack/gr_api/Stack_Created.json")); + + // Delete + scenario.http().receive().get(); + scenario.http().send().response(HttpStatus.OK) + .payload(new ClassPathResource("openstack/gr_api/Stack_Deleted.json")); + + // Delete scenario.http().receive().get(); + scenario.http().send().response(HttpStatus.OK) + .payload(new ClassPathResource("openstack/gr_api/Stack_Deleted.json")); + // Poll + scenario.http().receive().get(); scenario.http().send().response(HttpStatus.OK) .payload(new ClassPathResource("openstack/gr_api/Stack_Deleted.json")); } diff --git a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/macro/QueryStackByIdMacro2.java b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/macro/QueryStackByIdMacro2.java index efd420486d..aca5fe8194 100644 --- a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/macro/QueryStackByIdMacro2.java +++ b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/macro/QueryStackByIdMacro2.java @@ -9,6 +9,10 @@ import com.consol.citrus.simulator.scenario.AbstractSimulatorScenario; import com.consol.citrus.simulator.scenario.Scenario; import com.consol.citrus.simulator.scenario.ScenarioDesigner; +/** + * This scenario is used by the following test cases: Resume Service Instance Macro 3 Modules 1 To Complete + * + */ @Scenario("Openstack-QueryStackByID-Macro2") @RequestMapping(value = "/sim/mockPublicUrl/stacks/macro_module_2/*", method = RequestMethod.GET) public class QueryStackByIdMacro2 extends AbstractSimulatorScenario { @@ -16,6 +20,9 @@ public class QueryStackByIdMacro2 extends AbstractSimulatorScenario { @Override public void run(ScenarioDesigner scenario) { + scenario.scenarioEndpoint().getEndpointConfiguration().setTimeout(300000L); + + // Poll scenario.http().receive().get().extractFromHeader(DynamicEndpointUriResolver.REQUEST_PATH_HEADER_NAME, "correlationId"); scenario.echo("${correlationId}"); @@ -27,11 +34,19 @@ public class QueryStackByIdMacro2 extends AbstractSimulatorScenario { scenario.http().send().response(HttpStatus.OK) .payload(new ClassPathResource("openstack/gr_api/Stack_Created.json")); + // Delete scenario.http().receive().get(); + scenario.http().send().response(HttpStatus.OK) + .payload(new ClassPathResource("openstack/gr_api/Stack_Created.json")); + scenario.http().receive().get(); scenario.http().send().response(HttpStatus.OK) .payload(new ClassPathResource("openstack/gr_api/Stack_Deleted.json")); + // Poll + scenario.http().receive().get(); + scenario.http().send().response(HttpStatus.OK) + .payload(new ClassPathResource("openstack/gr_api/Stack_Deleted.json")); } } diff --git a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/macro/QueryStackByIdMacro3.java b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/macro/QueryStackByIdMacro3.java index 4d3ba8697a..9fc6fafdb3 100644 --- a/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/macro/QueryStackByIdMacro3.java +++ b/so-simulator/src/main/java/org/onap/so/simulator/scenarios/openstack/macro/QueryStackByIdMacro3.java @@ -9,6 +9,10 @@ import com.consol.citrus.simulator.scenario.AbstractSimulatorScenario; import com.consol.citrus.simulator.scenario.Scenario; import com.consol.citrus.simulator.scenario.ScenarioDesigner; +/** + * This scenario is used by the following test cases: Resume Service Instance Macro 3 Modules 1 To Complete + * + */ @Scenario("Openstack-QueryStackByID-Macro3") @RequestMapping(value = "/sim/mockPublicUrl/stacks/macro_module_3/*", method = RequestMethod.GET) public class QueryStackByIdMacro3 extends AbstractSimulatorScenario { @@ -16,6 +20,8 @@ public class QueryStackByIdMacro3 extends AbstractSimulatorScenario { @Override public void run(ScenarioDesigner scenario) { + scenario.scenarioEndpoint().getEndpointConfiguration().setTimeout(300000L); + scenario.http().receive().get().extractFromHeader(DynamicEndpointUriResolver.REQUEST_PATH_HEADER_NAME, "correlationId"); scenario.echo("${correlationId}"); @@ -24,11 +30,21 @@ public class QueryStackByIdMacro3 extends AbstractSimulatorScenario { scenario.variable("stackName", "macro_module_3"); + // Poll + scenario.http().send().response(HttpStatus.OK) + .payload(new ClassPathResource("openstack/gr_api/Stack_Created.json")); + + // Delete + scenario.http().receive().get(); scenario.http().send().response(HttpStatus.OK) .payload(new ClassPathResource("openstack/gr_api/Stack_Created.json")); scenario.http().receive().get(); + scenario.http().send().response(HttpStatus.OK) + .payload(new ClassPathResource("openstack/gr_api/Stack_Deleted.json")); + // Poll + scenario.http().receive().get(); scenario.http().send().response(HttpStatus.OK) .payload(new ClassPathResource("openstack/gr_api/Stack_Deleted.json")); |