How to use list method of com.consol.citrus.dsl.builder.KubernetesActionBuilder class

Best Citrus code snippet using com.consol.citrus.dsl.builder.KubernetesActionBuilder.list

Source:DefaultTestDesigner.java Github

copy

Full Screen

1/*2 * Copyright 2006-2015 the original author or authors.3 *4 * Licensed under the Apache License, Version 2.0 (the "License");5 * you may not use this file except in compliance with the License.6 * You may obtain a copy of the License at7 *8 * http://www.apache.org/licenses/LICENSE-2.09 *10 * Unless required by applicable law or agreed to in writing, software11 * distributed under the License is distributed on an "AS IS" BASIS,12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.13 * See the License for the specific language governing permissions and14 * limitations under the License.15 */16package com.consol.citrus.dsl.design;17import com.consol.citrus.*;18import com.consol.citrus.actions.*;19import com.consol.citrus.container.*;20import com.consol.citrus.context.TestContext;21import com.consol.citrus.dsl.builder.*;22import com.consol.citrus.dsl.container.FinallySequence;23import com.consol.citrus.endpoint.Endpoint;24import com.consol.citrus.exceptions.CitrusRuntimeException;25import com.consol.citrus.message.MessageType;26import com.consol.citrus.report.TestActionListeners;27import com.consol.citrus.server.Server;28import org.springframework.context.ApplicationContext;29import org.springframework.core.io.Resource;30import org.springframework.util.CollectionUtils;31import javax.sql.DataSource;32import java.util.*;33/**34 * Default test builder offers builder pattern methods in order to configure a35 * test case with test actions, variables and properties.36 *37 * @author Christoph Deppisch38 * @since 2.339 */40public class DefaultTestDesigner implements TestDesigner {41 /** This builders test case */42 private final TestCase testCase;43 /** This runners test context */44 private TestContext context;45 /** The test variables to set before execution */46 private Map<String, Object> variables= new LinkedHashMap<>();47 /** Spring bean application context */48 private ApplicationContext applicationContext;49 /** Optional stack of containers cached for execution */50 protected Stack<AbstractActionContainer> containers = new Stack<>();51 /** Default constructor */52 public DefaultTestDesigner() {53 this(new TestCase());54 testCase.setVariableDefinitions(variables);55 testClass(this.getClass());56 name(this.getClass().getSimpleName());57 packageName(this.getClass().getPackage().getName());58 }59 /**60 * Constructor initializing test case.61 * @param testCase62 */63 protected DefaultTestDesigner(TestCase testCase) {64 this.testCase = testCase;65 }66 /**67 * Constructor using Spring bean application context.68 * @param applicationContext69 * @param context70 */71 public DefaultTestDesigner(ApplicationContext applicationContext, TestContext context) {72 this();73 this.context = context;74 try {75 if (applicationContext != null) {76 this.applicationContext = applicationContext;77 initialize();78 }79 } catch (Exception e) {80 throw new CitrusRuntimeException("Failed to setup test designer", e);81 }82 }83 protected void initialize() {84 testCase.setTestActionListeners(applicationContext.getBean(TestActionListeners.class));85 if (!applicationContext.getBeansOfType(SequenceBeforeTest.class).isEmpty()) {86 testCase.setBeforeTest(CollectionUtils.arrayToList(applicationContext.getBeansOfType(SequenceBeforeTest.class).values().toArray()));87 }88 if (!applicationContext.getBeansOfType(SequenceAfterTest.class).isEmpty()) {89 testCase.setAfterTest(CollectionUtils.arrayToList(applicationContext.getBeansOfType(SequenceAfterTest.class).values().toArray()));90 }91 }92 @Override93 public void testClass(Class<?> type) {94 getTestCase().setTestClass(type);95 }96 @Override97 public void name(String name) {98 getTestCase().setBeanName(name);99 getTestCase().setName(name);100 }101 @Override102 public void description(String description) {103 getTestCase().setDescription(description);104 }105 @Override106 public void author(String author) {107 getTestCase().getMetaInfo().setAuthor(author);108 }109 @Override110 public void packageName(String packageName) {111 getTestCase().setPackageName(packageName);112 }113 @Override114 public void status(TestCaseMetaInfo.Status status) {115 getTestCase().getMetaInfo().setStatus(status);116 }117 @Override118 public void creationDate(Date date) {119 getTestCase().getMetaInfo().setCreationDate(date);120 }121 @Override122 public void variable(String name, Object value) {123 getVariables().put(name, value);124 }125 @Override126 public void action(TestAction testAction) {127 List<TestAction> actions = null;128 if (testAction instanceof TestActionContainerBuilder) {129 actions = ((TestActionContainerBuilder) testAction).getActions();130 } else if (testAction instanceof TestActionContainer) {131 actions = ((TestActionContainer) testAction).getActions();132 }133 if (!CollectionUtils.isEmpty(actions)) {134 if (containers.lastElement().equals(testAction)) {135 containers.pop();136 } else {137 throw new CitrusRuntimeException("Invalid use of action containers - the container execution is not expected!");138 }139 if (testAction instanceof FinallySequence) {140 testCase.getFinalActions().addAll(((FinallySequence) testAction).getActions());141 return;142 }143 }144 if (testAction instanceof TestActionBuilder<?>) {145 if (!containers.isEmpty()) {146 containers.lastElement().addTestAction(((TestActionBuilder<?>) testAction).build());147 } else {148 testCase.addTestAction(((TestActionBuilder<?>) testAction).build());149 }150 } else {151 if (!containers.isEmpty()) {152 containers.lastElement().addTestAction(testAction);153 } else {154 testCase.addTestAction(testAction);155 }156 }157 }158 @Override159 public ApplyTestBehaviorAction applyBehavior(TestBehavior behavior) {160 ApplyTestBehaviorAction action = new ApplyTestBehaviorAction(this, behavior);161 behavior.setApplicationContext(getApplicationContext());162 action.execute(null);163 return action;164 }165 @Override166 public <T extends AbstractActionContainer> AbstractTestContainerBuilder<T> container(T container) {167 AbstractTestContainerBuilder<T> containerBuilder = new AbstractTestContainerBuilder<T>(this, container) {};168 containers.push(containerBuilder.build());169 return containerBuilder;170 }171 @Override172 public CreateVariablesAction createVariable(String variableName, String value) {173 CreateVariablesAction action = new CreateVariablesAction();174 action.getVariables().put(variableName, value);175 action(action);176 return action;177 }178 @Override179 public AntRunBuilder antrun(String buildFilePath) {180 AntRunAction action = new AntRunAction();181 action.setBuildFilePath(buildFilePath);182 AntRunBuilder builder = new AntRunBuilder(action);183 action(builder);184 return builder;185 }186 @Override187 public EchoAction echo(String message) {188 EchoAction action = new EchoAction();189 action.setMessage(message);190 action(action);191 return action;192 }193 @Override194 public ExecutePLSQLBuilder plsql(DataSource dataSource) {195 ExecutePLSQLAction action = new ExecutePLSQLAction();196 action.setDataSource(dataSource);197 ExecutePLSQLBuilder builder = new ExecutePLSQLBuilder(action);198 action(builder);199 return builder;200 }201 @Override202 public ExecuteSQLBuilder sql(DataSource dataSource) {203 ExecuteSQLAction action = new ExecuteSQLAction();204 action.setDataSource(dataSource);205 ExecuteSQLBuilder builder = new ExecuteSQLBuilder(action);206 action(builder);207 return builder;208 }209 @Override210 public ExecuteSQLQueryBuilder query(DataSource dataSource) {211 ExecuteSQLQueryAction action = new ExecuteSQLQueryAction();212 action.setDataSource(dataSource);213 ExecuteSQLQueryBuilder builder = new ExecuteSQLQueryBuilder(action);214 action(builder);215 return builder;216 }217 @Override218 public ReceiveTimeoutBuilder receiveTimeout(Endpoint messageEndpoint) {219 ReceiveTimeoutAction action = new ReceiveTimeoutAction();220 action.setEndpoint(messageEndpoint);221 ReceiveTimeoutBuilder builder = new ReceiveTimeoutBuilder(action);222 action(builder);223 return builder;224 }225 @Override226 public ReceiveTimeoutBuilder receiveTimeout(String messageEndpointUri) {227 ReceiveTimeoutAction action = new ReceiveTimeoutAction();228 action.setEndpointUri(messageEndpointUri);229 ReceiveTimeoutBuilder builder = new ReceiveTimeoutBuilder(action);230 action(builder);231 return builder;232 }233 @Override234 public FailAction fail(String message) {235 FailAction action = new FailAction();236 action.setMessage(message);237 action(action);238 return action;239 }240 @Override241 public InputActionBuilder input() {242 InputActionBuilder builder = new InputActionBuilder();243 action(builder);244 return builder;245 }246 @Override247 public JavaActionBuilder java(String className) {248 JavaAction action = new JavaAction();249 action.setClassName(className);250 JavaActionBuilder builder = new JavaActionBuilder(action);251 action(builder);252 return builder;253 }254 @Override255 public JavaActionBuilder java(Class<?> clazz) {256 JavaAction action = new JavaAction();257 action.setClassName(clazz.getSimpleName());258 JavaActionBuilder builder = new JavaActionBuilder(action);259 action(builder);260 return builder;261 }262 @Override263 public JavaActionBuilder java(Object instance) {264 JavaAction action = new JavaAction();265 action.setInstance(instance);266 JavaActionBuilder builder = new JavaActionBuilder(action);267 action(builder);268 return builder;269 }270 @Override271 public LoadPropertiesAction load(String filePath) {272 LoadPropertiesAction action = new LoadPropertiesAction();273 action.setFilePath(filePath);274 action(action);275 return action;276 }277 @Override278 public PurgeJmsQueuesBuilder purgeQueues() {279 PurgeJmsQueuesBuilder builder = new PurgeJmsQueuesBuilder()280 .withApplicationContext(applicationContext);281 action(builder);282 return builder;283 }284 @Override285 public PurgeChannelsBuilder purgeChannels() {286 PurgeChannelsBuilder builder = new PurgeChannelsBuilder();287 builder.channelResolver(getApplicationContext());288 action(builder);289 return builder;290 }291 @Override292 public PurgeEndpointsBuilder purgeEndpoints() {293 PurgeEndpointsBuilder builder = new PurgeEndpointsBuilder()294 .withApplicationContext(getApplicationContext());295 action(builder);296 return builder;297 }298 @Override299 public ReceiveMessageBuilder receive(Endpoint messageEndpoint) {300 ReceiveMessageAction action = new ReceiveMessageAction();301 action.setEndpoint(messageEndpoint);302 ReceiveMessageBuilder builder = new ReceiveMessageBuilder(action)303 .messageType(MessageType.XML)304 .withApplicationContext(getApplicationContext());305 action(builder);306 return builder;307 }308 @Override309 public ReceiveMessageBuilder receive(String messageEndpointUri) {310 ReceiveMessageAction action = new ReceiveMessageAction();311 action.setEndpointUri(messageEndpointUri);312 ReceiveMessageBuilder builder = new ReceiveMessageBuilder(action)313 .messageType(MessageType.XML)314 .withApplicationContext(getApplicationContext());315 action(builder);316 return builder;317 }318 @Override319 public SendMessageBuilder send(Endpoint messageEndpoint) {320 SendMessageAction action = new SendMessageAction();321 action.setEndpoint(messageEndpoint);322 SendMessageBuilder builder = new SendMessageBuilder(action)323 .withApplicationContext(getApplicationContext());324 action(builder);325 return builder;326 }327 @Override328 public SendMessageBuilder send(String messageEndpointUri) {329 SendMessageAction action = new SendMessageAction();330 action.setEndpointUri(messageEndpointUri);331 SendMessageBuilder builder = new SendMessageBuilder(action)332 .withApplicationContext(getApplicationContext());333 action(builder);334 return builder;335 }336 @Override337 public SleepAction sleep() {338 SleepAction action = new SleepAction();339 action(action);340 return action;341 }342 @Override343 public SleepAction sleep(long milliseconds) {344 SleepAction action = new SleepAction();345 action.setMilliseconds(String.valueOf(milliseconds));346 action(action);347 return action;348 }349 @Override350 public SleepAction sleep(double seconds) {351 SleepAction action = new SleepAction();352 action.setSeconds(String.valueOf(seconds));353 action(action);354 return action;355 }356 @Override357 public WaitBuilder waitFor() {358 return new WaitBuilder(this, new Wait(), containers);359 }360 @Override361 public StartServerAction start(Server... servers) {362 StartServerAction action = new StartServerAction();363 action.getServerList().addAll(Arrays.asList(servers));364 action(action);365 return action;366 }367 @Override368 public StartServerAction start(Server server) {369 StartServerAction action = new StartServerAction();370 action.setServer(server);371 action(action);372 return action;373 }374 @Override375 public StopServerAction stop(Server... servers) {376 StopServerAction action = new StopServerAction();377 action.getServerList().addAll(Arrays.asList(servers));378 action(action);379 return action;380 }381 @Override382 public StopServerAction stop(Server server) {383 StopServerAction action = new StopServerAction();384 action.setServer(server);385 action(action);386 return action;387 }388 @Override389 public StopTimeAction stopTime() {390 StopTimeAction action = new StopTimeAction();391 action(action);392 return action;393 }394 @Override395 public StopTimeAction stopTime(String id) {396 StopTimeAction action = new StopTimeAction();397 action.setId(id);398 action(action);399 return action;400 }401 @Override402 public StopTimeAction stopTime(String id, String suffix) {403 StopTimeAction action = new StopTimeAction();404 action.setId(id);405 action.setSuffix(suffix);406 action(action);407 return action;408 }409 @Override410 public TraceVariablesAction traceVariables() {411 TraceVariablesAction action = new TraceVariablesAction();412 action(action);413 return action;414 }415 @Override416 public TraceVariablesAction traceVariables(String... variables) {417 TraceVariablesAction action = new TraceVariablesAction();418 action.setVariableNames(Arrays.asList(variables));419 action(action);420 return action;421 }422 @Override423 public GroovyActionBuilder groovy(String script) {424 GroovyActionBuilder builder = new GroovyActionBuilder()425 .script(script);426 action(builder);427 return builder;428 }429 @Override430 public GroovyActionBuilder groovy(Resource scriptResource) {431 GroovyActionBuilder builder = new GroovyActionBuilder()432 .script(scriptResource);433 action(builder);434 return builder;435 }436 @Override437 public TransformActionBuilder transform() {438 TransformActionBuilder builder = new TransformActionBuilder();439 action(builder);440 return builder;441 }442 @Override443 public AssertExceptionBuilder assertException() {444 AssertExceptionBuilder builder = new AssertExceptionBuilder(this);445 containers.push(builder.build());446 return builder;447 }448 @Override449 public CatchExceptionBuilder catchException() {450 CatchExceptionBuilder builder = new CatchExceptionBuilder(this)451 .exception(CitrusRuntimeException.class.getName());452 containers.push(builder.build());453 return builder;454 }455 @Override456 public AssertSoapFaultBuilder assertSoapFault() {457 AssertSoapFaultBuilder builder = new AssertSoapFaultBuilder(this)458 .withApplicationContext(applicationContext);459 containers.push(builder.build());460 return builder;461 }462 @Override463 public ConditionalBuilder conditional() {464 ConditionalBuilder builder = new ConditionalBuilder(this);465 containers.push(builder.build());466 return builder;467 }468 @Override469 public IterateBuilder iterate() {470 IterateBuilder builder = new IterateBuilder(this);471 containers.push(builder.build());472 return builder;473 }474 @Override475 public ParallelBuilder parallel() {476 ParallelBuilder builder = new ParallelBuilder(this);477 containers.push(builder.build());478 return builder;479 }480 @Override481 public RepeatOnErrorBuilder repeatOnError() {482 RepeatOnErrorBuilder builder = new RepeatOnErrorBuilder(this);483 containers.push(builder.build());484 return builder;485 }486 @Override487 public RepeatBuilder repeat() {488 RepeatBuilder builder = new RepeatBuilder(this);489 containers.push(builder.build());490 return builder;491 }492 @Override493 public SequenceBuilder sequential() {494 SequenceBuilder builder = new SequenceBuilder(this);495 containers.push(builder.build());496 return builder;497 }498 @Override499 public AsyncBuilder async() {500 AsyncBuilder builder = new AsyncBuilder(this);501 containers.push(builder.build());502 return builder;503 }504 @Override505 public TimerBuilder timer() {506 TimerBuilder builder = new TimerBuilder(this);507 containers.push(builder.build());508 return builder;509 }510 @Override511 public StopTimerAction stopTimer(String timerId) {512 StopTimerAction action = new StopTimerAction();513 action.setTimerId(timerId);514 action(action);515 return action;516 }517 @Override518 public StopTimerAction stopTimers() {519 StopTimerAction action = new StopTimerAction();520 action(action);521 return action;522 }523 @Override524 public DockerActionBuilder docker() {525 DockerActionBuilder builder = new DockerActionBuilder();526 action(builder);527 return builder;528 }529 @Override530 public KubernetesActionBuilder kubernetes() {531 KubernetesActionBuilder builder = new KubernetesActionBuilder();532 action(builder);533 return builder;534 }535 @Override536 public SeleniumActionBuilder selenium() {537 SeleniumActionBuilder builder = new SeleniumActionBuilder();538 action(builder);539 return builder;540 }541 @Override542 public HttpActionBuilder http() {543 HttpActionBuilder builder = new HttpActionBuilder()544 .withApplicationContext(getApplicationContext());545 action(builder);546 return builder;547 }548 @Override549 public SoapActionBuilder soap() {550 SoapActionBuilder builder = new SoapActionBuilder()551 .withApplicationContext(getApplicationContext());552 action(builder);553 return builder;554 }555 @Override556 public CamelRouteActionBuilder camel() {557 CamelRouteActionBuilder builder = new CamelRouteActionBuilder()558 .withApplicationContext(getApplicationContext());559 action(builder);560 return builder;561 }562 @Override563 public ZooActionBuilder zookeeper() {564 ZooActionBuilder builder = new ZooActionBuilder()565 .withApplicationContext(getApplicationContext());566 action(builder);567 return builder;568 }569 @Override570 public TemplateBuilder applyTemplate(String name) {571 Template template = new Template();572 template.setName(name);573 TemplateBuilder builder = new TemplateBuilder(template)574 .load(getApplicationContext());575 action(builder);576 return builder;577 }578 @Override579 public FinallySequenceBuilder doFinally() {580 FinallySequenceBuilder builder = new FinallySequenceBuilder(this);581 containers.push(builder.build());582 return builder;583 }584 /**585 * Builds the test case.586 * @return587 */588 public TestCase getTestCase() {589 return testCase;590 }591 /**592 * Get the test variables.593 * @return594 */595 public Map<String, Object> getVariables() {596 return variables;597 }598 /**599 * Gets the Spring bean application context.600 * @return601 */602 public ApplicationContext getApplicationContext() {603 return applicationContext;604 }605 /**606 * Sets the application context either from ApplicationContextAware injection or from outside.607 * @param applicationContext608 */609 public void setApplicationContext(ApplicationContext applicationContext) {610 this.applicationContext = applicationContext;611 }612 /**613 * Gets the test context.614 * @return615 */616 public TestContext getTestContext() {617 return context;618 }619 /**620 * Sets the test context.621 * @param context622 */623 public void setTestContext(TestContext context) {624 this.context = context;625 }626}...

Full Screen

Full Screen

Source:DefaultTestRunner.java Github

copy

Full Screen

1/*2 * Copyright 2006-2015 the original author or authors.3 *4 * Licensed under the Apache License, Version 2.0 (the "License");5 * you may not use this file except in compliance with the License.6 * You may obtain a copy of the License at7 *8 * http://www.apache.org/licenses/LICENSE-2.09 *10 * Unless required by applicable law or agreed to in writing, software11 * distributed under the License is distributed on an "AS IS" BASIS,12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.13 * See the License for the specific language governing permissions and14 * limitations under the License.15 */16package com.consol.citrus.dsl.runner;17import com.consol.citrus.*;18import com.consol.citrus.actions.*;19import com.consol.citrus.container.*;20import com.consol.citrus.context.TestContext;21import com.consol.citrus.dsl.builder.*;22import com.consol.citrus.dsl.container.FinallySequence;23import com.consol.citrus.exceptions.CitrusRuntimeException;24import com.consol.citrus.exceptions.TestCaseFailedException;25import com.consol.citrus.message.MessageType;26import com.consol.citrus.report.TestActionListeners;27import com.consol.citrus.script.GroovyAction;28import com.consol.citrus.server.Server;29import org.slf4j.Logger;30import org.slf4j.LoggerFactory;31import org.springframework.context.ApplicationContext;32import org.springframework.util.CollectionUtils;33import java.util.*;34/**35 * Default test runner implementation. Provides Java DSL methods for test actions. Immediately executes test actions as36 * they were built. This way the test case grows with each test action and changes for instance to the test context (variables) are37 * immediately visible.38 *39 * @author Christoph Deppisch40 * @since 2.341 */42public class DefaultTestRunner implements TestRunner {43 /** Logger */44 private static Logger log = LoggerFactory.getLogger(DefaultTestRunner.class);45 /** This builders test case */46 private final TestCase testCase;47 /** This runners test context */48 private TestContext context;49 /** Spring bean application context */50 private ApplicationContext applicationContext;51 /** Optional stack of containers cached for execution */52 protected Stack<AbstractActionContainer> containers = new Stack<>();53 /** Default constructor */54 public DefaultTestRunner() {55 this(new TestCase());56 testClass(this.getClass());57 name(this.getClass().getSimpleName());58 packageName(this.getClass().getPackage().getName());59 }60 /**61 * Constructor initializing test case.62 * @param testCase63 */64 protected DefaultTestRunner(TestCase testCase) {65 this.testCase = testCase;66 }67 /**68 * Constructor using Spring bean application context.69 * @param applicationContext70 * @param context71 */72 public DefaultTestRunner(ApplicationContext applicationContext, TestContext context) {73 this();74 this.applicationContext = applicationContext;75 this.context = context;76 try {77 initialize();78 } catch (Exception e) {79 throw new CitrusRuntimeException("Failed to setup test runner", e);80 }81 }82 protected void initialize() {83 testCase.setTestRunner(true);84 testCase.setTestActionListeners(applicationContext.getBean(TestActionListeners.class));85 if (!applicationContext.getBeansOfType(SequenceBeforeTest.class).isEmpty()) {86 testCase.setBeforeTest(CollectionUtils.arrayToList(applicationContext.getBeansOfType(SequenceBeforeTest.class).values().toArray()));87 }88 if (!applicationContext.getBeansOfType(SequenceAfterTest.class).isEmpty()) {89 testCase.setAfterTest(CollectionUtils.arrayToList(applicationContext.getBeansOfType(SequenceAfterTest.class).values().toArray()));90 }91 }92 @Override93 public void testClass(Class<?> type) {94 getTestCase().setTestClass(type);95 }96 @Override97 public void name(String name) {98 testCase.setBeanName(name);99 testCase.setName(name);100 }101 @Override102 public void description(String description) {103 getTestCase().setDescription(description);104 }105 @Override106 public void author(String author) {107 getTestCase().getMetaInfo().setAuthor(author);108 }109 @Override110 public void packageName(String packageName) {111 getTestCase().setPackageName(packageName);112 }113 @Override114 public void status(TestCaseMetaInfo.Status status) {115 getTestCase().getMetaInfo().setStatus(status);116 }117 @Override118 public void creationDate(Date date) {119 getTestCase().getMetaInfo().setCreationDate(date);120 }121 @Override122 public void start() {123 testCase.start(context);124 }125 @Override126 public void stop() {127 try {128 if (!CollectionUtils.isEmpty(context.getExceptions())) {129 CitrusRuntimeException ex = context.getExceptions().remove(0);130 testCase.setTestResult(TestResult.failed(testCase.getName(), testCase.getTestClass().getName(), ex));131 throw new TestCaseFailedException(ex);132 }133 } finally {134 testCase.finish(context);135 }136 }137 @Override138 public <T> T variable(String name, T value) {139 testCase.getVariableDefinitions().put(name, value);140 if (value instanceof String) {141 String resolved = context.replaceDynamicContentInString(value.toString());142 context.setVariable(name, resolved);143 return (T) resolved;144 } else {145 context.setVariable(name, value);146 return value;147 }148 }149 @Override150 public <T extends TestAction> T run(T testAction) {151 if (testAction instanceof TestActionContainer) {152 if (containers.lastElement().equals(testAction)) {153 containers.pop();154 } else {155 throw new CitrusRuntimeException("Invalid use of action containers - the container execution is not expected!");156 }157 if (testAction instanceof FinallySequence) {158 testCase.getFinalActions().addAll(((FinallySequence) testAction).getActions());159 return testAction;160 }161 }162 if (!containers.isEmpty()) {163 containers.lastElement().addTestAction(testAction);164 } else {165 testCase.addTestAction(testAction);166 testCase.executeAction(testAction, context);167 }168 return testAction;169 }170 @Override171 public ApplyTestBehaviorAction applyBehavior(TestBehavior behavior) {172 ApplyTestBehaviorAction action = new ApplyTestBehaviorAction(this, behavior);173 behavior.setApplicationContext(applicationContext);174 action.execute(context);175 return action;176 }177 @Override178 public <T extends AbstractActionContainer> AbstractTestContainerBuilder<T> container(T container) {179 AbstractTestContainerBuilder<T> containerBuilder = new AbstractTestContainerBuilder<T>(this, container) {};180 containers.push(containerBuilder.build());181 return containerBuilder;182 }183 @Override184 public CreateVariablesAction createVariable(String variableName, String value) {185 CreateVariablesAction action = new CreateVariablesAction();186 action.getVariables().put(variableName, value);187 return run(action);188 }189 @Override190 public AntRunAction antrun(BuilderSupport<AntRunBuilder> configurer) {191 AntRunBuilder builder = new AntRunBuilder();192 configurer.configure(builder);193 return run(builder.build());194 }195 @Override196 public EchoAction echo(String message) {197 EchoAction action = new EchoAction();198 action.setMessage(message);199 return run(action);200 }201 @Override202 public ExecutePLSQLAction plsql(BuilderSupport<ExecutePLSQLBuilder> configurer) {203 ExecutePLSQLBuilder builder = new ExecutePLSQLBuilder();204 configurer.configure(builder);205 return run(builder.build());206 }207 @Override208 public ExecuteSQLAction sql(BuilderSupport<ExecuteSQLBuilder> configurer) {209 ExecuteSQLBuilder builder = new ExecuteSQLBuilder();210 configurer.configure(builder);211 return run(builder.build());212 }213 @Override214 public ExecuteSQLQueryAction query(BuilderSupport<ExecuteSQLQueryBuilder> configurer) {215 ExecuteSQLQueryBuilder builder = new ExecuteSQLQueryBuilder();216 configurer.configure(builder);217 return run(builder.build());218 }219 @Override220 public FailAction fail(String message) {221 FailAction action = new FailAction();222 action.setMessage(message);223 return run(action);224 }225 @Override226 public InputAction input(BuilderSupport<InputActionBuilder> configurer) {227 InputActionBuilder builder = new InputActionBuilder();228 configurer.configure(builder);229 return run(builder.build());230 }231 @Override232 public ReceiveTimeoutAction receiveTimeout(BuilderSupport<ReceiveTimeoutBuilder> configurer) {233 ReceiveTimeoutBuilder builder = new ReceiveTimeoutBuilder();234 configurer.configure(builder);235 return run(builder.build());236 }237 @Override238 public LoadPropertiesAction load(String filePath) {239 LoadPropertiesAction action = new LoadPropertiesAction();240 action.setFilePath(filePath);241 return run(action);242 }243 @Override244 public TestAction purgeQueues(BuilderSupport<PurgeJmsQueuesBuilder> configurer) {245 PurgeJmsQueuesBuilder builder = new PurgeJmsQueuesBuilder()246 .withApplicationContext(applicationContext);247 configurer.configure(builder);248 return run(builder.build());249 }250 @Override251 public PurgeMessageChannelAction purgeChannels(BuilderSupport<PurgeChannelsBuilder> configurer) {252 PurgeChannelsBuilder builder = new PurgeChannelsBuilder();253 builder.channelResolver(applicationContext);254 configurer.configure(builder);255 return run(builder.build());256 }257 @Override258 public PurgeEndpointAction purgeEndpoints(BuilderSupport<PurgeEndpointsBuilder> configurer) {259 PurgeEndpointsBuilder builder = new PurgeEndpointsBuilder()260 .withApplicationContext(applicationContext);261 configurer.configure(builder);262 return run(builder.build());263 }264 @Override265 public ReceiveMessageAction receive(BuilderSupport<ReceiveMessageBuilder> configurer) {266 ReceiveMessageBuilder<ReceiveMessageAction, ReceiveMessageBuilder> builder = new ReceiveMessageBuilder()267 .messageType(MessageType.XML)268 .withApplicationContext(applicationContext);269 configurer.configure(builder);270 return (ReceiveMessageAction) run(builder.build().getDelegate());271 }272 @Override273 public SendMessageAction send(BuilderSupport<SendMessageBuilder> configurer) {274 SendMessageBuilder<SendMessageAction, SendMessageBuilder> builder = new SendMessageBuilder()275 .withApplicationContext(applicationContext);276 configurer.configure(builder);277 return (SendMessageAction) run(builder.build().getDelegate());278 }279 @Override280 public SleepAction sleep() {281 return run(new SleepAction());282 }283 @Override284 public SleepAction sleep(long milliseconds) {285 SleepAction action = new SleepAction();286 action.setMilliseconds(String.valueOf(milliseconds));287 return run(action);288 }289 @Override290 @Deprecated291 public Wait waitFor(BuilderSupport<WaitBuilder> configurer) {292 WaitBuilder builder = new WaitBuilder(null, new Wait());293 configurer.configure(builder);294 containers.push(builder.build());295 return run(builder.build());296 }297 @Override298 public WaitBuilder waitFor() {299 WaitBuilder builder = new WaitBuilder(this, new Wait());300 containers.push(builder.build());301 return builder;302 }303 @Override304 public StartServerAction start(Server... servers) {305 StartServerAction action = new StartServerAction();306 action.getServerList().addAll(Arrays.asList(servers));307 return run(action);308 }309 @Override310 public StartServerAction start(Server server) {311 StartServerAction action = new StartServerAction();312 action.setServer(server);313 return run(action);314 }315 @Override316 public StopServerAction stop(Server... servers) {317 StopServerAction action = new StopServerAction();318 action.getServerList().addAll(Arrays.asList(servers));319 return run(action);320 }321 @Override322 public StopServerAction stop(Server server) {323 StopServerAction action = new StopServerAction();324 action.setServer(server);325 return run(action);326 }327 @Override328 public StopTimeAction stopTime() {329 return run(new StopTimeAction());330 }331 @Override332 public StopTimeAction stopTime(String id) {333 StopTimeAction action = new StopTimeAction();334 action.setId(id);335 return run(action);336 }337 @Override338 public StopTimeAction stopTime(String id, String suffix) {339 StopTimeAction action = new StopTimeAction();340 action.setId(id);341 action.setSuffix(suffix);342 return run(action);343 }344 @Override345 public TraceVariablesAction traceVariables() {346 return run(new TraceVariablesAction());347 }348 @Override349 public TraceVariablesAction traceVariables(String... variables) {350 TraceVariablesAction action = new TraceVariablesAction();351 action.setVariableNames(Arrays.asList(variables));352 return run(action);353 }354 @Override355 public GroovyAction groovy(BuilderSupport<GroovyActionBuilder> configurer) {356 GroovyActionBuilder builder = new GroovyActionBuilder();357 configurer.configure(builder);358 return run(builder.build());359 }360 @Override361 public TransformAction transform(BuilderSupport<TransformActionBuilder> configurer) {362 TransformActionBuilder builder = new TransformActionBuilder();363 configurer.configure(builder);364 return run(builder.build());365 }366 @Override367 public AssertExceptionBuilder assertException() {368 AssertExceptionBuilder builder = new AssertExceptionBuilder(this);369 containers.push(builder.build());370 return builder;371 }372 @Override373 public CatchExceptionBuilder catchException() {374 CatchExceptionBuilder builder = new CatchExceptionBuilder(this);375 containers.push(builder.build());376 return builder;377 }378 @Override379 public AssertSoapFaultBuilder assertSoapFault() {380 AssertSoapFaultBuilder builder = new AssertSoapFaultBuilder(this)381 .withApplicationContext(applicationContext);382 containers.push(builder.build());383 return builder;384 }385 @Override386 public ConditionalBuilder conditional() {387 ConditionalBuilder builder = new ConditionalBuilder(this);388 containers.push(builder.build());389 return builder;390 }391 @Override392 public IterateBuilder iterate() {393 IterateBuilder builder = new IterateBuilder(this);394 containers.push(builder.build());395 return builder;396 }397 @Override398 public ParallelBuilder parallel() {399 ParallelBuilder builder = new ParallelBuilder(this);400 containers.push(builder.build());401 return builder;402 }403 @Override404 public RepeatOnErrorBuilder repeatOnError() {405 RepeatOnErrorBuilder builder = new RepeatOnErrorBuilder(this);406 containers.push(builder.build());407 return builder;408 }409 @Override410 public RepeatBuilder repeat() {411 RepeatBuilder builder = new RepeatBuilder(this);412 containers.push(builder.build());413 return builder;414 }415 @Override416 public SequenceBuilder sequential() {417 SequenceBuilder builder = new SequenceBuilder(this);418 containers.push(builder.build());419 return builder;420 }421 @Override422 public AsyncBuilder async() {423 AsyncBuilder builder = new AsyncBuilder(this);424 containers.push(builder.build());425 return builder;426 }427 @Override428 public TimerBuilder timer() {429 TimerBuilder builder = new TimerBuilder(this);430 containers.push(builder.build());431 return builder;432 }433 @Override434 public StopTimerAction stopTimer(String timerId) {435 StopTimerAction action = new StopTimerAction();436 action.setTimerId(timerId);437 return run(action);438 }439 @Override440 public StopTimerAction stopTimers() {441 StopTimerAction action = new StopTimerAction();442 return run(action);443 }444 @Override445 public TestAction docker(BuilderSupport<DockerActionBuilder> configurer) {446 DockerActionBuilder builder = new DockerActionBuilder();447 configurer.configure(builder);448 return run(builder.build());449 }450 @Override451 public TestAction kubernetes(BuilderSupport<KubernetesActionBuilder> configurer) {452 KubernetesActionBuilder builder = new KubernetesActionBuilder();453 configurer.configure(builder);454 return run(builder.build());455 }456 @Override457 public TestAction selenium(BuilderSupport<SeleniumActionBuilder> configurer) {458 SeleniumActionBuilder builder = new SeleniumActionBuilder();459 configurer.configure(builder);460 return run(builder.build());461 }462 @Override463 public TestAction http(BuilderSupport<HttpActionBuilder> configurer) {464 HttpActionBuilder builder = new HttpActionBuilder()465 .withApplicationContext(applicationContext);466 configurer.configure(builder);467 return run(builder.build()).getDelegate();468 }469 @Override470 public TestAction soap(BuilderSupport<SoapActionBuilder> configurer) {471 SoapActionBuilder builder = new SoapActionBuilder()472 .withApplicationContext(applicationContext);473 configurer.configure(builder);474 return run(builder.build()).getDelegate();475 }476 @Override477 public TestAction camel(BuilderSupport<CamelRouteActionBuilder> configurer) {478 CamelRouteActionBuilder builder = new CamelRouteActionBuilder()479 .withApplicationContext(applicationContext);480 configurer.configure(builder);481 return run(builder.build()).getDelegate();482 }483 @Override484 public TestAction zookeeper(BuilderSupport<ZooActionBuilder> configurer) {485 ZooActionBuilder builder = new ZooActionBuilder()486 .withApplicationContext(applicationContext);487 configurer.configure(builder);488 return run(builder.build());489 }490 @Override491 public Template applyTemplate(BuilderSupport<TemplateBuilder> configurer) {492 TemplateBuilder builder = new TemplateBuilder();493 configurer.configure(builder);494 builder.load(applicationContext);495 configurer.configure(builder);496 return run(builder.build());497 }498 @Override499 public FinallySequenceBuilder doFinally() {500 FinallySequenceBuilder builder = new FinallySequenceBuilder(this);501 containers.push(builder.build());502 return builder;503 }504 /**505 * Gets the test context.506 * @return507 */508 public TestContext getTestContext() {509 return context;510 }511 /**512 * Sets the test context.513 * @param context514 */515 public void setTestContext(TestContext context) {516 this.context = context;517 }518 /**519 * Gets the value of the applicationContext property.520 *521 * @return the applicationContext522 */523 public ApplicationContext getApplicationContext() {524 return applicationContext;525 }526 /**527 * Sets the application context either from ApplicationContextAware injection or from outside.528 * @param applicationContext529 */530 public void setApplicationContext(ApplicationContext applicationContext) {531 this.applicationContext = applicationContext;532 }533 @Override534 public TestCase getTestCase() {535 return testCase;536 }537}...

Full Screen

Full Screen

Source:KubernetesActionBuilder.java Github

copy

Full Screen

...252 public class PodsActionBuilder {253 /**254 * List pods.255 */256 public NamespacedActionBuilder<PodList> list() {257 ListPods command = new ListPods();258 return new NamespacedActionBuilder<>(command);259 }260 /**261 * Creates new pod.262 * @param pod263 */264 public NamedActionBuilder<Pod> create(Pod pod) {265 CreatePod command = new CreatePod();266 command.setPod(pod);267 return new NamedActionBuilder<>(command);268 }269 /**270 * Create new pod from template.271 * @param template272 */273 public NamedActionBuilder<Pod> create(Resource template) {274 CreatePod command = new CreatePod();275 command.setTemplateResource(template);276 return new NamedActionBuilder<>(command);277 }278 /**279 * Create new pod from template path.280 * @param templatePath281 */282 public NamedActionBuilder<Pod> create(String templatePath) {283 CreatePod command = new CreatePod();284 command.setTemplate(templatePath);285 return new NamedActionBuilder<>(command);286 }287 /**288 * Gets pod by name.289 * @param name290 */291 public NamedActionBuilder<Pod> get(String name) {292 GetPod command = new GetPod();293 command.name(name);294 return new NamedActionBuilder<>(command);295 }296 /**297 * Deletes pod by name.298 * @param name299 */300 public NamedActionBuilder<DeleteResult> delete(String name) {301 DeletePod command = new DeletePod();302 command.name(name);303 return new NamedActionBuilder<>(command);304 }305 /**306 * Watch pods.307 */308 public NamedActionBuilder<Pod> watch() {309 return new NamedActionBuilder<>(new WatchPods());310 }311 }312 /**313 * Services action builder.314 */315 public class ServicesActionBuilder {316 /**317 * List services.318 */319 public NamespacedActionBuilder<ServiceList> list() {320 return new NamespacedActionBuilder<>(new ListServices());321 }322 /**323 * Creates new service.324 * @param pod325 */326 public NamedActionBuilder<Service> create(Service pod) {327 CreateService command = new CreateService();328 command.setService(pod);329 return new NamedActionBuilder<>(command);330 }331 /**332 * Create new service from template.333 * @param template334 */335 public NamedActionBuilder<Service> create(Resource template) {336 CreateService command = new CreateService();337 command.setTemplateResource(template);338 return new NamedActionBuilder<>(command);339 }340 /**341 * Create new service from template path.342 * @param templatePath343 */344 public NamedActionBuilder<Service> create(String templatePath) {345 CreateService command = new CreateService();346 command.setTemplate(templatePath);347 return new NamedActionBuilder<>(command);348 }349 /**350 * Gets service by name.351 * @param name352 */353 public NamedActionBuilder<Service> get(String name) {354 GetService command = new GetService();355 command.name(name);356 return new NamedActionBuilder<>(command);357 }358 /**359 * Deletes service by name.360 * @param name361 */362 public NamedActionBuilder<DeleteResult> delete(String name) {363 DeleteService command = new DeleteService();364 command.name(name);365 return new NamedActionBuilder<>(command);366 }367 /**368 * Watch services.369 */370 public NamedActionBuilder<Service> watch() {371 return new NamedActionBuilder<>(new WatchServices());372 }373 }374 /**375 * Endpoints action builder.376 */377 public class EndpointsActionBuilder {378 /**379 * List endpoints.380 */381 public NamespacedActionBuilder<EndpointsList> list() {382 return new NamespacedActionBuilder<>(new ListEndpoints());383 }384 }385 /**386 * Nodes action builder.387 */388 public class NodesActionBuilder {389 /**390 * List nodes.391 */392 public BaseActionBuilder<BaseActionBuilder, NodeList> list() {393 return new BaseActionBuilder<>(new ListNodes());394 }395 /**396 * Watch nodes.397 */398 public BaseActionBuilder<BaseActionBuilder, Node> watch() {399 return new BaseActionBuilder<>(new WatchNodes());400 }401 }402 /**403 * Namespaces action builder.404 */405 public class NamespacesActionBuilder {406 /**407 * List namespaces.408 */409 public BaseActionBuilder<BaseActionBuilder, NamespaceList> list() {410 return new BaseActionBuilder<>(new ListNamespaces());411 }412 /**413 * Watch namespaces.414 */415 public BaseActionBuilder<BaseActionBuilder, Namespace> watch() {416 return new BaseActionBuilder<>(new WatchNamespaces());417 }418 }419 /**420 * Events action builder.421 */422 public class EventsActionBuilder {423 /**424 * List endpoints.425 */426 public NamespacedActionBuilder<EventList> list() {427 return new NamespacedActionBuilder<>(new ListEvents());428 }429 }430 /**431 * ReplicationControllers action builder.432 */433 public class ReplicationControllersActionBuilder {434 /**435 * List replication controllers.436 */437 public NamespacedActionBuilder<ReplicationControllerList> list() {438 return new NamespacedActionBuilder<>(new ListReplicationControllers());439 }440 /**441 * Watch pods.442 */443 public NamespacedActionBuilder<ReplicationController> watch() {444 return new NamespacedActionBuilder<>(new WatchReplicationControllers());445 }446 }447}...

Full Screen

Full Screen

list

Using AI Code Generation

copy

Full Screen

1package com.consol.citrus.kubernetes.actions;2import com.consol.citrus.actions.AbstractTestAction;3import com.consol.citrus.context.TestContext;4import com.consol.citrus.kubernetes.client.KubernetesClient;5import com.consol.citrus.kubernetes.command.KubernetesCommand;6import com.consol.citrus.kubernetes.command.KubernetesCommandResult;7import com.consol.citrus.kubernetes.command.KubernetesCommandType;8import com.consol.citrus.kubernetes.command.builder.KubernetesCommandBuilder;9import com.consol.citrus.kubernetes.command.builder.KubernetesCommandBuilderSupport;10import java.util.Map;11public class KubernetesAction extends AbstractTestAction {12 private final KubernetesClient client;13 private final KubernetesCommandBuilderSupport commandBuilder;14 public KubernetesAction(KubernetesClient client, KubernetesCommandBuilderSupport commandBuilder) {15 this.client = client;16 this.commandBuilder = commandBuilder;17 }18 public void doExecute(TestContext context) {19 KubernetesCommand command = commandBuilder.build(context);20 KubernetesCommandResult result = client.execute(command);21 context.setVariable(command.getResultVariable(), result.getResult());22 }23 public KubernetesClient getClient() {24 return client;25 }26 public KubernetesCommandBuilderSupport getCommandBuilder() {27 return commandBuilder;28 }29 public static final class Builder {30 private KubernetesClient client;31 private KubernetesCommandBuilderSupport commandBuilder;32 public Builder client(KubernetesClient client) {33 this.client = client;34 return this;35 }36 public Builder command(KubernetesCommandBuilderSupport commandBuilder) {37 this.commandBuilder = commandBuilder;38 return this;39 }40 public KubernetesAction build() {41 return new KubernetesAction(client, commandBuilder);42 }43 }44}45package com.consol.citrus.kubernetes.actions;46import com.consol.citrus.kubernetes.client.KubernetesClient;47import com.consol.citrus.kubernetes.command.builder.KubernetesCommandBuilder;48import com.consol.citrus.kubernetes.command.builder.KubernetesCommandBuilderSupport

Full Screen

Full Screen

list

Using AI Code Generation

copy

Full Screen

1package com.consol.citrus.dsl;2import com.consol.citrus.dsl.builder.KubernetesActionBuilder;3import com.consol.citrus.dsl.runner.TestRunner;4import com.consol.citrus.kubernetes.actions.KubernetesAction;5import com.consol.citrus.kubernetes.client.KubernetesClient;6public class KubernetesActionBuilderSample {7 public static void main(String[] args) {8 TestRunner runner = new TestRunner();9 KubernetesClient kubernetesClient = new KubernetesClient();10 kubernetesClient.setNamespace("default");11 KubernetesActionBuilder kubernetesActionBuilder = runner.kubernetes(kubernetesClient);12 KubernetesAction kubernetesAction = kubernetesActionBuilder.list().build();13 kubernetesAction.execute(runner);14 }15}16package com.consol.citrus.dsl;17import com.consol.citrus.dsl.builder.KubernetesActionBuilder;18import com.consol.citrus.dsl.runner.TestRunner;19import com.consol.citrus.kubernetes.actions.KubernetesAction;20import com.consol.citrus.kubernetes.client.KubernetesClient;21public class KubernetesActionBuilderSample {22 public static void main(String[] args) {23 TestRunner runner = new TestRunner();24 KubernetesClient kubernetesClient = new KubernetesClient();25 kubernetesClient.setNamespace("default");26 KubernetesActionBuilder kubernetesActionBuilder = runner.kubernetes(kubernetesClient);27 KubernetesAction kubernetesAction = kubernetesActionBuilder.delete().build();28 kubernetesAction.execute(runner);29 }30}31package com.consol.citrus.dsl;32import com.consol.citrus.dsl.builder.KubernetesActionBuilder;33import com.consol.citrus.dsl.runner.TestRunner;34import com.consol.citrus.kubernetes.actions.KubernetesAction;35import com.consol.citrus.kubernetes.client.KubernetesClient;36public class KubernetesActionBuilderSample {37 public static void main(String[] args) {38 TestRunner runner = new TestRunner();39 KubernetesClient kubernetesClient = new KubernetesClient();

Full Screen

Full Screen

list

Using AI Code Generation

copy

Full Screen

1package com.consol.citrus.dsl.builder;2import com.consol.citrus.kubernetes.actions.KubernetesAction;3import com.consol.citrus.kubernetes.client.KubernetesClient;4import com.consol.citrus.kubernetes.command.KubernetesCommand;5import com.consol.citrus.kubernetes.command.KubernetesCommandBuilder;6import com.consol.citrus.kubernetes.command.KubernetesCommandResult;7import com.consol.citrus.kubernetes.command.KubernetesCommandResultBuilder;8import com.consol.citrus.kubernetes.command.KubernetesCommandType;9import org.springframework.util.StringUtils;10import java.util.List;11import java.util.Map;12import java.util.stream.Collectors;13import static com.consol.citrus.kubernetes.command.KubernetesCommandType.LIST;14public class KubernetesActionBuilder extends AbstractKubernetesCommandBuilder<KubernetesAction, KubernetesActionBuilder> {15 public KubernetesActionBuilder(KubernetesAction action) {16 super(action);17 }18 public KubernetesCommandType getCommandType() {19 return LIST;20 }21 public KubernetesActionBuilder commandType(KubernetesCommandType type) {22 return this;23 }24 public KubernetesActionBuilder commandType(String type) {25 return this;26 }27 public KubernetesActionBuilder parameters(Map<String, Object> parameters) {28 return this;29 }30 public KubernetesActionBuilder parameters(String parameters) {31 return this;32 }33 public KubernetesActionBuilder parameters(Object parameters) {34 return this;35 }

Full Screen

Full Screen

list

Using AI Code Generation

copy

Full Screen

1package com.consol.citrus.dsl.design;2import com.consol.citrus.dsl.builder.KubernetesActionBuilder;3import com.consol.citrus.dsl.runner.TestRunner;4import com.consol.citrus.kubernetes.client.KubernetesClient;5import com.consol.citrus.kubernetes.command.KubernetesCommand;6import com.consol.citrus.kubernetes.command.KubernetesCommandType;7import com.consol.citrus.kubernetes.command.KubernetesCommands;8import com.consol.citrus.kubernetes.command.ResultType;9import com.consol.citrus.kubernetes.message.KubernetesMessageHeaders;10import com.consol.citrus.kubernetes.settings.KubernetesSettings;11import com.consol.citrus.message.MessageType;12import com.consol.citrus.testng.AbstractTestNGUnitTest;13import org.mockito.Mockito;14import org.springframework.core.io.ClassPathResource;15import org.springframework.http.HttpMethod;16import org.springframework.http.HttpStatus;17import org.springframework.http.MediaType;18import org.springframework.util.FileCopyUtils;19import org.springframework.web.client.HttpClientErrorException;20import org.springframework.web.client.RestTemplate;21import org.testng.Assert;22import org.testng.annotations.BeforeClass;23import org.testng.annotations.Test;24import java.io.IOException;25import java.nio.charset.Charset;26import java.util.Collections;27import static com.consol.citrus.kubernetes.command.KubernetesCommandType.LIST;28public class KubernetesActionBuilderListTest extends AbstractTestNGUnitTest {29 private RestTemplate restTemplate = Mockito.mock(RestTemplate.class);30 private KubernetesClient kubernetesClient = new KubernetesClient();31 public void setup() throws IOException {32 kubernetesClient.setRestTemplate(restTemplate);33 kubernetesClient.setKubernetesSettings(new KubernetesSettings());34 kubernetesClient.getKubernetesSettings().setNamespace("default");35 kubernetesClient.getKubernetesSettings().setPodName("test-pod");36 kubernetesClient.getKubernetesSettings().setContainerName("test-container");37 kubernetesClient.getKubernetesSettings().setWatchTimeout(5000L);38 Mockito.when(restTemplate.exchange(Mockito.anyString(), Mockito.eq(HttpMethod.GET), Mockito.any(), Mockito.eq(String.class)))39 .thenReturn(new org.springframework.http.ResponseEntity<>(FileCopyUtils.copyToString(new ClassPathResource("list.json", KubernetesActionBuilderListTest.class).getInputStream(), Charset.defaultCharset()), HttpStatus.OK));40 Mockito.when(restTemplate.exchange(Mockito

Full Screen

Full Screen

list

Using AI Code Generation

copy

Full Screen

1package com.consol.citrus.dsl.builder;2import com.consol.citrus.TestAction;3import com.consol.citrus.dsl.builder.KubernetesActionBuilder;4import com.consol.citrus.dsl.builder.KubernetesActionBuilder.List;5import com.consol.citrus.dsl.builder.KubernetesActionBuilder.List.ListBuilder;6import com.consol.citrus.dsl.builder.KubernetesActionBuilder.List.ListBuilderImpl;7import com.consol.citrus.kubernetes.actions.KubernetesExecuteAction;8import com.consol.citrus.kubernetes.command.KubernetesCommand;9import com.consol.citrus.kubernetes.command.KubernetesCommandBuilder;10import com.consol.citrus.kubernetes.command.KubernetesCommandBuilder.ListCommandBuilder;11import com.consol.citrus.kubernetes.command.KubernetesCommandBuilder.ListCommandBuilderImpl;12import com.consol.citrus.kubernetes.command.KubernetesCommandBuilderImpl;13import com.consol.citrus.kubernetes.command.KubernetesCommandType;14import com.consol.citrus.kubernetes.command.list.ListOptions;15import com.consol.citrus.kubernetes.command.list.ListOptionsBuilder;16import com.consol.citrus.kubernetes.command.list.ListOptionsBuilderImpl;17import com.consol.citrus.kubernetes.command.list.ListResource;18import com.consol.citrus.kubernetes.command.list.ListResourceBuilder;19import com.consol.citrus.kubernetes.command.list.ListResourceBuilderImpl;20import com.consol.citrus.kubernetes.settings.KubernetesSettings;21import com.consol.citrus.kubernetes.settings.KubernetesSettingsBuilder;22import com.consol.citrus.kubernetes.settings.KubernetesSettingsBuilderImpl;23import com.consol.citrus.kubernetes.settings.KubernetesVariables;24import com.consol.citrus.util.FileUtils;25import com.consol.citrus.validation.builder.AbstractMessageContentBuilder;26import com.consol.citrus.validation.builder.StaticMessageContentBuilder;27import com.consol.citrus.validation.json.JsonMessageValidationContext;28import com.consol.citrus.validation.xml.XmlMessageValidationContext;29import org.springframework.core.io.Resource;30import org.springframework.util.CollectionUtils;31import org.springframework.util.StringUtils;32import java.util.ArrayList;33import java.util.Arrays;34import java.util.HashMap;35import java.util.List;36import java.util.Map;37import java.util.stream.Collectors;38import static com.consol.citrus.kubernetes.command.KubernetesCommandType.EXEC;39import static com.consol.citrus.kubernetes.command.KubernetesCommandType.HELP

Full Screen

Full Screen

list

Using AI Code Generation

copy

Full Screen

1package com.consol.citrus.dsl.builder;2import java.util.List;3import org.springframework.util.StringUtils;4import org.springframework.web.util.UriComponentsBuilder;5import com.consol.citrus.dsl.builder.AbstractClientBuilder;6import com.consol.citrus.dsl.builder.DelegatingTestActionBuilder;7import com.consol.citrus.dsl.builder.HttpActionBuilder;8import com.consol.citrus.dsl.builder.HttpClientBuilder;9import com.consol.citrus.dsl.builder.HttpRequestActionBuilder;10import com.consol.citrus.dsl.builder.HttpResponseActionBuilder;11import com.consol.citrus.dsl.builder.KubernetesActionBuilder;12import com.consol.citrus.dsl.builder.KubernetesClientBuilder;13import com.consol.citrus.dsl.builder.KubernetesExecuteActionBuilder;14import com.consol.citrus.dsl.builder.KubernetesRequestActionBuilder;15import com.consol.citrus.dsl.builder.KubernetesResponseActionBuilder;16import com.consol.citrus.dsl.builder.KubernetesServerActionBuilder;17import com.consol.citrus.dsl.builder.KubernetesServerBuilder;18import com.consol.citrus.dsl.builder.KubernetesServerRequestActionBuilder;19import com.consol.citrus.dsl.builder.KubernetesServerResponseActionBuilder;20import com.consol.citrus.dsl.builder.SendMessageActionBuilder;21import com.consol.citrus.dsl.builder.SendSoapMessageActionBuilder;22import com.consol.citrus.dsl.builder.SendSoapMessageBuilder;23import com.consol.citrus.dsl.builder.SoapClientBuilder;24import com.consol.citrus.dsl.builder.SoapMessageBuilder;25import com.consol.citrus.dsl.builder.WebServiceClientBuilder;26import com.consol.citrus.dsl.builder.WebServiceServerBuilder;27import com.consol.citrus.dsl.builder.WebServiceServerRequestActionBuilder;28import com.consol.citrus.dsl.builder.WebServiceServerResponseActionBuilder;29import com.consol.citrus.http.client.HttpClient;30import com.consol.citrus.http.message.HttpMessage;31import com.consol.citrus.kubernetes.client.KubernetesClient;32import com.consol.citrus.kubernetes.message.KubernetesMessage;33import com.consol.citrus.message.Message;34import com.consol.citrus.message.MessageType;35import com.consol.citrus.server.WebServiceServer;36import com.consol.citrus.ws.client.WebServiceClient;37import com.consol.citrus.ws.message.SoapMessage;38import com.consol.citrus.ws.server.Web

Full Screen

Full Screen

list

Using AI Code Generation

copy

Full Screen

1package com.consol.citrus.dsl;2import com.consol.citrus.dsl.runner.TestRunner;3import com.consol.citrus.dsl.builder.KubernetesActionBuilder;4import com.consol.citrus.dsl.builder.KubernetesActionBuilder.ListPods;5import com.consol.citrus.dsl.builder.KubernetesActionBuilder.ListPodsResult;6import com.consol.citrus.dsl.builder.KubernetesActionBuilder.ListServices;7import com.consol.citrus.dsl.builder.KubernetesActionBuilder.ListServicesResult;8import com.consol.citrus.dsl.builder.KubernetesActionBuilder.ListDeployments;9import com.consol.citrus.dsl.builder.KubernetesActionBuilder.ListDeploymentsResult;10import com.consol.citrus.dsl.builder.KubernetesActionBuilder.ListReplicaSets;11import com.consol.citrus.dsl.builder.KubernetesActionBuilder.ListReplicaSetsResult;12import com.consol.citrus.dsl.builder.KubernetesActionBuilder.ListReplicationControllers;13import com.consol.citrus.dsl.builder.KubernetesActionBuilder.ListReplicationControllersResult;14import com.consol.citrus.dsl.builder.KubernetesActionBuilder.ListNodes;15import com.consol.citrus.dsl.builder.KubernetesActionBuilder.ListNodesResult;16import com.consol.citrus.dsl.builder.KubernetesActionBuilder.ListNamespaces;17import com.consol.citrus.dsl.builder.KubernetesActionBuilder.ListNamespacesResult;18import com.consol.citrus.dsl.builder.KubernetesActionBuilder.ListPersistentVolumes;19import com.consol.citrus.dsl.builder.KubernetesActionBuilder.ListPersistentVolumesResult;20import com.consol.citrus.dsl.builder.KubernetesActionBuilder.ListPersistentVolumeClaims;21import com.consol.citrus.dsl.builder.KubernetesActionBuilder.ListPersistentVolumeClaimsResult;22import com.consol.citrus.dsl.builder.KubernetesActionBuilder.ListEvents;23import com.consol.citrus.dsl.builder.KubernetesActionBuilder.ListEventsResult;24public class ListTest extends AbstractTestContainerTest {25 public void execute(TestRunner runner) {26 runner.kubernetes(action -> action.client("k8sClient").listPods());27 runner.kubernetes(action -> action.client("k8sClient").listPods().result("list-pods-result"));

Full Screen

Full Screen

list

Using AI Code Generation

copy

Full Screen

1package com.consol.citrus.dsl.builder;2import com.consol.citrus.dsl.runner.TestRunner;3import com.consol.citrus.kubernetes.actions.KubernetesActionBuilder;4import com.consol.citrus.kubernetes.client.KubernetesClient;5import com.consol.citrus.kubernetes.command.KubernetesCommand;6import com.consol.citrus.kubernetes.command.KubernetesCommandBuilder;7import com.consol.citrus.kubernetes.command.KubernetesCommands;8import com.consol.citrus.kubernetes.message.KubernetesMessageHeaders;9import com.consol.citrus.kubernetes.settings.KubernetesSettings;10import com.consol.citrus.kubernetes.settings.KubernetesSettingsBuilder;11import com.consol.citrus.message.MessageType;12import com.consol.citrus.testng.AbstractTestNGUnitTest;13import org.mockito.Mockito;14import org.springframework.core.io.ClassPathResource;15import org.springframework.core.io.Resource;16import org.testng.annotations.Test;17import static org.mockito.Mockito.*;18public class KubernetesActionBuilderTest extends AbstractTestNGUnitTest {19 private KubernetesClient kubernetesClient = Mockito.mock(KubernetesClient.class);20 public void testKubernetesListBuilder() {21 reset(kubernetesClient);22 when(kubernetesClient.executeCommand(any(KubernetesCommand.class))).thenReturn("success");23 Resource resource = new ClassPathResource("kubernetes/list.json");24 when(kubernetesClient.readResource(resource)).thenReturn("success");25 when(kubernetesClient.getEndpointConfiguration()).thenReturn(new KubernetesSettings());26 MockTestRunner builder = new MockTestRunner(getClass().getSimpleName(), applicationContext, context) {27 public void execute() {28 list(kubernetesClient)29 .namespace("my-namespace")30 .resource("pods")31 .headers(KubernetesMessageHeaders.KUBERNETES_API_VERSION, "v1")32 .headers(KubernetesMessageHeaders.KUBERNETES_KIND, "PodList")33 .headers(KubernetesMessageHeaders.KUBERNETES_RESOURCE_VERSION, "1")34 .headers(KubernetesMessageHeaders.KUBERNETES_SELF_LINK, "/api/v1/namespaces/my-namespace/pods")35 .headers(KubernetesMessageHeaders.KUBERNETES_METADATA_NAME, "my-pod")36 .headers(KubernetesMessageHeaders.KUBERNETES_METADATA_NAMESPACE, "my-namespace")37 .headers(KubernetesMessageHeaders.KUBERNETES_METADATA_SELF_LINK

Full Screen

Full Screen

list

Using AI Code Generation

copy

Full Screen

1package com.consol.citrus.dsl.builder;2import com.consol.citrus.dsl.runner.TestRunner;3import com.consol.citrus.kubernetes.actions.KubernetesActionBuilder;4import com.consol.citrus.kubernetes.client.KubernetesClient;5import com.consol.citrus.kubernetes.command.KubernetesCommand;6import com.consol.citrus.kubernetes.command.KubernetesCommandBuilder;7import com.consol.citrus.kubernetes.command.KubernetesCommandResult;8import com.consol.citrus.kubernetes.command.KubernetesCommandResultBuilder;9import com.consol.citrus.kubernetes.command.KubernetesCommands;10import com.consol.citrus.kubernetes.command.types.ServiceList;11import com.consol.citrus.kubernetes.command.types.ServiceListBuilder;12import com.consol.citrus.kubernetes.command.types.ServiceListBuilder.ServiceListBuilderImpl;13import com.consol.citrus.kubernetes.command.types.ServiceListBuilder.ServiceListBuilderStep1;14import com.consol.citrus.kubernetes.command.types.ServiceListBuilder.ServiceListBuilderStep2;15import com.consol.citrus.kubernetes.command.types.ServiceListBuilder.ServiceListBuilderStep3;16import com.consol.citrus.kubernetes.command.types.ServiceListBuilder.ServiceListBuilderStep4;17import com.consol.citrus.kubernetes.command.types.ServiceListBuilder.ServiceListBuilderStep5;18import com.consol.citrus.kubernetes.command.types.ServiceListBuilder.ServiceListBuilderStep6;19import com.consol.citrus.kubernetes.command.types.ServiceListBuilder.ServiceListBuilderStep7;20import com.consol.citrus.kubernetes.command.types.ServiceListBuilder.ServiceListBuilderStep8;21import com.consol.citrus.kubernetes.command.types.ServiceListBuilder.ServiceListBuilderStep9;22import com.consol.citrus.kubernetes.command.types.ServiceListBuilder.ServiceListBuilderStep10;23import com.consol.citrus.kubernetes.command.types.ServiceListBuilder.ServiceListBuilderStep11;24import com.consol.citrus.kubernetes.command.types.ServiceListBuilder.ServiceListBuilderStep12;25import com.consol.citrus.kubernetes.command.types.ServiceListBuilder.ServiceListBuilderStep13;26import com.consol.citrus.kubernetes.command.types.ServiceListBuilder.ServiceListBuilderStep14;27import com.consol.citrus.kubernetes.command.types.ServiceListBuilder.ServiceListBuilderStep15;28import com.consol.citrus.kubernetes.command.types.ServiceListBuilder.ServiceListBuilder

Full Screen

Full Screen

list

Using AI Code Generation

copy

Full Screen

1public class 3 extends TestActionBuilder.AbstractTestActionBuilder<KubernetesActionBuilder> {2 public void build() {3 }4}5public class 4 extends TestActionBuilder.AbstractTestActionBuilder<KubernetesActionBuilder> {6 public void build() {7 }8}9public class 5 extends TestActionBuilder.AbstractTestActionBuilder<KubernetesActionBuilder> {10 public void build() {11 }12}13public class 6 extends TestActionBuilder.AbstractTestActionBuilder<KubernetesActionBuilder> {14 public void build() {15 }16}17public class 7 extends TestActionBuilder.AbstractTestActionBuilder<KubernetesActionBuilder> {18 public void build() {19 }20}21public class 8 extends TestActionBuilder.AbstractTestActionBuilder<KubernetesActionBuilder> {22 public void build() {23 }24}25public class 9 extends TestActionBuilder.AbstractTestActionBuilder<KubernetesActionBuilder> {26 public void build() {27 }28}29public class 10 extends TestActionBuilder.AbstractTestActionBuilder<KubernetesActionBuilder> {30 public void build() {

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.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful