How to use getLocale method of com.consol.citrus.ws.message.SoapFault class

Best Citrus code snippet using com.consol.citrus.ws.message.SoapFault.getLocale

Source:WebServiceEndpoint.java Github

copy

Full Screen

...244 245 if (SoapFaultDefinition.SERVER.equals(replyMessage.getFaultCodeQName()) ||246 SoapFaultDefinition.RECEIVER.equals(replyMessage.getFaultCodeQName())) {247 soapFault = soapBody.addServerOrReceiverFault(replyMessage.getFaultString(),248 replyMessage.getLocale());249 } else if (SoapFaultDefinition.CLIENT.equals(replyMessage.getFaultCodeQName()) ||250 SoapFaultDefinition.SENDER.equals(replyMessage.getFaultCodeQName())) {251 soapFault = soapBody.addClientOrSenderFault(replyMessage.getFaultString(),252 replyMessage.getLocale());253 } else if (soapBody instanceof Soap11Body) {254 Soap11Body soap11Body = (Soap11Body) soapBody;255 soapFault = soap11Body.addFault(replyMessage.getFaultCodeQName(),256 replyMessage.getFaultString(),257 replyMessage.getLocale());258 } else if (soapBody instanceof Soap12Body) {259 Soap12Body soap12Body = (Soap12Body) soapBody;260 Soap12Fault soap12Fault = soap12Body.addServerOrReceiverFault(replyMessage.getFaultString(),261 replyMessage.getLocale());262 soap12Fault.addFaultSubcode(replyMessage.getFaultCodeQName());263 264 soapFault = soap12Fault;265 } else {266 throw new CitrusRuntimeException("Found unsupported SOAP implementation. Use SOAP 1.1 or SOAP 1.2.");267 }268 269 if (replyMessage.getFaultActor() != null) {270 soapFault.setFaultActorOrRole(replyMessage.getFaultActor());271 }272 273 List<String> soapFaultDetails = replyMessage.getFaultDetails();274 if (!soapFaultDetails.isEmpty()) {275 TransformerFactory transformerFactory = TransformerFactory.newInstance();...

Full Screen

Full Screen

Source:SendSoapFaultActionTest.java Github

copy

Full Screen

...56 Assert.assertTrue(sentMessage instanceof SoapFault);57 SoapFault soapFault = (SoapFault) sentMessage;58 Assert.assertEquals(soapFault.getFaultCode(), "{http://citrusframework.org}ws:TEC-1000");59 Assert.assertEquals(soapFault.getFaultString(), "Internal server error");60 Assert.assertEquals(soapFault.getLocale(), Locale.ENGLISH);61 return null;62 }63 }).when(producer).send(any(Message.class), any(TestContext.class));64 when(endpoint.getActor()).thenReturn(null);65 66 sendSoapFaultAction.execute(context);67 }68 69 @Test70 @SuppressWarnings("rawtypes")71 public void testSendSoapFaultWithActor() {72 SendSoapFaultAction sendSoapFaultAction = new SendSoapFaultAction();73 sendSoapFaultAction.setEndpoint(endpoint);74 75 sendSoapFaultAction.setFaultCode("{http://citrusframework.org}ws:TEC-1000");76 sendSoapFaultAction.setFaultString("Internal server error");77 sendSoapFaultAction.setFaultActor("SERVER");78 79 reset(endpoint, producer, endpointConfiguration);80 when(endpoint.createProducer()).thenReturn(producer);81 when(endpoint.getEndpointConfiguration()).thenReturn(endpointConfiguration);82 when(endpointConfiguration.getTimeout()).thenReturn(5000L);83 doAnswer(new Answer() {84 @Override85 public Object answer(InvocationOnMock invocation) throws Throwable {86 Message sentMessage = (Message)invocation.getArguments()[0];87 Assert.assertTrue(sentMessage instanceof SoapFault);88 SoapFault soapFault = (SoapFault) sentMessage;89 Assert.assertEquals(soapFault.getFaultCode(), "{http://citrusframework.org}ws:TEC-1000");90 Assert.assertEquals(soapFault.getFaultString(), "Internal server error");91 Assert.assertEquals(soapFault.getLocale(), Locale.ENGLISH);92 Assert.assertEquals(soapFault.getFaultActor(), "SERVER");93 return null;94 }95 }).when(producer).send(any(Message.class), any(TestContext.class));96 when(endpoint.getActor()).thenReturn(null);97 98 sendSoapFaultAction.execute(context);99 }100 101 @Test102 @SuppressWarnings("rawtypes")103 public void testSendSoapFaultMissingFaultString() {104 SendSoapFaultAction sendSoapFaultAction = new SendSoapFaultAction();105 sendSoapFaultAction.setEndpoint(endpoint);106 107 sendSoapFaultAction.setFaultCode("{http://citrusframework.org}ws:TEC-1000");108 109 reset(endpoint, producer, endpointConfiguration);110 when(endpoint.createProducer()).thenReturn(producer);111 when(endpoint.getEndpointConfiguration()).thenReturn(endpointConfiguration);112 when(endpointConfiguration.getTimeout()).thenReturn(5000L);113 doAnswer(new Answer() {114 @Override115 public Object answer(InvocationOnMock invocation) throws Throwable {116 Message sentMessage = (Message)invocation.getArguments()[0];117 Assert.assertTrue(sentMessage instanceof SoapFault);118 SoapFault soapFault = (SoapFault) sentMessage;119 Assert.assertEquals(soapFault.getFaultCode(), "{http://citrusframework.org}ws:TEC-1000");120 Assert.assertNull(soapFault.getFaultString());121 Assert.assertEquals(soapFault.getLocale(), Locale.ENGLISH);122 return null;123 }124 }).when(producer).send(any(Message.class), any(TestContext.class));125 when(endpoint.getActor()).thenReturn(null);126 127 sendSoapFaultAction.execute(context);128 }129 130 @Test131 @SuppressWarnings("rawtypes")132 public void testSendSoapFaultWithVariableSupport() {133 SendSoapFaultAction sendSoapFaultAction = new SendSoapFaultAction();134 sendSoapFaultAction.setEndpoint(endpoint);135 136 sendSoapFaultAction.setFaultCode("citrus:concat('{http://citrusframework.org}ws:', ${faultCode})");137 sendSoapFaultAction.setFaultString("${faultString}");138 139 context.setVariable("faultCode", "TEC-1000");140 context.setVariable("faultString", "Internal server error");141 reset(endpoint, producer, endpointConfiguration);142 when(endpoint.createProducer()).thenReturn(producer);143 when(endpoint.getEndpointConfiguration()).thenReturn(endpointConfiguration);144 when(endpointConfiguration.getTimeout()).thenReturn(5000L);145 doAnswer(new Answer() {146 @Override147 public Object answer(InvocationOnMock invocation) throws Throwable {148 Message sentMessage = (Message)invocation.getArguments()[0];149 Assert.assertTrue(sentMessage instanceof SoapFault);150 SoapFault soapFault = (SoapFault) sentMessage;151 Assert.assertEquals(soapFault.getFaultCode(), "{http://citrusframework.org}ws:TEC-1000");152 Assert.assertEquals(soapFault.getFaultString(), "Internal server error");153 Assert.assertEquals(soapFault.getLocale(), Locale.ENGLISH);154 return null;155 }156 }).when(producer).send(any(Message.class), any(TestContext.class));157 when(endpoint.getActor()).thenReturn(null);158 159 sendSoapFaultAction.execute(context);160 }161 162 @Test163 public void testSendSoapFaultMissingFaultCode() {164 SendSoapFaultAction sendSoapFaultAction = new SendSoapFaultAction();165 sendSoapFaultAction.setEndpoint(endpoint);166 167 reset(endpoint, producer, endpointConfiguration);...

Full Screen

Full Screen

getLocale

Using AI Code Generation

copy

Full Screen

1package com.consol.citrus.ws.actions;2import com.consol.citrus.testng.AbstractTestNGUnitTest;3import com.consol.citrus.ws.message.SoapFault;4import org.easymock.EasyMock;5import org.springframework.context.ApplicationContext;6import org.testng.Assert;7import org.testng.annotations.Test;8import java.util.Locale;9public class SoapFaultTest extends AbstractTestNGUnitTest {10 public void testGetLocale() {11 SoapFault soapFault = new SoapFault();12 soapFault.setLocale(Locale.CANADA);13 Assert.assertEquals(soapFault.getLocale(), Locale.CANADA);14 }15}16package com.consol.citrus.ws.actions;17import com.consol.citrus.testng.AbstractTestNGUnitTest;18import com.consol.citrus.ws.message.SoapFault;19import org.easymock.EasyMock;20import org.springframework.context.ApplicationContext;21import org.testng.Assert;22import org.testng.annotations.Test;23import java.util.Locale;24public class SoapFaultTest extends AbstractTestNGUnitTest {25 public void testSetLocale() {26 SoapFault soapFault = new SoapFault();27 soapFault.setLocale(Locale.CANADA);28 Assert.assertEquals(soapFault.getLocale(), Locale.CANADA);29 }30}31package com.consol.citrus.ws.actions;32import com.consol.citrus.testng.AbstractTestNGUnitTest;33import com.consol.citrus.ws.message.SoapFault;34import org.easymock.EasyMock;35import org.springframework.context.ApplicationContext;36import org.testng.Assert;37import org.testng.annotations.Test;38import java.util.Locale;39public class SoapFaultTest extends AbstractTestNGUnitTest {40 public void testGetFaultString() {41 SoapFault soapFault = new SoapFault();42 soapFault.setFaultString("faultString");43 Assert.assertEquals(soapFault.getFaultString(), "faultString");44 }45}46package com.consol.citrus.ws.actions;47import com.consol.citrus.testng.AbstractTestNGUnitTest;48import

Full Screen

Full Screen

getLocale

Using AI Code Generation

copy

Full Screen

1SoapFault soapFault = new SoapFault();2soapFault.getLocale();3SoapFault soapFault = new SoapFault();4soapFault.getFaultStringOrReason();5SoapFault soapFault = new SoapFault();6soapFault.getFaultActor();7SoapFault soapFault = new SoapFault();8soapFault.getFaultCode();9SoapFault soapFault = new SoapFault();10soapFault.getFaultDetail();11SoapFault soapFault = new SoapFault();12soapFault.getFaultReason();13SoapFault soapFault = new SoapFault();14soapFault.getFaultString();15SoapFault soapFault = new SoapFault();16soapFault.getFaultCodeAsQName();17SoapFault soapFault = new SoapFault();18soapFault.getFaultDetailAsDocument();19SoapFault soapFault = new SoapFault();20soapFault.getFaultDetailAsQName();21SoapFault soapFault = new SoapFault();22soapFault.getFaultReasonAsQName();23SoapFault soapFault = new SoapFault();24soapFault.getFaultStringOrReasonAsQName();25SoapFault soapFault = new SoapFault();

Full Screen

Full Screen

getLocale

Using AI Code Generation

copy

Full Screen

1package com.consol.citrus.samples;2import java.util.Locale;3import org.springframework.context.annotation.Bean;4import org.springframework.context.annotation.Configuration;5import org.springframework.context.annotation.ImportResource;6import com.consol.citrus.dsl.endpoint.CitrusEndpoints;7import com.consol.citrus.message.MessageType;8import com.consol.citrus.ws.client.WebServiceClient;9import com.consol.citrus.ws.server.WebServiceServer;10@ImportResource("classpath:com/consol/citrus/samples/3-soap-fault-context.xml")11public class SoapFaultJavaConfig {12 public WebServiceServer soapFaultServer() {13 .soap()14 .server()15 .port(8080)16 .autoStart(true)17 .build();18 }19 public WebServiceClient soapFaultClient() {20 .soap()21 .client()22 .autoStart(true)23 .build();24 }25}

Full Screen

Full Screen

getLocale

Using AI Code Generation

copy

Full Screen

1package com.consol.citrus.ws.message;2import org.testng.Assert;3import org.testng.annotations.Test;4import javax.xml.namespace.QName;5import javax.xml.soap.SOAPConstants;6import javax.xml.soap.SOAPFactory;7import javax.xml.soap.SOAPFault;8import java.util.Locale;9public class SoapFaultTest {10 public void testGetLocale() throws Exception {11 SOAPFault fault = SOAPFactory.newInstance(SOAPConstants.SOAP_1_1_PROTOCOL).createFault();12 fault.setFaultString("faultString", Locale.FRENCH);13 SoapFault soapFault = new SoapFault(fault);14 Assert.assertEquals(soapFault.getLocale(), Locale.FRENCH);15 }16}17package com.consol.citrus.ws.message;18import org.testng.Assert;19import org.testng.annotations.Test;20import javax.xml.namespace.QName;21import javax.xml.soap.SOAPConstants;22import javax.xml.soap.SOAPFactory;23import javax.xml.soap.SOAPFault;24public class SoapFaultTest {25 public void testGetFaultCode() throws Exception {26 SOAPFault fault = SOAPFactory.newInstance(SOAPConstants.SOAP_1_1_PROTOCOL).createFault();27 fault.setFaultCode(new QName("faultCode"));28 SoapFault soapFault = new SoapFault(fault);29 Assert.assertEquals(soapFault.getFaultCode(), new QName("faultCode"));30 }31}32package com.consol.citrus.ws.message;33import org.testng.Assert;34import org.testng.annotations.Test;35import javax.xml.namespace.QName;36import javax.xml.soap.SOAPConstants;37import javax.xml.soap.SOAPFactory;38import javax.xml.soap.SOAPFault;39public class SoapFaultTest {40 public void testGetFaultString() throws Exception {41 SOAPFault fault = SOAPFactory.newInstance(SOAPConstants.SOAP_1_1_PROTOCOL).createFault();42 fault.setFaultString("faultString");43 SoapFault soapFault = new SoapFault(fault);44 Assert.assertEquals(soapFault.getFaultString(), "faultString");45 }46}

Full Screen

Full Screen

getLocale

Using AI Code Generation

copy

Full Screen

1package com.consol.citrus.ws.message;2import org.testng.Assert;3import org.testng.annotations.Test;4import javax.xml.namespace.QName;5import java.util.Locale;6public class SoapFaultTest {7 public void testGetLocale() {8 SoapFault soapFault = new SoapFault();9 soapFault.setFaultString("test");10 soapFault.setLocale(Locale.US);11 Assert.assertEquals(soapFault.getLocale(), Locale.US);12 }13}

Full Screen

Full Screen

getLocale

Using AI Code Generation

copy

Full Screen

1public void getLocale() {2 SoapFault fault = new SoapFault();3 fault.getLocale();4}5public void getFaultActor() {6 SoapFault fault = new SoapFault();7 fault.getFaultActor();8}9public void getFaultCode() {10 SoapFault fault = new SoapFault();11 fault.getFaultCode();12}13public void getFaultString() {14 SoapFault fault = new SoapFault();15 fault.getFaultString();16}17public void getFaultStringOrReason() {18 SoapFault fault = new SoapFault();19 fault.getFaultStringOrReason();20}21public void getFaultDetail() {22 SoapFault fault = new SoapFault();23 fault.getFaultDetail();24}25public void getFaultDetailElement() {26 SoapFault fault = new SoapFault();27 fault.getFaultDetailElement();28}29public void getFaultCodeAsQName() {30 SoapFault fault = new SoapFault();31 fault.getFaultCodeAsQName();32}33public void getFaultStringOrReasonAsQName() {34 SoapFault fault = new SoapFault();35 fault.getFaultStringOrReasonAsQName();36}

Full Screen

Full Screen

getLocale

Using AI Code Generation

copy

Full Screen

1package com.consol.citrus.ws.message;2import static org.testng.Assert.assertEquals;3import org.testng.annotations.Test;4import javax.xml.namespace.QName;5public class SoapFaultTest {6 public void testGetLocale() {7 SoapFault soapFault = new SoapFault();8 soapFault.setFaultString("Server Error");9 soapFault.setLocale("en");10 assertEquals(soapFault.getLocale(), "en");11 }12}13BUILD SUCCESSFUL (total time: 0 seconds)

Full Screen

Full Screen

getLocale

Using AI Code Generation

copy

Full Screen

1package com.consol.citrus;2import org.testng.annotations.Test;3import com.consol.citrus.context.TestContext;4import com.consol.citrus.ws.message.SoapFault;5public class GetLocale {6 public void getLocale() {7 SoapFault fault = new SoapFault("fault", "faultCode", "faultString", "faultActor", "faultDetail");8 TestContext context = new TestContext();9 fault.getLocale(context);10 }11}12package com.consol.citrus;13import org.testng.annotations.Test;14import com.consol.citrus.context.TestContext;15import com.consol.citrus.ws.message.SoapFault;16public class GetFaultCode {17 public void getFaultCode() {18 SoapFault fault = new SoapFault("fault", "faultCode", "faultString", "faultActor", "faultDetail");19 TestContext context = new TestContext();20 fault.getFaultCode(context);21 }22}23package com.consol.citrus;24import org.testng.annotations.Test;25import com.consol.citrus.context.TestContext;26import com.consol.citrus.ws.message.SoapFault;27public class GetFaultString {28 public void getFaultString() {29 SoapFault fault = new SoapFault("fault", "faultCode", "faultString", "faultActor", "faultDetail");30 TestContext context = new TestContext();31 fault.getFaultString(context);32 }33}34package com.consol.citrus;35import org.testng.annotations.Test;36import com.consol.citrus.context.TestContext;37import com.consol.citrus.ws.message.SoapFault;38public class GetFaultActor {39 public void getFaultActor() {40 SoapFault fault = new SoapFault("fault", "faultCode", "faultString", "faultActor", "faultDetail");41 TestContext context = new TestContext();42 fault.getFaultActor(context);43 }44}

Full Screen

Full Screen

getLocale

Using AI Code Generation

copy

Full Screen

1public void test() {2 SoapFault fault = new SoapFault();3 fault.getLocale();4}5public void test() {6 SoapFault fault = new SoapFault();7 fault.setLocale("locale");8}9public void test() {10 SoapFault fault = new SoapFault();11 fault.getFaultStringOrReason();12}13public void test() {14 SoapFault fault = new SoapFault();15 fault.setFaultStringOrReason("faultStringOrReason");16}17public void test() {18 SoapFault fault = new SoapFault();19 fault.getFaultCode();20}21public void test() {22 SoapFault fault = new SoapFault();23 fault.setFaultCode("faultCode");24}25public void test() {26 SoapFault fault = new SoapFault();27 fault.getFaultActor();28}29public void test() {30 SoapFault fault = new SoapFault();31 fault.setFaultActor("faultActor");32}33public void test() {34 SoapFault fault = new SoapFault();35 fault.getFaultDetail();36}37public void test() {38 SoapFault fault = new SoapFault();39 fault.setFaultDetail("faultDetail");40}

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