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/ReceiveTimeoutAction.java | ReceiveTimeoutAction.getOrCreateEndpoint | public Endpoint getOrCreateEndpoint(TestContext context) {
if (endpoint != null) {
return endpoint;
} else if (StringUtils.hasText(endpointUri)) {
endpoint = context.getEndpointFactory().create(endpointUri, context);
return endpoint;
} else {
throw new CitrusRuntimeException("Neither endpoint nor endpoint uri is set properly!");
}
} | java | public Endpoint getOrCreateEndpoint(TestContext context) {
if (endpoint != null) {
return endpoint;
} else if (StringUtils.hasText(endpointUri)) {
endpoint = context.getEndpointFactory().create(endpointUri, context);
return endpoint;
} else {
throw new CitrusRuntimeException("Neither endpoint nor endpoint uri is set properly!");
}
} | [
"public",
"Endpoint",
"getOrCreateEndpoint",
"(",
"TestContext",
"context",
")",
"{",
"if",
"(",
"endpoint",
"!=",
"null",
")",
"{",
"return",
"endpoint",
";",
"}",
"else",
"if",
"(",
"StringUtils",
".",
"hasText",
"(",
"endpointUri",
")",
")",
"{",
"endpo... | Creates or gets the endpoint instance.
@param context
@return | [
"Creates",
"or",
"gets",
"the",
"endpoint",
"instance",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/actions/ReceiveTimeoutAction.java#L100-L109 | train |
citrusframework/citrus | modules/citrus-core/src/main/java/com/consol/citrus/container/AbstractSuiteActionContainer.java | AbstractSuiteActionContainer.shouldExecute | public boolean shouldExecute(String suiteName, String[] includedGroups) {
String baseErrorMessage = "Suite container restrictions did not match %s - do not execute container '%s'";
if (StringUtils.hasText(suiteName) &&
!CollectionUtils.isEmpty(suiteNames) && ! suiteNames.contains(suiteName)) {
if (log.isDebugEnabled()) {
log.debug(String.format(baseErrorMessage, "suite name", getName()));
}
return false;
}
if (!checkTestGroups(includedGroups)) {
if (log.isDebugEnabled()) {
log.debug(String.format(baseErrorMessage, "test groups", getName()));
}
return false;
}
for (Map.Entry<String, String> envEntry : env.entrySet()) {
if (!System.getenv().containsKey(envEntry.getKey()) ||
(StringUtils.hasText(envEntry.getValue()) && !System.getenv().get(envEntry.getKey()).equals(envEntry.getValue()))) {
if (log.isDebugEnabled()) {
log.debug(String.format(baseErrorMessage, "env properties", getName()));
}
return false;
}
}
for (Map.Entry<String, String> systemProperty : systemProperties.entrySet()) {
if (!System.getProperties().containsKey(systemProperty.getKey()) ||
(StringUtils.hasText(systemProperty.getValue()) && !System.getProperties().get(systemProperty.getKey()).equals(systemProperty.getValue()))) {
if (log.isDebugEnabled()) {
log.debug(String.format(baseErrorMessage, "system properties", getName()));
}
return false;
}
}
return true;
} | java | public boolean shouldExecute(String suiteName, String[] includedGroups) {
String baseErrorMessage = "Suite container restrictions did not match %s - do not execute container '%s'";
if (StringUtils.hasText(suiteName) &&
!CollectionUtils.isEmpty(suiteNames) && ! suiteNames.contains(suiteName)) {
if (log.isDebugEnabled()) {
log.debug(String.format(baseErrorMessage, "suite name", getName()));
}
return false;
}
if (!checkTestGroups(includedGroups)) {
if (log.isDebugEnabled()) {
log.debug(String.format(baseErrorMessage, "test groups", getName()));
}
return false;
}
for (Map.Entry<String, String> envEntry : env.entrySet()) {
if (!System.getenv().containsKey(envEntry.getKey()) ||
(StringUtils.hasText(envEntry.getValue()) && !System.getenv().get(envEntry.getKey()).equals(envEntry.getValue()))) {
if (log.isDebugEnabled()) {
log.debug(String.format(baseErrorMessage, "env properties", getName()));
}
return false;
}
}
for (Map.Entry<String, String> systemProperty : systemProperties.entrySet()) {
if (!System.getProperties().containsKey(systemProperty.getKey()) ||
(StringUtils.hasText(systemProperty.getValue()) && !System.getProperties().get(systemProperty.getKey()).equals(systemProperty.getValue()))) {
if (log.isDebugEnabled()) {
log.debug(String.format(baseErrorMessage, "system properties", getName()));
}
return false;
}
}
return true;
} | [
"public",
"boolean",
"shouldExecute",
"(",
"String",
"suiteName",
",",
"String",
"[",
"]",
"includedGroups",
")",
"{",
"String",
"baseErrorMessage",
"=",
"\"Suite container restrictions did not match %s - do not execute container '%s'\"",
";",
"if",
"(",
"StringUtils",
".",... | Checks if this suite actions should execute according to suite name and included test groups.
@param suiteName
@param includedGroups
@return | [
"Checks",
"if",
"this",
"suite",
"actions",
"should",
"execute",
"according",
"to",
"suite",
"name",
"and",
"included",
"test",
"groups",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/container/AbstractSuiteActionContainer.java#L56-L95 | train |
citrusframework/citrus | modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/builder/CamelControlBusActionBuilder.java | CamelControlBusActionBuilder.route | public CamelControlBusActionBuilder route(String id, String action) {
super.action.setRouteId(id);
super.action.setAction(action);
return this;
} | java | public CamelControlBusActionBuilder route(String id, String action) {
super.action.setRouteId(id);
super.action.setAction(action);
return this;
} | [
"public",
"CamelControlBusActionBuilder",
"route",
"(",
"String",
"id",
",",
"String",
"action",
")",
"{",
"super",
".",
"action",
".",
"setRouteId",
"(",
"id",
")",
";",
"super",
".",
"action",
".",
"setAction",
"(",
"action",
")",
";",
"return",
"this",
... | Sets route action to execute.
@param id
@param action | [
"Sets",
"route",
"action",
"to",
"execute",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/builder/CamelControlBusActionBuilder.java#L43-L47 | train |
citrusframework/citrus | modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/builder/CamelControlBusActionBuilder.java | CamelControlBusActionBuilder.language | public CamelControlBusActionBuilder language(String language, String expression) {
action.setLanguageType(language);
action.setLanguageExpression(expression);
return this;
} | java | public CamelControlBusActionBuilder language(String language, String expression) {
action.setLanguageType(language);
action.setLanguageExpression(expression);
return this;
} | [
"public",
"CamelControlBusActionBuilder",
"language",
"(",
"String",
"language",
",",
"String",
"expression",
")",
"{",
"action",
".",
"setLanguageType",
"(",
"language",
")",
";",
"action",
".",
"setLanguageExpression",
"(",
"expression",
")",
";",
"return",
"thi... | Sets a language expression to execute.
@param language
@param expression
@return | [
"Sets",
"a",
"language",
"expression",
"to",
"execute",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/builder/CamelControlBusActionBuilder.java#L65-L70 | train |
citrusframework/citrus | modules/citrus-http/src/main/java/com/consol/citrus/http/interceptor/LoggingHandlerInterceptor.java | LoggingHandlerInterceptor.handleRequest | public void handleRequest(String request) {
if (messageListener != null) {
log.debug("Received Http request");
messageListener.onInboundMessage(new RawMessage(request), null);
} else {
if (log.isDebugEnabled()) {
log.debug("Received Http request:" + NEWLINE + request);
}
}
} | java | public void handleRequest(String request) {
if (messageListener != null) {
log.debug("Received Http request");
messageListener.onInboundMessage(new RawMessage(request), null);
} else {
if (log.isDebugEnabled()) {
log.debug("Received Http request:" + NEWLINE + request);
}
}
} | [
"public",
"void",
"handleRequest",
"(",
"String",
"request",
")",
"{",
"if",
"(",
"messageListener",
"!=",
"null",
")",
"{",
"log",
".",
"debug",
"(",
"\"Received Http request\"",
")",
";",
"messageListener",
".",
"onInboundMessage",
"(",
"new",
"RawMessage",
... | Handle request message and write request to logger.
@param request | [
"Handle",
"request",
"message",
"and",
"write",
"request",
"to",
"logger",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-http/src/main/java/com/consol/citrus/http/interceptor/LoggingHandlerInterceptor.java#L85-L94 | train |
citrusframework/citrus | modules/citrus-http/src/main/java/com/consol/citrus/http/interceptor/LoggingHandlerInterceptor.java | LoggingHandlerInterceptor.handleResponse | public void handleResponse(String response) {
if (messageListener != null) {
log.debug("Sending Http response");
messageListener.onOutboundMessage(new RawMessage(response), null);
} else {
if (log.isDebugEnabled()) {
log.debug("Sending Http response:" + NEWLINE + response);
}
}
} | java | public void handleResponse(String response) {
if (messageListener != null) {
log.debug("Sending Http response");
messageListener.onOutboundMessage(new RawMessage(response), null);
} else {
if (log.isDebugEnabled()) {
log.debug("Sending Http response:" + NEWLINE + response);
}
}
} | [
"public",
"void",
"handleResponse",
"(",
"String",
"response",
")",
"{",
"if",
"(",
"messageListener",
"!=",
"null",
")",
"{",
"log",
".",
"debug",
"(",
"\"Sending Http response\"",
")",
";",
"messageListener",
".",
"onOutboundMessage",
"(",
"new",
"RawMessage",... | Handle response message and write content to logger.
@param response | [
"Handle",
"response",
"message",
"and",
"write",
"content",
"to",
"logger",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-http/src/main/java/com/consol/citrus/http/interceptor/LoggingHandlerInterceptor.java#L100-L109 | train |
citrusframework/citrus | modules/citrus-http/src/main/java/com/consol/citrus/http/interceptor/LoggingHandlerInterceptor.java | LoggingHandlerInterceptor.getRequestContent | private String getRequestContent(HttpServletRequest request) throws IOException {
StringBuilder builder = new StringBuilder();
builder.append(request.getProtocol());
builder.append(" ");
builder.append(request.getMethod());
builder.append(" ");
builder.append(request.getRequestURI());
builder.append(NEWLINE);
Enumeration<?> headerNames = request.getHeaderNames();
while (headerNames.hasMoreElements()) {
String headerName = headerNames.nextElement().toString();
builder.append(headerName);
builder.append(":");
Enumeration<?> headerValues = request.getHeaders(headerName);
if (headerValues.hasMoreElements()) {
builder.append(headerValues.nextElement());
}
while (headerValues.hasMoreElements()) {
builder.append(",");
builder.append(headerValues.nextElement());
}
builder.append(NEWLINE);
}
builder.append(NEWLINE);
builder.append(FileUtils.readToString(request.getInputStream()));
return builder.toString();
} | java | private String getRequestContent(HttpServletRequest request) throws IOException {
StringBuilder builder = new StringBuilder();
builder.append(request.getProtocol());
builder.append(" ");
builder.append(request.getMethod());
builder.append(" ");
builder.append(request.getRequestURI());
builder.append(NEWLINE);
Enumeration<?> headerNames = request.getHeaderNames();
while (headerNames.hasMoreElements()) {
String headerName = headerNames.nextElement().toString();
builder.append(headerName);
builder.append(":");
Enumeration<?> headerValues = request.getHeaders(headerName);
if (headerValues.hasMoreElements()) {
builder.append(headerValues.nextElement());
}
while (headerValues.hasMoreElements()) {
builder.append(",");
builder.append(headerValues.nextElement());
}
builder.append(NEWLINE);
}
builder.append(NEWLINE);
builder.append(FileUtils.readToString(request.getInputStream()));
return builder.toString();
} | [
"private",
"String",
"getRequestContent",
"(",
"HttpServletRequest",
"request",
")",
"throws",
"IOException",
"{",
"StringBuilder",
"builder",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"builder",
".",
"append",
"(",
"request",
".",
"getProtocol",
"(",
")",
")"... | Builds raw request message content from Http servlet request.
@param request
@return
@throws IOException | [
"Builds",
"raw",
"request",
"message",
"content",
"from",
"Http",
"servlet",
"request",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-http/src/main/java/com/consol/citrus/http/interceptor/LoggingHandlerInterceptor.java#L117-L151 | train |
citrusframework/citrus | modules/citrus-jms/src/main/java/com/consol/citrus/jms/endpoint/JmsConsumer.java | JmsConsumer.receive | private javax.jms.Message receive(String destinationName, String selector) {
javax.jms.Message receivedJmsMessage;
if (log.isDebugEnabled()) {
log.debug("Receiving JMS message on destination: '" + destinationName + (StringUtils.hasText(selector) ? "(" + selector + ")" : "") + "'");
}
if (StringUtils.hasText(selector)) {
receivedJmsMessage = endpointConfiguration.getJmsTemplate().receiveSelected(destinationName, selector);
} else {
receivedJmsMessage = endpointConfiguration.getJmsTemplate().receive(destinationName);
}
if (receivedJmsMessage == null) {
throw new ActionTimeoutException("Action timed out while receiving JMS message on '" + destinationName + (StringUtils.hasText(selector) ? "(" + selector + ")" : "") + "'");
}
log.info("Received JMS message on destination: '" + destinationName + (StringUtils.hasText(selector) ? "(" + selector + ")" : "") + "'");
return receivedJmsMessage;
} | java | private javax.jms.Message receive(String destinationName, String selector) {
javax.jms.Message receivedJmsMessage;
if (log.isDebugEnabled()) {
log.debug("Receiving JMS message on destination: '" + destinationName + (StringUtils.hasText(selector) ? "(" + selector + ")" : "") + "'");
}
if (StringUtils.hasText(selector)) {
receivedJmsMessage = endpointConfiguration.getJmsTemplate().receiveSelected(destinationName, selector);
} else {
receivedJmsMessage = endpointConfiguration.getJmsTemplate().receive(destinationName);
}
if (receivedJmsMessage == null) {
throw new ActionTimeoutException("Action timed out while receiving JMS message on '" + destinationName + (StringUtils.hasText(selector) ? "(" + selector + ")" : "") + "'");
}
log.info("Received JMS message on destination: '" + destinationName + (StringUtils.hasText(selector) ? "(" + selector + ")" : "") + "'");
return receivedJmsMessage;
} | [
"private",
"javax",
".",
"jms",
".",
"Message",
"receive",
"(",
"String",
"destinationName",
",",
"String",
"selector",
")",
"{",
"javax",
".",
"jms",
".",
"Message",
"receivedJmsMessage",
";",
"if",
"(",
"log",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
... | Receive message from destination name.
@param destinationName
@param selector
@return | [
"Receive",
"message",
"from",
"destination",
"name",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-jms/src/main/java/com/consol/citrus/jms/endpoint/JmsConsumer.java#L81-L101 | train |
citrusframework/citrus | modules/citrus-jms/src/main/java/com/consol/citrus/jms/endpoint/JmsConsumer.java | JmsConsumer.receive | private javax.jms.Message receive(Destination destination, String selector) {
javax.jms.Message receivedJmsMessage;
if (log.isDebugEnabled()) {
log.debug("Receiving JMS message on destination: '" + endpointConfiguration.getDestinationName(destination) + (StringUtils.hasText(selector) ? "(" + selector + ")" : "") + "'");
}
if (StringUtils.hasText(selector)) {
receivedJmsMessage = endpointConfiguration.getJmsTemplate().receiveSelected(destination, selector);
} else {
receivedJmsMessage = endpointConfiguration.getJmsTemplate().receive(destination);
}
if (receivedJmsMessage == null) {
throw new ActionTimeoutException("Action timed out while receiving JMS message on '" + endpointConfiguration.getDestinationName(destination) + (StringUtils.hasText(selector) ? "(" + selector + ")" : "") + "'");
}
log.info("Received JMS message on destination: '" + endpointConfiguration.getDestinationName(destination) + (StringUtils.hasText(selector) ? "(" + selector + ")" : "") + "'");
return receivedJmsMessage;
} | java | private javax.jms.Message receive(Destination destination, String selector) {
javax.jms.Message receivedJmsMessage;
if (log.isDebugEnabled()) {
log.debug("Receiving JMS message on destination: '" + endpointConfiguration.getDestinationName(destination) + (StringUtils.hasText(selector) ? "(" + selector + ")" : "") + "'");
}
if (StringUtils.hasText(selector)) {
receivedJmsMessage = endpointConfiguration.getJmsTemplate().receiveSelected(destination, selector);
} else {
receivedJmsMessage = endpointConfiguration.getJmsTemplate().receive(destination);
}
if (receivedJmsMessage == null) {
throw new ActionTimeoutException("Action timed out while receiving JMS message on '" + endpointConfiguration.getDestinationName(destination) + (StringUtils.hasText(selector) ? "(" + selector + ")" : "") + "'");
}
log.info("Received JMS message on destination: '" + endpointConfiguration.getDestinationName(destination) + (StringUtils.hasText(selector) ? "(" + selector + ")" : "") + "'");
return receivedJmsMessage;
} | [
"private",
"javax",
".",
"jms",
".",
"Message",
"receive",
"(",
"Destination",
"destination",
",",
"String",
"selector",
")",
"{",
"javax",
".",
"jms",
".",
"Message",
"receivedJmsMessage",
";",
"if",
"(",
"log",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
... | Receive message from destination.
@param destination
@param selector
@return | [
"Receive",
"message",
"from",
"destination",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-jms/src/main/java/com/consol/citrus/jms/endpoint/JmsConsumer.java#L109-L129 | train |
citrusframework/citrus | modules/citrus-core/src/main/java/com/consol/citrus/validation/xhtml/XhtmlMessageConverter.java | XhtmlMessageConverter.convert | public String convert(String messagePayload) {
initialize();
// check if we already have XHTML message content
if (messagePayload.contains(XHTML_DOCTYPE_DEFINITION)) {
return messagePayload;
} else {
String xhtmlPayload;
StringWriter xhtmlWriter = new StringWriter();
tidyInstance.parse(new StringReader(messagePayload), xhtmlWriter);
xhtmlPayload = xhtmlWriter.toString();
xhtmlPayload = xhtmlPayload.replaceFirst(W3_XHTML1_URL, "org/w3/xhtml/");
return xhtmlPayload;
}
} | java | public String convert(String messagePayload) {
initialize();
// check if we already have XHTML message content
if (messagePayload.contains(XHTML_DOCTYPE_DEFINITION)) {
return messagePayload;
} else {
String xhtmlPayload;
StringWriter xhtmlWriter = new StringWriter();
tidyInstance.parse(new StringReader(messagePayload), xhtmlWriter);
xhtmlPayload = xhtmlWriter.toString();
xhtmlPayload = xhtmlPayload.replaceFirst(W3_XHTML1_URL, "org/w3/xhtml/");
return xhtmlPayload;
}
} | [
"public",
"String",
"convert",
"(",
"String",
"messagePayload",
")",
"{",
"initialize",
"(",
")",
";",
"// check if we already have XHTML message content",
"if",
"(",
"messagePayload",
".",
"contains",
"(",
"XHTML_DOCTYPE_DEFINITION",
")",
")",
"{",
"return",
"message... | Converts message to XHTML conform representation.
@param messagePayload
@return | [
"Converts",
"message",
"to",
"XHTML",
"conform",
"representation",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/validation/xhtml/XhtmlMessageConverter.java#L48-L63 | train |
citrusframework/citrus | modules/citrus-core/src/main/java/com/consol/citrus/validation/xhtml/XhtmlMessageConverter.java | XhtmlMessageConverter.initialize | public void initialize() {
try {
if (tidyInstance == null) {
tidyInstance = new Tidy();
tidyInstance.setXHTML(true);
tidyInstance.setShowWarnings(false);
tidyInstance.setQuiet(true);
tidyInstance.setEscapeCdata(true);
tidyInstance.setTidyMark(false);
if (tidyConfiguration != null) {
tidyInstance.setConfigurationFromFile(tidyConfiguration.getFile().getAbsolutePath());
}
}
} catch (IOException e) {
throw new CitrusRuntimeException("Failed to initialize XHTML tidy instance");
}
} | java | public void initialize() {
try {
if (tidyInstance == null) {
tidyInstance = new Tidy();
tidyInstance.setXHTML(true);
tidyInstance.setShowWarnings(false);
tidyInstance.setQuiet(true);
tidyInstance.setEscapeCdata(true);
tidyInstance.setTidyMark(false);
if (tidyConfiguration != null) {
tidyInstance.setConfigurationFromFile(tidyConfiguration.getFile().getAbsolutePath());
}
}
} catch (IOException e) {
throw new CitrusRuntimeException("Failed to initialize XHTML tidy instance");
}
} | [
"public",
"void",
"initialize",
"(",
")",
"{",
"try",
"{",
"if",
"(",
"tidyInstance",
"==",
"null",
")",
"{",
"tidyInstance",
"=",
"new",
"Tidy",
"(",
")",
";",
"tidyInstance",
".",
"setXHTML",
"(",
"true",
")",
";",
"tidyInstance",
".",
"setShowWarnings... | Initialize tidy from configuration.
@throws IOException | [
"Initialize",
"tidy",
"from",
"configuration",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/validation/xhtml/XhtmlMessageConverter.java#L69-L86 | train |
citrusframework/citrus | modules/citrus-kafka/src/main/java/com/consol/citrus/kafka/embedded/EmbeddedKafkaServer.java | EmbeddedKafkaServer.start | public void start() {
if (kafkaServer != null) {
log.warn("Found instance of Kafka server - avoid duplicate Kafka server startup");
return;
}
File logDir = createLogDir();
zookeeper = createZookeeperServer(logDir);
serverFactory = createServerFactory();
try {
serverFactory.startup(zookeeper);
} catch (InterruptedException | IOException e) {
throw new CitrusRuntimeException("Failed to start embedded zookeeper server", e);
}
Properties brokerConfigProperties = createBrokerProperties("localhost:" + zookeeperPort, kafkaServerPort, logDir);
brokerConfigProperties.setProperty(KafkaConfig.ReplicaSocketTimeoutMsProp(), "1000");
brokerConfigProperties.setProperty(KafkaConfig.ControllerSocketTimeoutMsProp(), "1000");
brokerConfigProperties.setProperty(KafkaConfig.OffsetsTopicReplicationFactorProp(), "1");
brokerConfigProperties.setProperty(KafkaConfig.ReplicaHighWatermarkCheckpointIntervalMsProp(), String.valueOf(Long.MAX_VALUE));
if (brokerProperties != null) {
brokerProperties.forEach(brokerConfigProperties::put);
}
kafkaServer = new KafkaServer(new KafkaConfig(brokerConfigProperties), Time.SYSTEM,
scala.Option.apply(null), scala.collection.JavaConversions.asScalaBuffer(Collections.<KafkaMetricsReporter>emptyList()).toList());
kafkaServer.startup();
kafkaServer.boundPort(ListenerName.forSecurityProtocol(SecurityProtocol.PLAINTEXT));
createKafkaTopics(StringUtils.commaDelimitedListToSet(topics));
} | java | public void start() {
if (kafkaServer != null) {
log.warn("Found instance of Kafka server - avoid duplicate Kafka server startup");
return;
}
File logDir = createLogDir();
zookeeper = createZookeeperServer(logDir);
serverFactory = createServerFactory();
try {
serverFactory.startup(zookeeper);
} catch (InterruptedException | IOException e) {
throw new CitrusRuntimeException("Failed to start embedded zookeeper server", e);
}
Properties brokerConfigProperties = createBrokerProperties("localhost:" + zookeeperPort, kafkaServerPort, logDir);
brokerConfigProperties.setProperty(KafkaConfig.ReplicaSocketTimeoutMsProp(), "1000");
brokerConfigProperties.setProperty(KafkaConfig.ControllerSocketTimeoutMsProp(), "1000");
brokerConfigProperties.setProperty(KafkaConfig.OffsetsTopicReplicationFactorProp(), "1");
brokerConfigProperties.setProperty(KafkaConfig.ReplicaHighWatermarkCheckpointIntervalMsProp(), String.valueOf(Long.MAX_VALUE));
if (brokerProperties != null) {
brokerProperties.forEach(brokerConfigProperties::put);
}
kafkaServer = new KafkaServer(new KafkaConfig(brokerConfigProperties), Time.SYSTEM,
scala.Option.apply(null), scala.collection.JavaConversions.asScalaBuffer(Collections.<KafkaMetricsReporter>emptyList()).toList());
kafkaServer.startup();
kafkaServer.boundPort(ListenerName.forSecurityProtocol(SecurityProtocol.PLAINTEXT));
createKafkaTopics(StringUtils.commaDelimitedListToSet(topics));
} | [
"public",
"void",
"start",
"(",
")",
"{",
"if",
"(",
"kafkaServer",
"!=",
"null",
")",
"{",
"log",
".",
"warn",
"(",
"\"Found instance of Kafka server - avoid duplicate Kafka server startup\"",
")",
";",
"return",
";",
"}",
"File",
"logDir",
"=",
"createLogDir",
... | Start embedded server instances for Kafka and Zookeeper. | [
"Start",
"embedded",
"server",
"instances",
"for",
"Kafka",
"and",
"Zookeeper",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-kafka/src/main/java/com/consol/citrus/kafka/embedded/EmbeddedKafkaServer.java#L86-L118 | train |
citrusframework/citrus | modules/citrus-kafka/src/main/java/com/consol/citrus/kafka/embedded/EmbeddedKafkaServer.java | EmbeddedKafkaServer.stop | public void stop() {
if (kafkaServer != null) {
try {
if (kafkaServer.brokerState().currentState() != (NotRunning.state())) {
kafkaServer.shutdown();
kafkaServer.awaitShutdown();
}
} catch (Exception e) {
log.warn("Failed to shutdown Kafka embedded server", e);
}
try {
CoreUtils.delete(kafkaServer.config().logDirs());
} catch (Exception e) {
log.warn("Failed to remove logs on Kafka embedded server", e);
}
}
if (serverFactory != null) {
try {
serverFactory.shutdown();
} catch (Exception e) {
log.warn("Failed to shutdown Zookeeper instance", e);
}
}
} | java | public void stop() {
if (kafkaServer != null) {
try {
if (kafkaServer.brokerState().currentState() != (NotRunning.state())) {
kafkaServer.shutdown();
kafkaServer.awaitShutdown();
}
} catch (Exception e) {
log.warn("Failed to shutdown Kafka embedded server", e);
}
try {
CoreUtils.delete(kafkaServer.config().logDirs());
} catch (Exception e) {
log.warn("Failed to remove logs on Kafka embedded server", e);
}
}
if (serverFactory != null) {
try {
serverFactory.shutdown();
} catch (Exception e) {
log.warn("Failed to shutdown Zookeeper instance", e);
}
}
} | [
"public",
"void",
"stop",
"(",
")",
"{",
"if",
"(",
"kafkaServer",
"!=",
"null",
")",
"{",
"try",
"{",
"if",
"(",
"kafkaServer",
".",
"brokerState",
"(",
")",
".",
"currentState",
"(",
")",
"!=",
"(",
"NotRunning",
".",
"state",
"(",
")",
")",
")",... | Shutdown embedded Kafka and Zookeeper server instances | [
"Shutdown",
"embedded",
"Kafka",
"and",
"Zookeeper",
"server",
"instances"
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-kafka/src/main/java/com/consol/citrus/kafka/embedded/EmbeddedKafkaServer.java#L123-L148 | train |
citrusframework/citrus | modules/citrus-kafka/src/main/java/com/consol/citrus/kafka/embedded/EmbeddedKafkaServer.java | EmbeddedKafkaServer.createZookeeperServer | protected ZooKeeperServer createZookeeperServer(File logDir) {
try {
return new ZooKeeperServer(logDir, logDir, 2000);
} catch (IOException e) {
throw new CitrusRuntimeException("Failed to create embedded zookeeper server", e);
}
} | java | protected ZooKeeperServer createZookeeperServer(File logDir) {
try {
return new ZooKeeperServer(logDir, logDir, 2000);
} catch (IOException e) {
throw new CitrusRuntimeException("Failed to create embedded zookeeper server", e);
}
} | [
"protected",
"ZooKeeperServer",
"createZookeeperServer",
"(",
"File",
"logDir",
")",
"{",
"try",
"{",
"return",
"new",
"ZooKeeperServer",
"(",
"logDir",
",",
"logDir",
",",
"2000",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"new",
... | Creates new embedded Zookeeper server.
@return | [
"Creates",
"new",
"embedded",
"Zookeeper",
"server",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-kafka/src/main/java/com/consol/citrus/kafka/embedded/EmbeddedKafkaServer.java#L164-L170 | train |
citrusframework/citrus | modules/citrus-kafka/src/main/java/com/consol/citrus/kafka/embedded/EmbeddedKafkaServer.java | EmbeddedKafkaServer.createLogDir | protected File createLogDir() {
File logDir = Optional.ofNullable(logDirPath)
.map(Paths::get)
.map(Path::toFile)
.orElse(new File(System.getProperty("java.io.tmpdir")));
if (!logDir.exists()) {
if (!logDir.mkdirs()) {
log.warn("Unable to create log directory: " + logDir.getAbsolutePath());
logDir = new File(System.getProperty("java.io.tmpdir"));
log.info("Using default log directory: " + logDir.getAbsolutePath());
}
}
File logs = new File(logDir, "zookeeper" + System.currentTimeMillis()).getAbsoluteFile();
if (autoDeleteLogs) {
logs.deleteOnExit();
}
return logs;
} | java | protected File createLogDir() {
File logDir = Optional.ofNullable(logDirPath)
.map(Paths::get)
.map(Path::toFile)
.orElse(new File(System.getProperty("java.io.tmpdir")));
if (!logDir.exists()) {
if (!logDir.mkdirs()) {
log.warn("Unable to create log directory: " + logDir.getAbsolutePath());
logDir = new File(System.getProperty("java.io.tmpdir"));
log.info("Using default log directory: " + logDir.getAbsolutePath());
}
}
File logs = new File(logDir, "zookeeper" + System.currentTimeMillis()).getAbsoluteFile();
if (autoDeleteLogs) {
logs.deleteOnExit();
}
return logs;
} | [
"protected",
"File",
"createLogDir",
"(",
")",
"{",
"File",
"logDir",
"=",
"Optional",
".",
"ofNullable",
"(",
"logDirPath",
")",
".",
"map",
"(",
"Paths",
"::",
"get",
")",
".",
"map",
"(",
"Path",
"::",
"toFile",
")",
".",
"orElse",
"(",
"new",
"Fi... | Creates Zookeeper log directory. By default logs are created in Java temp directory.
By default directory is automatically deleted on exit.
@return | [
"Creates",
"Zookeeper",
"log",
"directory",
".",
"By",
"default",
"logs",
"are",
"created",
"in",
"Java",
"temp",
"directory",
".",
"By",
"default",
"directory",
"is",
"automatically",
"deleted",
"on",
"exit",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-kafka/src/main/java/com/consol/citrus/kafka/embedded/EmbeddedKafkaServer.java#L178-L199 | train |
citrusframework/citrus | modules/citrus-kafka/src/main/java/com/consol/citrus/kafka/embedded/EmbeddedKafkaServer.java | EmbeddedKafkaServer.createServerFactory | protected ServerCnxnFactory createServerFactory() {
try {
ServerCnxnFactory serverFactory = new NIOServerCnxnFactory();
serverFactory.configure(new InetSocketAddress(zookeeperPort), 5000);
return serverFactory;
} catch (IOException e) {
throw new CitrusRuntimeException("Failed to create default zookeeper server factory", e);
}
} | java | protected ServerCnxnFactory createServerFactory() {
try {
ServerCnxnFactory serverFactory = new NIOServerCnxnFactory();
serverFactory.configure(new InetSocketAddress(zookeeperPort), 5000);
return serverFactory;
} catch (IOException e) {
throw new CitrusRuntimeException("Failed to create default zookeeper server factory", e);
}
} | [
"protected",
"ServerCnxnFactory",
"createServerFactory",
"(",
")",
"{",
"try",
"{",
"ServerCnxnFactory",
"serverFactory",
"=",
"new",
"NIOServerCnxnFactory",
"(",
")",
";",
"serverFactory",
".",
"configure",
"(",
"new",
"InetSocketAddress",
"(",
"zookeeperPort",
")",
... | Create server factory for embedded Zookeeper server instance.
@return | [
"Create",
"server",
"factory",
"for",
"embedded",
"Zookeeper",
"server",
"instance",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-kafka/src/main/java/com/consol/citrus/kafka/embedded/EmbeddedKafkaServer.java#L205-L213 | train |
citrusframework/citrus | modules/citrus-kafka/src/main/java/com/consol/citrus/kafka/embedded/EmbeddedKafkaServer.java | EmbeddedKafkaServer.createKafkaTopics | protected void createKafkaTopics(Set<String> topics) {
Map<String, Object> adminConfigs = new HashMap<>();
adminConfigs.put(AdminClientConfig.BOOTSTRAP_SERVERS_CONFIG, "localhost:" + kafkaServerPort);
try (AdminClient admin = AdminClient.create(adminConfigs)) {
List<NewTopic> newTopics = topics.stream()
.map(t -> new NewTopic(t, partitions, (short) 1))
.collect(Collectors.toList());
CreateTopicsResult createTopics = admin.createTopics(newTopics);
try {
createTopics.all().get();
} catch (Exception e) {
log.warn("Failed to create Kafka topics", e);
}
}
} | java | protected void createKafkaTopics(Set<String> topics) {
Map<String, Object> adminConfigs = new HashMap<>();
adminConfigs.put(AdminClientConfig.BOOTSTRAP_SERVERS_CONFIG, "localhost:" + kafkaServerPort);
try (AdminClient admin = AdminClient.create(adminConfigs)) {
List<NewTopic> newTopics = topics.stream()
.map(t -> new NewTopic(t, partitions, (short) 1))
.collect(Collectors.toList());
CreateTopicsResult createTopics = admin.createTopics(newTopics);
try {
createTopics.all().get();
} catch (Exception e) {
log.warn("Failed to create Kafka topics", e);
}
}
} | [
"protected",
"void",
"createKafkaTopics",
"(",
"Set",
"<",
"String",
">",
"topics",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"adminConfigs",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"adminConfigs",
".",
"put",
"(",
"AdminClientConfig",
".",
... | Create topics on embedded Kafka server.
@param topics | [
"Create",
"topics",
"on",
"embedded",
"Kafka",
"server",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-kafka/src/main/java/com/consol/citrus/kafka/embedded/EmbeddedKafkaServer.java#L219-L233 | train |
citrusframework/citrus | modules/citrus-kafka/src/main/java/com/consol/citrus/kafka/embedded/EmbeddedKafkaServer.java | EmbeddedKafkaServer.createBrokerProperties | protected Properties createBrokerProperties(String zooKeeperConnect, int kafkaServerPort, File logDir) {
Properties props = new Properties();
props.put(KafkaConfig.BrokerIdProp(), "0");
props.put(KafkaConfig.ZkConnectProp(), zooKeeperConnect);
props.put(KafkaConfig.ZkConnectionTimeoutMsProp(), "10000");
props.put(KafkaConfig.ReplicaSocketTimeoutMsProp(), "1500");
props.put(KafkaConfig.ControllerSocketTimeoutMsProp(), "1500");
props.put(KafkaConfig.ControlledShutdownEnableProp(), "false");
props.put(KafkaConfig.DeleteTopicEnableProp(), "true");
props.put(KafkaConfig.LogDeleteDelayMsProp(), "1000");
props.put(KafkaConfig.ControlledShutdownRetryBackoffMsProp(), "100");
props.put(KafkaConfig.LogCleanerDedupeBufferSizeProp(), "2097152");
props.put(KafkaConfig.LogMessageTimestampDifferenceMaxMsProp(), Long.MAX_VALUE);
props.put(KafkaConfig.OffsetsTopicReplicationFactorProp(), "1");
props.put(KafkaConfig.OffsetsTopicPartitionsProp(), "5");
props.put(KafkaConfig.GroupInitialRebalanceDelayMsProp(), "0");
props.put(KafkaConfig.LogDirProp(), logDir.getAbsolutePath());
props.put(KafkaConfig.ListenersProp(), SecurityProtocol.PLAINTEXT.name + "://localhost:" + kafkaServerPort);
props.forEach((key, value) -> log.debug(String.format("Using default Kafka broker property %s='%s'", key ,value)));
return props;
} | java | protected Properties createBrokerProperties(String zooKeeperConnect, int kafkaServerPort, File logDir) {
Properties props = new Properties();
props.put(KafkaConfig.BrokerIdProp(), "0");
props.put(KafkaConfig.ZkConnectProp(), zooKeeperConnect);
props.put(KafkaConfig.ZkConnectionTimeoutMsProp(), "10000");
props.put(KafkaConfig.ReplicaSocketTimeoutMsProp(), "1500");
props.put(KafkaConfig.ControllerSocketTimeoutMsProp(), "1500");
props.put(KafkaConfig.ControlledShutdownEnableProp(), "false");
props.put(KafkaConfig.DeleteTopicEnableProp(), "true");
props.put(KafkaConfig.LogDeleteDelayMsProp(), "1000");
props.put(KafkaConfig.ControlledShutdownRetryBackoffMsProp(), "100");
props.put(KafkaConfig.LogCleanerDedupeBufferSizeProp(), "2097152");
props.put(KafkaConfig.LogMessageTimestampDifferenceMaxMsProp(), Long.MAX_VALUE);
props.put(KafkaConfig.OffsetsTopicReplicationFactorProp(), "1");
props.put(KafkaConfig.OffsetsTopicPartitionsProp(), "5");
props.put(KafkaConfig.GroupInitialRebalanceDelayMsProp(), "0");
props.put(KafkaConfig.LogDirProp(), logDir.getAbsolutePath());
props.put(KafkaConfig.ListenersProp(), SecurityProtocol.PLAINTEXT.name + "://localhost:" + kafkaServerPort);
props.forEach((key, value) -> log.debug(String.format("Using default Kafka broker property %s='%s'", key ,value)));
return props;
} | [
"protected",
"Properties",
"createBrokerProperties",
"(",
"String",
"zooKeeperConnect",
",",
"int",
"kafkaServerPort",
",",
"File",
"logDir",
")",
"{",
"Properties",
"props",
"=",
"new",
"Properties",
"(",
")",
";",
"props",
".",
"put",
"(",
"KafkaConfig",
".",
... | Creates Kafka broker properties.
@param zooKeeperConnect
@param kafkaServerPort
@param logDir
@return | [
"Creates",
"Kafka",
"broker",
"properties",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-kafka/src/main/java/com/consol/citrus/kafka/embedded/EmbeddedKafkaServer.java#L242-L266 | train |
citrusframework/citrus | modules/citrus-ws/src/main/java/com/consol/citrus/ws/message/callback/SoapResponseMessageCallback.java | SoapResponseMessageCallback.doWithMessage | public void doWithMessage(WebServiceMessage responseMessage) throws IOException, TransformerException {
// convert and set response for later access via getResponse():
response = endpointConfiguration.getMessageConverter().convertInbound(responseMessage, endpointConfiguration, context);
} | java | public void doWithMessage(WebServiceMessage responseMessage) throws IOException, TransformerException {
// convert and set response for later access via getResponse():
response = endpointConfiguration.getMessageConverter().convertInbound(responseMessage, endpointConfiguration, context);
} | [
"public",
"void",
"doWithMessage",
"(",
"WebServiceMessage",
"responseMessage",
")",
"throws",
"IOException",
",",
"TransformerException",
"{",
"// convert and set response for later access via getResponse():",
"response",
"=",
"endpointConfiguration",
".",
"getMessageConverter",
... | Callback method called with actual web service response message. Method constructs a Spring Integration
message from this web service message for further processing. | [
"Callback",
"method",
"called",
"with",
"actual",
"web",
"service",
"response",
"message",
".",
"Method",
"constructs",
"a",
"Spring",
"Integration",
"message",
"from",
"this",
"web",
"service",
"message",
"for",
"further",
"processing",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-ws/src/main/java/com/consol/citrus/ws/message/callback/SoapResponseMessageCallback.java#L59-L62 | train |
citrusframework/citrus | modules/citrus-vertx/src/main/java/com/consol/citrus/vertx/endpoint/VertxSyncConsumer.java | VertxSyncConsumer.saveReplyDestination | public void saveReplyDestination(Message receivedMessage, TestContext context) {
if (receivedMessage.getHeader(CitrusVertxMessageHeaders.VERTX_REPLY_ADDRESS) != null) {
String correlationKeyName = endpointConfiguration.getCorrelator().getCorrelationKeyName(getName());
String correlationKey = endpointConfiguration.getCorrelator().getCorrelationKey(receivedMessage);
correlationManager.saveCorrelationKey(correlationKeyName, correlationKey, context);
correlationManager.store(correlationKey, receivedMessage.getHeader(CitrusVertxMessageHeaders.VERTX_REPLY_ADDRESS).toString());
} else {
log.warn("Unable to retrieve reply address for message \n" +
receivedMessage + "\n - no reply address found in message headers!");
}
} | java | public void saveReplyDestination(Message receivedMessage, TestContext context) {
if (receivedMessage.getHeader(CitrusVertxMessageHeaders.VERTX_REPLY_ADDRESS) != null) {
String correlationKeyName = endpointConfiguration.getCorrelator().getCorrelationKeyName(getName());
String correlationKey = endpointConfiguration.getCorrelator().getCorrelationKey(receivedMessage);
correlationManager.saveCorrelationKey(correlationKeyName, correlationKey, context);
correlationManager.store(correlationKey, receivedMessage.getHeader(CitrusVertxMessageHeaders.VERTX_REPLY_ADDRESS).toString());
} else {
log.warn("Unable to retrieve reply address for message \n" +
receivedMessage + "\n - no reply address found in message headers!");
}
} | [
"public",
"void",
"saveReplyDestination",
"(",
"Message",
"receivedMessage",
",",
"TestContext",
"context",
")",
"{",
"if",
"(",
"receivedMessage",
".",
"getHeader",
"(",
"CitrusVertxMessageHeaders",
".",
"VERTX_REPLY_ADDRESS",
")",
"!=",
"null",
")",
"{",
"String",... | Store the reply address either straight forward or with a given
message correlation key.
@param receivedMessage
@param context | [
"Store",
"the",
"reply",
"address",
"either",
"straight",
"forward",
"or",
"with",
"a",
"given",
"message",
"correlation",
"key",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-vertx/src/main/java/com/consol/citrus/vertx/endpoint/VertxSyncConsumer.java#L97-L107 | train |
citrusframework/citrus | modules/citrus-zookeeper/src/main/java/com/consol/citrus/zookeeper/client/ZooClient.java | ZooClient.createZooKeeperClient | private ZooKeeper createZooKeeperClient() throws IOException {
ZooClientConfig config = getZookeeperClientConfig();
return new ZooKeeper(config.getUrl(), config.getTimeout(), getConnectionWatcher());
} | java | private ZooKeeper createZooKeeperClient() throws IOException {
ZooClientConfig config = getZookeeperClientConfig();
return new ZooKeeper(config.getUrl(), config.getTimeout(), getConnectionWatcher());
} | [
"private",
"ZooKeeper",
"createZooKeeperClient",
"(",
")",
"throws",
"IOException",
"{",
"ZooClientConfig",
"config",
"=",
"getZookeeperClientConfig",
"(",
")",
";",
"return",
"new",
"ZooKeeper",
"(",
"config",
".",
"getUrl",
"(",
")",
",",
"config",
".",
"getTi... | Creates a new Zookeeper client instance with configuration.
@return | [
"Creates",
"a",
"new",
"Zookeeper",
"client",
"instance",
"with",
"configuration",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-zookeeper/src/main/java/com/consol/citrus/zookeeper/client/ZooClient.java#L65-L68 | train |
citrusframework/citrus | modules/citrus-zookeeper/src/main/java/com/consol/citrus/zookeeper/client/ZooClient.java | ZooClient.getZooKeeperClient | public ZooKeeper getZooKeeperClient() {
if (zookeeper == null) {
try {
zookeeper = createZooKeeperClient();
int retryAttempts = 5;
while(!zookeeper.getState().isConnected() && retryAttempts > 0) {
LOG.debug("connecting...");
retryAttempts--;
Thread.sleep(1000);
}
} catch (IOException | InterruptedException e) {
throw new CitrusRuntimeException(e);
}
}
return zookeeper;
} | java | public ZooKeeper getZooKeeperClient() {
if (zookeeper == null) {
try {
zookeeper = createZooKeeperClient();
int retryAttempts = 5;
while(!zookeeper.getState().isConnected() && retryAttempts > 0) {
LOG.debug("connecting...");
retryAttempts--;
Thread.sleep(1000);
}
} catch (IOException | InterruptedException e) {
throw new CitrusRuntimeException(e);
}
}
return zookeeper;
} | [
"public",
"ZooKeeper",
"getZooKeeperClient",
"(",
")",
"{",
"if",
"(",
"zookeeper",
"==",
"null",
")",
"{",
"try",
"{",
"zookeeper",
"=",
"createZooKeeperClient",
"(",
")",
";",
"int",
"retryAttempts",
"=",
"5",
";",
"while",
"(",
"!",
"zookeeper",
".",
... | Constructs or gets the zookeeper client implementation.
@return | [
"Constructs",
"or",
"gets",
"the",
"zookeeper",
"client",
"implementation",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-zookeeper/src/main/java/com/consol/citrus/zookeeper/client/ZooClient.java#L74-L91 | train |
citrusframework/citrus | modules/citrus-core/src/main/java/com/consol/citrus/endpoint/DefaultEndpointFactory.java | DefaultEndpointFactory.loadEndpointComponentProperties | private void loadEndpointComponentProperties() {
try {
endpointComponentProperties = PropertiesLoaderUtils.loadProperties(new ClassPathResource("com/consol/citrus/endpoint/endpoint.components"));
} catch (IOException e) {
log.warn("Unable to laod default endpoint components from resource '%s'", e);
}
} | java | private void loadEndpointComponentProperties() {
try {
endpointComponentProperties = PropertiesLoaderUtils.loadProperties(new ClassPathResource("com/consol/citrus/endpoint/endpoint.components"));
} catch (IOException e) {
log.warn("Unable to laod default endpoint components from resource '%s'", e);
}
} | [
"private",
"void",
"loadEndpointComponentProperties",
"(",
")",
"{",
"try",
"{",
"endpointComponentProperties",
"=",
"PropertiesLoaderUtils",
".",
"loadProperties",
"(",
"new",
"ClassPathResource",
"(",
"\"com/consol/citrus/endpoint/endpoint.components\"",
")",
")",
";",
"}... | Loads property file from classpath holding default endpoint component definitions in Citrus. | [
"Loads",
"property",
"file",
"from",
"classpath",
"holding",
"default",
"endpoint",
"component",
"definitions",
"in",
"Citrus",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/endpoint/DefaultEndpointFactory.java#L192-L198 | train |
citrusframework/citrus | modules/citrus-core/src/main/java/com/consol/citrus/endpoint/DefaultEndpointFactory.java | DefaultEndpointFactory.loadEndpointParserProperties | private void loadEndpointParserProperties() {
try {
endpointParserProperties = PropertiesLoaderUtils.loadProperties(new ClassPathResource("com/consol/citrus/endpoint/endpoint.parser"));
} catch (IOException e) {
log.warn("Unable to laod default endpoint annotation parsers from resource '%s'", e);
}
} | java | private void loadEndpointParserProperties() {
try {
endpointParserProperties = PropertiesLoaderUtils.loadProperties(new ClassPathResource("com/consol/citrus/endpoint/endpoint.parser"));
} catch (IOException e) {
log.warn("Unable to laod default endpoint annotation parsers from resource '%s'", e);
}
} | [
"private",
"void",
"loadEndpointParserProperties",
"(",
")",
"{",
"try",
"{",
"endpointParserProperties",
"=",
"PropertiesLoaderUtils",
".",
"loadProperties",
"(",
"new",
"ClassPathResource",
"(",
"\"com/consol/citrus/endpoint/endpoint.parser\"",
")",
")",
";",
"}",
"catc... | Loads property file from classpath holding default endpoint annotation parser definitions in Citrus. | [
"Loads",
"property",
"file",
"from",
"classpath",
"holding",
"default",
"endpoint",
"annotation",
"parser",
"definitions",
"in",
"Citrus",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/endpoint/DefaultEndpointFactory.java#L203-L209 | train |
citrusframework/citrus | modules/citrus-ws/src/main/java/com/consol/citrus/ws/addressing/WsAddressingHeaders.java | WsAddressingHeaders.setAction | public void setAction(String action) {
try {
this.action = new URI(action);
} catch (URISyntaxException e) {
throw new CitrusRuntimeException("Invalid action uri", e);
}
} | java | public void setAction(String action) {
try {
this.action = new URI(action);
} catch (URISyntaxException e) {
throw new CitrusRuntimeException("Invalid action uri", e);
}
} | [
"public",
"void",
"setAction",
"(",
"String",
"action",
")",
"{",
"try",
"{",
"this",
".",
"action",
"=",
"new",
"URI",
"(",
"action",
")",
";",
"}",
"catch",
"(",
"URISyntaxException",
"e",
")",
"{",
"throw",
"new",
"CitrusRuntimeException",
"(",
"\"Inv... | Sets the action from uri string.
@param action the action to set | [
"Sets",
"the",
"action",
"from",
"uri",
"string",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-ws/src/main/java/com/consol/citrus/ws/addressing/WsAddressingHeaders.java#L90-L96 | train |
citrusframework/citrus | modules/citrus-ws/src/main/java/com/consol/citrus/ws/addressing/WsAddressingHeaders.java | WsAddressingHeaders.setTo | public void setTo(String to) {
try {
this.to = new URI(to);
} catch (URISyntaxException e) {
throw new CitrusRuntimeException("Invalid to uri", e);
}
} | java | public void setTo(String to) {
try {
this.to = new URI(to);
} catch (URISyntaxException e) {
throw new CitrusRuntimeException("Invalid to uri", e);
}
} | [
"public",
"void",
"setTo",
"(",
"String",
"to",
")",
"{",
"try",
"{",
"this",
".",
"to",
"=",
"new",
"URI",
"(",
"to",
")",
";",
"}",
"catch",
"(",
"URISyntaxException",
"e",
")",
"{",
"throw",
"new",
"CitrusRuntimeException",
"(",
"\"Invalid to uri\"",
... | Sets the to uri by string.
@param to the to to set | [
"Sets",
"the",
"to",
"uri",
"by",
"string",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-ws/src/main/java/com/consol/citrus/ws/addressing/WsAddressingHeaders.java#L118-L124 | train |
citrusframework/citrus | modules/citrus-ws/src/main/java/com/consol/citrus/ws/addressing/WsAddressingHeaders.java | WsAddressingHeaders.setMessageId | public void setMessageId(String messageId) {
try {
this.messageId = new URI(messageId);
} catch (URISyntaxException e) {
throw new CitrusRuntimeException("Invalid messageId uri", e);
}
} | java | public void setMessageId(String messageId) {
try {
this.messageId = new URI(messageId);
} catch (URISyntaxException e) {
throw new CitrusRuntimeException("Invalid messageId uri", e);
}
} | [
"public",
"void",
"setMessageId",
"(",
"String",
"messageId",
")",
"{",
"try",
"{",
"this",
".",
"messageId",
"=",
"new",
"URI",
"(",
"messageId",
")",
";",
"}",
"catch",
"(",
"URISyntaxException",
"e",
")",
"{",
"throw",
"new",
"CitrusRuntimeException",
"... | Sets the message id from uri string.
@param messageId the messageId to set | [
"Sets",
"the",
"message",
"id",
"from",
"uri",
"string",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-ws/src/main/java/com/consol/citrus/ws/addressing/WsAddressingHeaders.java#L146-L152 | train |
citrusframework/citrus | modules/citrus-ws/src/main/java/com/consol/citrus/ws/addressing/WsAddressingHeaders.java | WsAddressingHeaders.setFrom | public void setFrom(String from) {
try {
this.from = new EndpointReference(new URI(from));
} catch (URISyntaxException e) {
throw new CitrusRuntimeException("Invalid from uri", e);
}
} | java | public void setFrom(String from) {
try {
this.from = new EndpointReference(new URI(from));
} catch (URISyntaxException e) {
throw new CitrusRuntimeException("Invalid from uri", e);
}
} | [
"public",
"void",
"setFrom",
"(",
"String",
"from",
")",
"{",
"try",
"{",
"this",
".",
"from",
"=",
"new",
"EndpointReference",
"(",
"new",
"URI",
"(",
"from",
")",
")",
";",
"}",
"catch",
"(",
"URISyntaxException",
"e",
")",
"{",
"throw",
"new",
"Ci... | Sets the from endpoint reference by string.
@param from the from to set | [
"Sets",
"the",
"from",
"endpoint",
"reference",
"by",
"string",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-ws/src/main/java/com/consol/citrus/ws/addressing/WsAddressingHeaders.java#L174-L180 | train |
citrusframework/citrus | modules/citrus-ws/src/main/java/com/consol/citrus/ws/addressing/WsAddressingHeaders.java | WsAddressingHeaders.setReplyTo | public void setReplyTo(String replyTo) {
try {
this.replyTo = new EndpointReference(new URI(replyTo));
} catch (URISyntaxException e) {
throw new CitrusRuntimeException("Invalid replyTo uri", e);
}
} | java | public void setReplyTo(String replyTo) {
try {
this.replyTo = new EndpointReference(new URI(replyTo));
} catch (URISyntaxException e) {
throw new CitrusRuntimeException("Invalid replyTo uri", e);
}
} | [
"public",
"void",
"setReplyTo",
"(",
"String",
"replyTo",
")",
"{",
"try",
"{",
"this",
".",
"replyTo",
"=",
"new",
"EndpointReference",
"(",
"new",
"URI",
"(",
"replyTo",
")",
")",
";",
"}",
"catch",
"(",
"URISyntaxException",
"e",
")",
"{",
"throw",
... | Sets the reply to endpoint reference by string.
@param replyTo the replyTo to set | [
"Sets",
"the",
"reply",
"to",
"endpoint",
"reference",
"by",
"string",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-ws/src/main/java/com/consol/citrus/ws/addressing/WsAddressingHeaders.java#L202-L208 | train |
citrusframework/citrus | modules/citrus-ws/src/main/java/com/consol/citrus/ws/addressing/WsAddressingHeaders.java | WsAddressingHeaders.setFaultTo | public void setFaultTo(String faultTo) {
try {
this.faultTo = new EndpointReference(new URI(faultTo));
} catch (URISyntaxException e) {
throw new CitrusRuntimeException("Invalid faultTo uri", e);
}
} | java | public void setFaultTo(String faultTo) {
try {
this.faultTo = new EndpointReference(new URI(faultTo));
} catch (URISyntaxException e) {
throw new CitrusRuntimeException("Invalid faultTo uri", e);
}
} | [
"public",
"void",
"setFaultTo",
"(",
"String",
"faultTo",
")",
"{",
"try",
"{",
"this",
".",
"faultTo",
"=",
"new",
"EndpointReference",
"(",
"new",
"URI",
"(",
"faultTo",
")",
")",
";",
"}",
"catch",
"(",
"URISyntaxException",
"e",
")",
"{",
"throw",
... | Sets the fault to endpoint reference by string.
@param faultTo the faultTo to set | [
"Sets",
"the",
"fault",
"to",
"endpoint",
"reference",
"by",
"string",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-ws/src/main/java/com/consol/citrus/ws/addressing/WsAddressingHeaders.java#L230-L236 | train |
citrusframework/citrus | tools/maven/citrus-maven-plugin/src/main/java/com/consol/citrus/mvn/plugin/CreateDocsMojo.java | CreateDocsMojo.createHtmlDoc | private void createHtmlDoc() throws PrompterException {
HtmlDocConfiguration configuration = new HtmlDocConfiguration();
String heading = prompter.prompt("Enter overview title:", configuration.getHeading());
String columns = prompter.prompt("Enter number of columns in overview:", configuration.getColumns());
String pageTitle = prompter.prompt("Enter page title:", configuration.getPageTitle());
String outputFile = prompter.prompt("Enter output file name:", configuration.getOutputFile());
String logo = prompter.prompt("Enter file path to logo:", configuration.getLogo());
String confirm = prompter.prompt("Confirm HTML documentation: outputFile='target/" + outputFile + (outputFile.endsWith(".html") ? "" : ".html") + "'\n",
Arrays.asList("y", "n"), "y");
if (confirm.equalsIgnoreCase("n")) {
return;
}
HtmlTestDocsGenerator generator = getHtmlTestDocsGenerator();
generator.withOutputFile(outputFile + (outputFile.endsWith(".html") ? "" : ".html"))
.withPageTitle(pageTitle)
.withOverviewTitle(heading)
.withColumns(columns)
.useSrcDirectory(getTestSrcDirectory())
.withLogo(logo);
generator.generateDoc();
getLog().info("Successfully created HTML documentation: outputFile='target/" + outputFile + (outputFile.endsWith(".html") ? "" : ".html") + "'");
} | java | private void createHtmlDoc() throws PrompterException {
HtmlDocConfiguration configuration = new HtmlDocConfiguration();
String heading = prompter.prompt("Enter overview title:", configuration.getHeading());
String columns = prompter.prompt("Enter number of columns in overview:", configuration.getColumns());
String pageTitle = prompter.prompt("Enter page title:", configuration.getPageTitle());
String outputFile = prompter.prompt("Enter output file name:", configuration.getOutputFile());
String logo = prompter.prompt("Enter file path to logo:", configuration.getLogo());
String confirm = prompter.prompt("Confirm HTML documentation: outputFile='target/" + outputFile + (outputFile.endsWith(".html") ? "" : ".html") + "'\n",
Arrays.asList("y", "n"), "y");
if (confirm.equalsIgnoreCase("n")) {
return;
}
HtmlTestDocsGenerator generator = getHtmlTestDocsGenerator();
generator.withOutputFile(outputFile + (outputFile.endsWith(".html") ? "" : ".html"))
.withPageTitle(pageTitle)
.withOverviewTitle(heading)
.withColumns(columns)
.useSrcDirectory(getTestSrcDirectory())
.withLogo(logo);
generator.generateDoc();
getLog().info("Successfully created HTML documentation: outputFile='target/" + outputFile + (outputFile.endsWith(".html") ? "" : ".html") + "'");
} | [
"private",
"void",
"createHtmlDoc",
"(",
")",
"throws",
"PrompterException",
"{",
"HtmlDocConfiguration",
"configuration",
"=",
"new",
"HtmlDocConfiguration",
"(",
")",
";",
"String",
"heading",
"=",
"prompter",
".",
"prompt",
"(",
"\"Enter overview title:\"",
",",
... | Create HTML documentation in interactive mode.
@throws PrompterException | [
"Create",
"HTML",
"documentation",
"in",
"interactive",
"mode",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/tools/maven/citrus-maven-plugin/src/main/java/com/consol/citrus/mvn/plugin/CreateDocsMojo.java#L90-L118 | train |
citrusframework/citrus | tools/maven/citrus-maven-plugin/src/main/java/com/consol/citrus/mvn/plugin/CreateDocsMojo.java | CreateDocsMojo.createExcelDoc | private void createExcelDoc() throws PrompterException {
ExcelDocConfiguration configuration = new ExcelDocConfiguration();
String company = prompter.prompt("Enter company:", configuration.getCompany());
String author = prompter.prompt("Enter author:", configuration.getAuthor());
String pageTitle = prompter.prompt("Enter page title:", configuration.getPageTitle());
String outputFile = prompter.prompt("Enter output file name:", configuration.getOutputFile());
String headers = prompter.prompt("Enter custom headers:", configuration.getHeaders());
String confirm = prompter.prompt("Confirm Excel documentation: outputFile='target/" + outputFile + (outputFile.endsWith(".xls") ? "" : ".xls") + "'\n",
Arrays.asList("y", "n"), "y");
if (confirm.equalsIgnoreCase("n")) {
return;
}
ExcelTestDocsGenerator generator = getExcelTestDocsGenerator();
generator.withOutputFile(outputFile + (outputFile.endsWith(".xls") ? "" : ".xls"))
.withPageTitle(pageTitle)
.withAuthor(author)
.withCompany(company)
.useSrcDirectory(getTestSrcDirectory())
.withCustomHeaders(headers);
generator.generateDoc();
getLog().info("Successfully created Excel documentation: outputFile='target/" + outputFile + (outputFile.endsWith(".xls") ? "" : ".xls") + "'");
} | java | private void createExcelDoc() throws PrompterException {
ExcelDocConfiguration configuration = new ExcelDocConfiguration();
String company = prompter.prompt("Enter company:", configuration.getCompany());
String author = prompter.prompt("Enter author:", configuration.getAuthor());
String pageTitle = prompter.prompt("Enter page title:", configuration.getPageTitle());
String outputFile = prompter.prompt("Enter output file name:", configuration.getOutputFile());
String headers = prompter.prompt("Enter custom headers:", configuration.getHeaders());
String confirm = prompter.prompt("Confirm Excel documentation: outputFile='target/" + outputFile + (outputFile.endsWith(".xls") ? "" : ".xls") + "'\n",
Arrays.asList("y", "n"), "y");
if (confirm.equalsIgnoreCase("n")) {
return;
}
ExcelTestDocsGenerator generator = getExcelTestDocsGenerator();
generator.withOutputFile(outputFile + (outputFile.endsWith(".xls") ? "" : ".xls"))
.withPageTitle(pageTitle)
.withAuthor(author)
.withCompany(company)
.useSrcDirectory(getTestSrcDirectory())
.withCustomHeaders(headers);
generator.generateDoc();
getLog().info("Successfully created Excel documentation: outputFile='target/" + outputFile + (outputFile.endsWith(".xls") ? "" : ".xls") + "'");
} | [
"private",
"void",
"createExcelDoc",
"(",
")",
"throws",
"PrompterException",
"{",
"ExcelDocConfiguration",
"configuration",
"=",
"new",
"ExcelDocConfiguration",
"(",
")",
";",
"String",
"company",
"=",
"prompter",
".",
"prompt",
"(",
"\"Enter company:\"",
",",
"con... | Create Excel documentation in interactive mode.
@throws PrompterException | [
"Create",
"Excel",
"documentation",
"in",
"interactive",
"mode",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/tools/maven/citrus-maven-plugin/src/main/java/com/consol/citrus/mvn/plugin/CreateDocsMojo.java#L124-L151 | train |
citrusframework/citrus | modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/functions/Functions.java | Functions.changeDate | public static String changeDate(String date, String dateOffset, String dateFormat, TestContext context) {
return new ChangeDateFunction().execute(Arrays.asList(date, dateOffset, dateFormat), context);
} | java | public static String changeDate(String date, String dateOffset, String dateFormat, TestContext context) {
return new ChangeDateFunction().execute(Arrays.asList(date, dateOffset, dateFormat), context);
} | [
"public",
"static",
"String",
"changeDate",
"(",
"String",
"date",
",",
"String",
"dateOffset",
",",
"String",
"dateFormat",
",",
"TestContext",
"context",
")",
"{",
"return",
"new",
"ChangeDateFunction",
"(",
")",
".",
"execute",
"(",
"Arrays",
".",
"asList",... | Runs change date function with arguments.
@param date
@param dateOffset
@param dateFormat
@return | [
"Runs",
"change",
"date",
"function",
"with",
"arguments",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/functions/Functions.java#L61-L63 | train |
citrusframework/citrus | modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/functions/Functions.java | Functions.createCDataSection | public static String createCDataSection(String content, TestContext context) {
return new CreateCDataSectionFunction().execute(Collections.singletonList(content), context);
} | java | public static String createCDataSection(String content, TestContext context) {
return new CreateCDataSectionFunction().execute(Collections.singletonList(content), context);
} | [
"public",
"static",
"String",
"createCDataSection",
"(",
"String",
"content",
",",
"TestContext",
"context",
")",
"{",
"return",
"new",
"CreateCDataSectionFunction",
"(",
")",
".",
"execute",
"(",
"Collections",
".",
"singletonList",
"(",
"content",
")",
",",
"c... | Runs create CData section function with arguments.
@return | [
"Runs",
"create",
"CData",
"section",
"function",
"with",
"arguments",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/functions/Functions.java#L79-L81 | train |
citrusframework/citrus | modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/functions/Functions.java | Functions.digestAuthHeader | public static String digestAuthHeader(String username, String password, String realm, String noncekey, String method, String uri, String opaque, String algorithm, TestContext context) {
return new DigestAuthHeaderFunction().execute(Arrays.asList(username, password, realm, noncekey, method, uri, opaque, algorithm), context);
} | java | public static String digestAuthHeader(String username, String password, String realm, String noncekey, String method, String uri, String opaque, String algorithm, TestContext context) {
return new DigestAuthHeaderFunction().execute(Arrays.asList(username, password, realm, noncekey, method, uri, opaque, algorithm), context);
} | [
"public",
"static",
"String",
"digestAuthHeader",
"(",
"String",
"username",
",",
"String",
"password",
",",
"String",
"realm",
",",
"String",
"noncekey",
",",
"String",
"method",
",",
"String",
"uri",
",",
"String",
"opaque",
",",
"String",
"algorithm",
",",
... | Runs create digest auth header function with arguments.
@return | [
"Runs",
"create",
"digest",
"auth",
"header",
"function",
"with",
"arguments",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/functions/Functions.java#L151-L153 | train |
citrusframework/citrus | modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/functions/Functions.java | Functions.randomUUID | public static String randomUUID(TestContext context) {
return new RandomUUIDFunction().execute(Collections.<String>emptyList(), context);
} | java | public static String randomUUID(TestContext context) {
return new RandomUUIDFunction().execute(Collections.<String>emptyList(), context);
} | [
"public",
"static",
"String",
"randomUUID",
"(",
"TestContext",
"context",
")",
"{",
"return",
"new",
"RandomUUIDFunction",
"(",
")",
".",
"execute",
"(",
"Collections",
".",
"<",
"String",
">",
"emptyList",
"(",
")",
",",
"context",
")",
";",
"}"
] | Runs random UUID function with arguments.
@return | [
"Runs",
"random",
"UUID",
"function",
"with",
"arguments",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/functions/Functions.java#L159-L161 | train |
citrusframework/citrus | modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/functions/Functions.java | Functions.escapeXml | public static String escapeXml(String content, TestContext context) {
return new EscapeXmlFunction().execute(Collections.singletonList(content), context);
} | java | public static String escapeXml(String content, TestContext context) {
return new EscapeXmlFunction().execute(Collections.singletonList(content), context);
} | [
"public",
"static",
"String",
"escapeXml",
"(",
"String",
"content",
",",
"TestContext",
"context",
")",
"{",
"return",
"new",
"EscapeXmlFunction",
"(",
")",
".",
"execute",
"(",
"Collections",
".",
"singletonList",
"(",
"content",
")",
",",
"context",
")",
... | Runs escape XML function with arguments.
@return | [
"Runs",
"escape",
"XML",
"function",
"with",
"arguments",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/functions/Functions.java#L226-L228 | train |
citrusframework/citrus | modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/functions/Functions.java | Functions.readFile | public static String readFile(String filePath, TestContext context) {
return new ReadFileResourceFunction().execute(Collections.singletonList(filePath), context);
} | java | public static String readFile(String filePath, TestContext context) {
return new ReadFileResourceFunction().execute(Collections.singletonList(filePath), context);
} | [
"public",
"static",
"String",
"readFile",
"(",
"String",
"filePath",
",",
"TestContext",
"context",
")",
"{",
"return",
"new",
"ReadFileResourceFunction",
"(",
")",
".",
"execute",
"(",
"Collections",
".",
"singletonList",
"(",
"filePath",
")",
",",
"context",
... | Reads the file resource and returns the complete file content.
@param filePath
@return | [
"Reads",
"the",
"file",
"resource",
"and",
"returns",
"the",
"complete",
"file",
"content",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/functions/Functions.java#L235-L237 | train |
citrusframework/citrus | modules/citrus-core/src/main/java/com/consol/citrus/config/util/ValidateMessageParserUtil.java | ValidateMessageParserUtil.parseJsonPathElements | public static void parseJsonPathElements(Element validateElement, Map<String, Object> validateJsonPathExpressions) {
List<?> jsonPathElements = DomUtils.getChildElementsByTagName(validateElement, "json-path");
if (jsonPathElements.size() > 0) {
for (Iterator<?> jsonPathIterator = jsonPathElements.iterator(); jsonPathIterator.hasNext();) {
Element jsonPathElement = (Element) jsonPathIterator.next();
String expression = jsonPathElement.getAttribute("expression");
if (StringUtils.hasText(expression)) {
validateJsonPathExpressions.put(expression, jsonPathElement.getAttribute("value"));
}
}
}
} | java | public static void parseJsonPathElements(Element validateElement, Map<String, Object> validateJsonPathExpressions) {
List<?> jsonPathElements = DomUtils.getChildElementsByTagName(validateElement, "json-path");
if (jsonPathElements.size() > 0) {
for (Iterator<?> jsonPathIterator = jsonPathElements.iterator(); jsonPathIterator.hasNext();) {
Element jsonPathElement = (Element) jsonPathIterator.next();
String expression = jsonPathElement.getAttribute("expression");
if (StringUtils.hasText(expression)) {
validateJsonPathExpressions.put(expression, jsonPathElement.getAttribute("value"));
}
}
}
} | [
"public",
"static",
"void",
"parseJsonPathElements",
"(",
"Element",
"validateElement",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"validateJsonPathExpressions",
")",
"{",
"List",
"<",
"?",
">",
"jsonPathElements",
"=",
"DomUtils",
".",
"getChildElementsByTagNam... | Parses 'validate' element containing nested 'json-path' elements.
@param validateElement the validate element to parse
@param validateJsonPathExpressions adds the parsed json-path elements to this map | [
"Parses",
"validate",
"element",
"containing",
"nested",
"json",
"-",
"path",
"elements",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/config/util/ValidateMessageParserUtil.java#L40-L51 | train |
citrusframework/citrus | modules/citrus-core/src/main/java/com/consol/citrus/util/FileUtils.java | FileUtils.readToString | public static String readToString(Resource resource, Charset charset) throws IOException {
if (simulationMode) {
if (resource instanceof ClassPathResource) {
return ((ClassPathResource) resource).getPath();
} else if (resource instanceof FileSystemResource) {
return ((FileSystemResource) resource).getPath();
} else {
return resource.getFilename();
}
}
if (log.isDebugEnabled()) {
log.debug(String.format("Reading file resource: '%s' (encoding is '%s')", resource.getFilename(), charset.displayName()));
}
return readToString(resource.getInputStream(), charset);
} | java | public static String readToString(Resource resource, Charset charset) throws IOException {
if (simulationMode) {
if (resource instanceof ClassPathResource) {
return ((ClassPathResource) resource).getPath();
} else if (resource instanceof FileSystemResource) {
return ((FileSystemResource) resource).getPath();
} else {
return resource.getFilename();
}
}
if (log.isDebugEnabled()) {
log.debug(String.format("Reading file resource: '%s' (encoding is '%s')", resource.getFilename(), charset.displayName()));
}
return readToString(resource.getInputStream(), charset);
} | [
"public",
"static",
"String",
"readToString",
"(",
"Resource",
"resource",
",",
"Charset",
"charset",
")",
"throws",
"IOException",
"{",
"if",
"(",
"simulationMode",
")",
"{",
"if",
"(",
"resource",
"instanceof",
"ClassPathResource",
")",
"{",
"return",
"(",
"... | Read file resource to string value.
@param resource
@param charset
@return
@throws IOException | [
"Read",
"file",
"resource",
"to",
"string",
"value",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/util/FileUtils.java#L101-L116 | train |
citrusframework/citrus | modules/citrus-core/src/main/java/com/consol/citrus/util/FileUtils.java | FileUtils.readToString | public static String readToString(InputStream inputStream, Charset charset) throws IOException {
return new String(FileCopyUtils.copyToByteArray(inputStream), charset);
} | java | public static String readToString(InputStream inputStream, Charset charset) throws IOException {
return new String(FileCopyUtils.copyToByteArray(inputStream), charset);
} | [
"public",
"static",
"String",
"readToString",
"(",
"InputStream",
"inputStream",
",",
"Charset",
"charset",
")",
"throws",
"IOException",
"{",
"return",
"new",
"String",
"(",
"FileCopyUtils",
".",
"copyToByteArray",
"(",
"inputStream",
")",
",",
"charset",
")",
... | Read file input stream to string value.
@param inputStream
@param charset
@return
@throws IOException | [
"Read",
"file",
"input",
"stream",
"to",
"string",
"value",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/util/FileUtils.java#L125-L127 | train |
citrusframework/citrus | modules/citrus-core/src/main/java/com/consol/citrus/util/FileUtils.java | FileUtils.writeToFile | public static void writeToFile(InputStream inputStream, File file) {
try (InputStreamReader inputStreamReader = new InputStreamReader(inputStream)) {
writeToFile(FileCopyUtils.copyToString(inputStreamReader), file, getDefaultCharset());
} catch (IOException e) {
throw new CitrusRuntimeException("Failed to write file", e);
}
} | java | public static void writeToFile(InputStream inputStream, File file) {
try (InputStreamReader inputStreamReader = new InputStreamReader(inputStream)) {
writeToFile(FileCopyUtils.copyToString(inputStreamReader), file, getDefaultCharset());
} catch (IOException e) {
throw new CitrusRuntimeException("Failed to write file", e);
}
} | [
"public",
"static",
"void",
"writeToFile",
"(",
"InputStream",
"inputStream",
",",
"File",
"file",
")",
"{",
"try",
"(",
"InputStreamReader",
"inputStreamReader",
"=",
"new",
"InputStreamReader",
"(",
"inputStream",
")",
")",
"{",
"writeToFile",
"(",
"FileCopyUtil... | Writes inputStream content to file. Uses default charset encoding.
@param inputStream
@param file | [
"Writes",
"inputStream",
"content",
"to",
"file",
".",
"Uses",
"default",
"charset",
"encoding",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/util/FileUtils.java#L134-L140 | train |
citrusframework/citrus | modules/citrus-core/src/main/java/com/consol/citrus/util/FileUtils.java | FileUtils.writeToFile | public static void writeToFile(String content, File file, Charset charset) {
if (log.isDebugEnabled()) {
log.debug(String.format("Writing file resource: '%s' (encoding is '%s')", file.getName(), charset.displayName()));
}
if (!file.getParentFile().exists()) {
if (!file.getParentFile().mkdirs()) {
throw new CitrusRuntimeException("Unable to create folder structure for file: " + file.getPath());
}
}
try (OutputStream fos = new BufferedOutputStream(new FileOutputStream(file))) {
fos.write(content.getBytes(charset));
fos.flush();
} catch (IOException e) {
throw new CitrusRuntimeException("Failed to write file", e);
}
} | java | public static void writeToFile(String content, File file, Charset charset) {
if (log.isDebugEnabled()) {
log.debug(String.format("Writing file resource: '%s' (encoding is '%s')", file.getName(), charset.displayName()));
}
if (!file.getParentFile().exists()) {
if (!file.getParentFile().mkdirs()) {
throw new CitrusRuntimeException("Unable to create folder structure for file: " + file.getPath());
}
}
try (OutputStream fos = new BufferedOutputStream(new FileOutputStream(file))) {
fos.write(content.getBytes(charset));
fos.flush();
} catch (IOException e) {
throw new CitrusRuntimeException("Failed to write file", e);
}
} | [
"public",
"static",
"void",
"writeToFile",
"(",
"String",
"content",
",",
"File",
"file",
",",
"Charset",
"charset",
")",
"{",
"if",
"(",
"log",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"log",
".",
"debug",
"(",
"String",
".",
"format",
"(",
"\"Writi... | Writes String content to file with given charset encoding. Automatically closes file output streams when done.
@param content
@param file | [
"Writes",
"String",
"content",
"to",
"file",
"with",
"given",
"charset",
"encoding",
".",
"Automatically",
"closes",
"file",
"output",
"streams",
"when",
"done",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/util/FileUtils.java#L156-L173 | train |
citrusframework/citrus | modules/citrus-core/src/main/java/com/consol/citrus/util/FileUtils.java | FileUtils.findFiles | public static List<File> findFiles(final String startDir, final Set<String> fileNamePatterns) {
/* file names to be returned */
final List<File> files = new ArrayList<File>();
/* Stack to hold potential sub directories */
final Stack<File> dirs = new Stack<File>();
/* start directory */
final File startdir = new File(startDir);
if (!startdir.exists()) {
throw new CitrusRuntimeException("Test directory " + startdir.getAbsolutePath() + " does not exist");
}
if (startdir.isDirectory()) {
dirs.push(startdir);
}
/* walk through the directories */
while (dirs.size() > 0) {
final File file = dirs.pop();
File[] foundFiles = file.listFiles((dir, name) -> {
File tmp = new File(dir.getPath() + File.separator + name);
boolean accepted = tmp.isDirectory();
for (String fileNamePattern : fileNamePatterns) {
if (fileNamePattern.contains("/")) {
fileNamePattern = fileNamePattern.substring(fileNamePattern.lastIndexOf('/') + 1);
}
fileNamePattern = fileNamePattern.replace(".", "\\.").replace("*", ".*");
if (name.matches(fileNamePattern)) {
accepted = true;
}
}
/* Only allowing XML files as spring configuration files */
return accepted && !name.startsWith("CVS") && !name.startsWith(".svn") && !name.startsWith(".git");
});
for (File found : Optional.ofNullable(foundFiles).orElse(new File[] {})) {
/* Subfolder support */
if (found.isDirectory()) {
dirs.push(found);
} else {
files.add(found);
}
}
}
return files;
} | java | public static List<File> findFiles(final String startDir, final Set<String> fileNamePatterns) {
/* file names to be returned */
final List<File> files = new ArrayList<File>();
/* Stack to hold potential sub directories */
final Stack<File> dirs = new Stack<File>();
/* start directory */
final File startdir = new File(startDir);
if (!startdir.exists()) {
throw new CitrusRuntimeException("Test directory " + startdir.getAbsolutePath() + " does not exist");
}
if (startdir.isDirectory()) {
dirs.push(startdir);
}
/* walk through the directories */
while (dirs.size() > 0) {
final File file = dirs.pop();
File[] foundFiles = file.listFiles((dir, name) -> {
File tmp = new File(dir.getPath() + File.separator + name);
boolean accepted = tmp.isDirectory();
for (String fileNamePattern : fileNamePatterns) {
if (fileNamePattern.contains("/")) {
fileNamePattern = fileNamePattern.substring(fileNamePattern.lastIndexOf('/') + 1);
}
fileNamePattern = fileNamePattern.replace(".", "\\.").replace("*", ".*");
if (name.matches(fileNamePattern)) {
accepted = true;
}
}
/* Only allowing XML files as spring configuration files */
return accepted && !name.startsWith("CVS") && !name.startsWith(".svn") && !name.startsWith(".git");
});
for (File found : Optional.ofNullable(foundFiles).orElse(new File[] {})) {
/* Subfolder support */
if (found.isDirectory()) {
dirs.push(found);
} else {
files.add(found);
}
}
}
return files;
} | [
"public",
"static",
"List",
"<",
"File",
">",
"findFiles",
"(",
"final",
"String",
"startDir",
",",
"final",
"Set",
"<",
"String",
">",
"fileNamePatterns",
")",
"{",
"/* file names to be returned */",
"final",
"List",
"<",
"File",
">",
"files",
"=",
"new",
"... | Method to retrieve all files with given file name pattern in given directory.
Hierarchy of folders is supported.
@param startDir the directory to hold the files
@param fileNamePatterns the file names to include
@return list of test files as filename paths | [
"Method",
"to",
"retrieve",
"all",
"files",
"with",
"given",
"file",
"name",
"pattern",
"in",
"given",
"directory",
".",
"Hierarchy",
"of",
"folders",
"is",
"supported",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/util/FileUtils.java#L183-L235 | train |
citrusframework/citrus | modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/endpoint/CitrusEndpoints.java | CitrusEndpoints.docker | @SuppressWarnings("unchecked")
public static ClientServerEndpointBuilder<DockerClientBuilder, DockerClientBuilder> docker() {
return new ClientServerEndpointBuilder(new DockerClientBuilder(), new DockerClientBuilder()) {
@Override
public EndpointBuilder<? extends Endpoint> server() {
throw new UnsupportedOperationException("Citrus Docker stack has no support for server implementation");
}
};
} | java | @SuppressWarnings("unchecked")
public static ClientServerEndpointBuilder<DockerClientBuilder, DockerClientBuilder> docker() {
return new ClientServerEndpointBuilder(new DockerClientBuilder(), new DockerClientBuilder()) {
@Override
public EndpointBuilder<? extends Endpoint> server() {
throw new UnsupportedOperationException("Citrus Docker stack has no support for server implementation");
}
};
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"ClientServerEndpointBuilder",
"<",
"DockerClientBuilder",
",",
"DockerClientBuilder",
">",
"docker",
"(",
")",
"{",
"return",
"new",
"ClientServerEndpointBuilder",
"(",
"new",
"DockerClientBuilder",
... | Creates new DockerClient builder.
@return | [
"Creates",
"new",
"DockerClient",
"builder",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/endpoint/CitrusEndpoints.java#L171-L179 | train |
citrusframework/citrus | modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/endpoint/CitrusEndpoints.java | CitrusEndpoints.kubernetes | @SuppressWarnings("unchecked")
public static ClientServerEndpointBuilder<KubernetesClientBuilder, KubernetesClientBuilder> kubernetes() {
return new ClientServerEndpointBuilder(new KubernetesClientBuilder(), new KubernetesClientBuilder()) {
@Override
public EndpointBuilder<? extends Endpoint> server() {
throw new UnsupportedOperationException("Citrus Kubernetes stack has no support for server implementation");
}
};
} | java | @SuppressWarnings("unchecked")
public static ClientServerEndpointBuilder<KubernetesClientBuilder, KubernetesClientBuilder> kubernetes() {
return new ClientServerEndpointBuilder(new KubernetesClientBuilder(), new KubernetesClientBuilder()) {
@Override
public EndpointBuilder<? extends Endpoint> server() {
throw new UnsupportedOperationException("Citrus Kubernetes stack has no support for server implementation");
}
};
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"ClientServerEndpointBuilder",
"<",
"KubernetesClientBuilder",
",",
"KubernetesClientBuilder",
">",
"kubernetes",
"(",
")",
"{",
"return",
"new",
"ClientServerEndpointBuilder",
"(",
"new",
"Kubernetes... | Creates new KubernetesClient builder.
@return | [
"Creates",
"new",
"KubernetesClient",
"builder",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/endpoint/CitrusEndpoints.java#L185-L193 | train |
citrusframework/citrus | modules/citrus-ws/src/main/java/com/consol/citrus/ws/validation/XmlSoapFaultValidator.java | XmlSoapFaultValidator.validateFaultDetailString | @Override
protected void validateFaultDetailString(String receivedDetailString, String controlDetailString,
TestContext context, ValidationContext validationContext) throws ValidationException {
XmlMessageValidationContext xmlMessageValidationContext;
if (validationContext instanceof XmlMessageValidationContext) {
xmlMessageValidationContext = (XmlMessageValidationContext) validationContext;
} else {
xmlMessageValidationContext = new XmlMessageValidationContext();
}
messageValidator.validateMessage(new DefaultMessage(receivedDetailString), new DefaultMessage(controlDetailString), context, xmlMessageValidationContext);
} | java | @Override
protected void validateFaultDetailString(String receivedDetailString, String controlDetailString,
TestContext context, ValidationContext validationContext) throws ValidationException {
XmlMessageValidationContext xmlMessageValidationContext;
if (validationContext instanceof XmlMessageValidationContext) {
xmlMessageValidationContext = (XmlMessageValidationContext) validationContext;
} else {
xmlMessageValidationContext = new XmlMessageValidationContext();
}
messageValidator.validateMessage(new DefaultMessage(receivedDetailString), new DefaultMessage(controlDetailString), context, xmlMessageValidationContext);
} | [
"@",
"Override",
"protected",
"void",
"validateFaultDetailString",
"(",
"String",
"receivedDetailString",
",",
"String",
"controlDetailString",
",",
"TestContext",
"context",
",",
"ValidationContext",
"validationContext",
")",
"throws",
"ValidationException",
"{",
"XmlMessa... | Delegates to XML message validator for validation of fault detail. | [
"Delegates",
"to",
"XML",
"message",
"validator",
"for",
"validation",
"of",
"fault",
"detail",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-ws/src/main/java/com/consol/citrus/ws/validation/XmlSoapFaultValidator.java#L58-L70 | train |
citrusframework/citrus | modules/citrus-selenium/src/main/java/com/consol/citrus/selenium/endpoint/SeleniumBrowser.java | SeleniumBrowser.start | public void start() {
if (!isStarted()) {
if (getEndpointConfiguration().getWebDriver() != null) {
webDriver = getEndpointConfiguration().getWebDriver();
} else if (StringUtils.hasText(getEndpointConfiguration().getRemoteServerUrl())) {
webDriver = createRemoteWebDriver(getEndpointConfiguration().getBrowserType(), getEndpointConfiguration().getRemoteServerUrl());
} else {
webDriver = createLocalWebDriver(getEndpointConfiguration().getBrowserType());
}
if (!CollectionUtils.isEmpty(getEndpointConfiguration().getEventListeners())) {
EventFiringWebDriver wrapper = new EventFiringWebDriver(webDriver);
log.info("Add event listeners to web driver: " + getEndpointConfiguration().getEventListeners().size());
for (WebDriverEventListener listener : getEndpointConfiguration().getEventListeners()) {
wrapper.register(listener);
}
}
} else {
log.warn("Browser already started");
}
} | java | public void start() {
if (!isStarted()) {
if (getEndpointConfiguration().getWebDriver() != null) {
webDriver = getEndpointConfiguration().getWebDriver();
} else if (StringUtils.hasText(getEndpointConfiguration().getRemoteServerUrl())) {
webDriver = createRemoteWebDriver(getEndpointConfiguration().getBrowserType(), getEndpointConfiguration().getRemoteServerUrl());
} else {
webDriver = createLocalWebDriver(getEndpointConfiguration().getBrowserType());
}
if (!CollectionUtils.isEmpty(getEndpointConfiguration().getEventListeners())) {
EventFiringWebDriver wrapper = new EventFiringWebDriver(webDriver);
log.info("Add event listeners to web driver: " + getEndpointConfiguration().getEventListeners().size());
for (WebDriverEventListener listener : getEndpointConfiguration().getEventListeners()) {
wrapper.register(listener);
}
}
} else {
log.warn("Browser already started");
}
} | [
"public",
"void",
"start",
"(",
")",
"{",
"if",
"(",
"!",
"isStarted",
"(",
")",
")",
"{",
"if",
"(",
"getEndpointConfiguration",
"(",
")",
".",
"getWebDriver",
"(",
")",
"!=",
"null",
")",
"{",
"webDriver",
"=",
"getEndpointConfiguration",
"(",
")",
"... | Starts the browser and create local or remote web driver. | [
"Starts",
"the",
"browser",
"and",
"create",
"local",
"or",
"remote",
"web",
"driver",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-selenium/src/main/java/com/consol/citrus/selenium/endpoint/SeleniumBrowser.java#L98-L118 | train |
citrusframework/citrus | modules/citrus-selenium/src/main/java/com/consol/citrus/selenium/endpoint/SeleniumBrowser.java | SeleniumBrowser.stop | public void stop() {
if (isStarted()) {
log.info("Stopping browser " + webDriver.getCurrentUrl());
try {
log.info("Trying to close the browser " + webDriver + " ...");
webDriver.quit();
} catch (UnreachableBrowserException e) {
// It happens for Firefox. It's ok: browser is already closed.
log.warn("Browser is unreachable", e);
} catch (WebDriverException e) {
log.error("Failed to close browser", e);
}
webDriver = null;
} else {
log.warn("Browser already stopped");
}
} | java | public void stop() {
if (isStarted()) {
log.info("Stopping browser " + webDriver.getCurrentUrl());
try {
log.info("Trying to close the browser " + webDriver + " ...");
webDriver.quit();
} catch (UnreachableBrowserException e) {
// It happens for Firefox. It's ok: browser is already closed.
log.warn("Browser is unreachable", e);
} catch (WebDriverException e) {
log.error("Failed to close browser", e);
}
webDriver = null;
} else {
log.warn("Browser already stopped");
}
} | [
"public",
"void",
"stop",
"(",
")",
"{",
"if",
"(",
"isStarted",
"(",
")",
")",
"{",
"log",
".",
"info",
"(",
"\"Stopping browser \"",
"+",
"webDriver",
".",
"getCurrentUrl",
"(",
")",
")",
";",
"try",
"{",
"log",
".",
"info",
"(",
"\"Trying to close t... | Stop the browser when started. | [
"Stop",
"the",
"browser",
"when",
"started",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-selenium/src/main/java/com/consol/citrus/selenium/endpoint/SeleniumBrowser.java#L123-L141 | train |
citrusframework/citrus | modules/citrus-selenium/src/main/java/com/consol/citrus/selenium/endpoint/SeleniumBrowser.java | SeleniumBrowser.storeFile | public String storeFile(Resource file) {
try {
File newFile = new File(temporaryStorage.toFile(), file.getFilename());
log.info("Store file " + file + " to " + newFile);
FileUtils.copyFile(file.getFile(), newFile);
return newFile.getCanonicalPath();
} catch (IOException e) {
throw new CitrusRuntimeException("Failed to store file: " + file, e);
}
} | java | public String storeFile(Resource file) {
try {
File newFile = new File(temporaryStorage.toFile(), file.getFilename());
log.info("Store file " + file + " to " + newFile);
FileUtils.copyFile(file.getFile(), newFile);
return newFile.getCanonicalPath();
} catch (IOException e) {
throw new CitrusRuntimeException("Failed to store file: " + file, e);
}
} | [
"public",
"String",
"storeFile",
"(",
"Resource",
"file",
")",
"{",
"try",
"{",
"File",
"newFile",
"=",
"new",
"File",
"(",
"temporaryStorage",
".",
"toFile",
"(",
")",
",",
"file",
".",
"getFilename",
"(",
")",
")",
";",
"log",
".",
"info",
"(",
"\"... | Deploy resource object from resource folder and return path of deployed
file
@param file Resource to deploy to temporary storage
@return String containing the filename to which the file is uploaded to. | [
"Deploy",
"resource",
"object",
"from",
"resource",
"folder",
"and",
"return",
"path",
"of",
"deployed",
"file"
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-selenium/src/main/java/com/consol/citrus/selenium/endpoint/SeleniumBrowser.java#L161-L173 | train |
citrusframework/citrus | modules/citrus-selenium/src/main/java/com/consol/citrus/selenium/endpoint/SeleniumBrowser.java | SeleniumBrowser.getStoredFile | public String getStoredFile(String filename) {
try {
File stored = new File(temporaryStorage.toFile(), filename);
if (!stored.exists()) {
throw new CitrusRuntimeException("Failed to access stored file: " + stored.getCanonicalPath());
}
return stored.getCanonicalPath();
} catch (IOException e) {
throw new CitrusRuntimeException("Failed to retrieve file: " + filename, e);
}
} | java | public String getStoredFile(String filename) {
try {
File stored = new File(temporaryStorage.toFile(), filename);
if (!stored.exists()) {
throw new CitrusRuntimeException("Failed to access stored file: " + stored.getCanonicalPath());
}
return stored.getCanonicalPath();
} catch (IOException e) {
throw new CitrusRuntimeException("Failed to retrieve file: " + filename, e);
}
} | [
"public",
"String",
"getStoredFile",
"(",
"String",
"filename",
")",
"{",
"try",
"{",
"File",
"stored",
"=",
"new",
"File",
"(",
"temporaryStorage",
".",
"toFile",
"(",
")",
",",
"filename",
")",
";",
"if",
"(",
"!",
"stored",
".",
"exists",
"(",
")",
... | Retrieve resource object
@param filename Resource to retrieve.
@return String with the path to the resource. | [
"Retrieve",
"resource",
"object"
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-selenium/src/main/java/com/consol/citrus/selenium/endpoint/SeleniumBrowser.java#L181-L193 | train |
citrusframework/citrus | modules/citrus-selenium/src/main/java/com/consol/citrus/selenium/endpoint/SeleniumBrowser.java | SeleniumBrowser.createLocalWebDriver | private WebDriver createLocalWebDriver(String browserType) {
switch (browserType) {
case BrowserType.FIREFOX:
FirefoxProfile firefoxProfile = getEndpointConfiguration().getFirefoxProfile();
/* set custom download folder */
firefoxProfile.setPreference("browser.download.dir", temporaryStorage.toFile().getAbsolutePath());
DesiredCapabilities defaults = DesiredCapabilities.firefox();
defaults.setCapability(FirefoxDriver.PROFILE, firefoxProfile);
return new FirefoxDriver(defaults);
case BrowserType.IE:
return new InternetExplorerDriver();
case BrowserType.EDGE:
return new EdgeDriver();
case BrowserType.SAFARI:
return new SafariDriver();
case BrowserType.CHROME:
return new ChromeDriver();
case BrowserType.GOOGLECHROME:
return new ChromeDriver();
case BrowserType.HTMLUNIT:
BrowserVersion browserVersion = null;
if (getEndpointConfiguration().getVersion().equals("FIREFOX")) {
browserVersion = BrowserVersion.FIREFOX_45;
} else if (getEndpointConfiguration().getVersion().equals("INTERNET_EXPLORER")) {
browserVersion = BrowserVersion.INTERNET_EXPLORER;
} else if (getEndpointConfiguration().getVersion().equals("EDGE")) {
browserVersion = BrowserVersion.EDGE;
} else if (getEndpointConfiguration().getVersion().equals("CHROME")) {
browserVersion = BrowserVersion.CHROME;
}
HtmlUnitDriver htmlUnitDriver;
if (browserVersion != null) {
htmlUnitDriver = new HtmlUnitDriver(browserVersion);
} else {
htmlUnitDriver = new HtmlUnitDriver();
}
htmlUnitDriver.setJavascriptEnabled(getEndpointConfiguration().isJavaScript());
return htmlUnitDriver;
default:
throw new CitrusRuntimeException("Unsupported local browser type: " + browserType);
}
} | java | private WebDriver createLocalWebDriver(String browserType) {
switch (browserType) {
case BrowserType.FIREFOX:
FirefoxProfile firefoxProfile = getEndpointConfiguration().getFirefoxProfile();
/* set custom download folder */
firefoxProfile.setPreference("browser.download.dir", temporaryStorage.toFile().getAbsolutePath());
DesiredCapabilities defaults = DesiredCapabilities.firefox();
defaults.setCapability(FirefoxDriver.PROFILE, firefoxProfile);
return new FirefoxDriver(defaults);
case BrowserType.IE:
return new InternetExplorerDriver();
case BrowserType.EDGE:
return new EdgeDriver();
case BrowserType.SAFARI:
return new SafariDriver();
case BrowserType.CHROME:
return new ChromeDriver();
case BrowserType.GOOGLECHROME:
return new ChromeDriver();
case BrowserType.HTMLUNIT:
BrowserVersion browserVersion = null;
if (getEndpointConfiguration().getVersion().equals("FIREFOX")) {
browserVersion = BrowserVersion.FIREFOX_45;
} else if (getEndpointConfiguration().getVersion().equals("INTERNET_EXPLORER")) {
browserVersion = BrowserVersion.INTERNET_EXPLORER;
} else if (getEndpointConfiguration().getVersion().equals("EDGE")) {
browserVersion = BrowserVersion.EDGE;
} else if (getEndpointConfiguration().getVersion().equals("CHROME")) {
browserVersion = BrowserVersion.CHROME;
}
HtmlUnitDriver htmlUnitDriver;
if (browserVersion != null) {
htmlUnitDriver = new HtmlUnitDriver(browserVersion);
} else {
htmlUnitDriver = new HtmlUnitDriver();
}
htmlUnitDriver.setJavascriptEnabled(getEndpointConfiguration().isJavaScript());
return htmlUnitDriver;
default:
throw new CitrusRuntimeException("Unsupported local browser type: " + browserType);
}
} | [
"private",
"WebDriver",
"createLocalWebDriver",
"(",
"String",
"browserType",
")",
"{",
"switch",
"(",
"browserType",
")",
"{",
"case",
"BrowserType",
".",
"FIREFOX",
":",
"FirefoxProfile",
"firefoxProfile",
"=",
"getEndpointConfiguration",
"(",
")",
".",
"getFirefo... | Creates local web driver.
@param browserType
@return | [
"Creates",
"local",
"web",
"driver",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-selenium/src/main/java/com/consol/citrus/selenium/endpoint/SeleniumBrowser.java#L200-L244 | train |
citrusframework/citrus | modules/citrus-selenium/src/main/java/com/consol/citrus/selenium/endpoint/SeleniumBrowser.java | SeleniumBrowser.createRemoteWebDriver | private RemoteWebDriver createRemoteWebDriver(String browserType, String serverAddress) {
try {
switch (browserType) {
case BrowserType.FIREFOX:
DesiredCapabilities defaultsFF = DesiredCapabilities.firefox();
defaultsFF.setCapability(FirefoxDriver.PROFILE, getEndpointConfiguration().getFirefoxProfile());
return new RemoteWebDriver(new URL(serverAddress), defaultsFF);
case BrowserType.IE:
DesiredCapabilities defaultsIE = DesiredCapabilities.internetExplorer();
defaultsIE.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
return new RemoteWebDriver(new URL(serverAddress), defaultsIE);
case BrowserType.CHROME:
DesiredCapabilities defaultsChrome = DesiredCapabilities.chrome();
defaultsChrome.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
return new RemoteWebDriver(new URL(serverAddress), defaultsChrome);
case BrowserType.GOOGLECHROME:
DesiredCapabilities defaultsGoogleChrome = DesiredCapabilities.chrome();
defaultsGoogleChrome.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
return new RemoteWebDriver(new URL(serverAddress), defaultsGoogleChrome);
default:
throw new CitrusRuntimeException("Unsupported remote browser type: " + browserType);
}
} catch (MalformedURLException e) {
throw new CitrusRuntimeException("Failed to access remote server", e);
}
} | java | private RemoteWebDriver createRemoteWebDriver(String browserType, String serverAddress) {
try {
switch (browserType) {
case BrowserType.FIREFOX:
DesiredCapabilities defaultsFF = DesiredCapabilities.firefox();
defaultsFF.setCapability(FirefoxDriver.PROFILE, getEndpointConfiguration().getFirefoxProfile());
return new RemoteWebDriver(new URL(serverAddress), defaultsFF);
case BrowserType.IE:
DesiredCapabilities defaultsIE = DesiredCapabilities.internetExplorer();
defaultsIE.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
return new RemoteWebDriver(new URL(serverAddress), defaultsIE);
case BrowserType.CHROME:
DesiredCapabilities defaultsChrome = DesiredCapabilities.chrome();
defaultsChrome.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
return new RemoteWebDriver(new URL(serverAddress), defaultsChrome);
case BrowserType.GOOGLECHROME:
DesiredCapabilities defaultsGoogleChrome = DesiredCapabilities.chrome();
defaultsGoogleChrome.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
return new RemoteWebDriver(new URL(serverAddress), defaultsGoogleChrome);
default:
throw new CitrusRuntimeException("Unsupported remote browser type: " + browserType);
}
} catch (MalformedURLException e) {
throw new CitrusRuntimeException("Failed to access remote server", e);
}
} | [
"private",
"RemoteWebDriver",
"createRemoteWebDriver",
"(",
"String",
"browserType",
",",
"String",
"serverAddress",
")",
"{",
"try",
"{",
"switch",
"(",
"browserType",
")",
"{",
"case",
"BrowserType",
".",
"FIREFOX",
":",
"DesiredCapabilities",
"defaultsFF",
"=",
... | Creates remote web driver.
@param browserType
@param serverAddress
@return
@throws MalformedURLException | [
"Creates",
"remote",
"web",
"driver",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-selenium/src/main/java/com/consol/citrus/selenium/endpoint/SeleniumBrowser.java#L253-L278 | train |
citrusframework/citrus | modules/citrus-selenium/src/main/java/com/consol/citrus/selenium/endpoint/SeleniumBrowser.java | SeleniumBrowser.createTemporaryStorage | private Path createTemporaryStorage() {
try {
Path tempDir = Files.createTempDirectory("selenium");
tempDir.toFile().deleteOnExit();
log.info("Download storage location is: " + tempDir.toString());
return tempDir;
} catch (IOException e) {
throw new CitrusRuntimeException("Could not create temporary storage", e);
}
} | java | private Path createTemporaryStorage() {
try {
Path tempDir = Files.createTempDirectory("selenium");
tempDir.toFile().deleteOnExit();
log.info("Download storage location is: " + tempDir.toString());
return tempDir;
} catch (IOException e) {
throw new CitrusRuntimeException("Could not create temporary storage", e);
}
} | [
"private",
"Path",
"createTemporaryStorage",
"(",
")",
"{",
"try",
"{",
"Path",
"tempDir",
"=",
"Files",
".",
"createTempDirectory",
"(",
"\"selenium\"",
")",
";",
"tempDir",
".",
"toFile",
"(",
")",
".",
"deleteOnExit",
"(",
")",
";",
"log",
".",
"info",
... | Creates temporary storage.
@return | [
"Creates",
"temporary",
"storage",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-selenium/src/main/java/com/consol/citrus/selenium/endpoint/SeleniumBrowser.java#L284-L294 | train |
citrusframework/citrus | modules/citrus-cucumber/src/main/java/com/consol/citrus/cucumber/step/runner/http/HttpSteps.java | HttpSteps.sendClientRequest | protected void sendClientRequest(HttpMessage request) {
BuilderSupport<HttpActionBuilder> action = builder -> {
HttpClientActionBuilder.HttpClientSendActionBuilder sendBuilder = builder.client(httpClient).send();
HttpClientRequestActionBuilder requestBuilder;
if (request.getRequestMethod() == null || request.getRequestMethod().equals(HttpMethod.POST)) {
requestBuilder = sendBuilder.post().message(request);
} else if (request.getRequestMethod().equals(HttpMethod.GET)) {
requestBuilder = sendBuilder.get().message(request);
} else if (request.getRequestMethod().equals(HttpMethod.PUT)) {
requestBuilder = sendBuilder.put().message(request);
} else if (request.getRequestMethod().equals(HttpMethod.DELETE)) {
requestBuilder = sendBuilder.delete().message(request);
} else if (request.getRequestMethod().equals(HttpMethod.HEAD)) {
requestBuilder = sendBuilder.head().message(request);
} else if (request.getRequestMethod().equals(HttpMethod.TRACE)) {
requestBuilder = sendBuilder.trace().message(request);
} else if (request.getRequestMethod().equals(HttpMethod.PATCH)) {
requestBuilder = sendBuilder.patch().message(request);
} else if (request.getRequestMethod().equals(HttpMethod.OPTIONS)) {
requestBuilder = sendBuilder.options().message(request);
} else {
requestBuilder = sendBuilder.post().message(request);
}
if (StringUtils.hasText(url)) {
requestBuilder.uri(url);
}
};
runner.http(action);
} | java | protected void sendClientRequest(HttpMessage request) {
BuilderSupport<HttpActionBuilder> action = builder -> {
HttpClientActionBuilder.HttpClientSendActionBuilder sendBuilder = builder.client(httpClient).send();
HttpClientRequestActionBuilder requestBuilder;
if (request.getRequestMethod() == null || request.getRequestMethod().equals(HttpMethod.POST)) {
requestBuilder = sendBuilder.post().message(request);
} else if (request.getRequestMethod().equals(HttpMethod.GET)) {
requestBuilder = sendBuilder.get().message(request);
} else if (request.getRequestMethod().equals(HttpMethod.PUT)) {
requestBuilder = sendBuilder.put().message(request);
} else if (request.getRequestMethod().equals(HttpMethod.DELETE)) {
requestBuilder = sendBuilder.delete().message(request);
} else if (request.getRequestMethod().equals(HttpMethod.HEAD)) {
requestBuilder = sendBuilder.head().message(request);
} else if (request.getRequestMethod().equals(HttpMethod.TRACE)) {
requestBuilder = sendBuilder.trace().message(request);
} else if (request.getRequestMethod().equals(HttpMethod.PATCH)) {
requestBuilder = sendBuilder.patch().message(request);
} else if (request.getRequestMethod().equals(HttpMethod.OPTIONS)) {
requestBuilder = sendBuilder.options().message(request);
} else {
requestBuilder = sendBuilder.post().message(request);
}
if (StringUtils.hasText(url)) {
requestBuilder.uri(url);
}
};
runner.http(action);
} | [
"protected",
"void",
"sendClientRequest",
"(",
"HttpMessage",
"request",
")",
"{",
"BuilderSupport",
"<",
"HttpActionBuilder",
">",
"action",
"=",
"builder",
"->",
"{",
"HttpClientActionBuilder",
".",
"HttpClientSendActionBuilder",
"sendBuilder",
"=",
"builder",
".",
... | Sends client request.
@param request | [
"Sends",
"client",
"request",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-cucumber/src/main/java/com/consol/citrus/cucumber/step/runner/http/HttpSteps.java#L214-L245 | train |
citrusframework/citrus | modules/citrus-cucumber/src/main/java/com/consol/citrus/cucumber/step/runner/http/HttpSteps.java | HttpSteps.receiveClientResponse | protected void receiveClientResponse(HttpMessage response) {
runner.http(action -> {
HttpClientResponseActionBuilder responseBuilder = action.client(httpClient).receive()
.response(response.getStatusCode())
.message(response);
for (Map.Entry<String, String> headerEntry : pathValidations.entrySet()) {
responseBuilder.validate(headerEntry.getKey(), headerEntry.getValue());
}
pathValidations.clear();
});
} | java | protected void receiveClientResponse(HttpMessage response) {
runner.http(action -> {
HttpClientResponseActionBuilder responseBuilder = action.client(httpClient).receive()
.response(response.getStatusCode())
.message(response);
for (Map.Entry<String, String> headerEntry : pathValidations.entrySet()) {
responseBuilder.validate(headerEntry.getKey(), headerEntry.getValue());
}
pathValidations.clear();
});
} | [
"protected",
"void",
"receiveClientResponse",
"(",
"HttpMessage",
"response",
")",
"{",
"runner",
".",
"http",
"(",
"action",
"->",
"{",
"HttpClientResponseActionBuilder",
"responseBuilder",
"=",
"action",
".",
"client",
"(",
"httpClient",
")",
".",
"receive",
"("... | Receives client response.
@param response | [
"Receives",
"client",
"response",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-cucumber/src/main/java/com/consol/citrus/cucumber/step/runner/http/HttpSteps.java#L272-L283 | train |
citrusframework/citrus | modules/citrus-cucumber/src/main/java/com/consol/citrus/cucumber/step/runner/http/HttpSteps.java | HttpSteps.receiveServerRequest | protected void receiveServerRequest(HttpMessage request) {
BuilderSupport<HttpActionBuilder> action = builder -> {
HttpServerActionBuilder.HttpServerReceiveActionBuilder receiveBuilder = builder.server(httpServer).receive();
HttpServerRequestActionBuilder requestBuilder;
if (request.getRequestMethod() == null || request.getRequestMethod().equals(HttpMethod.POST)) {
requestBuilder = receiveBuilder.post().message(request);
} else if (request.getRequestMethod().equals(HttpMethod.GET)) {
requestBuilder = receiveBuilder.get().message(request);
} else if (request.getRequestMethod().equals(HttpMethod.PUT)) {
requestBuilder = receiveBuilder.put().message(request);
} else if (request.getRequestMethod().equals(HttpMethod.DELETE)) {
requestBuilder = receiveBuilder.delete().message(request);
} else if (request.getRequestMethod().equals(HttpMethod.HEAD)) {
requestBuilder = receiveBuilder.head().message(request);
} else if (request.getRequestMethod().equals(HttpMethod.TRACE)) {
requestBuilder = receiveBuilder.trace().message(request);
} else if (request.getRequestMethod().equals(HttpMethod.PATCH)) {
requestBuilder = receiveBuilder.patch().message(request);
} else if (request.getRequestMethod().equals(HttpMethod.OPTIONS)) {
requestBuilder = receiveBuilder.options().message(request);
} else {
requestBuilder = receiveBuilder.post().message(request);
}
for (Map.Entry<String, String> headerEntry : pathValidations.entrySet()) {
requestBuilder.validate(headerEntry.getKey(), headerEntry.getValue());
}
pathValidations.clear();
};
runner.http(action);
} | java | protected void receiveServerRequest(HttpMessage request) {
BuilderSupport<HttpActionBuilder> action = builder -> {
HttpServerActionBuilder.HttpServerReceiveActionBuilder receiveBuilder = builder.server(httpServer).receive();
HttpServerRequestActionBuilder requestBuilder;
if (request.getRequestMethod() == null || request.getRequestMethod().equals(HttpMethod.POST)) {
requestBuilder = receiveBuilder.post().message(request);
} else if (request.getRequestMethod().equals(HttpMethod.GET)) {
requestBuilder = receiveBuilder.get().message(request);
} else if (request.getRequestMethod().equals(HttpMethod.PUT)) {
requestBuilder = receiveBuilder.put().message(request);
} else if (request.getRequestMethod().equals(HttpMethod.DELETE)) {
requestBuilder = receiveBuilder.delete().message(request);
} else if (request.getRequestMethod().equals(HttpMethod.HEAD)) {
requestBuilder = receiveBuilder.head().message(request);
} else if (request.getRequestMethod().equals(HttpMethod.TRACE)) {
requestBuilder = receiveBuilder.trace().message(request);
} else if (request.getRequestMethod().equals(HttpMethod.PATCH)) {
requestBuilder = receiveBuilder.patch().message(request);
} else if (request.getRequestMethod().equals(HttpMethod.OPTIONS)) {
requestBuilder = receiveBuilder.options().message(request);
} else {
requestBuilder = receiveBuilder.post().message(request);
}
for (Map.Entry<String, String> headerEntry : pathValidations.entrySet()) {
requestBuilder.validate(headerEntry.getKey(), headerEntry.getValue());
}
pathValidations.clear();
};
runner.http(action);
} | [
"protected",
"void",
"receiveServerRequest",
"(",
"HttpMessage",
"request",
")",
"{",
"BuilderSupport",
"<",
"HttpActionBuilder",
">",
"action",
"=",
"builder",
"->",
"{",
"HttpServerActionBuilder",
".",
"HttpServerReceiveActionBuilder",
"receiveBuilder",
"=",
"builder",
... | Receives server request.
@param request | [
"Receives",
"server",
"request",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-cucumber/src/main/java/com/consol/citrus/cucumber/step/runner/http/HttpSteps.java#L319-L351 | train |
citrusframework/citrus | modules/citrus-http/src/main/java/com/consol/citrus/http/message/CookieConverter.java | CookieConverter.convertCookies | Cookie[] convertCookies(HttpEntity<?> httpEntity) {
final List<Cookie> cookies = new LinkedList<>();
List<String> inboundCookies = httpEntity.getHeaders().get(HttpHeaders.SET_COOKIE);
if (inboundCookies != null) {
for (String cookieString : inboundCookies) {
Cookie cookie = convertCookieString(cookieString);
cookies.add(cookie);
}
}
return cookies.toArray(new Cookie[0]);
} | java | Cookie[] convertCookies(HttpEntity<?> httpEntity) {
final List<Cookie> cookies = new LinkedList<>();
List<String> inboundCookies = httpEntity.getHeaders().get(HttpHeaders.SET_COOKIE);
if (inboundCookies != null) {
for (String cookieString : inboundCookies) {
Cookie cookie = convertCookieString(cookieString);
cookies.add(cookie);
}
}
return cookies.toArray(new Cookie[0]);
} | [
"Cookie",
"[",
"]",
"convertCookies",
"(",
"HttpEntity",
"<",
"?",
">",
"httpEntity",
")",
"{",
"final",
"List",
"<",
"Cookie",
">",
"cookies",
"=",
"new",
"LinkedList",
"<>",
"(",
")",
";",
"List",
"<",
"String",
">",
"inboundCookies",
"=",
"httpEntity"... | Converts cookies from a HttpEntity into Cookie objects
@param httpEntity The message to convert
@return A array of converted cookies | [
"Converts",
"cookies",
"from",
"a",
"HttpEntity",
"into",
"Cookie",
"objects"
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-http/src/main/java/com/consol/citrus/http/message/CookieConverter.java#L53-L65 | train |
citrusframework/citrus | modules/citrus-http/src/main/java/com/consol/citrus/http/message/CookieConverter.java | CookieConverter.getCookieString | String getCookieString(Cookie cookie) {
StringBuilder builder = new StringBuilder();
builder.append(cookie.getName());
builder.append("=");
builder.append(cookie.getValue());
if (cookie.getVersion() > 0) {
builder.append(";" + VERSION + "=").append(cookie.getVersion());
}
if (StringUtils.hasText(cookie.getPath())) {
builder.append(";" + PATH + "=").append(cookie.getPath());
}
if (StringUtils.hasText(cookie.getDomain())) {
builder.append(";" + DOMAIN + "=").append(cookie.getDomain());
}
if (cookie.getMaxAge() > 0) {
builder.append(";" + MAX_AGE + "=").append(cookie.getMaxAge());
}
if (StringUtils.hasText(cookie.getComment())) {
builder.append(";" + COMMENT + "=").append(cookie.getComment());
}
if (cookie.getSecure()) {
builder.append(";" + SECURE);
}
if (cookie.isHttpOnly()) {
builder.append(";" + HTTP_ONLY);
}
return builder.toString();
} | java | String getCookieString(Cookie cookie) {
StringBuilder builder = new StringBuilder();
builder.append(cookie.getName());
builder.append("=");
builder.append(cookie.getValue());
if (cookie.getVersion() > 0) {
builder.append(";" + VERSION + "=").append(cookie.getVersion());
}
if (StringUtils.hasText(cookie.getPath())) {
builder.append(";" + PATH + "=").append(cookie.getPath());
}
if (StringUtils.hasText(cookie.getDomain())) {
builder.append(";" + DOMAIN + "=").append(cookie.getDomain());
}
if (cookie.getMaxAge() > 0) {
builder.append(";" + MAX_AGE + "=").append(cookie.getMaxAge());
}
if (StringUtils.hasText(cookie.getComment())) {
builder.append(";" + COMMENT + "=").append(cookie.getComment());
}
if (cookie.getSecure()) {
builder.append(";" + SECURE);
}
if (cookie.isHttpOnly()) {
builder.append(";" + HTTP_ONLY);
}
return builder.toString();
} | [
"String",
"getCookieString",
"(",
"Cookie",
"cookie",
")",
"{",
"StringBuilder",
"builder",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"builder",
".",
"append",
"(",
"cookie",
".",
"getName",
"(",
")",
")",
";",
"builder",
".",
"append",
"(",
"\"=\"",
"... | Converts a given cookie into a HTTP conform cookie String
@param cookie the cookie to convert
@return The cookie string representation of the given cookie | [
"Converts",
"a",
"given",
"cookie",
"into",
"a",
"HTTP",
"conform",
"cookie",
"String"
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-http/src/main/java/com/consol/citrus/http/message/CookieConverter.java#L72-L108 | train |
citrusframework/citrus | modules/citrus-http/src/main/java/com/consol/citrus/http/message/CookieConverter.java | CookieConverter.convertCookieString | private Cookie convertCookieString(String cookieString) {
Cookie cookie = new Cookie(getCookieParam(NAME, cookieString), getCookieParam(VALUE, cookieString));
if (cookieString.contains(COMMENT)) {
cookie.setComment(getCookieParam(COMMENT, cookieString));
}
if (cookieString.contains(PATH)) {
cookie.setPath(getCookieParam(PATH, cookieString));
}
if (cookieString.contains(DOMAIN)) {
cookie.setDomain(getCookieParam(DOMAIN, cookieString));
}
if (cookieString.contains(MAX_AGE)) {
cookie.setMaxAge(Integer.valueOf(getCookieParam(MAX_AGE, cookieString)));
}
if (cookieString.contains(SECURE)) {
cookie.setSecure(Boolean.valueOf(getCookieParam(SECURE, cookieString)));
}
if (cookieString.contains(VERSION)) {
cookie.setVersion(Integer.valueOf(getCookieParam(VERSION, cookieString)));
}
if (cookieString.contains(HTTP_ONLY)) {
cookie.setHttpOnly(Boolean.valueOf(getCookieParam(HTTP_ONLY, cookieString)));
}
return cookie;
} | java | private Cookie convertCookieString(String cookieString) {
Cookie cookie = new Cookie(getCookieParam(NAME, cookieString), getCookieParam(VALUE, cookieString));
if (cookieString.contains(COMMENT)) {
cookie.setComment(getCookieParam(COMMENT, cookieString));
}
if (cookieString.contains(PATH)) {
cookie.setPath(getCookieParam(PATH, cookieString));
}
if (cookieString.contains(DOMAIN)) {
cookie.setDomain(getCookieParam(DOMAIN, cookieString));
}
if (cookieString.contains(MAX_AGE)) {
cookie.setMaxAge(Integer.valueOf(getCookieParam(MAX_AGE, cookieString)));
}
if (cookieString.contains(SECURE)) {
cookie.setSecure(Boolean.valueOf(getCookieParam(SECURE, cookieString)));
}
if (cookieString.contains(VERSION)) {
cookie.setVersion(Integer.valueOf(getCookieParam(VERSION, cookieString)));
}
if (cookieString.contains(HTTP_ONLY)) {
cookie.setHttpOnly(Boolean.valueOf(getCookieParam(HTTP_ONLY, cookieString)));
}
return cookie;
} | [
"private",
"Cookie",
"convertCookieString",
"(",
"String",
"cookieString",
")",
"{",
"Cookie",
"cookie",
"=",
"new",
"Cookie",
"(",
"getCookieParam",
"(",
"NAME",
",",
"cookieString",
")",
",",
"getCookieParam",
"(",
"VALUE",
",",
"cookieString",
")",
")",
";"... | Converts a cookie string from a http header value into a Cookie object
@param cookieString The string to convert
@return The Cookie representation of the given String | [
"Converts",
"a",
"cookie",
"string",
"from",
"a",
"http",
"header",
"value",
"into",
"a",
"Cookie",
"object"
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-http/src/main/java/com/consol/citrus/http/message/CookieConverter.java#L115-L147 | train |
citrusframework/citrus | modules/citrus-http/src/main/java/com/consol/citrus/http/message/CookieConverter.java | CookieConverter.getCookieParam | private String getCookieParam(String param, String cookieString) {
if (param.equals(NAME)) {
return cookieString.substring(0, cookieString.indexOf('='));
}
if (param.equals(VALUE)) {
if (cookieString.contains(";")) {
return cookieString.substring(cookieString.indexOf('=') + 1, cookieString.indexOf(';'));
} else {
return cookieString.substring(cookieString.indexOf('=') + 1);
}
}
if(containsFlag(SECURE, param, cookieString) || containsFlag(HTTP_ONLY, param, cookieString)) {
return String.valueOf(true);
}
if (cookieString.contains(param + '=')) {
final int endParam = cookieString.indexOf(';', cookieString.indexOf(param + '='));
final int beginIndex = cookieString.indexOf(param + '=') + param.length() + 1;
if (endParam > 0) {
return cookieString.substring(beginIndex, endParam);
} else {
return cookieString.substring(beginIndex);
}
}
throw new CitrusRuntimeException(String.format(
"Unable to get cookie argument '%s' from cookie String: %s", param, cookieString));
} | java | private String getCookieParam(String param, String cookieString) {
if (param.equals(NAME)) {
return cookieString.substring(0, cookieString.indexOf('='));
}
if (param.equals(VALUE)) {
if (cookieString.contains(";")) {
return cookieString.substring(cookieString.indexOf('=') + 1, cookieString.indexOf(';'));
} else {
return cookieString.substring(cookieString.indexOf('=') + 1);
}
}
if(containsFlag(SECURE, param, cookieString) || containsFlag(HTTP_ONLY, param, cookieString)) {
return String.valueOf(true);
}
if (cookieString.contains(param + '=')) {
final int endParam = cookieString.indexOf(';', cookieString.indexOf(param + '='));
final int beginIndex = cookieString.indexOf(param + '=') + param.length() + 1;
if (endParam > 0) {
return cookieString.substring(beginIndex, endParam);
} else {
return cookieString.substring(beginIndex);
}
}
throw new CitrusRuntimeException(String.format(
"Unable to get cookie argument '%s' from cookie String: %s", param, cookieString));
} | [
"private",
"String",
"getCookieParam",
"(",
"String",
"param",
",",
"String",
"cookieString",
")",
"{",
"if",
"(",
"param",
".",
"equals",
"(",
"NAME",
")",
")",
"{",
"return",
"cookieString",
".",
"substring",
"(",
"0",
",",
"cookieString",
".",
"indexOf"... | Extract cookie param from cookie string as it was provided by "Set-Cookie" header.
@param param The parameter to extract from the cookie string
@param cookieString The cookie string from the cookie header to extract the parameter from
@return The value of the requested parameter | [
"Extract",
"cookie",
"param",
"from",
"cookie",
"string",
"as",
"it",
"was",
"provided",
"by",
"Set",
"-",
"Cookie",
"header",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-http/src/main/java/com/consol/citrus/http/message/CookieConverter.java#L155-L184 | train |
citrusframework/citrus | modules/citrus-core/src/main/java/com/consol/citrus/config/xml/AbstractEndpointParser.java | AbstractEndpointParser.parseEndpointConfiguration | protected void parseEndpointConfiguration(BeanDefinitionBuilder endpointConfigurationBuilder, Element element, ParserContext parserContext) {
BeanDefinitionParserUtils.setPropertyValue(endpointConfigurationBuilder, element.getAttribute("timeout"), "timeout");
} | java | protected void parseEndpointConfiguration(BeanDefinitionBuilder endpointConfigurationBuilder, Element element, ParserContext parserContext) {
BeanDefinitionParserUtils.setPropertyValue(endpointConfigurationBuilder, element.getAttribute("timeout"), "timeout");
} | [
"protected",
"void",
"parseEndpointConfiguration",
"(",
"BeanDefinitionBuilder",
"endpointConfigurationBuilder",
",",
"Element",
"element",
",",
"ParserContext",
"parserContext",
")",
"{",
"BeanDefinitionParserUtils",
".",
"setPropertyValue",
"(",
"endpointConfigurationBuilder",
... | Subclasses can override this parsing method in order to provide proper endpoint configuration bean definition properties.
@param endpointConfigurationBuilder
@param element
@param parserContext
@return | [
"Subclasses",
"can",
"override",
"this",
"parsing",
"method",
"in",
"order",
"to",
"provide",
"proper",
"endpoint",
"configuration",
"bean",
"definition",
"properties",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/config/xml/AbstractEndpointParser.java#L74-L76 | train |
citrusframework/citrus | modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/builder/InputActionBuilder.java | InputActionBuilder.answers | public InputActionBuilder answers(String... answers) {
if (answers.length == 0) {
throw new CitrusRuntimeException("Please specify proper answer possibilities for input action");
}
StringBuilder validAnswers = new StringBuilder();
for (String answer : answers) {
validAnswers.append(InputAction.ANSWER_SEPARATOR);
validAnswers.append(answer);
}
action.setValidAnswers(validAnswers.toString().substring(1));
return this;
} | java | public InputActionBuilder answers(String... answers) {
if (answers.length == 0) {
throw new CitrusRuntimeException("Please specify proper answer possibilities for input action");
}
StringBuilder validAnswers = new StringBuilder();
for (String answer : answers) {
validAnswers.append(InputAction.ANSWER_SEPARATOR);
validAnswers.append(answer);
}
action.setValidAnswers(validAnswers.toString().substring(1));
return this;
} | [
"public",
"InputActionBuilder",
"answers",
"(",
"String",
"...",
"answers",
")",
"{",
"if",
"(",
"answers",
".",
"length",
"==",
"0",
")",
"{",
"throw",
"new",
"CitrusRuntimeException",
"(",
"\"Please specify proper answer possibilities for input action\"",
")",
";",
... | Sets the valid answers.
@param answers the validAnswers to set | [
"Sets",
"the",
"valid",
"answers",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/builder/InputActionBuilder.java#L70-L84 | train |
citrusframework/citrus | modules/citrus-core/src/main/java/com/consol/citrus/Citrus.java | Citrus.beforeSuite | public void beforeSuite(String suiteName, String ... testGroups) {
testSuiteListener.onStart();
if (!CollectionUtils.isEmpty(beforeSuite)) {
for (SequenceBeforeSuite sequenceBeforeSuite : beforeSuite) {
try {
if (sequenceBeforeSuite.shouldExecute(suiteName, testGroups)) {
sequenceBeforeSuite.execute(createTestContext());
}
} catch (Exception e) {
testSuiteListener.onStartFailure(e);
afterSuite(suiteName, testGroups);
throw new AssertionError("Before suite failed with errors", e);
}
}
testSuiteListener.onStartSuccess();
} else {
testSuiteListener.onStartSuccess();
}
} | java | public void beforeSuite(String suiteName, String ... testGroups) {
testSuiteListener.onStart();
if (!CollectionUtils.isEmpty(beforeSuite)) {
for (SequenceBeforeSuite sequenceBeforeSuite : beforeSuite) {
try {
if (sequenceBeforeSuite.shouldExecute(suiteName, testGroups)) {
sequenceBeforeSuite.execute(createTestContext());
}
} catch (Exception e) {
testSuiteListener.onStartFailure(e);
afterSuite(suiteName, testGroups);
throw new AssertionError("Before suite failed with errors", e);
}
}
testSuiteListener.onStartSuccess();
} else {
testSuiteListener.onStartSuccess();
}
} | [
"public",
"void",
"beforeSuite",
"(",
"String",
"suiteName",
",",
"String",
"...",
"testGroups",
")",
"{",
"testSuiteListener",
".",
"onStart",
"(",
")",
";",
"if",
"(",
"!",
"CollectionUtils",
".",
"isEmpty",
"(",
"beforeSuite",
")",
")",
"{",
"for",
"(",... | Performs before suite test actions.
@param suiteName
@param testGroups | [
"Performs",
"before",
"suite",
"test",
"actions",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/Citrus.java#L325-L346 | train |
citrusframework/citrus | modules/citrus-core/src/main/java/com/consol/citrus/Citrus.java | Citrus.afterSuite | public void afterSuite(String suiteName, String ... testGroups) {
testSuiteListener.onFinish();
if (!CollectionUtils.isEmpty(afterSuite)) {
for (SequenceAfterSuite sequenceAfterSuite : afterSuite) {
try {
if (sequenceAfterSuite.shouldExecute(suiteName, testGroups)) {
sequenceAfterSuite.execute(createTestContext());
}
} catch (Exception e) {
testSuiteListener.onFinishFailure(e);
throw new AssertionError("After suite failed with errors", e);
}
}
testSuiteListener.onFinishSuccess();
} else {
testSuiteListener.onFinishSuccess();
}
} | java | public void afterSuite(String suiteName, String ... testGroups) {
testSuiteListener.onFinish();
if (!CollectionUtils.isEmpty(afterSuite)) {
for (SequenceAfterSuite sequenceAfterSuite : afterSuite) {
try {
if (sequenceAfterSuite.shouldExecute(suiteName, testGroups)) {
sequenceAfterSuite.execute(createTestContext());
}
} catch (Exception e) {
testSuiteListener.onFinishFailure(e);
throw new AssertionError("After suite failed with errors", e);
}
}
testSuiteListener.onFinishSuccess();
} else {
testSuiteListener.onFinishSuccess();
}
} | [
"public",
"void",
"afterSuite",
"(",
"String",
"suiteName",
",",
"String",
"...",
"testGroups",
")",
"{",
"testSuiteListener",
".",
"onFinish",
"(",
")",
";",
"if",
"(",
"!",
"CollectionUtils",
".",
"isEmpty",
"(",
"afterSuite",
")",
")",
"{",
"for",
"(",
... | Performs after suite test actions.
@param suiteName
@param testGroups | [
"Performs",
"after",
"suite",
"test",
"actions",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/Citrus.java#L353-L372 | train |
citrusframework/citrus | modules/citrus-jmx/src/main/java/com/consol/citrus/jmx/message/JmxMessage.java | JmxMessage.attribute | public JmxMessage attribute(String name, Object value) {
return attribute(name, value, value.getClass());
} | java | public JmxMessage attribute(String name, Object value) {
return attribute(name, value, value.getClass());
} | [
"public",
"JmxMessage",
"attribute",
"(",
"String",
"name",
",",
"Object",
"value",
")",
"{",
"return",
"attribute",
"(",
"name",
",",
"value",
",",
"value",
".",
"getClass",
"(",
")",
")",
";",
"}"
] | Sets attribute for write operation.
@param name
@param value
@return | [
"Sets",
"attribute",
"for",
"write",
"operation",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-jmx/src/main/java/com/consol/citrus/jmx/message/JmxMessage.java#L98-L100 | train |
citrusframework/citrus | modules/citrus-jmx/src/main/java/com/consol/citrus/jmx/message/JmxMessage.java | JmxMessage.attribute | public JmxMessage attribute(String name, Object value, Class<?> valueType) {
if (mbeanInvocation == null) {
throw new CitrusRuntimeException("Invalid access to attribute for JMX message");
}
ManagedBeanInvocation.Attribute attribute = new ManagedBeanInvocation.Attribute();
attribute.setName(name);
if (value != null) {
attribute.setValueObject(value);
attribute.setType(valueType.getName());
}
mbeanInvocation.setAttribute(attribute);
return this;
} | java | public JmxMessage attribute(String name, Object value, Class<?> valueType) {
if (mbeanInvocation == null) {
throw new CitrusRuntimeException("Invalid access to attribute for JMX message");
}
ManagedBeanInvocation.Attribute attribute = new ManagedBeanInvocation.Attribute();
attribute.setName(name);
if (value != null) {
attribute.setValueObject(value);
attribute.setType(valueType.getName());
}
mbeanInvocation.setAttribute(attribute);
return this;
} | [
"public",
"JmxMessage",
"attribute",
"(",
"String",
"name",
",",
"Object",
"value",
",",
"Class",
"<",
"?",
">",
"valueType",
")",
"{",
"if",
"(",
"mbeanInvocation",
"==",
"null",
")",
"{",
"throw",
"new",
"CitrusRuntimeException",
"(",
"\"Invalid access to at... | Sets attribute for write operation with custom value type.
@param name
@param value
@param valueType
@return | [
"Sets",
"attribute",
"for",
"write",
"operation",
"with",
"custom",
"value",
"type",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-jmx/src/main/java/com/consol/citrus/jmx/message/JmxMessage.java#L109-L123 | train |
citrusframework/citrus | modules/citrus-jmx/src/main/java/com/consol/citrus/jmx/message/JmxMessage.java | JmxMessage.operation | public JmxMessage operation(String name) {
if (mbeanInvocation == null) {
throw new CitrusRuntimeException("Invalid access to operation for JMX message");
}
ManagedBeanInvocation.Operation operation = new ManagedBeanInvocation.Operation();
operation.setName(name);
mbeanInvocation.setOperation(operation);
return this;
} | java | public JmxMessage operation(String name) {
if (mbeanInvocation == null) {
throw new CitrusRuntimeException("Invalid access to operation for JMX message");
}
ManagedBeanInvocation.Operation operation = new ManagedBeanInvocation.Operation();
operation.setName(name);
mbeanInvocation.setOperation(operation);
return this;
} | [
"public",
"JmxMessage",
"operation",
"(",
"String",
"name",
")",
"{",
"if",
"(",
"mbeanInvocation",
"==",
"null",
")",
"{",
"throw",
"new",
"CitrusRuntimeException",
"(",
"\"Invalid access to operation for JMX message\"",
")",
";",
"}",
"ManagedBeanInvocation",
".",
... | Sets operation for read write access.
@param name
@return | [
"Sets",
"operation",
"for",
"read",
"write",
"access",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-jmx/src/main/java/com/consol/citrus/jmx/message/JmxMessage.java#L130-L139 | train |
citrusframework/citrus | modules/citrus-jmx/src/main/java/com/consol/citrus/jmx/message/JmxMessage.java | JmxMessage.parameter | public JmxMessage parameter(Object arg, Class<?> argType) {
if (mbeanInvocation == null) {
throw new CitrusRuntimeException("Invalid access to operation parameter for JMX message");
}
if (mbeanInvocation.getOperation() == null) {
throw new CitrusRuntimeException("Invalid access to operation parameter before operation was set for JMX message");
}
if (mbeanInvocation.getOperation().getParameter() == null) {
mbeanInvocation.getOperation().setParameter(new ManagedBeanInvocation.Parameter());
}
OperationParam operationParam = new OperationParam();
operationParam.setValueObject(arg);
operationParam.setType(argType.getName());
mbeanInvocation.getOperation().getParameter().getParameter().add(operationParam);
return this;
} | java | public JmxMessage parameter(Object arg, Class<?> argType) {
if (mbeanInvocation == null) {
throw new CitrusRuntimeException("Invalid access to operation parameter for JMX message");
}
if (mbeanInvocation.getOperation() == null) {
throw new CitrusRuntimeException("Invalid access to operation parameter before operation was set for JMX message");
}
if (mbeanInvocation.getOperation().getParameter() == null) {
mbeanInvocation.getOperation().setParameter(new ManagedBeanInvocation.Parameter());
}
OperationParam operationParam = new OperationParam();
operationParam.setValueObject(arg);
operationParam.setType(argType.getName());
mbeanInvocation.getOperation().getParameter().getParameter().add(operationParam);
return this;
} | [
"public",
"JmxMessage",
"parameter",
"(",
"Object",
"arg",
",",
"Class",
"<",
"?",
">",
"argType",
")",
"{",
"if",
"(",
"mbeanInvocation",
"==",
"null",
")",
"{",
"throw",
"new",
"CitrusRuntimeException",
"(",
"\"Invalid access to operation parameter for JMX message... | Adds operation parameter with custom parameter type.
@param arg
@param argType
@return | [
"Adds",
"operation",
"parameter",
"with",
"custom",
"parameter",
"type",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-jmx/src/main/java/com/consol/citrus/jmx/message/JmxMessage.java#L156-L174 | train |
citrusframework/citrus | modules/citrus-core/src/main/java/com/consol/citrus/endpoint/adapter/RequestDispatchingEndpointAdapter.java | RequestDispatchingEndpointAdapter.dispatchMessage | public Message dispatchMessage(Message request, String mappingKey) {
return mappingStrategy.getEndpointAdapter(mappingKey).handleMessage(request);
} | java | public Message dispatchMessage(Message request, String mappingKey) {
return mappingStrategy.getEndpointAdapter(mappingKey).handleMessage(request);
} | [
"public",
"Message",
"dispatchMessage",
"(",
"Message",
"request",
",",
"String",
"mappingKey",
")",
"{",
"return",
"mappingStrategy",
".",
"getEndpointAdapter",
"(",
"mappingKey",
")",
".",
"handleMessage",
"(",
"request",
")",
";",
"}"
] | Consolidate mapping strategy in order to find dispatch incoming request to endpoint adapter according
to mapping key that was extracted before from message content.
@param request
@param mappingKey
@return | [
"Consolidate",
"mapping",
"strategy",
"in",
"order",
"to",
"find",
"dispatch",
"incoming",
"request",
"to",
"endpoint",
"adapter",
"according",
"to",
"mapping",
"key",
"that",
"was",
"extracted",
"before",
"from",
"message",
"content",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/endpoint/adapter/RequestDispatchingEndpointAdapter.java#L51-L53 | train |
citrusframework/citrus | modules/citrus-core/src/main/java/com/consol/citrus/endpoint/AbstractEndpointComponent.java | AbstractEndpointComponent.enrichEndpointConfiguration | protected void enrichEndpointConfiguration(EndpointConfiguration endpointConfiguration, Map<String, String> parameters, TestContext context) {
for (Map.Entry<String, String> parameterEntry : parameters.entrySet()) {
Field field = ReflectionUtils.findField(endpointConfiguration.getClass(), parameterEntry.getKey());
if (field == null) {
throw new CitrusRuntimeException(String.format("Unable to find parameter field on endpoint configuration '%s'", parameterEntry.getKey()));
}
Method setter = ReflectionUtils.findMethod(endpointConfiguration.getClass(), "set" + parameterEntry.getKey().substring(0, 1).toUpperCase() + parameterEntry.getKey().substring(1), field.getType());
if (setter == null) {
throw new CitrusRuntimeException(String.format("Unable to find parameter setter on endpoint configuration '%s'",
"set" + parameterEntry.getKey().substring(0, 1).toUpperCase() + parameterEntry.getKey().substring(1)));
}
if (parameterEntry.getValue() != null) {
ReflectionUtils.invokeMethod(setter, endpointConfiguration, TypeConversionUtils.convertStringToType(parameterEntry.getValue(), field.getType(), context));
} else {
ReflectionUtils.invokeMethod(setter, endpointConfiguration, field.getType().cast(null));
}
}
} | java | protected void enrichEndpointConfiguration(EndpointConfiguration endpointConfiguration, Map<String, String> parameters, TestContext context) {
for (Map.Entry<String, String> parameterEntry : parameters.entrySet()) {
Field field = ReflectionUtils.findField(endpointConfiguration.getClass(), parameterEntry.getKey());
if (field == null) {
throw new CitrusRuntimeException(String.format("Unable to find parameter field on endpoint configuration '%s'", parameterEntry.getKey()));
}
Method setter = ReflectionUtils.findMethod(endpointConfiguration.getClass(), "set" + parameterEntry.getKey().substring(0, 1).toUpperCase() + parameterEntry.getKey().substring(1), field.getType());
if (setter == null) {
throw new CitrusRuntimeException(String.format("Unable to find parameter setter on endpoint configuration '%s'",
"set" + parameterEntry.getKey().substring(0, 1).toUpperCase() + parameterEntry.getKey().substring(1)));
}
if (parameterEntry.getValue() != null) {
ReflectionUtils.invokeMethod(setter, endpointConfiguration, TypeConversionUtils.convertStringToType(parameterEntry.getValue(), field.getType(), context));
} else {
ReflectionUtils.invokeMethod(setter, endpointConfiguration, field.getType().cast(null));
}
}
} | [
"protected",
"void",
"enrichEndpointConfiguration",
"(",
"EndpointConfiguration",
"endpointConfiguration",
",",
"Map",
"<",
"String",
",",
"String",
">",
"parameters",
",",
"TestContext",
"context",
")",
"{",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
... | Sets properties on endpoint configuration using method reflection.
@param endpointConfiguration
@param parameters
@param context | [
"Sets",
"properties",
"on",
"endpoint",
"configuration",
"using",
"method",
"reflection",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/endpoint/AbstractEndpointComponent.java#L110-L131 | train |
citrusframework/citrus | modules/citrus-core/src/main/java/com/consol/citrus/endpoint/AbstractEndpointComponent.java | AbstractEndpointComponent.getEndpointConfigurationParameters | protected Map<String, String> getEndpointConfigurationParameters(Map<String, String> parameters,
Class<? extends EndpointConfiguration> endpointConfigurationType) {
Map<String, String> params = new HashMap<String, String>();
for (Map.Entry<String, String> parameterEntry : parameters.entrySet()) {
Field field = ReflectionUtils.findField(endpointConfigurationType, parameterEntry.getKey());
if (field != null) {
params.put(parameterEntry.getKey(), parameterEntry.getValue());
}
}
return params;
} | java | protected Map<String, String> getEndpointConfigurationParameters(Map<String, String> parameters,
Class<? extends EndpointConfiguration> endpointConfigurationType) {
Map<String, String> params = new HashMap<String, String>();
for (Map.Entry<String, String> parameterEntry : parameters.entrySet()) {
Field field = ReflectionUtils.findField(endpointConfigurationType, parameterEntry.getKey());
if (field != null) {
params.put(parameterEntry.getKey(), parameterEntry.getValue());
}
}
return params;
} | [
"protected",
"Map",
"<",
"String",
",",
"String",
">",
"getEndpointConfigurationParameters",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"parameters",
",",
"Class",
"<",
"?",
"extends",
"EndpointConfiguration",
">",
"endpointConfigurationType",
")",
"{",
"Map",... | Removes non config parameters from list of endpoint parameters according to given endpoint configuration type. All
parameters that do not reside to a endpoint configuration setting are removed so the result is a qualified list
of endpoint configuration parameters.
@param parameters
@param endpointConfigurationType
@return | [
"Removes",
"non",
"config",
"parameters",
"from",
"list",
"of",
"endpoint",
"parameters",
"according",
"to",
"given",
"endpoint",
"configuration",
"type",
".",
"All",
"parameters",
"that",
"do",
"not",
"reside",
"to",
"a",
"endpoint",
"configuration",
"setting",
... | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/endpoint/AbstractEndpointComponent.java#L142-L155 | train |
citrusframework/citrus | modules/citrus-core/src/main/java/com/consol/citrus/endpoint/AbstractEndpointComponent.java | AbstractEndpointComponent.getParameterString | protected String getParameterString(Map<String, String> parameters,
Class<? extends EndpointConfiguration> endpointConfigurationType) {
StringBuilder paramString = new StringBuilder();
for (Map.Entry<String, String> parameterEntry : parameters.entrySet()) {
Field field = ReflectionUtils.findField(endpointConfigurationType, parameterEntry.getKey());
if (field == null) {
if (paramString.length() == 0) {
paramString.append("?").append(parameterEntry.getKey());
if (parameterEntry.getValue() != null) {
paramString.append("=").append(parameterEntry.getValue());
}
} else {
paramString.append("&").append(parameterEntry.getKey());
if (parameterEntry.getValue() != null) {
paramString.append("=").append(parameterEntry.getValue());
}
}
}
}
return paramString.toString();
} | java | protected String getParameterString(Map<String, String> parameters,
Class<? extends EndpointConfiguration> endpointConfigurationType) {
StringBuilder paramString = new StringBuilder();
for (Map.Entry<String, String> parameterEntry : parameters.entrySet()) {
Field field = ReflectionUtils.findField(endpointConfigurationType, parameterEntry.getKey());
if (field == null) {
if (paramString.length() == 0) {
paramString.append("?").append(parameterEntry.getKey());
if (parameterEntry.getValue() != null) {
paramString.append("=").append(parameterEntry.getValue());
}
} else {
paramString.append("&").append(parameterEntry.getKey());
if (parameterEntry.getValue() != null) {
paramString.append("=").append(parameterEntry.getValue());
}
}
}
}
return paramString.toString();
} | [
"protected",
"String",
"getParameterString",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"parameters",
",",
"Class",
"<",
"?",
"extends",
"EndpointConfiguration",
">",
"endpointConfigurationType",
")",
"{",
"StringBuilder",
"paramString",
"=",
"new",
"StringBuild... | Filters non endpoint configuration parameters from parameter list and puts them
together as parameters string. According to given endpoint configuration type only non
endpoint configuration settings are added to parameter string.
@param parameters
@param endpointConfigurationType
@return | [
"Filters",
"non",
"endpoint",
"configuration",
"parameters",
"from",
"parameter",
"list",
"and",
"puts",
"them",
"together",
"as",
"parameters",
"string",
".",
"According",
"to",
"given",
"endpoint",
"configuration",
"type",
"only",
"non",
"endpoint",
"configuration... | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/endpoint/AbstractEndpointComponent.java#L166-L189 | train |
citrusframework/citrus | modules/citrus-docker/src/main/java/com/consol/citrus/docker/client/DockerEndpointConfiguration.java | DockerEndpointConfiguration.createDockerClient | private com.github.dockerjava.api.DockerClient createDockerClient() {
return DockerClientImpl.getInstance(getDockerClientConfig())
.withDockerCmdExecFactory(new JerseyDockerCmdExecFactory());
} | java | private com.github.dockerjava.api.DockerClient createDockerClient() {
return DockerClientImpl.getInstance(getDockerClientConfig())
.withDockerCmdExecFactory(new JerseyDockerCmdExecFactory());
} | [
"private",
"com",
".",
"github",
".",
"dockerjava",
".",
"api",
".",
"DockerClient",
"createDockerClient",
"(",
")",
"{",
"return",
"DockerClientImpl",
".",
"getInstance",
"(",
"getDockerClientConfig",
"(",
")",
")",
".",
"withDockerCmdExecFactory",
"(",
"new",
... | Creates new Docker client instance with configuration.
@return | [
"Creates",
"new",
"Docker",
"client",
"instance",
"with",
"configuration",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-docker/src/main/java/com/consol/citrus/docker/client/DockerEndpointConfiguration.java#L44-L47 | train |
citrusframework/citrus | modules/citrus-docker/src/main/java/com/consol/citrus/docker/client/DockerEndpointConfiguration.java | DockerEndpointConfiguration.getDockerClient | public com.github.dockerjava.api.DockerClient getDockerClient() {
if (dockerClient == null) {
dockerClient = createDockerClient();
}
return dockerClient;
} | java | public com.github.dockerjava.api.DockerClient getDockerClient() {
if (dockerClient == null) {
dockerClient = createDockerClient();
}
return dockerClient;
} | [
"public",
"com",
".",
"github",
".",
"dockerjava",
".",
"api",
".",
"DockerClient",
"getDockerClient",
"(",
")",
"{",
"if",
"(",
"dockerClient",
"==",
"null",
")",
"{",
"dockerClient",
"=",
"createDockerClient",
"(",
")",
";",
"}",
"return",
"dockerClient",
... | Constructs or gets the docker client implementation.
@return | [
"Constructs",
"or",
"gets",
"the",
"docker",
"client",
"implementation",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-docker/src/main/java/com/consol/citrus/docker/client/DockerEndpointConfiguration.java#L53-L59 | train |
citrusframework/citrus | modules/citrus-jms/src/main/java/com/consol/citrus/jms/actions/PurgeJmsQueuesAction.java | PurgeJmsQueuesAction.purgeQueue | private void purgeQueue(String queueName, Session session) throws JMSException {
purgeDestination(getDestination(session, queueName), session, queueName);
} | java | private void purgeQueue(String queueName, Session session) throws JMSException {
purgeDestination(getDestination(session, queueName), session, queueName);
} | [
"private",
"void",
"purgeQueue",
"(",
"String",
"queueName",
",",
"Session",
"session",
")",
"throws",
"JMSException",
"{",
"purgeDestination",
"(",
"getDestination",
"(",
"session",
",",
"queueName",
")",
",",
"session",
",",
"queueName",
")",
";",
"}"
] | Purges a queue destination identified by its name.
@param queueName
@param session
@throws JMSException | [
"Purges",
"a",
"queue",
"destination",
"identified",
"by",
"its",
"name",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-jms/src/main/java/com/consol/citrus/jms/actions/PurgeJmsQueuesAction.java#L107-L109 | train |
citrusframework/citrus | modules/citrus-jms/src/main/java/com/consol/citrus/jms/actions/PurgeJmsQueuesAction.java | PurgeJmsQueuesAction.purgeQueue | private void purgeQueue(Queue queue, Session session) throws JMSException {
purgeDestination(queue, session, queue.getQueueName());
} | java | private void purgeQueue(Queue queue, Session session) throws JMSException {
purgeDestination(queue, session, queue.getQueueName());
} | [
"private",
"void",
"purgeQueue",
"(",
"Queue",
"queue",
",",
"Session",
"session",
")",
"throws",
"JMSException",
"{",
"purgeDestination",
"(",
"queue",
",",
"session",
",",
"queue",
".",
"getQueueName",
"(",
")",
")",
";",
"}"
] | Purges a queue destination.
@param queue
@param session
@throws JMSException | [
"Purges",
"a",
"queue",
"destination",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-jms/src/main/java/com/consol/citrus/jms/actions/PurgeJmsQueuesAction.java#L117-L119 | train |
citrusframework/citrus | modules/citrus-jms/src/main/java/com/consol/citrus/jms/actions/PurgeJmsQueuesAction.java | PurgeJmsQueuesAction.purgeDestination | private void purgeDestination(Destination destination, Session session, String destinationName) throws JMSException {
if (log.isDebugEnabled()) {
log.debug("Try to purge destination " + destinationName);
}
int messagesPurged = 0;
MessageConsumer messageConsumer = session.createConsumer(destination);
try {
javax.jms.Message message;
do {
message = (receiveTimeout >= 0) ? messageConsumer.receive(receiveTimeout) : messageConsumer.receive();
if (message != null) {
log.debug("Removed message from destination " + destinationName);
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 destination");
}
} finally {
JmsUtils.closeMessageConsumer(messageConsumer);
}
} | java | private void purgeDestination(Destination destination, Session session, String destinationName) throws JMSException {
if (log.isDebugEnabled()) {
log.debug("Try to purge destination " + destinationName);
}
int messagesPurged = 0;
MessageConsumer messageConsumer = session.createConsumer(destination);
try {
javax.jms.Message message;
do {
message = (receiveTimeout >= 0) ? messageConsumer.receive(receiveTimeout) : messageConsumer.receive();
if (message != null) {
log.debug("Removed message from destination " + destinationName);
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 destination");
}
} finally {
JmsUtils.closeMessageConsumer(messageConsumer);
}
} | [
"private",
"void",
"purgeDestination",
"(",
"Destination",
"destination",
",",
"Session",
"session",
",",
"String",
"destinationName",
")",
"throws",
"JMSException",
"{",
"if",
"(",
"log",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"log",
".",
"debug",
"(",
... | Purge destination by receiving all available messages.
@param destination
@param session
@param destinationName
@throws JMSException | [
"Purge",
"destination",
"by",
"receiving",
"all",
"available",
"messages",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-jms/src/main/java/com/consol/citrus/jms/actions/PurgeJmsQueuesAction.java#L128-L158 | train |
citrusframework/citrus | modules/citrus-jms/src/main/java/com/consol/citrus/jms/actions/PurgeJmsQueuesAction.java | PurgeJmsQueuesAction.getDestination | private Destination getDestination(Session session, String queueName) throws JMSException {
return new DynamicDestinationResolver().resolveDestinationName(session, queueName, false);
} | java | private Destination getDestination(Session session, String queueName) throws JMSException {
return new DynamicDestinationResolver().resolveDestinationName(session, queueName, false);
} | [
"private",
"Destination",
"getDestination",
"(",
"Session",
"session",
",",
"String",
"queueName",
")",
"throws",
"JMSException",
"{",
"return",
"new",
"DynamicDestinationResolver",
"(",
")",
".",
"resolveDestinationName",
"(",
"session",
",",
"queueName",
",",
"fal... | Resolves destination by given name.
@param session
@param queueName
@return
@throws JMSException | [
"Resolves",
"destination",
"by",
"given",
"name",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-jms/src/main/java/com/consol/citrus/jms/actions/PurgeJmsQueuesAction.java#L167-L169 | train |
citrusframework/citrus | modules/citrus-jms/src/main/java/com/consol/citrus/jms/actions/PurgeJmsQueuesAction.java | PurgeJmsQueuesAction.createConnection | protected Connection createConnection() throws JMSException {
if (connectionFactory instanceof QueueConnectionFactory) {
return ((QueueConnectionFactory) connectionFactory).createQueueConnection();
}
return connectionFactory.createConnection();
} | java | protected Connection createConnection() throws JMSException {
if (connectionFactory instanceof QueueConnectionFactory) {
return ((QueueConnectionFactory) connectionFactory).createQueueConnection();
}
return connectionFactory.createConnection();
} | [
"protected",
"Connection",
"createConnection",
"(",
")",
"throws",
"JMSException",
"{",
"if",
"(",
"connectionFactory",
"instanceof",
"QueueConnectionFactory",
")",
"{",
"return",
"(",
"(",
"QueueConnectionFactory",
")",
"connectionFactory",
")",
".",
"createQueueConnec... | Create queue connection.
@return
@throws JMSException | [
"Create",
"queue",
"connection",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-jms/src/main/java/com/consol/citrus/jms/actions/PurgeJmsQueuesAction.java#L176-L181 | train |
citrusframework/citrus | modules/citrus-jms/src/main/java/com/consol/citrus/jms/actions/PurgeJmsQueuesAction.java | PurgeJmsQueuesAction.createSession | protected Session createSession(Connection connection) throws JMSException {
if (connection instanceof QueueConnection) {
return ((QueueConnection) connection).createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
}
return connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
} | java | protected Session createSession(Connection connection) throws JMSException {
if (connection instanceof QueueConnection) {
return ((QueueConnection) connection).createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
}
return connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
} | [
"protected",
"Session",
"createSession",
"(",
"Connection",
"connection",
")",
"throws",
"JMSException",
"{",
"if",
"(",
"connection",
"instanceof",
"QueueConnection",
")",
"{",
"return",
"(",
"(",
"QueueConnection",
")",
"connection",
")",
".",
"createQueueSession"... | Create queue session.
@param connection
@return
@throws JMSException | [
"Create",
"queue",
"session",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-jms/src/main/java/com/consol/citrus/jms/actions/PurgeJmsQueuesAction.java#L189-L194 | train |
citrusframework/citrus | modules/citrus-http/src/main/java/com/consol/citrus/http/security/SecurityHandlerFactory.java | SecurityHandlerFactory.getObject | public SecurityHandler getObject() throws Exception {
ConstraintSecurityHandler securityHandler = new ConstraintSecurityHandler();
securityHandler.setAuthenticator(authenticator);
securityHandler.setRealmName(realm);
for (Entry<String, Constraint> constraint : constraints.entrySet()) {
ConstraintMapping constraintMapping = new ConstraintMapping();
constraintMapping.setConstraint(constraint.getValue());
constraintMapping.setPathSpec(constraint.getKey());
securityHandler.addConstraintMapping(constraintMapping);
}
securityHandler.setLoginService(loginService);
return securityHandler;
} | java | public SecurityHandler getObject() throws Exception {
ConstraintSecurityHandler securityHandler = new ConstraintSecurityHandler();
securityHandler.setAuthenticator(authenticator);
securityHandler.setRealmName(realm);
for (Entry<String, Constraint> constraint : constraints.entrySet()) {
ConstraintMapping constraintMapping = new ConstraintMapping();
constraintMapping.setConstraint(constraint.getValue());
constraintMapping.setPathSpec(constraint.getKey());
securityHandler.addConstraintMapping(constraintMapping);
}
securityHandler.setLoginService(loginService);
return securityHandler;
} | [
"public",
"SecurityHandler",
"getObject",
"(",
")",
"throws",
"Exception",
"{",
"ConstraintSecurityHandler",
"securityHandler",
"=",
"new",
"ConstraintSecurityHandler",
"(",
")",
";",
"securityHandler",
".",
"setAuthenticator",
"(",
"authenticator",
")",
";",
"securityH... | Construct new security handler for basic authentication. | [
"Construct",
"new",
"security",
"handler",
"for",
"basic",
"authentication",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-http/src/main/java/com/consol/citrus/http/security/SecurityHandlerFactory.java#L59-L75 | train |
citrusframework/citrus | modules/citrus-http/src/main/java/com/consol/citrus/http/security/SecurityHandlerFactory.java | SecurityHandlerFactory.afterPropertiesSet | public void afterPropertiesSet() throws Exception {
if (loginService == null) {
loginService = new SimpleLoginService();
((SimpleLoginService) loginService).setName(realm);
}
} | java | public void afterPropertiesSet() throws Exception {
if (loginService == null) {
loginService = new SimpleLoginService();
((SimpleLoginService) loginService).setName(realm);
}
} | [
"public",
"void",
"afterPropertiesSet",
"(",
")",
"throws",
"Exception",
"{",
"if",
"(",
"loginService",
"==",
"null",
")",
"{",
"loginService",
"=",
"new",
"SimpleLoginService",
"(",
")",
";",
"(",
"(",
"SimpleLoginService",
")",
"loginService",
")",
".",
"... | Initialize member variables if not set by user in application context. | [
"Initialize",
"member",
"variables",
"if",
"not",
"set",
"by",
"user",
"in",
"application",
"context",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-http/src/main/java/com/consol/citrus/http/security/SecurityHandlerFactory.java#L80-L85 | train |
citrusframework/citrus | modules/citrus-ftp/src/main/java/com/consol/citrus/ftp/server/FtpServerFtpLet.java | FtpServerFtpLet.writeFtpReply | private void writeFtpReply(FtpSession session, FtpMessage response) {
try {
CommandResultType commandResult = response.getPayload(CommandResultType.class);
FtpReply reply = new DefaultFtpReply(Integer.valueOf(commandResult.getReplyCode()), commandResult.getReplyString());
session.write(reply);
} catch (FtpException e) {
throw new CitrusRuntimeException("Failed to write ftp reply", e);
}
} | java | private void writeFtpReply(FtpSession session, FtpMessage response) {
try {
CommandResultType commandResult = response.getPayload(CommandResultType.class);
FtpReply reply = new DefaultFtpReply(Integer.valueOf(commandResult.getReplyCode()), commandResult.getReplyString());
session.write(reply);
} catch (FtpException e) {
throw new CitrusRuntimeException("Failed to write ftp reply", e);
}
} | [
"private",
"void",
"writeFtpReply",
"(",
"FtpSession",
"session",
",",
"FtpMessage",
"response",
")",
"{",
"try",
"{",
"CommandResultType",
"commandResult",
"=",
"response",
".",
"getPayload",
"(",
"CommandResultType",
".",
"class",
")",
";",
"FtpReply",
"reply",
... | Construct ftp reply from response message and write reply to given session.
@param session
@param response | [
"Construct",
"ftp",
"reply",
"from",
"response",
"message",
"and",
"write",
"reply",
"to",
"given",
"session",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-ftp/src/main/java/com/consol/citrus/ftp/server/FtpServerFtpLet.java#L171-L180 | train |
citrusframework/citrus | modules/citrus-core/src/main/java/com/consol/citrus/functions/FunctionParameterHelper.java | FunctionParameterHelper.getParameterList | public static List<String> getParameterList(String parameterString) {
List<String> parameterList = new ArrayList<>();
StringTokenizer tok = new StringTokenizer(parameterString, ",");
while (tok.hasMoreElements()) {
String param = tok.nextToken().trim();
parameterList.add(cutOffSingleQuotes(param));
}
List<String> postProcessed = new ArrayList<>();
for (int i = 0; i < parameterList.size(); i++) {
int next = i + 1;
String processed = parameterList.get(i);
if (processed.startsWith("'") && !processed.endsWith("'")) {
while (next < parameterList.size()) {
if (parameterString.contains(processed + ", " + parameterList.get(next))) {
processed += ", " + parameterList.get(next);
} else if (parameterString.contains(processed + "," + parameterList.get(next))) {
processed += "," + parameterList.get(next);
} else if (parameterString.contains(processed + " , " + parameterList.get(next))) {
processed += " , " + parameterList.get(next);
} else {
processed += parameterList.get(next);
}
i++;
if (parameterList.get(next).endsWith("'")) {
break;
} else {
next++;
}
}
}
postProcessed.add(cutOffSingleQuotes(processed));
}
return postProcessed;
} | java | public static List<String> getParameterList(String parameterString) {
List<String> parameterList = new ArrayList<>();
StringTokenizer tok = new StringTokenizer(parameterString, ",");
while (tok.hasMoreElements()) {
String param = tok.nextToken().trim();
parameterList.add(cutOffSingleQuotes(param));
}
List<String> postProcessed = new ArrayList<>();
for (int i = 0; i < parameterList.size(); i++) {
int next = i + 1;
String processed = parameterList.get(i);
if (processed.startsWith("'") && !processed.endsWith("'")) {
while (next < parameterList.size()) {
if (parameterString.contains(processed + ", " + parameterList.get(next))) {
processed += ", " + parameterList.get(next);
} else if (parameterString.contains(processed + "," + parameterList.get(next))) {
processed += "," + parameterList.get(next);
} else if (parameterString.contains(processed + " , " + parameterList.get(next))) {
processed += " , " + parameterList.get(next);
} else {
processed += parameterList.get(next);
}
i++;
if (parameterList.get(next).endsWith("'")) {
break;
} else {
next++;
}
}
}
postProcessed.add(cutOffSingleQuotes(processed));
}
return postProcessed;
} | [
"public",
"static",
"List",
"<",
"String",
">",
"getParameterList",
"(",
"String",
"parameterString",
")",
"{",
"List",
"<",
"String",
">",
"parameterList",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"StringTokenizer",
"tok",
"=",
"new",
"StringTokenizer",
... | Convert a parameter string to a list of parameters.
@param parameterString comma separated parameter string.
@return list of parameters. | [
"Convert",
"a",
"parameter",
"string",
"to",
"a",
"list",
"of",
"parameters",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/functions/FunctionParameterHelper.java#L41-L82 | train |
citrusframework/citrus | modules/citrus-core/src/main/java/com/consol/citrus/container/AbstractIteratingActionContainer.java | AbstractIteratingActionContainer.executeActions | protected void executeActions(TestContext context) {
context.setVariable(indexName, String.valueOf(index));
for (TestAction action: actions) {
setActiveAction(action);
action.execute(context);
}
} | java | protected void executeActions(TestContext context) {
context.setVariable(indexName, String.valueOf(index));
for (TestAction action: actions) {
setActiveAction(action);
action.execute(context);
}
} | [
"protected",
"void",
"executeActions",
"(",
"TestContext",
"context",
")",
"{",
"context",
".",
"setVariable",
"(",
"indexName",
",",
"String",
".",
"valueOf",
"(",
"index",
")",
")",
";",
"for",
"(",
"TestAction",
"action",
":",
"actions",
")",
"{",
"setA... | Executes the nested test actions.
@param context | [
"Executes",
"the",
"nested",
"test",
"actions",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/container/AbstractIteratingActionContainer.java#L63-L70 | train |
citrusframework/citrus | modules/citrus-core/src/main/java/com/consol/citrus/container/AbstractIteratingActionContainer.java | AbstractIteratingActionContainer.checkCondition | protected boolean checkCondition(TestContext context) {
if (conditionExpression != null) {
return conditionExpression.evaluate(index, context);
}
// replace dynamic content with each iteration
String conditionString = condition;
if (conditionString.indexOf(Citrus.VARIABLE_PREFIX + indexName + Citrus.VARIABLE_SUFFIX) != -1) {
Properties props = new Properties();
props.put(indexName, String.valueOf(index));
conditionString = new PropertyPlaceholderHelper(Citrus.VARIABLE_PREFIX, Citrus.VARIABLE_SUFFIX).replacePlaceholders(conditionString, props);
}
conditionString = context.replaceDynamicContentInString(conditionString);
if (ValidationMatcherUtils.isValidationMatcherExpression(conditionString)) {
try {
ValidationMatcherUtils.resolveValidationMatcher("iteratingCondition", String.valueOf(index), conditionString, context);
return true;
} catch (AssertionError e) {
return false;
}
}
if (conditionString.indexOf(indexName) != -1) {
conditionString = conditionString.replaceAll(indexName, String.valueOf(index));
}
return BooleanExpressionParser.evaluate(conditionString);
} | java | protected boolean checkCondition(TestContext context) {
if (conditionExpression != null) {
return conditionExpression.evaluate(index, context);
}
// replace dynamic content with each iteration
String conditionString = condition;
if (conditionString.indexOf(Citrus.VARIABLE_PREFIX + indexName + Citrus.VARIABLE_SUFFIX) != -1) {
Properties props = new Properties();
props.put(indexName, String.valueOf(index));
conditionString = new PropertyPlaceholderHelper(Citrus.VARIABLE_PREFIX, Citrus.VARIABLE_SUFFIX).replacePlaceholders(conditionString, props);
}
conditionString = context.replaceDynamicContentInString(conditionString);
if (ValidationMatcherUtils.isValidationMatcherExpression(conditionString)) {
try {
ValidationMatcherUtils.resolveValidationMatcher("iteratingCondition", String.valueOf(index), conditionString, context);
return true;
} catch (AssertionError e) {
return false;
}
}
if (conditionString.indexOf(indexName) != -1) {
conditionString = conditionString.replaceAll(indexName, String.valueOf(index));
}
return BooleanExpressionParser.evaluate(conditionString);
} | [
"protected",
"boolean",
"checkCondition",
"(",
"TestContext",
"context",
")",
"{",
"if",
"(",
"conditionExpression",
"!=",
"null",
")",
"{",
"return",
"conditionExpression",
".",
"evaluate",
"(",
"index",
",",
"context",
")",
";",
"}",
"// replace dynamic content ... | Check aborting condition.
@return | [
"Check",
"aborting",
"condition",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/container/AbstractIteratingActionContainer.java#L76-L105 | train |
citrusframework/citrus | modules/citrus-cucumber/src/main/java/cucumber/runtime/java/CitrusBackend.java | CitrusBackend.getObjectFactory | private ObjectFactory getObjectFactory() throws IllegalAccessException {
if (Env.INSTANCE.get(ObjectFactory.class.getName()).equals(CitrusObjectFactory.class.getName())) {
return CitrusObjectFactory.instance();
} else if (Env.INSTANCE.get(ObjectFactory.class.getName()).equals(CitrusSpringObjectFactory.class.getName())) {
return CitrusSpringObjectFactory.instance();
}
return ObjectFactoryLoader.loadObjectFactory(new ResourceLoaderClassFinder(resourceLoader, Thread.currentThread().getContextClassLoader()),
Env.INSTANCE.get(ObjectFactory.class.getName()));
} | java | private ObjectFactory getObjectFactory() throws IllegalAccessException {
if (Env.INSTANCE.get(ObjectFactory.class.getName()).equals(CitrusObjectFactory.class.getName())) {
return CitrusObjectFactory.instance();
} else if (Env.INSTANCE.get(ObjectFactory.class.getName()).equals(CitrusSpringObjectFactory.class.getName())) {
return CitrusSpringObjectFactory.instance();
}
return ObjectFactoryLoader.loadObjectFactory(new ResourceLoaderClassFinder(resourceLoader, Thread.currentThread().getContextClassLoader()),
Env.INSTANCE.get(ObjectFactory.class.getName()));
} | [
"private",
"ObjectFactory",
"getObjectFactory",
"(",
")",
"throws",
"IllegalAccessException",
"{",
"if",
"(",
"Env",
".",
"INSTANCE",
".",
"get",
"(",
"ObjectFactory",
".",
"class",
".",
"getName",
"(",
")",
")",
".",
"equals",
"(",
"CitrusObjectFactory",
".",... | Gets the object factory instance that is configured in environment.
@return | [
"Gets",
"the",
"object",
"factory",
"instance",
"that",
"is",
"configured",
"in",
"environment",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-cucumber/src/main/java/cucumber/runtime/java/CitrusBackend.java#L111-L120 | train |
citrusframework/citrus | modules/citrus-cucumber/src/main/java/cucumber/runtime/java/CitrusBackend.java | CitrusBackend.initializeCitrus | public static void initializeCitrus(ApplicationContext applicationContext) {
if (citrus != null) {
if (!citrus.getApplicationContext().equals(applicationContext)) {
log.warn("Citrus instance has already been initialized - creating new instance and shutting down current instance");
if (citrus.getApplicationContext() instanceof ConfigurableApplicationContext) {
((ConfigurableApplicationContext) citrus.getApplicationContext()).stop();
}
} else {
return;
}
}
citrus = Citrus.newInstance(applicationContext);
} | java | public static void initializeCitrus(ApplicationContext applicationContext) {
if (citrus != null) {
if (!citrus.getApplicationContext().equals(applicationContext)) {
log.warn("Citrus instance has already been initialized - creating new instance and shutting down current instance");
if (citrus.getApplicationContext() instanceof ConfigurableApplicationContext) {
((ConfigurableApplicationContext) citrus.getApplicationContext()).stop();
}
} else {
return;
}
}
citrus = Citrus.newInstance(applicationContext);
} | [
"public",
"static",
"void",
"initializeCitrus",
"(",
"ApplicationContext",
"applicationContext",
")",
"{",
"if",
"(",
"citrus",
"!=",
"null",
")",
"{",
"if",
"(",
"!",
"citrus",
".",
"getApplicationContext",
"(",
")",
".",
"equals",
"(",
"applicationContext",
... | Initializes Citrus instance with given application context.
@param applicationContext
@return | [
"Initializes",
"Citrus",
"instance",
"with",
"given",
"application",
"context",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-cucumber/src/main/java/cucumber/runtime/java/CitrusBackend.java#L139-L153 | train |
citrusframework/citrus | modules/citrus-core/src/main/java/com/consol/citrus/actions/ExecuteSQLAction.java | ExecuteSQLAction.executeStatements | protected void executeStatements(TestContext context) {
for (String stmt : statements) {
try {
final String toExecute;
if (stmt.trim().endsWith(";")) {
toExecute = context.replaceDynamicContentInString(stmt.trim().substring(0, stmt.trim().length()-1));
} else {
toExecute = context.replaceDynamicContentInString(stmt.trim());
}
if (log.isDebugEnabled()) {
log.debug("Executing SQL statement: " + toExecute);
}
getJdbcTemplate().execute(toExecute);
log.info("SQL statement execution successful");
} catch (Exception e) {
if (ignoreErrors) {
log.error("Ignoring error while executing SQL statement: " + e.getLocalizedMessage());
continue;
} else {
throw new CitrusRuntimeException(e);
}
}
}
} | java | protected void executeStatements(TestContext context) {
for (String stmt : statements) {
try {
final String toExecute;
if (stmt.trim().endsWith(";")) {
toExecute = context.replaceDynamicContentInString(stmt.trim().substring(0, stmt.trim().length()-1));
} else {
toExecute = context.replaceDynamicContentInString(stmt.trim());
}
if (log.isDebugEnabled()) {
log.debug("Executing SQL statement: " + toExecute);
}
getJdbcTemplate().execute(toExecute);
log.info("SQL statement execution successful");
} catch (Exception e) {
if (ignoreErrors) {
log.error("Ignoring error while executing SQL statement: " + e.getLocalizedMessage());
continue;
} else {
throw new CitrusRuntimeException(e);
}
}
}
} | [
"protected",
"void",
"executeStatements",
"(",
"TestContext",
"context",
")",
"{",
"for",
"(",
"String",
"stmt",
":",
"statements",
")",
"{",
"try",
"{",
"final",
"String",
"toExecute",
";",
"if",
"(",
"stmt",
".",
"trim",
"(",
")",
".",
"endsWith",
"(",... | Run all SQL statements.
@param context | [
"Run",
"all",
"SQL",
"statements",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/actions/ExecuteSQLAction.java#L71-L98 | train |
citrusframework/citrus | modules/citrus-core/src/main/java/com/consol/citrus/validation/json/report/GraciousProcessingReport.java | GraciousProcessingReport.dispatch | private void dispatch(final ProcessingMessage message) throws ProcessingException {
final LogLevel level = message.getLogLevel();
if (level.compareTo(exceptionThreshold) >= 0)
throw message.asException();
if (level.compareTo(currentLevel) > 0)
currentLevel = level;
if (level.compareTo(logLevel) >= 0)
log(message);
} | java | private void dispatch(final ProcessingMessage message) throws ProcessingException {
final LogLevel level = message.getLogLevel();
if (level.compareTo(exceptionThreshold) >= 0)
throw message.asException();
if (level.compareTo(currentLevel) > 0)
currentLevel = level;
if (level.compareTo(logLevel) >= 0)
log(message);
} | [
"private",
"void",
"dispatch",
"(",
"final",
"ProcessingMessage",
"message",
")",
"throws",
"ProcessingException",
"{",
"final",
"LogLevel",
"level",
"=",
"message",
".",
"getLogLevel",
"(",
")",
";",
"if",
"(",
"level",
".",
"compareTo",
"(",
"exceptionThreshol... | Main dispatch method
All messages logged go through this method. According to the report
configuration, the message will either be ignored, logged or raise an
exception.
@param message the message to log
@throws ProcessingException the message's level and report configuration
require that an exception be thrown | [
"Main",
"dispatch",
"method"
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/validation/json/report/GraciousProcessingReport.java#L141-L150 | train |
citrusframework/citrus | modules/citrus-http/src/main/java/com/consol/citrus/http/server/HttpServer.java | HttpServer.addRequestCachingFilter | private void addRequestCachingFilter() {
FilterMapping filterMapping = new FilterMapping();
filterMapping.setFilterName("request-caching-filter");
filterMapping.setPathSpec("/*");
FilterHolder filterHolder = new FilterHolder(new RequestCachingServletFilter());
filterHolder.setName("request-caching-filter");
servletHandler.addFilter(filterHolder, filterMapping);
} | java | private void addRequestCachingFilter() {
FilterMapping filterMapping = new FilterMapping();
filterMapping.setFilterName("request-caching-filter");
filterMapping.setPathSpec("/*");
FilterHolder filterHolder = new FilterHolder(new RequestCachingServletFilter());
filterHolder.setName("request-caching-filter");
servletHandler.addFilter(filterHolder, filterMapping);
} | [
"private",
"void",
"addRequestCachingFilter",
"(",
")",
"{",
"FilterMapping",
"filterMapping",
"=",
"new",
"FilterMapping",
"(",
")",
";",
"filterMapping",
".",
"setFilterName",
"(",
"\"request-caching-filter\"",
")",
";",
"filterMapping",
".",
"setPathSpec",
"(",
"... | Adds request caching filter used for not using request data when
logging incoming requests | [
"Adds",
"request",
"caching",
"filter",
"used",
"for",
"not",
"using",
"request",
"data",
"when",
"logging",
"incoming",
"requests"
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-http/src/main/java/com/consol/citrus/http/server/HttpServer.java#L240-L248 | train |
citrusframework/citrus | modules/citrus-http/src/main/java/com/consol/citrus/http/server/HttpServer.java | HttpServer.addGzipFilter | private void addGzipFilter() {
FilterMapping filterMapping = new FilterMapping();
filterMapping.setFilterName("gzip-filter");
filterMapping.setPathSpec("/*");
FilterHolder filterHolder = new FilterHolder(new GzipServletFilter());
filterHolder.setName("gzip-filter");
servletHandler.addFilter(filterHolder, filterMapping);
} | java | private void addGzipFilter() {
FilterMapping filterMapping = new FilterMapping();
filterMapping.setFilterName("gzip-filter");
filterMapping.setPathSpec("/*");
FilterHolder filterHolder = new FilterHolder(new GzipServletFilter());
filterHolder.setName("gzip-filter");
servletHandler.addFilter(filterHolder, filterMapping);
} | [
"private",
"void",
"addGzipFilter",
"(",
")",
"{",
"FilterMapping",
"filterMapping",
"=",
"new",
"FilterMapping",
"(",
")",
";",
"filterMapping",
".",
"setFilterName",
"(",
"\"gzip-filter\"",
")",
";",
"filterMapping",
".",
"setPathSpec",
"(",
"\"/*\"",
")",
";"... | Adds gzip filter for automatic response messages compressing. | [
"Adds",
"gzip",
"filter",
"for",
"automatic",
"response",
"messages",
"compressing",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-http/src/main/java/com/consol/citrus/http/server/HttpServer.java#L253-L261 | train |
citrusframework/citrus | modules/citrus-core/src/main/java/com/consol/citrus/variable/dictionary/xml/XpathMappingDataDictionary.java | XpathMappingDataDictionary.containsNode | private boolean containsNode(NodeList findings, Node node) {
for (int i = 0; i < findings.getLength(); i++) {
if (findings.item(i).equals(node)) {
return true;
}
}
return false;
} | java | private boolean containsNode(NodeList findings, Node node) {
for (int i = 0; i < findings.getLength(); i++) {
if (findings.item(i).equals(node)) {
return true;
}
}
return false;
} | [
"private",
"boolean",
"containsNode",
"(",
"NodeList",
"findings",
",",
"Node",
"node",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"findings",
".",
"getLength",
"(",
")",
";",
"i",
"++",
")",
"{",
"if",
"(",
"findings",
".",
"item",... | Checks if given node set contains node.
@param findings
@param node
@return | [
"Checks",
"if",
"given",
"node",
"set",
"contains",
"node",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/variable/dictionary/xml/XpathMappingDataDictionary.java#L75-L83 | train |
citrusframework/citrus | modules/citrus-core/src/main/java/com/consol/citrus/variable/dictionary/xml/XpathMappingDataDictionary.java | XpathMappingDataDictionary.buildNamespaceContext | private NamespaceContext buildNamespaceContext(Node node) {
SimpleNamespaceContext simpleNamespaceContext = new SimpleNamespaceContext();
Map<String, String> namespaces = XMLUtils.lookupNamespaces(node.getOwnerDocument());
// add default namespace mappings
namespaces.putAll(namespaceContextBuilder.getNamespaceMappings());
simpleNamespaceContext.setBindings(namespaces);
return simpleNamespaceContext;
} | java | private NamespaceContext buildNamespaceContext(Node node) {
SimpleNamespaceContext simpleNamespaceContext = new SimpleNamespaceContext();
Map<String, String> namespaces = XMLUtils.lookupNamespaces(node.getOwnerDocument());
// add default namespace mappings
namespaces.putAll(namespaceContextBuilder.getNamespaceMappings());
simpleNamespaceContext.setBindings(namespaces);
return simpleNamespaceContext;
} | [
"private",
"NamespaceContext",
"buildNamespaceContext",
"(",
"Node",
"node",
")",
"{",
"SimpleNamespaceContext",
"simpleNamespaceContext",
"=",
"new",
"SimpleNamespaceContext",
"(",
")",
";",
"Map",
"<",
"String",
",",
"String",
">",
"namespaces",
"=",
"XMLUtils",
"... | Builds namespace context with dynamic lookup on received node document and global namespace mappings from
namespace context builder.
@param node the element node from message
@return | [
"Builds",
"namespace",
"context",
"with",
"dynamic",
"lookup",
"on",
"received",
"node",
"document",
"and",
"global",
"namespace",
"mappings",
"from",
"namespace",
"context",
"builder",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/variable/dictionary/xml/XpathMappingDataDictionary.java#L91-L101 | train |
citrusframework/citrus | modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/builder/ZooActionBuilder.java | ZooActionBuilder.delete | public Delete delete(String path) {
Delete command = new Delete();
command.path(path);
command.version(DEFAULT_VERSION);
action.setCommand(command);
return command;
} | java | public Delete delete(String path) {
Delete command = new Delete();
command.path(path);
command.version(DEFAULT_VERSION);
action.setCommand(command);
return command;
} | [
"public",
"Delete",
"delete",
"(",
"String",
"path",
")",
"{",
"Delete",
"command",
"=",
"new",
"Delete",
"(",
")",
";",
"command",
".",
"path",
"(",
"path",
")",
";",
"command",
".",
"version",
"(",
"DEFAULT_VERSION",
")",
";",
"action",
".",
"setComm... | Adds a delete command. | [
"Adds",
"a",
"delete",
"command",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/builder/ZooActionBuilder.java#L82-L88 | train |
citrusframework/citrus | modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/builder/ZooActionBuilder.java | ZooActionBuilder.get | public GetData get(String path) {
GetData command = new GetData();
command.path(path);
action.setCommand(command);
return command;
} | java | public GetData get(String path) {
GetData command = new GetData();
command.path(path);
action.setCommand(command);
return command;
} | [
"public",
"GetData",
"get",
"(",
"String",
"path",
")",
"{",
"GetData",
"command",
"=",
"new",
"GetData",
"(",
")",
";",
"command",
".",
"path",
"(",
"path",
")",
";",
"action",
".",
"setCommand",
"(",
"command",
")",
";",
"return",
"command",
";",
"... | Adds a get-data command. | [
"Adds",
"a",
"get",
"-",
"data",
"command",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/builder/ZooActionBuilder.java#L113-L118 | train |
citrusframework/citrus | modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/builder/ZooActionBuilder.java | ZooActionBuilder.set | public SetData set(String path, String data) {
SetData command = new SetData();
command.path(path);
command.data(data);
command.version(0);
action.setCommand(command);
return command;
} | java | public SetData set(String path, String data) {
SetData command = new SetData();
command.path(path);
command.data(data);
command.version(0);
action.setCommand(command);
return command;
} | [
"public",
"SetData",
"set",
"(",
"String",
"path",
",",
"String",
"data",
")",
"{",
"SetData",
"command",
"=",
"new",
"SetData",
"(",
")",
";",
"command",
".",
"path",
"(",
"path",
")",
";",
"command",
".",
"data",
"(",
"data",
")",
";",
"command",
... | Adds a set-data command. | [
"Adds",
"a",
"set",
"-",
"data",
"command",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/builder/ZooActionBuilder.java#L132-L139 | train |
citrusframework/citrus | modules/citrus-ws/src/main/java/com/consol/citrus/ws/interceptor/LoggingClientInterceptor.java | LoggingClientInterceptor.handleRequest | public boolean handleRequest(MessageContext messageContext) throws WebServiceClientException {
try {
logRequest("Sending SOAP request", messageContext, false);
} catch (SoapEnvelopeException e) {
log.warn("Unable to write SOAP request to logger", e);
} catch (TransformerException e) {
log.warn("Unable to write SOAP request to logger", e);
}
return true;
} | java | public boolean handleRequest(MessageContext messageContext) throws WebServiceClientException {
try {
logRequest("Sending SOAP request", messageContext, false);
} catch (SoapEnvelopeException e) {
log.warn("Unable to write SOAP request to logger", e);
} catch (TransformerException e) {
log.warn("Unable to write SOAP request to logger", e);
}
return true;
} | [
"public",
"boolean",
"handleRequest",
"(",
"MessageContext",
"messageContext",
")",
"throws",
"WebServiceClientException",
"{",
"try",
"{",
"logRequest",
"(",
"\"Sending SOAP request\"",
",",
"messageContext",
",",
"false",
")",
";",
"}",
"catch",
"(",
"SoapEnvelopeEx... | Write SOAP request to logger before sending. | [
"Write",
"SOAP",
"request",
"to",
"logger",
"before",
"sending",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-ws/src/main/java/com/consol/citrus/ws/interceptor/LoggingClientInterceptor.java#L37-L47 | train |
citrusframework/citrus | modules/citrus-ws/src/main/java/com/consol/citrus/ws/interceptor/LoggingClientInterceptor.java | LoggingClientInterceptor.handleResponse | public boolean handleResponse(MessageContext messageContext) throws WebServiceClientException {
try {
logResponse("Received SOAP response", messageContext, true);
} catch (SoapEnvelopeException e) {
log.warn("Unable to write SOAP response to logger", e);
} catch (TransformerException e) {
log.warn("Unable to write SOAP response to logger", e);
}
return true;
} | java | public boolean handleResponse(MessageContext messageContext) throws WebServiceClientException {
try {
logResponse("Received SOAP response", messageContext, true);
} catch (SoapEnvelopeException e) {
log.warn("Unable to write SOAP response to logger", e);
} catch (TransformerException e) {
log.warn("Unable to write SOAP response to logger", e);
}
return true;
} | [
"public",
"boolean",
"handleResponse",
"(",
"MessageContext",
"messageContext",
")",
"throws",
"WebServiceClientException",
"{",
"try",
"{",
"logResponse",
"(",
"\"Received SOAP response\"",
",",
"messageContext",
",",
"true",
")",
";",
"}",
"catch",
"(",
"SoapEnvelop... | Write SOAP response to logger. | [
"Write",
"SOAP",
"response",
"to",
"logger",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-ws/src/main/java/com/consol/citrus/ws/interceptor/LoggingClientInterceptor.java#L52-L62 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.