idx
int64
0
41.2k
question
stringlengths
74
4.04k
target
stringlengths
7
750
28,200
public Endpoint getOrCreateEndpoint ( TestContext context ) { if ( endpoint != null ) { return endpoint ; } else if ( StringUtils . hasText ( endpointUri ) ) { endpoint = context . getEndpointFactory ( ) . create ( endpointUri , context ) ; return endpoint ; } else { throw new CitrusRuntimeException ( "Neither endpoint...
Creates or gets the endpoint instance .
28,201
public boolean shouldExecute ( String suiteName , String [ ] includedGroups ) { String baseErrorMessage = "Suite container restrictions did not match %s - do not execute container '%s'" ; if ( StringUtils . hasText ( suiteName ) && ! CollectionUtils . isEmpty ( suiteNames ) && ! suiteNames . contains ( suiteName ) ) { ...
Checks if this suite actions should execute according to suite name and included test groups .
28,202
public CamelControlBusActionBuilder route ( String id , String action ) { super . action . setRouteId ( id ) ; super . action . setAction ( action ) ; return this ; }
Sets route action to execute .
28,203
public CamelControlBusActionBuilder language ( String language , String expression ) { action . setLanguageType ( language ) ; action . setLanguageExpression ( expression ) ; return this ; }
Sets a language expression to execute .
28,204
public void handleRequest ( String request ) { if ( messageListener != null ) { log . debug ( "Received Http request" ) ; messageListener . onInboundMessage ( new RawMessage ( request ) , null ) ; } else { if ( log . isDebugEnabled ( ) ) { log . debug ( "Received Http request:" + NEWLINE + request ) ; } } }
Handle request message and write request to logger .
28,205
public void handleResponse ( String response ) { if ( messageListener != null ) { log . debug ( "Sending Http response" ) ; messageListener . onOutboundMessage ( new RawMessage ( response ) , null ) ; } else { if ( log . isDebugEnabled ( ) ) { log . debug ( "Sending Http response:" + NEWLINE + response ) ; } } }
Handle response message and write content to logger .
28,206
private String getRequestContent ( HttpServletRequest request ) throws IOException { StringBuilder builder = new StringBuilder ( ) ; builder . append ( request . getProtocol ( ) ) ; builder . append ( " " ) ; builder . append ( request . getMethod ( ) ) ; builder . append ( " " ) ; builder . append ( request . getReque...
Builds raw request message content from Http servlet request .
28,207
private javax . jms . Message receive ( String destinationName , String selector ) { javax . jms . Message receivedJmsMessage ; if ( log . isDebugEnabled ( ) ) { log . debug ( "Receiving JMS message on destination: '" + destinationName + ( StringUtils . hasText ( selector ) ? "(" + selector + ")" : "" ) + "'" ) ; } if ...
Receive message from destination name .
28,208
private javax . jms . Message receive ( Destination destination , String selector ) { javax . jms . Message receivedJmsMessage ; if ( log . isDebugEnabled ( ) ) { log . debug ( "Receiving JMS message on destination: '" + endpointConfiguration . getDestinationName ( destination ) + ( StringUtils . hasText ( selector ) ?...
Receive message from destination .
28,209
public String convert ( String messagePayload ) { initialize ( ) ; if ( messagePayload . contains ( XHTML_DOCTYPE_DEFINITION ) ) { return messagePayload ; } else { String xhtmlPayload ; StringWriter xhtmlWriter = new StringWriter ( ) ; tidyInstance . parse ( new StringReader ( messagePayload ) , xhtmlWriter ) ; xhtmlPa...
Converts message to XHTML conform representation .
28,210
public void initialize ( ) { try { if ( tidyInstance == null ) { tidyInstance = new Tidy ( ) ; tidyInstance . setXHTML ( true ) ; tidyInstance . setShowWarnings ( false ) ; tidyInstance . setQuiet ( true ) ; tidyInstance . setEscapeCdata ( true ) ; tidyInstance . setTidyMark ( false ) ; if ( tidyConfiguration != null )...
Initialize tidy from configuration .
28,211
public void start ( ) { if ( kafkaServer != null ) { log . warn ( "Found instance of Kafka server - avoid duplicate Kafka server startup" ) ; return ; } File logDir = createLogDir ( ) ; zookeeper = createZookeeperServer ( logDir ) ; serverFactory = createServerFactory ( ) ; try { serverFactory . startup ( zookeeper ) ;...
Start embedded server instances for Kafka and Zookeeper .
28,212
public void stop ( ) { if ( kafkaServer != null ) { try { if ( kafkaServer . brokerState ( ) . currentState ( ) != ( NotRunning . state ( ) ) ) { kafkaServer . shutdown ( ) ; kafkaServer . awaitShutdown ( ) ; } } catch ( Exception e ) { log . warn ( "Failed to shutdown Kafka embedded server" , e ) ; } try { CoreUtils ....
Shutdown embedded Kafka and Zookeeper server instances
28,213
protected ZooKeeperServer createZookeeperServer ( File logDir ) { try { return new ZooKeeperServer ( logDir , logDir , 2000 ) ; } catch ( IOException e ) { throw new CitrusRuntimeException ( "Failed to create embedded zookeeper server" , e ) ; } }
Creates new embedded Zookeeper server .
28,214
protected File createLogDir ( ) { File logDir = Optional . ofNullable ( logDirPath ) . map ( Paths :: get ) . map ( Path :: toFile ) . orElse ( new File ( System . getProperty ( "java.io.tmpdir" ) ) ) ; if ( ! logDir . exists ( ) ) { if ( ! logDir . mkdirs ( ) ) { log . warn ( "Unable to create log directory: " + logDi...
Creates Zookeeper log directory . By default logs are created in Java temp directory . By default directory is automatically deleted on exit .
28,215
protected ServerCnxnFactory createServerFactory ( ) { try { ServerCnxnFactory serverFactory = new NIOServerCnxnFactory ( ) ; serverFactory . configure ( new InetSocketAddress ( zookeeperPort ) , 5000 ) ; return serverFactory ; } catch ( IOException e ) { throw new CitrusRuntimeException ( "Failed to create default zook...
Create server factory for embedded Zookeeper server instance .
28,216
protected void createKafkaTopics ( Set < String > topics ) { Map < String , Object > adminConfigs = new HashMap < > ( ) ; adminConfigs . put ( AdminClientConfig . BOOTSTRAP_SERVERS_CONFIG , "localhost:" + kafkaServerPort ) ; try ( AdminClient admin = AdminClient . create ( adminConfigs ) ) { List < NewTopic > newTopics...
Create topics on embedded Kafka server .
28,217
protected Properties createBrokerProperties ( String zooKeeperConnect , int kafkaServerPort , File logDir ) { Properties props = new Properties ( ) ; props . put ( KafkaConfig . BrokerIdProp ( ) , "0" ) ; props . put ( KafkaConfig . ZkConnectProp ( ) , zooKeeperConnect ) ; props . put ( KafkaConfig . ZkConnectionTimeou...
Creates Kafka broker properties .
28,218
public void doWithMessage ( WebServiceMessage responseMessage ) throws IOException , TransformerException { response = endpointConfiguration . getMessageConverter ( ) . convertInbound ( responseMessage , endpointConfiguration , context ) ; }
Callback method called with actual web service response message . Method constructs a Spring Integration message from this web service message for further processing .
28,219
public void saveReplyDestination ( Message receivedMessage , TestContext context ) { if ( receivedMessage . getHeader ( CitrusVertxMessageHeaders . VERTX_REPLY_ADDRESS ) != null ) { String correlationKeyName = endpointConfiguration . getCorrelator ( ) . getCorrelationKeyName ( getName ( ) ) ; String correlationKey = en...
Store the reply address either straight forward or with a given message correlation key .
28,220
private ZooKeeper createZooKeeperClient ( ) throws IOException { ZooClientConfig config = getZookeeperClientConfig ( ) ; return new ZooKeeper ( config . getUrl ( ) , config . getTimeout ( ) , getConnectionWatcher ( ) ) ; }
Creates a new Zookeeper client instance with configuration .
28,221
public ZooKeeper getZooKeeperClient ( ) { if ( zookeeper == null ) { try { zookeeper = createZooKeeperClient ( ) ; int retryAttempts = 5 ; while ( ! zookeeper . getState ( ) . isConnected ( ) && retryAttempts > 0 ) { LOG . debug ( "connecting..." ) ; retryAttempts -- ; Thread . sleep ( 1000 ) ; } } catch ( IOException ...
Constructs or gets the zookeeper client implementation .
28,222
private void loadEndpointComponentProperties ( ) { try { endpointComponentProperties = PropertiesLoaderUtils . loadProperties ( new ClassPathResource ( "com/consol/citrus/endpoint/endpoint.components" ) ) ; } catch ( IOException e ) { log . warn ( "Unable to laod default endpoint components from resource '%s'" , e ) ; ...
Loads property file from classpath holding default endpoint component definitions in Citrus .
28,223
private void loadEndpointParserProperties ( ) { try { endpointParserProperties = PropertiesLoaderUtils . loadProperties ( new ClassPathResource ( "com/consol/citrus/endpoint/endpoint.parser" ) ) ; } catch ( IOException e ) { log . warn ( "Unable to laod default endpoint annotation parsers from resource '%s'" , e ) ; } ...
Loads property file from classpath holding default endpoint annotation parser definitions in Citrus .
28,224
public void setAction ( String action ) { try { this . action = new URI ( action ) ; } catch ( URISyntaxException e ) { throw new CitrusRuntimeException ( "Invalid action uri" , e ) ; } }
Sets the action from uri string .
28,225
public void setTo ( String to ) { try { this . to = new URI ( to ) ; } catch ( URISyntaxException e ) { throw new CitrusRuntimeException ( "Invalid to uri" , e ) ; } }
Sets the to uri by string .
28,226
public void setMessageId ( String messageId ) { try { this . messageId = new URI ( messageId ) ; } catch ( URISyntaxException e ) { throw new CitrusRuntimeException ( "Invalid messageId uri" , e ) ; } }
Sets the message id from uri string .
28,227
public void setFrom ( String from ) { try { this . from = new EndpointReference ( new URI ( from ) ) ; } catch ( URISyntaxException e ) { throw new CitrusRuntimeException ( "Invalid from uri" , e ) ; } }
Sets the from endpoint reference by string .
28,228
public void setReplyTo ( String replyTo ) { try { this . replyTo = new EndpointReference ( new URI ( replyTo ) ) ; } catch ( URISyntaxException e ) { throw new CitrusRuntimeException ( "Invalid replyTo uri" , e ) ; } }
Sets the reply to endpoint reference by string .
28,229
public void setFaultTo ( String faultTo ) { try { this . faultTo = new EndpointReference ( new URI ( faultTo ) ) ; } catch ( URISyntaxException e ) { throw new CitrusRuntimeException ( "Invalid faultTo uri" , e ) ; } }
Sets the fault to endpoint reference by string .
28,230
private void createHtmlDoc ( ) throws PrompterException { HtmlDocConfiguration configuration = new HtmlDocConfiguration ( ) ; String heading = prompter . prompt ( "Enter overview title:" , configuration . getHeading ( ) ) ; String columns = prompter . prompt ( "Enter number of columns in overview:" , configuration . ge...
Create HTML documentation in interactive mode .
28,231
private void createExcelDoc ( ) throws PrompterException { ExcelDocConfiguration configuration = new ExcelDocConfiguration ( ) ; String company = prompter . prompt ( "Enter company:" , configuration . getCompany ( ) ) ; String author = prompter . prompt ( "Enter author:" , configuration . getAuthor ( ) ) ; String pageT...
Create Excel documentation in interactive mode .
28,232
public static String changeDate ( String date , String dateOffset , String dateFormat , TestContext context ) { return new ChangeDateFunction ( ) . execute ( Arrays . asList ( date , dateOffset , dateFormat ) , context ) ; }
Runs change date function with arguments .
28,233
public static String createCDataSection ( String content , TestContext context ) { return new CreateCDataSectionFunction ( ) . execute ( Collections . singletonList ( content ) , context ) ; }
Runs create CData section function with arguments .
28,234
public static String digestAuthHeader ( String username , String password , String realm , String noncekey , String method , String uri , String opaque , String algorithm , TestContext context ) { return new DigestAuthHeaderFunction ( ) . execute ( Arrays . asList ( username , password , realm , noncekey , method , uri...
Runs create digest auth header function with arguments .
28,235
public static String randomUUID ( TestContext context ) { return new RandomUUIDFunction ( ) . execute ( Collections . < String > emptyList ( ) , context ) ; }
Runs random UUID function with arguments .
28,236
public static String escapeXml ( String content , TestContext context ) { return new EscapeXmlFunction ( ) . execute ( Collections . singletonList ( content ) , context ) ; }
Runs escape XML function with arguments .
28,237
public static String readFile ( String filePath , TestContext context ) { return new ReadFileResourceFunction ( ) . execute ( Collections . singletonList ( filePath ) , context ) ; }
Reads the file resource and returns the complete file content .
28,238
public static void parseJsonPathElements ( Element validateElement , Map < String , Object > validateJsonPathExpressions ) { List < ? > jsonPathElements = DomUtils . getChildElementsByTagName ( validateElement , "json-path" ) ; if ( jsonPathElements . size ( ) > 0 ) { for ( Iterator < ? > jsonPathIterator = jsonPathEle...
Parses validate element containing nested json - path elements .
28,239
public static String readToString ( Resource resource , Charset charset ) throws IOException { if ( simulationMode ) { if ( resource instanceof ClassPathResource ) { return ( ( ClassPathResource ) resource ) . getPath ( ) ; } else if ( resource instanceof FileSystemResource ) { return ( ( FileSystemResource ) resource ...
Read file resource to string value .
28,240
public static String readToString ( InputStream inputStream , Charset charset ) throws IOException { return new String ( FileCopyUtils . copyToByteArray ( inputStream ) , charset ) ; }
Read file input stream to string value .
28,241
public static void writeToFile ( InputStream inputStream , File file ) { try ( InputStreamReader inputStreamReader = new InputStreamReader ( inputStream ) ) { writeToFile ( FileCopyUtils . copyToString ( inputStreamReader ) , file , getDefaultCharset ( ) ) ; } catch ( IOException e ) { throw new CitrusRuntimeException ...
Writes inputStream content to file . Uses default charset encoding .
28,242
public static void writeToFile ( String content , File file , Charset charset ) { if ( log . isDebugEnabled ( ) ) { log . debug ( String . format ( "Writing file resource: '%s' (encoding is '%s')" , file . getName ( ) , charset . displayName ( ) ) ) ; } if ( ! file . getParentFile ( ) . exists ( ) ) { if ( ! file . get...
Writes String content to file with given charset encoding . Automatically closes file output streams when done .
28,243
public static List < File > findFiles ( final String startDir , final Set < String > fileNamePatterns ) { final List < File > files = new ArrayList < File > ( ) ; final Stack < File > dirs = new Stack < File > ( ) ; final File startdir = new File ( startDir ) ; if ( ! startdir . exists ( ) ) { throw new CitrusRuntimeEx...
Method to retrieve all files with given file name pattern in given directory . Hierarchy of folders is supported .
28,244
@ SuppressWarnings ( "unchecked" ) public static ClientServerEndpointBuilder < DockerClientBuilder , DockerClientBuilder > docker ( ) { return new ClientServerEndpointBuilder ( new DockerClientBuilder ( ) , new DockerClientBuilder ( ) ) { public EndpointBuilder < ? extends Endpoint > server ( ) { throw new UnsupportedO...
Creates new DockerClient builder .
28,245
@ SuppressWarnings ( "unchecked" ) public static ClientServerEndpointBuilder < KubernetesClientBuilder , KubernetesClientBuilder > kubernetes ( ) { return new ClientServerEndpointBuilder ( new KubernetesClientBuilder ( ) , new KubernetesClientBuilder ( ) ) { public EndpointBuilder < ? extends Endpoint > server ( ) { th...
Creates new KubernetesClient builder .
28,246
protected void validateFaultDetailString ( String receivedDetailString , String controlDetailString , TestContext context , ValidationContext validationContext ) throws ValidationException { XmlMessageValidationContext xmlMessageValidationContext ; if ( validationContext instanceof XmlMessageValidationContext ) { xmlMe...
Delegates to XML message validator for validation of fault detail .
28,247
public void start ( ) { if ( ! isStarted ( ) ) { if ( getEndpointConfiguration ( ) . getWebDriver ( ) != null ) { webDriver = getEndpointConfiguration ( ) . getWebDriver ( ) ; } else if ( StringUtils . hasText ( getEndpointConfiguration ( ) . getRemoteServerUrl ( ) ) ) { webDriver = createRemoteWebDriver ( getEndpointC...
Starts the browser and create local or remote web driver .
28,248
public void stop ( ) { if ( isStarted ( ) ) { log . info ( "Stopping browser " + webDriver . getCurrentUrl ( ) ) ; try { log . info ( "Trying to close the browser " + webDriver + " ..." ) ; webDriver . quit ( ) ; } catch ( UnreachableBrowserException e ) { log . warn ( "Browser is unreachable" , e ) ; } catch ( WebDriv...
Stop the browser when started .
28,249
public String storeFile ( Resource file ) { try { File newFile = new File ( temporaryStorage . toFile ( ) , file . getFilename ( ) ) ; log . info ( "Store file " + file + " to " + newFile ) ; FileUtils . copyFile ( file . getFile ( ) , newFile ) ; return newFile . getCanonicalPath ( ) ; } catch ( IOException e ) { thro...
Deploy resource object from resource folder and return path of deployed file
28,250
public String getStoredFile ( String filename ) { try { File stored = new File ( temporaryStorage . toFile ( ) , filename ) ; if ( ! stored . exists ( ) ) { throw new CitrusRuntimeException ( "Failed to access stored file: " + stored . getCanonicalPath ( ) ) ; } return stored . getCanonicalPath ( ) ; } catch ( IOExcept...
Retrieve resource object
28,251
private WebDriver createLocalWebDriver ( String browserType ) { switch ( browserType ) { case BrowserType . FIREFOX : FirefoxProfile firefoxProfile = getEndpointConfiguration ( ) . getFirefoxProfile ( ) ; firefoxProfile . setPreference ( "browser.download.dir" , temporaryStorage . toFile ( ) . getAbsolutePath ( ) ) ; D...
Creates local web driver .
28,252
private RemoteWebDriver createRemoteWebDriver ( String browserType , String serverAddress ) { try { switch ( browserType ) { case BrowserType . FIREFOX : DesiredCapabilities defaultsFF = DesiredCapabilities . firefox ( ) ; defaultsFF . setCapability ( FirefoxDriver . PROFILE , getEndpointConfiguration ( ) . getFirefoxP...
Creates remote web driver .
28,253
private Path createTemporaryStorage ( ) { try { Path tempDir = Files . createTempDirectory ( "selenium" ) ; tempDir . toFile ( ) . deleteOnExit ( ) ; log . info ( "Download storage location is: " + tempDir . toString ( ) ) ; return tempDir ; } catch ( IOException e ) { throw new CitrusRuntimeException ( "Could not crea...
Creates temporary storage .
28,254
protected void sendClientRequest ( HttpMessage request ) { BuilderSupport < HttpActionBuilder > action = builder -> { HttpClientActionBuilder . HttpClientSendActionBuilder sendBuilder = builder . client ( httpClient ) . send ( ) ; HttpClientRequestActionBuilder requestBuilder ; if ( request . getRequestMethod ( ) == nu...
Sends client request .
28,255
protected void receiveClientResponse ( HttpMessage response ) { runner . http ( action -> { HttpClientResponseActionBuilder responseBuilder = action . client ( httpClient ) . receive ( ) . response ( response . getStatusCode ( ) ) . message ( response ) ; for ( Map . Entry < String , String > headerEntry : pathValidati...
Receives client response .
28,256
protected void receiveServerRequest ( HttpMessage request ) { BuilderSupport < HttpActionBuilder > action = builder -> { HttpServerActionBuilder . HttpServerReceiveActionBuilder receiveBuilder = builder . server ( httpServer ) . receive ( ) ; HttpServerRequestActionBuilder requestBuilder ; if ( request . getRequestMeth...
Receives server request .
28,257
Cookie [ ] convertCookies ( HttpEntity < ? > httpEntity ) { final List < Cookie > cookies = new LinkedList < > ( ) ; List < String > inboundCookies = httpEntity . getHeaders ( ) . get ( HttpHeaders . SET_COOKIE ) ; if ( inboundCookies != null ) { for ( String cookieString : inboundCookies ) { Cookie cookie = convertCoo...
Converts cookies from a HttpEntity into Cookie objects
28,258
String getCookieString ( Cookie cookie ) { StringBuilder builder = new StringBuilder ( ) ; builder . append ( cookie . getName ( ) ) ; builder . append ( "=" ) ; builder . append ( cookie . getValue ( ) ) ; if ( cookie . getVersion ( ) > 0 ) { builder . append ( ";" + VERSION + "=" ) . append ( cookie . getVersion ( ) ...
Converts a given cookie into a HTTP conform cookie String
28,259
private Cookie convertCookieString ( String cookieString ) { Cookie cookie = new Cookie ( getCookieParam ( NAME , cookieString ) , getCookieParam ( VALUE , cookieString ) ) ; if ( cookieString . contains ( COMMENT ) ) { cookie . setComment ( getCookieParam ( COMMENT , cookieString ) ) ; } if ( cookieString . contains (...
Converts a cookie string from a http header value into a Cookie object
28,260
private String getCookieParam ( String param , String cookieString ) { if ( param . equals ( NAME ) ) { return cookieString . substring ( 0 , cookieString . indexOf ( '=' ) ) ; } if ( param . equals ( VALUE ) ) { if ( cookieString . contains ( ";" ) ) { return cookieString . substring ( cookieString . indexOf ( '=' ) +...
Extract cookie param from cookie string as it was provided by Set - Cookie header .
28,261
protected void parseEndpointConfiguration ( BeanDefinitionBuilder endpointConfigurationBuilder , Element element , ParserContext parserContext ) { BeanDefinitionParserUtils . setPropertyValue ( endpointConfigurationBuilder , element . getAttribute ( "timeout" ) , "timeout" ) ; }
Subclasses can override this parsing method in order to provide proper endpoint configuration bean definition properties .
28,262
public InputActionBuilder answers ( String ... answers ) { if ( answers . length == 0 ) { throw new CitrusRuntimeException ( "Please specify proper answer possibilities for input action" ) ; } StringBuilder validAnswers = new StringBuilder ( ) ; for ( String answer : answers ) { validAnswers . append ( InputAction . AN...
Sets the valid answers .
28,263
public void beforeSuite ( String suiteName , String ... testGroups ) { testSuiteListener . onStart ( ) ; if ( ! CollectionUtils . isEmpty ( beforeSuite ) ) { for ( SequenceBeforeSuite sequenceBeforeSuite : beforeSuite ) { try { if ( sequenceBeforeSuite . shouldExecute ( suiteName , testGroups ) ) { sequenceBeforeSuite ...
Performs before suite test actions .
28,264
public void afterSuite ( String suiteName , String ... testGroups ) { testSuiteListener . onFinish ( ) ; if ( ! CollectionUtils . isEmpty ( afterSuite ) ) { for ( SequenceAfterSuite sequenceAfterSuite : afterSuite ) { try { if ( sequenceAfterSuite . shouldExecute ( suiteName , testGroups ) ) { sequenceAfterSuite . exec...
Performs after suite test actions .
28,265
public JmxMessage attribute ( String name , Object value ) { return attribute ( name , value , value . getClass ( ) ) ; }
Sets attribute for write operation .
28,266
public JmxMessage attribute ( String name , Object value , Class < ? > valueType ) { if ( mbeanInvocation == null ) { throw new CitrusRuntimeException ( "Invalid access to attribute for JMX message" ) ; } ManagedBeanInvocation . Attribute attribute = new ManagedBeanInvocation . Attribute ( ) ; attribute . setName ( nam...
Sets attribute for write operation with custom value type .
28,267
public JmxMessage operation ( String name ) { if ( mbeanInvocation == null ) { throw new CitrusRuntimeException ( "Invalid access to operation for JMX message" ) ; } ManagedBeanInvocation . Operation operation = new ManagedBeanInvocation . Operation ( ) ; operation . setName ( name ) ; mbeanInvocation . setOperation ( ...
Sets operation for read write access .
28,268
public JmxMessage parameter ( Object arg , Class < ? > argType ) { if ( mbeanInvocation == null ) { throw new CitrusRuntimeException ( "Invalid access to operation parameter for JMX message" ) ; } if ( mbeanInvocation . getOperation ( ) == null ) { throw new CitrusRuntimeException ( "Invalid access to operation paramet...
Adds operation parameter with custom parameter type .
28,269
public Message dispatchMessage ( Message request , String mappingKey ) { return mappingStrategy . getEndpointAdapter ( mappingKey ) . handleMessage ( request ) ; }
Consolidate mapping strategy in order to find dispatch incoming request to endpoint adapter according to mapping key that was extracted before from message content .
28,270
protected void enrichEndpointConfiguration ( EndpointConfiguration endpointConfiguration , Map < String , String > parameters , TestContext context ) { for ( Map . Entry < String , String > parameterEntry : parameters . entrySet ( ) ) { Field field = ReflectionUtils . findField ( endpointConfiguration . getClass ( ) , ...
Sets properties on endpoint configuration using method reflection .
28,271
protected Map < String , String > getEndpointConfigurationParameters ( Map < String , String > parameters , Class < ? extends EndpointConfiguration > endpointConfigurationType ) { Map < String , String > params = new HashMap < String , String > ( ) ; for ( Map . Entry < String , String > parameterEntry : parameters . e...
Removes non config parameters from list of endpoint parameters according to given endpoint configuration type . All parameters that do not reside to a endpoint configuration setting are removed so the result is a qualified list of endpoint configuration parameters .
28,272
protected String getParameterString ( Map < String , String > parameters , Class < ? extends EndpointConfiguration > endpointConfigurationType ) { StringBuilder paramString = new StringBuilder ( ) ; for ( Map . Entry < String , String > parameterEntry : parameters . entrySet ( ) ) { Field field = ReflectionUtils . find...
Filters non endpoint configuration parameters from parameter list and puts them together as parameters string . According to given endpoint configuration type only non endpoint configuration settings are added to parameter string .
28,273
private com . github . dockerjava . api . DockerClient createDockerClient ( ) { return DockerClientImpl . getInstance ( getDockerClientConfig ( ) ) . withDockerCmdExecFactory ( new JerseyDockerCmdExecFactory ( ) ) ; }
Creates new Docker client instance with configuration .
28,274
public com . github . dockerjava . api . DockerClient getDockerClient ( ) { if ( dockerClient == null ) { dockerClient = createDockerClient ( ) ; } return dockerClient ; }
Constructs or gets the docker client implementation .
28,275
private void purgeQueue ( String queueName , Session session ) throws JMSException { purgeDestination ( getDestination ( session , queueName ) , session , queueName ) ; }
Purges a queue destination identified by its name .
28,276
private void purgeQueue ( Queue queue , Session session ) throws JMSException { purgeDestination ( queue , session , queue . getQueueName ( ) ) ; }
Purges a queue destination .
28,277
private void purgeDestination ( Destination destination , Session session , String destinationName ) throws JMSException { if ( log . isDebugEnabled ( ) ) { log . debug ( "Try to purge destination " + destinationName ) ; } int messagesPurged = 0 ; MessageConsumer messageConsumer = session . createConsumer ( destination...
Purge destination by receiving all available messages .
28,278
private Destination getDestination ( Session session , String queueName ) throws JMSException { return new DynamicDestinationResolver ( ) . resolveDestinationName ( session , queueName , false ) ; }
Resolves destination by given name .
28,279
protected Connection createConnection ( ) throws JMSException { if ( connectionFactory instanceof QueueConnectionFactory ) { return ( ( QueueConnectionFactory ) connectionFactory ) . createQueueConnection ( ) ; } return connectionFactory . createConnection ( ) ; }
Create queue connection .
28,280
protected Session createSession ( Connection connection ) throws JMSException { if ( connection instanceof QueueConnection ) { return ( ( QueueConnection ) connection ) . createQueueSession ( false , Session . AUTO_ACKNOWLEDGE ) ; } return connection . createSession ( false , Session . AUTO_ACKNOWLEDGE ) ; }
Create queue session .
28,281
public SecurityHandler getObject ( ) throws Exception { ConstraintSecurityHandler securityHandler = new ConstraintSecurityHandler ( ) ; securityHandler . setAuthenticator ( authenticator ) ; securityHandler . setRealmName ( realm ) ; for ( Entry < String , Constraint > constraint : constraints . entrySet ( ) ) { Constr...
Construct new security handler for basic authentication .
28,282
public void afterPropertiesSet ( ) throws Exception { if ( loginService == null ) { loginService = new SimpleLoginService ( ) ; ( ( SimpleLoginService ) loginService ) . setName ( realm ) ; } }
Initialize member variables if not set by user in application context .
28,283
private void writeFtpReply ( FtpSession session , FtpMessage response ) { try { CommandResultType commandResult = response . getPayload ( CommandResultType . class ) ; FtpReply reply = new DefaultFtpReply ( Integer . valueOf ( commandResult . getReplyCode ( ) ) , commandResult . getReplyString ( ) ) ; session . write (...
Construct ftp reply from response message and write reply to given session .
28,284
public static List < String > getParameterList ( String parameterString ) { List < String > parameterList = new ArrayList < > ( ) ; StringTokenizer tok = new StringTokenizer ( parameterString , "," ) ; while ( tok . hasMoreElements ( ) ) { String param = tok . nextToken ( ) . trim ( ) ; parameterList . add ( cutOffSing...
Convert a parameter string to a list of parameters .
28,285
protected void executeActions ( TestContext context ) { context . setVariable ( indexName , String . valueOf ( index ) ) ; for ( TestAction action : actions ) { setActiveAction ( action ) ; action . execute ( context ) ; } }
Executes the nested test actions .
28,286
protected boolean checkCondition ( TestContext context ) { if ( conditionExpression != null ) { return conditionExpression . evaluate ( index , context ) ; } String conditionString = condition ; if ( conditionString . indexOf ( Citrus . VARIABLE_PREFIX + indexName + Citrus . VARIABLE_SUFFIX ) != - 1 ) { Properties prop...
Check aborting condition .
28,287
private ObjectFactory getObjectFactory ( ) throws IllegalAccessException { if ( Env . INSTANCE . get ( ObjectFactory . class . getName ( ) ) . equals ( CitrusObjectFactory . class . getName ( ) ) ) { return CitrusObjectFactory . instance ( ) ; } else if ( Env . INSTANCE . get ( ObjectFactory . class . getName ( ) ) . e...
Gets the object factory instance that is configured in environment .
28,288
public static void initializeCitrus ( ApplicationContext applicationContext ) { if ( citrus != null ) { if ( ! citrus . getApplicationContext ( ) . equals ( applicationContext ) ) { log . warn ( "Citrus instance has already been initialized - creating new instance and shutting down current instance" ) ; if ( citrus . g...
Initializes Citrus instance with given application context .
28,289
protected void executeStatements ( TestContext context ) { for ( String stmt : statements ) { try { final String toExecute ; if ( stmt . trim ( ) . endsWith ( ";" ) ) { toExecute = context . replaceDynamicContentInString ( stmt . trim ( ) . substring ( 0 , stmt . trim ( ) . length ( ) - 1 ) ) ; } else { toExecute = con...
Run all SQL statements .
28,290
private void dispatch ( final ProcessingMessage message ) throws ProcessingException { final LogLevel level = message . getLogLevel ( ) ; if ( level . compareTo ( exceptionThreshold ) >= 0 ) throw message . asException ( ) ; if ( level . compareTo ( currentLevel ) > 0 ) currentLevel = level ; if ( level . compareTo ( l...
Main dispatch method
28,291
private void addRequestCachingFilter ( ) { FilterMapping filterMapping = new FilterMapping ( ) ; filterMapping . setFilterName ( "request-caching-filter" ) ; filterMapping . setPathSpec ( "/*" ) ; FilterHolder filterHolder = new FilterHolder ( new RequestCachingServletFilter ( ) ) ; filterHolder . setName ( "request-ca...
Adds request caching filter used for not using request data when logging incoming requests
28,292
private void addGzipFilter ( ) { FilterMapping filterMapping = new FilterMapping ( ) ; filterMapping . setFilterName ( "gzip-filter" ) ; filterMapping . setPathSpec ( "/*" ) ; FilterHolder filterHolder = new FilterHolder ( new GzipServletFilter ( ) ) ; filterHolder . setName ( "gzip-filter" ) ; servletHandler . addFilt...
Adds gzip filter for automatic response messages compressing .
28,293
private boolean containsNode ( NodeList findings , Node node ) { for ( int i = 0 ; i < findings . getLength ( ) ; i ++ ) { if ( findings . item ( i ) . equals ( node ) ) { return true ; } } return false ; }
Checks if given node set contains node .
28,294
private NamespaceContext buildNamespaceContext ( Node node ) { SimpleNamespaceContext simpleNamespaceContext = new SimpleNamespaceContext ( ) ; Map < String , String > namespaces = XMLUtils . lookupNamespaces ( node . getOwnerDocument ( ) ) ; namespaces . putAll ( namespaceContextBuilder . getNamespaceMappings ( ) ) ; ...
Builds namespace context with dynamic lookup on received node document and global namespace mappings from namespace context builder .
28,295
public Delete delete ( String path ) { Delete command = new Delete ( ) ; command . path ( path ) ; command . version ( DEFAULT_VERSION ) ; action . setCommand ( command ) ; return command ; }
Adds a delete command .
28,296
public GetData get ( String path ) { GetData command = new GetData ( ) ; command . path ( path ) ; action . setCommand ( command ) ; return command ; }
Adds a get - data command .
28,297
public SetData set ( String path , String data ) { SetData command = new SetData ( ) ; command . path ( path ) ; command . data ( data ) ; command . version ( 0 ) ; action . setCommand ( command ) ; return command ; }
Adds a set - data command .
28,298
public boolean handleRequest ( MessageContext messageContext ) throws WebServiceClientException { try { logRequest ( "Sending SOAP request" , messageContext , false ) ; } catch ( SoapEnvelopeException e ) { log . warn ( "Unable to write SOAP request to logger" , e ) ; } catch ( TransformerException e ) { log . warn ( "...
Write SOAP request to logger before sending .
28,299
public boolean handleResponse ( MessageContext messageContext ) throws WebServiceClientException { try { logResponse ( "Received SOAP response" , messageContext , true ) ; } catch ( SoapEnvelopeException e ) { log . warn ( "Unable to write SOAP response to logger" , e ) ; } catch ( TransformerException e ) { log . warn...
Write SOAP response to logger .