idx
int64
0
41.2k
question
stringlengths
74
4.04k
target
stringlengths
7
750
28,300
public GroovyActionBuilder script ( Resource scriptResource , Charset charset ) { try { action . setScript ( FileUtils . readToString ( scriptResource , charset ) ) ; } catch ( IOException e ) { throw new CitrusRuntimeException ( "Failed to read script resource file" , e ) ; } return this ; }
Sets the Groovy script to execute .
28,301
public GroovyActionBuilder template ( Resource scriptTemplate , Charset charset ) { try { action . setScriptTemplate ( FileUtils . readToString ( scriptTemplate , charset ) ) ; } catch ( IOException e ) { throw new CitrusRuntimeException ( "Failed to read script template file" , e ) ; } return this ; }
Use a script template resource .
28,302
private Object getObjectInstanceFromClass ( TestContext context ) throws ClassNotFoundException , SecurityException , NoSuchMethodException , IllegalArgumentException , InstantiationException , IllegalAccessException , InvocationTargetException { if ( ! StringUtils . hasText ( className ) ) { throw new CitrusRuntimeExc...
Instantiate class for name . Constructor arguments are supported if specified .
28,303
public void onInboundMessage ( Message message , TestContext context ) { if ( message != null ) { for ( MessageListener listener : messageListener ) { listener . onInboundMessage ( message , context ) ; } } }
Delegate to all known message listener instances .
28,304
private String removeCDataElements ( String value ) { String data = value . trim ( ) ; if ( data . startsWith ( CDATA_SECTION_START ) ) { data = value . substring ( CDATA_SECTION_START . length ( ) ) ; data = data . substring ( 0 , data . length ( ) - CDATA_SECTION_END . length ( ) ) ; } return data ; }
Cut off CDATA elements .
28,305
public void afterPropertiesSet ( ) throws Exception { for ( MessageValidator < ? extends ValidationContext > messageValidator : messageValidatorRegistry . getMessageValidators ( ) ) { if ( messageValidator instanceof DomXmlMessageValidator && messageValidator . supportsMessageType ( MessageType . XML . name ( ) , new D...
Initialize xml message validator if not injected by Spring bean context .
28,306
private String appendRequestPath ( String uri , Map < String , Object > headers ) { if ( ! headers . containsKey ( REQUEST_PATH_HEADER_NAME ) ) { return uri ; } String requestUri = uri ; String path = headers . get ( REQUEST_PATH_HEADER_NAME ) . toString ( ) ; while ( requestUri . endsWith ( "/" ) ) { requestUri = requ...
Appends optional request path to endpoint uri .
28,307
public void saveReplyDestination ( JmsMessage jmsMessage , TestContext context ) { if ( jmsMessage . getReplyTo ( ) != null ) { String correlationKeyName = endpointConfiguration . getCorrelator ( ) . getCorrelationKeyName ( getName ( ) ) ; String correlationKey = endpointConfiguration . getCorrelator ( ) . getCorrelati...
Store the reply destination either straight forward or with a given message correlation key .
28,308
protected void validateAttachmentContentData ( String receivedContent , String controlContent , String controlContentId ) { if ( ignoreAllWhitespaces ) { controlContent = StringUtils . trimAllWhitespace ( controlContent ) ; receivedContent = StringUtils . trimAllWhitespace ( receivedContent ) ; } Assert . isTrue ( rece...
Validates content data .
28,309
public RmiServerBuilder remoteInterfaces ( Class < ? extends Remote > ... remoteInterfaces ) { endpoint . setRemoteInterfaces ( Arrays . asList ( remoteInterfaces ) ) ; return this ; }
Sets the remote interfaces property .
28,310
private void sendOrPublishMessage ( Message message ) { if ( endpointConfiguration . isPubSubDomain ( ) ) { if ( log . isDebugEnabled ( ) ) { log . debug ( "Publish Vert.x event bus message to address: '" + endpointConfiguration . getAddress ( ) + "'" ) ; } vertx . eventBus ( ) . publish ( endpointConfiguration . getAd...
Sends or publishes new outbound message depending on eventbus nature .
28,311
public Type [ ] getParameterTypes ( ) { Type [ ] types = new Type [ parameterNames . size ( ) ] ; for ( int i = 0 ; i < types . length ; i ++ ) { types [ i ] = String . class ; } return types ; }
Provide parameter types for this step .
28,312
public Message < ? > receive ( MessageSelector selector ) { Object [ ] array = this . queue . toArray ( ) ; for ( Object o : array ) { Message < ? > message = ( Message < ? > ) o ; if ( selector . accept ( message ) && this . queue . remove ( message ) ) { return message ; } } return null ; }
Supports selective consumption of messages on the channel . The first message to be accepted by given message selector is returned as result .
28,313
public Message < ? > receive ( MessageSelector selector , long timeout ) { long timeLeft = timeout ; Message < ? > message = receive ( selector ) ; while ( message == null && timeLeft > 0 ) { timeLeft -= pollingInterval ; if ( RETRY_LOG . isDebugEnabled ( ) ) { RETRY_LOG . debug ( "No message received with message sele...
Consume messages on the channel via message selector . Timeout forces several retries with polling interval setting .
28,314
public void setInterceptors ( List < ClientInterceptor > interceptors ) { this . interceptors = interceptors ; getWebServiceTemplate ( ) . setInterceptors ( interceptors . toArray ( new ClientInterceptor [ interceptors . size ( ) ] ) ) ; }
Sets the client interceptors .
28,315
protected String randomValue ( List < String > values ) { if ( values == null || values . isEmpty ( ) ) { throw new InvalidFunctionUsageException ( "No values to choose from" ) ; } final int idx = random . nextInt ( values . size ( ) ) ; return values . get ( idx ) ; }
Pseudo - randomly choose one of the supplied values and return it .
28,316
public SeleniumActionBuilder navigate ( String page ) { NavigateAction action = new NavigateAction ( ) ; action . setPage ( page ) ; action ( action ) ; return this ; }
Navigate action .
28,317
public ElementActionBuilder select ( String option ) { DropDownSelectAction action = new DropDownSelectAction ( ) ; action . setOption ( option ) ; action ( action ) ; return new ElementActionBuilder ( action ) ; }
Dropdown select single option action .
28,318
public ElementActionBuilder select ( String ... options ) { DropDownSelectAction action = new DropDownSelectAction ( ) ; action . setOptions ( Arrays . asList ( options ) ) ; action ( action ) ; return new ElementActionBuilder ( action ) ; }
Dropdown select multiple options action .
28,319
public ElementActionBuilder setInput ( String value ) { SetInputAction action = new SetInputAction ( ) ; action . setValue ( value ) ; action ( action ) ; return new ElementActionBuilder ( action ) ; }
Set input action .
28,320
public ElementActionBuilder checkInput ( boolean checked ) { CheckInputAction action = new CheckInputAction ( ) ; action . setChecked ( checked ) ; action ( action ) ; return new ElementActionBuilder ( action ) ; }
Check input action .
28,321
public SeleniumActionBuilder screenshot ( String outputDir ) { MakeScreenshotAction action = new MakeScreenshotAction ( ) ; action . setOutputDir ( outputDir ) ; action ( action ) ; return this ; }
Make screenshot with custom output directory .
28,322
public SeleniumActionBuilder store ( String filePath ) { StoreFileAction action = new StoreFileAction ( ) ; action . setFilePath ( filePath ) ; action ( action ) ; return this ; }
Store file .
28,323
public SeleniumActionBuilder getStored ( String fileName ) { GetStoredFileAction action = new GetStoredFileAction ( ) ; action . setFileName ( fileName ) ; action ( action ) ; return this ; }
Get stored file .
28,324
private < T extends SeleniumAction > T action ( T delegate ) { if ( seleniumBrowser != null ) { delegate . setBrowser ( seleniumBrowser ) ; } action . setDelegate ( delegate ) ; return delegate ; }
Prepare selenium action .
28,325
public Message createMessage ( final String messageName ) { final Message [ ] message = { null } ; for ( final Object messageCreator : messageCreators ) { ReflectionUtils . doWithMethods ( messageCreator . getClass ( ) , new ReflectionUtils . MethodCallback ( ) { public void doWith ( Method method ) throws IllegalArgum...
Create message by delegating message creation to known message creators that are able to create message with given name .
28,326
public void addType ( String type ) { try { messageCreators . add ( Class . forName ( type ) . newInstance ( ) ) ; } catch ( ClassNotFoundException | IllegalAccessException e ) { throw new CitrusRuntimeException ( "Unable to access message creator type: " + type , e ) ; } catch ( InstantiationException e ) { throw new ...
Adds new message creator POJO instance from type .
28,327
private boolean checkAnswer ( String input ) { StringTokenizer tok = new StringTokenizer ( validAnswers , ANSWER_SEPARATOR ) ; while ( tok . hasMoreTokens ( ) ) { if ( tok . nextElement ( ) . toString ( ) . trim ( ) . equalsIgnoreCase ( input . trim ( ) ) ) { return true ; } } log . info ( "User input is not valid - mu...
Validate given input according to valid answer tokens .
28,328
public T message ( Message controlMessage ) { StaticMessageContentBuilder staticMessageContentBuilder = StaticMessageContentBuilder . withMessage ( controlMessage ) ; staticMessageContentBuilder . setMessageHeaders ( getMessageContentBuilder ( ) . getMessageHeaders ( ) ) ; getAction ( ) . setMessageBuilder ( staticMess...
Expect a control message in this receive action .
28,329
protected void setPayload ( String payload ) { MessageContentBuilder messageContentBuilder = getMessageContentBuilder ( ) ; if ( messageContentBuilder instanceof PayloadTemplateMessageBuilder ) { ( ( PayloadTemplateMessageBuilder ) messageContentBuilder ) . setPayloadData ( payload ) ; } else if ( messageContentBuilder...
Sets the payload data on the message builder implementation .
28,330
public T payload ( Resource payloadResource , Charset charset ) { try { setPayload ( FileUtils . readToString ( payloadResource , charset ) ) ; } catch ( IOException e ) { throw new CitrusRuntimeException ( "Failed to read payload resource" , e ) ; } return self ; }
Expect this message payload data in received message .
28,331
public T payload ( Object payload , Marshaller marshaller ) { StringResult result = new StringResult ( ) ; try { marshaller . marshal ( payload , result ) ; } catch ( XmlMappingException e ) { throw new CitrusRuntimeException ( "Failed to marshal object graph for message payload" , e ) ; } catch ( IOException e ) { thr...
Expect this message payload as model object which is marshalled to a character sequence using the default object to xml mapper before validation is performed .
28,332
public T payload ( Object payload , ObjectMapper objectMapper ) { try { setPayload ( objectMapper . writer ( ) . writeValueAsString ( payload ) ) ; } catch ( JsonProcessingException e ) { throw new CitrusRuntimeException ( "Failed to map object graph for message payload" , e ) ; } return self ; }
Expect this message payload as model object which is mapped to a character sequence using the default object to json mapper before validation is performed .
28,333
public T payloadModel ( Object payload ) { Assert . notNull ( applicationContext , "Citrus application context is not initialized!" ) ; if ( ! CollectionUtils . isEmpty ( applicationContext . getBeansOfType ( Marshaller . class ) ) ) { return payload ( payload , applicationContext . getBean ( Marshaller . class ) ) ; }...
Expect this message payload as model object which is marshalled to a character sequence using the default object to xml mapper that is available in Spring bean application context .
28,334
public T header ( String name , Object value ) { getMessageContentBuilder ( ) . getMessageHeaders ( ) . put ( name , value ) ; return self ; }
Expect this message header entry in received message .
28,335
public T headers ( Map < String , Object > headers ) { getMessageContentBuilder ( ) . getMessageHeaders ( ) . putAll ( headers ) ; return self ; }
Expect this message header entries in received message .
28,336
public T headerFragment ( Object model ) { Assert . notNull ( applicationContext , "Citrus application context is not initialized!" ) ; if ( ! CollectionUtils . isEmpty ( applicationContext . getBeansOfType ( Marshaller . class ) ) ) { return headerFragment ( model , applicationContext . getBean ( Marshaller . class ) ...
Expect this message header data as model object which is marshalled to a character sequence using the default object to xml mapper that is available in Spring bean application context .
28,337
public T headerFragment ( Object model , String mapperName ) { Assert . notNull ( applicationContext , "Citrus application context is not initialized!" ) ; if ( applicationContext . containsBean ( mapperName ) ) { Object mapper = applicationContext . getBean ( mapperName ) ; if ( Marshaller . class . isAssignableFrom (...
Expect this message header data as model object which is marshalled to a character sequence using the given object to xml mapper that is accessed by its bean name in Spring bean application context .
28,338
public T headerFragment ( Object model , Marshaller marshaller ) { StringResult result = new StringResult ( ) ; try { marshaller . marshal ( model , result ) ; } catch ( XmlMappingException e ) { throw new CitrusRuntimeException ( "Failed to marshal object graph for message header data" , e ) ; } catch ( IOException e ...
Expect this message header data as model object which is marshalled to a character sequence using the default object to xml mapper before validation is performed .
28,339
public T headerFragment ( Object model , ObjectMapper objectMapper ) { try { return header ( objectMapper . writer ( ) . writeValueAsString ( model ) ) ; } catch ( JsonProcessingException e ) { throw new CitrusRuntimeException ( "Failed to map object graph for message header data" , e ) ; } }
Expect this message header data as model object which is mapped to a character sequence using the default object to json mapper before validation is performed .
28,340
public T header ( Resource resource , Charset charset ) { try { getMessageContentBuilder ( ) . getHeaderData ( ) . add ( FileUtils . readToString ( resource , charset ) ) ; } catch ( IOException e ) { throw new CitrusRuntimeException ( "Failed to read header resource" , e ) ; } return self ; }
Expect this message header data in received message from file resource . Message header data is used in SOAP messages as XML fragment for instance .
28,341
public T validateScript ( Resource scriptResource , Charset charset ) { try { validateScript ( FileUtils . readToString ( scriptResource , charset ) ) ; } catch ( IOException e ) { throw new CitrusRuntimeException ( "Failed to read script resource file" , e ) ; } return self ; }
Reads validation script file resource and sets content as validation script .
28,342
public T messageType ( String messageType ) { this . messageType = messageType ; getAction ( ) . setMessageType ( messageType ) ; if ( getAction ( ) . getValidationContexts ( ) . isEmpty ( ) ) { getAction ( ) . getValidationContexts ( ) . add ( headerValidationContext ) ; getAction ( ) . getValidationContexts ( ) . add...
Sets a explicit message type for this receive action .
28,343
public T validateNamespace ( String prefix , String namespaceUri ) { xmlMessageValidationContext . getControlNamespaces ( ) . put ( prefix , namespaceUri ) ; return self ; }
Validates XML namespace with prefix and uri .
28,344
public T validate ( String path , Object controlValue ) { if ( JsonPathMessageValidationContext . isJsonPathExpression ( path ) ) { getJsonPathValidationContext ( ) . getJsonPathExpressions ( ) . put ( path , controlValue ) ; } else { getXPathValidationContext ( ) . getXpathExpressions ( ) . put ( path , controlValue )...
Adds message element validation .
28,345
public T ignore ( String path ) { if ( messageType . equalsIgnoreCase ( MessageType . XML . name ( ) ) || messageType . equalsIgnoreCase ( MessageType . XHTML . name ( ) ) ) { xmlMessageValidationContext . getIgnoreExpressions ( ) . add ( path ) ; } else if ( messageType . equalsIgnoreCase ( MessageType . JSON . name (...
Adds ignore path expression for message element .
28,346
public T xpath ( String xPathExpression , Object controlValue ) { validate ( xPathExpression , controlValue ) ; return self ; }
Adds XPath message element validation .
28,347
public T jsonPath ( String jsonPathExpression , Object controlValue ) { validate ( jsonPathExpression , controlValue ) ; return self ; }
Adds JsonPath message element validation .
28,348
public T namespace ( String prefix , String namespaceUri ) { getXpathVariableExtractor ( ) . getNamespaces ( ) . put ( prefix , namespaceUri ) ; xmlMessageValidationContext . getNamespaces ( ) . put ( prefix , namespaceUri ) ; return self ; }
Adds explicit namespace declaration for later path validation expressions .
28,349
public T namespaces ( Map < String , String > namespaceMappings ) { getXpathVariableExtractor ( ) . getNamespaces ( ) . putAll ( namespaceMappings ) ; xmlMessageValidationContext . getNamespaces ( ) . putAll ( namespaceMappings ) ; return self ; }
Sets default namespace declarations on this action builder .
28,350
public T selector ( Map < String , Object > messageSelector ) { getAction ( ) . setMessageSelectorMap ( messageSelector ) ; return self ; }
Sets message selector elements .
28,351
public T validator ( MessageValidator < ? extends ValidationContext > ... validators ) { Stream . of ( validators ) . forEach ( getAction ( ) :: addValidator ) ; return self ; }
Sets explicit message validators for this receive action .
28,352
@ SuppressWarnings ( "unchecked" ) public T validator ( String ... validatorNames ) { Assert . notNull ( applicationContext , "Citrus application context is not initialized!" ) ; for ( String validatorName : validatorNames ) { getAction ( ) . addValidator ( applicationContext . getBean ( validatorName , MessageValidato...
Sets explicit message validators by name .
28,353
public T headerValidator ( HeaderValidator ... validators ) { Stream . of ( validators ) . forEach ( headerValidationContext :: addHeaderValidator ) ; return self ; }
Sets explicit header validator for this receive action .
28,354
@ SuppressWarnings ( "unchecked" ) public T headerValidator ( String ... validatorNames ) { Assert . notNull ( applicationContext , "Citrus application context is not initialized!" ) ; for ( String validatorName : validatorNames ) { headerValidationContext . addHeaderValidator ( applicationContext . getBean ( validator...
Sets explicit header validators by name .
28,355
@ SuppressWarnings ( "unchecked" ) public T dictionary ( String dictionaryName ) { Assert . notNull ( applicationContext , "Citrus application context is not initialized!" ) ; DataDictionary dictionary = applicationContext . getBean ( dictionaryName , DataDictionary . class ) ; getAction ( ) . setDataDictionary ( dicti...
Sets explicit data dictionary by name .
28,356
public T extractFromHeader ( String headerName , String variable ) { if ( headerExtractor == null ) { headerExtractor = new MessageHeaderVariableExtractor ( ) ; getAction ( ) . getVariableExtractors ( ) . add ( headerExtractor ) ; } headerExtractor . getHeaderMappings ( ) . put ( headerName , variable ) ; return self ;...
Extract message header entry as variable .
28,357
public T extractFromPayload ( String path , String variable ) { if ( JsonPathMessageValidationContext . isJsonPathExpression ( path ) ) { getJsonPathVariableExtractor ( ) . getJsonPathExpressions ( ) . put ( path , variable ) ; } else { getXpathVariableExtractor ( ) . getXpathExpressions ( ) . put ( path , variable ) ;...
Extract message element via XPath or JSONPath from message payload as new test variable .
28,358
public T validationCallback ( ValidationCallback callback ) { if ( callback instanceof ApplicationContextAware ) { ( ( ApplicationContextAware ) callback ) . setApplicationContext ( applicationContext ) ; } getAction ( ) . setValidationCallback ( callback ) ; return self ; }
Adds validation callback to the receive action for validating the received message with Java code .
28,359
protected AbstractMessageContentBuilder getMessageContentBuilder ( ) { if ( getAction ( ) . getMessageBuilder ( ) != null && getAction ( ) . getMessageBuilder ( ) instanceof AbstractMessageContentBuilder ) { return ( AbstractMessageContentBuilder ) getAction ( ) . getMessageBuilder ( ) ; } else { PayloadTemplateMessage...
Get message builder if already registered or create a new message builder and register it
28,360
private XpathMessageValidationContext getXPathValidationContext ( ) { if ( xmlMessageValidationContext instanceof XpathMessageValidationContext ) { return ( ( XpathMessageValidationContext ) xmlMessageValidationContext ) ; } else { XpathMessageValidationContext xPathContext = new XpathMessageValidationContext ( ) ; xPa...
Gets the validation context as XML validation context an raises exception if existing validation context is not a XML validation context .
28,361
private ScriptValidationContext getScriptValidationContext ( ) { if ( scriptValidationContext == null ) { scriptValidationContext = new ScriptValidationContext ( messageType . toString ( ) ) ; getAction ( ) . getValidationContexts ( ) . add ( scriptValidationContext ) ; } return scriptValidationContext ; }
Creates new script validation context if not done before and gets the script validation context .
28,362
private JsonPathMessageValidationContext getJsonPathValidationContext ( ) { if ( jsonPathValidationContext == null ) { jsonPathValidationContext = new JsonPathMessageValidationContext ( ) ; getAction ( ) . getValidationContexts ( ) . add ( jsonPathValidationContext ) ; } return jsonPathValidationContext ; }
Creates new JSONPath validation context if not done before and gets the validation context .
28,363
protected List < ValidationContext > parseValidationContexts ( Element messageElement , BeanDefinitionBuilder builder ) { List < ValidationContext > validationContexts = new ArrayList < > ( ) ; if ( messageElement != null ) { String messageType = messageElement . getAttribute ( "type" ) ; if ( ! StringUtils . hasText (...
Parse message validation contexts .
28,364
protected List < VariableExtractor > getVariableExtractors ( Element element ) { List < VariableExtractor > variableExtractors = new ArrayList < > ( ) ; parseExtractHeaderElements ( element , variableExtractors ) ; Element extractElement = DomUtils . getChildElementByTagName ( element , "extract" ) ; if ( extractElemen...
Constructs a list of variable extractors .
28,365
private JsonMessageValidationContext getJsonMessageValidationContext ( Element messageElement ) { JsonMessageValidationContext context = new JsonMessageValidationContext ( ) ; if ( messageElement != null ) { Set < String > ignoreExpressions = new HashSet < String > ( ) ; List < ? > ignoreElements = DomUtils . getChildE...
Construct the basic Json message validation context .
28,366
private XmlMessageValidationContext getXmlMessageValidationContext ( Element messageElement ) { XmlMessageValidationContext context = new XmlMessageValidationContext ( ) ; if ( messageElement != null ) { addSchemaInformationToValidationContext ( messageElement , context ) ; Set < String > ignoreExpressions = new HashSe...
Construct the basic Xml message validation context .
28,367
private void addSchemaInformationToValidationContext ( Element messageElement , SchemaValidationContext context ) { String schemaValidation = messageElement . getAttribute ( "schema-validation" ) ; if ( StringUtils . hasText ( schemaValidation ) ) { context . setSchemaValidation ( Boolean . valueOf ( schemaValidation )...
Adds information about the validation of the message against a certain schema to the context
28,368
private XpathMessageValidationContext getXPathMessageValidationContext ( Element messageElement , XmlMessageValidationContext parentContext ) { XpathMessageValidationContext context = new XpathMessageValidationContext ( ) ; parseXPathValidationElements ( messageElement , context ) ; context . setControlNamespaces ( par...
Construct the XPath message validation context .
28,369
private JsonPathMessageValidationContext getJsonPathMessageValidationContext ( Element messageElement ) { JsonPathMessageValidationContext context = new JsonPathMessageValidationContext ( ) ; Map < String , Object > validateJsonPathExpressions = new HashMap < > ( ) ; List < ? > validateElements = DomUtils . getChildEle...
Construct the JSONPath message validation context .
28,370
private ScriptValidationContext getScriptValidationContext ( Element messageElement , String messageType ) { ScriptValidationContext context = null ; boolean done = false ; List < ? > validateElements = DomUtils . getChildElementsByTagName ( messageElement , "validate" ) ; if ( validateElements . size ( ) > 0 ) { for (...
Construct the message validation context .
28,371
private void extractXPathValidateExpressions ( Element validateElement , Map < String , Object > validateXpathExpressions ) { String pathExpression = validateElement . getAttribute ( "path" ) ; if ( StringUtils . hasText ( pathExpression ) && ! JsonPathMessageValidationContext . isJsonPathExpression ( pathExpression ) ...
Extracts xpath validation expressions and fills map with them
28,372
private void extractJsonPathValidateExpressions ( Element validateElement , Map < String , Object > validateJsonPathExpressions ) { String pathExpression = validateElement . getAttribute ( "path" ) ; if ( JsonPathMessageValidationContext . isJsonPathExpression ( pathExpression ) ) { validateJsonPathExpressions . put ( ...
Extracts jsonPath validation expressions and fills map with them
28,373
protected void addImportedSchemas ( Schema schema ) throws WSDLException , IOException , TransformerException , TransformerFactoryConfigurationError { for ( Object imports : schema . getImports ( ) . values ( ) ) { for ( SchemaImport schemaImport : ( Vector < SchemaImport > ) imports ) { if ( ! importedSchemas . contai...
Recursively add all imported schemas as schema resource . This is necessary when schema import are located in jar files . If they are not added immediately the reference to them is lost .
28,374
protected void addIncludedSchemas ( Schema schema ) throws WSDLException , IOException , TransformerException , TransformerFactoryConfigurationError { List < SchemaReference > includes = schema . getIncludes ( ) ; for ( SchemaReference schemaReference : includes ) { String schemaLocation ; URI locationURI = URI . creat...
Recursively add all included schemas as schema resource .
28,375
public NamespaceContext buildContext ( Message receivedMessage , Map < String , String > namespaces ) { SimpleNamespaceContext simpleNamespaceContext = new SimpleNamespaceContext ( ) ; if ( namespaceMappings . size ( ) > 0 ) { simpleNamespaceContext . setBindings ( namespaceMappings ) ; } Map < String , String > dynami...
Construct a basic namespace context from the received message and explicit namespace mappings .
28,376
public void addMessageSelectorFactory ( MessageSelectorFactory < ? > factory ) { if ( factory instanceof BeanFactoryAware ) { ( ( BeanFactoryAware ) factory ) . setBeanFactory ( beanFactory ) ; } this . factories . add ( factory ) ; }
Add message selector factory to list of delegates .
28,377
public static void resolveValidationMatcher ( String fieldName , String fieldValue , String validationMatcherExpression , TestContext context ) { String expression = VariableUtils . cutOffVariablesPrefix ( cutOffValidationMatchersPrefix ( validationMatcherExpression ) ) ; if ( expression . equals ( "ignore" ) ) { expre...
This method resolves a custom validationMatcher to its respective result .
28,378
public static boolean isValidationMatcherExpression ( String expression ) { return expression . startsWith ( Citrus . VALIDATION_MATCHER_PREFIX ) && expression . endsWith ( Citrus . VALIDATION_MATCHER_SUFFIX ) ; }
Checks if expression is a validation matcher expression .
28,379
private static String cutOffValidationMatchersPrefix ( String expression ) { if ( expression . startsWith ( Citrus . VALIDATION_MATCHER_PREFIX ) && expression . endsWith ( Citrus . VALIDATION_MATCHER_SUFFIX ) ) { return expression . substring ( Citrus . VALIDATION_MATCHER_PREFIX . length ( ) , expression . length ( ) -...
Cut off validation matchers prefix and suffix .
28,380
public BeanInvocation sayHello ( String message ) { BeanInvocation invocation = new BeanInvocation ( ) ; try { invocation . setMethod ( HelloService . class . getMethod ( "sayHello" , String . class ) ) ; invocation . setArgs ( new Object [ ] { message } ) ; } catch ( NoSuchMethodException e ) { throw new CitrusRuntime...
Creates bean invocation for hello service call .
28,381
public void apply ( CitrusAppConfiguration configuration ) { setPackages ( configuration . getPackages ( ) ) ; setTestClasses ( configuration . getTestClasses ( ) ) ; setIncludes ( configuration . getIncludes ( ) ) ; addDefaultProperties ( configuration . getDefaultProperties ( ) ) ; }
Applies configuration with settable properties at runtime .
28,382
public static String getRandomString ( int numberOfLetters , char [ ] alphabet , boolean includeNumbers ) { StringBuilder builder = new StringBuilder ( ) ; int upperRange = alphabet . length - 1 ; builder . append ( alphabet [ generator . nextInt ( upperRange ) ] ) ; if ( includeNumbers ) { upperRange += NUMBERS . leng...
Static random number generator aware string generating method .
28,383
public ValidationMatcher getValidationMatcher ( String validationMatcherName ) throws NoSuchValidationMatcherException { if ( ! members . containsKey ( validationMatcherName ) ) { throw new NoSuchValidationMatcherException ( "Can not find validation matcher " + validationMatcherName + " in library " + name + " (" + pre...
Try to find validationMatcher in library by name .
28,384
public boolean knowsValidationMatcher ( String validationMatcherName ) { if ( validationMatcherName . contains ( ":" ) ) { String validationMatcherPrefix = validationMatcherName . substring ( 0 , validationMatcherName . indexOf ( ':' ) + 1 ) ; if ( ! validationMatcherPrefix . equals ( prefix ) ) { return false ; } retu...
Does this library know a validationMatcher with the given name .
28,385
private boolean containsNumericMatcher ( String matcherExpression ) { for ( String numericMatcher : numericMatchers ) { if ( matcherExpression . contains ( numericMatcher ) ) { return true ; } } return false ; }
Checks for numeric matcher presence in expression .
28,386
private WebSocketMessage < ? > receive ( WebSocketEndpointConfiguration config , long timeout ) { long timeLeft = timeout ; WebSocketMessage < ? > message = config . getHandler ( ) . getMessage ( ) ; String path = endpointConfiguration . getEndpointUri ( ) ; while ( message == null && timeLeft > 0 ) { timeLeft -= endpo...
Receive web socket message by polling on web socket handler for incoming message .
28,387
private Stack < String > parseTargets ( ) { Stack < String > stack = new Stack < String > ( ) ; String [ ] targetTokens = targets . split ( "," ) ; for ( String targetToken : targetTokens ) { stack . add ( targetToken . trim ( ) ) ; } return stack ; }
Converts comma delimited string to stack .
28,388
private void loadBuildPropertyFile ( Project project , TestContext context ) { if ( StringUtils . hasText ( propertyFilePath ) ) { String propertyFileResource = context . replaceDynamicContentInString ( propertyFilePath ) ; log . info ( "Reading build property file: " + propertyFileResource ) ; Properties filePropertie...
Loads build properties from file resource and adds them to ANT project .
28,389
public static String build ( String messageSelector , Map < String , Object > messageSelectorMap , TestContext context ) { if ( StringUtils . hasText ( messageSelector ) ) { return context . replaceDynamicContentInString ( messageSelector ) ; } else if ( ! CollectionUtils . isEmpty ( messageSelectorMap ) ) { return Mes...
Build message selector from string expression or from key value map . Automatically replaces test variables .
28,390
public static MessageSelectorBuilder fromKeyValueMap ( Map < String , Object > valueMap ) { StringBuffer buf = new StringBuffer ( ) ; Iterator < Entry < String , Object > > iter = valueMap . entrySet ( ) . iterator ( ) ; if ( iter . hasNext ( ) ) { Entry < String , Object > entry = iter . next ( ) ; String key = entry ...
Static builder method using a key value map .
28,391
public Map < String , String > toKeyValueMap ( ) { Map < String , String > valueMap = new HashMap < String , String > ( ) ; String [ ] tokens ; if ( selectorString . contains ( " AND" ) ) { String [ ] chunks = selectorString . split ( " AND" ) ; for ( String chunk : chunks ) { tokens = escapeEqualsFromXpathNodeTest ( c...
Constructs a key value map from selector string representation .
28,392
private void doAutoSleep ( ) { if ( autoSleep > 0 ) { log . info ( "Sleeping " + autoSleep + " milliseconds" ) ; try { Thread . sleep ( autoSleep ) ; } catch ( InterruptedException e ) { log . error ( "Error during doc generation" , e ) ; } log . info ( "Returning after " + autoSleep + " milliseconds" ) ; } }
Sleep amount of time in between iterations .
28,393
private void send ( Message message , String destinationName , TestContext context ) { if ( log . isDebugEnabled ( ) ) { log . debug ( "Sending JMS message to destination: '" + destinationName + "'" ) ; } endpointConfiguration . getJmsTemplate ( ) . send ( destinationName , session -> { javax . jms . Message jmsMessage...
Send message using destination name .
28,394
private void send ( Message message , Destination destination , TestContext context ) { if ( log . isDebugEnabled ( ) ) { log . debug ( "Sending JMS message to destination: '" + endpointConfiguration . getDestinationName ( destination ) + "'" ) ; } endpointConfiguration . getJmsTemplate ( ) . send ( destination , sessi...
Send message using destination .
28,395
protected void configureMessageController ( ApplicationContext context ) { if ( context . containsBean ( MESSAGE_CONTROLLER_BEAN_NAME ) ) { HttpMessageController messageController = context . getBean ( MESSAGE_CONTROLLER_BEAN_NAME , HttpMessageController . class ) ; EndpointAdapter endpointAdapter = httpServer . getEnd...
Post process message controller .
28,396
protected void configureMessageConverter ( ApplicationContext context ) { if ( context . containsBean ( MESSAGE_CONVERTER_BEAN_NAME ) ) { HttpMessageConverter messageConverter = context . getBean ( MESSAGE_CONVERTER_BEAN_NAME , HttpMessageConverter . class ) ; if ( messageConverter instanceof DelegatingHttpEntityMessag...
Post process message converter .
28,397
private List < HandlerInterceptor > adaptInterceptors ( List < Object > interceptors , ApplicationContext context ) { List < HandlerInterceptor > handlerInterceptors = new ArrayList < HandlerInterceptor > ( ) ; if ( context . containsBean ( LOGGING_INTERCEPTOR_BEAN_NAME ) ) { LoggingHandlerInterceptor loggingIntercepto...
Adapts object list to handler interceptors .
28,398
public TransformActionBuilder source ( Resource xmlResource , Charset charset ) { try { action . setXmlData ( FileUtils . readToString ( xmlResource , charset ) ) ; } catch ( IOException e ) { throw new CitrusRuntimeException ( "Failed to read xml resource" , e ) ; } return this ; }
Set the XML document as resource
28,399
public TransformActionBuilder xslt ( Resource xsltResource , Charset charset ) { try { action . setXsltData ( FileUtils . readToString ( xsltResource , charset ) ) ; } catch ( IOException e ) { throw new CitrusRuntimeException ( "Failed to read xstl resource" , e ) ; } return this ; }
Set the XSLT document as resource