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-jdbc/src/main/java/com/consol/citrus/jdbc/data/DataSetCreator.java | DataSetCreator.createDataSet | public DataSet createDataSet(final Message response, final MessageType messageType) {
try {
if (response.getPayload() instanceof DataSet) {
return response.getPayload(DataSet.class);
} else if (isReadyToMarshal(response, messageType)) {
return marshalResponse(response, messageType);
} else {
return new DataSet();
}
} catch (final SQLException e) {
throw new CitrusRuntimeException("Failed to read dataSet from response message", e);
}
} | java | public DataSet createDataSet(final Message response, final MessageType messageType) {
try {
if (response.getPayload() instanceof DataSet) {
return response.getPayload(DataSet.class);
} else if (isReadyToMarshal(response, messageType)) {
return marshalResponse(response, messageType);
} else {
return new DataSet();
}
} catch (final SQLException e) {
throw new CitrusRuntimeException("Failed to read dataSet from response message", e);
}
} | [
"public",
"DataSet",
"createDataSet",
"(",
"final",
"Message",
"response",
",",
"final",
"MessageType",
"messageType",
")",
"{",
"try",
"{",
"if",
"(",
"response",
".",
"getPayload",
"(",
")",
"instanceof",
"DataSet",
")",
"{",
"return",
"response",
".",
"ge... | Converts Citrus result set representation to db driver model result set.
@param response The result set to convert
@return A DataSet the jdbc driver can understand | [
"Converts",
"Citrus",
"result",
"set",
"representation",
"to",
"db",
"driver",
"model",
"result",
"set",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-jdbc/src/main/java/com/consol/citrus/jdbc/data/DataSetCreator.java#L42-L54 | train |
citrusframework/citrus | modules/citrus-jdbc/src/main/java/com/consol/citrus/jdbc/data/DataSetCreator.java | DataSetCreator.marshalResponse | private DataSet marshalResponse(final Message response, final MessageType messageType) throws SQLException {
String dataSet = null;
if (response instanceof JdbcMessage || response.getPayload() instanceof OperationResult) {
dataSet = response.getPayload(OperationResult.class).getDataSet();
} else {
try {
JdbcMarshaller jdbcMarshaller = new JdbcMarshaller();
jdbcMarshaller.setType(messageType.name());
Object object = jdbcMarshaller.unmarshal(new StringSource(response.getPayload(String.class)));
if (object instanceof OperationResult && StringUtils.hasText(((OperationResult) object).getDataSet())) {
dataSet = ((OperationResult) object).getDataSet();
}
} catch (CitrusRuntimeException e) {
dataSet = response.getPayload(String.class);
}
}
if (isJsonResponse(messageType)) {
return new JsonDataSetProducer(Optional.ofNullable(dataSet).orElse("[]")).produce();
} else if (isXmlResponse(messageType)) {
return new XmlDataSetProducer(Optional.ofNullable(dataSet).orElse("<dataset></dataset>")).produce();
} else {
throw new CitrusRuntimeException("Unable to create dataSet from data type " + messageType.name());
}
} | java | private DataSet marshalResponse(final Message response, final MessageType messageType) throws SQLException {
String dataSet = null;
if (response instanceof JdbcMessage || response.getPayload() instanceof OperationResult) {
dataSet = response.getPayload(OperationResult.class).getDataSet();
} else {
try {
JdbcMarshaller jdbcMarshaller = new JdbcMarshaller();
jdbcMarshaller.setType(messageType.name());
Object object = jdbcMarshaller.unmarshal(new StringSource(response.getPayload(String.class)));
if (object instanceof OperationResult && StringUtils.hasText(((OperationResult) object).getDataSet())) {
dataSet = ((OperationResult) object).getDataSet();
}
} catch (CitrusRuntimeException e) {
dataSet = response.getPayload(String.class);
}
}
if (isJsonResponse(messageType)) {
return new JsonDataSetProducer(Optional.ofNullable(dataSet).orElse("[]")).produce();
} else if (isXmlResponse(messageType)) {
return new XmlDataSetProducer(Optional.ofNullable(dataSet).orElse("<dataset></dataset>")).produce();
} else {
throw new CitrusRuntimeException("Unable to create dataSet from data type " + messageType.name());
}
} | [
"private",
"DataSet",
"marshalResponse",
"(",
"final",
"Message",
"response",
",",
"final",
"MessageType",
"messageType",
")",
"throws",
"SQLException",
"{",
"String",
"dataSet",
"=",
"null",
";",
"if",
"(",
"response",
"instanceof",
"JdbcMessage",
"||",
"response... | Marshals the given message to the requested MessageType
@param response The response to marshal
@param messageType The requested MessageType
@return A DataSet representing the message
@throws SQLException In case the marshalling failed | [
"Marshals",
"the",
"given",
"message",
"to",
"the",
"requested",
"MessageType"
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-jdbc/src/main/java/com/consol/citrus/jdbc/data/DataSetCreator.java#L63-L88 | train |
citrusframework/citrus | modules/citrus-core/src/main/java/com/consol/citrus/xml/XsdSchemaRepository.java | XsdSchemaRepository.canValidate | public boolean canValidate(Document doc) {
XsdSchema schema = schemaMappingStrategy.getSchema(schemas, doc);
return schema != null;
} | java | public boolean canValidate(Document doc) {
XsdSchema schema = schemaMappingStrategy.getSchema(schemas, doc);
return schema != null;
} | [
"public",
"boolean",
"canValidate",
"(",
"Document",
"doc",
")",
"{",
"XsdSchema",
"schema",
"=",
"schemaMappingStrategy",
".",
"getSchema",
"(",
"schemas",
",",
"doc",
")",
";",
"return",
"schema",
"!=",
"null",
";",
"}"
] | Find the matching schema for document using given schema mapping strategy.
@param doc the document instance to validate.
@return boolean flag marking matching schema instance found | [
"Find",
"the",
"matching",
"schema",
"for",
"document",
"using",
"given",
"schema",
"mapping",
"strategy",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/xml/XsdSchemaRepository.java#L63-L66 | train |
citrusframework/citrus | modules/citrus-core/src/main/java/com/consol/citrus/xml/XsdSchemaRepository.java | XsdSchemaRepository.addCitrusSchema | protected void addCitrusSchema(String schemaName) throws IOException, SAXException, ParserConfigurationException {
Resource resource = new PathMatchingResourcePatternResolver().getResource("classpath:com/consol/citrus/schema/" + schemaName + ".xsd");
if (resource.exists()) {
addXsdSchema(resource);
}
} | java | protected void addCitrusSchema(String schemaName) throws IOException, SAXException, ParserConfigurationException {
Resource resource = new PathMatchingResourcePatternResolver().getResource("classpath:com/consol/citrus/schema/" + schemaName + ".xsd");
if (resource.exists()) {
addXsdSchema(resource);
}
} | [
"protected",
"void",
"addCitrusSchema",
"(",
"String",
"schemaName",
")",
"throws",
"IOException",
",",
"SAXException",
",",
"ParserConfigurationException",
"{",
"Resource",
"resource",
"=",
"new",
"PathMatchingResourcePatternResolver",
"(",
")",
".",
"getResource",
"("... | Adds Citrus message schema to repository if available on classpath.
@param schemaName The name of the schema within the citrus schema package | [
"Adds",
"Citrus",
"message",
"schema",
"to",
"repository",
"if",
"available",
"on",
"classpath",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/xml/XsdSchemaRepository.java#L96-L101 | train |
citrusframework/citrus | modules/citrus-ssh/src/main/java/com/consol/citrus/ssh/SshCommand.java | SshCommand.copyToStream | private void copyToStream(String txt, OutputStream stream) throws IOException {
if (txt != null) {
stream.write(txt.getBytes());
}
} | java | private void copyToStream(String txt, OutputStream stream) throws IOException {
if (txt != null) {
stream.write(txt.getBytes());
}
} | [
"private",
"void",
"copyToStream",
"(",
"String",
"txt",
",",
"OutputStream",
"stream",
")",
"throws",
"IOException",
"{",
"if",
"(",
"txt",
"!=",
"null",
")",
"{",
"stream",
".",
"write",
"(",
"txt",
".",
"getBytes",
"(",
")",
")",
";",
"}",
"}"
] | Copy character sequence to outbput stream.
@param txt
@param stream
@throws IOException | [
"Copy",
"character",
"sequence",
"to",
"outbput",
"stream",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-ssh/src/main/java/com/consol/citrus/ssh/SshCommand.java#L135-L139 | train |
citrusframework/citrus | modules/citrus-http/src/main/java/com/consol/citrus/http/model/FormData.java | FormData.addControl | public void addControl(Control control) {
if (controls == null) {
controls = new FormData.Controls();
}
this.controls.add(control);
} | java | public void addControl(Control control) {
if (controls == null) {
controls = new FormData.Controls();
}
this.controls.add(control);
} | [
"public",
"void",
"addControl",
"(",
"Control",
"control",
")",
"{",
"if",
"(",
"controls",
"==",
"null",
")",
"{",
"controls",
"=",
"new",
"FormData",
".",
"Controls",
"(",
")",
";",
"}",
"this",
".",
"controls",
".",
"add",
"(",
"control",
")",
";"... | Adds new form control.
@param control | [
"Adds",
"new",
"form",
"control",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-http/src/main/java/com/consol/citrus/http/model/FormData.java#L96-L102 | train |
citrusframework/citrus | modules/citrus-core/src/main/java/com/consol/citrus/validation/json/schema/JsonSchemaFilter.java | JsonSchemaFilter.filter | public List<SimpleJsonSchema> filter(List<JsonSchemaRepository> schemaRepositories,
JsonMessageValidationContext jsonMessageValidationContext,
ApplicationContext applicationContext) {
if (isSchemaRepositorySpecified(jsonMessageValidationContext)) {
return filterByRepositoryName(schemaRepositories, jsonMessageValidationContext);
} else if (isSchemaSpecified(jsonMessageValidationContext)) {
return getSchemaFromContext(jsonMessageValidationContext, applicationContext);
} else {
return mergeRepositories(schemaRepositories);
}
} | java | public List<SimpleJsonSchema> filter(List<JsonSchemaRepository> schemaRepositories,
JsonMessageValidationContext jsonMessageValidationContext,
ApplicationContext applicationContext) {
if (isSchemaRepositorySpecified(jsonMessageValidationContext)) {
return filterByRepositoryName(schemaRepositories, jsonMessageValidationContext);
} else if (isSchemaSpecified(jsonMessageValidationContext)) {
return getSchemaFromContext(jsonMessageValidationContext, applicationContext);
} else {
return mergeRepositories(schemaRepositories);
}
} | [
"public",
"List",
"<",
"SimpleJsonSchema",
">",
"filter",
"(",
"List",
"<",
"JsonSchemaRepository",
">",
"schemaRepositories",
",",
"JsonMessageValidationContext",
"jsonMessageValidationContext",
",",
"ApplicationContext",
"applicationContext",
")",
"{",
"if",
"(",
"isSch... | Filters the all schema repositories based on the configuration in the jsonMessageValidationContext
and returns a list of relevant schemas for the validation
@param schemaRepositories The repositories to be filtered
@param jsonMessageValidationContext The context for the json message validation
@param applicationContext The application context to extract beans from
@return A list of json schemas relevant for the validation based on the configuration | [
"Filters",
"the",
"all",
"schema",
"repositories",
"based",
"on",
"the",
"configuration",
"in",
"the",
"jsonMessageValidationContext",
"and",
"returns",
"a",
"list",
"of",
"relevant",
"schemas",
"for",
"the",
"validation"
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/validation/json/schema/JsonSchemaFilter.java#L51-L61 | train |
citrusframework/citrus | modules/citrus-core/src/main/java/com/consol/citrus/validation/json/schema/JsonSchemaFilter.java | JsonSchemaFilter.getSchemaFromContext | private List<SimpleJsonSchema> getSchemaFromContext(JsonMessageValidationContext jsonMessageValidationContext,
ApplicationContext applicationContext) {
try {
SimpleJsonSchema simpleJsonSchema =
applicationContext.getBean(jsonMessageValidationContext.getSchema(), SimpleJsonSchema.class);
if (log.isDebugEnabled()) {
log.debug("Found specified schema: \"" + jsonMessageValidationContext.getSchema() + "\".");
}
return Collections.singletonList(simpleJsonSchema);
} catch (NoSuchBeanDefinitionException e) {
throw new CitrusRuntimeException(
"Could not find the specified schema: \"" + jsonMessageValidationContext.getSchema() + "\".",
e);
}
} | java | private List<SimpleJsonSchema> getSchemaFromContext(JsonMessageValidationContext jsonMessageValidationContext,
ApplicationContext applicationContext) {
try {
SimpleJsonSchema simpleJsonSchema =
applicationContext.getBean(jsonMessageValidationContext.getSchema(), SimpleJsonSchema.class);
if (log.isDebugEnabled()) {
log.debug("Found specified schema: \"" + jsonMessageValidationContext.getSchema() + "\".");
}
return Collections.singletonList(simpleJsonSchema);
} catch (NoSuchBeanDefinitionException e) {
throw new CitrusRuntimeException(
"Could not find the specified schema: \"" + jsonMessageValidationContext.getSchema() + "\".",
e);
}
} | [
"private",
"List",
"<",
"SimpleJsonSchema",
">",
"getSchemaFromContext",
"(",
"JsonMessageValidationContext",
"jsonMessageValidationContext",
",",
"ApplicationContext",
"applicationContext",
")",
"{",
"try",
"{",
"SimpleJsonSchema",
"simpleJsonSchema",
"=",
"applicationContext"... | Extracts the the schema specified in the jsonMessageValidationContext from the application context
@param jsonMessageValidationContext The message validation context containing the name of the schema to extract
@param applicationContext The application context to extract the schema from
@return A list containing the relevant schema
@throws CitrusRuntimeException If no matching schema was found | [
"Extracts",
"the",
"the",
"schema",
"specified",
"in",
"the",
"jsonMessageValidationContext",
"from",
"the",
"application",
"context"
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/validation/json/schema/JsonSchemaFilter.java#L70-L86 | train |
citrusframework/citrus | modules/citrus-core/src/main/java/com/consol/citrus/validation/json/schema/JsonSchemaFilter.java | JsonSchemaFilter.filterByRepositoryName | private List<SimpleJsonSchema> filterByRepositoryName(List<JsonSchemaRepository> schemaRepositories,
JsonMessageValidationContext jsonMessageValidationContext) {
for (JsonSchemaRepository jsonSchemaRepository : schemaRepositories) {
if (Objects.equals(jsonSchemaRepository.getName(), jsonMessageValidationContext.getSchemaRepository())) {
if (log.isDebugEnabled()) {
log.debug("Found specified schema-repository: \"" +
jsonMessageValidationContext.getSchemaRepository() + "\".");
}
return jsonSchemaRepository.getSchemas();
}
}
throw new CitrusRuntimeException("Could not find the specified schema repository: " +
"\"" + jsonMessageValidationContext.getSchemaRepository() + "\".");
} | java | private List<SimpleJsonSchema> filterByRepositoryName(List<JsonSchemaRepository> schemaRepositories,
JsonMessageValidationContext jsonMessageValidationContext) {
for (JsonSchemaRepository jsonSchemaRepository : schemaRepositories) {
if (Objects.equals(jsonSchemaRepository.getName(), jsonMessageValidationContext.getSchemaRepository())) {
if (log.isDebugEnabled()) {
log.debug("Found specified schema-repository: \"" +
jsonMessageValidationContext.getSchemaRepository() + "\".");
}
return jsonSchemaRepository.getSchemas();
}
}
throw new CitrusRuntimeException("Could not find the specified schema repository: " +
"\"" + jsonMessageValidationContext.getSchemaRepository() + "\".");
} | [
"private",
"List",
"<",
"SimpleJsonSchema",
">",
"filterByRepositoryName",
"(",
"List",
"<",
"JsonSchemaRepository",
">",
"schemaRepositories",
",",
"JsonMessageValidationContext",
"jsonMessageValidationContext",
")",
"{",
"for",
"(",
"JsonSchemaRepository",
"jsonSchemaReposi... | Filters the schema repositories by the name configured in the jsonMessageValidationContext
@param schemaRepositories The List of schema repositories to filter
@param jsonMessageValidationContext The validation context of the json message containing the repository name
@return The list of json schemas found in the matching repository
@throws CitrusRuntimeException If no matching repository was found | [
"Filters",
"the",
"schema",
"repositories",
"by",
"the",
"name",
"configured",
"in",
"the",
"jsonMessageValidationContext"
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/validation/json/schema/JsonSchemaFilter.java#L95-L109 | train |
citrusframework/citrus | modules/citrus-core/src/main/java/com/consol/citrus/validation/json/schema/JsonSchemaFilter.java | JsonSchemaFilter.mergeRepositories | private List<SimpleJsonSchema> mergeRepositories(List<JsonSchemaRepository> schemaRepositories) {
return schemaRepositories.stream()
.map(JsonSchemaRepository::getSchemas)
.flatMap(List::stream)
.collect(Collectors.toList());
} | java | private List<SimpleJsonSchema> mergeRepositories(List<JsonSchemaRepository> schemaRepositories) {
return schemaRepositories.stream()
.map(JsonSchemaRepository::getSchemas)
.flatMap(List::stream)
.collect(Collectors.toList());
} | [
"private",
"List",
"<",
"SimpleJsonSchema",
">",
"mergeRepositories",
"(",
"List",
"<",
"JsonSchemaRepository",
">",
"schemaRepositories",
")",
"{",
"return",
"schemaRepositories",
".",
"stream",
"(",
")",
".",
"map",
"(",
"JsonSchemaRepository",
"::",
"getSchemas",... | Merges the list of given schema repositories to one unified list of json schemas
@param schemaRepositories The list of json schemas to merge
@return A list of all json schemas contained in the repositories | [
"Merges",
"the",
"list",
"of",
"given",
"schema",
"repositories",
"to",
"one",
"unified",
"list",
"of",
"json",
"schemas"
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/validation/json/schema/JsonSchemaFilter.java#L116-L121 | train |
citrusframework/citrus | modules/citrus-core/src/main/java/com/consol/citrus/annotations/CitrusAnnotations.java | CitrusAnnotations.injectAll | public static final void injectAll(final Object target, final Citrus citrusFramework) {
injectAll(target, citrusFramework, citrusFramework.createTestContext());
} | java | public static final void injectAll(final Object target, final Citrus citrusFramework) {
injectAll(target, citrusFramework, citrusFramework.createTestContext());
} | [
"public",
"static",
"final",
"void",
"injectAll",
"(",
"final",
"Object",
"target",
",",
"final",
"Citrus",
"citrusFramework",
")",
"{",
"injectAll",
"(",
"target",
",",
"citrusFramework",
",",
"citrusFramework",
".",
"createTestContext",
"(",
")",
")",
";",
"... | Creates new Citrus test context and injects all supported components and endpoints to target object using annotations.
@param target | [
"Creates",
"new",
"Citrus",
"test",
"context",
"and",
"injects",
"all",
"supported",
"components",
"and",
"endpoints",
"to",
"target",
"object",
"using",
"annotations",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/annotations/CitrusAnnotations.java#L60-L62 | train |
citrusframework/citrus | modules/citrus-core/src/main/java/com/consol/citrus/annotations/CitrusAnnotations.java | CitrusAnnotations.injectAll | public static final void injectAll(final Object target, final Citrus citrusFramework, final TestContext context) {
injectCitrusFramework(target, citrusFramework);
injectEndpoints(target, context);
} | java | public static final void injectAll(final Object target, final Citrus citrusFramework, final TestContext context) {
injectCitrusFramework(target, citrusFramework);
injectEndpoints(target, context);
} | [
"public",
"static",
"final",
"void",
"injectAll",
"(",
"final",
"Object",
"target",
",",
"final",
"Citrus",
"citrusFramework",
",",
"final",
"TestContext",
"context",
")",
"{",
"injectCitrusFramework",
"(",
"target",
",",
"citrusFramework",
")",
";",
"injectEndpoi... | Injects all supported components and endpoints to target object using annotations.
@param target | [
"Injects",
"all",
"supported",
"components",
"and",
"endpoints",
"to",
"target",
"object",
"using",
"annotations",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/annotations/CitrusAnnotations.java#L68-L71 | train |
citrusframework/citrus | modules/citrus-http/src/main/java/com/consol/citrus/http/message/HttpMessageConverter.java | HttpMessageConverter.getCustomHeaders | private Map<String, String> getCustomHeaders(HttpHeaders httpHeaders, Map<String, Object> mappedHeaders) {
Map<String, String> customHeaders = new HashMap<>();
for (Map.Entry<String, List<String>> header : httpHeaders.entrySet()) {
if (!mappedHeaders.containsKey(header.getKey())) {
customHeaders.put(header.getKey(), StringUtils.collectionToCommaDelimitedString(header.getValue()));
}
}
return customHeaders;
} | java | private Map<String, String> getCustomHeaders(HttpHeaders httpHeaders, Map<String, Object> mappedHeaders) {
Map<String, String> customHeaders = new HashMap<>();
for (Map.Entry<String, List<String>> header : httpHeaders.entrySet()) {
if (!mappedHeaders.containsKey(header.getKey())) {
customHeaders.put(header.getKey(), StringUtils.collectionToCommaDelimitedString(header.getValue()));
}
}
return customHeaders;
} | [
"private",
"Map",
"<",
"String",
",",
"String",
">",
"getCustomHeaders",
"(",
"HttpHeaders",
"httpHeaders",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"mappedHeaders",
")",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"customHeaders",
"=",
"new",
"Ha... | Message headers consist of standard HTTP message headers and custom headers.
This method assumes that all header entries that were not initially mapped
by header mapper implementations are custom headers.
@param httpHeaders all message headers in their pre nature.
@param mappedHeaders the previously mapped header entries (all standard headers).
@return The map of custom headers | [
"Message",
"headers",
"consist",
"of",
"standard",
"HTTP",
"message",
"headers",
"and",
"custom",
"headers",
".",
"This",
"method",
"assumes",
"that",
"all",
"header",
"entries",
"that",
"were",
"not",
"initially",
"mapped",
"by",
"header",
"mapper",
"implementa... | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-http/src/main/java/com/consol/citrus/http/message/HttpMessageConverter.java#L126-L136 | train |
citrusframework/citrus | modules/citrus-http/src/main/java/com/consol/citrus/http/message/HttpMessageConverter.java | HttpMessageConverter.createHttpHeaders | private HttpHeaders createHttpHeaders(HttpMessage httpMessage,
HttpEndpointConfiguration endpointConfiguration) {
HttpHeaders httpHeaders = new HttpHeaders();
endpointConfiguration
.getHeaderMapper()
.fromHeaders(
new org.springframework.messaging.MessageHeaders(httpMessage.getHeaders()),
httpHeaders);
Map<String, Object> messageHeaders = httpMessage.getHeaders();
for (Map.Entry<String, Object> header : messageHeaders.entrySet()) {
if (!header.getKey().startsWith(MessageHeaders.PREFIX) &&
!MessageHeaderUtils.isSpringInternalHeader(header.getKey()) &&
!httpHeaders.containsKey(header.getKey())) {
httpHeaders.add(header.getKey(), header.getValue().toString());
}
}
if (httpHeaders.getFirst(HttpMessageHeaders.HTTP_CONTENT_TYPE) == null) {
httpHeaders.add(HttpMessageHeaders.HTTP_CONTENT_TYPE, composeContentTypeHeaderValue(endpointConfiguration));
}
return httpHeaders;
} | java | private HttpHeaders createHttpHeaders(HttpMessage httpMessage,
HttpEndpointConfiguration endpointConfiguration) {
HttpHeaders httpHeaders = new HttpHeaders();
endpointConfiguration
.getHeaderMapper()
.fromHeaders(
new org.springframework.messaging.MessageHeaders(httpMessage.getHeaders()),
httpHeaders);
Map<String, Object> messageHeaders = httpMessage.getHeaders();
for (Map.Entry<String, Object> header : messageHeaders.entrySet()) {
if (!header.getKey().startsWith(MessageHeaders.PREFIX) &&
!MessageHeaderUtils.isSpringInternalHeader(header.getKey()) &&
!httpHeaders.containsKey(header.getKey())) {
httpHeaders.add(header.getKey(), header.getValue().toString());
}
}
if (httpHeaders.getFirst(HttpMessageHeaders.HTTP_CONTENT_TYPE) == null) {
httpHeaders.add(HttpMessageHeaders.HTTP_CONTENT_TYPE, composeContentTypeHeaderValue(endpointConfiguration));
}
return httpHeaders;
} | [
"private",
"HttpHeaders",
"createHttpHeaders",
"(",
"HttpMessage",
"httpMessage",
",",
"HttpEndpointConfiguration",
"endpointConfiguration",
")",
"{",
"HttpHeaders",
"httpHeaders",
"=",
"new",
"HttpHeaders",
"(",
")",
";",
"endpointConfiguration",
".",
"getHeaderMapper",
... | Creates HttpHeaders based on the outbound message and the endpoint configurations header mapper.
@param httpMessage The HttpMessage to copy the headers from
@param endpointConfiguration The endpoint configuration to get th header mapper from | [
"Creates",
"HttpHeaders",
"based",
"on",
"the",
"outbound",
"message",
"and",
"the",
"endpoint",
"configurations",
"header",
"mapper",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-http/src/main/java/com/consol/citrus/http/message/HttpMessageConverter.java#L166-L191 | train |
citrusframework/citrus | modules/citrus-http/src/main/java/com/consol/citrus/http/message/HttpMessageConverter.java | HttpMessageConverter.createHttpEntity | private HttpEntity<?> createHttpEntity(HttpHeaders httpHeaders, Object payload, HttpMethod method) {
if (httpMethodSupportsBody(method)) {
return new HttpEntity<>(payload, httpHeaders);
} else {
return new HttpEntity<>(httpHeaders);
}
} | java | private HttpEntity<?> createHttpEntity(HttpHeaders httpHeaders, Object payload, HttpMethod method) {
if (httpMethodSupportsBody(method)) {
return new HttpEntity<>(payload, httpHeaders);
} else {
return new HttpEntity<>(httpHeaders);
}
} | [
"private",
"HttpEntity",
"<",
"?",
">",
"createHttpEntity",
"(",
"HttpHeaders",
"httpHeaders",
",",
"Object",
"payload",
",",
"HttpMethod",
"method",
")",
"{",
"if",
"(",
"httpMethodSupportsBody",
"(",
"method",
")",
")",
"{",
"return",
"new",
"HttpEntity",
"<... | Composes a HttpEntity based on the given parameters
@param httpHeaders The headers to set
@param payload The payload to set
@param method The HttpMethod to use
@return The composed HttpEntitiy | [
"Composes",
"a",
"HttpEntity",
"based",
"on",
"the",
"given",
"parameters"
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-http/src/main/java/com/consol/citrus/http/message/HttpMessageConverter.java#L215-L221 | train |
citrusframework/citrus | modules/citrus-http/src/main/java/com/consol/citrus/http/message/HttpMessageConverter.java | HttpMessageConverter.convertOutboundMessage | private HttpMessage convertOutboundMessage(Message message) {
HttpMessage httpMessage;
if (message instanceof HttpMessage) {
httpMessage = (HttpMessage) message;
} else {
httpMessage = new HttpMessage(message);
}
return httpMessage;
} | java | private HttpMessage convertOutboundMessage(Message message) {
HttpMessage httpMessage;
if (message instanceof HttpMessage) {
httpMessage = (HttpMessage) message;
} else {
httpMessage = new HttpMessage(message);
}
return httpMessage;
} | [
"private",
"HttpMessage",
"convertOutboundMessage",
"(",
"Message",
"message",
")",
"{",
"HttpMessage",
"httpMessage",
";",
"if",
"(",
"message",
"instanceof",
"HttpMessage",
")",
"{",
"httpMessage",
"=",
"(",
"HttpMessage",
")",
"message",
";",
"}",
"else",
"{"... | Converts the outbound Message object into a HttpMessage
@param message The message to convert
@return The converted message as HttpMessage | [
"Converts",
"the",
"outbound",
"Message",
"object",
"into",
"a",
"HttpMessage"
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-http/src/main/java/com/consol/citrus/http/message/HttpMessageConverter.java#L228-L236 | train |
citrusframework/citrus | modules/citrus-http/src/main/java/com/consol/citrus/http/message/HttpMessageConverter.java | HttpMessageConverter.httpMethodSupportsBody | private boolean httpMethodSupportsBody(HttpMethod method) {
return HttpMethod.POST.equals(method) || HttpMethod.PUT.equals(method)
|| HttpMethod.DELETE.equals(method) || HttpMethod.PATCH.equals(method);
} | java | private boolean httpMethodSupportsBody(HttpMethod method) {
return HttpMethod.POST.equals(method) || HttpMethod.PUT.equals(method)
|| HttpMethod.DELETE.equals(method) || HttpMethod.PATCH.equals(method);
} | [
"private",
"boolean",
"httpMethodSupportsBody",
"(",
"HttpMethod",
"method",
")",
"{",
"return",
"HttpMethod",
".",
"POST",
".",
"equals",
"(",
"method",
")",
"||",
"HttpMethod",
".",
"PUT",
".",
"equals",
"(",
"method",
")",
"||",
"HttpMethod",
".",
"DELETE... | Determines whether the given message type supports a message body
@param method The HttpMethod to evaluate
@return Whether a message body is supported | [
"Determines",
"whether",
"the",
"given",
"message",
"type",
"supports",
"a",
"message",
"body"
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-http/src/main/java/com/consol/citrus/http/message/HttpMessageConverter.java#L243-L246 | train |
citrusframework/citrus | modules/citrus-http/src/main/java/com/consol/citrus/http/message/HttpMessageConverter.java | HttpMessageConverter.composeContentTypeHeaderValue | private String composeContentTypeHeaderValue(HttpEndpointConfiguration endpointConfiguration) {
return (endpointConfiguration.getContentType().contains("charset") || !StringUtils.hasText(endpointConfiguration.getCharset())) ?
endpointConfiguration.getContentType() :
endpointConfiguration.getContentType() + ";charset=" + endpointConfiguration.getCharset();
} | java | private String composeContentTypeHeaderValue(HttpEndpointConfiguration endpointConfiguration) {
return (endpointConfiguration.getContentType().contains("charset") || !StringUtils.hasText(endpointConfiguration.getCharset())) ?
endpointConfiguration.getContentType() :
endpointConfiguration.getContentType() + ";charset=" + endpointConfiguration.getCharset();
} | [
"private",
"String",
"composeContentTypeHeaderValue",
"(",
"HttpEndpointConfiguration",
"endpointConfiguration",
")",
"{",
"return",
"(",
"endpointConfiguration",
".",
"getContentType",
"(",
")",
".",
"contains",
"(",
"\"charset\"",
")",
"||",
"!",
"StringUtils",
".",
... | Creates the content type header value enriched with charset information if possible
@param endpointConfiguration The endpoint configuration to get the content type from
@return The content type header including charset information | [
"Creates",
"the",
"content",
"type",
"header",
"value",
"enriched",
"with",
"charset",
"information",
"if",
"possible"
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-http/src/main/java/com/consol/citrus/http/message/HttpMessageConverter.java#L253-L257 | train |
citrusframework/citrus | modules/citrus-core/src/main/java/com/consol/citrus/config/util/BeanDefinitionParserUtils.java | BeanDefinitionParserUtils.setPropertyValue | public static void setPropertyValue(BeanDefinitionBuilder builder, String propertyValue, String propertyName) {
if (StringUtils.hasText(propertyValue)) {
builder.addPropertyValue(propertyName, propertyValue);
}
} | java | public static void setPropertyValue(BeanDefinitionBuilder builder, String propertyValue, String propertyName) {
if (StringUtils.hasText(propertyValue)) {
builder.addPropertyValue(propertyName, propertyValue);
}
} | [
"public",
"static",
"void",
"setPropertyValue",
"(",
"BeanDefinitionBuilder",
"builder",
",",
"String",
"propertyValue",
",",
"String",
"propertyName",
")",
"{",
"if",
"(",
"StringUtils",
".",
"hasText",
"(",
"propertyValue",
")",
")",
"{",
"builder",
".",
"addP... | Sets the property value on bean definition in case value
is set properly.
@param builder the bean definition builder to be configured
@param propertyValue the property value
@param propertyName the name of the property | [
"Sets",
"the",
"property",
"value",
"on",
"bean",
"definition",
"in",
"case",
"value",
"is",
"set",
"properly",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/config/util/BeanDefinitionParserUtils.java#L48-L52 | train |
citrusframework/citrus | modules/citrus-core/src/main/java/com/consol/citrus/config/util/BeanDefinitionParserUtils.java | BeanDefinitionParserUtils.setConstructorArgValue | public static void setConstructorArgValue(BeanDefinitionBuilder builder, String propertyValue) {
if (StringUtils.hasText(propertyValue)) {
builder.addConstructorArgValue(propertyValue);
}
} | java | public static void setConstructorArgValue(BeanDefinitionBuilder builder, String propertyValue) {
if (StringUtils.hasText(propertyValue)) {
builder.addConstructorArgValue(propertyValue);
}
} | [
"public",
"static",
"void",
"setConstructorArgValue",
"(",
"BeanDefinitionBuilder",
"builder",
",",
"String",
"propertyValue",
")",
"{",
"if",
"(",
"StringUtils",
".",
"hasText",
"(",
"propertyValue",
")",
")",
"{",
"builder",
".",
"addConstructorArgValue",
"(",
"... | Sets the property value on bean definition as constructor argument in case value
is not null.
@param builder the bean definition to be configured
@param propertyValue the property value | [
"Sets",
"the",
"property",
"value",
"on",
"bean",
"definition",
"as",
"constructor",
"argument",
"in",
"case",
"value",
"is",
"not",
"null",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/config/util/BeanDefinitionParserUtils.java#L61-L65 | train |
citrusframework/citrus | modules/citrus-core/src/main/java/com/consol/citrus/config/util/BeanDefinitionParserUtils.java | BeanDefinitionParserUtils.registerBean | public static BeanDefinitionHolder registerBean(String beanId, Class<?> beanClass, ParserContext parserContext, boolean shouldFireEvents) {
return registerBean(beanId, BeanDefinitionBuilder.genericBeanDefinition(beanClass).getBeanDefinition(), parserContext, shouldFireEvents);
} | java | public static BeanDefinitionHolder registerBean(String beanId, Class<?> beanClass, ParserContext parserContext, boolean shouldFireEvents) {
return registerBean(beanId, BeanDefinitionBuilder.genericBeanDefinition(beanClass).getBeanDefinition(), parserContext, shouldFireEvents);
} | [
"public",
"static",
"BeanDefinitionHolder",
"registerBean",
"(",
"String",
"beanId",
",",
"Class",
"<",
"?",
">",
"beanClass",
",",
"ParserContext",
"parserContext",
",",
"boolean",
"shouldFireEvents",
")",
"{",
"return",
"registerBean",
"(",
"beanId",
",",
"BeanD... | Creates new bean definition from bean class and registers new bean in parser registry.
Returns bean definition holder.
@param beanId
@param beanClass
@param parserContext
@param shouldFireEvents | [
"Creates",
"new",
"bean",
"definition",
"from",
"bean",
"class",
"and",
"registers",
"new",
"bean",
"in",
"parser",
"registry",
".",
"Returns",
"bean",
"definition",
"holder",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/config/util/BeanDefinitionParserUtils.java#L118-L120 | train |
citrusframework/citrus | modules/citrus-core/src/main/java/com/consol/citrus/config/util/BeanDefinitionParserUtils.java | BeanDefinitionParserUtils.registerBean | public static BeanDefinitionHolder registerBean(String beanId, BeanDefinition beanDefinition, ParserContext parserContext, boolean shouldFireEvents) {
if (parserContext.getRegistry().containsBeanDefinition(beanId)) {
return new BeanDefinitionHolder(parserContext.getRegistry().getBeanDefinition(beanId), beanId);
}
BeanDefinitionHolder configurationHolder = new BeanDefinitionHolder(beanDefinition, beanId);
BeanDefinitionReaderUtils.registerBeanDefinition(configurationHolder, parserContext.getRegistry());
if (shouldFireEvents) {
BeanComponentDefinition componentDefinition = new BeanComponentDefinition(configurationHolder);
parserContext.registerComponent(componentDefinition);
}
return configurationHolder;
} | java | public static BeanDefinitionHolder registerBean(String beanId, BeanDefinition beanDefinition, ParserContext parserContext, boolean shouldFireEvents) {
if (parserContext.getRegistry().containsBeanDefinition(beanId)) {
return new BeanDefinitionHolder(parserContext.getRegistry().getBeanDefinition(beanId), beanId);
}
BeanDefinitionHolder configurationHolder = new BeanDefinitionHolder(beanDefinition, beanId);
BeanDefinitionReaderUtils.registerBeanDefinition(configurationHolder, parserContext.getRegistry());
if (shouldFireEvents) {
BeanComponentDefinition componentDefinition = new BeanComponentDefinition(configurationHolder);
parserContext.registerComponent(componentDefinition);
}
return configurationHolder;
} | [
"public",
"static",
"BeanDefinitionHolder",
"registerBean",
"(",
"String",
"beanId",
",",
"BeanDefinition",
"beanDefinition",
",",
"ParserContext",
"parserContext",
",",
"boolean",
"shouldFireEvents",
")",
"{",
"if",
"(",
"parserContext",
".",
"getRegistry",
"(",
")",... | Registers bean definition in parser registry and returns bean definition holder.
@param beanId
@param beanDefinition
@param parserContext
@param shouldFireEvents
@return | [
"Registers",
"bean",
"definition",
"in",
"parser",
"registry",
"and",
"returns",
"bean",
"definition",
"holder",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/config/util/BeanDefinitionParserUtils.java#L130-L144 | train |
citrusframework/citrus | modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/junit/jupiter/CitrusExtension.java | CitrusExtension.isDesignerMethod | private static boolean isDesignerMethod(Method method) {
Class<?>[] parameterTypes = method.getParameterTypes();
for (Class<?> parameterType : parameterTypes) {
if (parameterType.isAssignableFrom(TestDesigner.class)) {
return true;
}
}
return false;
} | java | private static boolean isDesignerMethod(Method method) {
Class<?>[] parameterTypes = method.getParameterTypes();
for (Class<?> parameterType : parameterTypes) {
if (parameterType.isAssignableFrom(TestDesigner.class)) {
return true;
}
}
return false;
} | [
"private",
"static",
"boolean",
"isDesignerMethod",
"(",
"Method",
"method",
")",
"{",
"Class",
"<",
"?",
">",
"[",
"]",
"parameterTypes",
"=",
"method",
".",
"getParameterTypes",
"(",
")",
";",
"for",
"(",
"Class",
"<",
"?",
">",
"parameterType",
":",
"... | Searches for method parameter of type test designer.
@param method
@return | [
"Searches",
"for",
"method",
"parameter",
"of",
"type",
"test",
"designer",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/junit/jupiter/CitrusExtension.java#L208-L218 | train |
citrusframework/citrus | modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/junit/jupiter/CitrusExtension.java | CitrusExtension.isDesignerClass | private static boolean isDesignerClass(Class<?> type) {
return Stream.of(type.getDeclaredFields()).anyMatch(field -> TestDesigner.class.isAssignableFrom(field.getType()));
} | java | private static boolean isDesignerClass(Class<?> type) {
return Stream.of(type.getDeclaredFields()).anyMatch(field -> TestDesigner.class.isAssignableFrom(field.getType()));
} | [
"private",
"static",
"boolean",
"isDesignerClass",
"(",
"Class",
"<",
"?",
">",
"type",
")",
"{",
"return",
"Stream",
".",
"of",
"(",
"type",
".",
"getDeclaredFields",
"(",
")",
")",
".",
"anyMatch",
"(",
"field",
"->",
"TestDesigner",
".",
"class",
".",... | Searches for field of type test designer.
@param type
@return | [
"Searches",
"for",
"field",
"of",
"type",
"test",
"designer",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/junit/jupiter/CitrusExtension.java#L225-L227 | train |
citrusframework/citrus | modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/junit/jupiter/CitrusExtension.java | CitrusExtension.isRunnerMethod | private static boolean isRunnerMethod(Method method) {
Class<?>[] parameterTypes = method.getParameterTypes();
for (Class<?> parameterType : parameterTypes) {
if (parameterType.isAssignableFrom(TestRunner.class)) {
return true;
}
}
return false;
} | java | private static boolean isRunnerMethod(Method method) {
Class<?>[] parameterTypes = method.getParameterTypes();
for (Class<?> parameterType : parameterTypes) {
if (parameterType.isAssignableFrom(TestRunner.class)) {
return true;
}
}
return false;
} | [
"private",
"static",
"boolean",
"isRunnerMethod",
"(",
"Method",
"method",
")",
"{",
"Class",
"<",
"?",
">",
"[",
"]",
"parameterTypes",
"=",
"method",
".",
"getParameterTypes",
"(",
")",
";",
"for",
"(",
"Class",
"<",
"?",
">",
"parameterType",
":",
"pa... | Searches for method parameter of type test runner.
@param method
@return | [
"Searches",
"for",
"method",
"parameter",
"of",
"type",
"test",
"runner",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/junit/jupiter/CitrusExtension.java#L234-L244 | train |
citrusframework/citrus | modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/junit/jupiter/CitrusExtension.java | CitrusExtension.isRunnerClass | private static boolean isRunnerClass(Class<?> type) {
return Stream.of(type.getDeclaredFields()).anyMatch(field -> TestRunner.class.isAssignableFrom(field.getType()));
} | java | private static boolean isRunnerClass(Class<?> type) {
return Stream.of(type.getDeclaredFields()).anyMatch(field -> TestRunner.class.isAssignableFrom(field.getType()));
} | [
"private",
"static",
"boolean",
"isRunnerClass",
"(",
"Class",
"<",
"?",
">",
"type",
")",
"{",
"return",
"Stream",
".",
"of",
"(",
"type",
".",
"getDeclaredFields",
"(",
")",
")",
".",
"anyMatch",
"(",
"field",
"->",
"TestRunner",
".",
"class",
".",
"... | Searches for field of type test runner.
@param type
@return | [
"Searches",
"for",
"field",
"of",
"type",
"test",
"runner",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/junit/jupiter/CitrusExtension.java#L251-L253 | train |
citrusframework/citrus | modules/citrus-core/src/main/java/com/consol/citrus/variable/VariableUtils.java | VariableUtils.getValueFromScript | public static String getValueFromScript(String scriptEngine, String code) {
try {
ScriptEngine engine = new ScriptEngineManager().getEngineByName(scriptEngine);
if (engine == null) {
throw new CitrusRuntimeException("Unable to find script engine with name '" + scriptEngine + "'");
}
return engine.eval(code).toString();
} catch (ScriptException e) {
throw new CitrusRuntimeException("Failed to evaluate " + scriptEngine + " script", e);
}
} | java | public static String getValueFromScript(String scriptEngine, String code) {
try {
ScriptEngine engine = new ScriptEngineManager().getEngineByName(scriptEngine);
if (engine == null) {
throw new CitrusRuntimeException("Unable to find script engine with name '" + scriptEngine + "'");
}
return engine.eval(code).toString();
} catch (ScriptException e) {
throw new CitrusRuntimeException("Failed to evaluate " + scriptEngine + " script", e);
}
} | [
"public",
"static",
"String",
"getValueFromScript",
"(",
"String",
"scriptEngine",
",",
"String",
"code",
")",
"{",
"try",
"{",
"ScriptEngine",
"engine",
"=",
"new",
"ScriptEngineManager",
"(",
")",
".",
"getEngineByName",
"(",
"scriptEngine",
")",
";",
"if",
... | Evaluates script code and returns a variable value as result.
@param scriptEngine the name of the scripting engine.
@param code the script code.
@return the variable value as String. | [
"Evaluates",
"script",
"code",
"and",
"returns",
"a",
"variable",
"value",
"as",
"result",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/variable/VariableUtils.java#L47-L59 | train |
citrusframework/citrus | modules/citrus-core/src/main/java/com/consol/citrus/variable/VariableUtils.java | VariableUtils.cutOffSingleQuotes | public static String cutOffSingleQuotes(String variable) {
if (StringUtils.hasText(variable) && variable.length() > 1 && variable.charAt(0) == '\'' && variable.charAt(variable.length() - 1) == '\'') {
return variable.substring(1, variable.length() - 1);
}
return variable;
} | java | public static String cutOffSingleQuotes(String variable) {
if (StringUtils.hasText(variable) && variable.length() > 1 && variable.charAt(0) == '\'' && variable.charAt(variable.length() - 1) == '\'') {
return variable.substring(1, variable.length() - 1);
}
return variable;
} | [
"public",
"static",
"String",
"cutOffSingleQuotes",
"(",
"String",
"variable",
")",
"{",
"if",
"(",
"StringUtils",
".",
"hasText",
"(",
"variable",
")",
"&&",
"variable",
".",
"length",
"(",
")",
">",
"1",
"&&",
"variable",
".",
"charAt",
"(",
"0",
")",
... | Cut off single quotes prefix and suffix.
@param variable
@return | [
"Cut",
"off",
"single",
"quotes",
"prefix",
"and",
"suffix",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/variable/VariableUtils.java#L66-L72 | train |
citrusframework/citrus | modules/citrus-core/src/main/java/com/consol/citrus/variable/VariableUtils.java | VariableUtils.cutOffDoubleQuotes | public static String cutOffDoubleQuotes(String variable) {
if (StringUtils.hasText(variable) && variable.length() > 1 && variable.charAt(0) == '"' && variable.charAt(variable.length() - 1) == '"') {
return variable.substring(1, variable.length() - 1);
}
return variable;
} | java | public static String cutOffDoubleQuotes(String variable) {
if (StringUtils.hasText(variable) && variable.length() > 1 && variable.charAt(0) == '"' && variable.charAt(variable.length() - 1) == '"') {
return variable.substring(1, variable.length() - 1);
}
return variable;
} | [
"public",
"static",
"String",
"cutOffDoubleQuotes",
"(",
"String",
"variable",
")",
"{",
"if",
"(",
"StringUtils",
".",
"hasText",
"(",
"variable",
")",
"&&",
"variable",
".",
"length",
"(",
")",
">",
"1",
"&&",
"variable",
".",
"charAt",
"(",
"0",
")",
... | Cut off double quotes prefix and suffix.
@param variable
@return | [
"Cut",
"off",
"double",
"quotes",
"prefix",
"and",
"suffix",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/variable/VariableUtils.java#L79-L85 | train |
citrusframework/citrus | modules/citrus-core/src/main/java/com/consol/citrus/variable/VariableUtils.java | VariableUtils.cutOffVariablesPrefix | public static String cutOffVariablesPrefix(String variable) {
if (variable.startsWith(Citrus.VARIABLE_PREFIX) && variable.endsWith(Citrus.VARIABLE_SUFFIX)) {
return variable.substring(Citrus.VARIABLE_PREFIX.length(), variable.length() - Citrus.VARIABLE_SUFFIX.length());
}
return variable;
} | java | public static String cutOffVariablesPrefix(String variable) {
if (variable.startsWith(Citrus.VARIABLE_PREFIX) && variable.endsWith(Citrus.VARIABLE_SUFFIX)) {
return variable.substring(Citrus.VARIABLE_PREFIX.length(), variable.length() - Citrus.VARIABLE_SUFFIX.length());
}
return variable;
} | [
"public",
"static",
"String",
"cutOffVariablesPrefix",
"(",
"String",
"variable",
")",
"{",
"if",
"(",
"variable",
".",
"startsWith",
"(",
"Citrus",
".",
"VARIABLE_PREFIX",
")",
"&&",
"variable",
".",
"endsWith",
"(",
"Citrus",
".",
"VARIABLE_SUFFIX",
")",
")"... | Cut off variables prefix
@param variable
@return | [
"Cut",
"off",
"variables",
"prefix"
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/variable/VariableUtils.java#L92-L98 | train |
citrusframework/citrus | modules/citrus-core/src/main/java/com/consol/citrus/variable/VariableUtils.java | VariableUtils.cutOffVariablesEscaping | public static String cutOffVariablesEscaping(String variable) {
if (variable.startsWith(Citrus.VARIABLE_ESCAPE) && variable.endsWith(Citrus.VARIABLE_ESCAPE)) {
return variable.substring(Citrus.VARIABLE_ESCAPE.length(), variable.length() - Citrus.VARIABLE_ESCAPE.length());
}
return variable;
} | java | public static String cutOffVariablesEscaping(String variable) {
if (variable.startsWith(Citrus.VARIABLE_ESCAPE) && variable.endsWith(Citrus.VARIABLE_ESCAPE)) {
return variable.substring(Citrus.VARIABLE_ESCAPE.length(), variable.length() - Citrus.VARIABLE_ESCAPE.length());
}
return variable;
} | [
"public",
"static",
"String",
"cutOffVariablesEscaping",
"(",
"String",
"variable",
")",
"{",
"if",
"(",
"variable",
".",
"startsWith",
"(",
"Citrus",
".",
"VARIABLE_ESCAPE",
")",
"&&",
"variable",
".",
"endsWith",
"(",
"Citrus",
".",
"VARIABLE_ESCAPE",
")",
"... | Cut off variables escaping
@param variable
@return | [
"Cut",
"off",
"variables",
"escaping"
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/variable/VariableUtils.java#L105-L111 | train |
citrusframework/citrus | modules/citrus-core/src/main/java/com/consol/citrus/variable/VariableUtils.java | VariableUtils.isVariableName | public static boolean isVariableName(final String expression) {
if (expression == null || expression.length() == 0) {
return false;
}
if (expression.startsWith(Citrus.VARIABLE_PREFIX) && expression.endsWith(Citrus.VARIABLE_SUFFIX)) {
return true;
}
return false;
} | java | public static boolean isVariableName(final String expression) {
if (expression == null || expression.length() == 0) {
return false;
}
if (expression.startsWith(Citrus.VARIABLE_PREFIX) && expression.endsWith(Citrus.VARIABLE_SUFFIX)) {
return true;
}
return false;
} | [
"public",
"static",
"boolean",
"isVariableName",
"(",
"final",
"String",
"expression",
")",
"{",
"if",
"(",
"expression",
"==",
"null",
"||",
"expression",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"expression"... | Checks whether a given expression is a variable name.
@param expression
@return flag true/false | [
"Checks",
"whether",
"a",
"given",
"expression",
"is",
"a",
"variable",
"name",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/variable/VariableUtils.java#L118-L128 | train |
citrusframework/citrus | modules/citrus-core/src/main/java/com/consol/citrus/variable/VariableUtils.java | VariableUtils.replaceVariablesInString | public static String replaceVariablesInString(final String str, TestContext context, boolean enableQuoting) {
StringBuffer newStr = new StringBuffer();
boolean isVarComplete;
StringBuffer variableNameBuf = new StringBuffer();
int startIndex = 0;
int curIndex;
int searchIndex;
while ((searchIndex = str.indexOf(Citrus.VARIABLE_PREFIX, startIndex)) != -1) {
int control = 0;
isVarComplete = false;
curIndex = searchIndex + Citrus.VARIABLE_PREFIX.length();
while (curIndex < str.length() && !isVarComplete) {
if (str.indexOf(Citrus.VARIABLE_PREFIX, curIndex) == curIndex) {
control++;
}
if ((!Character.isJavaIdentifierPart(str.charAt(curIndex)) && (str.charAt(curIndex) == Citrus.VARIABLE_SUFFIX.charAt(0))) || (curIndex + 1 == str.length())) {
if (control == 0) {
isVarComplete = true;
} else {
control--;
}
}
if (!isVarComplete) {
variableNameBuf.append(str.charAt(curIndex));
}
++curIndex;
}
final String value = context.getVariable(variableNameBuf.toString());
if (value == null) {
throw new NoSuchVariableException("Variable: " + variableNameBuf.toString() + " could not be found");
}
newStr.append(str.substring(startIndex, searchIndex));
if (enableQuoting) {
newStr.append("'" + value + "'");
} else {
newStr.append(value);
}
startIndex = curIndex;
variableNameBuf = new StringBuffer();
isVarComplete = false;
}
newStr.append(str.substring(startIndex));
return newStr.toString();
} | java | public static String replaceVariablesInString(final String str, TestContext context, boolean enableQuoting) {
StringBuffer newStr = new StringBuffer();
boolean isVarComplete;
StringBuffer variableNameBuf = new StringBuffer();
int startIndex = 0;
int curIndex;
int searchIndex;
while ((searchIndex = str.indexOf(Citrus.VARIABLE_PREFIX, startIndex)) != -1) {
int control = 0;
isVarComplete = false;
curIndex = searchIndex + Citrus.VARIABLE_PREFIX.length();
while (curIndex < str.length() && !isVarComplete) {
if (str.indexOf(Citrus.VARIABLE_PREFIX, curIndex) == curIndex) {
control++;
}
if ((!Character.isJavaIdentifierPart(str.charAt(curIndex)) && (str.charAt(curIndex) == Citrus.VARIABLE_SUFFIX.charAt(0))) || (curIndex + 1 == str.length())) {
if (control == 0) {
isVarComplete = true;
} else {
control--;
}
}
if (!isVarComplete) {
variableNameBuf.append(str.charAt(curIndex));
}
++curIndex;
}
final String value = context.getVariable(variableNameBuf.toString());
if (value == null) {
throw new NoSuchVariableException("Variable: " + variableNameBuf.toString() + " could not be found");
}
newStr.append(str.substring(startIndex, searchIndex));
if (enableQuoting) {
newStr.append("'" + value + "'");
} else {
newStr.append(value);
}
startIndex = curIndex;
variableNameBuf = new StringBuffer();
isVarComplete = false;
}
newStr.append(str.substring(startIndex));
return newStr.toString();
} | [
"public",
"static",
"String",
"replaceVariablesInString",
"(",
"final",
"String",
"str",
",",
"TestContext",
"context",
",",
"boolean",
"enableQuoting",
")",
"{",
"StringBuffer",
"newStr",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"boolean",
"isVarComplete",
";",... | Replace all variable expression in a string with
its respective value. Variable values are enclosed with quotes
if enabled.
@param str
@param context
@param enableQuoting
@return | [
"Replace",
"all",
"variable",
"expression",
"in",
"a",
"string",
"with",
"its",
"respective",
"value",
".",
"Variable",
"values",
"are",
"enclosed",
"with",
"quotes",
"if",
"enabled",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/variable/VariableUtils.java#L140-L197 | train |
citrusframework/citrus | modules/citrus-vertx/src/main/java/com/consol/citrus/vertx/factory/AbstractVertxInstanceFactory.java | AbstractVertxInstanceFactory.createVertx | protected Vertx createVertx(VertxEndpointConfiguration endpointConfiguration) {
final Vertx[] vertx = new Vertx[1];
final Future loading = new FutureFactoryImpl().future();
Handler<AsyncResult<Vertx>> asyncLoadingHandler = new Handler<AsyncResult<Vertx>>() {
@Override
public void handle(AsyncResult<Vertx> event) {
vertx[0] = event.result();
loading.complete();
log.info("Vert.x instance started");
}
};
if (endpointConfiguration.getPort() > 0) {
if (log.isDebugEnabled()) {
log.debug(String.format("Creating new Vert.x instance '%s:%s' ...", endpointConfiguration.getHost(), endpointConfiguration.getPort()));
}
VertxOptions vertxOptions = new VertxOptions();
vertxOptions.setClusterPort(endpointConfiguration.getPort());
vertxOptions.setClusterHost(endpointConfiguration.getHost());
vertxFactory.clusteredVertx(vertxOptions, asyncLoadingHandler);
} else {
if (log.isDebugEnabled()) {
log.debug(String.format("Creating new Vert.x instance '%s:%s' ...", endpointConfiguration.getHost(), 0L));
}
VertxOptions vertxOptions = new VertxOptions();
vertxOptions.setClusterPort(0);
vertxOptions.setClusterHost(endpointConfiguration.getHost());
vertxFactory.clusteredVertx(vertxOptions, asyncLoadingHandler);
}
// Wait for full loading
while (!loading.isComplete()) {
try {
log.debug("Waiting for Vert.x instance to startup");
Thread.sleep(250L);
} catch (InterruptedException e) {
log.warn("Interrupted while waiting for Vert.x instance startup", e);
}
}
return vertx[0];
} | java | protected Vertx createVertx(VertxEndpointConfiguration endpointConfiguration) {
final Vertx[] vertx = new Vertx[1];
final Future loading = new FutureFactoryImpl().future();
Handler<AsyncResult<Vertx>> asyncLoadingHandler = new Handler<AsyncResult<Vertx>>() {
@Override
public void handle(AsyncResult<Vertx> event) {
vertx[0] = event.result();
loading.complete();
log.info("Vert.x instance started");
}
};
if (endpointConfiguration.getPort() > 0) {
if (log.isDebugEnabled()) {
log.debug(String.format("Creating new Vert.x instance '%s:%s' ...", endpointConfiguration.getHost(), endpointConfiguration.getPort()));
}
VertxOptions vertxOptions = new VertxOptions();
vertxOptions.setClusterPort(endpointConfiguration.getPort());
vertxOptions.setClusterHost(endpointConfiguration.getHost());
vertxFactory.clusteredVertx(vertxOptions, asyncLoadingHandler);
} else {
if (log.isDebugEnabled()) {
log.debug(String.format("Creating new Vert.x instance '%s:%s' ...", endpointConfiguration.getHost(), 0L));
}
VertxOptions vertxOptions = new VertxOptions();
vertxOptions.setClusterPort(0);
vertxOptions.setClusterHost(endpointConfiguration.getHost());
vertxFactory.clusteredVertx(vertxOptions, asyncLoadingHandler);
}
// Wait for full loading
while (!loading.isComplete()) {
try {
log.debug("Waiting for Vert.x instance to startup");
Thread.sleep(250L);
} catch (InterruptedException e) {
log.warn("Interrupted while waiting for Vert.x instance startup", e);
}
}
return vertx[0];
} | [
"protected",
"Vertx",
"createVertx",
"(",
"VertxEndpointConfiguration",
"endpointConfiguration",
")",
"{",
"final",
"Vertx",
"[",
"]",
"vertx",
"=",
"new",
"Vertx",
"[",
"1",
"]",
";",
"final",
"Future",
"loading",
"=",
"new",
"FutureFactoryImpl",
"(",
")",
".... | Creates new Vert.x instance with default factory. Subclasses may overwrite this
method in order to provide special Vert.x instance.
@return | [
"Creates",
"new",
"Vert",
".",
"x",
"instance",
"with",
"default",
"factory",
".",
"Subclasses",
"may",
"overwrite",
"this",
"method",
"in",
"order",
"to",
"provide",
"special",
"Vert",
".",
"x",
"instance",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-vertx/src/main/java/com/consol/citrus/vertx/factory/AbstractVertxInstanceFactory.java#L47-L89 | train |
citrusframework/citrus | modules/citrus-core/src/main/java/com/consol/citrus/functions/core/AbstractDateFunction.java | AbstractDateFunction.getDateValueOffset | protected int getDateValueOffset(String offsetString, char c) {
ArrayList<Character> charList = new ArrayList<Character>();
int index = offsetString.indexOf(c);
if (index != -1) {
for (int i = index-1; i >= 0; i--) {
if (Character.isDigit(offsetString.charAt(i))) {
charList.add(0, offsetString.charAt(i));
} else {
StringBuffer offsetValue = new StringBuffer();
offsetValue.append("0");
for (int j = 0; j < charList.size(); j++) {
offsetValue.append(charList.get(j));
}
if (offsetString.charAt(i) == '-') {
return Integer.valueOf("-" + offsetValue.toString());
} else {
return Integer.valueOf(offsetValue.toString());
}
}
}
}
return 0;
} | java | protected int getDateValueOffset(String offsetString, char c) {
ArrayList<Character> charList = new ArrayList<Character>();
int index = offsetString.indexOf(c);
if (index != -1) {
for (int i = index-1; i >= 0; i--) {
if (Character.isDigit(offsetString.charAt(i))) {
charList.add(0, offsetString.charAt(i));
} else {
StringBuffer offsetValue = new StringBuffer();
offsetValue.append("0");
for (int j = 0; j < charList.size(); j++) {
offsetValue.append(charList.get(j));
}
if (offsetString.charAt(i) == '-') {
return Integer.valueOf("-" + offsetValue.toString());
} else {
return Integer.valueOf(offsetValue.toString());
}
}
}
}
return 0;
} | [
"protected",
"int",
"getDateValueOffset",
"(",
"String",
"offsetString",
",",
"char",
"c",
")",
"{",
"ArrayList",
"<",
"Character",
">",
"charList",
"=",
"new",
"ArrayList",
"<",
"Character",
">",
"(",
")",
";",
"int",
"index",
"=",
"offsetString",
".",
"i... | Parse offset string and add or subtract date offset value.
@param offsetString
@param c
@return | [
"Parse",
"offset",
"string",
"and",
"add",
"or",
"subtract",
"date",
"offset",
"value",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/functions/core/AbstractDateFunction.java#L56-L82 | train |
citrusframework/citrus | modules/citrus-core/src/main/java/com/consol/citrus/report/JUnitReporter.java | JUnitReporter.createReportContent | private String createReportContent(String suiteName, List<TestResult> results, ReportTemplates templates) throws IOException {
final StringBuilder reportDetails = new StringBuilder();
for (TestResult result: results) {
Properties detailProps = new Properties();
detailProps.put("test.class", result.getClassName());
detailProps.put("test.name", StringEscapeUtils.escapeXml(result.getTestName()));
detailProps.put("test.duration", "0.0");
if (result.isFailed()) {
detailProps.put("test.error.cause", Optional.ofNullable(result.getCause()).map(Object::getClass).map(Class::getName).orElse(result.getFailureType()));
detailProps.put("test.error.msg", StringEscapeUtils.escapeXml(result.getErrorMessage()));
detailProps.put("test.error.stackTrace", Optional.ofNullable(result.getCause()).map(cause -> {
StringWriter writer = new StringWriter();
cause.printStackTrace(new PrintWriter(writer));
return writer.toString();
}).orElse(result.getFailureStack()));
reportDetails.append(PropertyUtils.replacePropertiesInString(templates.getFailedTemplate(), detailProps));
} else {
reportDetails.append(PropertyUtils.replacePropertiesInString(templates.getSuccessTemplate(), detailProps));
}
}
Properties reportProps = new Properties();
reportProps.put("test.suite", suiteName);
reportProps.put("test.cnt", Integer.toString(results.size()));
reportProps.put("test.skipped.cnt", Long.toString(results.stream().filter(TestResult::isSkipped).count()));
reportProps.put("test.failed.cnt", Long.toString(results.stream().filter(TestResult::isFailed).count()));
reportProps.put("test.success.cnt", Long.toString(results.stream().filter(TestResult::isSuccess).count()));
reportProps.put("test.error.cnt", "0");
reportProps.put("test.duration", "0.0");
reportProps.put("tests", reportDetails.toString());
return PropertyUtils.replacePropertiesInString(templates.getReportTemplate(), reportProps);
} | java | private String createReportContent(String suiteName, List<TestResult> results, ReportTemplates templates) throws IOException {
final StringBuilder reportDetails = new StringBuilder();
for (TestResult result: results) {
Properties detailProps = new Properties();
detailProps.put("test.class", result.getClassName());
detailProps.put("test.name", StringEscapeUtils.escapeXml(result.getTestName()));
detailProps.put("test.duration", "0.0");
if (result.isFailed()) {
detailProps.put("test.error.cause", Optional.ofNullable(result.getCause()).map(Object::getClass).map(Class::getName).orElse(result.getFailureType()));
detailProps.put("test.error.msg", StringEscapeUtils.escapeXml(result.getErrorMessage()));
detailProps.put("test.error.stackTrace", Optional.ofNullable(result.getCause()).map(cause -> {
StringWriter writer = new StringWriter();
cause.printStackTrace(new PrintWriter(writer));
return writer.toString();
}).orElse(result.getFailureStack()));
reportDetails.append(PropertyUtils.replacePropertiesInString(templates.getFailedTemplate(), detailProps));
} else {
reportDetails.append(PropertyUtils.replacePropertiesInString(templates.getSuccessTemplate(), detailProps));
}
}
Properties reportProps = new Properties();
reportProps.put("test.suite", suiteName);
reportProps.put("test.cnt", Integer.toString(results.size()));
reportProps.put("test.skipped.cnt", Long.toString(results.stream().filter(TestResult::isSkipped).count()));
reportProps.put("test.failed.cnt", Long.toString(results.stream().filter(TestResult::isFailed).count()));
reportProps.put("test.success.cnt", Long.toString(results.stream().filter(TestResult::isSuccess).count()));
reportProps.put("test.error.cnt", "0");
reportProps.put("test.duration", "0.0");
reportProps.put("tests", reportDetails.toString());
return PropertyUtils.replacePropertiesInString(templates.getReportTemplate(), reportProps);
} | [
"private",
"String",
"createReportContent",
"(",
"String",
"suiteName",
",",
"List",
"<",
"TestResult",
">",
"results",
",",
"ReportTemplates",
"templates",
")",
"throws",
"IOException",
"{",
"final",
"StringBuilder",
"reportDetails",
"=",
"new",
"StringBuilder",
"(... | Create report file for test class.
@param suiteName
@param results
@param templates
@return | [
"Create",
"report",
"file",
"for",
"test",
"class",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/report/JUnitReporter.java#L116-L149 | train |
citrusframework/citrus | modules/citrus-core/src/main/java/com/consol/citrus/report/JUnitReporter.java | JUnitReporter.createReportFile | private void createReportFile(String reportFileName, String content, File targetDirectory) {
if (!targetDirectory.exists()) {
if (!targetDirectory.mkdirs()) {
throw new CitrusRuntimeException("Unable to create report output directory: " + getReportDirectory() + (StringUtils.hasText(outputDirectory) ? "/" + outputDirectory : ""));
}
}
try (Writer fileWriter = new FileWriter(new File(targetDirectory, reportFileName))) {
fileWriter.append(content);
fileWriter.flush();
} catch (IOException e) {
log.error("Failed to create test report", e);
}
} | java | private void createReportFile(String reportFileName, String content, File targetDirectory) {
if (!targetDirectory.exists()) {
if (!targetDirectory.mkdirs()) {
throw new CitrusRuntimeException("Unable to create report output directory: " + getReportDirectory() + (StringUtils.hasText(outputDirectory) ? "/" + outputDirectory : ""));
}
}
try (Writer fileWriter = new FileWriter(new File(targetDirectory, reportFileName))) {
fileWriter.append(content);
fileWriter.flush();
} catch (IOException e) {
log.error("Failed to create test report", e);
}
} | [
"private",
"void",
"createReportFile",
"(",
"String",
"reportFileName",
",",
"String",
"content",
",",
"File",
"targetDirectory",
")",
"{",
"if",
"(",
"!",
"targetDirectory",
".",
"exists",
"(",
")",
")",
"{",
"if",
"(",
"!",
"targetDirectory",
".",
"mkdirs"... | Creates the JUnit report file
@param reportFileName The report file to write
@param content The String content of the report file | [
"Creates",
"the",
"JUnit",
"report",
"file"
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/report/JUnitReporter.java#L156-L169 | train |
citrusframework/citrus | modules/citrus-core/src/main/java/com/consol/citrus/validation/json/schema/JsonSchemaValidation.java | JsonSchemaValidation.validate | public ProcessingReport validate(Message message,
List<JsonSchemaRepository> schemaRepositories,
JsonMessageValidationContext validationContext,
ApplicationContext applicationContext) {
return validate(message, jsonSchemaFilter.filter(schemaRepositories, validationContext, applicationContext));
} | java | public ProcessingReport validate(Message message,
List<JsonSchemaRepository> schemaRepositories,
JsonMessageValidationContext validationContext,
ApplicationContext applicationContext) {
return validate(message, jsonSchemaFilter.filter(schemaRepositories, validationContext, applicationContext));
} | [
"public",
"ProcessingReport",
"validate",
"(",
"Message",
"message",
",",
"List",
"<",
"JsonSchemaRepository",
">",
"schemaRepositories",
",",
"JsonMessageValidationContext",
"validationContext",
",",
"ApplicationContext",
"applicationContext",
")",
"{",
"return",
"validate... | Validates the given message against a list of JsonSchemaRepositories under consideration of the actual context
@param message The message to be validated
@param schemaRepositories The schema repositories to be used for validation
@param validationContext The context of the validation to be used for the validation
@param applicationContext The application context to be used for the validation
@return A report holding the results of the validation | [
"Validates",
"the",
"given",
"message",
"against",
"a",
"list",
"of",
"JsonSchemaRepositories",
"under",
"consideration",
"of",
"the",
"actual",
"context"
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/validation/json/schema/JsonSchemaValidation.java#L69-L74 | train |
citrusframework/citrus | modules/citrus-core/src/main/java/com/consol/citrus/validation/json/schema/JsonSchemaValidation.java | JsonSchemaValidation.validate | private GraciousProcessingReport validate(Message message, List<SimpleJsonSchema> jsonSchemas) {
if (jsonSchemas.isEmpty()) {
return new GraciousProcessingReport(true);
} else {
List<ProcessingReport> processingReports = new LinkedList<>();
for (SimpleJsonSchema simpleJsonSchema : jsonSchemas) {
processingReports.add(validate(message, simpleJsonSchema));
}
return new GraciousProcessingReport(processingReports);
}
} | java | private GraciousProcessingReport validate(Message message, List<SimpleJsonSchema> jsonSchemas) {
if (jsonSchemas.isEmpty()) {
return new GraciousProcessingReport(true);
} else {
List<ProcessingReport> processingReports = new LinkedList<>();
for (SimpleJsonSchema simpleJsonSchema : jsonSchemas) {
processingReports.add(validate(message, simpleJsonSchema));
}
return new GraciousProcessingReport(processingReports);
}
} | [
"private",
"GraciousProcessingReport",
"validate",
"(",
"Message",
"message",
",",
"List",
"<",
"SimpleJsonSchema",
">",
"jsonSchemas",
")",
"{",
"if",
"(",
"jsonSchemas",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"new",
"GraciousProcessingReport",
"(",
"tru... | Validates a message against all schemas contained in the given json schema repository
@param message The message to be validated
@param jsonSchemas The list of json schemas to iterate over | [
"Validates",
"a",
"message",
"against",
"all",
"schemas",
"contained",
"in",
"the",
"given",
"json",
"schema",
"repository"
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/validation/json/schema/JsonSchemaValidation.java#L81-L91 | train |
citrusframework/citrus | modules/citrus-core/src/main/java/com/consol/citrus/validation/json/schema/JsonSchemaValidation.java | JsonSchemaValidation.validate | private ProcessingReport validate(Message message, SimpleJsonSchema simpleJsonSchema) {
try {
JsonNode receivedJson = objectMapper.readTree(message.getPayload(String.class));
return simpleJsonSchema.getSchema().validate(receivedJson);
} catch (IOException | ProcessingException e) {
throw new CitrusRuntimeException("Failed to validate Json schema", e);
}
} | java | private ProcessingReport validate(Message message, SimpleJsonSchema simpleJsonSchema) {
try {
JsonNode receivedJson = objectMapper.readTree(message.getPayload(String.class));
return simpleJsonSchema.getSchema().validate(receivedJson);
} catch (IOException | ProcessingException e) {
throw new CitrusRuntimeException("Failed to validate Json schema", e);
}
} | [
"private",
"ProcessingReport",
"validate",
"(",
"Message",
"message",
",",
"SimpleJsonSchema",
"simpleJsonSchema",
")",
"{",
"try",
"{",
"JsonNode",
"receivedJson",
"=",
"objectMapper",
".",
"readTree",
"(",
"message",
".",
"getPayload",
"(",
"String",
".",
"class... | Validates a given message against a given json schema
@param message The message to be validated
@param simpleJsonSchema The json schema to validate against
@return returns the report holding the result of the validation | [
"Validates",
"a",
"given",
"message",
"against",
"a",
"given",
"json",
"schema"
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/validation/json/schema/JsonSchemaValidation.java#L99-L106 | train |
citrusframework/citrus | modules/citrus-mail/src/main/java/com/consol/citrus/mail/server/MailServer.java | MailServer.invokeEndpointAdapter | protected Message invokeEndpointAdapter(MailMessage mail) {
if (splitMultipart) {
return split(mail.getPayload(MailRequest.class).getBody(), mail.getHeaders());
} else {
return getEndpointAdapter().handleMessage(mail);
}
} | java | protected Message invokeEndpointAdapter(MailMessage mail) {
if (splitMultipart) {
return split(mail.getPayload(MailRequest.class).getBody(), mail.getHeaders());
} else {
return getEndpointAdapter().handleMessage(mail);
}
} | [
"protected",
"Message",
"invokeEndpointAdapter",
"(",
"MailMessage",
"mail",
")",
"{",
"if",
"(",
"splitMultipart",
")",
"{",
"return",
"split",
"(",
"mail",
".",
"getPayload",
"(",
"MailRequest",
".",
"class",
")",
".",
"getBody",
"(",
")",
",",
"mail",
"... | Invokes the endpoint adapter with constructed mail message and headers.
@param mail | [
"Invokes",
"the",
"endpoint",
"adapter",
"with",
"constructed",
"mail",
"message",
"and",
"headers",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-mail/src/main/java/com/consol/citrus/mail/server/MailServer.java#L148-L154 | train |
citrusframework/citrus | modules/citrus-mail/src/main/java/com/consol/citrus/mail/server/MailServer.java | MailServer.split | private Message split(BodyPart bodyPart, Map<String, Object> messageHeaders) {
MailMessage mailRequest = createMailMessage(messageHeaders, bodyPart.getContent(), bodyPart.getContentType());
Stack<Message> responseStack = new Stack<>();
if (bodyPart instanceof AttachmentPart) {
fillStack(getEndpointAdapter().handleMessage(mailRequest
.setHeader(CitrusMailMessageHeaders.MAIL_CONTENT_TYPE, bodyPart.getContentType())
.setHeader(CitrusMailMessageHeaders.MAIL_FILENAME, ((AttachmentPart) bodyPart).getFileName())), responseStack);
} else {
fillStack(getEndpointAdapter().handleMessage(mailRequest
.setHeader(CitrusMailMessageHeaders.MAIL_CONTENT_TYPE, bodyPart.getContentType())), responseStack);
}
if (bodyPart.hasAttachments()) {
for (AttachmentPart attachmentPart : bodyPart.getAttachments().getAttachments()) {
fillStack(split(attachmentPart, messageHeaders), responseStack);
}
}
return responseStack.isEmpty() ? null : responseStack.pop();
} | java | private Message split(BodyPart bodyPart, Map<String, Object> messageHeaders) {
MailMessage mailRequest = createMailMessage(messageHeaders, bodyPart.getContent(), bodyPart.getContentType());
Stack<Message> responseStack = new Stack<>();
if (bodyPart instanceof AttachmentPart) {
fillStack(getEndpointAdapter().handleMessage(mailRequest
.setHeader(CitrusMailMessageHeaders.MAIL_CONTENT_TYPE, bodyPart.getContentType())
.setHeader(CitrusMailMessageHeaders.MAIL_FILENAME, ((AttachmentPart) bodyPart).getFileName())), responseStack);
} else {
fillStack(getEndpointAdapter().handleMessage(mailRequest
.setHeader(CitrusMailMessageHeaders.MAIL_CONTENT_TYPE, bodyPart.getContentType())), responseStack);
}
if (bodyPart.hasAttachments()) {
for (AttachmentPart attachmentPart : bodyPart.getAttachments().getAttachments()) {
fillStack(split(attachmentPart, messageHeaders), responseStack);
}
}
return responseStack.isEmpty() ? null : responseStack.pop();
} | [
"private",
"Message",
"split",
"(",
"BodyPart",
"bodyPart",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"messageHeaders",
")",
"{",
"MailMessage",
"mailRequest",
"=",
"createMailMessage",
"(",
"messageHeaders",
",",
"bodyPart",
".",
"getContent",
"(",
")",
... | Split mail message into several messages. Each body and each attachment results in separate message
invoked on endpoint adapter. Mail message response if any should be sent only once within test case.
However latest mail response sent by test case is returned, others are ignored.
@param bodyPart
@param messageHeaders | [
"Split",
"mail",
"message",
"into",
"several",
"messages",
".",
"Each",
"body",
"and",
"each",
"attachment",
"results",
"in",
"separate",
"message",
"invoked",
"on",
"endpoint",
"adapter",
".",
"Mail",
"message",
"response",
"if",
"any",
"should",
"be",
"sent"... | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-mail/src/main/java/com/consol/citrus/mail/server/MailServer.java#L164-L184 | train |
citrusframework/citrus | modules/citrus-core/src/main/java/com/consol/citrus/config/xml/SchemaRepositoryParser.java | SchemaRepositoryParser.registerJsonSchemaRepository | private void registerJsonSchemaRepository(Element element, ParserContext parserContext) {
BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition(JsonSchemaRepository.class);
addLocationsToBuilder(element, builder);
parseSchemasElement(element, builder, parserContext);
parserContext.getRegistry().registerBeanDefinition(element.getAttribute(ID), builder.getBeanDefinition());
} | java | private void registerJsonSchemaRepository(Element element, ParserContext parserContext) {
BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition(JsonSchemaRepository.class);
addLocationsToBuilder(element, builder);
parseSchemasElement(element, builder, parserContext);
parserContext.getRegistry().registerBeanDefinition(element.getAttribute(ID), builder.getBeanDefinition());
} | [
"private",
"void",
"registerJsonSchemaRepository",
"(",
"Element",
"element",
",",
"ParserContext",
"parserContext",
")",
"{",
"BeanDefinitionBuilder",
"builder",
"=",
"BeanDefinitionBuilder",
".",
"genericBeanDefinition",
"(",
"JsonSchemaRepository",
".",
"class",
")",
"... | Registers a JsonSchemaRepository definition in the parser context
@param element The element to be converted into a JsonSchemaRepository definition
@param parserContext The parser context to add the definitions to | [
"Registers",
"a",
"JsonSchemaRepository",
"definition",
"in",
"the",
"parser",
"context"
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/config/xml/SchemaRepositoryParser.java#L69-L74 | train |
citrusframework/citrus | modules/citrus-core/src/main/java/com/consol/citrus/config/xml/SchemaRepositoryParser.java | SchemaRepositoryParser.registerXmlSchemaRepository | private void registerXmlSchemaRepository(Element element, ParserContext parserContext) {
BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition(XsdSchemaRepository.class);
BeanDefinitionParserUtils.setPropertyReference(builder, element.getAttribute("schema-mapping-strategy"), "schemaMappingStrategy");
addLocationsToBuilder(element, builder);
parseSchemasElement(element, builder, parserContext);
parserContext.getRegistry().registerBeanDefinition(element.getAttribute(ID), builder.getBeanDefinition());
} | java | private void registerXmlSchemaRepository(Element element, ParserContext parserContext) {
BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition(XsdSchemaRepository.class);
BeanDefinitionParserUtils.setPropertyReference(builder, element.getAttribute("schema-mapping-strategy"), "schemaMappingStrategy");
addLocationsToBuilder(element, builder);
parseSchemasElement(element, builder, parserContext);
parserContext.getRegistry().registerBeanDefinition(element.getAttribute(ID), builder.getBeanDefinition());
} | [
"private",
"void",
"registerXmlSchemaRepository",
"(",
"Element",
"element",
",",
"ParserContext",
"parserContext",
")",
"{",
"BeanDefinitionBuilder",
"builder",
"=",
"BeanDefinitionBuilder",
".",
"genericBeanDefinition",
"(",
"XsdSchemaRepository",
".",
"class",
")",
";"... | Registers a XsdSchemaRepository definition in the parser context
@param element The element to be converted into a XmlSchemaRepository definition
@param parserContext The parser context to add the definitions to | [
"Registers",
"a",
"XsdSchemaRepository",
"definition",
"in",
"the",
"parser",
"context"
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/config/xml/SchemaRepositoryParser.java#L81-L87 | train |
citrusframework/citrus | modules/citrus-core/src/main/java/com/consol/citrus/config/xml/SchemaRepositoryParser.java | SchemaRepositoryParser.isXmlSchemaRepository | private boolean isXmlSchemaRepository(Element element) {
String schemaRepositoryType = element.getAttribute("type");
return StringUtils.isEmpty(schemaRepositoryType) || "xml".equals(schemaRepositoryType);
} | java | private boolean isXmlSchemaRepository(Element element) {
String schemaRepositoryType = element.getAttribute("type");
return StringUtils.isEmpty(schemaRepositoryType) || "xml".equals(schemaRepositoryType);
} | [
"private",
"boolean",
"isXmlSchemaRepository",
"(",
"Element",
"element",
")",
"{",
"String",
"schemaRepositoryType",
"=",
"element",
".",
"getAttribute",
"(",
"\"type\"",
")",
";",
"return",
"StringUtils",
".",
"isEmpty",
"(",
"schemaRepositoryType",
")",
"||",
"... | Decides whether the given element is a xml schema repository.
Note:
If the "type" attribute has not been set, the repository is interpreted as a xml repository by definition.
This is important to guarantee downwards compatibility.
@param element The element to be checked
@return Whether the given element is a xml schema repository | [
"Decides",
"whether",
"the",
"given",
"element",
"is",
"a",
"xml",
"schema",
"repository",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/config/xml/SchemaRepositoryParser.java#L98-L101 | train |
citrusframework/citrus | modules/citrus-core/src/main/java/com/consol/citrus/config/xml/SchemaRepositoryParser.java | SchemaRepositoryParser.addLocationsToBuilder | private void addLocationsToBuilder(Element element, BeanDefinitionBuilder builder) {
Element locationsElement = DomUtils.getChildElementByTagName(element, LOCATIONS);
if (locationsElement != null) {
List<Element> locationElements = DomUtils.getChildElementsByTagName(locationsElement, LOCATION);
List<String> locations = locationElements.stream()
.map(locationElement -> locationElement.getAttribute("path"))
.collect(Collectors.toList());
if (!locations.isEmpty()) {
builder.addPropertyValue(LOCATIONS, locations);
}
}
} | java | private void addLocationsToBuilder(Element element, BeanDefinitionBuilder builder) {
Element locationsElement = DomUtils.getChildElementByTagName(element, LOCATIONS);
if (locationsElement != null) {
List<Element> locationElements = DomUtils.getChildElementsByTagName(locationsElement, LOCATION);
List<String> locations = locationElements.stream()
.map(locationElement -> locationElement.getAttribute("path"))
.collect(Collectors.toList());
if (!locations.isEmpty()) {
builder.addPropertyValue(LOCATIONS, locations);
}
}
} | [
"private",
"void",
"addLocationsToBuilder",
"(",
"Element",
"element",
",",
"BeanDefinitionBuilder",
"builder",
")",
"{",
"Element",
"locationsElement",
"=",
"DomUtils",
".",
"getChildElementByTagName",
"(",
"element",
",",
"LOCATIONS",
")",
";",
"if",
"(",
"locatio... | Adds the locations contained in the given locations element to the BeanDefinitionBuilder
@param element the element containing the locations to be added to the builder
@param builder the BeanDefinitionBuilder to add the locations to | [
"Adds",
"the",
"locations",
"contained",
"in",
"the",
"given",
"locations",
"element",
"to",
"the",
"BeanDefinitionBuilder"
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/config/xml/SchemaRepositoryParser.java#L118-L131 | train |
citrusframework/citrus | modules/citrus-core/src/main/java/com/consol/citrus/config/xml/SchemaRepositoryParser.java | SchemaRepositoryParser.parseSchemasElement | private void parseSchemasElement(Element element,
BeanDefinitionBuilder builder,
ParserContext parserContext) {
Element schemasElement = DomUtils.getChildElementByTagName(element, SCHEMAS);
if (schemasElement != null) {
List<Element> schemaElements = DomUtils.getChildElements(schemasElement);
ManagedList<RuntimeBeanReference> beanReferences = constructRuntimeBeanReferences(parserContext, schemaElements);
if (!beanReferences.isEmpty()) {
builder.addPropertyValue(SCHEMAS, beanReferences);
}
}
} | java | private void parseSchemasElement(Element element,
BeanDefinitionBuilder builder,
ParserContext parserContext) {
Element schemasElement = DomUtils.getChildElementByTagName(element, SCHEMAS);
if (schemasElement != null) {
List<Element> schemaElements = DomUtils.getChildElements(schemasElement);
ManagedList<RuntimeBeanReference> beanReferences = constructRuntimeBeanReferences(parserContext, schemaElements);
if (!beanReferences.isEmpty()) {
builder.addPropertyValue(SCHEMAS, beanReferences);
}
}
} | [
"private",
"void",
"parseSchemasElement",
"(",
"Element",
"element",
",",
"BeanDefinitionBuilder",
"builder",
",",
"ParserContext",
"parserContext",
")",
"{",
"Element",
"schemasElement",
"=",
"DomUtils",
".",
"getChildElementByTagName",
"(",
"element",
",",
"SCHEMAS",
... | Parses the given schema element to RuntimeBeanReference in consideration of the given context
and adds them to the builder
@param element The element from where the schemas will be parsed
@param builder The builder to add the resulting RuntimeBeanReference to
@param parserContext The context to parse the schema elements in | [
"Parses",
"the",
"given",
"schema",
"element",
"to",
"RuntimeBeanReference",
"in",
"consideration",
"of",
"the",
"given",
"context",
"and",
"adds",
"them",
"to",
"the",
"builder"
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/config/xml/SchemaRepositoryParser.java#L140-L153 | train |
citrusframework/citrus | modules/citrus-core/src/main/java/com/consol/citrus/config/xml/SchemaRepositoryParser.java | SchemaRepositoryParser.constructRuntimeBeanReferences | private ManagedList<RuntimeBeanReference> constructRuntimeBeanReferences(
ParserContext parserContext,
List<Element> schemaElements) {
ManagedList<RuntimeBeanReference> runtimeBeanReferences = new ManagedList<>();
for (Element schemaElement : schemaElements) {
if (schemaElement.hasAttribute(SCHEMA)) {
runtimeBeanReferences.add(
new RuntimeBeanReference(schemaElement.getAttribute(SCHEMA)));
} else {
schemaParser.parse(schemaElement, parserContext);
runtimeBeanReferences.add(
new RuntimeBeanReference(schemaElement.getAttribute(ID)));
}
}
return runtimeBeanReferences;
} | java | private ManagedList<RuntimeBeanReference> constructRuntimeBeanReferences(
ParserContext parserContext,
List<Element> schemaElements) {
ManagedList<RuntimeBeanReference> runtimeBeanReferences = new ManagedList<>();
for (Element schemaElement : schemaElements) {
if (schemaElement.hasAttribute(SCHEMA)) {
runtimeBeanReferences.add(
new RuntimeBeanReference(schemaElement.getAttribute(SCHEMA)));
} else {
schemaParser.parse(schemaElement, parserContext);
runtimeBeanReferences.add(
new RuntimeBeanReference(schemaElement.getAttribute(ID)));
}
}
return runtimeBeanReferences;
} | [
"private",
"ManagedList",
"<",
"RuntimeBeanReference",
">",
"constructRuntimeBeanReferences",
"(",
"ParserContext",
"parserContext",
",",
"List",
"<",
"Element",
">",
"schemaElements",
")",
"{",
"ManagedList",
"<",
"RuntimeBeanReference",
">",
"runtimeBeanReferences",
"="... | Construct a List of RuntimeBeanReferences from the given list of schema elements under
consideration of the given parser context
@param parserContext The context to parse the elements in
@param schemaElements The element to be parsed
@return A list of RuntimeBeanReferences that have been defined in the xml document | [
"Construct",
"a",
"List",
"of",
"RuntimeBeanReferences",
"from",
"the",
"given",
"list",
"of",
"schema",
"elements",
"under",
"consideration",
"of",
"the",
"given",
"parser",
"context"
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/config/xml/SchemaRepositoryParser.java#L162-L180 | train |
citrusframework/citrus | modules/citrus-ssh/src/main/java/com/consol/citrus/ssh/server/SinglePublicKeyAuthenticator.java | SinglePublicKeyAuthenticator.readKey | private PublicKey readKey(InputStream is) {
InputStreamReader isr = new InputStreamReader(is);
PEMParser r = new PEMParser(isr);
try {
Object o = r.readObject();
if (o instanceof PEMKeyPair) {
PEMKeyPair keyPair = (PEMKeyPair) o;
if (keyPair.getPublicKeyInfo() != null &&
keyPair.getPublicKeyInfo().getEncoded().length > 0) {
return provider.getPublicKey(keyPair.getPublicKeyInfo());
}
} else if (o instanceof SubjectPublicKeyInfo) {
return provider.getPublicKey((SubjectPublicKeyInfo) o);
}
} catch (IOException e) {
// Ignoring, returning null
log.warn("Failed to get key from PEM file", e);
} finally {
IoUtils.closeQuietly(isr,r);
}
return null;
} | java | private PublicKey readKey(InputStream is) {
InputStreamReader isr = new InputStreamReader(is);
PEMParser r = new PEMParser(isr);
try {
Object o = r.readObject();
if (o instanceof PEMKeyPair) {
PEMKeyPair keyPair = (PEMKeyPair) o;
if (keyPair.getPublicKeyInfo() != null &&
keyPair.getPublicKeyInfo().getEncoded().length > 0) {
return provider.getPublicKey(keyPair.getPublicKeyInfo());
}
} else if (o instanceof SubjectPublicKeyInfo) {
return provider.getPublicKey((SubjectPublicKeyInfo) o);
}
} catch (IOException e) {
// Ignoring, returning null
log.warn("Failed to get key from PEM file", e);
} finally {
IoUtils.closeQuietly(isr,r);
}
return null;
} | [
"private",
"PublicKey",
"readKey",
"(",
"InputStream",
"is",
")",
"{",
"InputStreamReader",
"isr",
"=",
"new",
"InputStreamReader",
"(",
"is",
")",
";",
"PEMParser",
"r",
"=",
"new",
"PEMParser",
"(",
"isr",
")",
";",
"try",
"{",
"Object",
"o",
"=",
"r",... | Read the key with bouncycastle's PEM tools
@param is
@return | [
"Read",
"the",
"key",
"with",
"bouncycastle",
"s",
"PEM",
"tools"
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-ssh/src/main/java/com/consol/citrus/ssh/server/SinglePublicKeyAuthenticator.java#L87-L109 | train |
citrusframework/citrus | modules/citrus-websocket/src/main/java/com/consol/citrus/websocket/handler/CitrusWebSocketHandler.java | CitrusWebSocketHandler.sendMessage | public boolean sendMessage(WebSocketMessage<?> message) {
boolean sentSuccessfully = false;
if (sessions.isEmpty()) {
LOG.warn("No Web Socket session exists - message cannot be sent");
}
for (WebSocketSession session : sessions.values()) {
if (session != null && session.isOpen()) {
try {
session.sendMessage(message);
sentSuccessfully = true;
} catch (IOException e) {
LOG.error(String.format("(%s) error sending message", session.getId()), e);
}
}
}
return sentSuccessfully;
} | java | public boolean sendMessage(WebSocketMessage<?> message) {
boolean sentSuccessfully = false;
if (sessions.isEmpty()) {
LOG.warn("No Web Socket session exists - message cannot be sent");
}
for (WebSocketSession session : sessions.values()) {
if (session != null && session.isOpen()) {
try {
session.sendMessage(message);
sentSuccessfully = true;
} catch (IOException e) {
LOG.error(String.format("(%s) error sending message", session.getId()), e);
}
}
}
return sentSuccessfully;
} | [
"public",
"boolean",
"sendMessage",
"(",
"WebSocketMessage",
"<",
"?",
">",
"message",
")",
"{",
"boolean",
"sentSuccessfully",
"=",
"false",
";",
"if",
"(",
"sessions",
".",
"isEmpty",
"(",
")",
")",
"{",
"LOG",
".",
"warn",
"(",
"\"No Web Socket session ex... | Publish message to all sessions known to this handler.
@param message
@return | [
"Publish",
"message",
"to",
"all",
"sessions",
"known",
"to",
"this",
"handler",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-websocket/src/main/java/com/consol/citrus/websocket/handler/CitrusWebSocketHandler.java#L94-L111 | train |
citrusframework/citrus | modules/citrus-core/src/main/java/com/consol/citrus/validation/matcher/ValidationMatcherRegistry.java | ValidationMatcherRegistry.getLibraryForPrefix | public ValidationMatcherLibrary getLibraryForPrefix(String validationMatcherPrefix) {
if (validationMatcherLibraries != null) {
for (ValidationMatcherLibrary validationMatcherLibrary : validationMatcherLibraries) {
if (validationMatcherLibrary.getPrefix().equals(validationMatcherPrefix)) {
return validationMatcherLibrary;
}
}
}
throw new NoSuchValidationMatcherLibraryException("Can not find validationMatcher library for prefix " + validationMatcherPrefix);
} | java | public ValidationMatcherLibrary getLibraryForPrefix(String validationMatcherPrefix) {
if (validationMatcherLibraries != null) {
for (ValidationMatcherLibrary validationMatcherLibrary : validationMatcherLibraries) {
if (validationMatcherLibrary.getPrefix().equals(validationMatcherPrefix)) {
return validationMatcherLibrary;
}
}
}
throw new NoSuchValidationMatcherLibraryException("Can not find validationMatcher library for prefix " + validationMatcherPrefix);
} | [
"public",
"ValidationMatcherLibrary",
"getLibraryForPrefix",
"(",
"String",
"validationMatcherPrefix",
")",
"{",
"if",
"(",
"validationMatcherLibraries",
"!=",
"null",
")",
"{",
"for",
"(",
"ValidationMatcherLibrary",
"validationMatcherLibrary",
":",
"validationMatcherLibrari... | Get library for validationMatcher prefix.
@param validationMatcherPrefix to be searched for
@return ValidationMatcherLibrary instance | [
"Get",
"library",
"for",
"validationMatcher",
"prefix",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/validation/matcher/ValidationMatcherRegistry.java#L40-L50 | train |
citrusframework/citrus | modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/builder/WaitConditionBuilder.java | WaitConditionBuilder.ms | public S ms(Long milliseconds) {
builder.milliseconds(String.valueOf(milliseconds));
return self;
} | java | public S ms(Long milliseconds) {
builder.milliseconds(String.valueOf(milliseconds));
return self;
} | [
"public",
"S",
"ms",
"(",
"Long",
"milliseconds",
")",
"{",
"builder",
".",
"milliseconds",
"(",
"String",
".",
"valueOf",
"(",
"milliseconds",
")",
")",
";",
"return",
"self",
";",
"}"
] | The total length of milliseconds to wait on the condition to be satisfied
@param milliseconds
@return | [
"The",
"total",
"length",
"of",
"milliseconds",
"to",
"wait",
"on",
"the",
"condition",
"to",
"be",
"satisfied"
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/builder/WaitConditionBuilder.java#L83-L86 | train |
citrusframework/citrus | modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/builder/WaitConditionBuilder.java | WaitConditionBuilder.interval | public S interval(Long interval) {
builder.interval(String.valueOf(interval));
return self;
} | java | public S interval(Long interval) {
builder.interval(String.valueOf(interval));
return self;
} | [
"public",
"S",
"interval",
"(",
"Long",
"interval",
")",
"{",
"builder",
".",
"interval",
"(",
"String",
".",
"valueOf",
"(",
"interval",
")",
")",
";",
"return",
"self",
";",
"}"
] | The interval in seconds to use between each test of the condition
@param interval
@return | [
"The",
"interval",
"in",
"seconds",
"to",
"use",
"between",
"each",
"test",
"of",
"the",
"condition"
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/builder/WaitConditionBuilder.java#L123-L126 | train |
citrusframework/citrus | modules/citrus-selenium/src/main/java/com/consol/citrus/selenium/util/BrowserUtils.java | BrowserUtils.makeIECachingSafeUrl | public static String makeIECachingSafeUrl(String url, long unique) {
if (url.contains("timestamp=")) {
return url.replaceFirst("(.*)(timestamp=)(.*)([&#].*)", "$1$2" + unique + "$4")
.replaceFirst("(.*)(timestamp=)(.*)$", "$1$2" + unique);
} else {
return url.contains("?")
? url + "×tamp=" + unique
: url + "?timestamp=" + unique;
}
} | java | public static String makeIECachingSafeUrl(String url, long unique) {
if (url.contains("timestamp=")) {
return url.replaceFirst("(.*)(timestamp=)(.*)([&#].*)", "$1$2" + unique + "$4")
.replaceFirst("(.*)(timestamp=)(.*)$", "$1$2" + unique);
} else {
return url.contains("?")
? url + "×tamp=" + unique
: url + "?timestamp=" + unique;
}
} | [
"public",
"static",
"String",
"makeIECachingSafeUrl",
"(",
"String",
"url",
",",
"long",
"unique",
")",
"{",
"if",
"(",
"url",
".",
"contains",
"(",
"\"timestamp=\"",
")",
")",
"{",
"return",
"url",
".",
"replaceFirst",
"(",
"\"(.*)(timestamp=)(.*)([&#].*)\"",
... | Makes new unique URL to avoid IE caching.
@param url
@param unique
@return | [
"Makes",
"new",
"unique",
"URL",
"to",
"avoid",
"IE",
"caching",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-selenium/src/main/java/com/consol/citrus/selenium/util/BrowserUtils.java#L38-L47 | train |
citrusframework/citrus | modules/citrus-core/src/main/java/com/consol/citrus/report/FailureStackElement.java | FailureStackElement.getStackMessage | public String getStackMessage() {
if (lineNumberEnd.longValue() > 0 && !lineNumberStart.equals(lineNumberEnd)) {
return "at " + testFilePath + "(" + actionName + ":" + lineNumberStart + "-" + lineNumberEnd + ")";
} else {
return "at " + testFilePath + "(" + actionName + ":" + lineNumberStart + ")";
}
} | java | public String getStackMessage() {
if (lineNumberEnd.longValue() > 0 && !lineNumberStart.equals(lineNumberEnd)) {
return "at " + testFilePath + "(" + actionName + ":" + lineNumberStart + "-" + lineNumberEnd + ")";
} else {
return "at " + testFilePath + "(" + actionName + ":" + lineNumberStart + ")";
}
} | [
"public",
"String",
"getStackMessage",
"(",
")",
"{",
"if",
"(",
"lineNumberEnd",
".",
"longValue",
"(",
")",
">",
"0",
"&&",
"!",
"lineNumberStart",
".",
"equals",
"(",
"lineNumberEnd",
")",
")",
"{",
"return",
"\"at \"",
"+",
"testFilePath",
"+",
"\"(\""... | Constructs the stack trace message.
@return the stack trace message. | [
"Constructs",
"the",
"stack",
"trace",
"message",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/report/FailureStackElement.java#L54-L60 | train |
citrusframework/citrus | modules/citrus-docker/src/main/java/com/consol/citrus/docker/command/AbstractDockerCommand.java | AbstractDockerCommand.success | protected ResponseItem success() {
ResponseItem response = new ResponseItem();
Field statusField = ReflectionUtils.findField(ResponseItem.class, "status");
ReflectionUtils.makeAccessible(statusField);
ReflectionUtils.setField(statusField, response, "success");
return response;
} | java | protected ResponseItem success() {
ResponseItem response = new ResponseItem();
Field statusField = ReflectionUtils.findField(ResponseItem.class, "status");
ReflectionUtils.makeAccessible(statusField);
ReflectionUtils.setField(statusField, response, "success");
return response;
} | [
"protected",
"ResponseItem",
"success",
"(",
")",
"{",
"ResponseItem",
"response",
"=",
"new",
"ResponseItem",
"(",
")",
";",
"Field",
"statusField",
"=",
"ReflectionUtils",
".",
"findField",
"(",
"ResponseItem",
".",
"class",
",",
"\"status\"",
")",
";",
"Ref... | Construct default success response for commands without return value.
@return | [
"Construct",
"default",
"success",
"response",
"for",
"commands",
"without",
"return",
"value",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-docker/src/main/java/com/consol/citrus/docker/command/AbstractDockerCommand.java#L61-L68 | train |
citrusframework/citrus | modules/citrus-docker/src/main/java/com/consol/citrus/docker/command/AbstractDockerCommand.java | AbstractDockerCommand.getParameter | protected String getParameter(String parameterName, TestContext context) {
if (getParameters().containsKey(parameterName)) {
return context.replaceDynamicContentInString(getParameters().get(parameterName).toString());
} else {
throw new CitrusRuntimeException(String.format("Missing docker command parameter '%s'", parameterName));
}
} | java | protected String getParameter(String parameterName, TestContext context) {
if (getParameters().containsKey(parameterName)) {
return context.replaceDynamicContentInString(getParameters().get(parameterName).toString());
} else {
throw new CitrusRuntimeException(String.format("Missing docker command parameter '%s'", parameterName));
}
} | [
"protected",
"String",
"getParameter",
"(",
"String",
"parameterName",
",",
"TestContext",
"context",
")",
"{",
"if",
"(",
"getParameters",
"(",
")",
".",
"containsKey",
"(",
"parameterName",
")",
")",
"{",
"return",
"context",
".",
"replaceDynamicContentInString"... | Gets the docker command parameter.
@return | [
"Gets",
"the",
"docker",
"command",
"parameter",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-docker/src/main/java/com/consol/citrus/docker/command/AbstractDockerCommand.java#L99-L105 | train |
citrusframework/citrus | modules/citrus-kafka/src/main/java/com/consol/citrus/kafka/endpoint/KafkaEndpointBuilder.java | KafkaEndpointBuilder.producerProperties | public KafkaEndpointBuilder producerProperties(Map<String, Object> producerProperties) {
endpoint.getEndpointConfiguration().setProducerProperties(producerProperties);
return this;
} | java | public KafkaEndpointBuilder producerProperties(Map<String, Object> producerProperties) {
endpoint.getEndpointConfiguration().setProducerProperties(producerProperties);
return this;
} | [
"public",
"KafkaEndpointBuilder",
"producerProperties",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"producerProperties",
")",
"{",
"endpoint",
".",
"getEndpointConfiguration",
"(",
")",
".",
"setProducerProperties",
"(",
"producerProperties",
")",
";",
"return",
... | Sets the producer properties.
@param producerProperties
@return | [
"Sets",
"the",
"producer",
"properties",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-kafka/src/main/java/com/consol/citrus/kafka/endpoint/KafkaEndpointBuilder.java#L186-L189 | train |
citrusframework/citrus | modules/citrus-kafka/src/main/java/com/consol/citrus/kafka/endpoint/KafkaEndpointBuilder.java | KafkaEndpointBuilder.consumerProperties | public KafkaEndpointBuilder consumerProperties(Map<String, Object> consumerProperties) {
endpoint.getEndpointConfiguration().setConsumerProperties(consumerProperties);
return this;
} | java | public KafkaEndpointBuilder consumerProperties(Map<String, Object> consumerProperties) {
endpoint.getEndpointConfiguration().setConsumerProperties(consumerProperties);
return this;
} | [
"public",
"KafkaEndpointBuilder",
"consumerProperties",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"consumerProperties",
")",
"{",
"endpoint",
".",
"getEndpointConfiguration",
"(",
")",
".",
"setConsumerProperties",
"(",
"consumerProperties",
")",
";",
"return",
... | Sets the consumer properties.
@param consumerProperties
@return | [
"Sets",
"the",
"consumer",
"properties",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-kafka/src/main/java/com/consol/citrus/kafka/endpoint/KafkaEndpointBuilder.java#L196-L199 | train |
citrusframework/citrus | modules/citrus-core/src/main/java/com/consol/citrus/validation/text/PlainTextMessageValidator.java | PlainTextMessageValidator.validateText | private void validateText(String receivedMessagePayload, String controlMessagePayload) {
if (!StringUtils.hasText(controlMessagePayload)) {
log.debug("Skip message payload validation as no control message was defined");
return;
} else {
Assert.isTrue(StringUtils.hasText(receivedMessagePayload), "Validation failed - " +
"expected message contents, but received empty message!");
}
if (!receivedMessagePayload.equals(controlMessagePayload)) {
if (StringUtils.trimAllWhitespace(receivedMessagePayload).equals(StringUtils.trimAllWhitespace(controlMessagePayload))) {
throw new ValidationException("Text values not equal (only whitespaces!), expected '" + controlMessagePayload + "' " +
"but was '" + receivedMessagePayload + "'");
} else {
throw new ValidationException("Text values not equal, expected '" + controlMessagePayload + "' " +
"but was '" + receivedMessagePayload + "'");
}
}
} | java | private void validateText(String receivedMessagePayload, String controlMessagePayload) {
if (!StringUtils.hasText(controlMessagePayload)) {
log.debug("Skip message payload validation as no control message was defined");
return;
} else {
Assert.isTrue(StringUtils.hasText(receivedMessagePayload), "Validation failed - " +
"expected message contents, but received empty message!");
}
if (!receivedMessagePayload.equals(controlMessagePayload)) {
if (StringUtils.trimAllWhitespace(receivedMessagePayload).equals(StringUtils.trimAllWhitespace(controlMessagePayload))) {
throw new ValidationException("Text values not equal (only whitespaces!), expected '" + controlMessagePayload + "' " +
"but was '" + receivedMessagePayload + "'");
} else {
throw new ValidationException("Text values not equal, expected '" + controlMessagePayload + "' " +
"but was '" + receivedMessagePayload + "'");
}
}
} | [
"private",
"void",
"validateText",
"(",
"String",
"receivedMessagePayload",
",",
"String",
"controlMessagePayload",
")",
"{",
"if",
"(",
"!",
"StringUtils",
".",
"hasText",
"(",
"controlMessagePayload",
")",
")",
"{",
"log",
".",
"debug",
"(",
"\"Skip message payl... | Compares two string with each other in order to validate plain text.
@param receivedMessagePayload
@param controlMessagePayload | [
"Compares",
"two",
"string",
"with",
"each",
"other",
"in",
"order",
"to",
"validate",
"plain",
"text",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/validation/text/PlainTextMessageValidator.java#L168-L186 | train |
citrusframework/citrus | modules/citrus-core/src/main/java/com/consol/citrus/validation/text/PlainTextMessageValidator.java | PlainTextMessageValidator.normalizeWhitespace | private String normalizeWhitespace(String payload) {
if (ignoreWhitespace) {
StringBuilder result = new StringBuilder();
boolean lastWasSpace = true;
for (int i = 0; i < payload.length(); i++) {
char c = payload.charAt(i);
if (Character.isWhitespace(c)) {
if (!lastWasSpace) {
result.append(' ');
}
lastWasSpace = true;
} else {
result.append(c);
lastWasSpace = false;
}
}
return result.toString().trim();
}
if (ignoreNewLineType) {
return payload.replaceAll("\\r(\\n)?", "\n");
}
return payload;
} | java | private String normalizeWhitespace(String payload) {
if (ignoreWhitespace) {
StringBuilder result = new StringBuilder();
boolean lastWasSpace = true;
for (int i = 0; i < payload.length(); i++) {
char c = payload.charAt(i);
if (Character.isWhitespace(c)) {
if (!lastWasSpace) {
result.append(' ');
}
lastWasSpace = true;
} else {
result.append(c);
lastWasSpace = false;
}
}
return result.toString().trim();
}
if (ignoreNewLineType) {
return payload.replaceAll("\\r(\\n)?", "\n");
}
return payload;
} | [
"private",
"String",
"normalizeWhitespace",
"(",
"String",
"payload",
")",
"{",
"if",
"(",
"ignoreWhitespace",
")",
"{",
"StringBuilder",
"result",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"boolean",
"lastWasSpace",
"=",
"true",
";",
"for",
"(",
"int",
"i... | Normalize whitespace characters if appropriate. Based on system property settings this method normalizes
new line characters exclusively or filters all whitespaces such as double whitespaces and new lines.
@param payload
@return | [
"Normalize",
"whitespace",
"characters",
"if",
"appropriate",
".",
"Based",
"on",
"system",
"property",
"settings",
"this",
"method",
"normalizes",
"new",
"line",
"characters",
"exclusively",
"or",
"filters",
"all",
"whitespaces",
"such",
"as",
"double",
"whitespace... | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/validation/text/PlainTextMessageValidator.java#L195-L219 | train |
citrusframework/citrus | modules/citrus-http/src/main/java/com/consol/citrus/http/client/HttpClientBuilder.java | HttpClientBuilder.interceptor | public HttpClientBuilder interceptor(ClientHttpRequestInterceptor interceptor) {
if (endpoint.getEndpointConfiguration().getClientInterceptors() == null) {
endpoint.getEndpointConfiguration().setClientInterceptors(new ArrayList<ClientHttpRequestInterceptor>());
}
endpoint.getEndpointConfiguration().getClientInterceptors().add(interceptor);
return this;
} | java | public HttpClientBuilder interceptor(ClientHttpRequestInterceptor interceptor) {
if (endpoint.getEndpointConfiguration().getClientInterceptors() == null) {
endpoint.getEndpointConfiguration().setClientInterceptors(new ArrayList<ClientHttpRequestInterceptor>());
}
endpoint.getEndpointConfiguration().getClientInterceptors().add(interceptor);
return this;
} | [
"public",
"HttpClientBuilder",
"interceptor",
"(",
"ClientHttpRequestInterceptor",
"interceptor",
")",
"{",
"if",
"(",
"endpoint",
".",
"getEndpointConfiguration",
"(",
")",
".",
"getClientInterceptors",
"(",
")",
"==",
"null",
")",
"{",
"endpoint",
".",
"getEndpoin... | Sets a client single interceptor.
@param interceptor
@return | [
"Sets",
"a",
"client",
"single",
"interceptor",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-http/src/main/java/com/consol/citrus/http/client/HttpClientBuilder.java#L214-L221 | train |
citrusframework/citrus | modules/citrus-http/src/main/java/com/consol/citrus/http/validation/FormUrlEncodedMessageValidator.java | FormUrlEncodedMessageValidator.createFormData | private FormData createFormData(Message message) {
FormData formData = new ObjectFactory().createFormData();
formData.setContentType(getFormContentType(message));
formData.setAction(getFormAction(message));
if (message.getPayload() instanceof MultiValueMap) {
MultiValueMap<String, Object> formValueMap = message.getPayload(MultiValueMap.class);
for (Map.Entry<String, List<Object>> entry : formValueMap.entrySet()) {
Control control = new ObjectFactory().createControl();
control.setName(entry.getKey());
control.setValue(StringUtils.arrayToCommaDelimitedString(entry.getValue().toArray()));
formData.addControl(control);
}
} else {
String rawFormData = message.getPayload(String.class);
if (StringUtils.hasText(rawFormData)) {
StringTokenizer tokenizer = new StringTokenizer(rawFormData, "&");
while (tokenizer.hasMoreTokens()) {
Control control = new ObjectFactory().createControl();
String[] nameValuePair = tokenizer.nextToken().split("=");
if (autoDecode) {
try {
control.setName(URLDecoder.decode(nameValuePair[0], getEncoding()));
control.setValue(URLDecoder.decode(nameValuePair[1], getEncoding()));
} catch (UnsupportedEncodingException e) {
throw new CitrusRuntimeException(String.format("Failed to decode form control value '%s=%s'", nameValuePair[0], nameValuePair[1]), e);
}
} else {
control.setName(nameValuePair[0]);
control.setValue(nameValuePair[1]);
}
formData.addControl(control);
}
}
}
return formData;
} | java | private FormData createFormData(Message message) {
FormData formData = new ObjectFactory().createFormData();
formData.setContentType(getFormContentType(message));
formData.setAction(getFormAction(message));
if (message.getPayload() instanceof MultiValueMap) {
MultiValueMap<String, Object> formValueMap = message.getPayload(MultiValueMap.class);
for (Map.Entry<String, List<Object>> entry : formValueMap.entrySet()) {
Control control = new ObjectFactory().createControl();
control.setName(entry.getKey());
control.setValue(StringUtils.arrayToCommaDelimitedString(entry.getValue().toArray()));
formData.addControl(control);
}
} else {
String rawFormData = message.getPayload(String.class);
if (StringUtils.hasText(rawFormData)) {
StringTokenizer tokenizer = new StringTokenizer(rawFormData, "&");
while (tokenizer.hasMoreTokens()) {
Control control = new ObjectFactory().createControl();
String[] nameValuePair = tokenizer.nextToken().split("=");
if (autoDecode) {
try {
control.setName(URLDecoder.decode(nameValuePair[0], getEncoding()));
control.setValue(URLDecoder.decode(nameValuePair[1], getEncoding()));
} catch (UnsupportedEncodingException e) {
throw new CitrusRuntimeException(String.format("Failed to decode form control value '%s=%s'", nameValuePair[0], nameValuePair[1]), e);
}
} else {
control.setName(nameValuePair[0]);
control.setValue(nameValuePair[1]);
}
formData.addControl(control);
}
}
}
return formData;
} | [
"private",
"FormData",
"createFormData",
"(",
"Message",
"message",
")",
"{",
"FormData",
"formData",
"=",
"new",
"ObjectFactory",
"(",
")",
".",
"createFormData",
"(",
")",
";",
"formData",
".",
"setContentType",
"(",
"getFormContentType",
"(",
"message",
")",
... | Create form data model object from url encoded message payload.
@param message
@return | [
"Create",
"form",
"data",
"model",
"object",
"from",
"url",
"encoded",
"message",
"payload",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-http/src/main/java/com/consol/citrus/http/validation/FormUrlEncodedMessageValidator.java#L86-L126 | train |
citrusframework/citrus | modules/citrus-http/src/main/java/com/consol/citrus/http/validation/FormUrlEncodedMessageValidator.java | FormUrlEncodedMessageValidator.getFormAction | private String getFormAction(Message message) {
return message.getHeader(HttpMessageHeaders.HTTP_REQUEST_URI) != null ? message.getHeader(HttpMessageHeaders.HTTP_REQUEST_URI).toString() : null;
} | java | private String getFormAction(Message message) {
return message.getHeader(HttpMessageHeaders.HTTP_REQUEST_URI) != null ? message.getHeader(HttpMessageHeaders.HTTP_REQUEST_URI).toString() : null;
} | [
"private",
"String",
"getFormAction",
"(",
"Message",
"message",
")",
"{",
"return",
"message",
".",
"getHeader",
"(",
"HttpMessageHeaders",
".",
"HTTP_REQUEST_URI",
")",
"!=",
"null",
"?",
"message",
".",
"getHeader",
"(",
"HttpMessageHeaders",
".",
"HTTP_REQUEST... | Reads form action target from message headers.
@param message
@return | [
"Reads",
"form",
"action",
"target",
"from",
"message",
"headers",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-http/src/main/java/com/consol/citrus/http/validation/FormUrlEncodedMessageValidator.java#L143-L145 | train |
citrusframework/citrus | modules/citrus-http/src/main/java/com/consol/citrus/http/validation/FormUrlEncodedMessageValidator.java | FormUrlEncodedMessageValidator.getFormContentType | private String getFormContentType(Message message) {
return message.getHeader(HttpMessageHeaders.HTTP_CONTENT_TYPE) != null ? message.getHeader(HttpMessageHeaders.HTTP_CONTENT_TYPE).toString() : null;
} | java | private String getFormContentType(Message message) {
return message.getHeader(HttpMessageHeaders.HTTP_CONTENT_TYPE) != null ? message.getHeader(HttpMessageHeaders.HTTP_CONTENT_TYPE).toString() : null;
} | [
"private",
"String",
"getFormContentType",
"(",
"Message",
"message",
")",
"{",
"return",
"message",
".",
"getHeader",
"(",
"HttpMessageHeaders",
".",
"HTTP_CONTENT_TYPE",
")",
"!=",
"null",
"?",
"message",
".",
"getHeader",
"(",
"HttpMessageHeaders",
".",
"HTTP_C... | Reads form content type from message headers.
@param message
@return | [
"Reads",
"form",
"content",
"type",
"from",
"message",
"headers",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-http/src/main/java/com/consol/citrus/http/validation/FormUrlEncodedMessageValidator.java#L152-L154 | train |
citrusframework/citrus | modules/citrus-core/src/main/java/com/consol/citrus/variable/dictionary/AbstractDataDictionary.java | AbstractDataDictionary.convertIfNecessary | protected <T> T convertIfNecessary(String value, T originalValue) {
if (originalValue == null) {
return (T) value;
}
return TypeConversionUtils.convertIfNecessary(value, (Class<T>) originalValue.getClass());
} | java | protected <T> T convertIfNecessary(String value, T originalValue) {
if (originalValue == null) {
return (T) value;
}
return TypeConversionUtils.convertIfNecessary(value, (Class<T>) originalValue.getClass());
} | [
"protected",
"<",
"T",
">",
"T",
"convertIfNecessary",
"(",
"String",
"value",
",",
"T",
"originalValue",
")",
"{",
"if",
"(",
"originalValue",
"==",
"null",
")",
"{",
"return",
"(",
"T",
")",
"value",
";",
"}",
"return",
"TypeConversionUtils",
".",
"con... | Convert to original value type if necessary.
@param value
@param originalValue
@param <T>
@return | [
"Convert",
"to",
"original",
"value",
"type",
"if",
"necessary",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/variable/dictionary/AbstractDataDictionary.java#L62-L68 | train |
citrusframework/citrus | modules/citrus-http/src/main/java/com/consol/citrus/http/message/HttpQueryParamHeaderValidator.java | HttpQueryParamHeaderValidator.convertToMap | private Map<String, String> convertToMap(Object expression) {
if (expression instanceof Map) {
return (Map<String, String>) expression;
}
return Stream.of(Optional.ofNullable(expression)
.map(Object::toString)
.orElse("")
.split(","))
.map(keyValue -> Optional.ofNullable(StringUtils.split(keyValue, "=")).orElse(new String[] {keyValue, ""}))
.collect(Collectors.toMap(keyValue -> keyValue[0], keyValue -> keyValue[1]));
} | java | private Map<String, String> convertToMap(Object expression) {
if (expression instanceof Map) {
return (Map<String, String>) expression;
}
return Stream.of(Optional.ofNullable(expression)
.map(Object::toString)
.orElse("")
.split(","))
.map(keyValue -> Optional.ofNullable(StringUtils.split(keyValue, "=")).orElse(new String[] {keyValue, ""}))
.collect(Collectors.toMap(keyValue -> keyValue[0], keyValue -> keyValue[1]));
} | [
"private",
"Map",
"<",
"String",
",",
"String",
">",
"convertToMap",
"(",
"Object",
"expression",
")",
"{",
"if",
"(",
"expression",
"instanceof",
"Map",
")",
"{",
"return",
"(",
"Map",
"<",
"String",
",",
"String",
">",
")",
"expression",
";",
"}",
"r... | Convert query string key-value expression to map.
@param expression
@return | [
"Convert",
"query",
"string",
"key",
"-",
"value",
"expression",
"to",
"map",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-http/src/main/java/com/consol/citrus/http/message/HttpQueryParamHeaderValidator.java#L63-L74 | train |
citrusframework/citrus | modules/citrus-core/src/main/java/com/consol/citrus/validation/script/GroovyScriptMessageBuilder.java | GroovyScriptMessageBuilder.buildMessagePayload | public String buildMessagePayload(TestContext context, String messageType) {
try {
//construct control message payload
String messagePayload = "";
if (scriptResourcePath != null) {
messagePayload = buildMarkupBuilderScript(context.replaceDynamicContentInString(
FileUtils.readToString(FileUtils.getFileResource(scriptResourcePath, context), Charset.forName(context.resolveDynamicValue(scriptResourceCharset)))));
} else if (scriptData != null) {
messagePayload = buildMarkupBuilderScript(context.replaceDynamicContentInString(scriptData));
}
return messagePayload;
} catch (IOException e) {
throw new CitrusRuntimeException("Failed to build control message payload", e);
}
} | java | public String buildMessagePayload(TestContext context, String messageType) {
try {
//construct control message payload
String messagePayload = "";
if (scriptResourcePath != null) {
messagePayload = buildMarkupBuilderScript(context.replaceDynamicContentInString(
FileUtils.readToString(FileUtils.getFileResource(scriptResourcePath, context), Charset.forName(context.resolveDynamicValue(scriptResourceCharset)))));
} else if (scriptData != null) {
messagePayload = buildMarkupBuilderScript(context.replaceDynamicContentInString(scriptData));
}
return messagePayload;
} catch (IOException e) {
throw new CitrusRuntimeException("Failed to build control message payload", e);
}
} | [
"public",
"String",
"buildMessagePayload",
"(",
"TestContext",
"context",
",",
"String",
"messageType",
")",
"{",
"try",
"{",
"//construct control message payload",
"String",
"messagePayload",
"=",
"\"\"",
";",
"if",
"(",
"scriptResourcePath",
"!=",
"null",
")",
"{"... | Build the control message from script code. | [
"Build",
"the",
"control",
"message",
"from",
"script",
"code",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/validation/script/GroovyScriptMessageBuilder.java#L55-L70 | train |
citrusframework/citrus | modules/citrus-core/src/main/java/com/consol/citrus/validation/script/GroovyScriptMessageBuilder.java | GroovyScriptMessageBuilder.buildMarkupBuilderScript | private String buildMarkupBuilderScript(String scriptData) {
try {
ClassLoader parent = GroovyScriptMessageBuilder.class.getClassLoader();
GroovyClassLoader loader = new GroovyClassLoader(parent);
Class<?> groovyClass = loader.parseClass(TemplateBasedScriptBuilder.fromTemplateResource(scriptTemplateResource)
.withCode(scriptData)
.build());
if (groovyClass == null) {
throw new CitrusRuntimeException("Could not load groovy script!");
}
GroovyObject groovyObject = (GroovyObject) groovyClass.newInstance();
return (String) groovyObject.invokeMethod("run", new Object[] {});
} catch (CompilationFailedException e) {
throw new CitrusRuntimeException(e);
} catch (InstantiationException e) {
throw new CitrusRuntimeException(e);
} catch (IllegalAccessException e) {
throw new CitrusRuntimeException(e);
}
} | java | private String buildMarkupBuilderScript(String scriptData) {
try {
ClassLoader parent = GroovyScriptMessageBuilder.class.getClassLoader();
GroovyClassLoader loader = new GroovyClassLoader(parent);
Class<?> groovyClass = loader.parseClass(TemplateBasedScriptBuilder.fromTemplateResource(scriptTemplateResource)
.withCode(scriptData)
.build());
if (groovyClass == null) {
throw new CitrusRuntimeException("Could not load groovy script!");
}
GroovyObject groovyObject = (GroovyObject) groovyClass.newInstance();
return (String) groovyObject.invokeMethod("run", new Object[] {});
} catch (CompilationFailedException e) {
throw new CitrusRuntimeException(e);
} catch (InstantiationException e) {
throw new CitrusRuntimeException(e);
} catch (IllegalAccessException e) {
throw new CitrusRuntimeException(e);
}
} | [
"private",
"String",
"buildMarkupBuilderScript",
"(",
"String",
"scriptData",
")",
"{",
"try",
"{",
"ClassLoader",
"parent",
"=",
"GroovyScriptMessageBuilder",
".",
"class",
".",
"getClassLoader",
"(",
")",
";",
"GroovyClassLoader",
"loader",
"=",
"new",
"GroovyClas... | Builds an automatic Groovy MarkupBuilder script with given script body.
@param scriptData
@return | [
"Builds",
"an",
"automatic",
"Groovy",
"MarkupBuilder",
"script",
"with",
"given",
"script",
"body",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/validation/script/GroovyScriptMessageBuilder.java#L78-L100 | train |
citrusframework/citrus | modules/citrus-kubernetes/src/main/java/com/consol/citrus/kubernetes/command/AbstractCreateCommand.java | AbstractCreateCommand.getTemplateAsStream | protected InputStream getTemplateAsStream(TestContext context) {
Resource resource;
if (templateResource != null) {
resource = templateResource;
} else {
resource = FileUtils.getFileResource(template, context);
}
String templateYml;
try {
templateYml = context.replaceDynamicContentInString(FileUtils.readToString(resource));
} catch (IOException e) {
throw new CitrusRuntimeException("Failed to read template resource", e);
}
return new ByteArrayInputStream(templateYml.getBytes());
} | java | protected InputStream getTemplateAsStream(TestContext context) {
Resource resource;
if (templateResource != null) {
resource = templateResource;
} else {
resource = FileUtils.getFileResource(template, context);
}
String templateYml;
try {
templateYml = context.replaceDynamicContentInString(FileUtils.readToString(resource));
} catch (IOException e) {
throw new CitrusRuntimeException("Failed to read template resource", e);
}
return new ByteArrayInputStream(templateYml.getBytes());
} | [
"protected",
"InputStream",
"getTemplateAsStream",
"(",
"TestContext",
"context",
")",
"{",
"Resource",
"resource",
";",
"if",
"(",
"templateResource",
"!=",
"null",
")",
"{",
"resource",
"=",
"templateResource",
";",
"}",
"else",
"{",
"resource",
"=",
"FileUtil... | Create input stream from template resource and add test variable support.
@param context
@return | [
"Create",
"input",
"stream",
"from",
"template",
"resource",
"and",
"add",
"test",
"variable",
"support",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-kubernetes/src/main/java/com/consol/citrus/kubernetes/command/AbstractCreateCommand.java#L81-L96 | train |
citrusframework/citrus | modules/citrus-core/src/main/java/com/consol/citrus/actions/ExecuteSQLQueryAction.java | ExecuteSQLQueryAction.fillColumnValuesMap | private void fillColumnValuesMap(List<Map<String, Object>> results, Map<String, List<String>> columnValuesMap) {
for (Map<String, Object> row : results) {
for (Entry<String, Object> column : row.entrySet()) {
String columnValue;
String columnName = column.getKey();
if (!columnValuesMap.containsKey(columnName)) {
columnValuesMap.put(columnName, new ArrayList<String>());
}
if (column.getValue() instanceof byte[]) {
columnValue = Base64.encodeBase64String((byte[]) column.getValue());
} else {
columnValue = column.getValue() == null ? null : column.getValue().toString();
}
columnValuesMap.get(columnName).add((columnValue));
}
}
}
/**
* Gets the script validator implementation either autowired from application context
* or if not set here a default implementation.
*/
private SqlResultSetScriptValidator getScriptValidator() {
if (validator != null) {
return validator;
} else {
return new GroovySqlResultSetValidator();
}
}
/**
* Constructs a delimited string from multiple row values in result set in order to
* set this expression as variable value.
*
* @param rowValues the list of values representing the allResultRows for a column in the result set.
* @return the variable value as delimited string or single value.
*/
private String constructVariableValue(List<String> rowValues) {
if (CollectionUtils.isEmpty(rowValues)) {
return "";
} else if (rowValues.size() == 1) {
return rowValues.get(0) == null ? NULL_VALUE : rowValues.get(0);
} else {
StringBuilder result = new StringBuilder();
Iterator<String> it = rowValues.iterator();
result.append(it.next());
while (it.hasNext()) {
String nextValue = it.next();
result.append(";" + (nextValue == null ? NULL_VALUE : nextValue));
}
return result.toString();
}
}
/**
* Validates the database result set. At first script validation is done (if any was given).
* Afterwards the control result set validation is performed.
*
* @param columnValuesMap map containing column names as keys and list of string as retrieved values from db
* @param allResultRows list of all result rows retrieved from database
* @return success flag
* @throws UnknownElementException
* @throws ValidationException
*/
private void performValidation(final Map<String, List<String>> columnValuesMap,
List<Map<String, Object>> allResultRows, TestContext context)
throws UnknownElementException, ValidationException {
// apply script validation if specified
if (scriptValidationContext != null) {
getScriptValidator().validateSqlResultSet(allResultRows, scriptValidationContext, context);
}
//now apply control set validation if specified
if (CollectionUtils.isEmpty(controlResultSet)) {
return;
}
performControlResultSetValidation(columnValuesMap, context);
log.info("SQL query validation successful: All values OK");
}
private void performControlResultSetValidation(final Map<String, List<String>> columnValuesMap, TestContext context)
throws CitrusRuntimeException {
for (Entry<String, List<String>> controlEntry : controlResultSet.entrySet()) {
String columnName = controlEntry.getKey();
if (columnValuesMap.containsKey(columnName.toLowerCase())) {
columnName = columnName.toLowerCase();
} else if (columnValuesMap.containsKey(columnName.toUpperCase())) {
columnName = columnName.toUpperCase();
} else if (!columnValuesMap.containsKey(columnName)) {
throw new CitrusRuntimeException("Could not find column '" + columnName + "' in SQL result set");
}
List<String> resultColumnValues = columnValuesMap.get(columnName);
List<String> controlColumnValues = controlEntry.getValue();
// first check size of column values (representing number of allResultRows in result set)
if (resultColumnValues.size() != controlColumnValues.size()) {
throw new CitrusRuntimeException("Validation failed for column: '" + columnName + "' " +
"expected rows count: " + controlColumnValues.size() + " but was " + resultColumnValues.size());
}
Iterator<String> it = resultColumnValues.iterator();
for (String controlValue : controlColumnValues) {
String resultValue = it.next();
//check if controlValue is variable or function (and resolve it)
controlValue = context.replaceDynamicContentInString(controlValue);
validateSingleValue(columnName, controlValue, resultValue, context);
}
}
}
/**
* Does some simple validation on the SQL statement.
* @param stmt The statement which is to be validated.
*/
protected void validateSqlStatement(String stmt) {
if (!stmt.toLowerCase().startsWith("select")) {
throw new CitrusRuntimeException("Missing keyword SELECT in statement: " + stmt);
}
}
protected void validateSingleValue(String columnName, String controlValue, String resultValue, TestContext context) {
// check if value is ignored
if (controlValue.equals(Citrus.IGNORE_PLACEHOLDER)) {
if (log.isDebugEnabled()) {
log.debug("Ignoring column value '" + columnName + "(resultValue)'");
}
return;
}
if (ValidationMatcherUtils.isValidationMatcherExpression(controlValue)) {
ValidationMatcherUtils.resolveValidationMatcher(columnName, resultValue, controlValue, context);
return;
}
if (resultValue == null) {
if (isCitrusNullValue(controlValue)) {
if (log.isDebugEnabled()) {
log.debug("Validating database value for column: ''" +
columnName + "'' value as expected: NULL - value OK");
}
return;
} else {
throw new ValidationException("Validation failed for column: '" + columnName + "'"
+ "found value: NULL expected value: " + controlValue);
}
}
if (resultValue.equals(controlValue)) {
if (log.isDebugEnabled()) {
log.debug("Validation successful for column: '" + columnName +
"' expected value: " + controlValue + " - value OK");
}
} else {
throw new ValidationException("Validation failed for column: '" + columnName + "'"
+ " found value: '"
+ resultValue
+ "' expected value: "
+ ((controlValue.length()==0) ? NULL_VALUE : controlValue));
}
} | java | private void fillColumnValuesMap(List<Map<String, Object>> results, Map<String, List<String>> columnValuesMap) {
for (Map<String, Object> row : results) {
for (Entry<String, Object> column : row.entrySet()) {
String columnValue;
String columnName = column.getKey();
if (!columnValuesMap.containsKey(columnName)) {
columnValuesMap.put(columnName, new ArrayList<String>());
}
if (column.getValue() instanceof byte[]) {
columnValue = Base64.encodeBase64String((byte[]) column.getValue());
} else {
columnValue = column.getValue() == null ? null : column.getValue().toString();
}
columnValuesMap.get(columnName).add((columnValue));
}
}
}
/**
* Gets the script validator implementation either autowired from application context
* or if not set here a default implementation.
*/
private SqlResultSetScriptValidator getScriptValidator() {
if (validator != null) {
return validator;
} else {
return new GroovySqlResultSetValidator();
}
}
/**
* Constructs a delimited string from multiple row values in result set in order to
* set this expression as variable value.
*
* @param rowValues the list of values representing the allResultRows for a column in the result set.
* @return the variable value as delimited string or single value.
*/
private String constructVariableValue(List<String> rowValues) {
if (CollectionUtils.isEmpty(rowValues)) {
return "";
} else if (rowValues.size() == 1) {
return rowValues.get(0) == null ? NULL_VALUE : rowValues.get(0);
} else {
StringBuilder result = new StringBuilder();
Iterator<String> it = rowValues.iterator();
result.append(it.next());
while (it.hasNext()) {
String nextValue = it.next();
result.append(";" + (nextValue == null ? NULL_VALUE : nextValue));
}
return result.toString();
}
}
/**
* Validates the database result set. At first script validation is done (if any was given).
* Afterwards the control result set validation is performed.
*
* @param columnValuesMap map containing column names as keys and list of string as retrieved values from db
* @param allResultRows list of all result rows retrieved from database
* @return success flag
* @throws UnknownElementException
* @throws ValidationException
*/
private void performValidation(final Map<String, List<String>> columnValuesMap,
List<Map<String, Object>> allResultRows, TestContext context)
throws UnknownElementException, ValidationException {
// apply script validation if specified
if (scriptValidationContext != null) {
getScriptValidator().validateSqlResultSet(allResultRows, scriptValidationContext, context);
}
//now apply control set validation if specified
if (CollectionUtils.isEmpty(controlResultSet)) {
return;
}
performControlResultSetValidation(columnValuesMap, context);
log.info("SQL query validation successful: All values OK");
}
private void performControlResultSetValidation(final Map<String, List<String>> columnValuesMap, TestContext context)
throws CitrusRuntimeException {
for (Entry<String, List<String>> controlEntry : controlResultSet.entrySet()) {
String columnName = controlEntry.getKey();
if (columnValuesMap.containsKey(columnName.toLowerCase())) {
columnName = columnName.toLowerCase();
} else if (columnValuesMap.containsKey(columnName.toUpperCase())) {
columnName = columnName.toUpperCase();
} else if (!columnValuesMap.containsKey(columnName)) {
throw new CitrusRuntimeException("Could not find column '" + columnName + "' in SQL result set");
}
List<String> resultColumnValues = columnValuesMap.get(columnName);
List<String> controlColumnValues = controlEntry.getValue();
// first check size of column values (representing number of allResultRows in result set)
if (resultColumnValues.size() != controlColumnValues.size()) {
throw new CitrusRuntimeException("Validation failed for column: '" + columnName + "' " +
"expected rows count: " + controlColumnValues.size() + " but was " + resultColumnValues.size());
}
Iterator<String> it = resultColumnValues.iterator();
for (String controlValue : controlColumnValues) {
String resultValue = it.next();
//check if controlValue is variable or function (and resolve it)
controlValue = context.replaceDynamicContentInString(controlValue);
validateSingleValue(columnName, controlValue, resultValue, context);
}
}
}
/**
* Does some simple validation on the SQL statement.
* @param stmt The statement which is to be validated.
*/
protected void validateSqlStatement(String stmt) {
if (!stmt.toLowerCase().startsWith("select")) {
throw new CitrusRuntimeException("Missing keyword SELECT in statement: " + stmt);
}
}
protected void validateSingleValue(String columnName, String controlValue, String resultValue, TestContext context) {
// check if value is ignored
if (controlValue.equals(Citrus.IGNORE_PLACEHOLDER)) {
if (log.isDebugEnabled()) {
log.debug("Ignoring column value '" + columnName + "(resultValue)'");
}
return;
}
if (ValidationMatcherUtils.isValidationMatcherExpression(controlValue)) {
ValidationMatcherUtils.resolveValidationMatcher(columnName, resultValue, controlValue, context);
return;
}
if (resultValue == null) {
if (isCitrusNullValue(controlValue)) {
if (log.isDebugEnabled()) {
log.debug("Validating database value for column: ''" +
columnName + "'' value as expected: NULL - value OK");
}
return;
} else {
throw new ValidationException("Validation failed for column: '" + columnName + "'"
+ "found value: NULL expected value: " + controlValue);
}
}
if (resultValue.equals(controlValue)) {
if (log.isDebugEnabled()) {
log.debug("Validation successful for column: '" + columnName +
"' expected value: " + controlValue + " - value OK");
}
} else {
throw new ValidationException("Validation failed for column: '" + columnName + "'"
+ " found value: '"
+ resultValue
+ "' expected value: "
+ ((controlValue.length()==0) ? NULL_VALUE : controlValue));
}
} | [
"private",
"void",
"fillColumnValuesMap",
"(",
"List",
"<",
"Map",
"<",
"String",
",",
"Object",
">",
">",
"results",
",",
"Map",
"<",
"String",
",",
"List",
"<",
"String",
">",
">",
"columnValuesMap",
")",
"{",
"for",
"(",
"Map",
"<",
"String",
",",
... | Form a Map object which contains all columns of the result as keys
and a List of row values as values of the Map
@param results result map from last jdbc query execution
@param columnValuesMap map holding all result columns and corresponding values | [
"Form",
"a",
"Map",
"object",
"which",
"contains",
"all",
"columns",
"of",
"the",
"result",
"as",
"keys",
"and",
"a",
"List",
"of",
"row",
"values",
"as",
"values",
"of",
"the",
"Map"
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/actions/ExecuteSQLQueryAction.java#L169-L336 | train |
citrusframework/citrus | modules/citrus-core/src/main/java/com/consol/citrus/functions/FunctionUtils.java | FunctionUtils.resolveFunction | public static String resolveFunction(String functionString, TestContext context) {
String functionExpression = VariableUtils.cutOffVariablesPrefix(functionString);
if (!functionExpression.contains("(") || !functionExpression.endsWith(")") || !functionExpression.contains(":")) {
throw new InvalidFunctionUsageException("Unable to resolve function: " + functionExpression);
}
String functionPrefix = functionExpression.substring(0, functionExpression.indexOf(':') + 1);
String parameterString = functionExpression.substring(functionExpression.indexOf('(') + 1, functionExpression.length() - 1);
String function = functionExpression.substring(functionPrefix.length(), functionExpression.indexOf('('));
FunctionLibrary library = context.getFunctionRegistry().getLibraryForPrefix(functionPrefix);
parameterString = VariableUtils.replaceVariablesInString(parameterString, context, false);
parameterString = replaceFunctionsInString(parameterString, context);
String value = library.getFunction(function).execute(FunctionParameterHelper.getParameterList(parameterString), context);
if (value == null) {
return "";
} else {
return value;
}
} | java | public static String resolveFunction(String functionString, TestContext context) {
String functionExpression = VariableUtils.cutOffVariablesPrefix(functionString);
if (!functionExpression.contains("(") || !functionExpression.endsWith(")") || !functionExpression.contains(":")) {
throw new InvalidFunctionUsageException("Unable to resolve function: " + functionExpression);
}
String functionPrefix = functionExpression.substring(0, functionExpression.indexOf(':') + 1);
String parameterString = functionExpression.substring(functionExpression.indexOf('(') + 1, functionExpression.length() - 1);
String function = functionExpression.substring(functionPrefix.length(), functionExpression.indexOf('('));
FunctionLibrary library = context.getFunctionRegistry().getLibraryForPrefix(functionPrefix);
parameterString = VariableUtils.replaceVariablesInString(parameterString, context, false);
parameterString = replaceFunctionsInString(parameterString, context);
String value = library.getFunction(function).execute(FunctionParameterHelper.getParameterList(parameterString), context);
if (value == null) {
return "";
} else {
return value;
}
} | [
"public",
"static",
"String",
"resolveFunction",
"(",
"String",
"functionString",
",",
"TestContext",
"context",
")",
"{",
"String",
"functionExpression",
"=",
"VariableUtils",
".",
"cutOffVariablesPrefix",
"(",
"functionString",
")",
";",
"if",
"(",
"!",
"functionE... | This method resolves a custom function to its respective result.
@param functionString to evaluate.
@throws com.consol.citrus.exceptions.CitrusRuntimeException
@return evaluated result | [
"This",
"method",
"resolves",
"a",
"custom",
"function",
"to",
"its",
"respective",
"result",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/functions/FunctionUtils.java#L127-L150 | train |
citrusframework/citrus | modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/builder/AssertSoapFaultBuilder.java | AssertSoapFaultBuilder.faultDetailResource | public AssertSoapFaultBuilder faultDetailResource(Resource resource, Charset charset) {
try {
action.getFaultDetails().add(FileUtils.readToString(resource, charset));
} catch (IOException e) {
throw new CitrusRuntimeException("Failed to read fault detail resource", e);
}
return this;
} | java | public AssertSoapFaultBuilder faultDetailResource(Resource resource, Charset charset) {
try {
action.getFaultDetails().add(FileUtils.readToString(resource, charset));
} catch (IOException e) {
throw new CitrusRuntimeException("Failed to read fault detail resource", e);
}
return this;
} | [
"public",
"AssertSoapFaultBuilder",
"faultDetailResource",
"(",
"Resource",
"resource",
",",
"Charset",
"charset",
")",
"{",
"try",
"{",
"action",
".",
"getFaultDetails",
"(",
")",
".",
"add",
"(",
"FileUtils",
".",
"readToString",
"(",
"resource",
",",
"charset... | Expect fault detail from file resource.
@param resource
@param charset
@return | [
"Expect",
"fault",
"detail",
"from",
"file",
"resource",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/builder/AssertSoapFaultBuilder.java#L140-L147 | train |
citrusframework/citrus | modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/builder/AssertSoapFaultBuilder.java | AssertSoapFaultBuilder.validator | public AssertSoapFaultBuilder validator(String validatorName, ApplicationContext applicationContext) {
action.setValidator(applicationContext.getBean(validatorName, SoapFaultValidator.class));
return this;
} | java | public AssertSoapFaultBuilder validator(String validatorName, ApplicationContext applicationContext) {
action.setValidator(applicationContext.getBean(validatorName, SoapFaultValidator.class));
return this;
} | [
"public",
"AssertSoapFaultBuilder",
"validator",
"(",
"String",
"validatorName",
",",
"ApplicationContext",
"applicationContext",
")",
"{",
"action",
".",
"setValidator",
"(",
"applicationContext",
".",
"getBean",
"(",
"validatorName",
",",
"SoapFaultValidator",
".",
"c... | Set explicit SOAP fault validator implementation by bean name.
@param validatorName
@param applicationContext
@return | [
"Set",
"explicit",
"SOAP",
"fault",
"validator",
"implementation",
"by",
"bean",
"name",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/builder/AssertSoapFaultBuilder.java#L175-L178 | train |
citrusframework/citrus | modules/citrus-kafka/src/main/java/com/consol/citrus/kafka/message/KafkaMessage.java | KafkaMessage.getPartition | public Integer getPartition() {
Object partition = getHeader(KafkaMessageHeaders.PARTITION);
if (partition != null) {
return TypeConversionUtils.convertIfNecessary(partition, Integer.class);
}
return null;
} | java | public Integer getPartition() {
Object partition = getHeader(KafkaMessageHeaders.PARTITION);
if (partition != null) {
return TypeConversionUtils.convertIfNecessary(partition, Integer.class);
}
return null;
} | [
"public",
"Integer",
"getPartition",
"(",
")",
"{",
"Object",
"partition",
"=",
"getHeader",
"(",
"KafkaMessageHeaders",
".",
"PARTITION",
")",
";",
"if",
"(",
"partition",
"!=",
"null",
")",
"{",
"return",
"TypeConversionUtils",
".",
"convertIfNecessary",
"(",
... | Gets the Kafka partition header.
@return | [
"Gets",
"the",
"Kafka",
"partition",
"header",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-kafka/src/main/java/com/consol/citrus/kafka/message/KafkaMessage.java#L103-L111 | train |
citrusframework/citrus | modules/citrus-kafka/src/main/java/com/consol/citrus/kafka/message/KafkaMessage.java | KafkaMessage.getTimestamp | public Long getTimestamp() {
Object timestamp = getHeader(KafkaMessageHeaders.TIMESTAMP);
if (timestamp != null) {
return Long.valueOf(timestamp.toString());
}
return null;
} | java | public Long getTimestamp() {
Object timestamp = getHeader(KafkaMessageHeaders.TIMESTAMP);
if (timestamp != null) {
return Long.valueOf(timestamp.toString());
}
return null;
} | [
"public",
"Long",
"getTimestamp",
"(",
")",
"{",
"Object",
"timestamp",
"=",
"getHeader",
"(",
"KafkaMessageHeaders",
".",
"TIMESTAMP",
")",
";",
"if",
"(",
"timestamp",
"!=",
"null",
")",
"{",
"return",
"Long",
".",
"valueOf",
"(",
"timestamp",
".",
"toSt... | Gets the Kafka timestamp header.
@return | [
"Gets",
"the",
"Kafka",
"timestamp",
"header",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-kafka/src/main/java/com/consol/citrus/kafka/message/KafkaMessage.java#L117-L125 | train |
citrusframework/citrus | modules/citrus-kafka/src/main/java/com/consol/citrus/kafka/message/KafkaMessage.java | KafkaMessage.getOffset | public Long getOffset() {
Object offset = getHeader(KafkaMessageHeaders.OFFSET);
if (offset != null) {
return TypeConversionUtils.convertIfNecessary(offset, Long.class);
}
return 0L;
} | java | public Long getOffset() {
Object offset = getHeader(KafkaMessageHeaders.OFFSET);
if (offset != null) {
return TypeConversionUtils.convertIfNecessary(offset, Long.class);
}
return 0L;
} | [
"public",
"Long",
"getOffset",
"(",
")",
"{",
"Object",
"offset",
"=",
"getHeader",
"(",
"KafkaMessageHeaders",
".",
"OFFSET",
")",
";",
"if",
"(",
"offset",
"!=",
"null",
")",
"{",
"return",
"TypeConversionUtils",
".",
"convertIfNecessary",
"(",
"offset",
"... | Gets the Kafka offset header.
@return | [
"Gets",
"the",
"Kafka",
"offset",
"header",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-kafka/src/main/java/com/consol/citrus/kafka/message/KafkaMessage.java#L131-L139 | train |
citrusframework/citrus | modules/citrus-kafka/src/main/java/com/consol/citrus/kafka/message/KafkaMessage.java | KafkaMessage.getMessageKey | public Object getMessageKey() {
Object key = getHeader(KafkaMessageHeaders.MESSAGE_KEY);
if (key != null) {
return key;
}
return null;
} | java | public Object getMessageKey() {
Object key = getHeader(KafkaMessageHeaders.MESSAGE_KEY);
if (key != null) {
return key;
}
return null;
} | [
"public",
"Object",
"getMessageKey",
"(",
")",
"{",
"Object",
"key",
"=",
"getHeader",
"(",
"KafkaMessageHeaders",
".",
"MESSAGE_KEY",
")",
";",
"if",
"(",
"key",
"!=",
"null",
")",
"{",
"return",
"key",
";",
"}",
"return",
"null",
";",
"}"
] | Gets the Kafka message key header.
@return | [
"Gets",
"the",
"Kafka",
"message",
"key",
"header",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-kafka/src/main/java/com/consol/citrus/kafka/message/KafkaMessage.java#L145-L153 | train |
citrusframework/citrus | modules/citrus-kafka/src/main/java/com/consol/citrus/kafka/message/KafkaMessage.java | KafkaMessage.getTopic | public String getTopic() {
Object topic = getHeader(KafkaMessageHeaders.TOPIC);
if (topic != null) {
return topic.toString();
}
return null;
} | java | public String getTopic() {
Object topic = getHeader(KafkaMessageHeaders.TOPIC);
if (topic != null) {
return topic.toString();
}
return null;
} | [
"public",
"String",
"getTopic",
"(",
")",
"{",
"Object",
"topic",
"=",
"getHeader",
"(",
"KafkaMessageHeaders",
".",
"TOPIC",
")",
";",
"if",
"(",
"topic",
"!=",
"null",
")",
"{",
"return",
"topic",
".",
"toString",
"(",
")",
";",
"}",
"return",
"null"... | Gets the Kafka topic header.
@return | [
"Gets",
"the",
"Kafka",
"topic",
"header",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-kafka/src/main/java/com/consol/citrus/kafka/message/KafkaMessage.java#L159-L167 | train |
citrusframework/citrus | modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/builder/WaitActionConditionBuilder.java | WaitActionConditionBuilder.action | public Wait action(TestAction action) {
if (action instanceof TestActionBuilder) {
getCondition().setAction(((TestActionBuilder) action).build());
this.action.setAction(((TestActionBuilder) action).build());
getBuilder().actions(((TestActionBuilder) action).build());
} else {
getCondition().setAction(action);
this.action.setAction(action);
getBuilder().actions(action);
}
return getBuilder().build();
} | java | public Wait action(TestAction action) {
if (action instanceof TestActionBuilder) {
getCondition().setAction(((TestActionBuilder) action).build());
this.action.setAction(((TestActionBuilder) action).build());
getBuilder().actions(((TestActionBuilder) action).build());
} else {
getCondition().setAction(action);
this.action.setAction(action);
getBuilder().actions(action);
}
return getBuilder().build();
} | [
"public",
"Wait",
"action",
"(",
"TestAction",
"action",
")",
"{",
"if",
"(",
"action",
"instanceof",
"TestActionBuilder",
")",
"{",
"getCondition",
"(",
")",
".",
"setAction",
"(",
"(",
"(",
"TestActionBuilder",
")",
"action",
")",
".",
"build",
"(",
")",... | Sets the test action to execute and wait for.
@param action
@return | [
"Sets",
"the",
"test",
"action",
"to",
"execute",
"and",
"wait",
"for",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/builder/WaitActionConditionBuilder.java#L47-L59 | train |
citrusframework/citrus | modules/citrus-http/src/main/java/com/consol/citrus/http/interceptor/LoggingClientInterceptor.java | LoggingClientInterceptor.getRequestContent | private String getRequestContent(HttpRequest request, String body) {
StringBuilder builder = new StringBuilder();
builder.append(request.getMethod());
builder.append(" ");
builder.append(request.getURI());
builder.append(NEWLINE);
appendHeaders(request.getHeaders(), builder);
builder.append(NEWLINE);
builder.append(body);
return builder.toString();
} | java | private String getRequestContent(HttpRequest request, String body) {
StringBuilder builder = new StringBuilder();
builder.append(request.getMethod());
builder.append(" ");
builder.append(request.getURI());
builder.append(NEWLINE);
appendHeaders(request.getHeaders(), builder);
builder.append(NEWLINE);
builder.append(body);
return builder.toString();
} | [
"private",
"String",
"getRequestContent",
"(",
"HttpRequest",
"request",
",",
"String",
"body",
")",
"{",
"StringBuilder",
"builder",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"builder",
".",
"append",
"(",
"request",
".",
"getMethod",
"(",
")",
")",
";",
... | Builds request content string from request and body.
@param request
@param body
@return | [
"Builds",
"request",
"content",
"string",
"from",
"request",
"and",
"body",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-http/src/main/java/com/consol/citrus/http/interceptor/LoggingClientInterceptor.java#L99-L113 | train |
citrusframework/citrus | modules/citrus-http/src/main/java/com/consol/citrus/http/interceptor/LoggingClientInterceptor.java | LoggingClientInterceptor.getResponseContent | private String getResponseContent(CachingClientHttpResponseWrapper response) throws IOException {
if (response != null) {
StringBuilder builder = new StringBuilder();
builder.append("HTTP/1.1 "); // TODO get Http version from message
builder.append(response.getStatusCode());
builder.append(" ");
builder.append(response.getStatusText());
builder.append(NEWLINE);
appendHeaders(response.getHeaders(), builder);
builder.append(NEWLINE);
builder.append(response.getBodyContent());
return builder.toString();
} else {
return "";
}
} | java | private String getResponseContent(CachingClientHttpResponseWrapper response) throws IOException {
if (response != null) {
StringBuilder builder = new StringBuilder();
builder.append("HTTP/1.1 "); // TODO get Http version from message
builder.append(response.getStatusCode());
builder.append(" ");
builder.append(response.getStatusText());
builder.append(NEWLINE);
appendHeaders(response.getHeaders(), builder);
builder.append(NEWLINE);
builder.append(response.getBodyContent());
return builder.toString();
} else {
return "";
}
} | [
"private",
"String",
"getResponseContent",
"(",
"CachingClientHttpResponseWrapper",
"response",
")",
"throws",
"IOException",
"{",
"if",
"(",
"response",
"!=",
"null",
")",
"{",
"StringBuilder",
"builder",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"builder",
"."... | Builds response content string from response object.
@param response
@return
@throws IOException | [
"Builds",
"response",
"content",
"string",
"from",
"response",
"object",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-http/src/main/java/com/consol/citrus/http/interceptor/LoggingClientInterceptor.java#L121-L140 | train |
citrusframework/citrus | modules/citrus-http/src/main/java/com/consol/citrus/http/interceptor/LoggingClientInterceptor.java | LoggingClientInterceptor.appendHeaders | private void appendHeaders(HttpHeaders headers, StringBuilder builder) {
for (Entry<String, List<String>> headerEntry : headers.entrySet()) {
builder.append(headerEntry.getKey());
builder.append(":");
builder.append(StringUtils.arrayToCommaDelimitedString(headerEntry.getValue().toArray()));
builder.append(NEWLINE);
}
} | java | private void appendHeaders(HttpHeaders headers, StringBuilder builder) {
for (Entry<String, List<String>> headerEntry : headers.entrySet()) {
builder.append(headerEntry.getKey());
builder.append(":");
builder.append(StringUtils.arrayToCommaDelimitedString(headerEntry.getValue().toArray()));
builder.append(NEWLINE);
}
} | [
"private",
"void",
"appendHeaders",
"(",
"HttpHeaders",
"headers",
",",
"StringBuilder",
"builder",
")",
"{",
"for",
"(",
"Entry",
"<",
"String",
",",
"List",
"<",
"String",
">",
">",
"headerEntry",
":",
"headers",
".",
"entrySet",
"(",
")",
")",
"{",
"b... | Append Http headers to string builder.
@param headers
@param builder | [
"Append",
"Http",
"headers",
"to",
"string",
"builder",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-http/src/main/java/com/consol/citrus/http/interceptor/LoggingClientInterceptor.java#L147-L154 | train |
citrusframework/citrus | modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/builder/DockerActionBuilder.java | DockerActionBuilder.start | public ContainerStart start(String containerId) {
ContainerStart command = new ContainerStart();
command.container(containerId);
action.setCommand(command);
return command;
} | java | public ContainerStart start(String containerId) {
ContainerStart command = new ContainerStart();
command.container(containerId);
action.setCommand(command);
return command;
} | [
"public",
"ContainerStart",
"start",
"(",
"String",
"containerId",
")",
"{",
"ContainerStart",
"command",
"=",
"new",
"ContainerStart",
"(",
")",
";",
"command",
".",
"container",
"(",
"containerId",
")",
";",
"action",
".",
"setCommand",
"(",
"command",
")",
... | Adds a start command. | [
"Adds",
"a",
"start",
"command",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/builder/DockerActionBuilder.java#L94-L99 | train |
citrusframework/citrus | modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/builder/DockerActionBuilder.java | DockerActionBuilder.stop | public ContainerStop stop(String containerId) {
ContainerStop command = new ContainerStop();
command.container(containerId);
action.setCommand(command);
return command;
} | java | public ContainerStop stop(String containerId) {
ContainerStop command = new ContainerStop();
command.container(containerId);
action.setCommand(command);
return command;
} | [
"public",
"ContainerStop",
"stop",
"(",
"String",
"containerId",
")",
"{",
"ContainerStop",
"command",
"=",
"new",
"ContainerStop",
"(",
")",
";",
"command",
".",
"container",
"(",
"containerId",
")",
";",
"action",
".",
"setCommand",
"(",
"command",
")",
";... | Adds a stop command. | [
"Adds",
"a",
"stop",
"command",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/builder/DockerActionBuilder.java#L104-L109 | train |
citrusframework/citrus | modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/builder/DockerActionBuilder.java | DockerActionBuilder.wait | public ContainerWait wait(String containerId) {
ContainerWait command = new ContainerWait();
command.container(containerId);
action.setCommand(command);
return command;
} | java | public ContainerWait wait(String containerId) {
ContainerWait command = new ContainerWait();
command.container(containerId);
action.setCommand(command);
return command;
} | [
"public",
"ContainerWait",
"wait",
"(",
"String",
"containerId",
")",
"{",
"ContainerWait",
"command",
"=",
"new",
"ContainerWait",
"(",
")",
";",
"command",
".",
"container",
"(",
"containerId",
")",
";",
"action",
".",
"setCommand",
"(",
"command",
")",
";... | Adds a wait command. | [
"Adds",
"a",
"wait",
"command",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/builder/DockerActionBuilder.java#L114-L119 | train |
citrusframework/citrus | modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/builder/SendMessageBuilder.java | SendMessageBuilder.messageType | public T messageType(String messageType) {
this.messageType = messageType;
getAction().setMessageType(messageType);
if (binaryMessageConstructionInterceptor.supportsMessageType(messageType)) {
getMessageContentBuilder().add(binaryMessageConstructionInterceptor);
}
if (gzipMessageConstructionInterceptor.supportsMessageType(messageType)) {
getMessageContentBuilder().add(gzipMessageConstructionInterceptor);
}
return self;
} | java | public T messageType(String messageType) {
this.messageType = messageType;
getAction().setMessageType(messageType);
if (binaryMessageConstructionInterceptor.supportsMessageType(messageType)) {
getMessageContentBuilder().add(binaryMessageConstructionInterceptor);
}
if (gzipMessageConstructionInterceptor.supportsMessageType(messageType)) {
getMessageContentBuilder().add(gzipMessageConstructionInterceptor);
}
return self;
} | [
"public",
"T",
"messageType",
"(",
"String",
"messageType",
")",
"{",
"this",
".",
"messageType",
"=",
"messageType",
";",
"getAction",
"(",
")",
".",
"setMessageType",
"(",
"messageType",
")",
";",
"if",
"(",
"binaryMessageConstructionInterceptor",
".",
"suppor... | Sets a explicit message type for this send action.
@param messageType The message type to send the message in
@return The modified send message | [
"Sets",
"a",
"explicit",
"message",
"type",
"for",
"this",
"send",
"action",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/builder/SendMessageBuilder.java#L439-L452 | train |
citrusframework/citrus | modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/builder/SendMessageBuilder.java | SendMessageBuilder.xpath | public T xpath(String expression, String value) {
if (xpathMessageConstructionInterceptor == null) {
xpathMessageConstructionInterceptor = new XpathMessageConstructionInterceptor();
if (getAction().getMessageBuilder() != null) {
(getAction().getMessageBuilder()).add(xpathMessageConstructionInterceptor);
} else {
PayloadTemplateMessageBuilder messageBuilder = new PayloadTemplateMessageBuilder();
messageBuilder.getMessageInterceptors().add(xpathMessageConstructionInterceptor);
getAction().setMessageBuilder(messageBuilder);
}
}
xpathMessageConstructionInterceptor.getXPathExpressions().put(expression, value);
return self;
} | java | public T xpath(String expression, String value) {
if (xpathMessageConstructionInterceptor == null) {
xpathMessageConstructionInterceptor = new XpathMessageConstructionInterceptor();
if (getAction().getMessageBuilder() != null) {
(getAction().getMessageBuilder()).add(xpathMessageConstructionInterceptor);
} else {
PayloadTemplateMessageBuilder messageBuilder = new PayloadTemplateMessageBuilder();
messageBuilder.getMessageInterceptors().add(xpathMessageConstructionInterceptor);
getAction().setMessageBuilder(messageBuilder);
}
}
xpathMessageConstructionInterceptor.getXPathExpressions().put(expression, value);
return self;
} | [
"public",
"T",
"xpath",
"(",
"String",
"expression",
",",
"String",
"value",
")",
"{",
"if",
"(",
"xpathMessageConstructionInterceptor",
"==",
"null",
")",
"{",
"xpathMessageConstructionInterceptor",
"=",
"new",
"XpathMessageConstructionInterceptor",
"(",
")",
";",
... | Adds XPath manipulating expression that evaluates to message payload before sending.
@param expression
@param value
@return | [
"Adds",
"XPath",
"manipulating",
"expression",
"that",
"evaluates",
"to",
"message",
"payload",
"before",
"sending",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/builder/SendMessageBuilder.java#L507-L523 | train |
citrusframework/citrus | modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/builder/SendMessageBuilder.java | SendMessageBuilder.jsonPath | public T jsonPath(String expression, String value) {
if (jsonPathMessageConstructionInterceptor == null) {
jsonPathMessageConstructionInterceptor = new JsonPathMessageConstructionInterceptor();
if (getAction().getMessageBuilder() != null) {
(getAction().getMessageBuilder()).add(jsonPathMessageConstructionInterceptor);
} else {
PayloadTemplateMessageBuilder messageBuilder = new PayloadTemplateMessageBuilder();
messageBuilder.getMessageInterceptors().add(jsonPathMessageConstructionInterceptor);
getAction().setMessageBuilder(messageBuilder);
}
}
jsonPathMessageConstructionInterceptor.getJsonPathExpressions().put(expression, value);
return self;
} | java | public T jsonPath(String expression, String value) {
if (jsonPathMessageConstructionInterceptor == null) {
jsonPathMessageConstructionInterceptor = new JsonPathMessageConstructionInterceptor();
if (getAction().getMessageBuilder() != null) {
(getAction().getMessageBuilder()).add(jsonPathMessageConstructionInterceptor);
} else {
PayloadTemplateMessageBuilder messageBuilder = new PayloadTemplateMessageBuilder();
messageBuilder.getMessageInterceptors().add(jsonPathMessageConstructionInterceptor);
getAction().setMessageBuilder(messageBuilder);
}
}
jsonPathMessageConstructionInterceptor.getJsonPathExpressions().put(expression, value);
return self;
} | [
"public",
"T",
"jsonPath",
"(",
"String",
"expression",
",",
"String",
"value",
")",
"{",
"if",
"(",
"jsonPathMessageConstructionInterceptor",
"==",
"null",
")",
"{",
"jsonPathMessageConstructionInterceptor",
"=",
"new",
"JsonPathMessageConstructionInterceptor",
"(",
")... | Adds JSONPath manipulating expression that evaluates to message payload before sending.
@param expression
@param value
@return | [
"Adds",
"JSONPath",
"manipulating",
"expression",
"that",
"evaluates",
"to",
"message",
"payload",
"before",
"sending",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/builder/SendMessageBuilder.java#L531-L547 | train |
citrusframework/citrus | modules/citrus-ws/src/main/java/com/consol/citrus/ws/interceptor/LoggingInterceptorSupport.java | LoggingInterceptorSupport.logRequest | protected void logRequest(String logMessage, MessageContext messageContext, boolean incoming) throws TransformerException {
if (messageContext.getRequest() instanceof SoapMessage) {
logSoapMessage(logMessage, (SoapMessage) messageContext.getRequest(), incoming);
} else {
logWebServiceMessage(logMessage, messageContext.getRequest(), incoming);
}
} | java | protected void logRequest(String logMessage, MessageContext messageContext, boolean incoming) throws TransformerException {
if (messageContext.getRequest() instanceof SoapMessage) {
logSoapMessage(logMessage, (SoapMessage) messageContext.getRequest(), incoming);
} else {
logWebServiceMessage(logMessage, messageContext.getRequest(), incoming);
}
} | [
"protected",
"void",
"logRequest",
"(",
"String",
"logMessage",
",",
"MessageContext",
"messageContext",
",",
"boolean",
"incoming",
")",
"throws",
"TransformerException",
"{",
"if",
"(",
"messageContext",
".",
"getRequest",
"(",
")",
"instanceof",
"SoapMessage",
")... | Logs request message from message context. SOAP messages get logged with envelope transformation
other messages with serialization.
@param logMessage
@param messageContext
@param incoming
@throws TransformerException | [
"Logs",
"request",
"message",
"from",
"message",
"context",
".",
"SOAP",
"messages",
"get",
"logged",
"with",
"envelope",
"transformation",
"other",
"messages",
"with",
"serialization",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-ws/src/main/java/com/consol/citrus/ws/interceptor/LoggingInterceptorSupport.java#L62-L68 | train |
citrusframework/citrus | modules/citrus-ws/src/main/java/com/consol/citrus/ws/interceptor/LoggingInterceptorSupport.java | LoggingInterceptorSupport.logResponse | protected void logResponse(String logMessage, MessageContext messageContext, boolean incoming) throws TransformerException {
if (messageContext.hasResponse()) {
if (messageContext.getResponse() instanceof SoapMessage) {
logSoapMessage(logMessage, (SoapMessage) messageContext.getResponse(), incoming);
} else {
logWebServiceMessage(logMessage, messageContext.getResponse(), incoming);
}
}
} | java | protected void logResponse(String logMessage, MessageContext messageContext, boolean incoming) throws TransformerException {
if (messageContext.hasResponse()) {
if (messageContext.getResponse() instanceof SoapMessage) {
logSoapMessage(logMessage, (SoapMessage) messageContext.getResponse(), incoming);
} else {
logWebServiceMessage(logMessage, messageContext.getResponse(), incoming);
}
}
} | [
"protected",
"void",
"logResponse",
"(",
"String",
"logMessage",
",",
"MessageContext",
"messageContext",
",",
"boolean",
"incoming",
")",
"throws",
"TransformerException",
"{",
"if",
"(",
"messageContext",
".",
"hasResponse",
"(",
")",
")",
"{",
"if",
"(",
"mes... | Logs response message from message context if any. SOAP messages get logged with envelope transformation
other messages with serialization.
@param logMessage
@param messageContext
@param incoming
@throws TransformerException | [
"Logs",
"response",
"message",
"from",
"message",
"context",
"if",
"any",
".",
"SOAP",
"messages",
"get",
"logged",
"with",
"envelope",
"transformation",
"other",
"messages",
"with",
"serialization",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-ws/src/main/java/com/consol/citrus/ws/interceptor/LoggingInterceptorSupport.java#L79-L87 | train |
citrusframework/citrus | modules/citrus-ws/src/main/java/com/consol/citrus/ws/interceptor/LoggingInterceptorSupport.java | LoggingInterceptorSupport.logSoapMessage | protected void logSoapMessage(String logMessage, SoapMessage soapMessage, boolean incoming) throws TransformerException {
Transformer transformer = createIndentingTransformer();
StringWriter writer = new StringWriter();
transformer.transform(soapMessage.getEnvelope().getSource(), new StreamResult(writer));
logMessage(logMessage, XMLUtils.prettyPrint(writer.toString()), incoming);
} | java | protected void logSoapMessage(String logMessage, SoapMessage soapMessage, boolean incoming) throws TransformerException {
Transformer transformer = createIndentingTransformer();
StringWriter writer = new StringWriter();
transformer.transform(soapMessage.getEnvelope().getSource(), new StreamResult(writer));
logMessage(logMessage, XMLUtils.prettyPrint(writer.toString()), incoming);
} | [
"protected",
"void",
"logSoapMessage",
"(",
"String",
"logMessage",
",",
"SoapMessage",
"soapMessage",
",",
"boolean",
"incoming",
")",
"throws",
"TransformerException",
"{",
"Transformer",
"transformer",
"=",
"createIndentingTransformer",
"(",
")",
";",
"StringWriter",... | Log SOAP message with transformer instance.
@param logMessage the customized log message.
@param soapMessage the message content as SOAP envelope source.
@param incoming
@throws TransformerException | [
"Log",
"SOAP",
"message",
"with",
"transformer",
"instance",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-ws/src/main/java/com/consol/citrus/ws/interceptor/LoggingInterceptorSupport.java#L97-L103 | train |
citrusframework/citrus | modules/citrus-ws/src/main/java/com/consol/citrus/ws/interceptor/LoggingInterceptorSupport.java | LoggingInterceptorSupport.logMessage | protected void logMessage(String logMessage, String message, boolean incoming) {
if (messageListener != null) {
log.debug(logMessage);
if (incoming) {
messageListener.onInboundMessage(new RawMessage(message), null);
} else {
messageListener.onOutboundMessage(new RawMessage(message), null);
}
} else {
if (log.isDebugEnabled()) {
log.debug(logMessage + ":" + System.getProperty("line.separator") + message);
}
}
} | java | protected void logMessage(String logMessage, String message, boolean incoming) {
if (messageListener != null) {
log.debug(logMessage);
if (incoming) {
messageListener.onInboundMessage(new RawMessage(message), null);
} else {
messageListener.onOutboundMessage(new RawMessage(message), null);
}
} else {
if (log.isDebugEnabled()) {
log.debug(logMessage + ":" + System.getProperty("line.separator") + message);
}
}
} | [
"protected",
"void",
"logMessage",
"(",
"String",
"logMessage",
",",
"String",
"message",
",",
"boolean",
"incoming",
")",
"{",
"if",
"(",
"messageListener",
"!=",
"null",
")",
"{",
"log",
".",
"debug",
"(",
"logMessage",
")",
";",
"if",
"(",
"incoming",
... | Performs the final logger call with dynamic message.
@param logMessage a custom log message entry.
@param message the message content.
@param incoming | [
"Performs",
"the",
"final",
"logger",
"call",
"with",
"dynamic",
"message",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-ws/src/main/java/com/consol/citrus/ws/interceptor/LoggingInterceptorSupport.java#L131-L145 | train |
citrusframework/citrus | modules/citrus-ws/src/main/java/com/consol/citrus/ws/interceptor/LoggingInterceptorSupport.java | LoggingInterceptorSupport.createIndentingTransformer | private Transformer createIndentingTransformer() throws TransformerConfigurationException {
Transformer transformer = createTransformer();
transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
transformer.setOutputProperty(OutputKeys.INDENT, "yes");
return transformer;
} | java | private Transformer createIndentingTransformer() throws TransformerConfigurationException {
Transformer transformer = createTransformer();
transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
transformer.setOutputProperty(OutputKeys.INDENT, "yes");
return transformer;
} | [
"private",
"Transformer",
"createIndentingTransformer",
"(",
")",
"throws",
"TransformerConfigurationException",
"{",
"Transformer",
"transformer",
"=",
"createTransformer",
"(",
")",
";",
"transformer",
".",
"setOutputProperty",
"(",
"OutputKeys",
".",
"OMIT_XML_DECLARATIO... | Get transformer implementation with output properties set.
@return the transformer instance.
@throws TransformerConfigurationException | [
"Get",
"transformer",
"implementation",
"with",
"output",
"properties",
"set",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-ws/src/main/java/com/consol/citrus/ws/interceptor/LoggingInterceptorSupport.java#L153-L158 | train |
citrusframework/citrus | modules/citrus-kafka/src/main/java/com/consol/citrus/kafka/endpoint/KafkaProducer.java | KafkaProducer.createKafkaProducer | private org.apache.kafka.clients.producer.KafkaProducer<Object, Object> createKafkaProducer() {
Map<String, Object> producerProps = new HashMap<>();
producerProps.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, endpointConfiguration.getServer());
producerProps.put(ProducerConfig.REQUEST_TIMEOUT_MS_CONFIG, new Long(endpointConfiguration.getTimeout()).intValue());
producerProps.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, endpointConfiguration.getKeySerializer());
producerProps.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, endpointConfiguration.getValueSerializer());
producerProps.put(ProducerConfig.CLIENT_ID_CONFIG, Optional.ofNullable(endpointConfiguration.getClientId()).orElse(KafkaMessageHeaders.KAFKA_PREFIX + "producer_" + UUID.randomUUID().toString()));
producerProps.putAll(endpointConfiguration.getProducerProperties());
return new org.apache.kafka.clients.producer.KafkaProducer<>(producerProps);
} | java | private org.apache.kafka.clients.producer.KafkaProducer<Object, Object> createKafkaProducer() {
Map<String, Object> producerProps = new HashMap<>();
producerProps.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, endpointConfiguration.getServer());
producerProps.put(ProducerConfig.REQUEST_TIMEOUT_MS_CONFIG, new Long(endpointConfiguration.getTimeout()).intValue());
producerProps.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, endpointConfiguration.getKeySerializer());
producerProps.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, endpointConfiguration.getValueSerializer());
producerProps.put(ProducerConfig.CLIENT_ID_CONFIG, Optional.ofNullable(endpointConfiguration.getClientId()).orElse(KafkaMessageHeaders.KAFKA_PREFIX + "producer_" + UUID.randomUUID().toString()));
producerProps.putAll(endpointConfiguration.getProducerProperties());
return new org.apache.kafka.clients.producer.KafkaProducer<>(producerProps);
} | [
"private",
"org",
".",
"apache",
".",
"kafka",
".",
"clients",
".",
"producer",
".",
"KafkaProducer",
"<",
"Object",
",",
"Object",
">",
"createKafkaProducer",
"(",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"producerProps",
"=",
"new",
"HashMap",... | Creates default KafkaTemplate instance from endpoint configuration. | [
"Creates",
"default",
"KafkaTemplate",
"instance",
"from",
"endpoint",
"configuration",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-kafka/src/main/java/com/consol/citrus/kafka/endpoint/KafkaProducer.java#L97-L109 | train |
citrusframework/citrus | modules/citrus-kafka/src/main/java/com/consol/citrus/kafka/endpoint/KafkaProducer.java | KafkaProducer.setProducer | public void setProducer(org.apache.kafka.clients.producer.KafkaProducer<Object, Object> producer) {
this.producer = producer;
} | java | public void setProducer(org.apache.kafka.clients.producer.KafkaProducer<Object, Object> producer) {
this.producer = producer;
} | [
"public",
"void",
"setProducer",
"(",
"org",
".",
"apache",
".",
"kafka",
".",
"clients",
".",
"producer",
".",
"KafkaProducer",
"<",
"Object",
",",
"Object",
">",
"producer",
")",
"{",
"this",
".",
"producer",
"=",
"producer",
";",
"}"
] | Sets the producer.
@param producer | [
"Sets",
"the",
"producer",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-kafka/src/main/java/com/consol/citrus/kafka/endpoint/KafkaProducer.java#L122-L124 | train |
citrusframework/citrus | tools/remote/citrus-remote-server/src/main/java/com/consol/citrus/remote/CitrusRemoteServer.java | CitrusRemoteServer.start | public void start() {
application = new CitrusRemoteApplication(configuration);
port(configuration.getPort());
application.init();
if (!configuration.isSkipTests()) {
new RunController(configuration).run();
}
if (configuration.getTimeToLive() == 0) {
stop();
}
} | java | public void start() {
application = new CitrusRemoteApplication(configuration);
port(configuration.getPort());
application.init();
if (!configuration.isSkipTests()) {
new RunController(configuration).run();
}
if (configuration.getTimeToLive() == 0) {
stop();
}
} | [
"public",
"void",
"start",
"(",
")",
"{",
"application",
"=",
"new",
"CitrusRemoteApplication",
"(",
"configuration",
")",
";",
"port",
"(",
"configuration",
".",
"getPort",
"(",
")",
")",
";",
"application",
".",
"init",
"(",
")",
";",
"if",
"(",
"!",
... | Start server instance and listen for incoming requests. | [
"Start",
"server",
"instance",
"and",
"listen",
"for",
"incoming",
"requests",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/tools/remote/citrus-remote-server/src/main/java/com/consol/citrus/remote/CitrusRemoteServer.java#L96-L108 | train |
citrusframework/citrus | tools/remote/citrus-remote-server/src/main/java/com/consol/citrus/remote/CitrusRemoteServer.java | CitrusRemoteServer.waitForCompletion | public boolean waitForCompletion() {
try {
return completed.get();
} catch (InterruptedException | ExecutionException e) {
log.warn("Failed to wait for server completion", e);
}
return false;
} | java | public boolean waitForCompletion() {
try {
return completed.get();
} catch (InterruptedException | ExecutionException e) {
log.warn("Failed to wait for server completion", e);
}
return false;
} | [
"public",
"boolean",
"waitForCompletion",
"(",
")",
"{",
"try",
"{",
"return",
"completed",
".",
"get",
"(",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"|",
"ExecutionException",
"e",
")",
"{",
"log",
".",
"warn",
"(",
"\"Failed to wait for server co... | Waits for completed state of application.
@return | [
"Waits",
"for",
"completed",
"state",
"of",
"application",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/tools/remote/citrus-remote-server/src/main/java/com/consol/citrus/remote/CitrusRemoteServer.java#L130-L138 | train |
citrusframework/citrus | modules/citrus-jmx/src/main/java/com/consol/citrus/jmx/server/JmxServerBuilder.java | JmxServerBuilder.environmentProperties | public JmxServerBuilder environmentProperties(Properties environmentProperties) {
HashMap<String, Object> properties = new HashMap<>(environmentProperties.size());
for (Map.Entry<Object, Object> entry : environmentProperties.entrySet()) {
properties.put(entry.getKey().toString(), entry.getValue());
}
endpoint.getEndpointConfiguration().setEnvironmentProperties(properties);
return this;
} | java | public JmxServerBuilder environmentProperties(Properties environmentProperties) {
HashMap<String, Object> properties = new HashMap<>(environmentProperties.size());
for (Map.Entry<Object, Object> entry : environmentProperties.entrySet()) {
properties.put(entry.getKey().toString(), entry.getValue());
}
endpoint.getEndpointConfiguration().setEnvironmentProperties(properties);
return this;
} | [
"public",
"JmxServerBuilder",
"environmentProperties",
"(",
"Properties",
"environmentProperties",
")",
"{",
"HashMap",
"<",
"String",
",",
"Object",
">",
"properties",
"=",
"new",
"HashMap",
"<>",
"(",
"environmentProperties",
".",
"size",
"(",
")",
")",
";",
"... | Sets the environment properties.
@param environmentProperties
@return | [
"Sets",
"the",
"environment",
"properties",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-jmx/src/main/java/com/consol/citrus/jmx/server/JmxServerBuilder.java#L104-L112 | train |
citrusframework/citrus | modules/citrus-jmx/src/main/java/com/consol/citrus/jmx/server/JmxServerBuilder.java | JmxServerBuilder.timeout | public JmxServerBuilder timeout(long timeout) {
endpoint.setDefaultTimeout(timeout);
endpoint.getEndpointConfiguration().setTimeout(timeout);
return this;
} | java | public JmxServerBuilder timeout(long timeout) {
endpoint.setDefaultTimeout(timeout);
endpoint.getEndpointConfiguration().setTimeout(timeout);
return this;
} | [
"public",
"JmxServerBuilder",
"timeout",
"(",
"long",
"timeout",
")",
"{",
"endpoint",
".",
"setDefaultTimeout",
"(",
"timeout",
")",
";",
"endpoint",
".",
"getEndpointConfiguration",
"(",
")",
".",
"setTimeout",
"(",
"timeout",
")",
";",
"return",
"this",
";"... | Sets the default timeout.
@param timeout
@return | [
"Sets",
"the",
"default",
"timeout",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-jmx/src/main/java/com/consol/citrus/jmx/server/JmxServerBuilder.java#L149-L153 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.