How to use getName method of com.consol.citrus.dsl.actions.DelegatingTestAction class

Best Citrus code snippet using com.consol.citrus.dsl.actions.DelegatingTestAction.getName

Source:SendSoapFaultTestRunnerTest.java Github

copy

Full Screen

...77 TestCase test = builder.getTestCase();78 Assert.assertEquals(test.getActionCount(), 1);79 Assert.assertEquals(test.getActions().get(0).getClass(), DelegatingTestAction.class);80 SendSoapFaultAction action = (SendSoapFaultAction)((DelegatingTestAction)test.getActions().get(0)).getDelegate();81 Assert.assertEquals(action.getName(), "send");82 Assert.assertEquals(action.getEndpoint(), soapServer);83 Assert.assertEquals(action.getMessageBuilder().getClass(), StaticMessageContentBuilder.class);84 StaticMessageContentBuilder messageBuilder = (StaticMessageContentBuilder) action.getMessageBuilder();85 Assert.assertEquals(messageBuilder.getMessage().getPayload(), "");86 Assert.assertEquals(messageBuilder.getMessageHeaders().size(), 0L);87 Assert.assertEquals(action.getFaultActor(), "faultActor");88 Assert.assertEquals(action.getFaultCode(), FAULT_CODE);89 Assert.assertEquals(action.getFaultString(), FAULT_STRING);90 }91 @Test92 public void testSendSoapFaultByEndpointName() {93 TestContext context = applicationContext.getBean(TestContext.class);94 context.setApplicationContext(applicationContextMock);95 reset(applicationContextMock, soapServer, messageProducer);96 when(soapServer.createProducer()).thenReturn(messageProducer);97 when(soapServer.getActor()).thenReturn(null);98 doAnswer(invocation -> {99 SoapFault message = (SoapFault) invocation.getArguments()[0];100 Assert.assertEquals(message.getFaultCode(), FAULT_CODE);101 Assert.assertEquals(message.getFaultString(), FAULT_STRING);102 return null;103 }).when(messageProducer).send(any(Message.class), any(TestContext.class));104 when(applicationContextMock.getBean(TestContext.class)).thenReturn(context);105 when(applicationContextMock.getBean("soapServer", Endpoint.class)).thenReturn(soapServer);106 when(applicationContextMock.getBean(TestActionListeners.class)).thenReturn(new TestActionListeners());107 when(applicationContextMock.getBeansOfType(SequenceBeforeTest.class)).thenReturn(new HashMap<String, SequenceBeforeTest>());108 when(applicationContextMock.getBeansOfType(SequenceAfterTest.class)).thenReturn(new HashMap<String, SequenceAfterTest>());109 MockTestRunner builder = new MockTestRunner(getClass().getSimpleName(), applicationContextMock, context) {110 @Override111 public void execute() {112 soap(builder -> builder.server("soapServer")113 .sendFault()114 .faultCode(FAULT_CODE)115 .faultString(FAULT_STRING));116 }117 };118 TestCase test = builder.getTestCase();119 Assert.assertEquals(test.getActionCount(), 1);120 Assert.assertEquals(test.getActions().get(0).getClass(), DelegatingTestAction.class);121 SendSoapFaultAction action = (SendSoapFaultAction)((DelegatingTestAction)test.getActions().get(0)).getDelegate();122 Assert.assertEquals(action.getName(), "send");123 Assert.assertEquals(action.getEndpoint(), soapServer);124 Assert.assertEquals(action.getMessageBuilder().getClass(), StaticMessageContentBuilder.class);125 StaticMessageContentBuilder messageBuilder = (StaticMessageContentBuilder) action.getMessageBuilder();126 Assert.assertEquals(messageBuilder.getMessage().getPayload(), "");127 Assert.assertEquals(messageBuilder.getMessageHeaders().size(), 0L);128 Assert.assertNull(action.getFaultActor());129 Assert.assertEquals(action.getFaultCode(), FAULT_CODE);130 Assert.assertEquals(action.getFaultString(), FAULT_STRING);131 }132 @Test133 public void testSendSoapFaultWithDetailResource() throws IOException {134 reset(resource, soapServer, messageProducer);135 when(soapServer.createProducer()).thenReturn(messageProducer);136 when(soapServer.getActor()).thenReturn(null);137 doAnswer(invocation -> {138 SoapFault message = (SoapFault) invocation.getArguments()[0];139 Assert.assertEquals(message.getFaultCode(), FAULT_CODE);140 Assert.assertEquals(message.getFaultString(), FAULT_STRING);141 Assert.assertEquals(message.getFaultDetails().size(), 1L);142 Assert.assertEquals(message.getFaultDetails().get(0), ERROR_DETAIL);143 return null;144 }).when(messageProducer).send(any(Message.class), any(TestContext.class));145 when(resource.getInputStream()).thenReturn(new ByteArrayInputStream(ERROR_DETAIL.getBytes()));146 MockTestRunner builder = new MockTestRunner(getClass().getSimpleName(), applicationContext, context) {147 @Override148 public void execute() {149 soap(builder -> builder.server(soapServer)150 .sendFault()151 .faultCode(FAULT_CODE)152 .faultDetailResource(resource)153 .faultString(FAULT_STRING));154 }155 };156 TestCase test = builder.getTestCase();157 Assert.assertEquals(test.getActionCount(), 1);158 Assert.assertEquals(test.getActions().get(0).getClass(), DelegatingTestAction.class);159 SendSoapFaultAction action = (SendSoapFaultAction)((DelegatingTestAction)test.getActions().get(0)).getDelegate();160 Assert.assertEquals(action.getName(), "send");161 Assert.assertEquals(action.getEndpoint(), soapServer);162 Assert.assertEquals(action.getMessageBuilder().getClass(), StaticMessageContentBuilder.class);163 StaticMessageContentBuilder messageBuilder = (StaticMessageContentBuilder) action.getMessageBuilder();164 Assert.assertEquals(messageBuilder.getMessage().getPayload(), "");165 Assert.assertEquals(messageBuilder.getMessageHeaders().size(), 0L);166 Assert.assertEquals(action.getFaultDetails().size(), 1L);167 Assert.assertEquals(action.getFaultDetails().get(0), ERROR_DETAIL);168 Assert.assertEquals(action.getFaultCode(), FAULT_CODE);169 Assert.assertEquals(action.getFaultString(), FAULT_STRING);170 }171 @Test172 public void testSendSoapFaultWithDetail() {173 reset(soapServer, messageProducer);174 when(soapServer.createProducer()).thenReturn(messageProducer);175 when(soapServer.getActor()).thenReturn(null);176 doAnswer(invocation -> {177 SoapFault message = (SoapFault) invocation.getArguments()[0];178 Assert.assertEquals(message.getFaultCode(), FAULT_CODE);179 Assert.assertEquals(message.getFaultString(), FAULT_STRING);180 Assert.assertEquals(message.getFaultDetails().size(), 1L);181 Assert.assertEquals(message.getFaultDetails().get(0), "DETAIL");182 return null;183 }).when(messageProducer).send(any(Message.class), any(TestContext.class));184 MockTestRunner builder = new MockTestRunner(getClass().getSimpleName(), applicationContext, context) {185 @Override186 public void execute() {187 soap(builder -> builder.server(soapServer)188 .sendFault()189 .faultCode(FAULT_CODE)190 .faultDetail("DETAIL")191 .faultString(FAULT_STRING));192 }193 };194 TestCase test = builder.getTestCase();195 Assert.assertEquals(test.getActionCount(), 1);196 Assert.assertEquals(test.getActions().get(0).getClass(), DelegatingTestAction.class);197 SendSoapFaultAction action = (SendSoapFaultAction)((DelegatingTestAction)test.getActions().get(0)).getDelegate();198 Assert.assertEquals(action.getName(), "send");199 Assert.assertEquals(action.getEndpoint(), soapServer);200 Assert.assertEquals(action.getMessageBuilder().getClass(), StaticMessageContentBuilder.class);201 StaticMessageContentBuilder messageBuilder = (StaticMessageContentBuilder) action.getMessageBuilder();202 Assert.assertEquals(messageBuilder.getMessage().getPayload(), "");203 Assert.assertEquals(messageBuilder.getMessageHeaders().size(), 0L);204 Assert.assertEquals(action.getFaultDetails().size(), 1L);205 Assert.assertEquals(action.getFaultDetails().get(0), "DETAIL");206 Assert.assertEquals(action.getFaultCode(), FAULT_CODE);207 Assert.assertEquals(action.getFaultString(), FAULT_STRING);208 }209 @Test210 public void testSendSoapFaultWithDetailResourcePath() {211 reset(soapServer, messageProducer);212 when(soapServer.createProducer()).thenReturn(messageProducer);213 when(soapServer.getActor()).thenReturn(null);214 doAnswer(invocation -> {215 SoapFault message = (SoapFault) invocation.getArguments()[0];216 Assert.assertEquals(message.getFaultCode(), FAULT_CODE);217 Assert.assertEquals(message.getFaultString(), FAULT_STRING);218 Assert.assertEquals(message.getFaultDetails().size(), 1L);219 Assert.assertEquals(message.getFaultDetails().get(0), ERROR_DETAIL);220 return null;221 }).when(messageProducer).send(any(Message.class), any(TestContext.class));222 MockTestRunner builder = new MockTestRunner(getClass().getSimpleName(), applicationContext, context) {223 @Override224 public void execute() {225 soap(builder -> builder.server(soapServer)226 .sendFault()227 .faultCode(FAULT_CODE)228 .faultDetailResource("classpath:com/consol/citrus/dsl/runner/soap-fault-detail.xml")229 .faultString(FAULT_STRING));230 }231 };232 TestCase test = builder.getTestCase();233 Assert.assertEquals(test.getActionCount(), 1);234 Assert.assertEquals(test.getActions().get(0).getClass(), DelegatingTestAction.class);235 SendSoapFaultAction action = (SendSoapFaultAction)((DelegatingTestAction)test.getActions().get(0)).getDelegate();236 Assert.assertEquals(action.getName(), "send");237 Assert.assertEquals(action.getEndpoint(), soapServer);238 Assert.assertEquals(action.getMessageBuilder().getClass(), StaticMessageContentBuilder.class);239 StaticMessageContentBuilder messageBuilder = (StaticMessageContentBuilder) action.getMessageBuilder();240 Assert.assertEquals(messageBuilder.getMessage().getPayload(), "");241 Assert.assertEquals(messageBuilder.getMessageHeaders().size(), 0L);242 Assert.assertEquals(action.getFaultDetails().size(), 0L);243 Assert.assertEquals(action.getFaultDetailResourcePaths().size(), 1L);244 Assert.assertEquals(action.getFaultDetailResourcePaths().get(0), "classpath:com/consol/citrus/dsl/runner/soap-fault-detail.xml");245 Assert.assertEquals(action.getFaultCode(), FAULT_CODE);246 Assert.assertEquals(action.getFaultString(), FAULT_STRING);247 }248 @Test249 public void testSendSoapFaultWithMultipleDetail() {250 reset(soapServer, messageProducer);251 when(soapServer.createProducer()).thenReturn(messageProducer);252 when(soapServer.getActor()).thenReturn(null);253 doAnswer(invocation -> {254 SoapFault message = (SoapFault) invocation.getArguments()[0];255 Assert.assertEquals(message.getFaultCode(), FAULT_CODE);256 Assert.assertEquals(message.getFaultString(), FAULT_STRING);257 Assert.assertEquals(message.getFaultDetails().size(), 2L);258 Assert.assertEquals(message.getFaultDetails().get(0), "DETAIL1");259 Assert.assertEquals(message.getFaultDetails().get(1), "DETAIL2");260 return null;261 }).when(messageProducer).send(any(Message.class), any(TestContext.class));262 MockTestRunner builder = new MockTestRunner(getClass().getSimpleName(), applicationContext, context) {263 @Override264 public void execute() {265 soap(builder -> builder.server(soapServer)266 .sendFault()267 .faultCode(FAULT_CODE)268 .faultDetail("DETAIL1")269 .faultDetail("DETAIL2")270 .faultString(FAULT_STRING));271 }272 };273 TestCase test = builder.getTestCase();274 Assert.assertEquals(test.getActionCount(), 1);275 Assert.assertEquals(test.getActions().get(0).getClass(), DelegatingTestAction.class);276 SendSoapFaultAction action = (SendSoapFaultAction)((DelegatingTestAction)test.getActions().get(0)).getDelegate();277 Assert.assertEquals(action.getName(), "send");278 Assert.assertEquals(action.getEndpoint(), soapServer);279 Assert.assertEquals(action.getMessageBuilder().getClass(), StaticMessageContentBuilder.class);280 StaticMessageContentBuilder messageBuilder = (StaticMessageContentBuilder) action.getMessageBuilder();281 Assert.assertEquals(messageBuilder.getMessage().getPayload(), "");282 Assert.assertEquals(messageBuilder.getMessageHeaders().size(), 0L);283 Assert.assertEquals(action.getFaultDetails().size(), 2L);284 Assert.assertEquals(action.getFaultDetails().get(0), "DETAIL1");285 Assert.assertEquals(action.getFaultDetails().get(1), "DETAIL2");286 Assert.assertEquals(action.getFaultCode(), FAULT_CODE);287 Assert.assertEquals(action.getFaultString(), FAULT_STRING);288 }289}...

Full Screen

Full Screen

Source:SeleniumStepsTest.java Github

copy

Full Screen

...59 }60 @Test61 public void testStart() {62 SeleniumBrowserConfiguration endpointConfiguration = new SeleniumBrowserConfiguration();63 when(seleniumBrowser.getName()).thenReturn("seleniumBrowser");64 when(seleniumBrowser.getWebDriver()).thenReturn(webDriver);65 when(seleniumBrowser.getEndpointConfiguration()).thenReturn(endpointConfiguration);66 steps.setBrowser("seleniumBrowser");67 steps.start();68 Assert.assertEquals(runner.getTestCase().getActionCount(), 1L);69 Assert.assertTrue(((DelegatingTestAction) runner.getTestCase().getTestAction(0)).getDelegate() instanceof SeleniumAction);70 SeleniumAction action = (SeleniumAction) ((DelegatingTestAction) runner.getTestCase().getTestAction(0)).getDelegate();71 Assert.assertEquals(action.getBrowser(), seleniumBrowser);72 Assert.assertTrue(action instanceof StartBrowserAction);73 verify(seleniumBrowser).start();74 }75 @Test76 public void testStop() {77 SeleniumBrowserConfiguration endpointConfiguration = new SeleniumBrowserConfiguration();78 when(seleniumBrowser.getName()).thenReturn("seleniumBrowser");79 when(seleniumBrowser.getWebDriver()).thenReturn(webDriver);80 when(seleniumBrowser.getEndpointConfiguration()).thenReturn(endpointConfiguration);81 steps.setBrowser("seleniumBrowser");82 steps.stop();83 Assert.assertEquals(runner.getTestCase().getActionCount(), 1L);84 Assert.assertTrue(((DelegatingTestAction) runner.getTestCase().getTestAction(0)).getDelegate() instanceof SeleniumAction);85 SeleniumAction action = (SeleniumAction) ((DelegatingTestAction) runner.getTestCase().getTestAction(0)).getDelegate();86 Assert.assertEquals(action.getBrowser(), seleniumBrowser);87 Assert.assertTrue(action instanceof StopBrowserAction);88 verify(seleniumBrowser).stop();89 }90 @Test91 public void testNavigate() {92 SeleniumBrowserConfiguration endpointConfiguration = new SeleniumBrowserConfiguration();93 when(seleniumBrowser.getName()).thenReturn("seleniumBrowser");94 when(seleniumBrowser.getWebDriver()).thenReturn(webDriver);95 when(seleniumBrowser.getEndpointConfiguration()).thenReturn(endpointConfiguration);96 WebDriver.Navigation navigation = Mockito.mock(WebDriver.Navigation.class);97 when(webDriver.navigate()).thenReturn(navigation);98 steps.setBrowser("seleniumBrowser");99 steps.navigate("http://localhost:8080/test");100 Assert.assertEquals(runner.getTestCase().getActionCount(), 1L);101 Assert.assertTrue(((DelegatingTestAction) runner.getTestCase().getTestAction(0)).getDelegate() instanceof SeleniumAction);102 SeleniumAction action = (SeleniumAction) ((DelegatingTestAction) runner.getTestCase().getTestAction(0)).getDelegate();103 Assert.assertEquals(action.getBrowser(), seleniumBrowser);104 Assert.assertTrue(action instanceof NavigateAction);105 Assert.assertEquals(((NavigateAction)action).getPage(), "http://localhost:8080/test");106 verify(navigation).to(any(URL.class));107 }108 @Test109 public void testClick() {110 SeleniumBrowserConfiguration endpointConfiguration = new SeleniumBrowserConfiguration();111 when(seleniumBrowser.getName()).thenReturn("seleniumBrowser");112 when(seleniumBrowser.getWebDriver()).thenReturn(webDriver);113 when(seleniumBrowser.getEndpointConfiguration()).thenReturn(endpointConfiguration);114 WebElement element = Mockito.mock(WebElement.class);115 when(element.isDisplayed()).thenReturn(true);116 when(element.isEnabled()).thenReturn(true);117 when(element.getTagName()).thenReturn("button");118 when(webDriver.findElement(any(By.class))).thenAnswer(invocation -> {119 By select = (By) invocation.getArguments()[0];120 Assert.assertEquals(select.getClass(), By.ById.class);121 Assert.assertEquals(select.toString(), "By.id: foo");122 return element;123 });124 steps.setBrowser("seleniumBrowser");125 steps.click("id", "foo");126 Assert.assertEquals(runner.getTestCase().getActionCount(), 1L);127 Assert.assertTrue(((DelegatingTestAction) runner.getTestCase().getTestAction(0)).getDelegate() instanceof SeleniumAction);128 SeleniumAction action = (SeleniumAction) ((DelegatingTestAction) runner.getTestCase().getTestAction(0)).getDelegate();129 Assert.assertEquals(action.getBrowser(), seleniumBrowser);130 Assert.assertTrue(action instanceof ClickAction);131 Assert.assertEquals(((ClickAction)action).getProperty(), "id");132 Assert.assertEquals(((ClickAction)action).getPropertyValue(), "foo");133 verify(element).click();134 }135 @Test136 public void testSetInput() {137 SeleniumBrowserConfiguration endpointConfiguration = new SeleniumBrowserConfiguration();138 when(seleniumBrowser.getName()).thenReturn("seleniumBrowser");139 when(seleniumBrowser.getWebDriver()).thenReturn(webDriver);140 when(seleniumBrowser.getEndpointConfiguration()).thenReturn(endpointConfiguration);141 WebElement element = Mockito.mock(WebElement.class);142 when(element.isDisplayed()).thenReturn(true);143 when(element.isEnabled()).thenReturn(true);144 when(element.getTagName()).thenReturn("input");145 when(webDriver.findElement(any(By.class))).thenReturn(element);146 steps.setBrowser("seleniumBrowser");147 steps.setInput("Hello","id", "foo");148 Assert.assertEquals(runner.getTestCase().getActionCount(), 1L);149 Assert.assertTrue(((DelegatingTestAction) runner.getTestCase().getTestAction(0)).getDelegate() instanceof SeleniumAction);150 SeleniumAction action = (SeleniumAction) ((DelegatingTestAction) runner.getTestCase().getTestAction(0)).getDelegate();151 Assert.assertEquals(action.getBrowser(), seleniumBrowser);152 Assert.assertTrue(action instanceof SetInputAction);153 Assert.assertEquals(((SetInputAction)action).getValue(), "Hello");154 Assert.assertEquals(((SetInputAction)action).getProperty(), "id");155 Assert.assertEquals(((SetInputAction)action).getPropertyValue(), "foo");156 verify(element).clear();157 verify(element).sendKeys("Hello");158 }159 @Test160 public void testCheckInput() {161 SeleniumBrowserConfiguration endpointConfiguration = new SeleniumBrowserConfiguration();162 when(seleniumBrowser.getName()).thenReturn("seleniumBrowser");163 when(seleniumBrowser.getWebDriver()).thenReturn(webDriver);164 when(seleniumBrowser.getEndpointConfiguration()).thenReturn(endpointConfiguration);165 WebElement element = Mockito.mock(WebElement.class);166 when(element.isDisplayed()).thenReturn(true);167 when(element.isEnabled()).thenReturn(true);168 when(element.getTagName()).thenReturn("input");169 when(webDriver.findElement(any(By.class))).thenReturn(element);170 steps.setBrowser("seleniumBrowser");171 steps.checkInput("check","id", "foo");172 Assert.assertEquals(runner.getTestCase().getActionCount(), 1L);173 Assert.assertTrue(((DelegatingTestAction) runner.getTestCase().getTestAction(0)).getDelegate() instanceof SeleniumAction);174 SeleniumAction action = (SeleniumAction) ((DelegatingTestAction) runner.getTestCase().getTestAction(0)).getDelegate();175 Assert.assertEquals(action.getBrowser(), seleniumBrowser);176 Assert.assertTrue(action instanceof CheckInputAction);177 Assert.assertEquals(((CheckInputAction)action).isChecked(), true);178 Assert.assertEquals(((CheckInputAction)action).getProperty(), "id");179 Assert.assertEquals(((CheckInputAction)action).getPropertyValue(), "foo");180 verify(element).click();181 }182 @Test183 public void testShouldDisplay() {184 SeleniumBrowserConfiguration endpointConfiguration = new SeleniumBrowserConfiguration();185 when(seleniumBrowser.getName()).thenReturn("seleniumBrowser");186 when(seleniumBrowser.getWebDriver()).thenReturn(webDriver);187 when(seleniumBrowser.getEndpointConfiguration()).thenReturn(endpointConfiguration);188 WebElement element = Mockito.mock(WebElement.class);189 when(element.isDisplayed()).thenReturn(true);190 when(element.isEnabled()).thenReturn(true);191 when(element.getTagName()).thenReturn("button");192 when(webDriver.findElement(any(By.class))).thenAnswer(invocation -> {193 By select = (By) invocation.getArguments()[0];194 Assert.assertEquals(select.getClass(), By.ByName.class);195 Assert.assertEquals(select.toString(), "By.name: foo");196 return element;197 });198 steps.setBrowser("seleniumBrowser");199 steps.should_display("name", "foo");...

Full Screen

Full Screen

Source:SendHttpMessageTestDesignerTest.java Github

copy

Full Screen

...55 Assert.assertEquals(((DelegatingTestAction)test.getActions().get(0)).getDelegate().getClass(), SendMessageAction.class);56 Assert.assertEquals(test.getActions().get(1).getClass(), DelegatingTestAction.class);57 Assert.assertEquals(((DelegatingTestAction)test.getActions().get(1)).getDelegate().getClass(), SendMessageAction.class);58 SendMessageAction action = (SendMessageAction) ((DelegatingTestAction)test.getActions().get(0)).getDelegate();59 Assert.assertEquals(action.getName(), "send");60 Assert.assertEquals(action.getEndpoint(), httpClient);61 Assert.assertEquals(action.getMessageBuilder().getClass(), StaticMessageContentBuilder.class);62 StaticMessageContentBuilder messageBuilder = (StaticMessageContentBuilder) action.getMessageBuilder();63 Assert.assertEquals(messageBuilder.getMessage().getPayload(String.class), "Foo");64 Assert.assertEquals(messageBuilder.getMessage().getHeader("operation"), "foo");65 Assert.assertEquals(messageBuilder.getMessageHeaders().size(), 1L);66 Assert.assertEquals(messageBuilder.getMessageHeaders().get("additional"), "additionalValue");67 Assert.assertFalse(action.isForkMode());68 action = (SendMessageAction) ((DelegatingTestAction)test.getActions().get(1)).getDelegate();69 Assert.assertEquals(action.getName(), "send");70 Assert.assertEquals(action.getEndpoint(), httpClient);71 Assert.assertEquals(action.getMessageBuilder().getClass(), StaticMessageContentBuilder.class);72 Assert.assertTrue(action.isForkMode());73 }74 @Test75 public void testHttpMethod() {76 MockTestDesigner builder = new MockTestDesigner(applicationContext, context) {77 @Override78 public void configure() {79 http().client(httpClient)80 .send()81 .get()82 .payload("<TestRequest><Message>Hello World!</Message></TestRequest>");83 }84 };85 builder.configure();86 TestCase test = builder.getTestCase();87 Assert.assertEquals(test.getActionCount(), 1);88 Assert.assertEquals(test.getActions().get(0).getClass(), DelegatingTestAction.class);89 Assert.assertEquals(((DelegatingTestAction)test.getActions().get(0)).getDelegate().getClass(), SendMessageAction.class);90 SendMessageAction action = (SendMessageAction) ((DelegatingTestAction)test.getActions().get(0)).getDelegate();91 Assert.assertEquals(action.getName(), "send");92 Assert.assertEquals(action.getEndpoint(), httpClient);93 Assert.assertEquals(action.getMessageBuilder().getClass(), HttpMessageContentBuilder.class);94 HttpMessageContentBuilder messageBuilder = (HttpMessageContentBuilder) action.getMessageBuilder();95 Assert.assertEquals(messageBuilder.getMessage().getPayload(), "<TestRequest><Message>Hello World!</Message></TestRequest>");96 Assert.assertEquals(messageBuilder.getMessage().getHeaders().size(), 3L);97 Assert.assertEquals(messageBuilder.getMessage().getHeaders().get(HttpMessageHeaders.HTTP_REQUEST_METHOD), HttpMethod.GET.name());98 }99 @Test100 public void testHttpRequestUriAndPath() {101 MockTestDesigner builder = new MockTestDesigner(applicationContext, context) {102 @Override103 public void configure() {104 http().client(httpClient)105 .send()106 .get("/test")107 .uri("http://localhost:8080/")108 .payload("<TestRequest><Message>Hello World!</Message></TestRequest>");109 }110 };111 builder.configure();112 TestCase test = builder.getTestCase();113 Assert.assertEquals(test.getActionCount(), 1);114 Assert.assertEquals(test.getActions().get(0).getClass(), DelegatingTestAction.class);115 Assert.assertEquals(((DelegatingTestAction)test.getActions().get(0)).getDelegate().getClass(), SendMessageAction.class);116 SendMessageAction action = (SendMessageAction) ((DelegatingTestAction)test.getActions().get(0)).getDelegate();117 Assert.assertEquals(action.getName(), "send");118 Assert.assertEquals(action.getEndpoint(), httpClient);119 Assert.assertEquals(action.getMessageBuilder().getClass(), HttpMessageContentBuilder.class);120 HttpMessageContentBuilder messageBuilder = (HttpMessageContentBuilder) action.getMessageBuilder();121 Assert.assertEquals(messageBuilder.getMessage().getPayload(), "<TestRequest><Message>Hello World!</Message></TestRequest>");122 Assert.assertEquals(messageBuilder.getMessage().getHeaders().size(), 6L);123 Assert.assertEquals(messageBuilder.getMessage().getHeaders().get(HttpMessageHeaders.HTTP_REQUEST_URI), "http://localhost:8080/");124 Assert.assertEquals(messageBuilder.getMessage().getHeaders().get(DynamicEndpointUriResolver.ENDPOINT_URI_HEADER_NAME), "http://localhost:8080/");125 Assert.assertEquals(messageBuilder.getMessage().getHeaders().get(DynamicEndpointUriResolver.REQUEST_PATH_HEADER_NAME), "/test");126 }127 @Test128 public void testHttpRequestUriAndQueryParams() {129 MockTestDesigner builder = new MockTestDesigner(applicationContext, context) {130 @Override131 public void configure() {132 http().client(httpClient)133 .send()134 .get()135 .uri("http://localhost:8080/")136 .queryParam("param1", "value1")137 .queryParam("param2", "value2")138 .payload("<TestRequest><Message>Hello World!</Message></TestRequest>");139 }140 };141 builder.configure();142 TestCase test = builder.getTestCase();143 Assert.assertEquals(test.getActionCount(), 1);144 Assert.assertEquals(test.getActions().get(0).getClass(), DelegatingTestAction.class);145 Assert.assertEquals(((DelegatingTestAction)test.getActions().get(0)).getDelegate().getClass(), SendMessageAction.class);146 SendMessageAction action = (SendMessageAction) ((DelegatingTestAction)test.getActions().get(0)).getDelegate();147 Assert.assertEquals(action.getName(), "send");148 Assert.assertEquals(action.getEndpoint(), httpClient);149 Assert.assertEquals(action.getMessageBuilder().getClass(), HttpMessageContentBuilder.class);150 HttpMessageContentBuilder messageBuilder = (HttpMessageContentBuilder) action.getMessageBuilder();151 Assert.assertEquals(messageBuilder.getMessage().getPayload(), "<TestRequest><Message>Hello World!</Message></TestRequest>");152 Assert.assertEquals(messageBuilder.getMessage().getHeaders().size(), 7L);153 Assert.assertEquals(messageBuilder.getMessage().getHeaders().get(HttpMessageHeaders.HTTP_REQUEST_URI), "http://localhost:8080/");154 Assert.assertEquals(messageBuilder.getMessage().getHeaders().get(DynamicEndpointUriResolver.ENDPOINT_URI_HEADER_NAME), "http://localhost:8080/");155 Assert.assertEquals(messageBuilder.getMessage().getHeaders().get(DynamicEndpointUriResolver.QUERY_PARAM_HEADER_NAME), "param1=value1,param2=value2");156 }157}...

Full Screen

Full Screen

getName

Using AI Code Generation

copy

Full Screen

1package com.consol.citrus.dsl.actions;2import com.consol.citrus.dsl.testng.TestNGCitrusTestDesigner;3import org.testng.annotations.Test;4public class DelegatingTestActionJavaITest extends TestNGCitrusTestDesigner {5public void delegatingTestActionJavaITest() {6DelegatingTestAction delegatingTestAction = new DelegatingTestAction();7delegatingTestAction.setName("delegatingTestAction");8delegatingTestAction.setDelegate(new TestAction() {9public void doExecute(TestContext context) {10System.out.println("Hello World!");11}12});13delegatingTestAction.execute(context);14}15}16package com.consol.citrus.dsl.actions;17import com.consol.citrus.dsl.testng.TestNGCitrusTestDesigner;18import org.testng.annotations.Test;19public class DelegatingTestActionJavaITest extends TestNGCitrusTestDesigner {20public void delegatingTestActionJavaITest() {21DelegatingTestAction delegatingTestAction = new DelegatingTestAction();22delegatingTestAction.setName("delegatingTestAction");23delegatingTestAction.setDelegate(new TestAction() {24public void doExecute(TestContext context) {25System.out.println("Hello World!");26}27});28delegatingTestAction.execute(context);29}30}31package com.consol.citrus.dsl.actions;32import com.consol.citrus.dsl.testng.TestNGCitrusTestDesigner;33import org.testng.annotations.Test;34public class DelegatingTestActionJavaITest extends TestNGCitrusTestDesigner {

Full Screen

Full Screen

getName

Using AI Code Generation

copy

Full Screen

1package com.consol.citrus.dsl.actions;2import com.consol.citrus.dsl.testng.TestNGCitrusTestDesigner;3import org.testng.annotations.Test;4public class DelegatingTestActionJavaIT extends TestNGCitrusTestDesigner {5public void delegatingTestActionJavaIT() {6 echo(getName());7}8}9package com.consol.citrus.dsl.actions;10import com.consol.citrus.dsl.testng.TestNGCitrusTestDesigner;11import org.testng.annotations.Test;12public class EchoActionJavaIT extends TestNGCitrusTestDesigner {13public void echoActionJavaIT() {14 echo(getName());15}16}17package com.consol.citrus.dsl.actions;18import com.consol.citrus.dsl.testng.TestNGCitrusTestDesigner;19import org.testng.annotations.Test;20public class ExecutePLSQLActionJavaIT extends TestNGCitrusTestDesigner {21public void executePLSQLActionJavaIT() {22 echo(getName());23}24}25package com.consol.citrus.dsl.actions;26import com.consol.citrus.dsl.testng.TestNGCitrusTestDesigner;27import org.testng.annotations.Test;28public class ExecuteSQLActionJavaIT extends TestNGCitrusTestDesigner {29public void executeSQLActionJavaIT() {30 echo(getName());31}32}33package com.consol.citrus.dsl.actions;34import com.consol.citrus.dsl.testng.TestNGCitrusTestDesigner;35import org.testng.annotations.Test;36public class FailActionJavaIT extends TestNGCitrusTestDesigner {37public void failActionJavaIT() {38 echo(getName());39}40}41package com.consol.citrus.dsl.actions;42import com.consol.citrus.dsl.testng.TestNGCitrusTestDesigner;43import org.testng.annotations.Test;

Full Screen

Full Screen

getName

Using AI Code Generation

copy

Full Screen

1package com.consol.citrus.dsl.actions;2import com.consol.citrus.actions.EchoAction;3import com.consol.citrus.dsl.testng.TestNGCitrusTestDesigner;4import org.testng.annotations.Test;5public class DelegatingTestActionIT extends TestNGCitrusTestDesigner {6 public void delegatingTestActionIT() {7 echo(new EchoAction().message("Hello World!").getName());8 }9}10package com.consol.citrus.dsl.actions;11import com.consol.citrus.actions.EchoAction;12import com.consol.citrus.dsl.testng.TestNGCitrusTestDesigner;13import org.testng.annotations.Test;14public class DelegatingTestActionIT extends TestNGCitrusTestDesigner {15 public void delegatingTestActionIT() {16 echo(new EchoAction().message("Hello World!").getName());17 }18}19package com.consol.citrus.dsl.actions;20import com.consol.citrus.actions.EchoAction;21import com.consol.citrus.dsl.testng.TestNGCitrusTestDesigner;22import org.testng.annotations.Test;23public class DelegatingTestActionIT extends TestNGCitrusTestDesigner {24 public void delegatingTestActionIT() {25 echo(new EchoAction().message("Hello World!").getName());26 }27}28package com.consol.citrus.dsl.actions;29import com.consol.citrus.actions.EchoAction;30import com.consol.citrus.dsl.testng.TestNGCitrusTestDesigner;31import org.testng.annotations.Test;32public class DelegatingTestActionIT extends TestNGCitrusTestDesigner {33 public void delegatingTestActionIT() {34 echo(new EchoAction().message("Hello World!").getName());35 }36}37package com.consol.citrus.dsl.actions;38import com.consol.citrus.actions

Full Screen

Full Screen

getName

Using AI Code Generation

copy

Full Screen

1import com.consol.citrus.dsl.actions.DelegatingTestAction;2import com.consol.citrus.dsl.junit.JUnit4CitrusTest;3import org.junit.Test;4public class 3 extends JUnit4CitrusTest {5public void 3() {6DelegatingTestAction delegatingTestAction = new DelegatingTestAction();7delegatingTestAction.getName();8}9}

Full Screen

Full Screen

getName

Using AI Code Generation

copy

Full Screen

1package com.consol.citrus.dsl.actions;2import com.consol.citrus.dsl.testng.TestNGCitrusTestRunner;3import org.testng.annotations.Test;4public class DelegatingTestActionTest extends TestNGCitrusTestRunner {5public void delegatingTestActionTest() {6DelegatingTestAction delegatingTestAction = new DelegatingTestAction();7delegatingTestAction.setName("DelegatingTestAction");8delegatingTestAction.execute(context);9}10}11package com.consol.citrus.dsl.actions;12import com.consol.citrus.dsl.testng.TestNGCitrusTestRunner;13import org.testng.annotations.Test;14public class DelegatingTestActionTest extends TestNGCitrusTestRunner {15public void delegatingTestActionTest() {16DelegatingTestAction delegatingTestAction = new DelegatingTestAction();17delegatingTestAction.setAction(new DelegatingTestAction());18delegatingTestAction.execute(context);19}20}21package com.consol.citrus.dsl.actions;22import com.consol.citrus.dsl.testng.TestNGCitrusTestRunner;23import org.testng.annotations.Test;24public class DelegatingTestActionTest extends TestNGCitrusTestRunner {25public void delegatingTestActionTest() {26DelegatingTestAction delegatingTestAction = new DelegatingTestAction();27delegatingTestAction.setTestAction(new DelegatingTestAction());28delegatingTestAction.execute(context);29}30}31package com.consol.citrus.dsl.actions;32import com.consol.citrus.dsl.testng.TestNGCitrusTestRunner;33import org.testng.annotations.Test;34public class DelegatingTestActionTest extends TestNGCitrusTestRunner {35public void delegatingTestActionTest() {36DelegatingTestAction delegatingTestAction = new DelegatingTestAction();37delegatingTestAction.setTestAction(new DelegatingTestAction());38delegatingTestAction.execute(context);39}40}

Full Screen

Full Screen

getName

Using AI Code Generation

copy

Full Screen

1package com.consol.citrus.dsl.actions;2import com.consol.citrus.TestAction;3import com.consol.citrus.TestActionBuilder;4import com.consol.citrus.actions.AbstractTestAction;5import com.consol.citrus.context.TestContext;6import com.consol.citrus.dsl.design.TestDesigner;7import com.consol.citrus.dsl.runner.TestRunner;8import com.consol.citrus.exceptions.CitrusRuntimeException;9import com.consol.citrus.testng.AbstractTestNGUnitTest;10import org.mockito.Mockito;11import org.springframework.beans.factory.annotation.Autowired;12import org.springframework.context.ApplicationContext;13import org.testng.Assert;14import org.testng.annotations.Test;15import java.util.*;16public class DelegatingTestActionTest extends AbstractTestNGUnitTest {17 private ApplicationContext applicationContext;18 public void testDelegatingTestActionBuilder() {19 final TestActionBuilder testActionBuilder = Mockito.mock(TestActionBuilder.class);20 Mockito.when(testActionBuilder.getName()).thenReturn("testActionBuilder");21 DelegatingTestAction delegatingTestAction = new DelegatingTestAction(testActionBuilder);22 Assert.assertEquals(delegatingTestAction.getName(), "testActionBuilder");23 Assert.assertEquals(delegatingTestAction.getTestActionBuilder(), testActionBuilder);24 delegatingTestAction = new DelegatingTestAction(testActionBuilder, applicationContext);25 Assert.assertEquals(delegatingTestAction.getName(), "testActionBuilder");26 Assert.assertEquals(delegatingTestAction.getTestActionBuilder(), testActionBuilder);27 }28 public void testDelegatingTestAction() {29 final TestAction testAction = Mockito.mock(TestAction.class);30 Mockito.when(testAction.getName()).thenReturn("testAction");31 DelegatingTestAction delegatingTestAction = new DelegatingTestAction(testAction);32 Assert.assertEquals(delegatingTestAction.getName(), "testAction");33 Assert.assertEquals(delegatingTestAction.getTestAction(), testAction);34 delegatingTestAction = new DelegatingTestAction(testAction, applicationContext);35 Assert.assertEquals(delegatingTestAction.getName(), "testAction");36 Assert.assertEquals(delegatingTestAction.getTestAction(), testAction);37 }38 public void testDelegatingTestActionWithNullTestActionBuilder() {39 try {40 new DelegatingTestAction(null);41 } catch (CitrusRuntimeException e) {42 Assert.assertEquals(e.getMessage(),

Full Screen

Full Screen

getName

Using AI Code Generation

copy

Full Screen

1package com.consol.citrus.dsl.actions;2import com.consol.citrus.testng.AbstractTestNGUnitTest;3import org.testng.annotations.Test;4public class GetNameTest extends AbstractTestNGUnitTest {5 public void testGetName() {6 DelegatingTestAction delegatingTestAction = new DelegatingTestAction();7 delegatingTestAction.setName("delegatingTestAction");8 assert delegatingTestAction.getName().equals("delegatingTestAction");9 }10}11package com.consol.citrus.dsl.actions;12import com.consol.citrus.testng.AbstractTestNGUnitTest;13import org.testng.annotations.Test;14public class SetNameTest extends AbstractTestNGUnitTest {15 public void testSetName() {16 DelegatingTestAction delegatingTestAction = new DelegatingTestAction();17 delegatingTestAction.setName("delegatingTestAction");18 assert delegatingTestAction.getName().equals("delegatingTestAction");19 }20}21package com.consol.citrus.dsl.actions;22import com.consol.citrus.actions.EchoAction;23import com.consol.citrus.testng.AbstractTestNGUnitTest;24import org.testng.annotations.Test;25public class GetActionTest extends AbstractTestNGUnitTest {26 public void testGetAction() {27 DelegatingTestAction delegatingTestAction = new DelegatingTestAction();28 EchoAction echoAction = new EchoAction();29 echoAction.setMessage("Hello");30 delegatingTestAction.setAction(echoAction);31 assert delegatingTestAction.getAction().equals(echoAction);32 }33}34package com.consol.citrus.dsl.actions;35import com.consol.citrus.actions.EchoAction;36import com.consol.citrus.testng.AbstractTestNGUnitTest;37import org.testng.annotations.Test;38public class SetActionTest extends AbstractTestNGUnitTest {39 public void testSetAction() {40 DelegatingTestAction delegatingTestAction = new DelegatingTestAction();

Full Screen

Full Screen

getName

Using AI Code Generation

copy

Full Screen

1public class 3 {2 public static void main(String[] args) {3 DelegatingTestAction delegatingTestAction = new DelegatingTestAction();4 delegatingTestAction.setName("test");5 System.out.println(delegatingTestAction.getName());6 }7}8public class 4 {9 public static void main(String[] args) {10 DelegatingTestAction delegatingTestAction = new DelegatingTestAction();11 delegatingTestAction.setDelegate(new EchoAction());12 }13}14public class 5 {15 public static void main(String[] args) {16 DelegatingTestAction delegatingTestAction = new DelegatingTestAction();17 delegatingTestAction.setDelegate(new EchoAction());18 System.out.println(delegatingTestAction.getDelegate());19 }20}21public class 6 {22 public static void main(String[] args) {23 DelegatingTestAction delegatingTestAction = new DelegatingTestAction();24 delegatingTestAction.setActionName("test");25 }26}27public class 7 {28 public static void main(String[] args) {29 DelegatingTestAction delegatingTestAction = new DelegatingTestAction();30 delegatingTestAction.setActionName("test");31 System.out.println(delegatingTestAction.getActionName());32 }33}34public class 8 {35 public static void main(String[] args) {36 DelegatingTestAction delegatingTestAction = new DelegatingTestAction();37 delegatingTestAction.setParameters(Collections.<String, Object>singletonMap("test", "test"));38 }39}

Full Screen

Full Screen

getName

Using AI Code Generation

copy

Full Screen

1public class 3 extends AbstractTestNGCitrusTest {2 public void 3() {3 variable("var1", "citrus:randomNumber(5)");4 variable("var2", "citrus:randomNumber(5)");5 variable("var3", "citrus:randomNumber(5)");6 variable("var4", "citrus:randomNumber(5)");7 variable("var5", "citrus:randomNumber(5)");8 variable("var6", "citrus:randomNumber(5)");9 variable("var7", "citrus:randomNumber(5)");10 variable("var8", "citrus:randomNumber(5)");11 variable("var9", "citrus:randomNumber(5)");12 variable("var10", "citrus:randomNumber(5)");13 variable("var11", "citrus:randomNumber(5)");14 variable("var12", "citrus:randomNumber(5)");15 variable("var13", "citrus:randomNumber(5)");16 variable("var14", "citrus:randomNumber(5)");17 variable("var15", "citrus:randomNumber(5)");18 variable("var16", "citrus:randomNumber(5)");19 variable("var17", "citrus:randomNumber(5)");20 variable("var18", "citrus:randomNumber(5)");21 variable("var19", "citrus:randomNumber(5)");22 variable("var20", "citrus:randomNumber(5)");23 variable("var21", "citrus:randomNumber(5)");24 variable("var22", "citrus:randomNumber(5)");25 variable("var23", "citrus:randomNumber(5)");26 variable("var24", "citrus:randomNumber(5)");27 variable("var25", "citrus:randomNumber(5)");28 variable("var26", "citrus:randomNumber(5)");29 variable("var27", "citrus:randomNumber(5)");30 variable("var28", "citrus:randomNumber(5)");31 variable("var29", "citrus:randomNumber(5)");32 variable("var30", "citrus:randomNumber(5)");33 variable("var31", "citrus:randomNumber(5)");34 variable("var32", "cit

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