How to use action method of com.consol.citrus.dsl.builder.WaitActionConditionBuilder class

Best Citrus code snippet using com.consol.citrus.dsl.builder.WaitActionConditionBuilder.action

Source:DefaultTestRunner.java Github

copy

Full Screen

...23import com.consol.citrus.TestActionBuilder;24import com.consol.citrus.TestActionContainerBuilder;25import com.consol.citrus.TestCase;26import com.consol.citrus.TestCaseMetaInfo;27import com.consol.citrus.actions.AntRunAction;28import com.consol.citrus.actions.CreateVariablesAction;29import com.consol.citrus.actions.EchoAction;30import com.consol.citrus.actions.ExecutePLSQLAction;31import com.consol.citrus.actions.ExecuteSQLAction;32import com.consol.citrus.actions.ExecuteSQLQueryAction;33import com.consol.citrus.actions.FailAction;34import com.consol.citrus.actions.InputAction;35import com.consol.citrus.actions.LoadPropertiesAction;36import com.consol.citrus.actions.PurgeEndpointAction;37import com.consol.citrus.actions.ReceiveMessageAction;38import com.consol.citrus.actions.ReceiveTimeoutAction;39import com.consol.citrus.actions.SendMessageAction;40import com.consol.citrus.actions.SleepAction;41import com.consol.citrus.actions.StartServerAction;42import com.consol.citrus.actions.StopServerAction;43import com.consol.citrus.actions.StopTimeAction;44import com.consol.citrus.actions.StopTimerAction;45import com.consol.citrus.actions.TraceVariablesAction;46import com.consol.citrus.actions.TransformAction;47import com.consol.citrus.condition.ActionCondition;48import com.consol.citrus.condition.Condition;49import com.consol.citrus.condition.FileCondition;50import com.consol.citrus.condition.HttpCondition;51import com.consol.citrus.container.Assert;52import com.consol.citrus.container.Async;53import com.consol.citrus.container.Catch;54import com.consol.citrus.container.Conditional;55import com.consol.citrus.container.FinallySequence;56import com.consol.citrus.container.Iterate;57import com.consol.citrus.container.Parallel;58import com.consol.citrus.container.RepeatOnErrorUntilTrue;59import com.consol.citrus.container.RepeatUntilTrue;60import com.consol.citrus.container.Sequence;61import com.consol.citrus.container.Template;62import com.consol.citrus.container.TestActionContainer;63import com.consol.citrus.container.Timer;64import com.consol.citrus.container.Wait;65import com.consol.citrus.container.WaitActionConditionBuilder;66import com.consol.citrus.container.WaitFileConditionBuilder;67import com.consol.citrus.container.WaitHttpConditionBuilder;68import com.consol.citrus.context.TestContext;69import com.consol.citrus.dsl.builder.AssertSoapFaultBuilder;70import com.consol.citrus.dsl.builder.BuilderSupport;71import com.consol.citrus.dsl.builder.CamelRouteActionBuilder;72import com.consol.citrus.dsl.builder.DockerExecuteActionBuilder;73import com.consol.citrus.dsl.builder.HttpActionBuilder;74import com.consol.citrus.dsl.builder.KubernetesExecuteActionBuilder;75import com.consol.citrus.dsl.builder.PurgeJmsQueuesActionBuilder;76import com.consol.citrus.dsl.builder.PurgeMessageChannelActionBuilder;77import com.consol.citrus.dsl.builder.ReceiveMessageActionBuilder;78import com.consol.citrus.dsl.builder.SeleniumActionBuilder;79import com.consol.citrus.dsl.builder.SendMessageActionBuilder;80import com.consol.citrus.dsl.builder.SoapActionBuilder;81import com.consol.citrus.dsl.builder.ZooExecuteActionBuilder;82import com.consol.citrus.exceptions.CitrusRuntimeException;83import com.consol.citrus.script.GroovyAction;84import com.consol.citrus.server.Server;85/**86 * Default test runner implementation. Provides Java DSL methods for test actions. Immediately executes test actions as87 * they were built. This way the test case grows with each test action and changes for instance to the test context (variables) are88 * immediately visible.89 *90 * @author Christoph Deppisch91 * @since 2.392 */93public class DefaultTestRunner implements TestRunner {94 /** Test case */95 private final DefaultTestCase testCase;96 /** This runners test context */97 private TestContext context;98 /** Optional stack of containers cached for execution */99 protected Stack<TestActionContainerBuilder<? extends TestActionContainer, ?>> containers = new Stack<>();100 /** Default constructor */101 public DefaultTestRunner() {102 testCase = new DefaultTestCase();103 testClass(this.getClass());104 name(this.getClass().getSimpleName());105 packageName(this.getClass().getPackage().getName());106 }107 /**108 * Constructor initializing test case.109 * @param testCase110 */111 protected DefaultTestRunner(DefaultTestCase testCase) {112 this.testCase = testCase;113 }114 /**115 * Constructor using Spring bean application context.116 * @param context117 */118 public DefaultTestRunner(TestContext context) {119 this();120 this.context = context;121 }122 @Override123 public void testClass(Class<?> type) {124 testCase.setTestClass(type);125 }126 @Override127 public void name(String name) {128 testCase.setName(name);129 }130 @Override131 public void description(String description) {132 testCase.setDescription(description);133 }134 @Override135 public void author(String author) {136 testCase.getMetaInfo().setAuthor(author);137 }138 @Override139 public void packageName(String packageName) {140 testCase.setPackageName(packageName);141 }142 @Override143 public void status(TestCaseMetaInfo.Status status) {144 testCase.getMetaInfo().setStatus(status);145 }146 @Override147 public void creationDate(Date date) {148 testCase.getMetaInfo().setCreationDate(date);149 }150 @Override151 public void groups(String[] groups) {152 this.testCase.setGroups(groups);153 }154 @Override155 public void start() {156 testCase.start(context);157 }158 @Override159 public void stop() {160 testCase.finish(context);161 }162 @Override163 public <T> T variable(String name, T value) {164 testCase.getVariableDefinitions().put(name, value);165 if (value instanceof String) {166 String resolved = context.replaceDynamicContentInString(value.toString());167 context.setVariable(name, resolved);168 return (T) resolved;169 } else {170 context.setVariable(name, value);171 return value;172 }173 }174 @Override175 public <A extends TestAction> TestActionBuilder<A> run(A testAction) {176 return run((TestActionBuilder<A>)() -> testAction);177 }178 @Override179 public <T extends TestActionBuilder<?>> T run(T builder) {180 if (builder instanceof TestActionContainerBuilder<?, ?>) {181 if (containers.lastElement().equals(builder)) {182 containers.pop();183 } else {184 throw new CitrusRuntimeException("Invalid use of action containers - the container execution is not expected!");185 }186 if (builder instanceof FinallySequence.Builder) {187 ((FinallySequence.Builder) builder).getActions().forEach(testCase::addFinalAction);188 return builder;189 }190 }191 if (containers.isEmpty()) {192 testCase.addTestAction(builder);193 testCase.executeAction(builder.build(), context);194 } else {195 containers.lastElement().getActions().add(builder);196 }197 return builder;198 }199 @Override200 public ApplyTestBehaviorAction.Builder applyBehavior(TestBehavior behavior) {201 ApplyTestBehaviorAction.Builder builder = new ApplyTestBehaviorAction.Builder()202 .runner(this)203 .behavior(behavior);204 behavior.setTestContext(context);205 builder.build().execute(context);206 return builder;207 }208 @Override209 public <T extends TestActionContainer, B extends TestActionContainerBuilder<T, B>> TestActionContainerBuilder<T, B> container(T container) {210 TestActionContainerBuilder<T, B> builder = new AbstractTestContainerBuilder<T, B>() {211 @Override212 public B actions(TestActionBuilder<?>... actions) {213 return run(super.actions(actions));214 }215 @Override216 protected T doBuild() {217 return container;218 }219 @Override220 public T build() {221 if (container.getActions().size() > 0) {222 return container;223 }224 return super.build();225 }226 };227 return container(builder);228 }229 @Override230 public <T extends TestActionContainerBuilder<? extends TestActionContainer, ?>> T container(T container) {231 containers.push(container);232 return container;233 }234 @Override235 public CreateVariablesAction.Builder createVariable(String variableName, String value) {236 CreateVariablesAction.Builder builder = CreateVariablesAction.Builder.createVariable(variableName, value);237 return run(builder);238 }239 @Override240 public AntRunAction.Builder antrun(BuilderSupport<AntRunAction.Builder> configurer) {241 AntRunAction.Builder builder = new AntRunAction.Builder();242 configurer.configure(builder);243 return run(builder);244 }245 @Override246 public EchoAction.Builder echo(String message) {247 return run(new EchoAction.Builder().message(message));248 }249 @Override250 public ExecutePLSQLAction.Builder plsql(BuilderSupport<ExecutePLSQLAction.Builder> configurer) {251 ExecutePLSQLAction.Builder builder = new ExecutePLSQLAction.Builder();252 configurer.configure(builder);253 return run(builder);254 }255 @Override256 public ExecuteSQLAction.Builder sql(BuilderSupport<ExecuteSQLAction.Builder> configurer) {257 ExecuteSQLAction.Builder builder = new ExecuteSQLAction.Builder();258 configurer.configure(builder);259 return run(builder);260 }261 @Override262 public ExecuteSQLQueryAction.Builder query(BuilderSupport<ExecuteSQLQueryAction.Builder> configurer) {263 ExecuteSQLQueryAction.Builder builder = new ExecuteSQLQueryAction.Builder();264 configurer.configure(builder);265 return run(builder);266 }267 @Override268 public FailAction.Builder fail(String message) {269 return run(new FailAction.Builder().message(message));270 }271 @Override272 public InputAction.Builder input(BuilderSupport<InputAction.Builder> configurer) {273 InputAction.Builder builder = new InputAction.Builder();274 configurer.configure(builder);275 return run(builder);276 }277 @Override278 public ReceiveTimeoutAction.Builder receiveTimeout(BuilderSupport<ReceiveTimeoutAction.Builder> configurer) {279 ReceiveTimeoutAction.Builder builder = new ReceiveTimeoutAction.Builder();280 configurer.configure(builder);281 return run(builder);282 }283 @Override284 public LoadPropertiesAction.Builder load(String filePath) {285 LoadPropertiesAction.Builder builder = new LoadPropertiesAction.Builder()286 .filePath(filePath);287 return run(builder);288 }289 @Override290 public PurgeJmsQueuesActionBuilder purgeQueues(BuilderSupport<PurgeJmsQueuesActionBuilder> configurer) {291 PurgeJmsQueuesActionBuilder builder = new PurgeJmsQueuesActionBuilder();292 builder.withReferenceResolver(context.getReferenceResolver());293 configurer.configure(builder);294 return run(builder);295 }296 @Override297 public PurgeMessageChannelActionBuilder purgeChannels(BuilderSupport<PurgeMessageChannelActionBuilder> configurer) {298 PurgeMessageChannelActionBuilder builder = new PurgeMessageChannelActionBuilder();299 builder.channelResolver(context.getReferenceResolver());300 configurer.configure(builder);301 return run(builder);302 }303 @Override304 public PurgeEndpointAction.Builder purgeEndpoints(BuilderSupport<PurgeEndpointAction.Builder> configurer) {305 PurgeEndpointAction.Builder builder = new PurgeEndpointAction.Builder()306 .withReferenceResolver(context.getReferenceResolver());307 configurer.configure(builder);308 return run(builder);309 }310 @Override311 public ReceiveMessageActionBuilder<?> receive(BuilderSupport<ReceiveMessageActionBuilder<?>> configurer) {312 ReceiveMessageActionBuilder<?> builder = new ReceiveMessageActionBuilder<>(new ReceiveMessageAction.Builder()313 .withReferenceResolver(context.getReferenceResolver()));314 configurer.configure(builder);315 return run(builder);316 }317 @Override318 public SendMessageActionBuilder<?> send(BuilderSupport<SendMessageActionBuilder<?>> configurer) {319 SendMessageActionBuilder<?> builder = new SendMessageActionBuilder<>(new SendMessageAction.Builder()320 .withReferenceResolver(context.getReferenceResolver()));321 configurer.configure(builder);322 return run(builder);323 }324 @Override325 public SleepAction.Builder sleep() {326 return run(new SleepAction.Builder());327 }328 @Override329 public SleepAction.Builder sleep(long milliseconds) {330 SleepAction.Builder builder = new SleepAction.Builder()331 .milliseconds(milliseconds);332 return run(builder);333 }334 @Override335 public Wait.Builder waitFor() {336 return new Wait.Builder() {337 @Override338 public WaitActionConditionBuilder execution() {339 final Sequence.Builder dummy = new Sequence.Builder();340 ActionCondition condition = new ActionCondition();341 this.condition = condition;342 DefaultTestRunner.this.containers.push(dummy);343 return new WaitActionConditionBuilder(condition, this) {344 @Override345 public WaitActionConditionBuilder action(TestActionBuilder<?> action) {346 super.action(action);347 DefaultTestRunner.this.containers.remove(dummy);348 return run(this);349 }350 };351 }352 @Override353 public WaitFileConditionBuilder file() {354 FileCondition condition = new FileCondition();355 this.condition = condition;356 return new WaitFileConditionBuilder(condition, this) {357 @Override358 public WaitFileConditionBuilder resource(File file) {359 super.resource(file);360 return run(this);361 }362 };363 }364 @Override365 public WaitHttpConditionBuilder http() {366 HttpCondition condition = new HttpCondition();367 this.condition = condition;368 return new WaitHttpConditionBuilder(condition, this) {369 @Override370 public WaitHttpConditionBuilder url(String requestUrl) {371 super.url(requestUrl);372 return run(this);373 }374 };375 }376 @Override377 public Wait.Builder condition(Condition condition) {378 super.condition(condition);379 return run(this);380 }381 };382 }383 @Override384 public StartServerAction.Builder start(Server... servers) {385 StartServerAction.Builder builder = new StartServerAction.Builder()386 .server(servers);387 return run(builder);388 }389 @Override390 public StartServerAction.Builder start(Server server) {391 StartServerAction.Builder builder = new StartServerAction.Builder()392 .server(server);393 return run(builder);394 }395 @Override396 public StopServerAction.Builder stop(Server... servers) {397 StopServerAction.Builder builder = new StopServerAction.Builder()398 .server(servers);399 return run(builder);400 }401 @Override402 public StopServerAction.Builder stop(Server server) {403 StopServerAction.Builder builder = new StopServerAction.Builder()404 .server(server);405 return run(builder);406 }407 @Override408 public StopTimeAction.Builder stopTime() {409 return run(new StopTimeAction.Builder());410 }411 @Override412 public StopTimeAction.Builder stopTime(String id) {413 StopTimeAction.Builder builder = new StopTimeAction.Builder()414 .id(id);415 return run(builder);416 }417 @Override418 public StopTimeAction.Builder stopTime(String id, String suffix) {419 StopTimeAction.Builder builder = new StopTimeAction.Builder()420 .id(id)421 .suffix(suffix);422 return run(builder);423 }424 @Override425 public TraceVariablesAction.Builder traceVariables() {426 return run(new TraceVariablesAction.Builder());427 }428 @Override429 public TraceVariablesAction.Builder traceVariables(String... variables) {430 TraceVariablesAction.Builder builder = new TraceVariablesAction.Builder()431 .variables(variables);432 return run(builder);433 }434 @Override435 public GroovyAction.Builder groovy(BuilderSupport<GroovyAction.Builder> configurer) {436 GroovyAction.Builder builder = new GroovyAction.Builder();437 configurer.configure(builder);438 return run(builder);439 }440 @Override441 public TransformAction.Builder transform(BuilderSupport<TransformAction.Builder> configurer) {442 TransformAction.Builder builder = new TransformAction.Builder();443 configurer.configure(builder);444 return run(builder);445 }446 @Override447 public Assert.Builder assertException() {448 Assert.Builder builder = new Assert.Builder() {449 @Override450 public Assert.Builder actions(TestActionBuilder<?>... actions) {451 return run(super.actions(actions));452 }453 };454 return container(builder);455 }456 @Override457 public Catch.Builder catchException() {458 Catch.Builder builder = new Catch.Builder() {459 @Override460 public Catch.Builder actions(TestActionBuilder<?>... actions) {461 return run(super.actions(actions));462 }463 };464 return container(builder);465 }466 @Override467 public AssertSoapFaultBuilder assertSoapFault() {468 AssertSoapFaultBuilder builder = new AssertSoapFaultBuilder() {469 @Override470 public AssertSoapFaultBuilder actions(TestActionBuilder<?>... actions) {471 return run(super.actions(actions));472 }473 };474 builder.withReferenceResolver(context.getReferenceResolver());475 return container(builder);476 }477 @Override478 public Conditional.Builder conditional() {479 Conditional.Builder builder = new Conditional.Builder() {480 @Override481 public Conditional.Builder actions(TestActionBuilder<?>... actions) {482 return run(super.actions(actions));483 }484 };485 return container(builder);486 }487 @Override488 public Iterate.Builder iterate() {489 Iterate.Builder builder = new Iterate.Builder() {490 @Override491 public Iterate.Builder actions(TestActionBuilder<?>... actions) {492 return run(super.actions(actions));493 }494 };495 return container(builder);496 }497 @Override498 public Parallel.Builder parallel() {499 Parallel.Builder builder = new Parallel.Builder() {500 @Override501 public Parallel.Builder actions(TestActionBuilder<?>... actions) {502 return run(super.actions(actions));503 }504 };505 return container(builder);506 }507 @Override508 public RepeatOnErrorUntilTrue.Builder repeatOnError() {509 RepeatOnErrorUntilTrue.Builder builder = new RepeatOnErrorUntilTrue.Builder() {510 @Override511 public RepeatOnErrorUntilTrue.Builder actions(TestActionBuilder<?>... actions) {512 return run(super.actions(actions));513 }514 };515 return container(builder);516 }517 @Override518 public RepeatUntilTrue.Builder repeat() {519 RepeatUntilTrue.Builder builder = new RepeatUntilTrue.Builder() {520 @Override521 public RepeatUntilTrue.Builder actions(TestActionBuilder<?>... actions) {522 return run(super.actions(actions));523 }524 };525 return container(builder);526 }527 @Override528 public Sequence.Builder sequential() {529 Sequence.Builder builder = new Sequence.Builder() {530 @Override531 public Sequence.Builder actions(TestActionBuilder<?>... actions) {532 return run(super.actions(actions));533 }534 };535 return container(builder);536 }537 @Override538 public Async.Builder async() {539 Async.Builder builder = new Async.Builder() {540 @Override541 public Async.Builder actions(TestActionBuilder<?>... actions) {542 return run(super.actions(actions));543 }544 };545 return container(builder);546 }547 @Override548 public Timer.Builder timer() {549 Timer.Builder builder = new Timer.Builder() {550 @Override551 public Timer.Builder actions(TestActionBuilder<?>... actions) {552 return run(super.actions(actions));553 }554 };555 return container(builder);556 }557 @Override558 public StopTimerAction.Builder stopTimer(String timerId) {559 StopTimerAction.Builder builder = new StopTimerAction.Builder()560 .id(timerId);561 return run(builder);562 }563 @Override564 public StopTimerAction.Builder stopTimers() {565 return run(new StopTimerAction.Builder());566 }567 @Override568 public DockerExecuteActionBuilder docker(BuilderSupport<DockerExecuteActionBuilder> configurer) {569 DockerExecuteActionBuilder builder = new DockerExecuteActionBuilder();570 configurer.configure(builder);571 return run(builder);572 }573 @Override574 public KubernetesExecuteActionBuilder kubernetes(BuilderSupport<KubernetesExecuteActionBuilder> configurer) {575 KubernetesExecuteActionBuilder builder = new KubernetesExecuteActionBuilder();576 configurer.configure(builder);577 return run(builder);578 }579 @Override580 public SeleniumActionBuilder selenium(BuilderSupport<SeleniumActionBuilder> configurer) {581 SeleniumActionBuilder builder = new SeleniumActionBuilder();582 configurer.configure(builder);583 return run(builder);584 }585 @Override586 public HttpActionBuilder http(BuilderSupport<HttpActionBuilder> configurer) {587 HttpActionBuilder builder = new HttpActionBuilder();588 builder.withReferenceResolver(context.getReferenceResolver());589 configurer.configure(builder);590 return run(builder);591 }592 @Override593 public SoapActionBuilder soap(BuilderSupport<SoapActionBuilder> configurer) {594 SoapActionBuilder builder = new SoapActionBuilder();595 builder.withReferenceResolver(context.getReferenceResolver());596 configurer.configure(builder);597 return run(builder);598 }599 @Override600 public CamelRouteActionBuilder camel(BuilderSupport<CamelRouteActionBuilder> configurer) {601 CamelRouteActionBuilder builder = new CamelRouteActionBuilder();602 builder.withReferenceResolver(context.getReferenceResolver());603 configurer.configure(builder);604 return run(builder);605 }606 @Override607 public ZooExecuteActionBuilder zookeeper(BuilderSupport<ZooExecuteActionBuilder> configurer) {608 ZooExecuteActionBuilder builder = new ZooExecuteActionBuilder();609 builder.withReferenceResolver(context.getReferenceResolver());610 configurer.configure(builder);611 return run(builder);612 }613 @Override614 public Template.Builder applyTemplate(BuilderSupport<Template.Builder> configurer) {615 Template.Builder builder = new Template.Builder()616 .withReferenceResolver(context.getReferenceResolver());617 configurer.configure(builder);618 return run(builder);619 }620 @Override621 public FinallySequence.Builder doFinally() {622 FinallySequence.Builder builder = new FinallySequence.Builder() {623 @Override624 public FinallySequence.Builder actions(TestActionBuilder<?>... actions) {625 return run(super.actions(actions));626 }627 };628 return container(builder);629 }630 /**631 * Gets the test context.632 * @return633 */634 public TestContext getTestContext() {635 return context;636 }637 @Override638 public void setTestContext(TestContext context) {639 this.context = context;...

Full Screen

Full Screen

Source:WaitBuilder.java Github

copy

Full Screen

...20import com.consol.citrus.dsl.design.TestDesigner;21import com.consol.citrus.dsl.runner.TestRunner;22import java.util.Stack;23/**24 * Wait action pauses test execution until a condition is satisfied. If the condition is not satisfied after the25 * configured timeout then the test exits with an error.26 *27 * @author Martin Maher28 * @since 2.429 */30public class WaitBuilder extends AbstractTestContainerBuilder<Wait> {31 private final Stack<AbstractActionContainer> containers;32 /**33 * Constructor using designer and action field.34 * @param designer35 * @param action36 */37 public WaitBuilder(TestDesigner designer, Wait action, Stack<AbstractActionContainer> containers) {38 super(designer, action);39 this.containers = containers;40 }41 /**42 * Constructor using runner and action field.43 * @param runner44 * @param action45 */46 public WaitBuilder(TestRunner runner, Wait action) {47 super(runner, action);48 this.containers = new Stack<>();49 }50 /**51 * Condition to wait for during execution.52 * @param condition53 * @return54 */55 public Wait condition(Condition condition) {56 container.setCondition(condition);57 return this.buildAndRun();58 }59 /**60 * The HTTP condition to wait for during execution.61 * @return62 */63 public WaitHttpConditionBuilder http() {64 HttpCondition condition = new HttpCondition();65 container.setCondition(condition);66 return new WaitHttpConditionBuilder(condition, this);67 }68 /**69 * The message condition to wait for during execution.70 * @return71 */72 public WaitMessageConditionBuilder message() {73 MessageCondition condition = new MessageCondition();74 container.setCondition(condition);75 return new WaitMessageConditionBuilder(condition, this);76 }77 /**78 * The test action condition to wait for during execution.79 * @return80 */81 public WaitActionConditionBuilder execution() {82 ActionCondition condition = new ActionCondition();83 container.setCondition(condition);84 containers.push(container);85 return new WaitActionConditionBuilder(container, condition, this);86 }87 /**88 * The file condition to wait for during execution.89 * @return90 */91 public WaitFileConditionBuilder file() {92 FileCondition condition = new FileCondition();93 container.setCondition(condition);94 return new WaitFileConditionBuilder(condition, this);95 }96 /**97 * The total length of seconds to wait on the condition to be satisfied98 * @param seconds99 * @return100 */101 public WaitBuilder seconds(String seconds) {102 container.setSeconds(seconds);103 return this;104 }105 /**106 * The total length of seconds to wait on the condition to be satisfied107 * @param seconds108 * @return109 */110 public WaitBuilder seconds(Long seconds) {111 container.setSeconds(seconds.toString());112 return this;113 }114 /**115 * The total length of milliseconds to wait on the condition to be satisfied116 * @param milliseconds117 * @return118 */119 public WaitBuilder ms(String milliseconds) {120 container.setMilliseconds(milliseconds);121 return this;122 }123 /**124 * The total length of milliseconds to wait on the condition to be satisfied125 * @param milliseconds126 * @return127 */128 public WaitBuilder ms(Long milliseconds) {129 container.setMilliseconds(String.valueOf(milliseconds));130 return this;131 }132 /**133 * The total length of milliseconds to wait on the condition to be satisfied134 * @param milliseconds135 * @return136 */137 public WaitBuilder milliseconds(String milliseconds) {138 container.setMilliseconds(milliseconds);139 return this;140 }141 /**142 * The total length of milliseconds to wait on the condition to be satisfied143 * @param milliseconds144 * @return145 */146 public WaitBuilder milliseconds(Long milliseconds) {147 container.setMilliseconds(String.valueOf(milliseconds));148 return this;149 }150 /**151 * The interval in seconds to use between each test of the condition152 * @param interval153 * @return154 */155 public WaitBuilder interval(String interval) {156 container.setInterval(interval);157 return this;158 }159 /**160 * The interval in seconds to use between each test of the condition161 * @param interval162 * @return163 */164 public WaitBuilder interval(Long interval) {165 container.setInterval(String.valueOf(interval));166 return this;167 }168 /**169 * Finishes action build process.170 * @return171 */172 public Wait buildAndRun() {173 if (designer != null) {174 designer.action(this);175 } else if (runner != null) {176 runner.run(super.build());177 }178 return super.build();179 }180}...

Full Screen

Full Screen

Source:WaitActionConditionBuilder.java Github

copy

Full Screen

...21 * @author Christoph Deppisch22 * @since 2.423 */24public class WaitActionConditionBuilder extends WaitConditionBuilder<ActionCondition, WaitActionConditionBuilder> {25 /** Parent wait action builder */26 private final Wait action;27 /**28 * Default constructor using fields.29 * @param condition30 * @param builder31 */32 public WaitActionConditionBuilder(Wait action, ActionCondition condition, WaitBuilder builder) {33 super(condition, builder);34 this.action = action;35 }36 /**37 * Sets the test action to execute and wait for.38 * @param action39 * @return40 */41 public Wait action(TestAction action) {42 if (action instanceof TestActionBuilder) {43 getCondition().setAction(((TestActionBuilder) action).build());44 this.action.setAction(((TestActionBuilder) action).build());45 getBuilder().actions(((TestActionBuilder) action).build());46 } else {47 getCondition().setAction(action);48 this.action.setAction(action);49 getBuilder().actions(action);50 }51 return getBuilder().build();52 }53}...

Full Screen

Full Screen

action

Using AI Code Generation

copy

Full Screen

1package com.consol.citrus.dsl.builder;2import com.consol.citrus.actions.WaitAction;3import com.consol.citrus.context.TestContext;4import com.consol.citrus.dsl.design.TestDesigner;5import com.consol.citrus.dsl.runner.TestRunner;6import com.consol.citrus.exceptions.CitrusRuntimeException;7import com.consol.citrus.validation.context.ValidationContext;8import org.springframework.util.StringUtils;9import java.util.concurrent.TimeUnit;10public class WaitActionConditionBuilder extends AbstractWaitActionConditionBuilder<WaitActionConditionBuilder> {11 public WaitActionConditionBuilder(WaitAction action) {12 super(action);13 }14 public WaitActionConditionBuilder(TestDesigner designer) {15 super(designer);16 }17 public WaitActionConditionBuilder(TestRunner runner) {18 super(runner);19 }20 public WaitActionConditionBuilder unit(TimeUnit timeUnit) {21 action.setTimeUnit(timeUnit);22 return this;23 }24 public WaitActionConditionBuilder time(long time) {25 action.setTime(time);26 return this;27 }28 public WaitActionConditionBuilder time(String time) {29 action.setTime(time);30 return this;31 }32 public WaitActionConditionBuilder time(String time, TimeUnit timeUnit) {33 action.setTime(time);34 action.setTimeUnit(timeUnit);35 return this;36 }37 public WaitActionConditionBuilder time(long time, TimeUnit time

Full Screen

Full Screen

action

Using AI Code Generation

copy

Full Screen

1e com.consol.citrus.dsl.builder;2import com.consol.citrus.actions.AbstractTstAction;3imports.actionWaitAction;4import com.consol.citrus.context.TestContext;5public class WaitActionConditionBuilder extends AbstractConditionBuilder<WaitActionConditionBuilder> {6 private final WaitAction action;7 ubic WaitActionConditionBuilder(WaitAction action) {8 supr(action);9 }package com.consol.citrus.dsl.builder;10 ublic WaitActionConditionBuilder interval(long interval) {11 action.setInterval(interval);12 return this;13 }14 public WaitActinConditionBuilde timeUnit(Strin timeUnit) {15 actionsetTimeUnit(timeUnit);16 return thi;17 }18 public WaitActionConditionBuilder timeout(lon timeout) {19 action.setTimeout(timeout);20 return this;21 }22 public WaitActionConditionBuilder timeoutTimeUnit(String timeUnit) {23 action.setTimeoutTimeUnit(timeUnit);24 return this;25 }26 public WaitActionConditionBuilder condition(String condition) {27 action.setCondition(condition);28 eturn this;29 }30 public WaitActionConditionBuilder condition(AbstractTstAction condition) {31 action.setCondition(condition);32 return this;33 }34 public WaitActionConditionBuilder context(TestContext context) {35 action.setContext(context);36 return this;37 }38 public WaitActionConditionBuilder variable(String variable) {39 action.setVariable(variable);40 return this;

Full Screen

Full Screen

action

Using AI Code Generation

copy

Full Screen

1package com.consol.citrus.samples;2import org.springframe3import com.consol.citrus.actions.AbstractTestAction;4import com.consol.citrus.actions.WaitAction;5import com.consol.citrus.context.TestContext;6public class WaitActionConditionBuilder extends AbstractConditionBuilder<WaitActionConditionBuilder> {7 private final WaitAction action;8 public WaitActionConditionBuilder(WaitAction action) {9 super(action);10 this.action = action;11 }12 public WaitActionConditionBuilder interval(long interval) {13 action.setInterval(interval);14 return this;15 }16 public WaitActionConditionBuilder timeUnit(String timeUnit) {17 action.setTimeUnit(timeUnit);18 return this;19 }20 public WaitActionConditionBuilder timeout(long timeout) {21 action.setTimeout(timeout);22 return this;23 }24 public WaitActionConditionBuilder timeoutTimeUnit(String timeUnit) {25 action.setTimeoutTimeUnit(timeUnit);26 return this;27 }28 public WaitActionConditionBuilder condition(String condition) {29 action.setCondition(condition);30 return this;31 }32 public WaitActionConditionBuilder condition(AbstractTestAction condition) {33 action.setCondition(condition);34 return this;35 }e com.consol.citrus.dsl.runnr;36importuilder.WaitActionConditionB37imort com.consol.citrs.dsl.uider.WatAtionBuilder;38importcom.consol.itrus.dsl.buider.WitActionConditionBuilder;39import com.consol.citru.dl.builder.WaitActionBuilder;40import com.consol.citrus.dsl.runner.TestRunner;41import com.consol.citrus.dsl.runner.TestRunner;42import com.consol.citrus.dsl.runner.TestRunner;43import com.consol.citrus.dsl.runner.TestRunner;44public class 3 extends TestRunner {45public void configure() {46WaitActionConditionBuilder wait = wait();47WaitActionBuilder wait1 = wait();48WaitActionConditionBuilder wait2 = wait();49WaitActionBuilder wait3 = wait();50}51}52package com.consol.citrus.dsl.runner;53import com.consol.citrus.dsl.builder.WaitActionConditionBuilder;54import com.consol.citrus.dsl.builder.WaitActionBuilder;55import com.consol.citrus.dsl.builder.WaitActionConditionBuilder;56import com.consol.citrus.dsl.builder.WaitActionBuilder;57import com.consol.citrus.dsl.runner.TestRunner;58import com.consol.citrus.dsl.runner.TestRunner;59import com.consol.citrus.dsl.runner.TestRunner;60import com.consol.citrus.dsl.runner.TestRunner;61public class 4 extends TestRunner {62public void configure() 63WaitActionConditionBuilder wait = wait();64WaitActionBuilder wait1 = wait();65WaitActionConditionBuilder wait2 = wait();

Full Screen

Full Screen

action

Using AI Code Generation

copy

Full Screen

1/ackage com.consol.citr*s.dsl.*uider;2publclass {3 public WaitActionConditionBuilder context(TestContext context) {4 action.setContext(context);5 return this;6 }7 public WaitActionConditionBuilder variable(String variable) {8 action.setVariable(variable);9 return this;

Full Screen

Full Screen

action

Using AI Code Generation

copy

Full Screen

1package com.consol.citrus.samples;2import org.springframework.context.annotation.Bean;3import org.springframework.context.annotation.Configuration;4import org.springframework.context.annotation.Import;5import com.consol.citrus.dsl.design.TestDesigner;6import com.consol.citrus.dsl.design.TestDesignerBeforeTestSupport;7import com.consol.citrus.dsl.runner.TestRunner;8import com.consol.citrus.dsl.runner.TestRunnerBeforeTestSupport;9import com.consol.citrus.dsl.testng.TestNGCitrusTestDesigner;10import com.consol.citrus.dsl.testng.TestNGCitrusTestRunner;11import com.consol.citrus.testng.CitrusParameters;12@Import({TestNGCitrusTestDesigner.class, TestNGCitrusTestRunner.class})13public class JavaConfigSample extends TestNGCitrusTestRunner {14 public TestRunner testRunner() {15 return new TestRunnerBeforeTestSupport() {16 public void execute() {17 echo("Hello Citrus!");18 }19 };20 }21 public TestDesigner testDesigner() {22 return new TestDesignerBeforeTestSupport() {23 public void configure() {24 echo("Hello Citrus!");25 }26 };27 }28 @CitrusParameters({"name"})29 public void testMethod() {30 echo("Hello Citrus!");31 }32 public void testMethod2() {33 echo("Hello Citrus!");34 }35}36package com.consol.citrus.samples;37import org.springframework.context.annotation.Bean;38import org.springframework.context.annotation.Configuration;39import org.springframework.context.annotation.Import;40import com.consol.citrus.dsl.design.TestDesigner;41import com.consol.citrus.dsl.design.TestDesignerBeforeTestSupport;42import com.consol.citrus.dsl.runner.TestRunner;43import com.consol.citrus.dsl.runner.TestRunnerBeforeTestSupport;44import com.consol.citrus.testng.CitrusParameters;45import com.consol.citrus.testng.CitrusXmlTestNGCitrusTest;46import org.testng.annotations.Test;47@Import({CitrusXmlTestNGCitrusTest.class})48public class JavaConfigSample {49 public TestRunner testRunner() {50 return new TestRunnerBeforeTestSupport()

Full Screen

Full Screen

action

Using AI Code Generation

copy

Full Screen

1package com.consol.citrus.dsl.builder;2public class WaitActionConditionBuilder {3 public WaitActionConditionBuilder() {4 com.consol.citrus.dsl.builder.WaitActionConditionBuilder builder = new com.consol.citrus.dsl.builder.WaitActionConditionBuilder();5 builder.action(new com.consol.citrus.actions.EchoAction());6 }7}8public class WaitActionConditionBuilder {9 public WaitActionConditionBuilder() {10 com.consol.citrus.dsl.builder.WaitActionConditionBuilder builder = new com.consol.citrus.dsl.builder.WaitActionConditionBuilder();11 builder.action(new com.consol.citrus.actions.EchoAction());12 }13}

Full Screen

Full Screen

action

Using AI Code Generation

copy

Full Screen

1public class 3 extends TestNGCitrusTestDesigner {2 public void 3() {3 variable("var", "value");4 echo("Hello Citrus!");5 parallel().actions(6 sequential().actions(7 echo("Hello Citrus!"),8 echo("Hello Citrus!"),9 echo("Hello Citrus!"),10 echo("Hello Citrus!")11 sequential().actions(12 echo("Hello Citrus!"),13 echo("Hello Citrus!"),14 echo("Hello Citrus!"),15 echo("Hello Citrus!")16 sequential().actions(17 echo("Hello Citrus!"),18 echo("Hello Citrus!"),19 echo("Hello Citrus!"),20 echo("Hello Citrus!")21 sequential().actions(22 echo("Hello Citrus!"),23 echo("Hello Citrus!"),24 echo("Hello Citrus!"),25 echo("Hello Citrus!")26 );27 echo("Hello Citrus!");28 }29}30public class 4 extends TestNGCitrusTestDesigner {31 public void 4() {32 variable("var", "value");33 ncho("Hello Citaus!");34 parallel().actions(35 sequential().actions(36 echo("Hello Citrus!"),37 echo("Hello Citrus!"),38 echo("Hello Citrus!"),39 echo("Hello Citrus!")40 sequential().actions(41 echo("Hello Citrus!"),42 echo("Hello Citrus!"),43 echo("Hello Citrus!"),44 echo("Hello Citrus!")45 sequential().actions(46 echo("Hello Citrus!"),47 echo("Hello Citrus!"),48 echo("Hello Citrus!"),49 echo("Hello Citrus!")50 sequential().actions(51 echo("Hello Citrus!"),52 echo("Hello Citrus!"),53 echo("Hello Citrus!"),54 echo("Hello Citrus!")55 );56 echo("Hello Citrus!");57 }58}59public class 5 extends TestNGCitrusTestDesigner {60 public void 5() {

Full Screen

Full Screen

action

Using AI Code Generation

copy

Full Screen

1public class 3 extends CitrusTestDesigner {2 public void configure() {3 while (condition("condition"), action("action"));4 }5}6public class 4 extends CitrusTestDesigner {7 public void configure() {8 while (condition("condition"), action("action"));9 }10}11public class 5 extends CitrusTestDesigner {12 public void configure() {13 while (condition("condition"), action("action"));14 }15}16public class 6 extends CitrusTestDesigner {17 public void configure() {18 while (condition("condition"), action("action"));19 }20}21public class 7 extends CitrusTestDesigner {22 public void configure() {23 while (condition("condition"), action("action"));24 }25}26public class 8 extends CitrusTestDesigner {27 public void configure() {28 while (condition("condition"), action("action"));29 }30}

Full Screen

Full Screen

action

Using AI Code Generation

copy

Full Screen

1public class 3 extends TestNGCitrusTestDesigner {2 public void 3() {3 variable("var", "value");4 echo("Hello Citrus!");5 parallel().actions(6 sequential().actions(7 echo("Hello Citrus!"),8 echo("Hello Citrus!"),9 echo("Hello Citrus!"),10 echo("Hello Citrus!")11 sequential().actions(12 echo("Hello Citrus!"),13 echo("Hello Citrus!"),14 echo("Hello Citrus!"),15 echo("Hello Citrus!")16 sequential().actions(17 echo("Hello Citrus!"),18 echo("Hello Citrus!"),19 echo("Hello Citrus!"),20 echo("Hello Citrus!")21 sequential().actions(22 echo("Hello Citrus!"),23 echo("Hello Citrus!"),24 echo("Hello Citrus!"),25 echo("Hello Citrus!")26 );27 echo("Hello Citrus!");28 }29}30public class 4 extends TestNGCitrusTestDesigner {31 public void 4() {32 variable("var", "value");33 echo("Hello Citrus!");34 parallel().actions(35 sequential().actions(36 echo("Hello Citrus!"),37 echo("Hello Citrus!"),38 echo("Hello Citrus!"),39 echo("Hello Citrus!")40 sequential().actions(41 echo("Hello Citrus!"),42 echo("Hello Citrus!"),43 echo("Hello Citrus!"),44 echo("Hello Citrus!")45 sequential().actions(46 echo("Hello Citrus!"),47 echo("Hello Citrus!"),48 echo("Hello Citrus!"),49 echo("Hello Citrus!")50 sequential().actions(51 echo("Hello Citrus!"),52 echo("Hello Citrus!"),53 echo("Hello Citrus!"),54 echo("Hello Citrus!")55 );56 echo("Hello Citrus!");57 }58}59public class 5 extends TestNGCitrusTestDesigner {60 public void 5() {61 variable("var",

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Citrus automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Most used method in WaitActionConditionBuilder

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful