-
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.
fix(simulator-spring-boot): indicate simulation failure with http status
- Loading branch information
Showing
40 changed files
with
547 additions
and
440 deletions.
There are no files selected for viewing
1 change: 0 additions & 1 deletion
1
...type-jms/src/main/resources/archetype-resources/src/main/resources/application.properties
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
1 change: 0 additions & 1 deletion
1
...ype-mail/src/main/resources/archetype-resources/src/main/resources/application.properties
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
1 change: 0 additions & 1 deletion
1
...ype-rest/src/main/resources/archetype-resources/src/main/resources/application.properties
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
1 change: 0 additions & 1 deletion
1
...-swagger/src/main/resources/archetype-resources/src/main/resources/application.properties
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
1 change: 0 additions & 1 deletion
1
...etype-ws/src/main/resources/archetype-resources/src/main/resources/application.properties
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
1 change: 0 additions & 1 deletion
1
...ype-wsdl/src/main/resources/archetype-resources/src/main/resources/application.properties
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
48 changes: 48 additions & 0 deletions
48
...ample-rest/src/main/java/org/citrusframework/simulator/sample/scenario/ThrowScenario.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 |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
package org.citrusframework.simulator.sample.scenario; | ||
|
||
import org.citrusframework.exceptions.CitrusRuntimeException; | ||
import org.citrusframework.simulator.scenario.AbstractSimulatorScenario; | ||
import org.citrusframework.simulator.scenario.Scenario; | ||
import org.citrusframework.simulator.scenario.ScenarioRunner; | ||
import org.citrusframework.simulator.scenario.SimulatorScenario; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RequestMethod; | ||
|
||
import static org.citrusframework.actions.EchoAction.Builder.echo; | ||
|
||
/** | ||
* This scenario fails at runtime, unexpectedly. It must therefore be reported as failed {@link SimulatorScenario}. | ||
* <p> | ||
* On the other hand, if a simulation fails on purpose, see {@link FailScenario}, it must be a "successful simulation". | ||
*/ | ||
@Scenario("Throw") | ||
@RequestMapping(value = "/services/rest/simulator/throw", method = RequestMethod.GET) | ||
public class ThrowScenario extends AbstractSimulatorScenario { | ||
|
||
@Override | ||
public void run(ScenarioRunner scenario) { | ||
scenario.$(scenario.http() | ||
.receive() | ||
.get()); | ||
|
||
scenario.$(echo("Careful - I am gonna fail (:")); | ||
|
||
throw new CitrusRuntimeException("Every failure is a step to success."); | ||
} | ||
} |
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
33 changes: 33 additions & 0 deletions
33
...or-spring-boot/src/main/java/org/citrusframework/simulator/endpoint/ExceptionMessage.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 |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
package org.citrusframework.simulator.endpoint; | ||
|
||
import org.citrusframework.message.DefaultMessage; | ||
|
||
public class ExceptionMessage extends DefaultMessage { | ||
|
||
public static final String EXCEPTION_TYPE = "Exception"; | ||
|
||
public ExceptionMessage(Throwable e) { | ||
super(e); | ||
} | ||
|
||
@Override | ||
public String getType() { | ||
return EXCEPTION_TYPE; | ||
} | ||
} |
Oops, something went wrong.