idx
int64
0
41.2k
question
stringlengths
74
4.04k
target
stringlengths
7
750
28,000
protected Message createControlMessage ( TestContext context , String messageType ) { if ( dataDictionary != null ) { messageBuilder . setDataDictionary ( dataDictionary ) ; } return messageBuilder . buildMessageContent ( context , messageType , MessageDirection . INBOUND ) ; }
Create control message that is expected .
28,001
public ReceiveMessageAction setValidators ( List < MessageValidator < ? extends ValidationContext > > validators ) { this . validators . clear ( ) ; this . validators . addAll ( validators ) ; return this ; }
Set list of message validators .
28,002
private DockerCommand createCommand ( Class < ? extends DockerCommand > commandType ) { try { return commandType . newInstance ( ) ; } catch ( InstantiationException | IllegalAccessException e ) { throw new BeanCreationException ( "Failed to create Docker command of type: " + commandType , e ) ; } }
Creates new Docker command instance of given type .
28,003
private void fillParams ( final Map < String , String [ ] > params , final String queryString , Charset charset ) { if ( StringUtils . hasText ( queryString ) ) { final StringTokenizer tokenizer = new StringTokenizer ( queryString , "&" ) ; while ( tokenizer . hasMoreTokens ( ) ) { final String [ ] nameValuePair = toke...
Adds parameter name value paris extracted from given query string .
28,004
protected void addDependencies ( Archive < ? > archive ) { String version = getConfiguration ( ) . getCitrusVersion ( ) ; CitrusArchiveBuilder archiveBuilder ; if ( version != null ) { archiveBuilder = CitrusArchiveBuilder . version ( version ) ; } else { archiveBuilder = CitrusArchiveBuilder . latestVersion ( ) ; } if...
Adds Citrus archive dependencies and all transitive dependencies to archive .
28,005
private void initMessage ( HttpMessage message ) { StaticMessageContentBuilder staticMessageContentBuilder = StaticMessageContentBuilder . withMessage ( message ) ; staticMessageContentBuilder . setMessageHeaders ( message . getHeaders ( ) ) ; getAction ( ) . setMessageBuilder ( new HttpMessageContentBuilder ( message ...
Initialize message builder .
28,006
public ExecutePLSQLBuilder sqlResource ( Resource sqlResource , Charset charset ) { try { action . setScript ( FileUtils . readToString ( sqlResource , charset ) ) ; } catch ( IOException e ) { throw new CitrusRuntimeException ( "Failed to read sql resource" , e ) ; } return this ; }
Setter for external file resource containing the SQL statements to execute .
28,007
public List < MessageConstructionInterceptor > getMessageConstructionInterceptors ( ) { return messageConstructionInterceptors . stream ( ) . filter ( interceptor -> ! ( interceptor instanceof DataDictionary ) || ( ( DataDictionary ) interceptor ) . isGlobalScope ( ) ) . collect ( Collectors . toList ( ) ) ; }
Gets the messageConstructionInterceptors .
28,008
public WaitActionConditionBuilder execution ( ) { ActionCondition condition = new ActionCondition ( ) ; container . setCondition ( condition ) ; containers . push ( container ) ; return new WaitActionConditionBuilder ( container , condition , this ) ; }
The test action condition to wait for during execution .
28,009
public Wait buildAndRun ( ) { if ( designer != null ) { designer . action ( this ) ; } else if ( runner != null ) { runner . run ( super . build ( ) ) ; } return super . build ( ) ; }
Finishes action build process .
28,010
protected void validate ( WebElement element , SeleniumBrowser browser , TestContext context ) { validateElementProperty ( "tag-name" , tagName , element . getTagName ( ) , context ) ; validateElementProperty ( "text" , text , element . getText ( ) , context ) ; Assert . isTrue ( displayed == element . isDisplayed ( ) ...
Validates found web element with expected content .
28,011
private void validateElementProperty ( String propertyName , String controlValue , String resultValue , TestContext context ) { if ( StringUtils . hasText ( controlValue ) ) { String control = context . replaceDynamicContentInString ( controlValue ) ; if ( ValidationMatcherUtils . isValidationMatcherExpression ( contro...
Validates web element property value with validation matcher support .
28,012
protected void execute ( WebElement element , SeleniumBrowser browser , TestContext context ) { if ( StringUtils . hasText ( element . getTagName ( ) ) ) { context . setVariable ( element . getTagName ( ) , element ) ; } }
Subclasses may override this method in order to add element actions .
28,013
protected By createBy ( TestContext context ) { if ( by != null ) { return by ; } switch ( property ) { case "id" : return By . id ( context . replaceDynamicContentInString ( propertyValue ) ) ; case "class-name" : return By . className ( context . replaceDynamicContentInString ( propertyValue ) ) ; case "link-text" : ...
Create by selector from type information .
28,014
private boolean checkCondition ( TestContext context ) { if ( conditionExpression != null ) { return conditionExpression . evaluate ( context ) ; } String conditionString = context . replaceDynamicContentInString ( condition ) ; if ( ValidationMatcherUtils . isValidationMatcherExpression ( conditionString ) ) { try { V...
Evaluates condition expression and returns boolean representation .
28,015
public void beforeDeploy ( @ Observes ( precedence = CitrusExtensionConstants . INSTANCE_PRECEDENCE ) BeforeDeploy event ) { try { if ( ! event . getDeployment ( ) . testable ( ) ) { log . info ( "Producing Citrus framework instance" ) ; citrusInstance . set ( Citrus . newInstance ( configurationInstance . get ( ) . ge...
Before deploy executed before deployment on client .
28,016
public static List < String > createStatementsFromFileResource ( Resource sqlResource , LastScriptLineDecorator lineDecorator ) { BufferedReader reader = null ; StringBuffer buffer ; List < String > stmts = new ArrayList < > ( ) ; try { if ( log . isDebugEnabled ( ) ) { log . debug ( "Create statements from SQL file: "...
Reads SQL statements from external file resource . File resource can hold several multi - line statements and comments .
28,017
public Object buildMessagePayload ( TestContext context , String messageType ) { this . getMessageInterceptors ( ) . add ( gzipMessageConstructionInterceptor ) ; this . getMessageInterceptors ( ) . add ( binaryMessageConstructionInterceptor ) ; return getPayloadContent ( context , messageType ) ; }
Build the control message from payload file resource or String data .
28,018
private void purgeEndpoint ( Endpoint endpoint , TestContext context ) { if ( log . isDebugEnabled ( ) ) { log . debug ( "Try to purge message endpoint " + endpoint . getName ( ) ) ; } int messagesPurged = 0 ; Consumer messageConsumer = endpoint . createConsumer ( ) ; Message message ; do { try { String selector = Mess...
Purges all messages from a message endpoint . Prerequisite is that endpoint operates on a destination that queues messages .
28,019
protected Endpoint resolveEndpointName ( String endpointName ) { try { return beanFactory . getBean ( endpointName , Endpoint . class ) ; } catch ( BeansException e ) { throw new CitrusRuntimeException ( String . format ( "Unable to resolve endpoint for name '%s'" , endpointName ) , e ) ; } }
Resolve the endpoint by name .
28,020
public SftpClientBuilder sessionConfigs ( Map < String , String > sessionConfigs ) { endpoint . getEndpointConfiguration ( ) . setSessionConfigs ( sessionConfigs ) ; return this ; }
Sets the sessionConfigs property .
28,021
public void saveReplyMessageChannel ( Message receivedMessage , TestContext context ) { MessageChannel replyChannel = null ; if ( receivedMessage . getHeader ( org . springframework . messaging . MessageHeaders . REPLY_CHANNEL ) instanceof MessageChannel ) { replyChannel = ( MessageChannel ) receivedMessage . getHeader...
Store reply message channel .
28,022
public static boolean isElementIgnored ( final Node received , Set < String > ignoreExpressions , NamespaceContext namespaceContext ) { if ( CollectionUtils . isEmpty ( ignoreExpressions ) ) { return false ; } if ( ignoreExpressions . contains ( XMLUtils . getNodesPathName ( received ) ) ) { return true ; } for ( Strin...
Checks whether the node is ignored by node path expression or xpath expression .
28,023
public static boolean isAttributeIgnored ( Node receivedElement , Node receivedAttribute , Node sourceAttribute , Set < String > ignoreMessageElements , NamespaceContext namespaceContext ) { if ( isAttributeIgnored ( receivedElement , receivedAttribute , ignoreMessageElements , namespaceContext ) ) { if ( log . isDebug...
Checks whether the current attribute is ignored either by global ignore placeholder in source attribute value or by xpath ignore expressions .
28,024
private static boolean isAttributeIgnored ( Node receivedElement , Node receivedAttribute , Set < String > ignoreMessageElements , NamespaceContext namespaceContext ) { if ( CollectionUtils . isEmpty ( ignoreMessageElements ) ) { return false ; } if ( ignoreMessageElements . contains ( XMLUtils . getNodesPathName ( rec...
Checks whether the current attribute is ignored .
28,025
public PurgeJmsQueuesBuilder withApplicationContext ( ApplicationContext applicationContext ) { if ( applicationContext . containsBean ( "connectionFactory" ) ) { connectionFactory ( applicationContext . getBean ( "connectionFactory" , ConnectionFactory . class ) ) ; } return this ; }
Sets the Spring bean factory for using endpoint names .
28,026
public String getServerUrl ( ) { if ( StringUtils . hasText ( this . serverUrl ) ) { return serverUrl ; } else { return "service:jmx:" + protocol + ":///jndi/" + protocol + "://" + host + ":" + port + ( binding != null ? "/" + binding : "" ) ; } }
Gets the value of the serverUrl property .
28,027
public SoapClientResponseActionBuilder receive ( ) { SoapClientResponseActionBuilder soapClientResponseActionBuilder ; if ( soapClient != null ) { soapClientResponseActionBuilder = new SoapClientResponseActionBuilder ( action , soapClient ) ; } else { soapClientResponseActionBuilder = new SoapClientResponseActionBuilde...
Generic response builder for expecting response messages on client .
28,028
public ConditionalBuilder when ( Object value , Matcher expression ) { action . setConditionExpression ( new HamcrestConditionExpression ( expression , value ) ) ; return this ; }
Condition which allows execution if evaluates to true .
28,029
public SoapFault locale ( String locale ) { LocaleEditor localeEditor = new LocaleEditor ( ) ; localeEditor . setAsText ( locale ) ; this . locale = ( Locale ) localeEditor . getValue ( ) ; return this ; }
Sets the locale used in SOAP fault .
28,030
public static SoapFault from ( org . springframework . ws . soap . SoapFault fault ) { QNameEditor qNameEditor = new QNameEditor ( ) ; qNameEditor . setValue ( fault . getFaultCode ( ) ) ; SoapFault soapFault = new SoapFault ( ) . faultCode ( qNameEditor . getAsText ( ) ) . faultActor ( fault . getFaultActorOrRole ( ) ...
Builder method from Spring WS SOAP fault object .
28,031
private static String extractFaultDetail ( SoapFaultDetailElement detail ) { StringResult detailResult = new StringResult ( ) ; try { TransformerFactory transformerFactory = TransformerFactory . newInstance ( ) ; Transformer transformer = transformerFactory . newTransformer ( ) ; transformer . setOutputProperty ( Outpu...
Extracts fault detail string from soap fault detail instance . Transforms detail source into string and takes care .
28,032
public void extractVariables ( Message message , TestContext context ) { if ( CollectionUtils . isEmpty ( xPathExpressions ) ) { return ; } if ( log . isDebugEnabled ( ) ) { log . debug ( "Reading XML elements with XPath" ) ; } NamespaceContext nsContext = context . getNamespaceContextBuilder ( ) . buildContext ( messa...
Extract variables using Xpath expressions .
28,033
public String getFailureStackAsString ( ) { StringBuilder builder = new StringBuilder ( ) ; for ( FailureStackElement failureStackElement : getFailureStack ( ) ) { builder . append ( "\n\t" ) ; builder . append ( failureStackElement . getStackMessage ( ) ) ; } return builder . toString ( ) ; }
Get formatted string representation of failure stack information .
28,034
public Stack < FailureStackElement > getFailureStack ( ) { Stack < FailureStackElement > stack = new Stack < FailureStackElement > ( ) ; for ( FailureStackElement failureStackElement : failureStack ) { stack . push ( failureStackElement ) ; } return stack ; }
Gets the custom failure stack with line number information where the testcase failed .
28,035
private Condition parseHttpCondition ( Element element ) { HttpCondition condition = new HttpCondition ( ) ; condition . setUrl ( element . getAttribute ( "url" ) ) ; String method = element . getAttribute ( "method" ) ; if ( StringUtils . hasText ( method ) ) { condition . setMethod ( method ) ; } String statusCode = ...
Parse Http request condition .
28,036
private Condition parseMessageCondition ( Element element ) { MessageCondition condition = new MessageCondition ( ) ; condition . setMessageName ( element . getAttribute ( "name" ) ) ; return condition ; }
Parse message store condition .
28,037
private BeanDefinition parseActionCondition ( Element element , ParserContext parserContext ) { Map < String , BeanDefinitionParser > actionRegistry = TestActionRegistry . getRegisteredActionParser ( ) ; Element action = DOMUtil . getFirstChildElement ( element ) ; if ( action != null ) { BeanDefinitionParser parser = ...
Parse test action condition .
28,038
private Condition parseFileCondition ( Element element ) { FileCondition condition = new FileCondition ( ) ; condition . setFilePath ( element . getAttribute ( "path" ) ) ; return condition ; }
Parse file existence condition .
28,039
private void addDispatcherServlet ( ) { ServletHolder servletHolder = new ServletHolder ( new CitrusMessageDispatcherServlet ( this ) ) ; servletHolder . setName ( getServletName ( ) ) ; servletHolder . setInitParameter ( "contextConfigLocation" , contextConfigLocation ) ; servletHandler . addServlet ( servletHolder ) ...
Adds Citrus message dispatcher servlet .
28,040
public Connector [ ] getConnectors ( ) { if ( connectors != null ) { return Arrays . copyOf ( connectors , connectors . length ) ; } else { return new Connector [ ] { } ; } }
Gets the connectors .
28,041
public String getValidationScript ( TestContext context ) { try { if ( validationScriptResourcePath != null ) { return context . replaceDynamicContentInString ( FileUtils . readToString ( FileUtils . getFileResource ( validationScriptResourcePath , context ) , Charset . forName ( context . replaceDynamicContentInString...
Constructs the actual validation script either from data or external resource .
28,042
public void setBinaryMediaTypes ( List < MediaType > binaryMediaTypes ) { requestMessageConverters . stream ( ) . filter ( converter -> converter instanceof ByteArrayHttpMessageConverter ) . map ( ByteArrayHttpMessageConverter . class :: cast ) . forEach ( converter -> converter . setSupportedMediaTypes ( binaryMediaTy...
Sets the binaryMediaTypes .
28,043
public void doWithMessage ( WebServiceMessage requestMessage ) throws IOException , TransformerException { endpointConfiguration . getMessageConverter ( ) . convertOutbound ( requestMessage , message , endpointConfiguration , context ) ; }
Callback method called before request message is sent .
28,044
private void copyCookies ( final Message message ) { if ( message instanceof HttpMessage ) { this . cookies . putAll ( ( ( HttpMessage ) message ) . getCookiesMap ( ) ) ; } }
Sets the cookies extracted from the given message as far as it is a HttpMessage
28,045
public HttpMessage status ( final HttpStatus statusCode ) { statusCode ( statusCode . value ( ) ) ; reasonPhrase ( statusCode . name ( ) ) ; return this ; }
Sets the Http response status code .
28,046
public HttpMessage uri ( final String requestUri ) { setHeader ( DynamicEndpointUriResolver . ENDPOINT_URI_HEADER_NAME , requestUri ) ; setHeader ( HttpMessageHeaders . HTTP_REQUEST_URI , requestUri ) ; return this ; }
Sets the Http request request uri header .
28,047
public HttpMessage queryParam ( final String name , final String value ) { if ( ! StringUtils . hasText ( name ) ) { throw new CitrusRuntimeException ( "Invalid query param name - must not be empty!" ) ; } this . addQueryParam ( name , value ) ; final String queryParamString = queryParams . entrySet ( ) . stream ( ) . ...
Sets a new Http request query param .
28,048
public HttpMessage path ( final String path ) { header ( HttpMessageHeaders . HTTP_REQUEST_URI , path ) ; header ( DynamicEndpointUriResolver . REQUEST_PATH_HEADER_NAME , path ) ; return this ; }
Sets request path that is dynamically added to base uri .
28,049
public HttpMethod getRequestMethod ( ) { final Object method = getHeader ( HttpMessageHeaders . HTTP_REQUEST_METHOD ) ; if ( method != null ) { return HttpMethod . valueOf ( method . toString ( ) ) ; } return null ; }
Gets the Http request method .
28,050
public String getUri ( ) { final Object requestUri = getHeader ( HttpMessageHeaders . HTTP_REQUEST_URI ) ; if ( requestUri != null ) { return requestUri . toString ( ) ; } return null ; }
Gets the Http request request uri .
28,051
public String getContextPath ( ) { final Object contextPath = getHeader ( HttpMessageHeaders . HTTP_CONTEXT_PATH ) ; if ( contextPath != null ) { return contextPath . toString ( ) ; } return null ; }
Gets the Http request context path .
28,052
public String getContentType ( ) { final Object contentType = getHeader ( HttpMessageHeaders . HTTP_CONTENT_TYPE ) ; if ( contentType != null ) { return contentType . toString ( ) ; } return null ; }
Gets the Http content type header .
28,053
public String getAccept ( ) { final Object accept = getHeader ( "Accept" ) ; if ( accept != null ) { return accept . toString ( ) ; } return null ; }
Gets the accept header .
28,054
public String getQueryParamString ( ) { return Optional . ofNullable ( getHeader ( HttpMessageHeaders . HTTP_QUERY_PARAMS ) ) . map ( Object :: toString ) . orElse ( "" ) ; }
Gets the Http request query param string .
28,055
public HttpStatus getStatusCode ( ) { final Object statusCode = getHeader ( HttpMessageHeaders . HTTP_STATUS_CODE ) ; if ( statusCode != null ) { if ( statusCode instanceof HttpStatus ) { return ( HttpStatus ) statusCode ; } else if ( statusCode instanceof Integer ) { return HttpStatus . valueOf ( ( Integer ) statusCod...
Gets the Http response status code .
28,056
public String getReasonPhrase ( ) { final Object reasonPhrase = getHeader ( HttpMessageHeaders . HTTP_REASON_PHRASE ) ; if ( reasonPhrase != null ) { return reasonPhrase . toString ( ) ; } return null ; }
Gets the Http response reason phrase .
28,057
public String getVersion ( ) { final Object version = getHeader ( HttpMessageHeaders . HTTP_VERSION ) ; if ( version != null ) { return version . toString ( ) ; } return null ; }
Gets the Http version .
28,058
public String getPath ( ) { final Object path = getHeader ( DynamicEndpointUriResolver . REQUEST_PATH_HEADER_NAME ) ; if ( path != null ) { return path . toString ( ) ; } return null ; }
Gets the request path after the context path .
28,059
public void setCookies ( final Cookie [ ] cookies ) { this . cookies . clear ( ) ; if ( cookies != null ) { for ( final Cookie cookie : cookies ) { cookie ( cookie ) ; } } }
Sets the cookies .
28,060
public HttpMessage cookie ( final Cookie cookie ) { this . cookies . put ( cookie . getName ( ) , cookie ) ; setHeader ( HttpMessageHeaders . HTTP_COOKIE_PREFIX + cookie . getName ( ) , cookieConverter . getCookieString ( cookie ) ) ; return this ; }
Adds new cookie to this http message .
28,061
public static HttpMessage fromRequestData ( final String requestData ) { try ( final BufferedReader reader = new BufferedReader ( new StringReader ( requestData ) ) ) { final HttpMessage request = new HttpMessage ( ) ; final String [ ] requestLine = reader . readLine ( ) . split ( "\\s" ) ; if ( requestLine . length > ...
Reads request from complete request dump .
28,062
public static HttpMessage fromResponseData ( final String responseData ) { try ( final BufferedReader reader = new BufferedReader ( new StringReader ( responseData ) ) ) { final HttpMessage response = new HttpMessage ( ) ; final String [ ] statusLine = reader . readLine ( ) . split ( "\\s" ) ; if ( statusLine . length ...
Reads response from complete response dump .
28,063
public void loadPropertiesAsVariables ( ) { BufferedReader reader = null ; try { if ( propertyFilesSet ( ) ) { for ( String propertyFilePath : propertyFiles ) { Resource propertyFile = new PathMatchingResourcePatternResolver ( ) . getResource ( propertyFilePath . trim ( ) ) ; log . debug ( "Reading property file " + pr...
Load the properties as variables .
28,064
private int invokeUrl ( TestContext context ) { URL contextUrl = getUrl ( context ) ; if ( log . isDebugEnabled ( ) ) { log . debug ( String . format ( "Probing Http request url '%s'" , contextUrl . toExternalForm ( ) ) ) ; } int responseCode = - 1 ; HttpURLConnection httpURLConnection = null ; try { httpURLConnection ...
Invokes Http request URL and returns response code .
28,065
private URL getUrl ( TestContext context ) { try { return new URL ( context . replaceDynamicContentInString ( this . url ) ) ; } catch ( MalformedURLException e ) { throw new CitrusRuntimeException ( "Invalid request url" , e ) ; } }
Gets the request url with test variable support .
28,066
private SoapFault constructControlFault ( TestContext context ) { SoapFault controlFault = new SoapFault ( ) ; if ( StringUtils . hasText ( faultActor ) ) { controlFault . faultActor ( context . replaceDynamicContentInString ( faultActor ) ) ; } controlFault . faultCode ( context . replaceDynamicContentInString ( fault...
Constructs the control soap fault holding all expected fault information like faultCode faultString and faultDetail .
28,067
private KubernetesCommand < ? > getCommandByName ( String commandName ) { if ( ! StringUtils . hasText ( commandName ) ) { throw new CitrusRuntimeException ( "Missing command name property" ) ; } switch ( commandName ) { case "info" : return new Info ( ) ; case "list-events" : return new ListEvents ( ) ; case "list-end...
Creates a new kubernetes command message model object from message headers .
28,068
private Map < String , Object > createMessageHeaders ( KubernetesCommand < ? > command ) { Map < String , Object > headers = new HashMap < String , Object > ( ) ; headers . put ( KubernetesMessageHeaders . COMMAND , command . getName ( ) ) ; for ( Map . Entry < String , Object > entry : command . getParameters ( ) . en...
Reads basic command information and converts to message headers .
28,069
private Volume [ ] getVolumes ( TestContext context ) { String [ ] volumes = StringUtils . commaDelimitedListToStringArray ( getParameter ( "volumes" , context ) ) ; Volume [ ] volumeSpecs = new Volume [ volumes . length ] ; for ( int i = 0 ; i < volumes . length ; i ++ ) { volumeSpecs [ i ] = new Volume ( volumes [ i ...
Gets the volume specs from comma delimited string .
28,070
private Capability [ ] getCapabilities ( String addDrop , TestContext context ) { String [ ] capabilities = StringUtils . commaDelimitedListToStringArray ( getParameter ( addDrop , context ) ) ; Capability [ ] capAdd = new Capability [ capabilities . length ] ; for ( int i = 0 ; i < capabilities . length ; i ++ ) { cap...
Gets the capabilities added .
28,071
private ExposedPort [ ] getExposedPorts ( String portSpecs , TestContext context ) { String [ ] ports = StringUtils . commaDelimitedListToStringArray ( portSpecs ) ; ExposedPort [ ] exposedPorts = new ExposedPort [ ports . length ] ; for ( int i = 0 ; i < ports . length ; i ++ ) { String portSpec = context . replaceDyn...
Construct set of exposed ports from comma delimited list of ports .
28,072
private Ports getPortBindings ( String portSpecs , ExposedPort [ ] exposedPorts , TestContext context ) { String [ ] ports = StringUtils . commaDelimitedListToStringArray ( portSpecs ) ; Ports portsBindings = new Ports ( ) ; for ( String portSpec : ports ) { String [ ] binding = context . replaceDynamicContentInString ...
Construct set of port bindings from comma delimited list of ports .
28,073
private void buildOutMessage ( Exchange exchange , Message message ) { org . apache . camel . Message reply = exchange . getOut ( ) ; for ( Map . Entry < String , Object > header : message . getHeaders ( ) . entrySet ( ) ) { if ( ! header . getKey ( ) . startsWith ( MessageHeaders . PREFIX ) ) { reply . setHeader ( hea...
Builds response and sets it as out message on given Camel exchange .
28,074
protected Message createMessage ( TestContext context , String messageType ) { if ( dataDictionary != null ) { messageBuilder . setDataDictionary ( dataDictionary ) ; } return messageBuilder . buildMessageContent ( context , messageType , MessageDirection . OUTBOUND ) ; }
Create message to be sent .
28,075
private MBeanServerConnection getNetworkConnection ( ) { try { JMXServiceURL url = new JMXServiceURL ( getEndpointConfiguration ( ) . getServerUrl ( ) ) ; String [ ] creds = { getEndpointConfiguration ( ) . getUsername ( ) , getEndpointConfiguration ( ) . getPassword ( ) } ; JMXConnector networkConnector = JMXConnector...
Establish network connection to remote mBean server .
28,076
private boolean connectionLost ( JMXConnectionNotification connectionNotification ) { return connectionNotification . getType ( ) . equals ( JMXConnectionNotification . NOTIFS_LOST ) || connectionNotification . getType ( ) . equals ( JMXConnectionNotification . CLOSED ) || connectionNotification . getType ( ) . equals ...
Finds connection lost type notifications .
28,077
public void scheduleReconnect ( ) { Runnable startRunnable = new Runnable ( ) { public void run ( ) { try { MBeanServerConnection serverConnection = getNetworkConnection ( ) ; if ( notificationListener != null ) { serverConnection . addNotificationListener ( objectName , notificationListener , getEndpointConfiguration ...
Schedules an attempt to re - initialize a lost connection after the reconnect delay
28,078
private void addNotificationListener ( ObjectName objectName , final String correlationKey , MBeanServerConnection serverConnection ) { try { notificationListener = new NotificationListener ( ) { public void handleNotification ( Notification notification , Object handback ) { correlationManager . store ( correlationKey...
Add notification listener for response messages .
28,079
public AntRunBuilder targets ( String ... targets ) { action . setTargets ( StringUtils . collectionToCommaDelimitedString ( Arrays . asList ( targets ) ) ) ; return this ; }
Multiple build target names to call .
28,080
public AntRunBuilder property ( String name , Object value ) { action . getProperties ( ) . put ( name , value ) ; return this ; }
Adds a build property by name and value .
28,081
private CitrusWebSocketHandler getWebSocketClientHandler ( String url ) { CitrusWebSocketHandler handler = new CitrusWebSocketHandler ( ) ; if ( webSocketHttpHeaders == null ) { webSocketHttpHeaders = new WebSocketHttpHeaders ( ) ; webSocketHttpHeaders . setSecWebSocketExtensions ( Collections . singletonList ( new Sta...
Creates new client web socket handler by opening a new socket connection to server .
28,082
public static void main ( String [ ] args ) { CitrusApp citrusApp = new CitrusApp ( args ) ; if ( citrusApp . configuration . getTimeToLive ( ) > 0 ) { CompletableFuture . runAsync ( ( ) -> { try { new CompletableFuture < Void > ( ) . get ( citrusApp . configuration . getTimeToLive ( ) , TimeUnit . MILLISECONDS ) ; } c...
Main method with command line arguments .
28,083
public void run ( ) { if ( isCompleted ( ) ) { log . info ( "Not executing tests as application state is completed!" ) ; return ; } log . info ( String . format ( "Running Citrus %s" , Citrus . getVersion ( ) ) ) ; setDefaultProperties ( configuration ) ; if ( ClassUtils . isPresent ( "org.testng.annotations.Test" , ge...
Run application with prepared Citrus instance .
28,084
private void stop ( ) { complete ( ) ; Citrus citrus = Citrus . CitrusInstanceManager . getSingleton ( ) ; if ( citrus != null ) { log . info ( "Closing Citrus and its application context" ) ; citrus . close ( ) ; } }
Stop application by setting completed state and stop application context .
28,085
private static void setDefaultProperties ( CitrusAppConfiguration configuration ) { for ( Map . Entry < String , String > entry : configuration . getDefaultProperties ( ) . entrySet ( ) ) { log . debug ( String . format ( "Setting application property %s=%s" , entry . getKey ( ) , entry . getValue ( ) ) ) ; System . se...
Reads default properties in configuration and sets them as system properties .
28,086
protected void executeStatements ( TestContext context ) { for ( String stmt : statements ) { try { final String toExecute = context . replaceDynamicContentInString ( stmt . trim ( ) ) ; if ( log . isDebugEnabled ( ) ) { log . debug ( "Executing PLSQL statement: " + toExecute ) ; } getJdbcTemplate ( ) . execute ( toExe...
Run all PLSQL statements .
28,087
private List < String > createStatementsFromScript ( TestContext context ) { List < String > stmts = new ArrayList < > ( ) ; script = context . replaceDynamicContentInString ( script ) ; if ( log . isDebugEnabled ( ) ) { log . debug ( "Found inline PLSQL script " + script ) ; } StringTokenizer tok = new StringTokenizer...
Create SQL statements from inline script .
28,088
public static RmiServiceInvocation create ( Object remoteTarget , Method method , Object [ ] args ) { RmiServiceInvocation serviceInvocation = new RmiServiceInvocation ( ) ; if ( Proxy . isProxyClass ( remoteTarget . getClass ( ) ) ) { serviceInvocation . setRemote ( method . getDeclaringClass ( ) . getName ( ) ) ; } e...
Static create method from target object and method definition .
28,089
public Class [ ] getArgTypes ( ) { List < Class > types = new ArrayList < > ( ) ; if ( args != null ) { for ( MethodArg arg : args . getArgs ( ) ) { try { types . add ( Class . forName ( arg . getType ( ) ) ) ; } catch ( ClassNotFoundException e ) { throw new CitrusRuntimeException ( "Failed to access method argument t...
Gets the argument types from list of args .
28,090
public Object [ ] getArgValues ( ApplicationContext applicationContext ) { List < Object > argValues = new ArrayList < > ( ) ; try { if ( args != null ) { for ( MethodArg methodArg : args . getArgs ( ) ) { Class argType = Class . forName ( methodArg . getType ( ) ) ; Object value = null ; if ( methodArg . getValueObjec...
Gets method args as objects . Automatically converts simple types and ready referenced beans .
28,091
private BeanDefinitionBuilder parseSqlAction ( Element element ) { BeanDefinitionBuilder beanDefinition = BeanDefinitionBuilder . rootBeanDefinition ( ExecuteSQLAction . class ) ; String ignoreErrors = element . getAttribute ( "ignore-errors" ) ; if ( ignoreErrors != null && ignoreErrors . equals ( "true" ) ) { beanDef...
Parses SQL action just executing a set of statements .
28,092
private BeanDefinitionBuilder parseSqlQueryAction ( Element element , Element scriptValidationElement , List < Element > validateElements , List < Element > extractElements ) { BeanDefinitionBuilder beanDefinition = BeanDefinitionBuilder . rootBeanDefinition ( ExecuteSQLQueryAction . class ) ; if ( scriptValidationElem...
Parses SQL query action with result set validation elements .
28,093
private ScriptValidationContext getScriptValidationContext ( Element scriptElement ) { String type = scriptElement . getAttribute ( "type" ) ; ScriptValidationContext validationContext = new ScriptValidationContext ( type ) ; String filePath = scriptElement . getAttribute ( "file" ) ; if ( StringUtils . hasText ( fileP...
Constructs the script validation context .
28,094
public void stop ( ) { try { if ( CollectionUtils . isEmpty ( consumer . subscription ( ) ) ) { consumer . unsubscribe ( ) ; } } finally { consumer . close ( Duration . ofMillis ( 10 * 1000L ) ) ; } }
Stop message listener container .
28,095
private org . apache . kafka . clients . consumer . KafkaConsumer < Object , Object > createConsumer ( ) { Map < String , Object > consumerProps = new HashMap < > ( ) ; consumerProps . put ( ConsumerConfig . CLIENT_ID_CONFIG , Optional . ofNullable ( endpointConfiguration . getClientId ( ) ) . orElse ( KafkaMessageHead...
Create new Kafka consumer with given endpoint configuration .
28,096
public void setConsumer ( org . apache . kafka . clients . consumer . KafkaConsumer < Object , Object > consumer ) { this . consumer = consumer ; }
Sets the consumer .
28,097
public TemplateBuilder load ( ApplicationContext applicationContext ) { Template rootTemplate = applicationContext . getBean ( action . getName ( ) , Template . class ) ; action . setGlobalContext ( rootTemplate . isGlobalContext ( ) ) ; action . setActor ( rootTemplate . getActor ( ) ) ; action . setActions ( rootTemp...
Loads template bean from Spring bean application context and sets attributes .
28,098
protected MessageChannel getDestinationChannel ( TestContext context ) { if ( endpointConfiguration . getChannel ( ) != null ) { return endpointConfiguration . getChannel ( ) ; } else if ( StringUtils . hasText ( endpointConfiguration . getChannelName ( ) ) ) { return resolveChannelName ( endpointConfiguration . getCha...
Get the destination channel depending on settings in this message sender . Either a direct channel object is set or a channel name which will be resolved to a channel .
28,099
protected String getDestinationChannelName ( ) { if ( endpointConfiguration . getChannel ( ) != null ) { return endpointConfiguration . getChannel ( ) . toString ( ) ; } else if ( StringUtils . hasText ( endpointConfiguration . getChannelName ( ) ) ) { return endpointConfiguration . getChannelName ( ) ; } else { throw ...
Gets the channel name depending on what is set in this message sender . Either channel name is set directly or channel object is consulted for channel name .