repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
partition
stringclasses
1 value
citrusframework/citrus
modules/citrus-core/src/main/java/com/consol/citrus/actions/ReceiveMessageAction.java
ReceiveMessageAction.createControlMessage
protected Message createControlMessage(TestContext context, String messageType) { if (dataDictionary != null) { messageBuilder.setDataDictionary(dataDictionary); } return messageBuilder.buildMessageContent(context, messageType, MessageDirection.INBOUND); }
java
protected Message createControlMessage(TestContext context, String messageType) { if (dataDictionary != null) { messageBuilder.setDataDictionary(dataDictionary); } return messageBuilder.buildMessageContent(context, messageType, MessageDirection.INBOUND); }
[ "protected", "Message", "createControlMessage", "(", "TestContext", "context", ",", "String", "messageType", ")", "{", "if", "(", "dataDictionary", "!=", "null", ")", "{", "messageBuilder", ".", "setDataDictionary", "(", "dataDictionary", ")", ";", "}", "return", ...
Create control message that is expected. @param context @param messageType @return
[ "Create", "control", "message", "that", "is", "expected", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/actions/ReceiveMessageAction.java#L243-L249
train
citrusframework/citrus
modules/citrus-core/src/main/java/com/consol/citrus/actions/ReceiveMessageAction.java
ReceiveMessageAction.setValidators
public ReceiveMessageAction setValidators(List<MessageValidator<? extends ValidationContext>> validators) { this.validators.clear(); this.validators.addAll(validators); return this; }
java
public ReceiveMessageAction setValidators(List<MessageValidator<? extends ValidationContext>> validators) { this.validators.clear(); this.validators.addAll(validators); return this; }
[ "public", "ReceiveMessageAction", "setValidators", "(", "List", "<", "MessageValidator", "<", "?", "extends", "ValidationContext", ">", ">", "validators", ")", "{", "this", ".", "validators", ".", "clear", "(", ")", ";", "this", ".", "validators", ".", "addAll...
Set list of message validators. @param validators the message validators to set
[ "Set", "list", "of", "message", "validators", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/actions/ReceiveMessageAction.java#L283-L287
train
citrusframework/citrus
modules/citrus-docker/src/main/java/com/consol/citrus/docker/config/xml/DockerExecuteActionParser.java
DockerExecuteActionParser.createCommand
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); } }
java
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); } }
[ "private", "DockerCommand", "createCommand", "(", "Class", "<", "?", "extends", "DockerCommand", ">", "commandType", ")", "{", "try", "{", "return", "commandType", ".", "newInstance", "(", ")", ";", "}", "catch", "(", "InstantiationException", "|", "IllegalAcces...
Creates new Docker command instance of given type. @param commandType @return
[ "Creates", "new", "Docker", "command", "instance", "of", "given", "type", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-docker/src/main/java/com/consol/citrus/docker/config/xml/DockerExecuteActionParser.java#L110-L116
train
citrusframework/citrus
modules/citrus-http/src/main/java/com/consol/citrus/http/servlet/CachingHttpServletRequestWrapper.java
CachingHttpServletRequestWrapper.fillParams
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 = tokenizer.nextToken().split("="); try { params.put(URLDecoder.decode(nameValuePair[0], charset.name()), new String[] { URLDecoder.decode(nameValuePair[1], charset.name()) }); } catch (final UnsupportedEncodingException e) { throw new CitrusRuntimeException(String.format( "Failed to decode query param value '%s=%s'", nameValuePair[0], nameValuePair[1]), e); } } } }
java
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 = tokenizer.nextToken().split("="); try { params.put(URLDecoder.decode(nameValuePair[0], charset.name()), new String[] { URLDecoder.decode(nameValuePair[1], charset.name()) }); } catch (final UnsupportedEncodingException e) { throw new CitrusRuntimeException(String.format( "Failed to decode query param value '%s=%s'", nameValuePair[0], nameValuePair[1]), e); } } } }
[ "private", "void", "fillParams", "(", "final", "Map", "<", "String", ",", "String", "[", "]", ">", "params", ",", "final", "String", "queryString", ",", "Charset", "charset", ")", "{", "if", "(", "StringUtils", ".", "hasText", "(", "queryString", ")", ")...
Adds parameter name value paris extracted from given query string. @param params The parameter map to alter @param queryString The query string to extract the values from @param charset
[ "Adds", "parameter", "name", "value", "paris", "extracted", "from", "given", "query", "string", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-http/src/main/java/com/consol/citrus/http/servlet/CachingHttpServletRequestWrapper.java#L111-L128
train
citrusframework/citrus
modules/citrus-arquillian/src/main/java/com/consol/citrus/arquillian/client/CitrusArchiveProcessor.java
CitrusArchiveProcessor.addDependencies
protected void addDependencies(Archive<?> archive) { String version = getConfiguration().getCitrusVersion(); CitrusArchiveBuilder archiveBuilder; if (version != null) { archiveBuilder = CitrusArchiveBuilder.version(version); } else { archiveBuilder = CitrusArchiveBuilder.latestVersion(); } if (archive instanceof EnterpriseArchive) { EnterpriseArchive ear = (EnterpriseArchive) archive; ear.addAsModules(archiveBuilder.all().build()); } else if (archive instanceof WebArchive) { WebArchive war = (WebArchive) archive; war.addAsLibraries(archiveBuilder.all().build()); } }
java
protected void addDependencies(Archive<?> archive) { String version = getConfiguration().getCitrusVersion(); CitrusArchiveBuilder archiveBuilder; if (version != null) { archiveBuilder = CitrusArchiveBuilder.version(version); } else { archiveBuilder = CitrusArchiveBuilder.latestVersion(); } if (archive instanceof EnterpriseArchive) { EnterpriseArchive ear = (EnterpriseArchive) archive; ear.addAsModules(archiveBuilder.all().build()); } else if (archive instanceof WebArchive) { WebArchive war = (WebArchive) archive; war.addAsLibraries(archiveBuilder.all().build()); } }
[ "protected", "void", "addDependencies", "(", "Archive", "<", "?", ">", "archive", ")", "{", "String", "version", "=", "getConfiguration", "(", ")", ".", "getCitrusVersion", "(", ")", ";", "CitrusArchiveBuilder", "archiveBuilder", ";", "if", "(", "version", "!=...
Adds Citrus archive dependencies and all transitive dependencies to archive. @param archive
[ "Adds", "Citrus", "archive", "dependencies", "and", "all", "transitive", "dependencies", "to", "archive", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-arquillian/src/main/java/com/consol/citrus/arquillian/client/CitrusArchiveProcessor.java#L53-L70
train
citrusframework/citrus
modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/builder/HttpClientResponseActionBuilder.java
HttpClientResponseActionBuilder.initMessage
private void initMessage(HttpMessage message) { StaticMessageContentBuilder staticMessageContentBuilder = StaticMessageContentBuilder.withMessage(message); staticMessageContentBuilder.setMessageHeaders(message.getHeaders()); getAction().setMessageBuilder(new HttpMessageContentBuilder(message, staticMessageContentBuilder)); }
java
private void initMessage(HttpMessage message) { StaticMessageContentBuilder staticMessageContentBuilder = StaticMessageContentBuilder.withMessage(message); staticMessageContentBuilder.setMessageHeaders(message.getHeaders()); getAction().setMessageBuilder(new HttpMessageContentBuilder(message, staticMessageContentBuilder)); }
[ "private", "void", "initMessage", "(", "HttpMessage", "message", ")", "{", "StaticMessageContentBuilder", "staticMessageContentBuilder", "=", "StaticMessageContentBuilder", ".", "withMessage", "(", "message", ")", ";", "staticMessageContentBuilder", ".", "setMessageHeaders", ...
Initialize message builder. @param message
[ "Initialize", "message", "builder", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/builder/HttpClientResponseActionBuilder.java#L72-L76
train
citrusframework/citrus
modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/builder/ExecutePLSQLBuilder.java
ExecutePLSQLBuilder.sqlResource
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; }
java
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; }
[ "public", "ExecutePLSQLBuilder", "sqlResource", "(", "Resource", "sqlResource", ",", "Charset", "charset", ")", "{", "try", "{", "action", ".", "setScript", "(", "FileUtils", ".", "readToString", "(", "sqlResource", ",", "charset", ")", ")", ";", "}", "catch",...
Setter for external file resource containing the SQL statements to execute. @param sqlResource @param charset
[ "Setter", "for", "external", "file", "resource", "containing", "the", "SQL", "statements", "to", "execute", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/builder/ExecutePLSQLBuilder.java#L156-L163
train
citrusframework/citrus
modules/citrus-core/src/main/java/com/consol/citrus/validation/interceptor/GlobalMessageConstructionInterceptors.java
GlobalMessageConstructionInterceptors.getMessageConstructionInterceptors
public List<MessageConstructionInterceptor> getMessageConstructionInterceptors() { return messageConstructionInterceptors.stream() .filter(interceptor -> !(interceptor instanceof DataDictionary) || ((DataDictionary) interceptor).isGlobalScope()) .collect(Collectors.toList()); }
java
public List<MessageConstructionInterceptor> getMessageConstructionInterceptors() { return messageConstructionInterceptors.stream() .filter(interceptor -> !(interceptor instanceof DataDictionary) || ((DataDictionary) interceptor).isGlobalScope()) .collect(Collectors.toList()); }
[ "public", "List", "<", "MessageConstructionInterceptor", ">", "getMessageConstructionInterceptors", "(", ")", "{", "return", "messageConstructionInterceptors", ".", "stream", "(", ")", ".", "filter", "(", "interceptor", "->", "!", "(", "interceptor", "instanceof", "Da...
Gets the messageConstructionInterceptors. @return
[ "Gets", "the", "messageConstructionInterceptors", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/validation/interceptor/GlobalMessageConstructionInterceptors.java#L51-L55
train
citrusframework/citrus
modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/builder/WaitBuilder.java
WaitBuilder.execution
public WaitActionConditionBuilder execution() { ActionCondition condition = new ActionCondition(); container.setCondition(condition); containers.push(container); return new WaitActionConditionBuilder(container, condition, this); }
java
public WaitActionConditionBuilder execution() { ActionCondition condition = new ActionCondition(); container.setCondition(condition); containers.push(container); return new WaitActionConditionBuilder(container, condition, this); }
[ "public", "WaitActionConditionBuilder", "execution", "(", ")", "{", "ActionCondition", "condition", "=", "new", "ActionCondition", "(", ")", ";", "container", ".", "setCondition", "(", "condition", ")", ";", "containers", ".", "push", "(", "container", ")", ";",...
The test action condition to wait for during execution. @return A WaitActionConditionBuilder for further configuration
[ "The", "test", "action", "condition", "to", "wait", "for", "during", "execution", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/builder/WaitBuilder.java#L132-L137
train
citrusframework/citrus
modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/builder/WaitBuilder.java
WaitBuilder.buildAndRun
public Wait buildAndRun() { if (designer != null) { designer.action(this); } else if (runner != null) { runner.run(super.build()); } return super.build(); }
java
public Wait buildAndRun() { if (designer != null) { designer.action(this); } else if (runner != null) { runner.run(super.build()); } return super.build(); }
[ "public", "Wait", "buildAndRun", "(", ")", "{", "if", "(", "designer", "!=", "null", ")", "{", "designer", ".", "action", "(", "this", ")", ";", "}", "else", "if", "(", "runner", "!=", "null", ")", "{", "runner", ".", "run", "(", "super", ".", "b...
Finishes action build process. @return The Wait action to execute
[ "Finishes", "action", "build", "process", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/builder/WaitBuilder.java#L273-L281
train
citrusframework/citrus
modules/citrus-selenium/src/main/java/com/consol/citrus/selenium/actions/FindElementAction.java
FindElementAction.validate
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(), String.format("Selenium web element validation failed, " + "property 'displayed' expected '%s', but was '%s'", displayed, element.isDisplayed())); Assert.isTrue(enabled == element.isEnabled(), String.format("Selenium web element validation failed, " + "property 'enabled' expected '%s', but was '%s'", enabled, element.isEnabled())); for (Map.Entry<String, String> attributeEntry : attributes.entrySet()) { validateElementProperty(String.format("attribute '%s'", attributeEntry.getKey()), attributeEntry.getValue(), element.getAttribute(attributeEntry.getKey()), context); } for (Map.Entry<String, String> styleEntry : styles.entrySet()) { validateElementProperty(String.format("css style '%s'", styleEntry.getKey()), styleEntry.getValue(), element.getCssValue(styleEntry.getKey()), context); } }
java
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(), String.format("Selenium web element validation failed, " + "property 'displayed' expected '%s', but was '%s'", displayed, element.isDisplayed())); Assert.isTrue(enabled == element.isEnabled(), String.format("Selenium web element validation failed, " + "property 'enabled' expected '%s', but was '%s'", enabled, element.isEnabled())); for (Map.Entry<String, String> attributeEntry : attributes.entrySet()) { validateElementProperty(String.format("attribute '%s'", attributeEntry.getKey()), attributeEntry.getValue(), element.getAttribute(attributeEntry.getKey()), context); } for (Map.Entry<String, String> styleEntry : styles.entrySet()) { validateElementProperty(String.format("css style '%s'", styleEntry.getKey()), styleEntry.getValue(), element.getCssValue(styleEntry.getKey()), context); } }
[ "protected", "void", "validate", "(", "WebElement", "element", ",", "SeleniumBrowser", "browser", ",", "TestContext", "context", ")", "{", "validateElementProperty", "(", "\"tag-name\"", ",", "tagName", ",", "element", ".", "getTagName", "(", ")", ",", "context", ...
Validates found web element with expected content. @param element @param browser @param context
[ "Validates", "found", "web", "element", "with", "expected", "content", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-selenium/src/main/java/com/consol/citrus/selenium/actions/FindElementAction.java#L89-L105
train
citrusframework/citrus
modules/citrus-selenium/src/main/java/com/consol/citrus/selenium/actions/FindElementAction.java
FindElementAction.validateElementProperty
private void validateElementProperty(String propertyName, String controlValue, String resultValue, TestContext context) { if (StringUtils.hasText(controlValue)) { String control = context.replaceDynamicContentInString(controlValue); if (ValidationMatcherUtils.isValidationMatcherExpression(control)) { ValidationMatcherUtils.resolveValidationMatcher("payload", resultValue, control, context); } else { Assert.isTrue(control.equals(resultValue), String.format("Selenium web element validation failed, %s expected '%s', but was '%s'", propertyName, control, resultValue)); } } }
java
private void validateElementProperty(String propertyName, String controlValue, String resultValue, TestContext context) { if (StringUtils.hasText(controlValue)) { String control = context.replaceDynamicContentInString(controlValue); if (ValidationMatcherUtils.isValidationMatcherExpression(control)) { ValidationMatcherUtils.resolveValidationMatcher("payload", resultValue, control, context); } else { Assert.isTrue(control.equals(resultValue), String.format("Selenium web element validation failed, %s expected '%s', but was '%s'", propertyName, control, resultValue)); } } }
[ "private", "void", "validateElementProperty", "(", "String", "propertyName", ",", "String", "controlValue", ",", "String", "resultValue", ",", "TestContext", "context", ")", "{", "if", "(", "StringUtils", ".", "hasText", "(", "controlValue", ")", ")", "{", "Stri...
Validates web element property value with validation matcher support. @param propertyName @param controlValue @param resultValue @param context
[ "Validates", "web", "element", "property", "value", "with", "validation", "matcher", "support", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-selenium/src/main/java/com/consol/citrus/selenium/actions/FindElementAction.java#L114-L124
train
citrusframework/citrus
modules/citrus-selenium/src/main/java/com/consol/citrus/selenium/actions/FindElementAction.java
FindElementAction.execute
protected void execute(WebElement element, SeleniumBrowser browser, TestContext context) { if (StringUtils.hasText(element.getTagName())) { context.setVariable(element.getTagName(), element); } }
java
protected void execute(WebElement element, SeleniumBrowser browser, TestContext context) { if (StringUtils.hasText(element.getTagName())) { context.setVariable(element.getTagName(), element); } }
[ "protected", "void", "execute", "(", "WebElement", "element", ",", "SeleniumBrowser", "browser", ",", "TestContext", "context", ")", "{", "if", "(", "StringUtils", ".", "hasText", "(", "element", ".", "getTagName", "(", ")", ")", ")", "{", "context", ".", ...
Subclasses may override this method in order to add element actions. @param element @param browser @param context
[ "Subclasses", "may", "override", "this", "method", "in", "order", "to", "add", "element", "actions", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-selenium/src/main/java/com/consol/citrus/selenium/actions/FindElementAction.java#L132-L136
train
citrusframework/citrus
modules/citrus-selenium/src/main/java/com/consol/citrus/selenium/actions/FindElementAction.java
FindElementAction.createBy
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": return By.linkText(context.replaceDynamicContentInString(propertyValue)); case "css-selector": return By.cssSelector(context.replaceDynamicContentInString(propertyValue)); case "name": return By.name(context.replaceDynamicContentInString(propertyValue)); case "tag-name": return By.tagName(context.replaceDynamicContentInString(propertyValue)); case "xpath": return By.xpath(context.replaceDynamicContentInString(propertyValue)); } throw new CitrusRuntimeException("Unknown selector type: " + property); }
java
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": return By.linkText(context.replaceDynamicContentInString(propertyValue)); case "css-selector": return By.cssSelector(context.replaceDynamicContentInString(propertyValue)); case "name": return By.name(context.replaceDynamicContentInString(propertyValue)); case "tag-name": return By.tagName(context.replaceDynamicContentInString(propertyValue)); case "xpath": return By.xpath(context.replaceDynamicContentInString(propertyValue)); } throw new CitrusRuntimeException("Unknown selector type: " + property); }
[ "protected", "By", "createBy", "(", "TestContext", "context", ")", "{", "if", "(", "by", "!=", "null", ")", "{", "return", "by", ";", "}", "switch", "(", "property", ")", "{", "case", "\"id\"", ":", "return", "By", ".", "id", "(", "context", ".", "...
Create by selector from type information. @return
[ "Create", "by", "selector", "from", "type", "information", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-selenium/src/main/java/com/consol/citrus/selenium/actions/FindElementAction.java#L142-L165
train
citrusframework/citrus
modules/citrus-core/src/main/java/com/consol/citrus/container/Conditional.java
Conditional.checkCondition
private boolean checkCondition(TestContext context) { if (conditionExpression != null) { return conditionExpression.evaluate(context); } // replace dynamic content with each iteration String conditionString = context.replaceDynamicContentInString(condition); if (ValidationMatcherUtils.isValidationMatcherExpression(conditionString)) { try { ValidationMatcherUtils.resolveValidationMatcher("iteratingCondition", "", conditionString, context); return true; } catch (AssertionError e) { return false; } } return BooleanExpressionParser.evaluate(conditionString); }
java
private boolean checkCondition(TestContext context) { if (conditionExpression != null) { return conditionExpression.evaluate(context); } // replace dynamic content with each iteration String conditionString = context.replaceDynamicContentInString(condition); if (ValidationMatcherUtils.isValidationMatcherExpression(conditionString)) { try { ValidationMatcherUtils.resolveValidationMatcher("iteratingCondition", "", conditionString, context); return true; } catch (AssertionError e) { return false; } } return BooleanExpressionParser.evaluate(conditionString); }
[ "private", "boolean", "checkCondition", "(", "TestContext", "context", ")", "{", "if", "(", "conditionExpression", "!=", "null", ")", "{", "return", "conditionExpression", ".", "evaluate", "(", "context", ")", ";", "}", "// replace dynamic content with each iteration"...
Evaluates condition expression and returns boolean representation. @param context @return
[ "Evaluates", "condition", "expression", "and", "returns", "boolean", "representation", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/container/Conditional.java#L69-L86
train
citrusframework/citrus
modules/citrus-arquillian/src/main/java/com/consol/citrus/arquillian/enricher/CitrusInstanceProducer.java
CitrusInstanceProducer.beforeDeploy
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().getConfigurationClass())); } } catch (Exception e) { log.error(CitrusExtensionConstants.CITRUS_EXTENSION_ERROR, e); throw e; } }
java
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().getConfigurationClass())); } } catch (Exception e) { log.error(CitrusExtensionConstants.CITRUS_EXTENSION_ERROR, e); throw e; } }
[ "public", "void", "beforeDeploy", "(", "@", "Observes", "(", "precedence", "=", "CitrusExtensionConstants", ".", "INSTANCE_PRECEDENCE", ")", "BeforeDeploy", "event", ")", "{", "try", "{", "if", "(", "!", "event", ".", "getDeployment", "(", ")", ".", "testable"...
Before deploy executed before deployment on client. @param event
[ "Before", "deploy", "executed", "before", "deployment", "on", "client", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-arquillian/src/main/java/com/consol/citrus/arquillian/enricher/CitrusInstanceProducer.java#L52-L62
train
citrusframework/citrus
modules/citrus-core/src/main/java/com/consol/citrus/util/SqlUtils.java
SqlUtils.createStatementsFromFileResource
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: " + sqlResource.getFile().getAbsolutePath()); } reader = new BufferedReader(new InputStreamReader(sqlResource.getInputStream())); buffer = new StringBuffer(); String line; while (reader.ready()) { line = reader.readLine(); if (line != null && !line.trim().startsWith(SQL_COMMENT) && line.trim().length() > 0) { if (line.trim().endsWith(getStatementEndingCharacter(lineDecorator))) { if (lineDecorator != null) { buffer.append(lineDecorator.decorate(line)); } else { buffer.append(line); } String stmt = buffer.toString().trim(); if (log.isDebugEnabled()) { log.debug("Found statement: " + stmt); } stmts.add(stmt); buffer.setLength(0); buffer = new StringBuffer(); } else { buffer.append(line); //more lines to come for this statement add line break buffer.append("\n"); } } } } catch (IOException e) { throw new CitrusRuntimeException("Resource could not be found - filename: " + sqlResource, e); } finally { if (reader != null) { try { reader.close(); } catch (IOException e) { log.warn("Warning: Error while closing reader instance", e); } } } return stmts; }
java
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: " + sqlResource.getFile().getAbsolutePath()); } reader = new BufferedReader(new InputStreamReader(sqlResource.getInputStream())); buffer = new StringBuffer(); String line; while (reader.ready()) { line = reader.readLine(); if (line != null && !line.trim().startsWith(SQL_COMMENT) && line.trim().length() > 0) { if (line.trim().endsWith(getStatementEndingCharacter(lineDecorator))) { if (lineDecorator != null) { buffer.append(lineDecorator.decorate(line)); } else { buffer.append(line); } String stmt = buffer.toString().trim(); if (log.isDebugEnabled()) { log.debug("Found statement: " + stmt); } stmts.add(stmt); buffer.setLength(0); buffer = new StringBuffer(); } else { buffer.append(line); //more lines to come for this statement add line break buffer.append("\n"); } } } } catch (IOException e) { throw new CitrusRuntimeException("Resource could not be found - filename: " + sqlResource, e); } finally { if (reader != null) { try { reader.close(); } catch (IOException e) { log.warn("Warning: Error while closing reader instance", e); } } } return stmts; }
[ "public", "static", "List", "<", "String", ">", "createStatementsFromFileResource", "(", "Resource", "sqlResource", ",", "LastScriptLineDecorator", "lineDecorator", ")", "{", "BufferedReader", "reader", "=", "null", ";", "StringBuffer", "buffer", ";", "List", "<", "...
Reads SQL statements from external file resource. File resource can hold several multi-line statements and comments. @param sqlResource the sql file resource. @param lineDecorator optional line decorator for last script lines. @return list of SQL statements.
[ "Reads", "SQL", "statements", "from", "external", "file", "resource", ".", "File", "resource", "can", "hold", "several", "multi", "-", "line", "statements", "and", "comments", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/util/SqlUtils.java#L69-L125
train
citrusframework/citrus
modules/citrus-core/src/main/java/com/consol/citrus/validation/builder/PayloadTemplateMessageBuilder.java
PayloadTemplateMessageBuilder.buildMessagePayload
public Object buildMessagePayload(TestContext context, String messageType) { this.getMessageInterceptors().add(gzipMessageConstructionInterceptor); this.getMessageInterceptors().add(binaryMessageConstructionInterceptor); return getPayloadContent(context, messageType); }
java
public Object buildMessagePayload(TestContext context, String messageType) { this.getMessageInterceptors().add(gzipMessageConstructionInterceptor); this.getMessageInterceptors().add(binaryMessageConstructionInterceptor); return getPayloadContent(context, messageType); }
[ "public", "Object", "buildMessagePayload", "(", "TestContext", "context", ",", "String", "messageType", ")", "{", "this", ".", "getMessageInterceptors", "(", ")", ".", "add", "(", "gzipMessageConstructionInterceptor", ")", ";", "this", ".", "getMessageInterceptors", ...
Build the control message from payload file resource or String data.
[ "Build", "the", "control", "message", "from", "payload", "file", "resource", "or", "String", "data", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/validation/builder/PayloadTemplateMessageBuilder.java#L55-L59
train
citrusframework/citrus
modules/citrus-core/src/main/java/com/consol/citrus/actions/PurgeEndpointAction.java
PurgeEndpointAction.purgeEndpoint
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 = MessageSelectorBuilder.build(messageSelector, messageSelectorMap, context); if (StringUtils.hasText(selector) && messageConsumer instanceof SelectiveConsumer) { message = (receiveTimeout >= 0) ? ((SelectiveConsumer) messageConsumer).receive(selector, context, receiveTimeout) : ((SelectiveConsumer) messageConsumer).receive(selector, context); } else { message = (receiveTimeout >= 0) ? messageConsumer.receive(context, receiveTimeout) : messageConsumer.receive(context); } } catch (ActionTimeoutException e) { if (log.isDebugEnabled()) { log.debug("Stop purging due to timeout - " + e.getMessage()); } break; } if (message != null) { log.debug("Removed message from endpoint " + endpoint.getName()); messagesPurged++; try { Thread.sleep(sleepTime); } catch (InterruptedException e) { log.warn("Interrupted during wait", e); } } } while (message != null); if (log.isDebugEnabled()) { log.debug("Purged " + messagesPurged + " messages from endpoint"); } }
java
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 = MessageSelectorBuilder.build(messageSelector, messageSelectorMap, context); if (StringUtils.hasText(selector) && messageConsumer instanceof SelectiveConsumer) { message = (receiveTimeout >= 0) ? ((SelectiveConsumer) messageConsumer).receive(selector, context, receiveTimeout) : ((SelectiveConsumer) messageConsumer).receive(selector, context); } else { message = (receiveTimeout >= 0) ? messageConsumer.receive(context, receiveTimeout) : messageConsumer.receive(context); } } catch (ActionTimeoutException e) { if (log.isDebugEnabled()) { log.debug("Stop purging due to timeout - " + e.getMessage()); } break; } if (message != null) { log.debug("Removed message from endpoint " + endpoint.getName()); messagesPurged++; try { Thread.sleep(sleepTime); } catch (InterruptedException e) { log.warn("Interrupted during wait", e); } } } while (message != null); if (log.isDebugEnabled()) { log.debug("Purged " + messagesPurged + " messages from endpoint"); } }
[ "private", "void", "purgeEndpoint", "(", "Endpoint", "endpoint", ",", "TestContext", "context", ")", "{", "if", "(", "log", ".", "isDebugEnabled", "(", ")", ")", "{", "log", ".", "debug", "(", "\"Try to purge message endpoint \"", "+", "endpoint", ".", "getNam...
Purges all messages from a message endpoint. Prerequisite is that endpoint operates on a destination that queues messages. @param endpoint @param context
[ "Purges", "all", "messages", "from", "a", "message", "endpoint", ".", "Prerequisite", "is", "that", "endpoint", "operates", "on", "a", "destination", "that", "queues", "messages", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/actions/PurgeEndpointAction.java#L99-L137
train
citrusframework/citrus
modules/citrus-core/src/main/java/com/consol/citrus/actions/PurgeEndpointAction.java
PurgeEndpointAction.resolveEndpointName
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); } }
java
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); } }
[ "protected", "Endpoint", "resolveEndpointName", "(", "String", "endpointName", ")", "{", "try", "{", "return", "beanFactory", ".", "getBean", "(", "endpointName", ",", "Endpoint", ".", "class", ")", ";", "}", "catch", "(", "BeansException", "e", ")", "{", "t...
Resolve the endpoint by name. @param endpointName the name to resolve @return the Endpoint object
[ "Resolve", "the", "endpoint", "by", "name", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/actions/PurgeEndpointAction.java#L144-L150
train
citrusframework/citrus
modules/citrus-ftp/src/main/java/com/consol/citrus/ftp/client/SftpClientBuilder.java
SftpClientBuilder.sessionConfigs
public SftpClientBuilder sessionConfigs(Map<String, String> sessionConfigs) { endpoint.getEndpointConfiguration().setSessionConfigs(sessionConfigs); return this; }
java
public SftpClientBuilder sessionConfigs(Map<String, String> sessionConfigs) { endpoint.getEndpointConfiguration().setSessionConfigs(sessionConfigs); return this; }
[ "public", "SftpClientBuilder", "sessionConfigs", "(", "Map", "<", "String", ",", "String", ">", "sessionConfigs", ")", "{", "endpoint", ".", "getEndpointConfiguration", "(", ")", ".", "setSessionConfigs", "(", "sessionConfigs", ")", ";", "return", "this", ";", "...
Sets the sessionConfigs property. @param sessionConfigs @return
[ "Sets", "the", "sessionConfigs", "property", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-ftp/src/main/java/com/consol/citrus/ftp/client/SftpClientBuilder.java#L154-L157
train
citrusframework/citrus
modules/citrus-core/src/main/java/com/consol/citrus/channel/ChannelSyncConsumer.java
ChannelSyncConsumer.saveReplyMessageChannel
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(org.springframework.messaging.MessageHeaders.REPLY_CHANNEL); } else if (StringUtils.hasText((String) receivedMessage.getHeader(org.springframework.messaging.MessageHeaders.REPLY_CHANNEL))) { replyChannel = resolveChannelName(receivedMessage.getHeader(org.springframework.messaging.MessageHeaders.REPLY_CHANNEL).toString(), context); } if (replyChannel != null) { String correlationKeyName = endpointConfiguration.getCorrelator().getCorrelationKeyName(getName()); String correlationKey = endpointConfiguration.getCorrelator().getCorrelationKey(receivedMessage); correlationManager.saveCorrelationKey(correlationKeyName, correlationKey, context); correlationManager.store(correlationKey, replyChannel); } else { log.warn("Unable to retrieve reply message channel for message \n" + receivedMessage + "\n - no reply channel found in message headers!"); } }
java
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(org.springframework.messaging.MessageHeaders.REPLY_CHANNEL); } else if (StringUtils.hasText((String) receivedMessage.getHeader(org.springframework.messaging.MessageHeaders.REPLY_CHANNEL))) { replyChannel = resolveChannelName(receivedMessage.getHeader(org.springframework.messaging.MessageHeaders.REPLY_CHANNEL).toString(), context); } if (replyChannel != null) { String correlationKeyName = endpointConfiguration.getCorrelator().getCorrelationKeyName(getName()); String correlationKey = endpointConfiguration.getCorrelator().getCorrelationKey(receivedMessage); correlationManager.saveCorrelationKey(correlationKeyName, correlationKey, context); correlationManager.store(correlationKey, replyChannel); } else { log.warn("Unable to retrieve reply message channel for message \n" + receivedMessage + "\n - no reply channel found in message headers!"); } }
[ "public", "void", "saveReplyMessageChannel", "(", "Message", "receivedMessage", ",", "TestContext", "context", ")", "{", "MessageChannel", "replyChannel", "=", "null", ";", "if", "(", "receivedMessage", ".", "getHeader", "(", "org", ".", "springframework", ".", "m...
Store reply message channel. @param receivedMessage @param context
[ "Store", "reply", "message", "channel", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/channel/ChannelSyncConsumer.java#L95-L112
train
citrusframework/citrus
modules/citrus-core/src/main/java/com/consol/citrus/validation/xml/XmlValidationUtils.java
XmlValidationUtils.isElementIgnored
public static boolean isElementIgnored(final Node received, Set<String> ignoreExpressions, NamespaceContext namespaceContext) { if (CollectionUtils.isEmpty(ignoreExpressions)) { return false; } /** This is the faster version, but then the ignoreValue name must be * the full path name like: Numbers.NumberItem.AreaCode */ if (ignoreExpressions.contains(XMLUtils.getNodesPathName(received))) { return true; } /** This is the slower version, but here the ignoreValues can be * the short path name like only: AreaCode * * If there are more nodes with the same short name, * the first one will match, eg. if there are: * Numbers1.NumberItem.AreaCode * Numbers2.NumberItem.AreaCode * And ignoreValues contains just: AreaCode * the only first Node: Numbers1.NumberItem.AreaCode will be ignored. */ for (String expression : ignoreExpressions) { if (received == XMLUtils.findNodeByName(received.getOwnerDocument(), expression)) { return true; } } /** This is the XPath version using XPath expressions in * ignoreValues to identify nodes to be ignored */ for (String expression : ignoreExpressions) { if (XPathUtils.isXPathExpression(expression)) { NodeList foundNodes = XPathUtils.evaluateAsNodeList(received.getOwnerDocument(), expression, namespaceContext); if (foundNodes != null) { for (int i = 0; i < foundNodes.getLength(); i++) { if (foundNodes.item(i) != null && foundNodes.item(i).isSameNode(received)) { return true; } } } } } return false; }
java
public static boolean isElementIgnored(final Node received, Set<String> ignoreExpressions, NamespaceContext namespaceContext) { if (CollectionUtils.isEmpty(ignoreExpressions)) { return false; } /** This is the faster version, but then the ignoreValue name must be * the full path name like: Numbers.NumberItem.AreaCode */ if (ignoreExpressions.contains(XMLUtils.getNodesPathName(received))) { return true; } /** This is the slower version, but here the ignoreValues can be * the short path name like only: AreaCode * * If there are more nodes with the same short name, * the first one will match, eg. if there are: * Numbers1.NumberItem.AreaCode * Numbers2.NumberItem.AreaCode * And ignoreValues contains just: AreaCode * the only first Node: Numbers1.NumberItem.AreaCode will be ignored. */ for (String expression : ignoreExpressions) { if (received == XMLUtils.findNodeByName(received.getOwnerDocument(), expression)) { return true; } } /** This is the XPath version using XPath expressions in * ignoreValues to identify nodes to be ignored */ for (String expression : ignoreExpressions) { if (XPathUtils.isXPathExpression(expression)) { NodeList foundNodes = XPathUtils.evaluateAsNodeList(received.getOwnerDocument(), expression, namespaceContext); if (foundNodes != null) { for (int i = 0; i < foundNodes.getLength(); i++) { if (foundNodes.item(i) != null && foundNodes.item(i).isSameNode(received)) { return true; } } } } } return false; }
[ "public", "static", "boolean", "isElementIgnored", "(", "final", "Node", "received", ",", "Set", "<", "String", ">", "ignoreExpressions", ",", "NamespaceContext", "namespaceContext", ")", "{", "if", "(", "CollectionUtils", ".", "isEmpty", "(", "ignoreExpressions", ...
Checks whether the node is ignored by node path expression or xpath expression. @param received @param ignoreExpressions @param namespaceContext @return
[ "Checks", "whether", "the", "node", "is", "ignored", "by", "node", "path", "expression", "or", "xpath", "expression", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/validation/xml/XmlValidationUtils.java#L82-L130
train
citrusframework/citrus
modules/citrus-core/src/main/java/com/consol/citrus/validation/xml/XmlValidationUtils.java
XmlValidationUtils.isAttributeIgnored
public static boolean isAttributeIgnored(Node receivedElement, Node receivedAttribute, Node sourceAttribute, Set<String> ignoreMessageElements, NamespaceContext namespaceContext) { if (isAttributeIgnored(receivedElement, receivedAttribute, ignoreMessageElements, namespaceContext)) { if (log.isDebugEnabled()) { log.debug("Attribute '" + receivedAttribute.getLocalName() + "' is on ignore list - skipped value validation"); } return true; } else if ((StringUtils.hasText(sourceAttribute.getNodeValue()) && sourceAttribute.getNodeValue().trim().equals(Citrus.IGNORE_PLACEHOLDER))) { if (log.isDebugEnabled()) { log.debug("Attribute: '" + receivedAttribute.getLocalName() + "' is ignored by placeholder '" + Citrus.IGNORE_PLACEHOLDER + "'"); } return true; } return false; }
java
public static boolean isAttributeIgnored(Node receivedElement, Node receivedAttribute, Node sourceAttribute, Set<String> ignoreMessageElements, NamespaceContext namespaceContext) { if (isAttributeIgnored(receivedElement, receivedAttribute, ignoreMessageElements, namespaceContext)) { if (log.isDebugEnabled()) { log.debug("Attribute '" + receivedAttribute.getLocalName() + "' is on ignore list - skipped value validation"); } return true; } else if ((StringUtils.hasText(sourceAttribute.getNodeValue()) && sourceAttribute.getNodeValue().trim().equals(Citrus.IGNORE_PLACEHOLDER))) { if (log.isDebugEnabled()) { log.debug("Attribute: '" + receivedAttribute.getLocalName() + "' is ignored by placeholder '" + Citrus.IGNORE_PLACEHOLDER + "'"); } return true; } return false; }
[ "public", "static", "boolean", "isAttributeIgnored", "(", "Node", "receivedElement", ",", "Node", "receivedAttribute", ",", "Node", "sourceAttribute", ",", "Set", "<", "String", ">", "ignoreMessageElements", ",", "NamespaceContext", "namespaceContext", ")", "{", "if",...
Checks whether the current attribute is ignored either by global ignore placeholder in source attribute value or by xpath ignore expressions. @param receivedElement @param receivedAttribute @param ignoreMessageElements @return
[ "Checks", "whether", "the", "current", "attribute", "is", "ignored", "either", "by", "global", "ignore", "placeholder", "in", "source", "attribute", "value", "or", "by", "xpath", "ignore", "expressions", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/validation/xml/XmlValidationUtils.java#L141-L160
train
citrusframework/citrus
modules/citrus-core/src/main/java/com/consol/citrus/validation/xml/XmlValidationUtils.java
XmlValidationUtils.isAttributeIgnored
private static boolean isAttributeIgnored(Node receivedElement, Node receivedAttribute, Set<String> ignoreMessageElements, NamespaceContext namespaceContext) { if (CollectionUtils.isEmpty(ignoreMessageElements)) { return false; } /** This is the faster version, but then the ignoreValue name must be * the full path name like: Numbers.NumberItem.AreaCode */ if (ignoreMessageElements.contains(XMLUtils.getNodesPathName(receivedElement) + "." + receivedAttribute.getNodeName())) { return true; } /** This is the slower version, but here the ignoreValues can be * the short path name like only: AreaCode * * If there are more nodes with the same short name, * the first one will match, eg. if there are: * Numbers1.NumberItem.AreaCode * Numbers2.NumberItem.AreaCode * And ignoreValues contains just: AreaCode * the only first Node: Numbers1.NumberItem.AreaCode will be ignored. */ for (String expression : ignoreMessageElements) { Node foundAttributeNode = XMLUtils.findNodeByName(receivedElement.getOwnerDocument(), expression); if (foundAttributeNode != null && receivedAttribute.isSameNode(foundAttributeNode)) { return true; } } /** This is the XPath version using XPath expressions in * ignoreValues to identify nodes to be ignored */ for (String expression : ignoreMessageElements) { if (XPathUtils.isXPathExpression(expression)) { Node foundAttributeNode = XPathUtils.evaluateAsNode(receivedElement.getOwnerDocument(), expression, namespaceContext); if (foundAttributeNode != null && foundAttributeNode.isSameNode(receivedAttribute)) { return true; } } } return false; }
java
private static boolean isAttributeIgnored(Node receivedElement, Node receivedAttribute, Set<String> ignoreMessageElements, NamespaceContext namespaceContext) { if (CollectionUtils.isEmpty(ignoreMessageElements)) { return false; } /** This is the faster version, but then the ignoreValue name must be * the full path name like: Numbers.NumberItem.AreaCode */ if (ignoreMessageElements.contains(XMLUtils.getNodesPathName(receivedElement) + "." + receivedAttribute.getNodeName())) { return true; } /** This is the slower version, but here the ignoreValues can be * the short path name like only: AreaCode * * If there are more nodes with the same short name, * the first one will match, eg. if there are: * Numbers1.NumberItem.AreaCode * Numbers2.NumberItem.AreaCode * And ignoreValues contains just: AreaCode * the only first Node: Numbers1.NumberItem.AreaCode will be ignored. */ for (String expression : ignoreMessageElements) { Node foundAttributeNode = XMLUtils.findNodeByName(receivedElement.getOwnerDocument(), expression); if (foundAttributeNode != null && receivedAttribute.isSameNode(foundAttributeNode)) { return true; } } /** This is the XPath version using XPath expressions in * ignoreValues to identify nodes to be ignored */ for (String expression : ignoreMessageElements) { if (XPathUtils.isXPathExpression(expression)) { Node foundAttributeNode = XPathUtils.evaluateAsNode(receivedElement.getOwnerDocument(), expression, namespaceContext); if (foundAttributeNode != null && foundAttributeNode.isSameNode(receivedAttribute)) { return true; } } } return false; }
[ "private", "static", "boolean", "isAttributeIgnored", "(", "Node", "receivedElement", ",", "Node", "receivedAttribute", ",", "Set", "<", "String", ">", "ignoreMessageElements", ",", "NamespaceContext", "namespaceContext", ")", "{", "if", "(", "CollectionUtils", ".", ...
Checks whether the current attribute is ignored. @param receivedElement @param receivedAttribute @param ignoreMessageElements @return
[ "Checks", "whether", "the", "current", "attribute", "is", "ignored", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/validation/xml/XmlValidationUtils.java#L169-L215
train
citrusframework/citrus
modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/builder/PurgeJmsQueuesBuilder.java
PurgeJmsQueuesBuilder.withApplicationContext
public PurgeJmsQueuesBuilder withApplicationContext(ApplicationContext applicationContext) { if (applicationContext.containsBean("connectionFactory")) { connectionFactory(applicationContext.getBean("connectionFactory", ConnectionFactory.class)); } return this; }
java
public PurgeJmsQueuesBuilder withApplicationContext(ApplicationContext applicationContext) { if (applicationContext.containsBean("connectionFactory")) { connectionFactory(applicationContext.getBean("connectionFactory", ConnectionFactory.class)); } return this; }
[ "public", "PurgeJmsQueuesBuilder", "withApplicationContext", "(", "ApplicationContext", "applicationContext", ")", "{", "if", "(", "applicationContext", ".", "containsBean", "(", "\"connectionFactory\"", ")", ")", "{", "connectionFactory", "(", "applicationContext", ".", ...
Sets the Spring bean factory for using endpoint names. @param applicationContext
[ "Sets", "the", "Spring", "bean", "factory", "for", "using", "endpoint", "names", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/builder/PurgeJmsQueuesBuilder.java#L151-L157
train
citrusframework/citrus
modules/citrus-jmx/src/main/java/com/consol/citrus/jmx/endpoint/JmxEndpointConfiguration.java
JmxEndpointConfiguration.getServerUrl
public String getServerUrl() { if (StringUtils.hasText(this.serverUrl)) { return serverUrl; } else { return "service:jmx:" + protocol + ":///jndi/" + protocol + "://" + host + ":" + port + (binding != null ? "/" + binding : ""); } }
java
public String getServerUrl() { if (StringUtils.hasText(this.serverUrl)) { return serverUrl; } else { return "service:jmx:" + protocol + ":///jndi/" + protocol + "://" + host + ":" + port + (binding != null ? "/" + binding : ""); } }
[ "public", "String", "getServerUrl", "(", ")", "{", "if", "(", "StringUtils", ".", "hasText", "(", "this", ".", "serverUrl", ")", ")", "{", "return", "serverUrl", ";", "}", "else", "{", "return", "\"service:jmx:\"", "+", "protocol", "+", "\":///jndi/\"", "+...
Gets the value of the serverUrl property. @return the serverUrl
[ "Gets", "the", "value", "of", "the", "serverUrl", "property", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-jmx/src/main/java/com/consol/citrus/jmx/endpoint/JmxEndpointConfiguration.java#L157-L163
train
citrusframework/citrus
modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/builder/SoapClientActionBuilder.java
SoapClientActionBuilder.receive
public SoapClientResponseActionBuilder receive() { SoapClientResponseActionBuilder soapClientResponseActionBuilder; if (soapClient != null) { soapClientResponseActionBuilder = new SoapClientResponseActionBuilder(action, soapClient); } else { soapClientResponseActionBuilder = new SoapClientResponseActionBuilder(action, soapClientUri); } soapClientResponseActionBuilder.withApplicationContext(applicationContext); return soapClientResponseActionBuilder; }
java
public SoapClientResponseActionBuilder receive() { SoapClientResponseActionBuilder soapClientResponseActionBuilder; if (soapClient != null) { soapClientResponseActionBuilder = new SoapClientResponseActionBuilder(action, soapClient); } else { soapClientResponseActionBuilder = new SoapClientResponseActionBuilder(action, soapClientUri); } soapClientResponseActionBuilder.withApplicationContext(applicationContext); return soapClientResponseActionBuilder; }
[ "public", "SoapClientResponseActionBuilder", "receive", "(", ")", "{", "SoapClientResponseActionBuilder", "soapClientResponseActionBuilder", ";", "if", "(", "soapClient", "!=", "null", ")", "{", "soapClientResponseActionBuilder", "=", "new", "SoapClientResponseActionBuilder", ...
Generic response builder for expecting response messages on client. @return
[ "Generic", "response", "builder", "for", "expecting", "response", "messages", "on", "client", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/builder/SoapClientActionBuilder.java#L59-L70
train
citrusframework/citrus
modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/builder/ConditionalBuilder.java
ConditionalBuilder.when
public ConditionalBuilder when(Object value, Matcher expression) { action.setConditionExpression(new HamcrestConditionExpression(expression, value)); return this; }
java
public ConditionalBuilder when(Object value, Matcher expression) { action.setConditionExpression(new HamcrestConditionExpression(expression, value)); return this; }
[ "public", "ConditionalBuilder", "when", "(", "Object", "value", ",", "Matcher", "expression", ")", "{", "action", ".", "setConditionExpression", "(", "new", "HamcrestConditionExpression", "(", "expression", ",", "value", ")", ")", ";", "return", "this", ";", "}"...
Condition which allows execution if evaluates to true. @param expression
[ "Condition", "which", "allows", "execution", "if", "evaluates", "to", "true", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/builder/ConditionalBuilder.java#L89-L92
train
citrusframework/citrus
modules/citrus-ws/src/main/java/com/consol/citrus/ws/message/SoapFault.java
SoapFault.locale
public SoapFault locale(String locale) { LocaleEditor localeEditor = new LocaleEditor(); localeEditor.setAsText(locale); this.locale = (Locale) localeEditor.getValue(); return this; }
java
public SoapFault locale(String locale) { LocaleEditor localeEditor = new LocaleEditor(); localeEditor.setAsText(locale); this.locale = (Locale) localeEditor.getValue(); return this; }
[ "public", "SoapFault", "locale", "(", "String", "locale", ")", "{", "LocaleEditor", "localeEditor", "=", "new", "LocaleEditor", "(", ")", ";", "localeEditor", ".", "setAsText", "(", "locale", ")", ";", "this", ".", "locale", "=", "(", "Locale", ")", "local...
Sets the locale used in SOAP fault. @param locale
[ "Sets", "the", "locale", "used", "in", "SOAP", "fault", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-ws/src/main/java/com/consol/citrus/ws/message/SoapFault.java#L147-L152
train
citrusframework/citrus
modules/citrus-ws/src/main/java/com/consol/citrus/ws/message/SoapFault.java
SoapFault.from
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()) .faultString(fault.getFaultStringOrReason()); if (fault.getFaultDetail() != null) { Iterator<SoapFaultDetailElement> details = fault.getFaultDetail().getDetailEntries(); while (details.hasNext()) { SoapFaultDetailElement soapFaultDetailElement = details.next(); soapFault.addFaultDetail(extractFaultDetail(soapFaultDetailElement)); } } return soapFault; }
java
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()) .faultString(fault.getFaultStringOrReason()); if (fault.getFaultDetail() != null) { Iterator<SoapFaultDetailElement> details = fault.getFaultDetail().getDetailEntries(); while (details.hasNext()) { SoapFaultDetailElement soapFaultDetailElement = details.next(); soapFault.addFaultDetail(extractFaultDetail(soapFaultDetailElement)); } } return soapFault; }
[ "public", "static", "SoapFault", "from", "(", "org", ".", "springframework", ".", "ws", ".", "soap", ".", "SoapFault", "fault", ")", "{", "QNameEditor", "qNameEditor", "=", "new", "QNameEditor", "(", ")", ";", "qNameEditor", ".", "setValue", "(", "fault", ...
Builder method from Spring WS SOAP fault object. @param fault @return
[ "Builder", "method", "from", "Spring", "WS", "SOAP", "fault", "object", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-ws/src/main/java/com/consol/citrus/ws/message/SoapFault.java#L199-L218
train
citrusframework/citrus
modules/citrus-ws/src/main/java/com/consol/citrus/ws/message/SoapFault.java
SoapFault.extractFaultDetail
private static String extractFaultDetail(SoapFaultDetailElement detail) { StringResult detailResult = new StringResult(); try { TransformerFactory transformerFactory = TransformerFactory.newInstance(); Transformer transformer = transformerFactory.newTransformer(); transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes"); transformer.transform(detail.getSource(), detailResult); } catch (TransformerException e) { throw new CitrusRuntimeException(e); } return detailResult.toString(); }
java
private static String extractFaultDetail(SoapFaultDetailElement detail) { StringResult detailResult = new StringResult(); try { TransformerFactory transformerFactory = TransformerFactory.newInstance(); Transformer transformer = transformerFactory.newTransformer(); transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes"); transformer.transform(detail.getSource(), detailResult); } catch (TransformerException e) { throw new CitrusRuntimeException(e); } return detailResult.toString(); }
[ "private", "static", "String", "extractFaultDetail", "(", "SoapFaultDetailElement", "detail", ")", "{", "StringResult", "detailResult", "=", "new", "StringResult", "(", ")", ";", "try", "{", "TransformerFactory", "transformerFactory", "=", "TransformerFactory", ".", "...
Extracts fault detail string from soap fault detail instance. Transforms detail source into string and takes care. @param detail @return
[ "Extracts", "fault", "detail", "string", "from", "soap", "fault", "detail", "instance", ".", "Transforms", "detail", "source", "into", "string", "and", "takes", "care", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-ws/src/main/java/com/consol/citrus/ws/message/SoapFault.java#L227-L242
train
citrusframework/citrus
modules/citrus-core/src/main/java/com/consol/citrus/validation/xml/XpathPayloadVariableExtractor.java
XpathPayloadVariableExtractor.extractVariables
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(message, namespaces); for (Entry<String, String> entry : xPathExpressions.entrySet()) { String pathExpression = context.replaceDynamicContentInString(entry.getKey()); String variableName = entry.getValue(); if (log.isDebugEnabled()) { log.debug("Evaluating XPath expression: " + pathExpression); } Document doc = XMLUtils.parseMessagePayload(message.getPayload(String.class)); if (XPathUtils.isXPathExpression(pathExpression)) { XPathExpressionResult resultType = XPathExpressionResult.fromString(pathExpression, XPathExpressionResult.STRING); pathExpression = XPathExpressionResult.cutOffPrefix(pathExpression); Object value = XPathUtils.evaluate(doc, pathExpression, nsContext, resultType); if (value == null) { throw new CitrusRuntimeException("Not able to find value for expression: " + pathExpression); } if (value instanceof List) { value = StringUtils.arrayToCommaDelimitedString(((List)value).toArray(new String[((List)value).size()])); } context.setVariable(variableName, value); } else { Node node = XMLUtils.findNodeByName(doc, pathExpression); if (node == null) { throw new UnknownElementException("No element found for expression" + pathExpression); } if (node.getNodeType() == Node.ELEMENT_NODE) { if (node.getFirstChild() != null) { context.setVariable(xPathExpressions.get(pathExpression), node.getFirstChild().getNodeValue()); } else { context.setVariable(xPathExpressions.get(pathExpression), ""); } } else { context.setVariable(xPathExpressions.get(pathExpression), node.getNodeValue()); } } } }
java
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(message, namespaces); for (Entry<String, String> entry : xPathExpressions.entrySet()) { String pathExpression = context.replaceDynamicContentInString(entry.getKey()); String variableName = entry.getValue(); if (log.isDebugEnabled()) { log.debug("Evaluating XPath expression: " + pathExpression); } Document doc = XMLUtils.parseMessagePayload(message.getPayload(String.class)); if (XPathUtils.isXPathExpression(pathExpression)) { XPathExpressionResult resultType = XPathExpressionResult.fromString(pathExpression, XPathExpressionResult.STRING); pathExpression = XPathExpressionResult.cutOffPrefix(pathExpression); Object value = XPathUtils.evaluate(doc, pathExpression, nsContext, resultType); if (value == null) { throw new CitrusRuntimeException("Not able to find value for expression: " + pathExpression); } if (value instanceof List) { value = StringUtils.arrayToCommaDelimitedString(((List)value).toArray(new String[((List)value).size()])); } context.setVariable(variableName, value); } else { Node node = XMLUtils.findNodeByName(doc, pathExpression); if (node == null) { throw new UnknownElementException("No element found for expression" + pathExpression); } if (node.getNodeType() == Node.ELEMENT_NODE) { if (node.getFirstChild() != null) { context.setVariable(xPathExpressions.get(pathExpression), node.getFirstChild().getNodeValue()); } else { context.setVariable(xPathExpressions.get(pathExpression), ""); } } else { context.setVariable(xPathExpressions.get(pathExpression), node.getNodeValue()); } } } }
[ "public", "void", "extractVariables", "(", "Message", "message", ",", "TestContext", "context", ")", "{", "if", "(", "CollectionUtils", ".", "isEmpty", "(", "xPathExpressions", ")", ")", "{", "return", ";", "}", "if", "(", "log", ".", "isDebugEnabled", "(", ...
Extract variables using Xpath expressions.
[ "Extract", "variables", "using", "Xpath", "expressions", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/validation/xml/XpathPayloadVariableExtractor.java#L58-L110
train
citrusframework/citrus
modules/citrus-core/src/main/java/com/consol/citrus/exceptions/CitrusRuntimeException.java
CitrusRuntimeException.getFailureStackAsString
public String getFailureStackAsString() { StringBuilder builder = new StringBuilder(); for (FailureStackElement failureStackElement : getFailureStack()) { builder.append("\n\t"); builder.append(failureStackElement.getStackMessage()); } return builder.toString(); }
java
public String getFailureStackAsString() { StringBuilder builder = new StringBuilder(); for (FailureStackElement failureStackElement : getFailureStack()) { builder.append("\n\t"); builder.append(failureStackElement.getStackMessage()); } return builder.toString(); }
[ "public", "String", "getFailureStackAsString", "(", ")", "{", "StringBuilder", "builder", "=", "new", "StringBuilder", "(", ")", ";", "for", "(", "FailureStackElement", "failureStackElement", ":", "getFailureStack", "(", ")", ")", "{", "builder", ".", "append", ...
Get formatted string representation of failure stack information. @return
[ "Get", "formatted", "string", "representation", "of", "failure", "stack", "information", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/exceptions/CitrusRuntimeException.java#L74-L83
train
citrusframework/citrus
modules/citrus-core/src/main/java/com/consol/citrus/exceptions/CitrusRuntimeException.java
CitrusRuntimeException.getFailureStack
public Stack<FailureStackElement> getFailureStack() { Stack<FailureStackElement> stack = new Stack<FailureStackElement>(); for (FailureStackElement failureStackElement : failureStack) { stack.push(failureStackElement); } return stack; }
java
public Stack<FailureStackElement> getFailureStack() { Stack<FailureStackElement> stack = new Stack<FailureStackElement>(); for (FailureStackElement failureStackElement : failureStack) { stack.push(failureStackElement); } return stack; }
[ "public", "Stack", "<", "FailureStackElement", ">", "getFailureStack", "(", ")", "{", "Stack", "<", "FailureStackElement", ">", "stack", "=", "new", "Stack", "<", "FailureStackElement", ">", "(", ")", ";", "for", "(", "FailureStackElement", "failureStackElement", ...
Gets the custom failure stack with line number information where the testcase failed. @return the failureStack
[ "Gets", "the", "custom", "failure", "stack", "with", "line", "number", "information", "where", "the", "testcase", "failed", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/exceptions/CitrusRuntimeException.java#L97-L105
train
citrusframework/citrus
modules/citrus-core/src/main/java/com/consol/citrus/config/xml/WaitParser.java
WaitParser.parseHttpCondition
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 = element.getAttribute("status"); if (StringUtils.hasText(statusCode)) { condition.setHttpResponseCode(statusCode); } String timeout = element.getAttribute("timeout"); if (StringUtils.hasText(timeout)) { condition.setTimeout(timeout); } return condition; }
java
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 = element.getAttribute("status"); if (StringUtils.hasText(statusCode)) { condition.setHttpResponseCode(statusCode); } String timeout = element.getAttribute("timeout"); if (StringUtils.hasText(timeout)) { condition.setTimeout(timeout); } return condition; }
[ "private", "Condition", "parseHttpCondition", "(", "Element", "element", ")", "{", "HttpCondition", "condition", "=", "new", "HttpCondition", "(", ")", ";", "condition", ".", "setUrl", "(", "element", ".", "getAttribute", "(", "\"url\"", ")", ")", ";", "String...
Parse Http request condition. @param element @return
[ "Parse", "Http", "request", "condition", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/config/xml/WaitParser.java#L92-L111
train
citrusframework/citrus
modules/citrus-core/src/main/java/com/consol/citrus/config/xml/WaitParser.java
WaitParser.parseMessageCondition
private Condition parseMessageCondition(Element element) { MessageCondition condition = new MessageCondition(); condition.setMessageName(element.getAttribute("name")); return condition; }
java
private Condition parseMessageCondition(Element element) { MessageCondition condition = new MessageCondition(); condition.setMessageName(element.getAttribute("name")); return condition; }
[ "private", "Condition", "parseMessageCondition", "(", "Element", "element", ")", "{", "MessageCondition", "condition", "=", "new", "MessageCondition", "(", ")", ";", "condition", ".", "setMessageName", "(", "element", ".", "getAttribute", "(", "\"name\"", ")", ")"...
Parse message store condition. @param element @return
[ "Parse", "message", "store", "condition", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/config/xml/WaitParser.java#L118-L123
train
citrusframework/citrus
modules/citrus-core/src/main/java/com/consol/citrus/config/xml/WaitParser.java
WaitParser.parseActionCondition
private BeanDefinition parseActionCondition(Element element, ParserContext parserContext) { Map<String, BeanDefinitionParser> actionRegistry = TestActionRegistry.getRegisteredActionParser(); Element action = DOMUtil.getFirstChildElement(element); if (action != null) { BeanDefinitionParser parser = actionRegistry.get(action.getTagName()); if (parser != null) { return parser.parse(action, parserContext); } else { return parserContext.getReaderContext().getNamespaceHandlerResolver().resolve(action.getNamespaceURI()).parse(action, parserContext); } } throw new BeanCreationException("Invalid wait for action condition - action not set properly"); }
java
private BeanDefinition parseActionCondition(Element element, ParserContext parserContext) { Map<String, BeanDefinitionParser> actionRegistry = TestActionRegistry.getRegisteredActionParser(); Element action = DOMUtil.getFirstChildElement(element); if (action != null) { BeanDefinitionParser parser = actionRegistry.get(action.getTagName()); if (parser != null) { return parser.parse(action, parserContext); } else { return parserContext.getReaderContext().getNamespaceHandlerResolver().resolve(action.getNamespaceURI()).parse(action, parserContext); } } throw new BeanCreationException("Invalid wait for action condition - action not set properly"); }
[ "private", "BeanDefinition", "parseActionCondition", "(", "Element", "element", ",", "ParserContext", "parserContext", ")", "{", "Map", "<", "String", ",", "BeanDefinitionParser", ">", "actionRegistry", "=", "TestActionRegistry", ".", "getRegisteredActionParser", "(", "...
Parse test action condition. @param element @param parserContext @return
[ "Parse", "test", "action", "condition", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/config/xml/WaitParser.java#L131-L146
train
citrusframework/citrus
modules/citrus-core/src/main/java/com/consol/citrus/config/xml/WaitParser.java
WaitParser.parseFileCondition
private Condition parseFileCondition(Element element) { FileCondition condition = new FileCondition(); condition.setFilePath(element.getAttribute("path")); return condition; }
java
private Condition parseFileCondition(Element element) { FileCondition condition = new FileCondition(); condition.setFilePath(element.getAttribute("path")); return condition; }
[ "private", "Condition", "parseFileCondition", "(", "Element", "element", ")", "{", "FileCondition", "condition", "=", "new", "FileCondition", "(", ")", ";", "condition", ".", "setFilePath", "(", "element", ".", "getAttribute", "(", "\"path\"", ")", ")", ";", "...
Parse file existence condition. @param element @return
[ "Parse", "file", "existence", "condition", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/config/xml/WaitParser.java#L153-L157
train
citrusframework/citrus
modules/citrus-ws/src/main/java/com/consol/citrus/ws/server/WebServiceServer.java
WebServiceServer.addDispatcherServlet
private void addDispatcherServlet() { ServletHolder servletHolder = new ServletHolder(new CitrusMessageDispatcherServlet(this)); servletHolder.setName(getServletName()); servletHolder.setInitParameter("contextConfigLocation", contextConfigLocation); servletHandler.addServlet(servletHolder); ServletMapping servletMapping = new ServletMapping(); servletMapping.setServletName(getServletName()); servletMapping.setPathSpec(servletMappingPath); servletHandler.addServletMapping(servletMapping); }
java
private void addDispatcherServlet() { ServletHolder servletHolder = new ServletHolder(new CitrusMessageDispatcherServlet(this)); servletHolder.setName(getServletName()); servletHolder.setInitParameter("contextConfigLocation", contextConfigLocation); servletHandler.addServlet(servletHolder); ServletMapping servletMapping = new ServletMapping(); servletMapping.setServletName(getServletName()); servletMapping.setPathSpec(servletMappingPath); servletHandler.addServletMapping(servletMapping); }
[ "private", "void", "addDispatcherServlet", "(", ")", "{", "ServletHolder", "servletHolder", "=", "new", "ServletHolder", "(", "new", "CitrusMessageDispatcherServlet", "(", "this", ")", ")", ";", "servletHolder", ".", "setName", "(", "getServletName", "(", ")", ")"...
Adds Citrus message dispatcher servlet.
[ "Adds", "Citrus", "message", "dispatcher", "servlet", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-ws/src/main/java/com/consol/citrus/ws/server/WebServiceServer.java#L186-L198
train
citrusframework/citrus
modules/citrus-ws/src/main/java/com/consol/citrus/ws/server/WebServiceServer.java
WebServiceServer.getConnectors
public Connector[] getConnectors() { if (connectors != null) { return Arrays.copyOf(connectors, connectors.length); } else { return new Connector[]{}; } }
java
public Connector[] getConnectors() { if (connectors != null) { return Arrays.copyOf(connectors, connectors.length); } else { return new Connector[]{}; } }
[ "public", "Connector", "[", "]", "getConnectors", "(", ")", "{", "if", "(", "connectors", "!=", "null", ")", "{", "return", "Arrays", ".", "copyOf", "(", "connectors", ",", "connectors", ".", "length", ")", ";", "}", "else", "{", "return", "new", "Conn...
Gets the connectors. @return the connectors
[ "Gets", "the", "connectors", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-ws/src/main/java/com/consol/citrus/ws/server/WebServiceServer.java#L434-L440
train
citrusframework/citrus
modules/citrus-core/src/main/java/com/consol/citrus/validation/script/ScriptValidationContext.java
ScriptValidationContext.getValidationScript
public String getValidationScript(TestContext context) { try { if (validationScriptResourcePath != null) { return context.replaceDynamicContentInString(FileUtils.readToString(FileUtils.getFileResource(validationScriptResourcePath, context), Charset.forName(context.replaceDynamicContentInString(validationScriptResourceCharset)))); } else if (validationScript != null) { return context.replaceDynamicContentInString(validationScript); } else { return ""; } } catch (IOException e) { throw new CitrusRuntimeException("Failed to load validation script resource", e); } }
java
public String getValidationScript(TestContext context) { try { if (validationScriptResourcePath != null) { return context.replaceDynamicContentInString(FileUtils.readToString(FileUtils.getFileResource(validationScriptResourcePath, context), Charset.forName(context.replaceDynamicContentInString(validationScriptResourceCharset)))); } else if (validationScript != null) { return context.replaceDynamicContentInString(validationScript); } else { return ""; } } catch (IOException e) { throw new CitrusRuntimeException("Failed to load validation script resource", e); } }
[ "public", "String", "getValidationScript", "(", "TestContext", "context", ")", "{", "try", "{", "if", "(", "validationScriptResourcePath", "!=", "null", ")", "{", "return", "context", ".", "replaceDynamicContentInString", "(", "FileUtils", ".", "readToString", "(", ...
Constructs the actual validation script either from data or external resource. @param context the current TestContext. @return the validationScript @throws CitrusRuntimeException
[ "Constructs", "the", "actual", "validation", "script", "either", "from", "data", "or", "external", "resource", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/validation/script/ScriptValidationContext.java#L75-L88
train
citrusframework/citrus
modules/citrus-http/src/main/java/com/consol/citrus/http/message/DelegatingHttpEntityMessageConverter.java
DelegatingHttpEntityMessageConverter.setBinaryMediaTypes
public void setBinaryMediaTypes(List<MediaType> binaryMediaTypes) { requestMessageConverters.stream() .filter(converter -> converter instanceof ByteArrayHttpMessageConverter) .map(ByteArrayHttpMessageConverter.class::cast) .forEach(converter -> converter.setSupportedMediaTypes(binaryMediaTypes)); responseMessageConverters.stream() .filter(converter -> converter instanceof ByteArrayHttpMessageConverter) .map(ByteArrayHttpMessageConverter.class::cast) .forEach(converter -> converter.setSupportedMediaTypes(binaryMediaTypes)); }
java
public void setBinaryMediaTypes(List<MediaType> binaryMediaTypes) { requestMessageConverters.stream() .filter(converter -> converter instanceof ByteArrayHttpMessageConverter) .map(ByteArrayHttpMessageConverter.class::cast) .forEach(converter -> converter.setSupportedMediaTypes(binaryMediaTypes)); responseMessageConverters.stream() .filter(converter -> converter instanceof ByteArrayHttpMessageConverter) .map(ByteArrayHttpMessageConverter.class::cast) .forEach(converter -> converter.setSupportedMediaTypes(binaryMediaTypes)); }
[ "public", "void", "setBinaryMediaTypes", "(", "List", "<", "MediaType", ">", "binaryMediaTypes", ")", "{", "requestMessageConverters", ".", "stream", "(", ")", ".", "filter", "(", "converter", "->", "converter", "instanceof", "ByteArrayHttpMessageConverter", ")", "....
Sets the binaryMediaTypes. @param binaryMediaTypes
[ "Sets", "the", "binaryMediaTypes", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-http/src/main/java/com/consol/citrus/http/message/DelegatingHttpEntityMessageConverter.java#L136-L146
train
citrusframework/citrus
modules/citrus-ws/src/main/java/com/consol/citrus/ws/message/callback/SoapRequestMessageCallback.java
SoapRequestMessageCallback.doWithMessage
public void doWithMessage(WebServiceMessage requestMessage) throws IOException, TransformerException { endpointConfiguration.getMessageConverter().convertOutbound(requestMessage, message, endpointConfiguration, context); }
java
public void doWithMessage(WebServiceMessage requestMessage) throws IOException, TransformerException { endpointConfiguration.getMessageConverter().convertOutbound(requestMessage, message, endpointConfiguration, context); }
[ "public", "void", "doWithMessage", "(", "WebServiceMessage", "requestMessage", ")", "throws", "IOException", ",", "TransformerException", "{", "endpointConfiguration", ".", "getMessageConverter", "(", ")", ".", "convertOutbound", "(", "requestMessage", ",", "message", "...
Callback method called before request message is sent.
[ "Callback", "method", "called", "before", "request", "message", "is", "sent", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-ws/src/main/java/com/consol/citrus/ws/message/callback/SoapRequestMessageCallback.java#L61-L63
train
citrusframework/citrus
modules/citrus-http/src/main/java/com/consol/citrus/http/message/HttpMessage.java
HttpMessage.copyCookies
private void copyCookies(final Message message) { if (message instanceof HttpMessage) { this.cookies.putAll(((HttpMessage) message).getCookiesMap()); } }
java
private void copyCookies(final Message message) { if (message instanceof HttpMessage) { this.cookies.putAll(((HttpMessage) message).getCookiesMap()); } }
[ "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 @param message the message to extract the cookies from
[ "Sets", "the", "cookies", "extracted", "from", "the", "given", "message", "as", "far", "as", "it", "is", "a", "HttpMessage" ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-http/src/main/java/com/consol/citrus/http/message/HttpMessage.java#L100-L104
train
citrusframework/citrus
modules/citrus-http/src/main/java/com/consol/citrus/http/message/HttpMessage.java
HttpMessage.status
public HttpMessage status(final HttpStatus statusCode) { statusCode(statusCode.value()); reasonPhrase(statusCode.name()); return this; }
java
public HttpMessage status(final HttpStatus statusCode) { statusCode(statusCode.value()); reasonPhrase(statusCode.name()); return this; }
[ "public", "HttpMessage", "status", "(", "final", "HttpStatus", "statusCode", ")", "{", "statusCode", "(", "statusCode", ".", "value", "(", ")", ")", ";", "reasonPhrase", "(", "statusCode", ".", "name", "(", ")", ")", ";", "return", "this", ";", "}" ]
Sets the Http response status code. @param statusCode The status code header to respond with @return The altered HttpMessage
[ "Sets", "the", "Http", "response", "status", "code", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-http/src/main/java/com/consol/citrus/http/message/HttpMessage.java#L134-L138
train
citrusframework/citrus
modules/citrus-http/src/main/java/com/consol/citrus/http/message/HttpMessage.java
HttpMessage.uri
public HttpMessage uri(final String requestUri) { setHeader(DynamicEndpointUriResolver.ENDPOINT_URI_HEADER_NAME, requestUri); setHeader(HttpMessageHeaders.HTTP_REQUEST_URI, requestUri); return this; }
java
public HttpMessage uri(final String requestUri) { setHeader(DynamicEndpointUriResolver.ENDPOINT_URI_HEADER_NAME, requestUri); setHeader(HttpMessageHeaders.HTTP_REQUEST_URI, requestUri); return this; }
[ "public", "HttpMessage", "uri", "(", "final", "String", "requestUri", ")", "{", "setHeader", "(", "DynamicEndpointUriResolver", ".", "ENDPOINT_URI_HEADER_NAME", ",", "requestUri", ")", ";", "setHeader", "(", "HttpMessageHeaders", ".", "HTTP_REQUEST_URI", ",", "request...
Sets the Http request request uri header. @param requestUri The request uri header value to use @return The altered HttpMessage
[ "Sets", "the", "Http", "request", "request", "uri", "header", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-http/src/main/java/com/consol/citrus/http/message/HttpMessage.java#L168-L172
train
citrusframework/citrus
modules/citrus-http/src/main/java/com/consol/citrus/http/message/HttpMessage.java
HttpMessage.queryParam
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() .map(this::outputQueryParam) .collect(Collectors.joining(",")); header(HttpMessageHeaders.HTTP_QUERY_PARAMS, queryParamString); header(DynamicEndpointUriResolver.QUERY_PARAM_HEADER_NAME, queryParamString); return this; }
java
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() .map(this::outputQueryParam) .collect(Collectors.joining(",")); header(HttpMessageHeaders.HTTP_QUERY_PARAMS, queryParamString); header(DynamicEndpointUriResolver.QUERY_PARAM_HEADER_NAME, queryParamString); return this; }
[ "public", "HttpMessage", "queryParam", "(", "final", "String", "name", ",", "final", "String", "value", ")", "{", "if", "(", "!", "StringUtils", ".", "hasText", "(", "name", ")", ")", "{", "throw", "new", "CitrusRuntimeException", "(", "\"Invalid query param n...
Sets a new Http request query param. @param name The name of the request query parameter @param value The value of the request query parameter @return The altered HttpMessage
[ "Sets", "a", "new", "Http", "request", "query", "param", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-http/src/main/java/com/consol/citrus/http/message/HttpMessage.java#L243-L259
train
citrusframework/citrus
modules/citrus-http/src/main/java/com/consol/citrus/http/message/HttpMessage.java
HttpMessage.path
public HttpMessage path(final String path) { header(HttpMessageHeaders.HTTP_REQUEST_URI, path); header(DynamicEndpointUriResolver.REQUEST_PATH_HEADER_NAME, path); return this; }
java
public HttpMessage path(final String path) { header(HttpMessageHeaders.HTTP_REQUEST_URI, path); header(DynamicEndpointUriResolver.REQUEST_PATH_HEADER_NAME, path); return this; }
[ "public", "HttpMessage", "path", "(", "final", "String", "path", ")", "{", "header", "(", "HttpMessageHeaders", ".", "HTTP_REQUEST_URI", ",", "path", ")", ";", "header", "(", "DynamicEndpointUriResolver", ".", "REQUEST_PATH_HEADER_NAME", ",", "path", ")", ";", "...
Sets request path that is dynamically added to base uri. @param path The part of the path to add @return The altered HttpMessage
[ "Sets", "request", "path", "that", "is", "dynamically", "added", "to", "base", "uri", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-http/src/main/java/com/consol/citrus/http/message/HttpMessage.java#L269-L273
train
citrusframework/citrus
modules/citrus-http/src/main/java/com/consol/citrus/http/message/HttpMessage.java
HttpMessage.getRequestMethod
public HttpMethod getRequestMethod() { final Object method = getHeader(HttpMessageHeaders.HTTP_REQUEST_METHOD); if (method != null) { return HttpMethod.valueOf(method.toString()); } return null; }
java
public HttpMethod getRequestMethod() { final Object method = getHeader(HttpMessageHeaders.HTTP_REQUEST_METHOD); if (method != null) { return HttpMethod.valueOf(method.toString()); } return null; }
[ "public", "HttpMethod", "getRequestMethod", "(", ")", "{", "final", "Object", "method", "=", "getHeader", "(", "HttpMessageHeaders", ".", "HTTP_REQUEST_METHOD", ")", ";", "if", "(", "method", "!=", "null", ")", "{", "return", "HttpMethod", ".", "valueOf", "(",...
Gets the Http request method. @return The used HttpMethod
[ "Gets", "the", "Http", "request", "method", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-http/src/main/java/com/consol/citrus/http/message/HttpMessage.java#L301-L309
train
citrusframework/citrus
modules/citrus-http/src/main/java/com/consol/citrus/http/message/HttpMessage.java
HttpMessage.getUri
public String getUri() { final Object requestUri = getHeader(HttpMessageHeaders.HTTP_REQUEST_URI); if (requestUri != null) { return requestUri.toString(); } return null; }
java
public String getUri() { final Object requestUri = getHeader(HttpMessageHeaders.HTTP_REQUEST_URI); if (requestUri != null) { return requestUri.toString(); } return null; }
[ "public", "String", "getUri", "(", ")", "{", "final", "Object", "requestUri", "=", "getHeader", "(", "HttpMessageHeaders", ".", "HTTP_REQUEST_URI", ")", ";", "if", "(", "requestUri", "!=", "null", ")", "{", "return", "requestUri", ".", "toString", "(", ")", ...
Gets the Http request request uri. @return The request uri
[ "Gets", "the", "Http", "request", "request", "uri", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-http/src/main/java/com/consol/citrus/http/message/HttpMessage.java#L316-L324
train
citrusframework/citrus
modules/citrus-http/src/main/java/com/consol/citrus/http/message/HttpMessage.java
HttpMessage.getContextPath
public String getContextPath() { final Object contextPath = getHeader(HttpMessageHeaders.HTTP_CONTEXT_PATH); if (contextPath != null) { return contextPath.toString(); } return null; }
java
public String getContextPath() { final Object contextPath = getHeader(HttpMessageHeaders.HTTP_CONTEXT_PATH); if (contextPath != null) { return contextPath.toString(); } return null; }
[ "public", "String", "getContextPath", "(", ")", "{", "final", "Object", "contextPath", "=", "getHeader", "(", "HttpMessageHeaders", ".", "HTTP_CONTEXT_PATH", ")", ";", "if", "(", "contextPath", "!=", "null", ")", "{", "return", "contextPath", ".", "toString", ...
Gets the Http request context path. @return the context path
[ "Gets", "the", "Http", "request", "context", "path", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-http/src/main/java/com/consol/citrus/http/message/HttpMessage.java#L331-L339
train
citrusframework/citrus
modules/citrus-http/src/main/java/com/consol/citrus/http/message/HttpMessage.java
HttpMessage.getContentType
public String getContentType() { final Object contentType = getHeader(HttpMessageHeaders.HTTP_CONTENT_TYPE); if (contentType != null) { return contentType.toString(); } return null; }
java
public String getContentType() { final Object contentType = getHeader(HttpMessageHeaders.HTTP_CONTENT_TYPE); if (contentType != null) { return contentType.toString(); } return null; }
[ "public", "String", "getContentType", "(", ")", "{", "final", "Object", "contentType", "=", "getHeader", "(", "HttpMessageHeaders", ".", "HTTP_CONTENT_TYPE", ")", ";", "if", "(", "contentType", "!=", "null", ")", "{", "return", "contentType", ".", "toString", ...
Gets the Http content type header. @return the content type header value
[ "Gets", "the", "Http", "content", "type", "header", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-http/src/main/java/com/consol/citrus/http/message/HttpMessage.java#L346-L354
train
citrusframework/citrus
modules/citrus-http/src/main/java/com/consol/citrus/http/message/HttpMessage.java
HttpMessage.getAccept
public String getAccept() { final Object accept = getHeader("Accept"); if (accept != null) { return accept.toString(); } return null; }
java
public String getAccept() { final Object accept = getHeader("Accept"); if (accept != null) { return accept.toString(); } return null; }
[ "public", "String", "getAccept", "(", ")", "{", "final", "Object", "accept", "=", "getHeader", "(", "\"Accept\"", ")", ";", "if", "(", "accept", "!=", "null", ")", "{", "return", "accept", ".", "toString", "(", ")", ";", "}", "return", "null", ";", "...
Gets the accept header. @return The accept header value
[ "Gets", "the", "accept", "header", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-http/src/main/java/com/consol/citrus/http/message/HttpMessage.java#L361-L369
train
citrusframework/citrus
modules/citrus-http/src/main/java/com/consol/citrus/http/message/HttpMessage.java
HttpMessage.getQueryParamString
public String getQueryParamString() { return Optional.ofNullable(getHeader(HttpMessageHeaders.HTTP_QUERY_PARAMS)).map(Object::toString).orElse(""); }
java
public String getQueryParamString() { return Optional.ofNullable(getHeader(HttpMessageHeaders.HTTP_QUERY_PARAMS)).map(Object::toString).orElse(""); }
[ "public", "String", "getQueryParamString", "(", ")", "{", "return", "Optional", ".", "ofNullable", "(", "getHeader", "(", "HttpMessageHeaders", ".", "HTTP_QUERY_PARAMS", ")", ")", ".", "map", "(", "Object", "::", "toString", ")", ".", "orElse", "(", "\"\"", ...
Gets the Http request query param string. @return The query parameter as string
[ "Gets", "the", "Http", "request", "query", "param", "string", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-http/src/main/java/com/consol/citrus/http/message/HttpMessage.java#L385-L387
train
citrusframework/citrus
modules/citrus-http/src/main/java/com/consol/citrus/http/message/HttpMessage.java
HttpMessage.getStatusCode
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) statusCode); } else { return HttpStatus.valueOf(Integer.valueOf(statusCode.toString())); } } return null; }
java
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) statusCode); } else { return HttpStatus.valueOf(Integer.valueOf(statusCode.toString())); } } return null; }
[ "public", "HttpStatus", "getStatusCode", "(", ")", "{", "final", "Object", "statusCode", "=", "getHeader", "(", "HttpMessageHeaders", ".", "HTTP_STATUS_CODE", ")", ";", "if", "(", "statusCode", "!=", "null", ")", "{", "if", "(", "statusCode", "instanceof", "Ht...
Gets the Http response status code. @return The status code of the message
[ "Gets", "the", "Http", "response", "status", "code", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-http/src/main/java/com/consol/citrus/http/message/HttpMessage.java#L394-L408
train
citrusframework/citrus
modules/citrus-http/src/main/java/com/consol/citrus/http/message/HttpMessage.java
HttpMessage.getReasonPhrase
public String getReasonPhrase() { final Object reasonPhrase = getHeader(HttpMessageHeaders.HTTP_REASON_PHRASE); if (reasonPhrase != null) { return reasonPhrase.toString(); } return null; }
java
public String getReasonPhrase() { final Object reasonPhrase = getHeader(HttpMessageHeaders.HTTP_REASON_PHRASE); if (reasonPhrase != null) { return reasonPhrase.toString(); } return null; }
[ "public", "String", "getReasonPhrase", "(", ")", "{", "final", "Object", "reasonPhrase", "=", "getHeader", "(", "HttpMessageHeaders", ".", "HTTP_REASON_PHRASE", ")", ";", "if", "(", "reasonPhrase", "!=", "null", ")", "{", "return", "reasonPhrase", ".", "toString...
Gets the Http response reason phrase. @return The reason phrase of the message
[ "Gets", "the", "Http", "response", "reason", "phrase", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-http/src/main/java/com/consol/citrus/http/message/HttpMessage.java#L415-L423
train
citrusframework/citrus
modules/citrus-http/src/main/java/com/consol/citrus/http/message/HttpMessage.java
HttpMessage.getVersion
public String getVersion() { final Object version = getHeader(HttpMessageHeaders.HTTP_VERSION); if (version != null) { return version.toString(); } return null; }
java
public String getVersion() { final Object version = getHeader(HttpMessageHeaders.HTTP_VERSION); if (version != null) { return version.toString(); } return null; }
[ "public", "String", "getVersion", "(", ")", "{", "final", "Object", "version", "=", "getHeader", "(", "HttpMessageHeaders", ".", "HTTP_VERSION", ")", ";", "if", "(", "version", "!=", "null", ")", "{", "return", "version", ".", "toString", "(", ")", ";", ...
Gets the Http version. @return The http version of the message
[ "Gets", "the", "Http", "version", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-http/src/main/java/com/consol/citrus/http/message/HttpMessage.java#L430-L438
train
citrusframework/citrus
modules/citrus-http/src/main/java/com/consol/citrus/http/message/HttpMessage.java
HttpMessage.getPath
public String getPath() { final Object path = getHeader(DynamicEndpointUriResolver.REQUEST_PATH_HEADER_NAME); if (path != null) { return path.toString(); } return null; }
java
public String getPath() { final Object path = getHeader(DynamicEndpointUriResolver.REQUEST_PATH_HEADER_NAME); if (path != null) { return path.toString(); } return null; }
[ "public", "String", "getPath", "(", ")", "{", "final", "Object", "path", "=", "getHeader", "(", "DynamicEndpointUriResolver", ".", "REQUEST_PATH_HEADER_NAME", ")", ";", "if", "(", "path", "!=", "null", ")", "{", "return", "path", ".", "toString", "(", ")", ...
Gets the request path after the context path. @return The request path of the message
[ "Gets", "the", "request", "path", "after", "the", "context", "path", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-http/src/main/java/com/consol/citrus/http/message/HttpMessage.java#L445-L453
train
citrusframework/citrus
modules/citrus-http/src/main/java/com/consol/citrus/http/message/HttpMessage.java
HttpMessage.setCookies
public void setCookies(final Cookie[] cookies) { this.cookies.clear(); if (cookies != null) { for (final Cookie cookie : cookies) { cookie(cookie); } } }
java
public void setCookies(final Cookie[] cookies) { this.cookies.clear(); if (cookies != null) { for (final Cookie cookie : cookies) { cookie(cookie); } } }
[ "public", "void", "setCookies", "(", "final", "Cookie", "[", "]", "cookies", ")", "{", "this", ".", "cookies", ".", "clear", "(", ")", ";", "if", "(", "cookies", "!=", "null", ")", "{", "for", "(", "final", "Cookie", "cookie", ":", "cookies", ")", ...
Sets the cookies. @param cookies The cookies to set
[ "Sets", "the", "cookies", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-http/src/main/java/com/consol/citrus/http/message/HttpMessage.java#L478-L485
train
citrusframework/citrus
modules/citrus-http/src/main/java/com/consol/citrus/http/message/HttpMessage.java
HttpMessage.cookie
public HttpMessage cookie(final Cookie cookie) { this.cookies.put(cookie.getName(), cookie); setHeader( HttpMessageHeaders.HTTP_COOKIE_PREFIX + cookie.getName(), cookieConverter.getCookieString(cookie)); return this; }
java
public HttpMessage cookie(final Cookie cookie) { this.cookies.put(cookie.getName(), cookie); setHeader( HttpMessageHeaders.HTTP_COOKIE_PREFIX + cookie.getName(), cookieConverter.getCookieString(cookie)); return this; }
[ "public", "HttpMessage", "cookie", "(", "final", "Cookie", "cookie", ")", "{", "this", ".", "cookies", ".", "put", "(", "cookie", ".", "getName", "(", ")", ",", "cookie", ")", ";", "setHeader", "(", "HttpMessageHeaders", ".", "HTTP_COOKIE_PREFIX", "+", "co...
Adds new cookie to this http message. @param cookie The Cookie to set @return The altered HttpMessage
[ "Adds", "new", "cookie", "to", "this", "http", "message", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-http/src/main/java/com/consol/citrus/http/message/HttpMessage.java#L493-L501
train
citrusframework/citrus
modules/citrus-http/src/main/java/com/consol/citrus/http/message/HttpMessage.java
HttpMessage.fromRequestData
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 > 0) { request.method(HttpMethod.valueOf(requestLine[0])); } if (requestLine.length > 1) { request.uri(requestLine[1]); } if (requestLine.length > 2) { request.version(requestLine[2]); } return parseHttpMessage(reader, request); } catch (final IOException e) { throw new CitrusRuntimeException("Failed to parse Http raw request data", e); } }
java
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 > 0) { request.method(HttpMethod.valueOf(requestLine[0])); } if (requestLine.length > 1) { request.uri(requestLine[1]); } if (requestLine.length > 2) { request.version(requestLine[2]); } return parseHttpMessage(reader, request); } catch (final IOException e) { throw new CitrusRuntimeException("Failed to parse Http raw request data", e); } }
[ "public", "static", "HttpMessage", "fromRequestData", "(", "final", "String", "requestData", ")", "{", "try", "(", "final", "BufferedReader", "reader", "=", "new", "BufferedReader", "(", "new", "StringReader", "(", "requestData", ")", ")", ")", "{", "final", "...
Reads request from complete request dump. @param requestData The request dump to parse @return The parsed dump as HttpMessage
[ "Reads", "request", "from", "complete", "request", "dump", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-http/src/main/java/com/consol/citrus/http/message/HttpMessage.java#L509-L530
train
citrusframework/citrus
modules/citrus-http/src/main/java/com/consol/citrus/http/message/HttpMessage.java
HttpMessage.fromResponseData
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 > 0) { response.version(statusLine[0]); } if (statusLine.length > 1) { response.status(HttpStatus.valueOf(Integer.valueOf(statusLine[1]))); } return parseHttpMessage(reader, response); } catch (final IOException e) { throw new CitrusRuntimeException("Failed to parse Http raw response data", e); } }
java
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 > 0) { response.version(statusLine[0]); } if (statusLine.length > 1) { response.status(HttpStatus.valueOf(Integer.valueOf(statusLine[1]))); } return parseHttpMessage(reader, response); } catch (final IOException e) { throw new CitrusRuntimeException("Failed to parse Http raw response data", e); } }
[ "public", "static", "HttpMessage", "fromResponseData", "(", "final", "String", "responseData", ")", "{", "try", "(", "final", "BufferedReader", "reader", "=", "new", "BufferedReader", "(", "new", "StringReader", "(", "responseData", ")", ")", ")", "{", "final", ...
Reads response from complete response dump. @param responseData The response dump to parse @return The parsed dump as HttpMessage
[ "Reads", "response", "from", "complete", "response", "dump", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-http/src/main/java/com/consol/citrus/http/message/HttpMessage.java#L538-L555
train
citrusframework/citrus
modules/citrus-core/src/main/java/com/consol/citrus/variable/GlobalVariablesPropertyLoader.java
GlobalVariablesPropertyLoader.loadPropertiesAsVariables
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 " + propertyFile.getFilename()); // Use input stream as this also allows to read from resources in a JAR file reader = new BufferedReader(new InputStreamReader(propertyFile.getInputStream())); // local context instance handling variable replacement in property values TestContext context = new TestContext(); // Careful!! The function registry *must* be set before setting the global variables. // Variables can contain functions which are resolved when context.setGlobalVariables is invoked. context.setFunctionRegistry(functionRegistry); context.setGlobalVariables(globalVariables); String propertyExpression; while ((propertyExpression = reader.readLine()) != null) { log.debug("Property line [ {} ]", propertyExpression); propertyExpression = propertyExpression.trim(); if (!isPropertyLine(propertyExpression)) { continue; } String key = propertyExpression.substring(0, propertyExpression.indexOf('=')).trim(); String value = propertyExpression.substring(propertyExpression.indexOf('=') + 1).trim(); log.debug("Property value replace dynamic content [ {} ]", value); value = context.replaceDynamicContentInString(value); if (log.isDebugEnabled()) { log.debug("Loading property: " + key + "=" + value + " into default variables"); } if (log.isDebugEnabled() && globalVariables.getVariables().containsKey(key)) { log.debug("Overwriting property " + key + " old value:" + globalVariables.getVariables().get(key) + " new value:" + value); } globalVariables.getVariables().put(key, value); // we need to keep local context up to date in case of recursive variable usage context.setVariable(key, globalVariables.getVariables().get(key)); } log.info("Loaded property file " + propertyFile.getFilename()); } } } catch (IOException e) { throw new CitrusRuntimeException("Error while loading property file", e); } finally { if (reader != null) { try { reader.close(); } catch (IOException e) { log.warn("Unable to close property file reader", e); } } } }
java
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 " + propertyFile.getFilename()); // Use input stream as this also allows to read from resources in a JAR file reader = new BufferedReader(new InputStreamReader(propertyFile.getInputStream())); // local context instance handling variable replacement in property values TestContext context = new TestContext(); // Careful!! The function registry *must* be set before setting the global variables. // Variables can contain functions which are resolved when context.setGlobalVariables is invoked. context.setFunctionRegistry(functionRegistry); context.setGlobalVariables(globalVariables); String propertyExpression; while ((propertyExpression = reader.readLine()) != null) { log.debug("Property line [ {} ]", propertyExpression); propertyExpression = propertyExpression.trim(); if (!isPropertyLine(propertyExpression)) { continue; } String key = propertyExpression.substring(0, propertyExpression.indexOf('=')).trim(); String value = propertyExpression.substring(propertyExpression.indexOf('=') + 1).trim(); log.debug("Property value replace dynamic content [ {} ]", value); value = context.replaceDynamicContentInString(value); if (log.isDebugEnabled()) { log.debug("Loading property: " + key + "=" + value + " into default variables"); } if (log.isDebugEnabled() && globalVariables.getVariables().containsKey(key)) { log.debug("Overwriting property " + key + " old value:" + globalVariables.getVariables().get(key) + " new value:" + value); } globalVariables.getVariables().put(key, value); // we need to keep local context up to date in case of recursive variable usage context.setVariable(key, globalVariables.getVariables().get(key)); } log.info("Loaded property file " + propertyFile.getFilename()); } } } catch (IOException e) { throw new CitrusRuntimeException("Error while loading property file", e); } finally { if (reader != null) { try { reader.close(); } catch (IOException e) { log.warn("Unable to close property file reader", e); } } } }
[ "public", "void", "loadPropertiesAsVariables", "(", ")", "{", "BufferedReader", "reader", "=", "null", ";", "try", "{", "if", "(", "propertyFilesSet", "(", ")", ")", "{", "for", "(", "String", "propertyFilePath", ":", "propertyFiles", ")", "{", "Resource", "...
Load the properties as variables. @throws CitrusRuntimeException
[ "Load", "the", "properties", "as", "variables", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/variable/GlobalVariablesPropertyLoader.java#L59-L124
train
citrusframework/citrus
modules/citrus-core/src/main/java/com/consol/citrus/condition/HttpCondition.java
HttpCondition.invokeUrl
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 = openConnection(contextUrl); httpURLConnection.setConnectTimeout(getTimeout(context)); httpURLConnection.setRequestMethod(context.resolveDynamicValue(method)); responseCode = httpURLConnection.getResponseCode(); } catch (IOException e) { log.warn(String.format("Could not access Http url '%s' - %s", contextUrl.toExternalForm(), e.getMessage())); } finally { if (httpURLConnection != null) { httpURLConnection.disconnect(); } } return responseCode; }
java
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 = openConnection(contextUrl); httpURLConnection.setConnectTimeout(getTimeout(context)); httpURLConnection.setRequestMethod(context.resolveDynamicValue(method)); responseCode = httpURLConnection.getResponseCode(); } catch (IOException e) { log.warn(String.format("Could not access Http url '%s' - %s", contextUrl.toExternalForm(), e.getMessage())); } finally { if (httpURLConnection != null) { httpURLConnection.disconnect(); } } return responseCode; }
[ "private", "int", "invokeUrl", "(", "TestContext", "context", ")", "{", "URL", "contextUrl", "=", "getUrl", "(", "context", ")", ";", "if", "(", "log", ".", "isDebugEnabled", "(", ")", ")", "{", "log", ".", "debug", "(", "String", ".", "format", "(", ...
Invokes Http request URL and returns response code. @param context The context to use for the URL invocation @return The response code of the request
[ "Invokes", "Http", "request", "URL", "and", "returns", "response", "code", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/condition/HttpCondition.java#L81-L105
train
citrusframework/citrus
modules/citrus-core/src/main/java/com/consol/citrus/condition/HttpCondition.java
HttpCondition.getUrl
private URL getUrl(TestContext context) { try { return new URL(context.replaceDynamicContentInString(this.url)); } catch (MalformedURLException e) { throw new CitrusRuntimeException("Invalid request url", e); } }
java
private URL getUrl(TestContext context) { try { return new URL(context.replaceDynamicContentInString(this.url)); } catch (MalformedURLException e) { throw new CitrusRuntimeException("Invalid request url", e); } }
[ "private", "URL", "getUrl", "(", "TestContext", "context", ")", "{", "try", "{", "return", "new", "URL", "(", "context", ".", "replaceDynamicContentInString", "(", "this", ".", "url", ")", ")", ";", "}", "catch", "(", "MalformedURLException", "e", ")", "{"...
Gets the request url with test variable support. @param context The test context to get the url from @return The extracted url
[ "Gets", "the", "request", "url", "with", "test", "variable", "support", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/condition/HttpCondition.java#L122-L128
train
citrusframework/citrus
modules/citrus-ws/src/main/java/com/consol/citrus/ws/actions/AssertSoapFault.java
AssertSoapFault.constructControlFault
private SoapFault constructControlFault(TestContext context) { SoapFault controlFault= new SoapFault(); if (StringUtils.hasText(faultActor)) { controlFault.faultActor(context.replaceDynamicContentInString(faultActor)); } controlFault.faultCode(context.replaceDynamicContentInString(faultCode)); controlFault.faultString(context.replaceDynamicContentInString(faultString)); for (String faultDetail : faultDetails) { controlFault.addFaultDetail(context.replaceDynamicContentInString(faultDetail)); } try { for (String faultDetailPath : faultDetailResourcePaths) { String resourcePath = context.replaceDynamicContentInString(faultDetailPath); controlFault.addFaultDetail(context.replaceDynamicContentInString(FileUtils.readToString(FileUtils.getFileResource(resourcePath, context), FileUtils.getCharset(resourcePath)))); } } catch (IOException e) { throw new CitrusRuntimeException("Failed to create SOAP fault detail from file resource", e); } return controlFault; }
java
private SoapFault constructControlFault(TestContext context) { SoapFault controlFault= new SoapFault(); if (StringUtils.hasText(faultActor)) { controlFault.faultActor(context.replaceDynamicContentInString(faultActor)); } controlFault.faultCode(context.replaceDynamicContentInString(faultCode)); controlFault.faultString(context.replaceDynamicContentInString(faultString)); for (String faultDetail : faultDetails) { controlFault.addFaultDetail(context.replaceDynamicContentInString(faultDetail)); } try { for (String faultDetailPath : faultDetailResourcePaths) { String resourcePath = context.replaceDynamicContentInString(faultDetailPath); controlFault.addFaultDetail(context.replaceDynamicContentInString(FileUtils.readToString(FileUtils.getFileResource(resourcePath, context), FileUtils.getCharset(resourcePath)))); } } catch (IOException e) { throw new CitrusRuntimeException("Failed to create SOAP fault detail from file resource", e); } return controlFault; }
[ "private", "SoapFault", "constructControlFault", "(", "TestContext", "context", ")", "{", "SoapFault", "controlFault", "=", "new", "SoapFault", "(", ")", ";", "if", "(", "StringUtils", ".", "hasText", "(", "faultActor", ")", ")", "{", "controlFault", ".", "fau...
Constructs the control soap fault holding all expected fault information like faultCode, faultString and faultDetail. @return the constructed SoapFault instance.
[ "Constructs", "the", "control", "soap", "fault", "holding", "all", "expected", "fault", "information", "like", "faultCode", "faultString", "and", "faultDetail", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-ws/src/main/java/com/consol/citrus/ws/actions/AssertSoapFault.java#L116-L140
train
citrusframework/citrus
modules/citrus-kubernetes/src/main/java/com/consol/citrus/kubernetes/message/KubernetesMessageConverter.java
KubernetesMessageConverter.getCommandByName
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-endpoints": return new ListEndpoints(); case "create-pod": return new CreatePod(); case "get-pod": return new GetPod(); case "delete-pod": return new DeletePod(); case "list-pods": return new ListPods(); case "watch-pods": return new WatchPods(); case "list-namespaces": return new ListNamespaces(); case "watch-namespaces": return new WatchNamespaces(); case "list-nodes": return new ListNodes(); case "watch-nodes": return new WatchNodes(); case "list-replication-controllers": return new ListReplicationControllers(); case "watch-replication-controllers": return new WatchReplicationControllers(); case "create-service": return new CreateService(); case "get-service": return new GetService(); case "delete-service": return new DeleteService(); case "list-services": return new ListServices(); case "watch-services": return new WatchServices(); default: throw new CitrusRuntimeException("Unknown kubernetes command: " + commandName); } }
java
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-endpoints": return new ListEndpoints(); case "create-pod": return new CreatePod(); case "get-pod": return new GetPod(); case "delete-pod": return new DeletePod(); case "list-pods": return new ListPods(); case "watch-pods": return new WatchPods(); case "list-namespaces": return new ListNamespaces(); case "watch-namespaces": return new WatchNamespaces(); case "list-nodes": return new ListNodes(); case "watch-nodes": return new WatchNodes(); case "list-replication-controllers": return new ListReplicationControllers(); case "watch-replication-controllers": return new WatchReplicationControllers(); case "create-service": return new CreateService(); case "get-service": return new GetService(); case "delete-service": return new DeleteService(); case "list-services": return new ListServices(); case "watch-services": return new WatchServices(); default: throw new CitrusRuntimeException("Unknown kubernetes command: " + commandName); } }
[ "private", "KubernetesCommand", "<", "?", ">", "getCommandByName", "(", "String", "commandName", ")", "{", "if", "(", "!", "StringUtils", ".", "hasText", "(", "commandName", ")", ")", "{", "throw", "new", "CitrusRuntimeException", "(", "\"Missing command name prop...
Creates a new kubernetes command message model object from message headers. @param commandName @return
[ "Creates", "a", "new", "kubernetes", "command", "message", "model", "object", "from", "message", "headers", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-kubernetes/src/main/java/com/consol/citrus/kubernetes/message/KubernetesMessageConverter.java#L87-L134
train
citrusframework/citrus
modules/citrus-kubernetes/src/main/java/com/consol/citrus/kubernetes/message/KubernetesMessageConverter.java
KubernetesMessageConverter.createMessageHeaders
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().entrySet()) { headers.put(entry.getKey(), entry.getValue()); } return headers; }
java
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().entrySet()) { headers.put(entry.getKey(), entry.getValue()); } return headers; }
[ "private", "Map", "<", "String", ",", "Object", ">", "createMessageHeaders", "(", "KubernetesCommand", "<", "?", ">", "command", ")", "{", "Map", "<", "String", ",", "Object", ">", "headers", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(",...
Reads basic command information and converts to message headers. @param command @return
[ "Reads", "basic", "command", "information", "and", "converts", "to", "message", "headers", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-kubernetes/src/main/java/com/consol/citrus/kubernetes/message/KubernetesMessageConverter.java#L141-L151
train
citrusframework/citrus
modules/citrus-docker/src/main/java/com/consol/citrus/docker/command/ContainerCreate.java
ContainerCreate.getVolumes
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]); } return volumeSpecs; }
java
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]); } return volumeSpecs; }
[ "private", "Volume", "[", "]", "getVolumes", "(", "TestContext", "context", ")", "{", "String", "[", "]", "volumes", "=", "StringUtils", ".", "commaDelimitedListToStringArray", "(", "getParameter", "(", "\"volumes\"", ",", "context", ")", ")", ";", "Volume", "...
Gets the volume specs from comma delimited string. @return
[ "Gets", "the", "volume", "specs", "from", "comma", "delimited", "string", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-docker/src/main/java/com/consol/citrus/docker/command/ContainerCreate.java#L164-L173
train
citrusframework/citrus
modules/citrus-docker/src/main/java/com/consol/citrus/docker/command/ContainerCreate.java
ContainerCreate.getCapabilities
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++) { capAdd[i] = Capability.valueOf(capabilities[i]); } return capAdd; }
java
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++) { capAdd[i] = Capability.valueOf(capabilities[i]); } return capAdd; }
[ "private", "Capability", "[", "]", "getCapabilities", "(", "String", "addDrop", ",", "TestContext", "context", ")", "{", "String", "[", "]", "capabilities", "=", "StringUtils", ".", "commaDelimitedListToStringArray", "(", "getParameter", "(", "addDrop", ",", "cont...
Gets the capabilities added. @return
[ "Gets", "the", "capabilities", "added", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-docker/src/main/java/com/consol/citrus/docker/command/ContainerCreate.java#L179-L188
train
citrusframework/citrus
modules/citrus-docker/src/main/java/com/consol/citrus/docker/command/ContainerCreate.java
ContainerCreate.getExposedPorts
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.replaceDynamicContentInString(ports[i]); if (portSpec.startsWith("udp:")) { exposedPorts[i] = ExposedPort.udp(Integer.valueOf(portSpec.substring("udp:".length()))); } else if (portSpec.startsWith("tcp:")) { exposedPorts[i] = ExposedPort.tcp(Integer.valueOf(portSpec.substring("tcp:".length()))); } else { exposedPorts[i] = ExposedPort.tcp(Integer.valueOf(portSpec)); } } return exposedPorts; }
java
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.replaceDynamicContentInString(ports[i]); if (portSpec.startsWith("udp:")) { exposedPorts[i] = ExposedPort.udp(Integer.valueOf(portSpec.substring("udp:".length()))); } else if (portSpec.startsWith("tcp:")) { exposedPorts[i] = ExposedPort.tcp(Integer.valueOf(portSpec.substring("tcp:".length()))); } else { exposedPorts[i] = ExposedPort.tcp(Integer.valueOf(portSpec)); } } return exposedPorts; }
[ "private", "ExposedPort", "[", "]", "getExposedPorts", "(", "String", "portSpecs", ",", "TestContext", "context", ")", "{", "String", "[", "]", "ports", "=", "StringUtils", ".", "commaDelimitedListToStringArray", "(", "portSpecs", ")", ";", "ExposedPort", "[", "...
Construct set of exposed ports from comma delimited list of ports. @param portSpecs @param context @return
[ "Construct", "set", "of", "exposed", "ports", "from", "comma", "delimited", "list", "of", "ports", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-docker/src/main/java/com/consol/citrus/docker/command/ContainerCreate.java#L196-L213
train
citrusframework/citrus
modules/citrus-docker/src/main/java/com/consol/citrus/docker/command/ContainerCreate.java
ContainerCreate.getPortBindings
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(portSpec).split(":"); if (binding.length == 2) { Integer hostPort = Integer.valueOf(binding[0]); Integer port = Integer.valueOf(binding[1]); portsBindings.bind(Stream.of(exposedPorts).filter(exposed -> port.equals(exposed.getPort())).findAny().orElse(ExposedPort.tcp(port)), Ports.Binding.bindPort(hostPort)); } } Stream.of(exposedPorts).filter(exposed -> !portsBindings.getBindings().keySet().contains(exposed)).forEach(exposed -> portsBindings.bind(exposed, Ports.Binding.empty())); return portsBindings; }
java
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(portSpec).split(":"); if (binding.length == 2) { Integer hostPort = Integer.valueOf(binding[0]); Integer port = Integer.valueOf(binding[1]); portsBindings.bind(Stream.of(exposedPorts).filter(exposed -> port.equals(exposed.getPort())).findAny().orElse(ExposedPort.tcp(port)), Ports.Binding.bindPort(hostPort)); } } Stream.of(exposedPorts).filter(exposed -> !portsBindings.getBindings().keySet().contains(exposed)).forEach(exposed -> portsBindings.bind(exposed, Ports.Binding.empty())); return portsBindings; }
[ "private", "Ports", "getPortBindings", "(", "String", "portSpecs", ",", "ExposedPort", "[", "]", "exposedPorts", ",", "TestContext", "context", ")", "{", "String", "[", "]", "ports", "=", "StringUtils", ".", "commaDelimitedListToStringArray", "(", "portSpecs", ")"...
Construct set of port bindings from comma delimited list of ports. @param portSpecs @param exposedPorts @param context @return
[ "Construct", "set", "of", "port", "bindings", "from", "comma", "delimited", "list", "of", "ports", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-docker/src/main/java/com/consol/citrus/docker/command/ContainerCreate.java#L222-L239
train
citrusframework/citrus
modules/citrus-camel/src/main/java/com/consol/citrus/camel/endpoint/CamelSyncConsumer.java
CamelSyncConsumer.buildOutMessage
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(header.getKey(), header.getValue()); } } if (message.getHeader(CitrusCamelMessageHeaders.EXCHANGE_EXCEPTION) != null) { String exceptionClass = message.getHeader(CitrusCamelMessageHeaders.EXCHANGE_EXCEPTION).toString(); String exceptionMsg = null; if (message.getHeader(CitrusCamelMessageHeaders.EXCHANGE_EXCEPTION_MESSAGE) != null) { exceptionMsg = message.getHeader(CitrusCamelMessageHeaders.EXCHANGE_EXCEPTION_MESSAGE).toString(); } try { Class<?> exception = Class.forName(exceptionClass); if (exceptionMsg != null) { exchange.setException((Throwable) exception.getConstructor(String.class).newInstance(exceptionMsg)); } else { exchange.setException((Throwable) exception.newInstance()); } } catch (RuntimeException e) { log.warn("Unable to create proper exception instance for exchange!", e); } catch (Exception e) { log.warn("Unable to create proper exception instance for exchange!", e); } } reply.setBody(message.getPayload()); }
java
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(header.getKey(), header.getValue()); } } if (message.getHeader(CitrusCamelMessageHeaders.EXCHANGE_EXCEPTION) != null) { String exceptionClass = message.getHeader(CitrusCamelMessageHeaders.EXCHANGE_EXCEPTION).toString(); String exceptionMsg = null; if (message.getHeader(CitrusCamelMessageHeaders.EXCHANGE_EXCEPTION_MESSAGE) != null) { exceptionMsg = message.getHeader(CitrusCamelMessageHeaders.EXCHANGE_EXCEPTION_MESSAGE).toString(); } try { Class<?> exception = Class.forName(exceptionClass); if (exceptionMsg != null) { exchange.setException((Throwable) exception.getConstructor(String.class).newInstance(exceptionMsg)); } else { exchange.setException((Throwable) exception.newInstance()); } } catch (RuntimeException e) { log.warn("Unable to create proper exception instance for exchange!", e); } catch (Exception e) { log.warn("Unable to create proper exception instance for exchange!", e); } } reply.setBody(message.getPayload()); }
[ "private", "void", "buildOutMessage", "(", "Exchange", "exchange", ",", "Message", "message", ")", "{", "org", ".", "apache", ".", "camel", ".", "Message", "reply", "=", "exchange", ".", "getOut", "(", ")", ";", "for", "(", "Map", ".", "Entry", "<", "S...
Builds response and sets it as out message on given Camel exchange. @param message @param exchange @return
[ "Builds", "response", "and", "sets", "it", "as", "out", "message", "on", "given", "Camel", "exchange", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-camel/src/main/java/com/consol/citrus/camel/endpoint/CamelSyncConsumer.java#L114-L145
train
citrusframework/citrus
modules/citrus-core/src/main/java/com/consol/citrus/actions/SendMessageAction.java
SendMessageAction.createMessage
protected Message createMessage(TestContext context, String messageType) { if (dataDictionary != null) { messageBuilder.setDataDictionary(dataDictionary); } return messageBuilder.buildMessageContent(context, messageType, MessageDirection.OUTBOUND); }
java
protected Message createMessage(TestContext context, String messageType) { if (dataDictionary != null) { messageBuilder.setDataDictionary(dataDictionary); } return messageBuilder.buildMessageContent(context, messageType, MessageDirection.OUTBOUND); }
[ "protected", "Message", "createMessage", "(", "TestContext", "context", ",", "String", "messageType", ")", "{", "if", "(", "dataDictionary", "!=", "null", ")", "{", "messageBuilder", ".", "setDataDictionary", "(", "dataDictionary", ")", ";", "}", "return", "mess...
Create message to be sent. @param context @param messageType @return
[ "Create", "message", "to", "be", "sent", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/actions/SendMessageAction.java#L158-L164
train
citrusframework/citrus
modules/citrus-jmx/src/main/java/com/consol/citrus/jmx/client/JmxClient.java
JmxClient.getNetworkConnection
private MBeanServerConnection getNetworkConnection() { try { JMXServiceURL url = new JMXServiceURL(getEndpointConfiguration().getServerUrl()); String[] creds = {getEndpointConfiguration().getUsername(), getEndpointConfiguration().getPassword()}; JMXConnector networkConnector = JMXConnectorFactory.connect(url, Collections.singletonMap(JMXConnector.CREDENTIALS, creds)); connectionId = networkConnector.getConnectionId(); networkConnector.addConnectionNotificationListener(this, null, null); return networkConnector.getMBeanServerConnection(); } catch (IOException e) { throw new CitrusRuntimeException("Failed to connect to network MBean server", e); } }
java
private MBeanServerConnection getNetworkConnection() { try { JMXServiceURL url = new JMXServiceURL(getEndpointConfiguration().getServerUrl()); String[] creds = {getEndpointConfiguration().getUsername(), getEndpointConfiguration().getPassword()}; JMXConnector networkConnector = JMXConnectorFactory.connect(url, Collections.singletonMap(JMXConnector.CREDENTIALS, creds)); connectionId = networkConnector.getConnectionId(); networkConnector.addConnectionNotificationListener(this, null, null); return networkConnector.getMBeanServerConnection(); } catch (IOException e) { throw new CitrusRuntimeException("Failed to connect to network MBean server", e); } }
[ "private", "MBeanServerConnection", "getNetworkConnection", "(", ")", "{", "try", "{", "JMXServiceURL", "url", "=", "new", "JMXServiceURL", "(", "getEndpointConfiguration", "(", ")", ".", "getServerUrl", "(", ")", ")", ";", "String", "[", "]", "creds", "=", "{...
Establish network connection to remote mBean server. @return
[ "Establish", "network", "connection", "to", "remote", "mBean", "server", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-jmx/src/main/java/com/consol/citrus/jmx/client/JmxClient.java#L169-L181
train
citrusframework/citrus
modules/citrus-jmx/src/main/java/com/consol/citrus/jmx/client/JmxClient.java
JmxClient.connectionLost
private boolean connectionLost(JMXConnectionNotification connectionNotification) { return connectionNotification.getType().equals(JMXConnectionNotification.NOTIFS_LOST) || connectionNotification.getType().equals(JMXConnectionNotification.CLOSED) || connectionNotification.getType().equals(JMXConnectionNotification.FAILED); }
java
private boolean connectionLost(JMXConnectionNotification connectionNotification) { return connectionNotification.getType().equals(JMXConnectionNotification.NOTIFS_LOST) || connectionNotification.getType().equals(JMXConnectionNotification.CLOSED) || connectionNotification.getType().equals(JMXConnectionNotification.FAILED); }
[ "private", "boolean", "connectionLost", "(", "JMXConnectionNotification", "connectionNotification", ")", "{", "return", "connectionNotification", ".", "getType", "(", ")", ".", "equals", "(", "JMXConnectionNotification", ".", "NOTIFS_LOST", ")", "||", "connectionNotificat...
Finds connection lost type notifications. @param connectionNotification @return
[ "Finds", "connection", "lost", "type", "notifications", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-jmx/src/main/java/com/consol/citrus/jmx/client/JmxClient.java#L227-L231
train
citrusframework/citrus
modules/citrus-jmx/src/main/java/com/consol/citrus/jmx/client/JmxClient.java
JmxClient.scheduleReconnect
public void scheduleReconnect() { Runnable startRunnable = new Runnable() { @Override public void run() { try { MBeanServerConnection serverConnection = getNetworkConnection(); if (notificationListener != null) { serverConnection.addNotificationListener(objectName, notificationListener, getEndpointConfiguration().getNotificationFilter(), getEndpointConfiguration().getNotificationHandback()); } } catch (Exception e) { log.warn("Failed to reconnect to JMX MBean server. {}", e.getMessage()); scheduleReconnect(); } } }; log.info("Reconnecting to MBean server {} in {} milliseconds.", getEndpointConfiguration().getServerUrl(), getEndpointConfiguration().getDelayOnReconnect()); scheduledExecutor.schedule(startRunnable, getEndpointConfiguration().getDelayOnReconnect(), TimeUnit.MILLISECONDS); }
java
public void scheduleReconnect() { Runnable startRunnable = new Runnable() { @Override public void run() { try { MBeanServerConnection serverConnection = getNetworkConnection(); if (notificationListener != null) { serverConnection.addNotificationListener(objectName, notificationListener, getEndpointConfiguration().getNotificationFilter(), getEndpointConfiguration().getNotificationHandback()); } } catch (Exception e) { log.warn("Failed to reconnect to JMX MBean server. {}", e.getMessage()); scheduleReconnect(); } } }; log.info("Reconnecting to MBean server {} in {} milliseconds.", getEndpointConfiguration().getServerUrl(), getEndpointConfiguration().getDelayOnReconnect()); scheduledExecutor.schedule(startRunnable, getEndpointConfiguration().getDelayOnReconnect(), TimeUnit.MILLISECONDS); }
[ "public", "void", "scheduleReconnect", "(", ")", "{", "Runnable", "startRunnable", "=", "new", "Runnable", "(", ")", "{", "@", "Override", "public", "void", "run", "(", ")", "{", "try", "{", "MBeanServerConnection", "serverConnection", "=", "getNetworkConnection...
Schedules an attempt to re-initialize a lost connection after the reconnect delay
[ "Schedules", "an", "attempt", "to", "re", "-", "initialize", "a", "lost", "connection", "after", "the", "reconnect", "delay" ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-jmx/src/main/java/com/consol/citrus/jmx/client/JmxClient.java#L236-L253
train
citrusframework/citrus
modules/citrus-jmx/src/main/java/com/consol/citrus/jmx/client/JmxClient.java
JmxClient.addNotificationListener
private void addNotificationListener(ObjectName objectName, final String correlationKey, MBeanServerConnection serverConnection) { try { notificationListener = new NotificationListener() { @Override public void handleNotification(Notification notification, Object handback) { correlationManager.store(correlationKey, new DefaultMessage(notification.getMessage())); } }; serverConnection.addNotificationListener(objectName, notificationListener, getEndpointConfiguration().getNotificationFilter(), getEndpointConfiguration().getNotificationHandback()); } catch (InstanceNotFoundException e) { throw new CitrusRuntimeException("Failed to find object name instance", e); } catch (IOException e) { throw new CitrusRuntimeException("Failed to add notification listener", e); } }
java
private void addNotificationListener(ObjectName objectName, final String correlationKey, MBeanServerConnection serverConnection) { try { notificationListener = new NotificationListener() { @Override public void handleNotification(Notification notification, Object handback) { correlationManager.store(correlationKey, new DefaultMessage(notification.getMessage())); } }; serverConnection.addNotificationListener(objectName, notificationListener, getEndpointConfiguration().getNotificationFilter(), getEndpointConfiguration().getNotificationHandback()); } catch (InstanceNotFoundException e) { throw new CitrusRuntimeException("Failed to find object name instance", e); } catch (IOException e) { throw new CitrusRuntimeException("Failed to add notification listener", e); } }
[ "private", "void", "addNotificationListener", "(", "ObjectName", "objectName", ",", "final", "String", "correlationKey", ",", "MBeanServerConnection", "serverConnection", ")", "{", "try", "{", "notificationListener", "=", "new", "NotificationListener", "(", ")", "{", ...
Add notification listener for response messages. @param objectName @param correlationKey @param serverConnection
[ "Add", "notification", "listener", "for", "response", "messages", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-jmx/src/main/java/com/consol/citrus/jmx/client/JmxClient.java#L261-L276
train
citrusframework/citrus
modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/builder/AntRunBuilder.java
AntRunBuilder.targets
public AntRunBuilder targets(String ... targets) { action.setTargets(StringUtils.collectionToCommaDelimitedString(Arrays.asList(targets))); return this; }
java
public AntRunBuilder targets(String ... targets) { action.setTargets(StringUtils.collectionToCommaDelimitedString(Arrays.asList(targets))); return this; }
[ "public", "AntRunBuilder", "targets", "(", "String", "...", "targets", ")", "{", "action", ".", "setTargets", "(", "StringUtils", ".", "collectionToCommaDelimitedString", "(", "Arrays", ".", "asList", "(", "targets", ")", ")", ")", ";", "return", "this", ";", ...
Multiple build target names to call. @param targets
[ "Multiple", "build", "target", "names", "to", "call", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/builder/AntRunBuilder.java#L71-L74
train
citrusframework/citrus
modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/builder/AntRunBuilder.java
AntRunBuilder.property
public AntRunBuilder property(String name, Object value) { action.getProperties().put(name, value); return this; }
java
public AntRunBuilder property(String name, Object value) { action.getProperties().put(name, value); return this; }
[ "public", "AntRunBuilder", "property", "(", "String", "name", ",", "Object", "value", ")", "{", "action", ".", "getProperties", "(", ")", ".", "put", "(", "name", ",", "value", ")", ";", "return", "this", ";", "}" ]
Adds a build property by name and value. @param name @param value
[ "Adds", "a", "build", "property", "by", "name", "and", "value", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/builder/AntRunBuilder.java#L81-L84
train
citrusframework/citrus
modules/citrus-websocket/src/main/java/com/consol/citrus/websocket/client/WebSocketClientEndpointConfiguration.java
WebSocketClientEndpointConfiguration.getWebSocketClientHandler
private CitrusWebSocketHandler getWebSocketClientHandler(String url) { CitrusWebSocketHandler handler = new CitrusWebSocketHandler(); if (webSocketHttpHeaders == null) { webSocketHttpHeaders = new WebSocketHttpHeaders(); webSocketHttpHeaders.setSecWebSocketExtensions(Collections.singletonList(new StandardToWebSocketExtensionAdapter(new JsrExtension(new PerMessageDeflateExtension().getName())))); } ListenableFuture<WebSocketSession> future = client.doHandshake(handler, webSocketHttpHeaders, UriComponentsBuilder.fromUriString(url).buildAndExpand().encode().toUri()); try { future.get(); } catch (Exception e) { String errMsg = String.format("Failed to connect to Web Socket server - '%s'", url); LOG.error(errMsg); throw new CitrusRuntimeException(errMsg); } return handler; }
java
private CitrusWebSocketHandler getWebSocketClientHandler(String url) { CitrusWebSocketHandler handler = new CitrusWebSocketHandler(); if (webSocketHttpHeaders == null) { webSocketHttpHeaders = new WebSocketHttpHeaders(); webSocketHttpHeaders.setSecWebSocketExtensions(Collections.singletonList(new StandardToWebSocketExtensionAdapter(new JsrExtension(new PerMessageDeflateExtension().getName())))); } ListenableFuture<WebSocketSession> future = client.doHandshake(handler, webSocketHttpHeaders, UriComponentsBuilder.fromUriString(url).buildAndExpand().encode().toUri()); try { future.get(); } catch (Exception e) { String errMsg = String.format("Failed to connect to Web Socket server - '%s'", url); LOG.error(errMsg); throw new CitrusRuntimeException(errMsg); } return handler; }
[ "private", "CitrusWebSocketHandler", "getWebSocketClientHandler", "(", "String", "url", ")", "{", "CitrusWebSocketHandler", "handler", "=", "new", "CitrusWebSocketHandler", "(", ")", ";", "if", "(", "webSocketHttpHeaders", "==", "null", ")", "{", "webSocketHttpHeaders",...
Creates new client web socket handler by opening a new socket connection to server. @param url @return
[ "Creates", "new", "client", "web", "socket", "handler", "by", "opening", "a", "new", "socket", "connection", "to", "server", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-websocket/src/main/java/com/consol/citrus/websocket/client/WebSocketClientEndpointConfiguration.java#L73-L90
train
citrusframework/citrus
modules/citrus-core/src/main/java/com/consol/citrus/main/CitrusApp.java
CitrusApp.main
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); } catch (InterruptedException | ExecutionException | TimeoutException e) { log.info(String.format("Shutdown Citrus application after %s ms", citrusApp.configuration.getTimeToLive())); citrusApp.stop(); } }); } if (citrusApp.configuration.isSkipTests()) { if (citrusApp.configuration.getConfigClass() != null) { Citrus.newInstance(citrusApp.configuration.getConfigClass()); } else { Citrus.newInstance(); } setDefaultProperties(citrusApp.configuration); } else { try { citrusApp.run(); } finally { if (citrusApp.configuration.getTimeToLive() == 0) { citrusApp.stop(); } } } if (citrusApp.configuration.isSystemExit()) { if (citrusApp.waitForCompletion()) { System.exit(0); } else { System.exit(-1); } } else { citrusApp.waitForCompletion(); } }
java
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); } catch (InterruptedException | ExecutionException | TimeoutException e) { log.info(String.format("Shutdown Citrus application after %s ms", citrusApp.configuration.getTimeToLive())); citrusApp.stop(); } }); } if (citrusApp.configuration.isSkipTests()) { if (citrusApp.configuration.getConfigClass() != null) { Citrus.newInstance(citrusApp.configuration.getConfigClass()); } else { Citrus.newInstance(); } setDefaultProperties(citrusApp.configuration); } else { try { citrusApp.run(); } finally { if (citrusApp.configuration.getTimeToLive() == 0) { citrusApp.stop(); } } } if (citrusApp.configuration.isSystemExit()) { if (citrusApp.waitForCompletion()) { System.exit(0); } else { System.exit(-1); } } else { citrusApp.waitForCompletion(); } }
[ "public", "static", "void", "main", "(", "String", "[", "]", "args", ")", "{", "CitrusApp", "citrusApp", "=", "new", "CitrusApp", "(", "args", ")", ";", "if", "(", "citrusApp", ".", "configuration", ".", "getTimeToLive", "(", ")", ">", "0", ")", "{", ...
Main method with command line arguments. @param args
[ "Main", "method", "with", "command", "line", "arguments", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/main/CitrusApp.java#L76-L117
train
citrusframework/citrus
modules/citrus-core/src/main/java/com/consol/citrus/main/CitrusApp.java
CitrusApp.run
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", getClass().getClassLoader())) { new TestNGEngine(configuration).run(); } else if (ClassUtils.isPresent("org.junit.Test", getClass().getClassLoader())) { new JUnit4TestEngine(configuration).run(); } }
java
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", getClass().getClassLoader())) { new TestNGEngine(configuration).run(); } else if (ClassUtils.isPresent("org.junit.Test", getClass().getClassLoader())) { new JUnit4TestEngine(configuration).run(); } }
[ "public", "void", "run", "(", ")", "{", "if", "(", "isCompleted", "(", ")", ")", "{", "log", ".", "info", "(", "\"Not executing tests as application state is completed!\"", ")", ";", "return", ";", "}", "log", ".", "info", "(", "String", ".", "format", "("...
Run application with prepared Citrus instance.
[ "Run", "application", "with", "prepared", "Citrus", "instance", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/main/CitrusApp.java#L122-L136
train
citrusframework/citrus
modules/citrus-core/src/main/java/com/consol/citrus/main/CitrusApp.java
CitrusApp.stop
private void stop() { complete(); Citrus citrus = Citrus.CitrusInstanceManager.getSingleton(); if (citrus != null) { log.info("Closing Citrus and its application context"); citrus.close(); } }
java
private void stop() { complete(); Citrus citrus = Citrus.CitrusInstanceManager.getSingleton(); if (citrus != null) { log.info("Closing Citrus and its application context"); citrus.close(); } }
[ "private", "void", "stop", "(", ")", "{", "complete", "(", ")", ";", "Citrus", "citrus", "=", "Citrus", ".", "CitrusInstanceManager", ".", "getSingleton", "(", ")", ";", "if", "(", "citrus", "!=", "null", ")", "{", "log", ".", "info", "(", "\"Closing C...
Stop application by setting completed state and stop application context.
[ "Stop", "application", "by", "setting", "completed", "state", "and", "stop", "application", "context", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/main/CitrusApp.java#L162-L170
train
citrusframework/citrus
modules/citrus-core/src/main/java/com/consol/citrus/main/CitrusApp.java
CitrusApp.setDefaultProperties
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.setProperty(entry.getKey(), Optional.ofNullable(entry.getValue()).orElse("")); } }
java
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.setProperty(entry.getKey(), Optional.ofNullable(entry.getValue()).orElse("")); } }
[ "private", "static", "void", "setDefaultProperties", "(", "CitrusAppConfiguration", "configuration", ")", "{", "for", "(", "Map", ".", "Entry", "<", "String", ",", "String", ">", "entry", ":", "configuration", ".", "getDefaultProperties", "(", ")", ".", "entrySe...
Reads default properties in configuration and sets them as system properties. @param configuration
[ "Reads", "default", "properties", "in", "configuration", "and", "sets", "them", "as", "system", "properties", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/main/CitrusApp.java#L176-L181
train
citrusframework/citrus
modules/citrus-core/src/main/java/com/consol/citrus/actions/ExecutePLSQLAction.java
ExecutePLSQLAction.executeStatements
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(toExecute); log.info("PLSQL statement execution successful"); } catch (DataAccessException e) { if (ignoreErrors) { log.warn("Ignoring error while executing PLSQL statement: " + e.getMessage()); continue; } else { throw new CitrusRuntimeException("Failed to execute PLSQL statement", e); } } } }
java
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(toExecute); log.info("PLSQL statement execution successful"); } catch (DataAccessException e) { if (ignoreErrors) { log.warn("Ignoring error while executing PLSQL statement: " + e.getMessage()); continue; } else { throw new CitrusRuntimeException("Failed to execute PLSQL statement", e); } } } }
[ "protected", "void", "executeStatements", "(", "TestContext", "context", ")", "{", "for", "(", "String", "stmt", ":", "statements", ")", "{", "try", "{", "final", "String", "toExecute", "=", "context", ".", "replaceDynamicContentInString", "(", "stmt", ".", "t...
Run all PLSQL statements. @param context
[ "Run", "all", "PLSQL", "statements", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/actions/ExecutePLSQLAction.java#L91-L112
train
citrusframework/citrus
modules/citrus-core/src/main/java/com/consol/citrus/actions/ExecutePLSQLAction.java
ExecutePLSQLAction.createStatementsFromScript
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(script, PLSQL_STMT_ENDING); while (tok.hasMoreTokens()) { String next = tok.nextToken().trim(); if (StringUtils.hasText(next)) { stmts.add(next); } } return stmts; }
java
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(script, PLSQL_STMT_ENDING); while (tok.hasMoreTokens()) { String next = tok.nextToken().trim(); if (StringUtils.hasText(next)) { stmts.add(next); } } return stmts; }
[ "private", "List", "<", "String", ">", "createStatementsFromScript", "(", "TestContext", "context", ")", "{", "List", "<", "String", ">", "stmts", "=", "new", "ArrayList", "<>", "(", ")", ";", "script", "=", "context", ".", "replaceDynamicContentInString", "("...
Create SQL statements from inline script. @param context the current test context. @return list of SQL statements.
[ "Create", "SQL", "statements", "from", "inline", "script", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/actions/ExecutePLSQLAction.java#L119-L136
train
citrusframework/citrus
modules/citrus-rmi/src/main/java/com/consol/citrus/rmi/model/RmiServiceInvocation.java
RmiServiceInvocation.create
public static RmiServiceInvocation create(Object remoteTarget, Method method, Object[] args) { RmiServiceInvocation serviceInvocation = new RmiServiceInvocation(); if (Proxy.isProxyClass(remoteTarget.getClass())) { serviceInvocation.setRemote(method.getDeclaringClass().getName()); } else { serviceInvocation.setRemote(remoteTarget.getClass().getName()); } serviceInvocation.setMethod(method.getName()); if (args != null) { serviceInvocation.setArgs(new RmiServiceInvocation.Args()); for (Object arg : args) { MethodArg methodArg = new MethodArg(); methodArg.setValueObject(arg); if (Map.class.isAssignableFrom(arg.getClass())) { methodArg.setType(Map.class.getName()); } else if (List.class.isAssignableFrom(arg.getClass())) { methodArg.setType(List.class.getName()); } else { methodArg.setType(arg.getClass().getName()); } serviceInvocation.getArgs().getArgs().add(methodArg); } } return serviceInvocation; }
java
public static RmiServiceInvocation create(Object remoteTarget, Method method, Object[] args) { RmiServiceInvocation serviceInvocation = new RmiServiceInvocation(); if (Proxy.isProxyClass(remoteTarget.getClass())) { serviceInvocation.setRemote(method.getDeclaringClass().getName()); } else { serviceInvocation.setRemote(remoteTarget.getClass().getName()); } serviceInvocation.setMethod(method.getName()); if (args != null) { serviceInvocation.setArgs(new RmiServiceInvocation.Args()); for (Object arg : args) { MethodArg methodArg = new MethodArg(); methodArg.setValueObject(arg); if (Map.class.isAssignableFrom(arg.getClass())) { methodArg.setType(Map.class.getName()); } else if (List.class.isAssignableFrom(arg.getClass())) { methodArg.setType(List.class.getName()); } else { methodArg.setType(arg.getClass().getName()); } serviceInvocation.getArgs().getArgs().add(methodArg); } } return serviceInvocation; }
[ "public", "static", "RmiServiceInvocation", "create", "(", "Object", "remoteTarget", ",", "Method", "method", ",", "Object", "[", "]", "args", ")", "{", "RmiServiceInvocation", "serviceInvocation", "=", "new", "RmiServiceInvocation", "(", ")", ";", "if", "(", "P...
Static create method from target object and method definition. @return
[ "Static", "create", "method", "from", "target", "object", "and", "method", "definition", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-rmi/src/main/java/com/consol/citrus/rmi/model/RmiServiceInvocation.java#L56-L87
train
citrusframework/citrus
modules/citrus-rmi/src/main/java/com/consol/citrus/rmi/model/RmiServiceInvocation.java
RmiServiceInvocation.getArgTypes
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 type", e); } } } return types.toArray(new Class[types.size()]); }
java
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 type", e); } } } return types.toArray(new Class[types.size()]); }
[ "public", "Class", "[", "]", "getArgTypes", "(", ")", "{", "List", "<", "Class", ">", "types", "=", "new", "ArrayList", "<>", "(", ")", ";", "if", "(", "args", "!=", "null", ")", "{", "for", "(", "MethodArg", "arg", ":", "args", ".", "getArgs", "...
Gets the argument types from list of args. @return
[ "Gets", "the", "argument", "types", "from", "list", "of", "args", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-rmi/src/main/java/com/consol/citrus/rmi/model/RmiServiceInvocation.java#L93-L107
train
citrusframework/citrus
modules/citrus-rmi/src/main/java/com/consol/citrus/rmi/model/RmiServiceInvocation.java
RmiServiceInvocation.getArgValues
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.getValueObject() != null) { value = methodArg.getValueObject(); } else if (methodArg.getValue() != null) { value = methodArg.getValue(); } else if (StringUtils.hasText(methodArg.getRef()) && applicationContext != null) { value = applicationContext.getBean(methodArg.getRef()); } if (value == null) { argValues.add(null); } else if (argType.isInstance(value) || argType.isAssignableFrom(value.getClass())) { argValues.add(argType.cast(value)); } else if (Map.class.equals(argType)) { String mapString = value.toString(); Properties props = new Properties(); try { props.load(new StringReader(mapString.substring(1, mapString.length() - 1).replace(", ", "\n"))); } catch (IOException e) { throw new CitrusRuntimeException("Failed to reconstruct method argument of type map", e); } Map<String, String> map = new LinkedHashMap<>(); for (Map.Entry<Object, Object> entry : props.entrySet()) { map.put(entry.getKey().toString(), entry.getValue().toString()); } argValues.add(map); } else { try { argValues.add(new SimpleTypeConverter().convertIfNecessary(value, argType)); } catch (ConversionNotSupportedException e) { if (String.class.equals(argType)) { argValues.add(value.toString()); } throw e; } } } } } catch (ClassNotFoundException e) { throw new CitrusRuntimeException("Failed to construct method arg objects", e); } return argValues.toArray(new Object[argValues.size()]); }
java
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.getValueObject() != null) { value = methodArg.getValueObject(); } else if (methodArg.getValue() != null) { value = methodArg.getValue(); } else if (StringUtils.hasText(methodArg.getRef()) && applicationContext != null) { value = applicationContext.getBean(methodArg.getRef()); } if (value == null) { argValues.add(null); } else if (argType.isInstance(value) || argType.isAssignableFrom(value.getClass())) { argValues.add(argType.cast(value)); } else if (Map.class.equals(argType)) { String mapString = value.toString(); Properties props = new Properties(); try { props.load(new StringReader(mapString.substring(1, mapString.length() - 1).replace(", ", "\n"))); } catch (IOException e) { throw new CitrusRuntimeException("Failed to reconstruct method argument of type map", e); } Map<String, String> map = new LinkedHashMap<>(); for (Map.Entry<Object, Object> entry : props.entrySet()) { map.put(entry.getKey().toString(), entry.getValue().toString()); } argValues.add(map); } else { try { argValues.add(new SimpleTypeConverter().convertIfNecessary(value, argType)); } catch (ConversionNotSupportedException e) { if (String.class.equals(argType)) { argValues.add(value.toString()); } throw e; } } } } } catch (ClassNotFoundException e) { throw new CitrusRuntimeException("Failed to construct method arg objects", e); } return argValues.toArray(new Object[argValues.size()]); }
[ "public", "Object", "[", "]", "getArgValues", "(", "ApplicationContext", "applicationContext", ")", "{", "List", "<", "Object", ">", "argValues", "=", "new", "ArrayList", "<>", "(", ")", ";", "try", "{", "if", "(", "args", "!=", "null", ")", "{", "for", ...
Gets method args as objects. Automatically converts simple types and ready referenced beans. @return
[ "Gets", "method", "args", "as", "objects", ".", "Automatically", "converts", "simple", "types", "and", "ready", "referenced", "beans", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-rmi/src/main/java/com/consol/citrus/rmi/model/RmiServiceInvocation.java#L113-L167
train
citrusframework/citrus
modules/citrus-core/src/main/java/com/consol/citrus/config/xml/SQLActionParser.java
SQLActionParser.parseSqlAction
private BeanDefinitionBuilder parseSqlAction(Element element) { BeanDefinitionBuilder beanDefinition = BeanDefinitionBuilder.rootBeanDefinition(ExecuteSQLAction.class); String ignoreErrors = element.getAttribute("ignore-errors"); if (ignoreErrors != null && ignoreErrors.equals("true")) { beanDefinition.addPropertyValue("ignoreErrors", true); } return beanDefinition; }
java
private BeanDefinitionBuilder parseSqlAction(Element element) { BeanDefinitionBuilder beanDefinition = BeanDefinitionBuilder.rootBeanDefinition(ExecuteSQLAction.class); String ignoreErrors = element.getAttribute("ignore-errors"); if (ignoreErrors != null && ignoreErrors.equals("true")) { beanDefinition.addPropertyValue("ignoreErrors", true); } return beanDefinition; }
[ "private", "BeanDefinitionBuilder", "parseSqlAction", "(", "Element", "element", ")", "{", "BeanDefinitionBuilder", "beanDefinition", "=", "BeanDefinitionBuilder", ".", "rootBeanDefinition", "(", "ExecuteSQLAction", ".", "class", ")", ";", "String", "ignoreErrors", "=", ...
Parses SQL action just executing a set of statements. @param element @return
[ "Parses", "SQL", "action", "just", "executing", "a", "set", "of", "statements", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/config/xml/SQLActionParser.java#L95-L104
train
citrusframework/citrus
modules/citrus-core/src/main/java/com/consol/citrus/config/xml/SQLActionParser.java
SQLActionParser.parseSqlQueryAction
private BeanDefinitionBuilder parseSqlQueryAction(Element element, Element scriptValidationElement, List<Element> validateElements, List<Element> extractElements) { BeanDefinitionBuilder beanDefinition = BeanDefinitionBuilder.rootBeanDefinition(ExecuteSQLQueryAction.class); // check for script validation if (scriptValidationElement != null) { beanDefinition.addPropertyValue("scriptValidationContext", getScriptValidationContext(scriptValidationElement)); } Map<String, List<String>> controlResultSet = new HashMap<String, List<String>>(); for (Iterator<?> iter = validateElements.iterator(); iter.hasNext();) { Element validateElement = (Element) iter.next(); Element valueListElement = DomUtils.getChildElementByTagName(validateElement, "values"); if (valueListElement != null) { List<String> valueList = new ArrayList<String>(); List<?> valueElements = DomUtils.getChildElementsByTagName(valueListElement, "value"); for (Iterator<?> valueElementsIt = valueElements.iterator(); valueElementsIt.hasNext();) { Element valueElement = (Element) valueElementsIt.next(); valueList.add(DomUtils.getTextValue(valueElement)); } controlResultSet.put(validateElement.getAttribute("column"), valueList); } else if (validateElement.hasAttribute("value")) { controlResultSet.put(validateElement.getAttribute("column"), Collections.singletonList(validateElement.getAttribute("value"))); } else { throw new BeanCreationException(element.getLocalName(), "Neither value attribute nor value list is set for column validation: " + validateElement.getAttribute("column")); } } beanDefinition.addPropertyValue("controlResultSet", controlResultSet); Map<String, String> extractVariables = new HashMap<String, String>(); for (Iterator<?> iter = extractElements.iterator(); iter.hasNext();) { Element validate = (Element) iter.next(); extractVariables.put(validate.getAttribute("column"), validate.getAttribute("variable")); } beanDefinition.addPropertyValue("extractVariables", extractVariables); return beanDefinition; }
java
private BeanDefinitionBuilder parseSqlQueryAction(Element element, Element scriptValidationElement, List<Element> validateElements, List<Element> extractElements) { BeanDefinitionBuilder beanDefinition = BeanDefinitionBuilder.rootBeanDefinition(ExecuteSQLQueryAction.class); // check for script validation if (scriptValidationElement != null) { beanDefinition.addPropertyValue("scriptValidationContext", getScriptValidationContext(scriptValidationElement)); } Map<String, List<String>> controlResultSet = new HashMap<String, List<String>>(); for (Iterator<?> iter = validateElements.iterator(); iter.hasNext();) { Element validateElement = (Element) iter.next(); Element valueListElement = DomUtils.getChildElementByTagName(validateElement, "values"); if (valueListElement != null) { List<String> valueList = new ArrayList<String>(); List<?> valueElements = DomUtils.getChildElementsByTagName(valueListElement, "value"); for (Iterator<?> valueElementsIt = valueElements.iterator(); valueElementsIt.hasNext();) { Element valueElement = (Element) valueElementsIt.next(); valueList.add(DomUtils.getTextValue(valueElement)); } controlResultSet.put(validateElement.getAttribute("column"), valueList); } else if (validateElement.hasAttribute("value")) { controlResultSet.put(validateElement.getAttribute("column"), Collections.singletonList(validateElement.getAttribute("value"))); } else { throw new BeanCreationException(element.getLocalName(), "Neither value attribute nor value list is set for column validation: " + validateElement.getAttribute("column")); } } beanDefinition.addPropertyValue("controlResultSet", controlResultSet); Map<String, String> extractVariables = new HashMap<String, String>(); for (Iterator<?> iter = extractElements.iterator(); iter.hasNext();) { Element validate = (Element) iter.next(); extractVariables.put(validate.getAttribute("column"), validate.getAttribute("variable")); } beanDefinition.addPropertyValue("extractVariables", extractVariables); return beanDefinition; }
[ "private", "BeanDefinitionBuilder", "parseSqlQueryAction", "(", "Element", "element", ",", "Element", "scriptValidationElement", ",", "List", "<", "Element", ">", "validateElements", ",", "List", "<", "Element", ">", "extractElements", ")", "{", "BeanDefinitionBuilder",...
Parses SQL query action with result set validation elements. @param element the root element. @param scriptValidationElement the optional script validation element. @param validateElements validation elements. @param extractElements variable extraction elements. @return
[ "Parses", "SQL", "query", "action", "with", "result", "set", "validation", "elements", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/config/xml/SQLActionParser.java#L114-L155
train
citrusframework/citrus
modules/citrus-core/src/main/java/com/consol/citrus/config/xml/SQLActionParser.java
SQLActionParser.getScriptValidationContext
private ScriptValidationContext getScriptValidationContext(Element scriptElement) { String type = scriptElement.getAttribute("type"); ScriptValidationContext validationContext = new ScriptValidationContext(type); String filePath = scriptElement.getAttribute("file"); if (StringUtils.hasText(filePath)) { validationContext.setValidationScriptResourcePath(filePath); } else { validationContext.setValidationScript(DomUtils.getTextValue(scriptElement)); } return validationContext; }
java
private ScriptValidationContext getScriptValidationContext(Element scriptElement) { String type = scriptElement.getAttribute("type"); ScriptValidationContext validationContext = new ScriptValidationContext(type); String filePath = scriptElement.getAttribute("file"); if (StringUtils.hasText(filePath)) { validationContext.setValidationScriptResourcePath(filePath); } else { validationContext.setValidationScript(DomUtils.getTextValue(scriptElement)); } return validationContext; }
[ "private", "ScriptValidationContext", "getScriptValidationContext", "(", "Element", "scriptElement", ")", "{", "String", "type", "=", "scriptElement", ".", "getAttribute", "(", "\"type\"", ")", ";", "ScriptValidationContext", "validationContext", "=", "new", "ScriptValida...
Constructs the script validation context. @param scriptElement @return
[ "Constructs", "the", "script", "validation", "context", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/config/xml/SQLActionParser.java#L162-L174
train
citrusframework/citrus
modules/citrus-kafka/src/main/java/com/consol/citrus/kafka/endpoint/KafkaConsumer.java
KafkaConsumer.stop
public void stop() { try { if (CollectionUtils.isEmpty(consumer.subscription())) { consumer.unsubscribe(); } } finally { consumer.close(Duration.ofMillis(10 * 1000L)); } }
java
public void stop() { try { if (CollectionUtils.isEmpty(consumer.subscription())) { consumer.unsubscribe(); } } finally { consumer.close(Duration.ofMillis(10 * 1000L)); } }
[ "public", "void", "stop", "(", ")", "{", "try", "{", "if", "(", "CollectionUtils", ".", "isEmpty", "(", "consumer", ".", "subscription", "(", ")", ")", ")", "{", "consumer", ".", "unsubscribe", "(", ")", ";", "}", "}", "finally", "{", "consumer", "."...
Stop message listener container.
[ "Stop", "message", "listener", "container", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-kafka/src/main/java/com/consol/citrus/kafka/endpoint/KafkaConsumer.java#L95-L103
train
citrusframework/citrus
modules/citrus-kafka/src/main/java/com/consol/citrus/kafka/endpoint/KafkaConsumer.java
KafkaConsumer.createConsumer
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(KafkaMessageHeaders.KAFKA_PREFIX + "consumer_" + UUID.randomUUID().toString())); consumerProps.put(ConsumerConfig.GROUP_ID_CONFIG, endpointConfiguration.getConsumerGroup()); consumerProps.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, Optional.ofNullable(endpointConfiguration.getServer()).orElse("localhost:9092")); consumerProps.put(ConsumerConfig.MAX_POLL_RECORDS_CONFIG, 1); consumerProps.put(ConsumerConfig.ENABLE_AUTO_COMMIT_CONFIG, endpointConfiguration.isAutoCommit()); consumerProps.put(ConsumerConfig.AUTO_COMMIT_INTERVAL_MS_CONFIG, endpointConfiguration.getAutoCommitInterval()); consumerProps.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, endpointConfiguration.getOffsetReset()); consumerProps.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, endpointConfiguration.getKeyDeserializer()); consumerProps.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, endpointConfiguration.getValueDeserializer()); consumerProps.putAll(endpointConfiguration.getConsumerProperties()); return new org.apache.kafka.clients.consumer.KafkaConsumer<>(consumerProps); }
java
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(KafkaMessageHeaders.KAFKA_PREFIX + "consumer_" + UUID.randomUUID().toString())); consumerProps.put(ConsumerConfig.GROUP_ID_CONFIG, endpointConfiguration.getConsumerGroup()); consumerProps.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, Optional.ofNullable(endpointConfiguration.getServer()).orElse("localhost:9092")); consumerProps.put(ConsumerConfig.MAX_POLL_RECORDS_CONFIG, 1); consumerProps.put(ConsumerConfig.ENABLE_AUTO_COMMIT_CONFIG, endpointConfiguration.isAutoCommit()); consumerProps.put(ConsumerConfig.AUTO_COMMIT_INTERVAL_MS_CONFIG, endpointConfiguration.getAutoCommitInterval()); consumerProps.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, endpointConfiguration.getOffsetReset()); consumerProps.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, endpointConfiguration.getKeyDeserializer()); consumerProps.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, endpointConfiguration.getValueDeserializer()); consumerProps.putAll(endpointConfiguration.getConsumerProperties()); return new org.apache.kafka.clients.consumer.KafkaConsumer<>(consumerProps); }
[ "private", "org", ".", "apache", ".", "kafka", ".", "clients", ".", "consumer", ".", "KafkaConsumer", "<", "Object", ",", "Object", ">", "createConsumer", "(", ")", "{", "Map", "<", "String", ",", "Object", ">", "consumerProps", "=", "new", "HashMap", "<...
Create new Kafka consumer with given endpoint configuration. @return
[ "Create", "new", "Kafka", "consumer", "with", "given", "endpoint", "configuration", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-kafka/src/main/java/com/consol/citrus/kafka/endpoint/KafkaConsumer.java#L109-L124
train
citrusframework/citrus
modules/citrus-kafka/src/main/java/com/consol/citrus/kafka/endpoint/KafkaConsumer.java
KafkaConsumer.setConsumer
public void setConsumer(org.apache.kafka.clients.consumer.KafkaConsumer<Object, Object> consumer) { this.consumer = consumer; }
java
public void setConsumer(org.apache.kafka.clients.consumer.KafkaConsumer<Object, Object> consumer) { this.consumer = consumer; }
[ "public", "void", "setConsumer", "(", "org", ".", "apache", ".", "kafka", ".", "clients", ".", "consumer", ".", "KafkaConsumer", "<", "Object", ",", "Object", ">", "consumer", ")", "{", "this", ".", "consumer", "=", "consumer", ";", "}" ]
Sets the consumer. @param consumer
[ "Sets", "the", "consumer", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-kafka/src/main/java/com/consol/citrus/kafka/endpoint/KafkaConsumer.java#L131-L133
train
citrusframework/citrus
modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/builder/TemplateBuilder.java
TemplateBuilder.load
public TemplateBuilder load(ApplicationContext applicationContext) { Template rootTemplate = applicationContext.getBean(action.getName(), Template.class); action.setGlobalContext(rootTemplate.isGlobalContext()); action.setActor(rootTemplate.getActor()); action.setActions(rootTemplate.getActions()); action.setParameter(rootTemplate.getParameter()); return this; }
java
public TemplateBuilder load(ApplicationContext applicationContext) { Template rootTemplate = applicationContext.getBean(action.getName(), Template.class); action.setGlobalContext(rootTemplate.isGlobalContext()); action.setActor(rootTemplate.getActor()); action.setActions(rootTemplate.getActions()); action.setParameter(rootTemplate.getParameter()); return this; }
[ "public", "TemplateBuilder", "load", "(", "ApplicationContext", "applicationContext", ")", "{", "Template", "rootTemplate", "=", "applicationContext", ".", "getBean", "(", "action", ".", "getName", "(", ")", ",", "Template", ".", "class", ")", ";", "action", "."...
Loads template bean from Spring bean application context and sets attributes. @param applicationContext @return
[ "Loads", "template", "bean", "from", "Spring", "bean", "application", "context", "and", "sets", "attributes", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/builder/TemplateBuilder.java#L62-L71
train
citrusframework/citrus
modules/citrus-core/src/main/java/com/consol/citrus/channel/ChannelConsumer.java
ChannelConsumer.getDestinationChannel
protected MessageChannel getDestinationChannel(TestContext context) { if (endpointConfiguration.getChannel() != null) { return endpointConfiguration.getChannel(); } else if (StringUtils.hasText(endpointConfiguration.getChannelName())) { return resolveChannelName(endpointConfiguration.getChannelName(), context); } else { throw new CitrusRuntimeException("Neither channel name nor channel object is set - " + "please specify destination channel"); } }
java
protected MessageChannel getDestinationChannel(TestContext context) { if (endpointConfiguration.getChannel() != null) { return endpointConfiguration.getChannel(); } else if (StringUtils.hasText(endpointConfiguration.getChannelName())) { return resolveChannelName(endpointConfiguration.getChannelName(), context); } else { throw new CitrusRuntimeException("Neither channel name nor channel object is set - " + "please specify destination channel"); } }
[ "protected", "MessageChannel", "getDestinationChannel", "(", "TestContext", "context", ")", "{", "if", "(", "endpointConfiguration", ".", "getChannel", "(", ")", "!=", "null", ")", "{", "return", "endpointConfiguration", ".", "getChannel", "(", ")", ";", "}", "e...
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. @param context the test context @return the destination channel object.
[ "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", ...
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/channel/ChannelConsumer.java#L113-L122
train
citrusframework/citrus
modules/citrus-core/src/main/java/com/consol/citrus/channel/ChannelConsumer.java
ChannelConsumer.getDestinationChannelName
protected String getDestinationChannelName() { if (endpointConfiguration.getChannel() != null) { return endpointConfiguration.getChannel().toString(); } else if (StringUtils.hasText(endpointConfiguration.getChannelName())) { return endpointConfiguration.getChannelName(); } else { throw new CitrusRuntimeException("Neither channel name nor channel object is set - " + "please specify destination channel"); } }
java
protected String getDestinationChannelName() { if (endpointConfiguration.getChannel() != null) { return endpointConfiguration.getChannel().toString(); } else if (StringUtils.hasText(endpointConfiguration.getChannelName())) { return endpointConfiguration.getChannelName(); } else { throw new CitrusRuntimeException("Neither channel name nor channel object is set - " + "please specify destination channel"); } }
[ "protected", "String", "getDestinationChannelName", "(", ")", "{", "if", "(", "endpointConfiguration", ".", "getChannel", "(", ")", "!=", "null", ")", "{", "return", "endpointConfiguration", ".", "getChannel", "(", ")", ".", "toString", "(", ")", ";", "}", "...
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. @return the channel name.
[ "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", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/channel/ChannelConsumer.java#L130-L139
train