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-ws/src/main/java/com/consol/citrus/ws/config/xml/SendSoapFaultActionParser.java
SendSoapFaultActionParser.parseFault
private void parseFault(BeanDefinitionBuilder builder, Element faultElement) { if (faultElement != null) { Element faultCodeElement = DomUtils.getChildElementByTagName(faultElement, "fault-code"); if (faultCodeElement != null) { builder.addPropertyValue("faultCode", DomUtils.getTextValue(faultCodeElement).trim()); } Element faultStringElement = DomUtils.getChildElementByTagName(faultElement, "fault-string"); if (faultStringElement != null) { builder.addPropertyValue("faultString", DomUtils.getTextValue(faultStringElement).trim()); } Element faultActorElement = DomUtils.getChildElementByTagName(faultElement, "fault-actor"); if (faultActorElement != null) { builder.addPropertyValue("faultActor", DomUtils.getTextValue(faultActorElement).trim()); } parseFaultDetail(builder, faultElement); } }
java
private void parseFault(BeanDefinitionBuilder builder, Element faultElement) { if (faultElement != null) { Element faultCodeElement = DomUtils.getChildElementByTagName(faultElement, "fault-code"); if (faultCodeElement != null) { builder.addPropertyValue("faultCode", DomUtils.getTextValue(faultCodeElement).trim()); } Element faultStringElement = DomUtils.getChildElementByTagName(faultElement, "fault-string"); if (faultStringElement != null) { builder.addPropertyValue("faultString", DomUtils.getTextValue(faultStringElement).trim()); } Element faultActorElement = DomUtils.getChildElementByTagName(faultElement, "fault-actor"); if (faultActorElement != null) { builder.addPropertyValue("faultActor", DomUtils.getTextValue(faultActorElement).trim()); } parseFaultDetail(builder, faultElement); } }
[ "private", "void", "parseFault", "(", "BeanDefinitionBuilder", "builder", ",", "Element", "faultElement", ")", "{", "if", "(", "faultElement", "!=", "null", ")", "{", "Element", "faultCodeElement", "=", "DomUtils", ".", "getChildElementByTagName", "(", "faultElement...
Parses the SOAP fault information. @param builder @param faultElement
[ "Parses", "the", "SOAP", "fault", "information", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-ws/src/main/java/com/consol/citrus/ws/config/xml/SendSoapFaultActionParser.java#L52-L71
train
citrusframework/citrus
modules/citrus-ws/src/main/java/com/consol/citrus/ws/config/xml/SendSoapFaultActionParser.java
SendSoapFaultActionParser.parseFaultDetail
private void parseFaultDetail(BeanDefinitionBuilder builder, Element faultElement) { List<Element> faultDetailElements = DomUtils.getChildElementsByTagName(faultElement, "fault-detail"); List<String> faultDetails = new ArrayList<String>(); List<String> faultDetailResourcePaths = new ArrayList<String>(); for (Element faultDetailElement : faultDetailElements) { if (faultDetailElement.hasAttribute("file")) { if (StringUtils.hasText(DomUtils.getTextValue(faultDetailElement).trim())) { throw new BeanCreationException("You tried to set fault-detail by file resource attribute and inline text value at the same time! " + "Please choose one of them."); } String charset = faultDetailElement.getAttribute("charset"); String filePath = faultDetailElement.getAttribute("file"); faultDetailResourcePaths.add(filePath + (StringUtils.hasText(charset) ? FileUtils.FILE_PATH_CHARSET_PARAMETER + charset : "")); } else { String faultDetailData = DomUtils.getTextValue(faultDetailElement).trim(); if (StringUtils.hasText(faultDetailData)) { faultDetails.add(faultDetailData); } else { throw new BeanCreationException("Not content for fault-detail is set! Either use file attribute or inline text value for fault-detail element."); } } } builder.addPropertyValue("faultDetails", faultDetails); builder.addPropertyValue("faultDetailResourcePaths", faultDetailResourcePaths); }
java
private void parseFaultDetail(BeanDefinitionBuilder builder, Element faultElement) { List<Element> faultDetailElements = DomUtils.getChildElementsByTagName(faultElement, "fault-detail"); List<String> faultDetails = new ArrayList<String>(); List<String> faultDetailResourcePaths = new ArrayList<String>(); for (Element faultDetailElement : faultDetailElements) { if (faultDetailElement.hasAttribute("file")) { if (StringUtils.hasText(DomUtils.getTextValue(faultDetailElement).trim())) { throw new BeanCreationException("You tried to set fault-detail by file resource attribute and inline text value at the same time! " + "Please choose one of them."); } String charset = faultDetailElement.getAttribute("charset"); String filePath = faultDetailElement.getAttribute("file"); faultDetailResourcePaths.add(filePath + (StringUtils.hasText(charset) ? FileUtils.FILE_PATH_CHARSET_PARAMETER + charset : "")); } else { String faultDetailData = DomUtils.getTextValue(faultDetailElement).trim(); if (StringUtils.hasText(faultDetailData)) { faultDetails.add(faultDetailData); } else { throw new BeanCreationException("Not content for fault-detail is set! Either use file attribute or inline text value for fault-detail element."); } } } builder.addPropertyValue("faultDetails", faultDetails); builder.addPropertyValue("faultDetailResourcePaths", faultDetailResourcePaths); }
[ "private", "void", "parseFaultDetail", "(", "BeanDefinitionBuilder", "builder", ",", "Element", "faultElement", ")", "{", "List", "<", "Element", ">", "faultDetailElements", "=", "DomUtils", ".", "getChildElementsByTagName", "(", "faultElement", ",", "\"fault-detail\"",...
Parses the fault detail element. @param builder @param faultElement the fault DOM element.
[ "Parses", "the", "fault", "detail", "element", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-ws/src/main/java/com/consol/citrus/ws/config/xml/SendSoapFaultActionParser.java#L79-L107
train
citrusframework/citrus
modules/citrus-ftp/src/main/java/com/consol/citrus/ftp/message/FtpMessage.java
FtpMessage.command
public static FtpMessage command(FTPCmd command) { Command cmd = new Command(); cmd.setSignal(command.getCommand()); return new FtpMessage(cmd); }
java
public static FtpMessage command(FTPCmd command) { Command cmd = new Command(); cmd.setSignal(command.getCommand()); return new FtpMessage(cmd); }
[ "public", "static", "FtpMessage", "command", "(", "FTPCmd", "command", ")", "{", "Command", "cmd", "=", "new", "Command", "(", ")", ";", "cmd", ".", "setSignal", "(", "command", ".", "getCommand", "(", ")", ")", ";", "return", "new", "FtpMessage", "(", ...
Sets the ftp command. @param command @return
[ "Sets", "the", "ftp", "command", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-ftp/src/main/java/com/consol/citrus/ftp/message/FtpMessage.java#L79-L83
train
citrusframework/citrus
modules/citrus-ftp/src/main/java/com/consol/citrus/ftp/message/FtpMessage.java
FtpMessage.connect
public static FtpMessage connect(String sessionId) { ConnectCommand cmd = new ConnectCommand(); cmd.setSignal("OPEN"); cmd.setSessionId(sessionId); return new FtpMessage(cmd); }
java
public static FtpMessage connect(String sessionId) { ConnectCommand cmd = new ConnectCommand(); cmd.setSignal("OPEN"); cmd.setSessionId(sessionId); return new FtpMessage(cmd); }
[ "public", "static", "FtpMessage", "connect", "(", "String", "sessionId", ")", "{", "ConnectCommand", "cmd", "=", "new", "ConnectCommand", "(", ")", ";", "cmd", ".", "setSignal", "(", "\"OPEN\"", ")", ";", "cmd", ".", "setSessionId", "(", "sessionId", ")", ...
Creates new connect command message. @param sessionId @return
[ "Creates", "new", "connect", "command", "message", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-ftp/src/main/java/com/consol/citrus/ftp/message/FtpMessage.java#L90-L95
train
citrusframework/citrus
modules/citrus-ftp/src/main/java/com/consol/citrus/ftp/message/FtpMessage.java
FtpMessage.arguments
public FtpMessage arguments(String arguments) { if (command != null) { command.setArguments(arguments); } setHeader(FtpMessageHeaders.FTP_ARGS, arguments); return this; }
java
public FtpMessage arguments(String arguments) { if (command != null) { command.setArguments(arguments); } setHeader(FtpMessageHeaders.FTP_ARGS, arguments); return this; }
[ "public", "FtpMessage", "arguments", "(", "String", "arguments", ")", "{", "if", "(", "command", "!=", "null", ")", "{", "command", ".", "setArguments", "(", "arguments", ")", ";", "}", "setHeader", "(", "FtpMessageHeaders", ".", "FTP_ARGS", ",", "arguments"...
Sets the command args. @param arguments
[ "Sets", "the", "command", "args", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-ftp/src/main/java/com/consol/citrus/ftp/message/FtpMessage.java#L305-L312
train
citrusframework/citrus
modules/citrus-ftp/src/main/java/com/consol/citrus/ftp/message/FtpMessage.java
FtpMessage.getSignal
public String getSignal() { return Optional.ofNullable(getHeader(FtpMessageHeaders.FTP_COMMAND)).map(Object::toString).orElse(null); }
java
public String getSignal() { return Optional.ofNullable(getHeader(FtpMessageHeaders.FTP_COMMAND)).map(Object::toString).orElse(null); }
[ "public", "String", "getSignal", "(", ")", "{", "return", "Optional", ".", "ofNullable", "(", "getHeader", "(", "FtpMessageHeaders", ".", "FTP_COMMAND", ")", ")", ".", "map", "(", "Object", "::", "toString", ")", ".", "orElse", "(", "null", ")", ";", "}"...
Gets the ftp command signal.
[ "Gets", "the", "ftp", "command", "signal", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-ftp/src/main/java/com/consol/citrus/ftp/message/FtpMessage.java#L317-L319
train
citrusframework/citrus
modules/citrus-ftp/src/main/java/com/consol/citrus/ftp/message/FtpMessage.java
FtpMessage.getArguments
public String getArguments() { return Optional.ofNullable(getHeader(FtpMessageHeaders.FTP_ARGS)).map(Object::toString).orElse(null); }
java
public String getArguments() { return Optional.ofNullable(getHeader(FtpMessageHeaders.FTP_ARGS)).map(Object::toString).orElse(null); }
[ "public", "String", "getArguments", "(", ")", "{", "return", "Optional", ".", "ofNullable", "(", "getHeader", "(", "FtpMessageHeaders", ".", "FTP_ARGS", ")", ")", ".", "map", "(", "Object", "::", "toString", ")", ".", "orElse", "(", "null", ")", ";", "}"...
Gets the command args.
[ "Gets", "the", "command", "args", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-ftp/src/main/java/com/consol/citrus/ftp/message/FtpMessage.java#L324-L326
train
citrusframework/citrus
modules/citrus-ftp/src/main/java/com/consol/citrus/ftp/message/FtpMessage.java
FtpMessage.getReplyCode
public Integer getReplyCode() { Object replyCode = getHeader(FtpMessageHeaders.FTP_REPLY_CODE); if (replyCode != null) { if (replyCode instanceof Integer) { return (Integer) replyCode; } else { return Integer.valueOf(replyCode.toString()); } } else if (commandResult != null) { return Optional.ofNullable(commandResult.getReplyCode()).map(Integer::valueOf).orElse(FTPReply.COMMAND_OK); } return null; }
java
public Integer getReplyCode() { Object replyCode = getHeader(FtpMessageHeaders.FTP_REPLY_CODE); if (replyCode != null) { if (replyCode instanceof Integer) { return (Integer) replyCode; } else { return Integer.valueOf(replyCode.toString()); } } else if (commandResult != null) { return Optional.ofNullable(commandResult.getReplyCode()).map(Integer::valueOf).orElse(FTPReply.COMMAND_OK); } return null; }
[ "public", "Integer", "getReplyCode", "(", ")", "{", "Object", "replyCode", "=", "getHeader", "(", "FtpMessageHeaders", ".", "FTP_REPLY_CODE", ")", ";", "if", "(", "replyCode", "!=", "null", ")", "{", "if", "(", "replyCode", "instanceof", "Integer", ")", "{",...
Gets the reply code.
[ "Gets", "the", "reply", "code", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-ftp/src/main/java/com/consol/citrus/ftp/message/FtpMessage.java#L331-L345
train
citrusframework/citrus
modules/citrus-ftp/src/main/java/com/consol/citrus/ftp/message/FtpMessage.java
FtpMessage.getReplyString
public String getReplyString() { Object replyString = getHeader(FtpMessageHeaders.FTP_REPLY_STRING); if (replyString != null) { return replyString.toString(); } return null; }
java
public String getReplyString() { Object replyString = getHeader(FtpMessageHeaders.FTP_REPLY_STRING); if (replyString != null) { return replyString.toString(); } return null; }
[ "public", "String", "getReplyString", "(", ")", "{", "Object", "replyString", "=", "getHeader", "(", "FtpMessageHeaders", ".", "FTP_REPLY_STRING", ")", ";", "if", "(", "replyString", "!=", "null", ")", "{", "return", "replyString", ".", "toString", "(", ")", ...
Gets the reply string.
[ "Gets", "the", "reply", "string", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-ftp/src/main/java/com/consol/citrus/ftp/message/FtpMessage.java#L371-L379
train
citrusframework/citrus
modules/citrus-ftp/src/main/java/com/consol/citrus/ftp/message/FtpMessage.java
FtpMessage.getCommandResult
private <T extends CommandResultType> T getCommandResult() { if (commandResult == null) { if (getPayload() instanceof String) { this.commandResult = (T) marshaller.unmarshal(new StringSource(getPayload(String.class))); } } return (T) commandResult; }
java
private <T extends CommandResultType> T getCommandResult() { if (commandResult == null) { if (getPayload() instanceof String) { this.commandResult = (T) marshaller.unmarshal(new StringSource(getPayload(String.class))); } } return (T) commandResult; }
[ "private", "<", "T", "extends", "CommandResultType", ">", "T", "getCommandResult", "(", ")", "{", "if", "(", "commandResult", "==", "null", ")", "{", "if", "(", "getPayload", "(", ")", "instanceof", "String", ")", "{", "this", ".", "commandResult", "=", ...
Gets the command result if any or tries to unmarshal String payload representation to an command result model. @return
[ "Gets", "the", "command", "result", "if", "any", "or", "tries", "to", "unmarshal", "String", "payload", "representation", "to", "an", "command", "result", "model", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-ftp/src/main/java/com/consol/citrus/ftp/message/FtpMessage.java#L412-L420
train
citrusframework/citrus
modules/citrus-ftp/src/main/java/com/consol/citrus/ftp/message/FtpMessage.java
FtpMessage.getCommand
private <T extends CommandType> T getCommand() { if (command == null) { if (getPayload() instanceof String) { this.command = (T) marshaller.unmarshal(new StringSource(getPayload(String.class))); } } return (T) command; }
java
private <T extends CommandType> T getCommand() { if (command == null) { if (getPayload() instanceof String) { this.command = (T) marshaller.unmarshal(new StringSource(getPayload(String.class))); } } return (T) command; }
[ "private", "<", "T", "extends", "CommandType", ">", "T", "getCommand", "(", ")", "{", "if", "(", "command", "==", "null", ")", "{", "if", "(", "getPayload", "(", ")", "instanceof", "String", ")", "{", "this", ".", "command", "=", "(", "T", ")", "ma...
Gets the command if any or tries to unmarshal String payload representation to an command model. @return
[ "Gets", "the", "command", "if", "any", "or", "tries", "to", "unmarshal", "String", "payload", "representation", "to", "an", "command", "model", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-ftp/src/main/java/com/consol/citrus/ftp/message/FtpMessage.java#L426-L434
train
citrusframework/citrus
modules/citrus-ftp/src/main/java/com/consol/citrus/ftp/message/FtpMessage.java
FtpMessage.setCommandHeader
private void setCommandHeader(CommandType command) { String header; if (command instanceof ConnectCommand) { header = FtpMessage.OPEN_COMMAND; } else if (command instanceof GetCommand) { header = FTPCmd.RETR.getCommand(); } else if (command instanceof PutCommand) { header = FTPCmd.STOR.getCommand(); } else if (command instanceof ListCommand) { header = FTPCmd.LIST.getCommand(); } else if (command instanceof DeleteCommand) { header = FTPCmd.DELE.getCommand(); } else { header = command.getSignal(); } setHeader(FtpMessageHeaders.FTP_COMMAND, header); }
java
private void setCommandHeader(CommandType command) { String header; if (command instanceof ConnectCommand) { header = FtpMessage.OPEN_COMMAND; } else if (command instanceof GetCommand) { header = FTPCmd.RETR.getCommand(); } else if (command instanceof PutCommand) { header = FTPCmd.STOR.getCommand(); } else if (command instanceof ListCommand) { header = FTPCmd.LIST.getCommand(); } else if (command instanceof DeleteCommand) { header = FTPCmd.DELE.getCommand(); } else { header = command.getSignal(); } setHeader(FtpMessageHeaders.FTP_COMMAND, header); }
[ "private", "void", "setCommandHeader", "(", "CommandType", "command", ")", "{", "String", "header", ";", "if", "(", "command", "instanceof", "ConnectCommand", ")", "{", "header", "=", "FtpMessage", ".", "OPEN_COMMAND", ";", "}", "else", "if", "(", "command", ...
Gets command header as ftp signal from command object. @param command
[ "Gets", "command", "header", "as", "ftp", "signal", "from", "command", "object", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-ftp/src/main/java/com/consol/citrus/ftp/message/FtpMessage.java#L440-L457
train
citrusframework/citrus
modules/citrus-core/src/main/java/com/consol/citrus/util/BooleanExpressionParser.java
BooleanExpressionParser.evaluate
public static boolean evaluate(final String expression) { final Deque<String> operators = new ArrayDeque<>(); final Deque<String> values = new ArrayDeque<>(); final boolean result; char currentCharacter; int currentCharacterIndex = 0; try { while (currentCharacterIndex < expression.length()) { currentCharacter = expression.charAt(currentCharacterIndex); if (SeparatorToken.OPEN_PARENTHESIS.value == currentCharacter) { operators.push(SeparatorToken.OPEN_PARENTHESIS.toString()); currentCharacterIndex += moveCursor(SeparatorToken.OPEN_PARENTHESIS.toString()); } else if (SeparatorToken.SPACE.value == currentCharacter) { currentCharacterIndex += moveCursor(SeparatorToken.SPACE.toString()); } else if (SeparatorToken.CLOSE_PARENTHESIS.value == currentCharacter) { evaluateSubexpression(operators, values); currentCharacterIndex += moveCursor(SeparatorToken.CLOSE_PARENTHESIS.toString()); } else if (!Character.isDigit(currentCharacter)) { final String parsedNonDigit = parseNonDigits(expression, currentCharacterIndex); if (isBoolean(parsedNonDigit)) { values.push(replaceBooleanStringByIntegerRepresentation(parsedNonDigit)); } else { operators.push(validateOperator(parsedNonDigit)); } currentCharacterIndex += moveCursor(parsedNonDigit); } else if (Character.isDigit(currentCharacter)) { final String parsedDigits = parseDigits(expression, currentCharacterIndex); values.push(parsedDigits); currentCharacterIndex += moveCursor(parsedDigits); } } result = Boolean.valueOf(evaluateExpressionStack(operators, values)); if (log.isDebugEnabled()) { log.debug("Boolean expression {} evaluates to {}", expression, result); } } catch (final NoSuchElementException e) { throw new CitrusRuntimeException("Unable to parse boolean expression '" + expression + "'. Maybe expression is incomplete!", e); } return result; }
java
public static boolean evaluate(final String expression) { final Deque<String> operators = new ArrayDeque<>(); final Deque<String> values = new ArrayDeque<>(); final boolean result; char currentCharacter; int currentCharacterIndex = 0; try { while (currentCharacterIndex < expression.length()) { currentCharacter = expression.charAt(currentCharacterIndex); if (SeparatorToken.OPEN_PARENTHESIS.value == currentCharacter) { operators.push(SeparatorToken.OPEN_PARENTHESIS.toString()); currentCharacterIndex += moveCursor(SeparatorToken.OPEN_PARENTHESIS.toString()); } else if (SeparatorToken.SPACE.value == currentCharacter) { currentCharacterIndex += moveCursor(SeparatorToken.SPACE.toString()); } else if (SeparatorToken.CLOSE_PARENTHESIS.value == currentCharacter) { evaluateSubexpression(operators, values); currentCharacterIndex += moveCursor(SeparatorToken.CLOSE_PARENTHESIS.toString()); } else if (!Character.isDigit(currentCharacter)) { final String parsedNonDigit = parseNonDigits(expression, currentCharacterIndex); if (isBoolean(parsedNonDigit)) { values.push(replaceBooleanStringByIntegerRepresentation(parsedNonDigit)); } else { operators.push(validateOperator(parsedNonDigit)); } currentCharacterIndex += moveCursor(parsedNonDigit); } else if (Character.isDigit(currentCharacter)) { final String parsedDigits = parseDigits(expression, currentCharacterIndex); values.push(parsedDigits); currentCharacterIndex += moveCursor(parsedDigits); } } result = Boolean.valueOf(evaluateExpressionStack(operators, values)); if (log.isDebugEnabled()) { log.debug("Boolean expression {} evaluates to {}", expression, result); } } catch (final NoSuchElementException e) { throw new CitrusRuntimeException("Unable to parse boolean expression '" + expression + "'. Maybe expression is incomplete!", e); } return result; }
[ "public", "static", "boolean", "evaluate", "(", "final", "String", "expression", ")", "{", "final", "Deque", "<", "String", ">", "operators", "=", "new", "ArrayDeque", "<>", "(", ")", ";", "final", "Deque", "<", "String", ">", "values", "=", "new", "Arra...
Perform evaluation of boolean expression string. @param expression The expression to evaluate @return boolean result @throws CitrusRuntimeException When unable to parse expression
[ "Perform", "evaluation", "of", "boolean", "expression", "string", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/util/BooleanExpressionParser.java#L92-L137
train
citrusframework/citrus
modules/citrus-core/src/main/java/com/consol/citrus/util/BooleanExpressionParser.java
BooleanExpressionParser.evaluateExpressionStack
private static String evaluateExpressionStack(final Deque<String> operators, final Deque<String> values) { while (!operators.isEmpty()) { values.push(getBooleanResultAsString(operators.pop(), values.pop(), values.pop())); } return replaceIntegerStringByBooleanRepresentation(values.pop()); }
java
private static String evaluateExpressionStack(final Deque<String> operators, final Deque<String> values) { while (!operators.isEmpty()) { values.push(getBooleanResultAsString(operators.pop(), values.pop(), values.pop())); } return replaceIntegerStringByBooleanRepresentation(values.pop()); }
[ "private", "static", "String", "evaluateExpressionStack", "(", "final", "Deque", "<", "String", ">", "operators", ",", "final", "Deque", "<", "String", ">", "values", ")", "{", "while", "(", "!", "operators", ".", "isEmpty", "(", ")", ")", "{", "values", ...
This method takes stacks of operators and values and evaluates possible expressions This is done by popping one operator and two values, applying the operator to the values and pushing the result back onto the value stack @param operators Operators to apply @param values Values @return The final result popped of the values stack
[ "This", "method", "takes", "stacks", "of", "operators", "and", "values", "and", "evaluates", "possible", "expressions", "This", "is", "done", "by", "popping", "one", "operator", "and", "two", "values", "applying", "the", "operator", "to", "the", "values", "and...
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/util/BooleanExpressionParser.java#L147-L152
train
citrusframework/citrus
modules/citrus-core/src/main/java/com/consol/citrus/util/BooleanExpressionParser.java
BooleanExpressionParser.evaluateSubexpression
private static void evaluateSubexpression(final Deque<String> operators, final Deque<String> values) { String operator = operators.pop(); while (!(operator).equals(SeparatorToken.OPEN_PARENTHESIS.toString())) { values.push(getBooleanResultAsString(operator, values.pop(), values.pop())); operator = operators.pop(); } }
java
private static void evaluateSubexpression(final Deque<String> operators, final Deque<String> values) { String operator = operators.pop(); while (!(operator).equals(SeparatorToken.OPEN_PARENTHESIS.toString())) { values.push(getBooleanResultAsString(operator, values.pop(), values.pop())); operator = operators.pop(); } }
[ "private", "static", "void", "evaluateSubexpression", "(", "final", "Deque", "<", "String", ">", "operators", ",", "final", "Deque", "<", "String", ">", "values", ")", "{", "String", "operator", "=", "operators", ".", "pop", "(", ")", ";", "while", "(", ...
Evaluates a sub expression within a pair of parentheses and pushes its result onto the stack of values @param operators Stack of operators @param values Stack of values
[ "Evaluates", "a", "sub", "expression", "within", "a", "pair", "of", "parentheses", "and", "pushes", "its", "result", "onto", "the", "stack", "of", "values" ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/util/BooleanExpressionParser.java#L160-L168
train
citrusframework/citrus
modules/citrus-core/src/main/java/com/consol/citrus/util/BooleanExpressionParser.java
BooleanExpressionParser.parseDigits
private static String parseDigits(final String expression, final int startIndex) { final StringBuilder digitBuffer = new StringBuilder(); char currentCharacter = expression.charAt(startIndex); int subExpressionIndex = startIndex; do { digitBuffer.append(currentCharacter); ++subExpressionIndex; if (subExpressionIndex < expression.length()) { currentCharacter = expression.charAt(subExpressionIndex); } } while (subExpressionIndex < expression.length() && Character.isDigit(currentCharacter)); return digitBuffer.toString(); }
java
private static String parseDigits(final String expression, final int startIndex) { final StringBuilder digitBuffer = new StringBuilder(); char currentCharacter = expression.charAt(startIndex); int subExpressionIndex = startIndex; do { digitBuffer.append(currentCharacter); ++subExpressionIndex; if (subExpressionIndex < expression.length()) { currentCharacter = expression.charAt(subExpressionIndex); } } while (subExpressionIndex < expression.length() && Character.isDigit(currentCharacter)); return digitBuffer.toString(); }
[ "private", "static", "String", "parseDigits", "(", "final", "String", "expression", ",", "final", "int", "startIndex", ")", "{", "final", "StringBuilder", "digitBuffer", "=", "new", "StringBuilder", "(", ")", ";", "char", "currentCharacter", "=", "expression", "...
This method reads digit characters from a given string, starting at a given index. It will read till the end of the string or up until it encounters a non-digit character @param expression The string to parse @param startIndex The start index from where to parse @return The parsed substring
[ "This", "method", "reads", "digit", "characters", "from", "a", "given", "string", "starting", "at", "a", "given", "index", ".", "It", "will", "read", "till", "the", "end", "of", "the", "string", "or", "up", "until", "it", "encounters", "a", "non", "-", ...
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/util/BooleanExpressionParser.java#L178-L194
train
citrusframework/citrus
modules/citrus-core/src/main/java/com/consol/citrus/util/BooleanExpressionParser.java
BooleanExpressionParser.replaceBooleanStringByIntegerRepresentation
private static String replaceBooleanStringByIntegerRepresentation(final String possibleBooleanString) { if (possibleBooleanString.equals(TRUE.toString())) { return "1"; } else if (possibleBooleanString.equals(FALSE.toString())) { return "0"; } return possibleBooleanString; }
java
private static String replaceBooleanStringByIntegerRepresentation(final String possibleBooleanString) { if (possibleBooleanString.equals(TRUE.toString())) { return "1"; } else if (possibleBooleanString.equals(FALSE.toString())) { return "0"; } return possibleBooleanString; }
[ "private", "static", "String", "replaceBooleanStringByIntegerRepresentation", "(", "final", "String", "possibleBooleanString", ")", "{", "if", "(", "possibleBooleanString", ".", "equals", "(", "TRUE", ".", "toString", "(", ")", ")", ")", "{", "return", "\"1\"", ";...
Checks whether a String is a Boolean value and replaces it with its Integer representation "true" -> "1" "false" -> "0" @param possibleBooleanString "true" or "false" @return "1" or "0"
[ "Checks", "whether", "a", "String", "is", "a", "Boolean", "value", "and", "replaces", "it", "with", "its", "Integer", "representation", "true", "-", ">", "1", "false", "-", ">", "0" ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/util/BooleanExpressionParser.java#L242-L249
train
citrusframework/citrus
modules/citrus-core/src/main/java/com/consol/citrus/util/BooleanExpressionParser.java
BooleanExpressionParser.isSeparatorToken
private static boolean isSeparatorToken(final char possibleSeparatorChar) { for (final SeparatorToken token : SeparatorToken.values()) { if (token.value == possibleSeparatorChar) { return true; } } return false; }
java
private static boolean isSeparatorToken(final char possibleSeparatorChar) { for (final SeparatorToken token : SeparatorToken.values()) { if (token.value == possibleSeparatorChar) { return true; } } return false; }
[ "private", "static", "boolean", "isSeparatorToken", "(", "final", "char", "possibleSeparatorChar", ")", "{", "for", "(", "final", "SeparatorToken", "token", ":", "SeparatorToken", ".", "values", "(", ")", ")", "{", "if", "(", "token", ".", "value", "==", "po...
Checks whether a given character is a known separator token or no @param possibleSeparatorChar The character to check @return True in case its a separator, false otherwise
[ "Checks", "whether", "a", "given", "character", "is", "a", "known", "separator", "token", "or", "no" ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/util/BooleanExpressionParser.java#L276-L283
train
citrusframework/citrus
modules/citrus-core/src/main/java/com/consol/citrus/util/BooleanExpressionParser.java
BooleanExpressionParser.validateOperator
private static String validateOperator(final String operator) { if (!OPERATORS.contains(operator) && !BOOLEAN_OPERATORS.contains(operator)) { throw new CitrusRuntimeException("Unknown operator '" + operator + "'"); } return operator; }
java
private static String validateOperator(final String operator) { if (!OPERATORS.contains(operator) && !BOOLEAN_OPERATORS.contains(operator)) { throw new CitrusRuntimeException("Unknown operator '" + operator + "'"); } return operator; }
[ "private", "static", "String", "validateOperator", "(", "final", "String", "operator", ")", "{", "if", "(", "!", "OPERATORS", ".", "contains", "(", "operator", ")", "&&", "!", "BOOLEAN_OPERATORS", ".", "contains", "(", "operator", ")", ")", "{", "throw", "...
Check if operator is known to this class. @param operator to validate @return the operator itself. @throws CitrusRuntimeException When encountering an unknown operator
[ "Check", "if", "operator", "is", "known", "to", "this", "class", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/util/BooleanExpressionParser.java#L292-L297
train
citrusframework/citrus
tools/remote/citrus-remote-server/src/main/java/com/consol/citrus/remote/controller/RunController.java
RunController.runPackages
public void runPackages(List<String> packages) { CitrusAppConfiguration citrusAppConfiguration = new CitrusAppConfiguration(); citrusAppConfiguration.setIncludes(Optional.ofNullable(includes).orElse(configuration.getIncludes())); citrusAppConfiguration.setPackages(packages); citrusAppConfiguration.setConfigClass(configuration.getConfigClass()); citrusAppConfiguration.addDefaultProperties(configuration.getDefaultProperties()); citrusAppConfiguration.addDefaultProperties(defaultProperties); run(citrusAppConfiguration); }
java
public void runPackages(List<String> packages) { CitrusAppConfiguration citrusAppConfiguration = new CitrusAppConfiguration(); citrusAppConfiguration.setIncludes(Optional.ofNullable(includes).orElse(configuration.getIncludes())); citrusAppConfiguration.setPackages(packages); citrusAppConfiguration.setConfigClass(configuration.getConfigClass()); citrusAppConfiguration.addDefaultProperties(configuration.getDefaultProperties()); citrusAppConfiguration.addDefaultProperties(defaultProperties); run(citrusAppConfiguration); }
[ "public", "void", "runPackages", "(", "List", "<", "String", ">", "packages", ")", "{", "CitrusAppConfiguration", "citrusAppConfiguration", "=", "new", "CitrusAppConfiguration", "(", ")", ";", "citrusAppConfiguration", ".", "setIncludes", "(", "Optional", ".", "ofNu...
Run Citrus application with given test package names. @param packages
[ "Run", "Citrus", "application", "with", "given", "test", "package", "names", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/tools/remote/citrus-remote-server/src/main/java/com/consol/citrus/remote/controller/RunController.java#L59-L67
train
citrusframework/citrus
tools/remote/citrus-remote-server/src/main/java/com/consol/citrus/remote/controller/RunController.java
RunController.runClasses
public void runClasses(List<TestClass> testClasses) { CitrusAppConfiguration citrusAppConfiguration = new CitrusAppConfiguration(); citrusAppConfiguration.setTestClasses(testClasses); citrusAppConfiguration.setConfigClass(configuration.getConfigClass()); citrusAppConfiguration.addDefaultProperties(configuration.getDefaultProperties()); citrusAppConfiguration.addDefaultProperties(defaultProperties); run(citrusAppConfiguration); }
java
public void runClasses(List<TestClass> testClasses) { CitrusAppConfiguration citrusAppConfiguration = new CitrusAppConfiguration(); citrusAppConfiguration.setTestClasses(testClasses); citrusAppConfiguration.setConfigClass(configuration.getConfigClass()); citrusAppConfiguration.addDefaultProperties(configuration.getDefaultProperties()); citrusAppConfiguration.addDefaultProperties(defaultProperties); run(citrusAppConfiguration); }
[ "public", "void", "runClasses", "(", "List", "<", "TestClass", ">", "testClasses", ")", "{", "CitrusAppConfiguration", "citrusAppConfiguration", "=", "new", "CitrusAppConfiguration", "(", ")", ";", "citrusAppConfiguration", ".", "setTestClasses", "(", "testClasses", "...
Run Citrus application with given test class names. @param testClasses
[ "Run", "Citrus", "application", "with", "given", "test", "class", "names", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/tools/remote/citrus-remote-server/src/main/java/com/consol/citrus/remote/controller/RunController.java#L73-L82
train
citrusframework/citrus
modules/citrus-ws/src/main/java/com/consol/citrus/ws/interceptor/LoggingEndpointInterceptor.java
LoggingEndpointInterceptor.handleRequest
public boolean handleRequest(MessageContext messageContext, Object endpoint) throws Exception { logRequest("Received SOAP request", messageContext, true); return true; }
java
public boolean handleRequest(MessageContext messageContext, Object endpoint) throws Exception { logRequest("Received SOAP request", messageContext, true); return true; }
[ "public", "boolean", "handleRequest", "(", "MessageContext", "messageContext", ",", "Object", "endpoint", ")", "throws", "Exception", "{", "logRequest", "(", "\"Received SOAP request\"", ",", "messageContext", ",", "true", ")", ";", "return", "true", ";", "}" ]
Write request message to logger.
[ "Write", "request", "message", "to", "logger", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-ws/src/main/java/com/consol/citrus/ws/interceptor/LoggingEndpointInterceptor.java#L37-L41
train
citrusframework/citrus
modules/citrus-ws/src/main/java/com/consol/citrus/ws/interceptor/LoggingEndpointInterceptor.java
LoggingEndpointInterceptor.handleResponse
public boolean handleResponse(MessageContext messageContext, Object endpoint) throws Exception { logResponse("Sending SOAP response", messageContext, false); return true; }
java
public boolean handleResponse(MessageContext messageContext, Object endpoint) throws Exception { logResponse("Sending SOAP response", messageContext, false); return true; }
[ "public", "boolean", "handleResponse", "(", "MessageContext", "messageContext", ",", "Object", "endpoint", ")", "throws", "Exception", "{", "logResponse", "(", "\"Sending SOAP response\"", ",", "messageContext", ",", "false", ")", ";", "return", "true", ";", "}" ]
Write response message to logger.
[ "Write", "response", "message", "to", "logger", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-ws/src/main/java/com/consol/citrus/ws/interceptor/LoggingEndpointInterceptor.java#L46-L50
train
citrusframework/citrus
modules/citrus-http/src/main/java/com/consol/citrus/http/client/HttpEndpointConfiguration.java
HttpEndpointConfiguration.getRestTemplate
public RestTemplate getRestTemplate() { if (restTemplate == null) { restTemplate = new RestTemplate(); restTemplate.setRequestFactory(getRequestFactory()); } restTemplate.setErrorHandler(getErrorHandler()); if (!defaultAcceptHeader) { for (org.springframework.http.converter.HttpMessageConverter messageConverter: restTemplate.getMessageConverters()) { if (messageConverter instanceof StringHttpMessageConverter) { ((StringHttpMessageConverter) messageConverter).setWriteAcceptCharset(defaultAcceptHeader); } } } return restTemplate; }
java
public RestTemplate getRestTemplate() { if (restTemplate == null) { restTemplate = new RestTemplate(); restTemplate.setRequestFactory(getRequestFactory()); } restTemplate.setErrorHandler(getErrorHandler()); if (!defaultAcceptHeader) { for (org.springframework.http.converter.HttpMessageConverter messageConverter: restTemplate.getMessageConverters()) { if (messageConverter instanceof StringHttpMessageConverter) { ((StringHttpMessageConverter) messageConverter).setWriteAcceptCharset(defaultAcceptHeader); } } } return restTemplate; }
[ "public", "RestTemplate", "getRestTemplate", "(", ")", "{", "if", "(", "restTemplate", "==", "null", ")", "{", "restTemplate", "=", "new", "RestTemplate", "(", ")", ";", "restTemplate", ".", "setRequestFactory", "(", "getRequestFactory", "(", ")", ")", ";", ...
Gets the restTemplate. @return the restTemplate
[ "Gets", "the", "restTemplate", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-http/src/main/java/com/consol/citrus/http/client/HttpEndpointConfiguration.java#L208-L225
train
citrusframework/citrus
modules/citrus-core/src/main/java/com/consol/citrus/validation/xml/XpathMessageValidator.java
XpathMessageValidator.getNodeValue
private String getNodeValue(Node node) { if (node.getNodeType() == Node.ELEMENT_NODE && node.getFirstChild() != null) { return node.getFirstChild().getNodeValue(); } else { return node.getNodeValue(); } }
java
private String getNodeValue(Node node) { if (node.getNodeType() == Node.ELEMENT_NODE && node.getFirstChild() != null) { return node.getFirstChild().getNodeValue(); } else { return node.getNodeValue(); } }
[ "private", "String", "getNodeValue", "(", "Node", "node", ")", "{", "if", "(", "node", ".", "getNodeType", "(", ")", "==", "Node", ".", "ELEMENT_NODE", "&&", "node", ".", "getFirstChild", "(", ")", "!=", "null", ")", "{", "return", "node", ".", "getFir...
Resolves an XML node's value @param node @return node's string value
[ "Resolves", "an", "XML", "node", "s", "value" ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/validation/xml/XpathMessageValidator.java#L137-L143
train
citrusframework/citrus
modules/citrus-core/src/main/java/com/consol/citrus/functions/core/RandomNumberFunction.java
RandomNumberFunction.getRandomNumber
public static String getRandomNumber(int numberLength, boolean paddingOn) { if (numberLength < 1) { throw new InvalidFunctionUsageException("numberLength must be greater than 0 - supplied " + numberLength); } StringBuilder buffer = new StringBuilder(); for (int i = 0; i < numberLength; i++) { buffer.append(generator.nextInt(10)); } return checkLeadingZeros(buffer.toString(), paddingOn); }
java
public static String getRandomNumber(int numberLength, boolean paddingOn) { if (numberLength < 1) { throw new InvalidFunctionUsageException("numberLength must be greater than 0 - supplied " + numberLength); } StringBuilder buffer = new StringBuilder(); for (int i = 0; i < numberLength; i++) { buffer.append(generator.nextInt(10)); } return checkLeadingZeros(buffer.toString(), paddingOn); }
[ "public", "static", "String", "getRandomNumber", "(", "int", "numberLength", ",", "boolean", "paddingOn", ")", "{", "if", "(", "numberLength", "<", "1", ")", "{", "throw", "new", "InvalidFunctionUsageException", "(", "\"numberLength must be greater than 0 - supplied \""...
Static number generator method. @param numberLength @param paddingOn @return
[ "Static", "number", "generator", "method", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/functions/core/RandomNumberFunction.java#L71-L82
train
citrusframework/citrus
modules/citrus-core/src/main/java/com/consol/citrus/functions/core/RandomNumberFunction.java
RandomNumberFunction.checkLeadingZeros
public static String checkLeadingZeros(String generated, boolean paddingOn) { if (paddingOn) { return replaceLeadingZero(generated); } else { return removeLeadingZeros(generated); } }
java
public static String checkLeadingZeros(String generated, boolean paddingOn) { if (paddingOn) { return replaceLeadingZero(generated); } else { return removeLeadingZeros(generated); } }
[ "public", "static", "String", "checkLeadingZeros", "(", "String", "generated", ",", "boolean", "paddingOn", ")", "{", "if", "(", "paddingOn", ")", "{", "return", "replaceLeadingZero", "(", "generated", ")", ";", "}", "else", "{", "return", "removeLeadingZeros", ...
Remove leading Zero numbers. @param generated @param paddingOn
[ "Remove", "leading", "Zero", "numbers", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/functions/core/RandomNumberFunction.java#L89-L96
train
citrusframework/citrus
modules/citrus-core/src/main/java/com/consol/citrus/functions/core/RandomNumberFunction.java
RandomNumberFunction.removeLeadingZeros
private static String removeLeadingZeros(String generated) { StringBuilder builder = new StringBuilder(); boolean leading = true; for (int i = 0; i < generated.length(); i++) { if (generated.charAt(i) == '0' && leading) { continue; } else { leading = false; builder.append(generated.charAt(i)); } } if (builder.length() == 0) { // very unlikely to happen, ensures that empty string is not returned builder.append('0'); } return builder.toString(); }
java
private static String removeLeadingZeros(String generated) { StringBuilder builder = new StringBuilder(); boolean leading = true; for (int i = 0; i < generated.length(); i++) { if (generated.charAt(i) == '0' && leading) { continue; } else { leading = false; builder.append(generated.charAt(i)); } } if (builder.length() == 0) { // very unlikely to happen, ensures that empty string is not returned builder.append('0'); } return builder.toString(); }
[ "private", "static", "String", "removeLeadingZeros", "(", "String", "generated", ")", "{", "StringBuilder", "builder", "=", "new", "StringBuilder", "(", ")", ";", "boolean", "leading", "=", "true", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "g...
Removes leading zero numbers if present. @param generated @return
[ "Removes", "leading", "zero", "numbers", "if", "present", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/functions/core/RandomNumberFunction.java#L103-L121
train
citrusframework/citrus
modules/citrus-core/src/main/java/com/consol/citrus/functions/core/RandomNumberFunction.java
RandomNumberFunction.replaceLeadingZero
private static String replaceLeadingZero(String generated) { if (generated.charAt(0) == '0') { // find number > 0 as replacement to avoid leading zero numbers int replacement = 0; while (replacement == 0) { replacement = generator.nextInt(10); } return replacement + generated.substring(1); } else { return generated; } }
java
private static String replaceLeadingZero(String generated) { if (generated.charAt(0) == '0') { // find number > 0 as replacement to avoid leading zero numbers int replacement = 0; while (replacement == 0) { replacement = generator.nextInt(10); } return replacement + generated.substring(1); } else { return generated; } }
[ "private", "static", "String", "replaceLeadingZero", "(", "String", "generated", ")", "{", "if", "(", "generated", ".", "charAt", "(", "0", ")", "==", "'", "'", ")", "{", "// find number > 0 as replacement to avoid leading zero numbers", "int", "replacement", "=", ...
Replaces first leading zero number if present. @param generated @return
[ "Replaces", "first", "leading", "zero", "number", "if", "present", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/functions/core/RandomNumberFunction.java#L128-L140
train
citrusframework/citrus
modules/citrus-arquillian/src/main/java/com/consol/citrus/arquillian/container/CitrusRemoteConfigurationProducer.java
CitrusRemoteConfigurationProducer.configure
public void configure(@Observes(precedence = CitrusExtensionConstants.REMOTE_CONFIG_PRECEDENCE) BeforeSuite event) { try { log.info("Producing Citrus remote configuration"); configurationInstance.set(CitrusConfiguration.from(getRemoteConfigurationProperties())); } catch (Exception e) { log.error(CitrusExtensionConstants.CITRUS_EXTENSION_ERROR, e); throw e; } }
java
public void configure(@Observes(precedence = CitrusExtensionConstants.REMOTE_CONFIG_PRECEDENCE) BeforeSuite event) { try { log.info("Producing Citrus remote configuration"); configurationInstance.set(CitrusConfiguration.from(getRemoteConfigurationProperties())); } catch (Exception e) { log.error(CitrusExtensionConstants.CITRUS_EXTENSION_ERROR, e); throw e; } }
[ "public", "void", "configure", "(", "@", "Observes", "(", "precedence", "=", "CitrusExtensionConstants", ".", "REMOTE_CONFIG_PRECEDENCE", ")", "BeforeSuite", "event", ")", "{", "try", "{", "log", ".", "info", "(", "\"Producing Citrus remote configuration\"", ")", ";...
Observes before suite event and tries to load Citrus remote extension properties. @param event
[ "Observes", "before", "suite", "event", "and", "tries", "to", "load", "Citrus", "remote", "extension", "properties", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-arquillian/src/main/java/com/consol/citrus/arquillian/container/CitrusRemoteConfigurationProducer.java#L57-L65
train
citrusframework/citrus
modules/citrus-arquillian/src/main/java/com/consol/citrus/arquillian/container/CitrusRemoteConfigurationProducer.java
CitrusRemoteConfigurationProducer.getRemoteConfigurationProperties
private Properties getRemoteConfigurationProperties() { ClassLoader ctcl = AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() { public ClassLoader run() { return Thread.currentThread().getContextClassLoader(); } }); try { if (log.isDebugEnabled()) { log.debug("Loading Citrus remote extension properties ..."); } Properties props = new Properties(); InputStream inputStream = ctcl.getResourceAsStream(CitrusExtensionConstants.CITRUS_REMOTE_PROPERTIES); if (inputStream != null) { props.load(inputStream); } if (log.isDebugEnabled()) { log.debug("Successfully loaded Citrus remote extension properties"); } return props; } catch (IOException e) { log.warn("Unable to load Citrus remote extension properties"); return new Properties(); } }
java
private Properties getRemoteConfigurationProperties() { ClassLoader ctcl = AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() { public ClassLoader run() { return Thread.currentThread().getContextClassLoader(); } }); try { if (log.isDebugEnabled()) { log.debug("Loading Citrus remote extension properties ..."); } Properties props = new Properties(); InputStream inputStream = ctcl.getResourceAsStream(CitrusExtensionConstants.CITRUS_REMOTE_PROPERTIES); if (inputStream != null) { props.load(inputStream); } if (log.isDebugEnabled()) { log.debug("Successfully loaded Citrus remote extension properties"); } return props; } catch (IOException e) { log.warn("Unable to load Citrus remote extension properties"); return new Properties(); } }
[ "private", "Properties", "getRemoteConfigurationProperties", "(", ")", "{", "ClassLoader", "ctcl", "=", "AccessController", ".", "doPrivileged", "(", "new", "PrivilegedAction", "<", "ClassLoader", ">", "(", ")", "{", "public", "ClassLoader", "run", "(", ")", "{", ...
Reads configuration properties from remote property file that has been added to the auxiliary archive. @return
[ "Reads", "configuration", "properties", "from", "remote", "property", "file", "that", "has", "been", "added", "to", "the", "auxiliary", "archive", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-arquillian/src/main/java/com/consol/citrus/arquillian/container/CitrusRemoteConfigurationProducer.java#L71-L99
train
citrusframework/citrus
modules/citrus-kubernetes/src/main/java/com/consol/citrus/kubernetes/command/AbstractKubernetesCommand.java
AbstractKubernetesCommand.getWithoutLabels
protected Map<String, String> getWithoutLabels(String labelExpression, TestContext context) { Map<String, String> labels = new HashMap<>(); Set<String> values = StringUtils.commaDelimitedListToSet(labelExpression); for (String item : values) { if (item.contains("!=")) { labels.put(context.replaceDynamicContentInString(item.substring(0, item.indexOf("!="))), context.replaceDynamicContentInString(item.substring(item.indexOf("!=") + 2))); } else if (item.startsWith("!")) { labels.put(context.replaceDynamicContentInString(item.substring(1)), null); } } return labels; }
java
protected Map<String, String> getWithoutLabels(String labelExpression, TestContext context) { Map<String, String> labels = new HashMap<>(); Set<String> values = StringUtils.commaDelimitedListToSet(labelExpression); for (String item : values) { if (item.contains("!=")) { labels.put(context.replaceDynamicContentInString(item.substring(0, item.indexOf("!="))), context.replaceDynamicContentInString(item.substring(item.indexOf("!=") + 2))); } else if (item.startsWith("!")) { labels.put(context.replaceDynamicContentInString(item.substring(1)), null); } } return labels; }
[ "protected", "Map", "<", "String", ",", "String", ">", "getWithoutLabels", "(", "String", "labelExpression", ",", "TestContext", "context", ")", "{", "Map", "<", "String", ",", "String", ">", "labels", "=", "new", "HashMap", "<>", "(", ")", ";", "Set", "...
Reads without labels from expression string. @param labelExpression @param context @return
[ "Reads", "without", "labels", "from", "expression", "string", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-kubernetes/src/main/java/com/consol/citrus/kubernetes/command/AbstractKubernetesCommand.java#L217-L230
train
citrusframework/citrus
modules/citrus-jmx/src/main/java/com/consol/citrus/jmx/server/JmxEndpointMBean.java
JmxEndpointMBean.handleInvocation
private Object handleInvocation(ManagedBeanInvocation mbeanInvocation) { Message response = endpointAdapter.handleMessage(endpointConfiguration.getMessageConverter() .convertInbound(mbeanInvocation, endpointConfiguration, null)); ManagedBeanResult serviceResult = null; if (response != null && response.getPayload() != null) { if (response.getPayload() instanceof ManagedBeanResult) { serviceResult = (ManagedBeanResult) response.getPayload(); } else if (response.getPayload() instanceof String) { serviceResult = (ManagedBeanResult) endpointConfiguration.getMarshaller().unmarshal(response.getPayload(Source.class)); } } if (serviceResult != null) { return serviceResult.getResultObject(endpointConfiguration.getApplicationContext()); } else { return null; } }
java
private Object handleInvocation(ManagedBeanInvocation mbeanInvocation) { Message response = endpointAdapter.handleMessage(endpointConfiguration.getMessageConverter() .convertInbound(mbeanInvocation, endpointConfiguration, null)); ManagedBeanResult serviceResult = null; if (response != null && response.getPayload() != null) { if (response.getPayload() instanceof ManagedBeanResult) { serviceResult = (ManagedBeanResult) response.getPayload(); } else if (response.getPayload() instanceof String) { serviceResult = (ManagedBeanResult) endpointConfiguration.getMarshaller().unmarshal(response.getPayload(Source.class)); } } if (serviceResult != null) { return serviceResult.getResultObject(endpointConfiguration.getApplicationContext()); } else { return null; } }
[ "private", "Object", "handleInvocation", "(", "ManagedBeanInvocation", "mbeanInvocation", ")", "{", "Message", "response", "=", "endpointAdapter", ".", "handleMessage", "(", "endpointConfiguration", ".", "getMessageConverter", "(", ")", ".", "convertInbound", "(", "mbea...
Handle managed bean invocation by delegating to endpoint adapter. Response is converted to proper method return result. @param mbeanInvocation @return
[ "Handle", "managed", "bean", "invocation", "by", "delegating", "to", "endpoint", "adapter", ".", "Response", "is", "converted", "to", "proper", "method", "return", "result", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-jmx/src/main/java/com/consol/citrus/jmx/server/JmxEndpointMBean.java#L164-L182
train
citrusframework/citrus
modules/citrus-core/src/main/java/com/consol/citrus/variable/dictionary/json/JsonMappingDataDictionary.java
JsonMappingDataDictionary.traverseJsonData
private void traverseJsonData(JSONObject jsonData, String jsonPath, TestContext context) { for (Iterator it = jsonData.entrySet().iterator(); it.hasNext();) { Map.Entry jsonEntry = (Map.Entry) it.next(); if (jsonEntry.getValue() instanceof JSONObject) { traverseJsonData((JSONObject) jsonEntry.getValue(), (StringUtils.hasText(jsonPath) ? jsonPath + "." + jsonEntry.getKey() : jsonEntry.getKey().toString()), context); } else if (jsonEntry.getValue() instanceof JSONArray) { JSONArray jsonArray = (JSONArray) jsonEntry.getValue(); for (int i = 0; i < jsonArray.size(); i++) { if (jsonArray.get(i) instanceof JSONObject) { traverseJsonData((JSONObject) jsonArray.get(i), String.format((StringUtils.hasText(jsonPath) ? jsonPath + "." + jsonEntry.getKey() : jsonEntry.getKey().toString()) + "[%s]", i), context); } else { jsonArray.set(i, translate(String.format((StringUtils.hasText(jsonPath) ? jsonPath + "." + jsonEntry.getKey() : jsonEntry.getKey().toString()) + "[%s]", i), jsonArray.get(i), context)); } } } else { jsonEntry.setValue(translate((StringUtils.hasText(jsonPath) ? jsonPath + "." + jsonEntry.getKey() : jsonEntry.getKey().toString()), jsonEntry.getValue() != null ? jsonEntry.getValue() : null, context)); } } }
java
private void traverseJsonData(JSONObject jsonData, String jsonPath, TestContext context) { for (Iterator it = jsonData.entrySet().iterator(); it.hasNext();) { Map.Entry jsonEntry = (Map.Entry) it.next(); if (jsonEntry.getValue() instanceof JSONObject) { traverseJsonData((JSONObject) jsonEntry.getValue(), (StringUtils.hasText(jsonPath) ? jsonPath + "." + jsonEntry.getKey() : jsonEntry.getKey().toString()), context); } else if (jsonEntry.getValue() instanceof JSONArray) { JSONArray jsonArray = (JSONArray) jsonEntry.getValue(); for (int i = 0; i < jsonArray.size(); i++) { if (jsonArray.get(i) instanceof JSONObject) { traverseJsonData((JSONObject) jsonArray.get(i), String.format((StringUtils.hasText(jsonPath) ? jsonPath + "." + jsonEntry.getKey() : jsonEntry.getKey().toString()) + "[%s]", i), context); } else { jsonArray.set(i, translate(String.format((StringUtils.hasText(jsonPath) ? jsonPath + "." + jsonEntry.getKey() : jsonEntry.getKey().toString()) + "[%s]", i), jsonArray.get(i), context)); } } } else { jsonEntry.setValue(translate((StringUtils.hasText(jsonPath) ? jsonPath + "." + jsonEntry.getKey() : jsonEntry.getKey().toString()), jsonEntry.getValue() != null ? jsonEntry.getValue() : null, context)); } } }
[ "private", "void", "traverseJsonData", "(", "JSONObject", "jsonData", ",", "String", "jsonPath", ",", "TestContext", "context", ")", "{", "for", "(", "Iterator", "it", "=", "jsonData", ".", "entrySet", "(", ")", ".", "iterator", "(", ")", ";", "it", ".", ...
Walks through the Json object structure and translates values based on element path if necessary. @param jsonData @param jsonPath @param context
[ "Walks", "through", "the", "Json", "object", "structure", "and", "translates", "values", "based", "on", "element", "path", "if", "necessary", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/variable/dictionary/json/JsonMappingDataDictionary.java#L113-L133
train
citrusframework/citrus
modules/citrus-core/src/main/java/com/consol/citrus/functions/core/DigestAuthHeaderFunction.java
DigestAuthHeaderFunction.getDigestHex
private String getDigestHex(String algorithm, String key) { if (algorithm.equals("md5")) { return DigestUtils.md5Hex(key); } else if (algorithm.equals("sha")) { return DigestUtils.shaHex(key); } throw new CitrusRuntimeException("Unsupported digest algorithm: " + algorithm); }
java
private String getDigestHex(String algorithm, String key) { if (algorithm.equals("md5")) { return DigestUtils.md5Hex(key); } else if (algorithm.equals("sha")) { return DigestUtils.shaHex(key); } throw new CitrusRuntimeException("Unsupported digest algorithm: " + algorithm); }
[ "private", "String", "getDigestHex", "(", "String", "algorithm", ",", "String", "key", ")", "{", "if", "(", "algorithm", ".", "equals", "(", "\"md5\"", ")", ")", "{", "return", "DigestUtils", ".", "md5Hex", "(", "key", ")", ";", "}", "else", "if", "(",...
Generates digest hexadecimal string representation of a key with given algorithm. @param algorithm @param key @return
[ "Generates", "digest", "hexadecimal", "string", "representation", "of", "a", "key", "with", "given", "algorithm", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/functions/core/DigestAuthHeaderFunction.java#L97-L105
train
citrusframework/citrus
modules/citrus-ws/src/main/java/com/consol/citrus/ws/server/WebServiceEndpoint.java
WebServiceEndpoint.simulateHttpStatusCode
private boolean simulateHttpStatusCode(Message replyMessage) throws IOException { if (replyMessage == null || CollectionUtils.isEmpty(replyMessage.getHeaders())) { return false; } for (Entry<String, Object> headerEntry : replyMessage.getHeaders().entrySet()) { if (headerEntry.getKey().equalsIgnoreCase(SoapMessageHeaders.HTTP_STATUS_CODE)) { WebServiceConnection connection = TransportContextHolder.getTransportContext().getConnection(); int statusCode = Integer.valueOf(headerEntry.getValue().toString()); if (connection instanceof HttpServletConnection) { ((HttpServletConnection)connection).setFault(false); ((HttpServletConnection)connection).getHttpServletResponse().setStatus(statusCode); return true; } else { log.warn("Unable to set custom Http status code on connection other than HttpServletConnection (" + connection.getClass().getName() + ")"); } } } return false; }
java
private boolean simulateHttpStatusCode(Message replyMessage) throws IOException { if (replyMessage == null || CollectionUtils.isEmpty(replyMessage.getHeaders())) { return false; } for (Entry<String, Object> headerEntry : replyMessage.getHeaders().entrySet()) { if (headerEntry.getKey().equalsIgnoreCase(SoapMessageHeaders.HTTP_STATUS_CODE)) { WebServiceConnection connection = TransportContextHolder.getTransportContext().getConnection(); int statusCode = Integer.valueOf(headerEntry.getValue().toString()); if (connection instanceof HttpServletConnection) { ((HttpServletConnection)connection).setFault(false); ((HttpServletConnection)connection).getHttpServletResponse().setStatus(statusCode); return true; } else { log.warn("Unable to set custom Http status code on connection other than HttpServletConnection (" + connection.getClass().getName() + ")"); } } } return false; }
[ "private", "boolean", "simulateHttpStatusCode", "(", "Message", "replyMessage", ")", "throws", "IOException", "{", "if", "(", "replyMessage", "==", "null", "||", "CollectionUtils", ".", "isEmpty", "(", "replyMessage", ".", "getHeaders", "(", ")", ")", ")", "{", ...
If Http status code is set on reply message headers simulate Http error with status code. No SOAP response is sent back in this case. @param replyMessage @return @throws IOException
[ "If", "Http", "status", "code", "is", "set", "on", "reply", "message", "headers", "simulate", "Http", "error", "with", "status", "code", ".", "No", "SOAP", "response", "is", "sent", "back", "in", "this", "case", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-ws/src/main/java/com/consol/citrus/ws/server/WebServiceEndpoint.java#L149-L170
train
citrusframework/citrus
modules/citrus-ws/src/main/java/com/consol/citrus/ws/server/WebServiceEndpoint.java
WebServiceEndpoint.addSoapBody
private void addSoapBody(SoapMessage response, Message replyMessage) throws TransformerException { if (!(replyMessage.getPayload() instanceof String) || StringUtils.hasText(replyMessage.getPayload(String.class))) { Source responseSource = getPayloadAsSource(replyMessage.getPayload()); TransformerFactory transformerFactory = TransformerFactory.newInstance(); Transformer transformer = transformerFactory.newTransformer(); transformer.transform(responseSource, response.getPayloadResult()); } }
java
private void addSoapBody(SoapMessage response, Message replyMessage) throws TransformerException { if (!(replyMessage.getPayload() instanceof String) || StringUtils.hasText(replyMessage.getPayload(String.class))) { Source responseSource = getPayloadAsSource(replyMessage.getPayload()); TransformerFactory transformerFactory = TransformerFactory.newInstance(); Transformer transformer = transformerFactory.newTransformer(); transformer.transform(responseSource, response.getPayloadResult()); } }
[ "private", "void", "addSoapBody", "(", "SoapMessage", "response", ",", "Message", "replyMessage", ")", "throws", "TransformerException", "{", "if", "(", "!", "(", "replyMessage", ".", "getPayload", "(", ")", "instanceof", "String", ")", "||", "StringUtils", ".",...
Add message payload as SOAP body element to the SOAP response. @param response @param replyMessage
[ "Add", "message", "payload", "as", "SOAP", "body", "element", "to", "the", "SOAP", "response", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-ws/src/main/java/com/consol/citrus/ws/server/WebServiceEndpoint.java#L201-L211
train
citrusframework/citrus
modules/citrus-ws/src/main/java/com/consol/citrus/ws/server/WebServiceEndpoint.java
WebServiceEndpoint.addSoapHeaders
private void addSoapHeaders(SoapMessage response, Message replyMessage) throws TransformerException { for (Entry<String, Object> headerEntry : replyMessage.getHeaders().entrySet()) { if (MessageHeaderUtils.isSpringInternalHeader(headerEntry.getKey()) || headerEntry.getKey().startsWith(DEFAULT_JMS_HEADER_PREFIX)) { continue; } if (headerEntry.getKey().equalsIgnoreCase(SoapMessageHeaders.SOAP_ACTION)) { response.setSoapAction(headerEntry.getValue().toString()); } else if (!headerEntry.getKey().startsWith(MessageHeaders.PREFIX)) { SoapHeaderElement headerElement; if (QNameUtils.validateQName(headerEntry.getKey())) { QName qname = QNameUtils.parseQNameString(headerEntry.getKey()); if (StringUtils.hasText(qname.getNamespaceURI())) { headerElement = response.getSoapHeader().addHeaderElement(qname); } else { headerElement = response.getSoapHeader().addHeaderElement(getDefaultQName(headerEntry.getKey())); } } else { throw new SoapHeaderException("Failed to add SOAP header '" + headerEntry.getKey() + "', " + "because of invalid QName"); } headerElement.setText(headerEntry.getValue().toString()); } } for (String headerData : replyMessage.getHeaderData()) { TransformerFactory transformerFactory = TransformerFactory.newInstance(); Transformer transformer = transformerFactory.newTransformer(); transformer.transform(new StringSource(headerData), response.getSoapHeader().getResult()); } }
java
private void addSoapHeaders(SoapMessage response, Message replyMessage) throws TransformerException { for (Entry<String, Object> headerEntry : replyMessage.getHeaders().entrySet()) { if (MessageHeaderUtils.isSpringInternalHeader(headerEntry.getKey()) || headerEntry.getKey().startsWith(DEFAULT_JMS_HEADER_PREFIX)) { continue; } if (headerEntry.getKey().equalsIgnoreCase(SoapMessageHeaders.SOAP_ACTION)) { response.setSoapAction(headerEntry.getValue().toString()); } else if (!headerEntry.getKey().startsWith(MessageHeaders.PREFIX)) { SoapHeaderElement headerElement; if (QNameUtils.validateQName(headerEntry.getKey())) { QName qname = QNameUtils.parseQNameString(headerEntry.getKey()); if (StringUtils.hasText(qname.getNamespaceURI())) { headerElement = response.getSoapHeader().addHeaderElement(qname); } else { headerElement = response.getSoapHeader().addHeaderElement(getDefaultQName(headerEntry.getKey())); } } else { throw new SoapHeaderException("Failed to add SOAP header '" + headerEntry.getKey() + "', " + "because of invalid QName"); } headerElement.setText(headerEntry.getValue().toString()); } } for (String headerData : replyMessage.getHeaderData()) { TransformerFactory transformerFactory = TransformerFactory.newInstance(); Transformer transformer = transformerFactory.newTransformer(); transformer.transform(new StringSource(headerData), response.getSoapHeader().getResult()); } }
[ "private", "void", "addSoapHeaders", "(", "SoapMessage", "response", ",", "Message", "replyMessage", ")", "throws", "TransformerException", "{", "for", "(", "Entry", "<", "String", ",", "Object", ">", "headerEntry", ":", "replyMessage", ".", "getHeaders", "(", "...
Translates message headers to SOAP headers in response. @param response @param replyMessage
[ "Translates", "message", "headers", "to", "SOAP", "headers", "in", "response", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-ws/src/main/java/com/consol/citrus/ws/server/WebServiceEndpoint.java#L218-L253
train
citrusframework/citrus
modules/citrus-ws/src/main/java/com/consol/citrus/ws/server/WebServiceEndpoint.java
WebServiceEndpoint.getDefaultQName
private QName getDefaultQName(String localPart) { if (StringUtils.hasText(defaultNamespaceUri)) { return new QName(defaultNamespaceUri, localPart, defaultPrefix); } else { throw new SoapHeaderException("Failed to add SOAP header '" + localPart + "', " + "because neither valid QName nor default namespace-uri is set!"); } }
java
private QName getDefaultQName(String localPart) { if (StringUtils.hasText(defaultNamespaceUri)) { return new QName(defaultNamespaceUri, localPart, defaultPrefix); } else { throw new SoapHeaderException("Failed to add SOAP header '" + localPart + "', " + "because neither valid QName nor default namespace-uri is set!"); } }
[ "private", "QName", "getDefaultQName", "(", "String", "localPart", ")", "{", "if", "(", "StringUtils", ".", "hasText", "(", "defaultNamespaceUri", ")", ")", "{", "return", "new", "QName", "(", "defaultNamespaceUri", ",", "localPart", ",", "defaultPrefix", ")", ...
Get the default QName from local part. @param localPart @return
[ "Get", "the", "default", "QName", "from", "local", "part", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-ws/src/main/java/com/consol/citrus/ws/server/WebServiceEndpoint.java#L333-L340
train
citrusframework/citrus
modules/citrus-core/src/main/java/com/consol/citrus/junit/jupiter/CitrusBaseExtension.java
CitrusBaseExtension.getBaseKey
protected static String getBaseKey(ExtensionContext extensionContext) { return extensionContext.getRequiredTestClass().getName() + "." + extensionContext.getRequiredTestMethod().getName() + "#"; }
java
protected static String getBaseKey(ExtensionContext extensionContext) { return extensionContext.getRequiredTestClass().getName() + "." + extensionContext.getRequiredTestMethod().getName() + "#"; }
[ "protected", "static", "String", "getBaseKey", "(", "ExtensionContext", "extensionContext", ")", "{", "return", "extensionContext", ".", "getRequiredTestClass", "(", ")", ".", "getName", "(", ")", "+", "\".\"", "+", "extensionContext", ".", "getRequiredTestMethod", ...
Gets base key for store. @param extensionContext @return
[ "Gets", "base", "key", "for", "store", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/junit/jupiter/CitrusBaseExtension.java#L118-L120
train
citrusframework/citrus
modules/citrus-core/src/main/java/com/consol/citrus/junit/jupiter/CitrusBaseExtension.java
CitrusBaseExtension.packageScan
public static Stream<DynamicTest> packageScan(String ... packagesToScan) { List<DynamicTest> tests = new ArrayList<>(); for (String packageScan : packagesToScan) { try { for (String fileNamePattern : Citrus.getXmlTestFileNamePattern()) { Resource[] fileResources = new PathMatchingResourcePatternResolver().getResources(packageScan.replace('.', File.separatorChar) + fileNamePattern); for (Resource fileResource : fileResources) { String filePath = fileResource.getFile().getParentFile().getCanonicalPath(); if (packageScan.startsWith("file:")) { filePath = "file:" + filePath; } filePath = filePath.substring(filePath.indexOf(packageScan.replace('.', File.separatorChar))); String testName = fileResource.getFilename().substring(0, fileResource.getFilename().length() - ".xml".length()); XmlTestLoader testLoader = new XmlTestLoader(DynamicTest.class, testName, filePath, citrus.getApplicationContext()); tests.add(DynamicTest.dynamicTest(testName, () -> citrus.run(testLoader.load()))); } } } catch (IOException e) { throw new CitrusRuntimeException("Unable to locate file resources for test package '" + packageScan + "'", e); } } return tests.stream(); }
java
public static Stream<DynamicTest> packageScan(String ... packagesToScan) { List<DynamicTest> tests = new ArrayList<>(); for (String packageScan : packagesToScan) { try { for (String fileNamePattern : Citrus.getXmlTestFileNamePattern()) { Resource[] fileResources = new PathMatchingResourcePatternResolver().getResources(packageScan.replace('.', File.separatorChar) + fileNamePattern); for (Resource fileResource : fileResources) { String filePath = fileResource.getFile().getParentFile().getCanonicalPath(); if (packageScan.startsWith("file:")) { filePath = "file:" + filePath; } filePath = filePath.substring(filePath.indexOf(packageScan.replace('.', File.separatorChar))); String testName = fileResource.getFilename().substring(0, fileResource.getFilename().length() - ".xml".length()); XmlTestLoader testLoader = new XmlTestLoader(DynamicTest.class, testName, filePath, citrus.getApplicationContext()); tests.add(DynamicTest.dynamicTest(testName, () -> citrus.run(testLoader.load()))); } } } catch (IOException e) { throw new CitrusRuntimeException("Unable to locate file resources for test package '" + packageScan + "'", e); } } return tests.stream(); }
[ "public", "static", "Stream", "<", "DynamicTest", ">", "packageScan", "(", "String", "...", "packagesToScan", ")", "{", "List", "<", "DynamicTest", ">", "tests", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", "String", "packageScan", ":", "packa...
Creates stream of dynamic tests based on package scan. Scans package for all Xml test case files and creates dynamic test instance for it. @param packagesToScan @return
[ "Creates", "stream", "of", "dynamic", "tests", "based", "on", "package", "scan", ".", "Scans", "package", "for", "all", "Xml", "test", "case", "files", "and", "creates", "dynamic", "test", "instance", "for", "it", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/junit/jupiter/CitrusBaseExtension.java#L190-L218
train
citrusframework/citrus
modules/citrus-kubernetes/src/main/java/com/consol/citrus/kubernetes/message/KubernetesMessage.java
KubernetesMessage.request
public static KubernetesMessage request(KubernetesCommand<?> command) { KubernetesRequest request = new KubernetesRequest(); request.setCommand(command.getName()); for (Map.Entry<String, Object> entry : command.getParameters().entrySet()) { if (entry.getKey().equals(KubernetesMessageHeaders.NAME)) { request.setName(entry.getValue().toString()); } if (entry.getKey().equals(KubernetesMessageHeaders.NAMESPACE)) { request.setNamespace(entry.getValue().toString()); } if (entry.getKey().equals(KubernetesMessageHeaders.LABEL)) { request.setLabel(entry.getValue().toString()); } } return new KubernetesMessage(request); }
java
public static KubernetesMessage request(KubernetesCommand<?> command) { KubernetesRequest request = new KubernetesRequest(); request.setCommand(command.getName()); for (Map.Entry<String, Object> entry : command.getParameters().entrySet()) { if (entry.getKey().equals(KubernetesMessageHeaders.NAME)) { request.setName(entry.getValue().toString()); } if (entry.getKey().equals(KubernetesMessageHeaders.NAMESPACE)) { request.setNamespace(entry.getValue().toString()); } if (entry.getKey().equals(KubernetesMessageHeaders.LABEL)) { request.setLabel(entry.getValue().toString()); } } return new KubernetesMessage(request); }
[ "public", "static", "KubernetesMessage", "request", "(", "KubernetesCommand", "<", "?", ">", "command", ")", "{", "KubernetesRequest", "request", "=", "new", "KubernetesRequest", "(", ")", ";", "request", ".", "setCommand", "(", "command", ".", "getName", "(", ...
Request generating instantiation. @param command @return
[ "Request", "generating", "instantiation", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-kubernetes/src/main/java/com/consol/citrus/kubernetes/message/KubernetesMessage.java#L148-L167
train
citrusframework/citrus
modules/citrus-core/src/main/java/com/consol/citrus/functions/FunctionRegistry.java
FunctionRegistry.isFunction
public boolean isFunction(final String variableExpression) { if (variableExpression == null || variableExpression.length() == 0) { return false; } for (int i = 0; i < functionLibraries.size(); i++) { FunctionLibrary lib = (FunctionLibrary)functionLibraries.get(i); if (variableExpression.startsWith(lib.getPrefix())) { return true; } } return false; }
java
public boolean isFunction(final String variableExpression) { if (variableExpression == null || variableExpression.length() == 0) { return false; } for (int i = 0; i < functionLibraries.size(); i++) { FunctionLibrary lib = (FunctionLibrary)functionLibraries.get(i); if (variableExpression.startsWith(lib.getPrefix())) { return true; } } return false; }
[ "public", "boolean", "isFunction", "(", "final", "String", "variableExpression", ")", "{", "if", "(", "variableExpression", "==", "null", "||", "variableExpression", ".", "length", "(", ")", "==", "0", ")", "{", "return", "false", ";", "}", "for", "(", "in...
Check if variable expression is a custom function. Expression has to start with one of the registered function library prefix. @param variableExpression to be checked @return flag (true/false)
[ "Check", "if", "variable", "expression", "is", "a", "custom", "function", ".", "Expression", "has", "to", "start", "with", "one", "of", "the", "registered", "function", "library", "prefix", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/functions/FunctionRegistry.java#L42-L55
train
citrusframework/citrus
modules/citrus-core/src/main/java/com/consol/citrus/functions/FunctionRegistry.java
FunctionRegistry.getLibraryForPrefix
public FunctionLibrary getLibraryForPrefix(String functionPrefix) { for (int i = 0; i < functionLibraries.size(); i++) { if (((FunctionLibrary)functionLibraries.get(i)).getPrefix().equals(functionPrefix)) { return (FunctionLibrary)functionLibraries.get(i); } } throw new NoSuchFunctionLibraryException("Can not find function library for prefix " + functionPrefix); }
java
public FunctionLibrary getLibraryForPrefix(String functionPrefix) { for (int i = 0; i < functionLibraries.size(); i++) { if (((FunctionLibrary)functionLibraries.get(i)).getPrefix().equals(functionPrefix)) { return (FunctionLibrary)functionLibraries.get(i); } } throw new NoSuchFunctionLibraryException("Can not find function library for prefix " + functionPrefix); }
[ "public", "FunctionLibrary", "getLibraryForPrefix", "(", "String", "functionPrefix", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "functionLibraries", ".", "size", "(", ")", ";", "i", "++", ")", "{", "if", "(", "(", "(", "FunctionLibrary", ...
Get library for function prefix. @param functionPrefix to be searched for @return FunctionLibrary instance
[ "Get", "library", "for", "function", "prefix", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/functions/FunctionRegistry.java#L62-L70
train
citrusframework/citrus
modules/citrus-ws/src/main/java/com/consol/citrus/ws/servlet/CitrusMessageDispatcherServlet.java
CitrusMessageDispatcherServlet.configureMessageEndpoint
protected void configureMessageEndpoint(ApplicationContext context) { if (context.containsBean(MESSAGE_ENDPOINT_BEAN_NAME)) { WebServiceEndpoint messageEndpoint = context.getBean(MESSAGE_ENDPOINT_BEAN_NAME, WebServiceEndpoint.class); EndpointAdapter endpointAdapter = webServiceServer.getEndpointAdapter(); if (endpointAdapter != null) { messageEndpoint.setEndpointAdapter(endpointAdapter); } WebServiceEndpointConfiguration endpointConfiguration = new WebServiceEndpointConfiguration(); endpointConfiguration.setHandleMimeHeaders(webServiceServer.isHandleMimeHeaders()); endpointConfiguration.setHandleAttributeHeaders(webServiceServer.isHandleAttributeHeaders()); endpointConfiguration.setKeepSoapEnvelope(webServiceServer.isKeepSoapEnvelope()); endpointConfiguration.setMessageConverter(webServiceServer.getMessageConverter()); messageEndpoint.setEndpointConfiguration(endpointConfiguration); if (StringUtils.hasText(webServiceServer.getSoapHeaderNamespace())) { messageEndpoint.setDefaultNamespaceUri(webServiceServer.getSoapHeaderNamespace()); } if (StringUtils.hasText(webServiceServer.getSoapHeaderPrefix())) { messageEndpoint.setDefaultPrefix(webServiceServer.getSoapHeaderPrefix()); } } }
java
protected void configureMessageEndpoint(ApplicationContext context) { if (context.containsBean(MESSAGE_ENDPOINT_BEAN_NAME)) { WebServiceEndpoint messageEndpoint = context.getBean(MESSAGE_ENDPOINT_BEAN_NAME, WebServiceEndpoint.class); EndpointAdapter endpointAdapter = webServiceServer.getEndpointAdapter(); if (endpointAdapter != null) { messageEndpoint.setEndpointAdapter(endpointAdapter); } WebServiceEndpointConfiguration endpointConfiguration = new WebServiceEndpointConfiguration(); endpointConfiguration.setHandleMimeHeaders(webServiceServer.isHandleMimeHeaders()); endpointConfiguration.setHandleAttributeHeaders(webServiceServer.isHandleAttributeHeaders()); endpointConfiguration.setKeepSoapEnvelope(webServiceServer.isKeepSoapEnvelope()); endpointConfiguration.setMessageConverter(webServiceServer.getMessageConverter()); messageEndpoint.setEndpointConfiguration(endpointConfiguration); if (StringUtils.hasText(webServiceServer.getSoapHeaderNamespace())) { messageEndpoint.setDefaultNamespaceUri(webServiceServer.getSoapHeaderNamespace()); } if (StringUtils.hasText(webServiceServer.getSoapHeaderPrefix())) { messageEndpoint.setDefaultPrefix(webServiceServer.getSoapHeaderPrefix()); } } }
[ "protected", "void", "configureMessageEndpoint", "(", "ApplicationContext", "context", ")", "{", "if", "(", "context", ".", "containsBean", "(", "MESSAGE_ENDPOINT_BEAN_NAME", ")", ")", "{", "WebServiceEndpoint", "messageEndpoint", "=", "context", ".", "getBean", "(", ...
Post process endpoint. @param context
[ "Post", "process", "endpoint", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-ws/src/main/java/com/consol/citrus/ws/servlet/CitrusMessageDispatcherServlet.java#L82-L106
train
citrusframework/citrus
modules/citrus-ws/src/main/java/com/consol/citrus/ws/servlet/CitrusMessageDispatcherServlet.java
CitrusMessageDispatcherServlet.adaptInterceptors
private List<EndpointInterceptor> adaptInterceptors(List<Object> interceptors) { List<EndpointInterceptor> endpointInterceptors = new ArrayList<EndpointInterceptor>(); if (interceptors != null) { for (Object interceptor : interceptors) { if (interceptor instanceof EndpointInterceptor) { endpointInterceptors.add((EndpointInterceptor) interceptor); } } } return endpointInterceptors; }
java
private List<EndpointInterceptor> adaptInterceptors(List<Object> interceptors) { List<EndpointInterceptor> endpointInterceptors = new ArrayList<EndpointInterceptor>(); if (interceptors != null) { for (Object interceptor : interceptors) { if (interceptor instanceof EndpointInterceptor) { endpointInterceptors.add((EndpointInterceptor) interceptor); } } } return endpointInterceptors; }
[ "private", "List", "<", "EndpointInterceptor", ">", "adaptInterceptors", "(", "List", "<", "Object", ">", "interceptors", ")", "{", "List", "<", "EndpointInterceptor", ">", "endpointInterceptors", "=", "new", "ArrayList", "<", "EndpointInterceptor", ">", "(", ")",...
Adapts object list to endpoint interceptors. @param interceptors @return
[ "Adapts", "object", "list", "to", "endpoint", "interceptors", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-ws/src/main/java/com/consol/citrus/ws/servlet/CitrusMessageDispatcherServlet.java#L113-L125
train
citrusframework/citrus
modules/citrus-core/src/main/java/com/consol/citrus/message/ZipMessage.java
ZipMessage.addEntry
public ZipMessage addEntry(Resource resource) { try { addEntry(new Entry(resource.getFile())); } catch (IOException e) { throw new CitrusRuntimeException("Failed to read zip entry content from given resource", e); } return this; }
java
public ZipMessage addEntry(Resource resource) { try { addEntry(new Entry(resource.getFile())); } catch (IOException e) { throw new CitrusRuntimeException("Failed to read zip entry content from given resource", e); } return this; }
[ "public", "ZipMessage", "addEntry", "(", "Resource", "resource", ")", "{", "try", "{", "addEntry", "(", "new", "Entry", "(", "resource", ".", "getFile", "(", ")", ")", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "CitrusRu...
Adds new zip archive entry. Resource can be a file or directory. In case of directory all files will be automatically added to the zip archive. Directory structures are retained throughout this process. @param resource @return
[ "Adds", "new", "zip", "archive", "entry", ".", "Resource", "can", "be", "a", "file", "or", "directory", ".", "In", "case", "of", "directory", "all", "files", "will", "be", "automatically", "added", "to", "the", "zip", "archive", ".", "Directory", "structur...
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/message/ZipMessage.java#L68-L75
train
citrusframework/citrus
modules/citrus-core/src/main/java/com/consol/citrus/message/ZipMessage.java
ZipMessage.addEntry
public ZipMessage addEntry(File file) { try { addEntry(new Entry(file)); } catch (IOException e) { throw new CitrusRuntimeException("Failed to read zip entry content from given file", e); } return this; }
java
public ZipMessage addEntry(File file) { try { addEntry(new Entry(file)); } catch (IOException e) { throw new CitrusRuntimeException("Failed to read zip entry content from given file", e); } return this; }
[ "public", "ZipMessage", "addEntry", "(", "File", "file", ")", "{", "try", "{", "addEntry", "(", "new", "Entry", "(", "file", ")", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "CitrusRuntimeException", "(", "\"Failed to read zi...
Adds new zip archive entry. Entry can be a file or directory. In case of directory all files will be automatically added to the zip archive. Directory structures are retained throughout this process. @param file @return
[ "Adds", "new", "zip", "archive", "entry", ".", "Entry", "can", "be", "a", "file", "or", "directory", ".", "In", "case", "of", "directory", "all", "files", "will", "be", "automatically", "added", "to", "the", "zip", "archive", ".", "Directory", "structures"...
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/message/ZipMessage.java#L83-L90
train
citrusframework/citrus
modules/citrus-core/src/main/java/com/consol/citrus/message/ZipMessage.java
ZipMessage.addEntry
public ZipMessage addEntry(String fileName, byte[] content) { Entry entry = new Entry(fileName); entry.setContent(content); addEntry(entry); return this; }
java
public ZipMessage addEntry(String fileName, byte[] content) { Entry entry = new Entry(fileName); entry.setContent(content); addEntry(entry); return this; }
[ "public", "ZipMessage", "addEntry", "(", "String", "fileName", ",", "byte", "[", "]", "content", ")", "{", "Entry", "entry", "=", "new", "Entry", "(", "fileName", ")", ";", "entry", ".", "setContent", "(", "content", ")", ";", "addEntry", "(", "entry", ...
Adds new zip archive entry with given content. @param fileName @param content @return
[ "Adds", "new", "zip", "archive", "entry", "with", "given", "content", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/message/ZipMessage.java#L99-L104
train
citrusframework/citrus
modules/citrus-ws/src/main/java/com/consol/citrus/ws/message/converter/SoapMessageConverter.java
SoapMessageConverter.handleInboundSoapMessage
protected void handleInboundSoapMessage(final org.springframework.ws.soap.SoapMessage soapMessage, final SoapMessage message, final WebServiceEndpointConfiguration endpointConfiguration) { handleInboundNamespaces(soapMessage, message); handleInboundSoapHeaders(soapMessage, message); handleInboundAttachments(soapMessage, message); if (endpointConfiguration.isHandleMimeHeaders()) { handleInboundMimeHeaders(soapMessage, message); } }
java
protected void handleInboundSoapMessage(final org.springframework.ws.soap.SoapMessage soapMessage, final SoapMessage message, final WebServiceEndpointConfiguration endpointConfiguration) { handleInboundNamespaces(soapMessage, message); handleInboundSoapHeaders(soapMessage, message); handleInboundAttachments(soapMessage, message); if (endpointConfiguration.isHandleMimeHeaders()) { handleInboundMimeHeaders(soapMessage, message); } }
[ "protected", "void", "handleInboundSoapMessage", "(", "final", "org", ".", "springframework", ".", "ws", ".", "soap", ".", "SoapMessage", "soapMessage", ",", "final", "SoapMessage", "message", ",", "final", "WebServiceEndpointConfiguration", "endpointConfiguration", ")"...
Method handles SOAP specific message information such as SOAP action headers and SOAP attachments. @param soapMessage @param message @param endpointConfiguration
[ "Method", "handles", "SOAP", "specific", "message", "information", "such", "as", "SOAP", "action", "headers", "and", "SOAP", "attachments", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-ws/src/main/java/com/consol/citrus/ws/message/converter/SoapMessageConverter.java#L168-L178
train
citrusframework/citrus
modules/citrus-ws/src/main/java/com/consol/citrus/ws/message/converter/SoapMessageConverter.java
SoapMessageConverter.handleInboundHttpHeaders
protected void handleInboundHttpHeaders(final SoapMessage message, final WebServiceEndpointConfiguration endpointConfiguration) { final TransportContext transportContext = TransportContextHolder.getTransportContext(); if (transportContext == null) { log.warn("Unable to get complete set of http request headers - no transport context available"); return; } final WebServiceConnection connection = transportContext.getConnection(); if (connection instanceof HttpServletConnection) { final UrlPathHelper pathHelper = new UrlPathHelper(); final HttpServletConnection servletConnection = (HttpServletConnection) connection; final HttpServletRequest httpServletRequest = servletConnection.getHttpServletRequest(); message.setHeader(SoapMessageHeaders.HTTP_REQUEST_URI, pathHelper.getRequestUri(httpServletRequest)); message.setHeader(SoapMessageHeaders.HTTP_CONTEXT_PATH, pathHelper.getContextPath(httpServletRequest)); final String queryParams = pathHelper.getOriginatingQueryString(httpServletRequest); message.setHeader(SoapMessageHeaders.HTTP_QUERY_PARAMS, queryParams != null ? queryParams : ""); message.setHeader(SoapMessageHeaders.HTTP_REQUEST_METHOD, httpServletRequest.getMethod()); if (endpointConfiguration.isHandleAttributeHeaders()) { final Enumeration<String> attributeNames = httpServletRequest.getAttributeNames(); while (attributeNames.hasMoreElements()) { final String attributeName = attributeNames.nextElement(); final Object attribute = httpServletRequest.getAttribute(attributeName); message.setHeader(attributeName, attribute); } } } else { log.warn("Unable to get complete set of http request headers"); try { message.setHeader(SoapMessageHeaders.HTTP_REQUEST_URI, connection.getUri()); } catch (final URISyntaxException e) { log.warn("Unable to get http request uri from http connection", e); } } }
java
protected void handleInboundHttpHeaders(final SoapMessage message, final WebServiceEndpointConfiguration endpointConfiguration) { final TransportContext transportContext = TransportContextHolder.getTransportContext(); if (transportContext == null) { log.warn("Unable to get complete set of http request headers - no transport context available"); return; } final WebServiceConnection connection = transportContext.getConnection(); if (connection instanceof HttpServletConnection) { final UrlPathHelper pathHelper = new UrlPathHelper(); final HttpServletConnection servletConnection = (HttpServletConnection) connection; final HttpServletRequest httpServletRequest = servletConnection.getHttpServletRequest(); message.setHeader(SoapMessageHeaders.HTTP_REQUEST_URI, pathHelper.getRequestUri(httpServletRequest)); message.setHeader(SoapMessageHeaders.HTTP_CONTEXT_PATH, pathHelper.getContextPath(httpServletRequest)); final String queryParams = pathHelper.getOriginatingQueryString(httpServletRequest); message.setHeader(SoapMessageHeaders.HTTP_QUERY_PARAMS, queryParams != null ? queryParams : ""); message.setHeader(SoapMessageHeaders.HTTP_REQUEST_METHOD, httpServletRequest.getMethod()); if (endpointConfiguration.isHandleAttributeHeaders()) { final Enumeration<String> attributeNames = httpServletRequest.getAttributeNames(); while (attributeNames.hasMoreElements()) { final String attributeName = attributeNames.nextElement(); final Object attribute = httpServletRequest.getAttribute(attributeName); message.setHeader(attributeName, attribute); } } } else { log.warn("Unable to get complete set of http request headers"); try { message.setHeader(SoapMessageHeaders.HTTP_REQUEST_URI, connection.getUri()); } catch (final URISyntaxException e) { log.warn("Unable to get http request uri from http connection", e); } } }
[ "protected", "void", "handleInboundHttpHeaders", "(", "final", "SoapMessage", "message", ",", "final", "WebServiceEndpointConfiguration", "endpointConfiguration", ")", "{", "final", "TransportContext", "transportContext", "=", "TransportContextHolder", ".", "getTransportContext...
Reads information from Http connection and adds them as Http marked headers to internal message representation. @param message
[ "Reads", "information", "from", "Http", "connection", "and", "adds", "them", "as", "Http", "marked", "headers", "to", "internal", "message", "representation", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-ws/src/main/java/com/consol/citrus/ws/message/converter/SoapMessageConverter.java#L220-L258
train
citrusframework/citrus
modules/citrus-ws/src/main/java/com/consol/citrus/ws/message/converter/SoapMessageConverter.java
SoapMessageConverter.handleInboundSoapHeaders
protected void handleInboundSoapHeaders(final org.springframework.ws.soap.SoapMessage soapMessage, final SoapMessage message) { try { final SoapHeader soapHeader = soapMessage.getSoapHeader(); if (soapHeader != null) { final Iterator<?> iter = soapHeader.examineAllHeaderElements(); while (iter.hasNext()) { final SoapHeaderElement headerEntry = (SoapHeaderElement) iter.next(); MessageHeaderUtils.setHeader(message, headerEntry.getName().getLocalPart(), headerEntry.getText()); } if (soapHeader.getSource() != null) { final StringResult headerData = new StringResult(); final TransformerFactory transformerFactory = TransformerFactory.newInstance(); final Transformer transformer = transformerFactory.newTransformer(); transformer.transform(soapHeader.getSource(), headerData); message.addHeaderData(headerData.toString()); } } if (StringUtils.hasText(soapMessage.getSoapAction())) { if (soapMessage.getSoapAction().equals("\"\"")) { message.setHeader(SoapMessageHeaders.SOAP_ACTION, ""); } else { if (soapMessage.getSoapAction().startsWith("\"") && soapMessage.getSoapAction().endsWith("\"")) { message.setHeader(SoapMessageHeaders.SOAP_ACTION, soapMessage.getSoapAction().substring(1, soapMessage.getSoapAction().length() - 1)); } else { message.setHeader(SoapMessageHeaders.SOAP_ACTION, soapMessage.getSoapAction()); } } } } catch (final TransformerException e) { throw new CitrusRuntimeException("Failed to read SOAP header source", e); } }
java
protected void handleInboundSoapHeaders(final org.springframework.ws.soap.SoapMessage soapMessage, final SoapMessage message) { try { final SoapHeader soapHeader = soapMessage.getSoapHeader(); if (soapHeader != null) { final Iterator<?> iter = soapHeader.examineAllHeaderElements(); while (iter.hasNext()) { final SoapHeaderElement headerEntry = (SoapHeaderElement) iter.next(); MessageHeaderUtils.setHeader(message, headerEntry.getName().getLocalPart(), headerEntry.getText()); } if (soapHeader.getSource() != null) { final StringResult headerData = new StringResult(); final TransformerFactory transformerFactory = TransformerFactory.newInstance(); final Transformer transformer = transformerFactory.newTransformer(); transformer.transform(soapHeader.getSource(), headerData); message.addHeaderData(headerData.toString()); } } if (StringUtils.hasText(soapMessage.getSoapAction())) { if (soapMessage.getSoapAction().equals("\"\"")) { message.setHeader(SoapMessageHeaders.SOAP_ACTION, ""); } else { if (soapMessage.getSoapAction().startsWith("\"") && soapMessage.getSoapAction().endsWith("\"")) { message.setHeader(SoapMessageHeaders.SOAP_ACTION, soapMessage.getSoapAction().substring(1, soapMessage.getSoapAction().length() - 1)); } else { message.setHeader(SoapMessageHeaders.SOAP_ACTION, soapMessage.getSoapAction()); } } } } catch (final TransformerException e) { throw new CitrusRuntimeException("Failed to read SOAP header source", e); } }
[ "protected", "void", "handleInboundSoapHeaders", "(", "final", "org", ".", "springframework", ".", "ws", ".", "soap", ".", "SoapMessage", "soapMessage", ",", "final", "SoapMessage", "message", ")", "{", "try", "{", "final", "SoapHeader", "soapHeader", "=", "soap...
Reads all soap headers from web service message and adds them to message builder as normal headers. Also takes care of soap action header. @param soapMessage the web service message. @param message the response message builder.
[ "Reads", "all", "soap", "headers", "from", "web", "service", "message", "and", "adds", "them", "to", "message", "builder", "as", "normal", "headers", ".", "Also", "takes", "care", "of", "soap", "action", "header", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-ws/src/main/java/com/consol/citrus/ws/message/converter/SoapMessageConverter.java#L267-L304
train
citrusframework/citrus
modules/citrus-ws/src/main/java/com/consol/citrus/ws/message/converter/SoapMessageConverter.java
SoapMessageConverter.handleOutboundMimeMessageHeader
private void handleOutboundMimeMessageHeader(final org.springframework.ws.soap.SoapMessage message, final String name, final Object value, final boolean handleMimeHeaders) { if (!handleMimeHeaders) { return; } if (message instanceof SaajSoapMessage) { final SaajSoapMessage soapMsg = (SaajSoapMessage) message; final MimeHeaders headers = soapMsg.getSaajMessage().getMimeHeaders(); headers.setHeader(name, value.toString()); } else if (message instanceof AxiomSoapMessage) { log.warn("Unable to set mime message header '" + name + "' on AxiomSoapMessage - unsupported"); } else { log.warn("Unsupported SOAP message implementation - unable to set mime message header '" + name + "'"); } }
java
private void handleOutboundMimeMessageHeader(final org.springframework.ws.soap.SoapMessage message, final String name, final Object value, final boolean handleMimeHeaders) { if (!handleMimeHeaders) { return; } if (message instanceof SaajSoapMessage) { final SaajSoapMessage soapMsg = (SaajSoapMessage) message; final MimeHeaders headers = soapMsg.getSaajMessage().getMimeHeaders(); headers.setHeader(name, value.toString()); } else if (message instanceof AxiomSoapMessage) { log.warn("Unable to set mime message header '" + name + "' on AxiomSoapMessage - unsupported"); } else { log.warn("Unsupported SOAP message implementation - unable to set mime message header '" + name + "'"); } }
[ "private", "void", "handleOutboundMimeMessageHeader", "(", "final", "org", ".", "springframework", ".", "ws", ".", "soap", ".", "SoapMessage", "message", ",", "final", "String", "name", ",", "final", "Object", "value", ",", "final", "boolean", "handleMimeHeaders",...
Adds a HTTP message header to the SOAP message. @param message the SOAP request message. @param name the header name. @param value the header value. @param handleMimeHeaders should handle mime headers.
[ "Adds", "a", "HTTP", "message", "header", "to", "the", "SOAP", "message", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-ws/src/main/java/com/consol/citrus/ws/message/converter/SoapMessageConverter.java#L314-L331
train
citrusframework/citrus
modules/citrus-ws/src/main/java/com/consol/citrus/ws/message/converter/SoapMessageConverter.java
SoapMessageConverter.handleInboundMessageProperties
protected void handleInboundMessageProperties(final MessageContext messageContext, final SoapMessage message) { if (messageContext == null) { return; } final String[] propertyNames = messageContext.getPropertyNames(); if (propertyNames != null) { for (final String propertyName : propertyNames) { message.setHeader(propertyName, messageContext.getProperty(propertyName)); } } }
java
protected void handleInboundMessageProperties(final MessageContext messageContext, final SoapMessage message) { if (messageContext == null) { return; } final String[] propertyNames = messageContext.getPropertyNames(); if (propertyNames != null) { for (final String propertyName : propertyNames) { message.setHeader(propertyName, messageContext.getProperty(propertyName)); } } }
[ "protected", "void", "handleInboundMessageProperties", "(", "final", "MessageContext", "messageContext", ",", "final", "SoapMessage", "message", ")", "{", "if", "(", "messageContext", "==", "null", ")", "{", "return", ";", "}", "final", "String", "[", "]", "prop...
Adds all message properties from web service message to message builder as normal header entries. @param messageContext the web service request message context. @param message the request message builder.
[ "Adds", "all", "message", "properties", "from", "web", "service", "message", "to", "message", "builder", "as", "normal", "header", "entries", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-ws/src/main/java/com/consol/citrus/ws/message/converter/SoapMessageConverter.java#L384-L394
train
citrusframework/citrus
modules/citrus-ws/src/main/java/com/consol/citrus/ws/message/converter/SoapMessageConverter.java
SoapMessageConverter.handleInboundAttachments
protected void handleInboundAttachments(final org.springframework.ws.soap.SoapMessage soapMessage, final SoapMessage message) { final Iterator<Attachment> attachments = soapMessage.getAttachments(); while (attachments.hasNext()) { final Attachment attachment = attachments.next(); final SoapAttachment soapAttachment = SoapAttachment.from(attachment); if (log.isDebugEnabled()) { log.debug(String.format("SOAP message contains attachment with contentId '%s'", soapAttachment.getContentId())); } message.addAttachment(soapAttachment); } }
java
protected void handleInboundAttachments(final org.springframework.ws.soap.SoapMessage soapMessage, final SoapMessage message) { final Iterator<Attachment> attachments = soapMessage.getAttachments(); while (attachments.hasNext()) { final Attachment attachment = attachments.next(); final SoapAttachment soapAttachment = SoapAttachment.from(attachment); if (log.isDebugEnabled()) { log.debug(String.format("SOAP message contains attachment with contentId '%s'", soapAttachment.getContentId())); } message.addAttachment(soapAttachment); } }
[ "protected", "void", "handleInboundAttachments", "(", "final", "org", ".", "springframework", ".", "ws", ".", "soap", ".", "SoapMessage", "soapMessage", ",", "final", "SoapMessage", "message", ")", "{", "final", "Iterator", "<", "Attachment", ">", "attachments", ...
Adds attachments if present in soap web service message. @param soapMessage the web service message. @param message the response message builder.
[ "Adds", "attachments", "if", "present", "in", "soap", "web", "service", "message", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-ws/src/main/java/com/consol/citrus/ws/message/converter/SoapMessageConverter.java#L402-L416
train
citrusframework/citrus
modules/citrus-core/src/main/java/com/consol/citrus/validation/DefaultMessageHeaderValidator.java
DefaultMessageHeaderValidator.getHeaderName
private String getHeaderName(String name, Map<String, Object> receivedHeaders, TestContext context, HeaderValidationContext validationContext) { String headerName = context.resolveDynamicValue(name); if (!receivedHeaders.containsKey(headerName) && validationContext.isHeaderNameIgnoreCase()) { String key = headerName; log.debug(String.format("Finding case insensitive header for key '%s'", key)); headerName = receivedHeaders .entrySet() .parallelStream() .filter(item -> item.getKey().equalsIgnoreCase(key)) .map(Map.Entry::getKey) .findFirst() .orElseThrow(() -> new ValidationException("Validation failed: No matching header for key '" + key + "'")); log.info(String.format("Found matching case insensitive header name: %s", headerName)); } return headerName; }
java
private String getHeaderName(String name, Map<String, Object> receivedHeaders, TestContext context, HeaderValidationContext validationContext) { String headerName = context.resolveDynamicValue(name); if (!receivedHeaders.containsKey(headerName) && validationContext.isHeaderNameIgnoreCase()) { String key = headerName; log.debug(String.format("Finding case insensitive header for key '%s'", key)); headerName = receivedHeaders .entrySet() .parallelStream() .filter(item -> item.getKey().equalsIgnoreCase(key)) .map(Map.Entry::getKey) .findFirst() .orElseThrow(() -> new ValidationException("Validation failed: No matching header for key '" + key + "'")); log.info(String.format("Found matching case insensitive header name: %s", headerName)); } return headerName; }
[ "private", "String", "getHeaderName", "(", "String", "name", ",", "Map", "<", "String", ",", "Object", ">", "receivedHeaders", ",", "TestContext", "context", ",", "HeaderValidationContext", "validationContext", ")", "{", "String", "headerName", "=", "context", "."...
Get header name from control message but also check if header expression is a variable or function. In addition to that find case insensitive header name in received message when feature is activated. @param name @param receivedHeaders @param context @param validationContext @return
[ "Get", "header", "name", "from", "control", "message", "but", "also", "check", "if", "header", "expression", "is", "a", "variable", "or", "function", ".", "In", "addition", "to", "that", "find", "case", "insensitive", "header", "name", "in", "received", "mes...
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/validation/DefaultMessageHeaderValidator.java#L106-L127
train
citrusframework/citrus
modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/builder/WaitHttpConditionBuilder.java
WaitHttpConditionBuilder.status
public WaitHttpConditionBuilder status(HttpStatus status) { getCondition().setHttpResponseCode(String.valueOf(status.value())); return this; }
java
public WaitHttpConditionBuilder status(HttpStatus status) { getCondition().setHttpResponseCode(String.valueOf(status.value())); return this; }
[ "public", "WaitHttpConditionBuilder", "status", "(", "HttpStatus", "status", ")", "{", "getCondition", "(", ")", ".", "setHttpResponseCode", "(", "String", ".", "valueOf", "(", "status", ".", "value", "(", ")", ")", ")", ";", "return", "this", ";", "}" ]
Sets the Http status code to check. @param status @return
[ "Sets", "the", "Http", "status", "code", "to", "check", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/builder/WaitHttpConditionBuilder.java#L69-L72
train
citrusframework/citrus
modules/citrus-core/src/main/java/com/consol/citrus/validation/MessageValidatorRegistry.java
MessageValidatorRegistry.findMessageValidators
public List<MessageValidator<? extends ValidationContext>> findMessageValidators(String messageType, Message message) { List<MessageValidator<? extends ValidationContext>> matchingValidators = new ArrayList<>(); for (MessageValidator<? extends ValidationContext> validator : messageValidators) { if (validator.supportsMessageType(messageType, message)) { matchingValidators.add(validator); } } if (matchingValidators.isEmpty() || matchingValidators.stream().allMatch(validator -> DefaultMessageHeaderValidator.class.isAssignableFrom(validator.getClass()))) { // try to find fallback message validator for given message payload if (message.getPayload() instanceof String && StringUtils.hasText(message.getPayload(String.class))) { String payload = message.getPayload(String.class).trim(); if (payload.startsWith("<") && !messageType.equals(MessageType.XML.name())) { matchingValidators = findFallbackMessageValidators(MessageType.XML.name(), message); } else if ((payload.trim().startsWith("{") || payload.trim().startsWith("[")) && !messageType.equals(MessageType.JSON.name())) { matchingValidators = findFallbackMessageValidators(MessageType.JSON.name(), message); } else if (!messageType.equals(MessageType.PLAINTEXT.name())) { matchingValidators = findFallbackMessageValidators(MessageType.PLAINTEXT.name(), message); } } } if (matchingValidators.isEmpty() || matchingValidators.stream().allMatch(validator -> DefaultMessageHeaderValidator.class.isAssignableFrom(validator.getClass()))) { throw new CitrusRuntimeException("Could not find proper message validator for message type '" + messageType + "', please define a capable message validator for this message type"); } if (log.isDebugEnabled()) { log.debug(String.format("Found %s message validators for message type: %s", matchingValidators.size(), messageType)); } return matchingValidators; }
java
public List<MessageValidator<? extends ValidationContext>> findMessageValidators(String messageType, Message message) { List<MessageValidator<? extends ValidationContext>> matchingValidators = new ArrayList<>(); for (MessageValidator<? extends ValidationContext> validator : messageValidators) { if (validator.supportsMessageType(messageType, message)) { matchingValidators.add(validator); } } if (matchingValidators.isEmpty() || matchingValidators.stream().allMatch(validator -> DefaultMessageHeaderValidator.class.isAssignableFrom(validator.getClass()))) { // try to find fallback message validator for given message payload if (message.getPayload() instanceof String && StringUtils.hasText(message.getPayload(String.class))) { String payload = message.getPayload(String.class).trim(); if (payload.startsWith("<") && !messageType.equals(MessageType.XML.name())) { matchingValidators = findFallbackMessageValidators(MessageType.XML.name(), message); } else if ((payload.trim().startsWith("{") || payload.trim().startsWith("[")) && !messageType.equals(MessageType.JSON.name())) { matchingValidators = findFallbackMessageValidators(MessageType.JSON.name(), message); } else if (!messageType.equals(MessageType.PLAINTEXT.name())) { matchingValidators = findFallbackMessageValidators(MessageType.PLAINTEXT.name(), message); } } } if (matchingValidators.isEmpty() || matchingValidators.stream().allMatch(validator -> DefaultMessageHeaderValidator.class.isAssignableFrom(validator.getClass()))) { throw new CitrusRuntimeException("Could not find proper message validator for message type '" + messageType + "', please define a capable message validator for this message type"); } if (log.isDebugEnabled()) { log.debug(String.format("Found %s message validators for message type: %s", matchingValidators.size(), messageType)); } return matchingValidators; }
[ "public", "List", "<", "MessageValidator", "<", "?", "extends", "ValidationContext", ">", ">", "findMessageValidators", "(", "String", "messageType", ",", "Message", "message", ")", "{", "List", "<", "MessageValidator", "<", "?", "extends", "ValidationContext", ">...
Finds matching message validators for this message type. @param messageType the message type @param message the message object @return the list of matching message validators.
[ "Finds", "matching", "message", "validators", "for", "this", "message", "type", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/validation/MessageValidatorRegistry.java#L57-L92
train
citrusframework/citrus
modules/citrus-core/src/main/java/com/consol/citrus/validation/MessageValidatorRegistry.java
MessageValidatorRegistry.getDefaultMessageHeaderValidator
public MessageValidator getDefaultMessageHeaderValidator() { return messageValidators .stream() .filter(validator -> DefaultMessageHeaderValidator.class.isAssignableFrom(validator.getClass())) .findFirst() .orElse(null); }
java
public MessageValidator getDefaultMessageHeaderValidator() { return messageValidators .stream() .filter(validator -> DefaultMessageHeaderValidator.class.isAssignableFrom(validator.getClass())) .findFirst() .orElse(null); }
[ "public", "MessageValidator", "getDefaultMessageHeaderValidator", "(", ")", "{", "return", "messageValidators", ".", "stream", "(", ")", ".", "filter", "(", "validator", "->", "DefaultMessageHeaderValidator", ".", "class", ".", "isAssignableFrom", "(", "validator", "....
Gets the default message header validator. @return
[ "Gets", "the", "default", "message", "header", "validator", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/validation/MessageValidatorRegistry.java#L137-L143
train
citrusframework/citrus
modules/citrus-jms/src/main/java/com/consol/citrus/jms/endpoint/JmsEndpointConfiguration.java
JmsEndpointConfiguration.createJmsTemplate
private void createJmsTemplate() { Assert.isTrue(this.connectionFactory != null, "Neither 'jmsTemplate' nor 'connectionFactory' is set correctly."); jmsTemplate = new JmsTemplate(); jmsTemplate.setConnectionFactory(this.connectionFactory); if (this.destination != null) { jmsTemplate.setDefaultDestination(this.destination); } else if (this.destinationName != null) { jmsTemplate.setDefaultDestinationName(this.destinationName); } if (this.destinationResolver != null) { jmsTemplate.setDestinationResolver(this.destinationResolver); } jmsTemplate.setPubSubDomain(pubSubDomain); }
java
private void createJmsTemplate() { Assert.isTrue(this.connectionFactory != null, "Neither 'jmsTemplate' nor 'connectionFactory' is set correctly."); jmsTemplate = new JmsTemplate(); jmsTemplate.setConnectionFactory(this.connectionFactory); if (this.destination != null) { jmsTemplate.setDefaultDestination(this.destination); } else if (this.destinationName != null) { jmsTemplate.setDefaultDestinationName(this.destinationName); } if (this.destinationResolver != null) { jmsTemplate.setDestinationResolver(this.destinationResolver); } jmsTemplate.setPubSubDomain(pubSubDomain); }
[ "private", "void", "createJmsTemplate", "(", ")", "{", "Assert", ".", "isTrue", "(", "this", ".", "connectionFactory", "!=", "null", ",", "\"Neither 'jmsTemplate' nor 'connectionFactory' is set correctly.\"", ")", ";", "jmsTemplate", "=", "new", "JmsTemplate", "(", ")...
Creates default JmsTemplate instance from connection factory and destination.
[ "Creates", "default", "JmsTemplate", "instance", "from", "connection", "factory", "and", "destination", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-jms/src/main/java/com/consol/citrus/jms/endpoint/JmsEndpointConfiguration.java#L102-L121
train
citrusframework/citrus
modules/citrus-selenium/src/main/java/com/consol/citrus/selenium/endpoint/SeleniumBrowserConfiguration.java
SeleniumBrowserConfiguration.getFirefoxProfile
public FirefoxProfile getFirefoxProfile() { if (firefoxProfile == null) { firefoxProfile = new FirefoxProfile(); firefoxProfile.setAcceptUntrustedCertificates(true); firefoxProfile.setAssumeUntrustedCertificateIssuer(false); /* default download folder, set to 2 to use custom download folder */ firefoxProfile.setPreference("browser.download.folderList", 2); /* comma separated list if MIME types to save without asking */ firefoxProfile.setPreference("browser.helperApps.neverAsk.saveToDisk", "text/plain"); /* do not show download manager */ firefoxProfile.setPreference("browser.download.manager.showWhenStarting", false); } return firefoxProfile; }
java
public FirefoxProfile getFirefoxProfile() { if (firefoxProfile == null) { firefoxProfile = new FirefoxProfile(); firefoxProfile.setAcceptUntrustedCertificates(true); firefoxProfile.setAssumeUntrustedCertificateIssuer(false); /* default download folder, set to 2 to use custom download folder */ firefoxProfile.setPreference("browser.download.folderList", 2); /* comma separated list if MIME types to save without asking */ firefoxProfile.setPreference("browser.helperApps.neverAsk.saveToDisk", "text/plain"); /* do not show download manager */ firefoxProfile.setPreference("browser.download.manager.showWhenStarting", false); } return firefoxProfile; }
[ "public", "FirefoxProfile", "getFirefoxProfile", "(", ")", "{", "if", "(", "firefoxProfile", "==", "null", ")", "{", "firefoxProfile", "=", "new", "FirefoxProfile", "(", ")", ";", "firefoxProfile", ".", "setAcceptUntrustedCertificates", "(", "true", ")", ";", "f...
Gets the firefoxProfile. @return
[ "Gets", "the", "firefoxProfile", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-selenium/src/main/java/com/consol/citrus/selenium/endpoint/SeleniumBrowserConfiguration.java#L175-L193
train
citrusframework/citrus
modules/citrus-jdbc/src/main/java/com/consol/citrus/jdbc/server/JdbcEndpointAdapterController.java
JdbcEndpointAdapterController.openConnection
@Override public void openConnection(Map<String, String> properties) throws JdbcServerException { if (!endpointConfiguration.isAutoConnect()) { List<OpenConnection.Property> propertyList = convertToPropertyList(properties); handleMessageAndCheckResponse(JdbcMessage.openConnection(propertyList)); } if (connections.get() == endpointConfiguration.getServerConfiguration().getMaxConnections()) { throw new JdbcServerException(String.format("Maximum number of connections (%s) reached", endpointConfiguration.getServerConfiguration().getMaxConnections())); } connections.incrementAndGet(); }
java
@Override public void openConnection(Map<String, String> properties) throws JdbcServerException { if (!endpointConfiguration.isAutoConnect()) { List<OpenConnection.Property> propertyList = convertToPropertyList(properties); handleMessageAndCheckResponse(JdbcMessage.openConnection(propertyList)); } if (connections.get() == endpointConfiguration.getServerConfiguration().getMaxConnections()) { throw new JdbcServerException(String.format("Maximum number of connections (%s) reached", endpointConfiguration.getServerConfiguration().getMaxConnections())); } connections.incrementAndGet(); }
[ "@", "Override", "public", "void", "openConnection", "(", "Map", "<", "String", ",", "String", ">", "properties", ")", "throws", "JdbcServerException", "{", "if", "(", "!", "endpointConfiguration", ".", "isAutoConnect", "(", ")", ")", "{", "List", "<", "Open...
Opens the connection with the given properties @param properties The properties to open the connection with @throws JdbcServerException In case that the maximum connections have been reached
[ "Opens", "the", "connection", "with", "the", "given", "properties" ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-jdbc/src/main/java/com/consol/citrus/jdbc/server/JdbcEndpointAdapterController.java#L134-L147
train
citrusframework/citrus
modules/citrus-jdbc/src/main/java/com/consol/citrus/jdbc/server/JdbcEndpointAdapterController.java
JdbcEndpointAdapterController.closeConnection
@Override public void closeConnection() throws JdbcServerException { if (!endpointConfiguration.isAutoConnect()) { handleMessageAndCheckResponse(JdbcMessage.closeConnection()); } if (connections.decrementAndGet() < 0) { connections.set(0); } }
java
@Override public void closeConnection() throws JdbcServerException { if (!endpointConfiguration.isAutoConnect()) { handleMessageAndCheckResponse(JdbcMessage.closeConnection()); } if (connections.decrementAndGet() < 0) { connections.set(0); } }
[ "@", "Override", "public", "void", "closeConnection", "(", ")", "throws", "JdbcServerException", "{", "if", "(", "!", "endpointConfiguration", ".", "isAutoConnect", "(", ")", ")", "{", "handleMessageAndCheckResponse", "(", "JdbcMessage", ".", "closeConnection", "(",...
Closes the connection @throws JdbcServerException In case that the connection could not be closed
[ "Closes", "the", "connection" ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-jdbc/src/main/java/com/consol/citrus/jdbc/server/JdbcEndpointAdapterController.java#L153-L162
train
citrusframework/citrus
modules/citrus-jdbc/src/main/java/com/consol/citrus/jdbc/server/JdbcEndpointAdapterController.java
JdbcEndpointAdapterController.createPreparedStatement
@Override public void createPreparedStatement(String stmt) throws JdbcServerException { if (!endpointConfiguration.isAutoCreateStatement()) { handleMessageAndCheckResponse(JdbcMessage.createPreparedStatement(stmt)); } }
java
@Override public void createPreparedStatement(String stmt) throws JdbcServerException { if (!endpointConfiguration.isAutoCreateStatement()) { handleMessageAndCheckResponse(JdbcMessage.createPreparedStatement(stmt)); } }
[ "@", "Override", "public", "void", "createPreparedStatement", "(", "String", "stmt", ")", "throws", "JdbcServerException", "{", "if", "(", "!", "endpointConfiguration", ".", "isAutoCreateStatement", "(", ")", ")", "{", "handleMessageAndCheckResponse", "(", "JdbcMessag...
Creates a prepared statement @param stmt The statement to create @throws JdbcServerException In case that the statement was not successful
[ "Creates", "a", "prepared", "statement" ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-jdbc/src/main/java/com/consol/citrus/jdbc/server/JdbcEndpointAdapterController.java#L169-L174
train
citrusframework/citrus
modules/citrus-jdbc/src/main/java/com/consol/citrus/jdbc/server/JdbcEndpointAdapterController.java
JdbcEndpointAdapterController.executeQuery
@Override public DataSet executeQuery(String query) throws JdbcServerException { log.info("Received execute query request: " + query); Message response = handleMessageAndCheckResponse(JdbcMessage.execute(query)); return dataSetCreator.createDataSet(response, getMessageType(response)); }
java
@Override public DataSet executeQuery(String query) throws JdbcServerException { log.info("Received execute query request: " + query); Message response = handleMessageAndCheckResponse(JdbcMessage.execute(query)); return dataSetCreator.createDataSet(response, getMessageType(response)); }
[ "@", "Override", "public", "DataSet", "executeQuery", "(", "String", "query", ")", "throws", "JdbcServerException", "{", "log", ".", "info", "(", "\"Received execute query request: \"", "+", "query", ")", ";", "Message", "response", "=", "handleMessageAndCheckResponse...
Executes a given query and returns the mapped result @param query The query to execute @return The DataSet containing the query result @throws JdbcServerException In case that the query was not successful
[ "Executes", "a", "given", "query", "and", "returns", "the", "mapped", "result" ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-jdbc/src/main/java/com/consol/citrus/jdbc/server/JdbcEndpointAdapterController.java#L193-L198
train
citrusframework/citrus
modules/citrus-jdbc/src/main/java/com/consol/citrus/jdbc/server/JdbcEndpointAdapterController.java
JdbcEndpointAdapterController.executeStatement
@Override public DataSet executeStatement(String stmt) throws JdbcServerException { log.info("Received execute statement request: " + stmt); Message response = handleMessageAndCheckResponse(JdbcMessage.execute(stmt)); return dataSetCreator.createDataSet(response, getMessageType(response)); }
java
@Override public DataSet executeStatement(String stmt) throws JdbcServerException { log.info("Received execute statement request: " + stmt); Message response = handleMessageAndCheckResponse(JdbcMessage.execute(stmt)); return dataSetCreator.createDataSet(response, getMessageType(response)); }
[ "@", "Override", "public", "DataSet", "executeStatement", "(", "String", "stmt", ")", "throws", "JdbcServerException", "{", "log", ".", "info", "(", "\"Received execute statement request: \"", "+", "stmt", ")", ";", "Message", "response", "=", "handleMessageAndCheckRe...
Executes the given statement @param stmt The statement to be executed @throws JdbcServerException In case that the execution was not successful
[ "Executes", "the", "given", "statement" ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-jdbc/src/main/java/com/consol/citrus/jdbc/server/JdbcEndpointAdapterController.java#L205-L210
train
citrusframework/citrus
modules/citrus-jdbc/src/main/java/com/consol/citrus/jdbc/server/JdbcEndpointAdapterController.java
JdbcEndpointAdapterController.executeUpdate
@Override public int executeUpdate(String updateSql) throws JdbcServerException { log.info("Received execute update request: " + updateSql); Message response = handleMessageAndCheckResponse(JdbcMessage.execute(updateSql)); return Optional.ofNullable( response.getHeader(JdbcMessageHeaders.JDBC_ROWS_UPDATED)) .map(Object::toString).map(Integer::valueOf) .orElse(0); }
java
@Override public int executeUpdate(String updateSql) throws JdbcServerException { log.info("Received execute update request: " + updateSql); Message response = handleMessageAndCheckResponse(JdbcMessage.execute(updateSql)); return Optional.ofNullable( response.getHeader(JdbcMessageHeaders.JDBC_ROWS_UPDATED)) .map(Object::toString).map(Integer::valueOf) .orElse(0); }
[ "@", "Override", "public", "int", "executeUpdate", "(", "String", "updateSql", ")", "throws", "JdbcServerException", "{", "log", ".", "info", "(", "\"Received execute update request: \"", "+", "updateSql", ")", ";", "Message", "response", "=", "handleMessageAndCheckRe...
Executes the given update @param updateSql The update statement to be executed @throws JdbcServerException In case that the execution was not successful
[ "Executes", "the", "given", "update" ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-jdbc/src/main/java/com/consol/citrus/jdbc/server/JdbcEndpointAdapterController.java#L217-L225
train
citrusframework/citrus
modules/citrus-jdbc/src/main/java/com/consol/citrus/jdbc/server/JdbcEndpointAdapterController.java
JdbcEndpointAdapterController.setTransactionState
@Override public void setTransactionState(boolean transactionState) { if (log.isDebugEnabled()) { log.debug(String.format("Received transaction state change: '%s':%n%s", endpointConfiguration.getServerConfiguration().getDatabaseName(), String.valueOf(transactionState))); } this.transactionState = transactionState; if(!endpointConfiguration.isAutoTransactionHandling() && transactionState){ handleMessageAndCheckResponse(JdbcMessage.startTransaction()); } }
java
@Override public void setTransactionState(boolean transactionState) { if (log.isDebugEnabled()) { log.debug(String.format("Received transaction state change: '%s':%n%s", endpointConfiguration.getServerConfiguration().getDatabaseName(), String.valueOf(transactionState))); } this.transactionState = transactionState; if(!endpointConfiguration.isAutoTransactionHandling() && transactionState){ handleMessageAndCheckResponse(JdbcMessage.startTransaction()); } }
[ "@", "Override", "public", "void", "setTransactionState", "(", "boolean", "transactionState", ")", "{", "if", "(", "log", ".", "isDebugEnabled", "(", ")", ")", "{", "log", ".", "debug", "(", "String", ".", "format", "(", "\"Received transaction state change: '%s...
Sets the transaction state of the database connection @param transactionState The boolean value whether the server is in transaction state.
[ "Sets", "the", "transaction", "state", "of", "the", "database", "connection" ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-jdbc/src/main/java/com/consol/citrus/jdbc/server/JdbcEndpointAdapterController.java#L242-L254
train
citrusframework/citrus
modules/citrus-jdbc/src/main/java/com/consol/citrus/jdbc/server/JdbcEndpointAdapterController.java
JdbcEndpointAdapterController.commitStatements
@Override public void commitStatements() { if (log.isDebugEnabled()) { log.debug(String.format("Received transaction commit: '%s':%n", endpointConfiguration.getServerConfiguration().getDatabaseName())); } if(!endpointConfiguration.isAutoTransactionHandling()){ handleMessageAndCheckResponse(JdbcMessage.commitTransaction()); } }
java
@Override public void commitStatements() { if (log.isDebugEnabled()) { log.debug(String.format("Received transaction commit: '%s':%n", endpointConfiguration.getServerConfiguration().getDatabaseName())); } if(!endpointConfiguration.isAutoTransactionHandling()){ handleMessageAndCheckResponse(JdbcMessage.commitTransaction()); } }
[ "@", "Override", "public", "void", "commitStatements", "(", ")", "{", "if", "(", "log", ".", "isDebugEnabled", "(", ")", ")", "{", "log", ".", "debug", "(", "String", ".", "format", "(", "\"Received transaction commit: '%s':%n\"", ",", "endpointConfiguration", ...
Commits the transaction statements
[ "Commits", "the", "transaction", "statements" ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-jdbc/src/main/java/com/consol/citrus/jdbc/server/JdbcEndpointAdapterController.java#L268-L278
train
citrusframework/citrus
modules/citrus-jdbc/src/main/java/com/consol/citrus/jdbc/server/JdbcEndpointAdapterController.java
JdbcEndpointAdapterController.rollbackStatements
@Override public void rollbackStatements() { if (log.isDebugEnabled()) { log.debug(String.format("Received transaction rollback: '%s':%n", endpointConfiguration.getServerConfiguration().getDatabaseName())); } if(!endpointConfiguration.isAutoTransactionHandling()){ handleMessageAndCheckResponse(JdbcMessage.rollbackTransaction()); } }
java
@Override public void rollbackStatements() { if (log.isDebugEnabled()) { log.debug(String.format("Received transaction rollback: '%s':%n", endpointConfiguration.getServerConfiguration().getDatabaseName())); } if(!endpointConfiguration.isAutoTransactionHandling()){ handleMessageAndCheckResponse(JdbcMessage.rollbackTransaction()); } }
[ "@", "Override", "public", "void", "rollbackStatements", "(", ")", "{", "if", "(", "log", ".", "isDebugEnabled", "(", ")", ")", "{", "log", ".", "debug", "(", "String", ".", "format", "(", "\"Received transaction rollback: '%s':%n\"", ",", "endpointConfiguration...
Performs a rollback on the current transaction
[ "Performs", "a", "rollback", "on", "the", "current", "transaction" ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-jdbc/src/main/java/com/consol/citrus/jdbc/server/JdbcEndpointAdapterController.java#L283-L293
train
citrusframework/citrus
modules/citrus-jdbc/src/main/java/com/consol/citrus/jdbc/server/JdbcEndpointAdapterController.java
JdbcEndpointAdapterController.createCallableStatement
@Override public void createCallableStatement(String sql) { if (!endpointConfiguration.isAutoCreateStatement()) { handleMessageAndCheckResponse(JdbcMessage.createCallableStatement(sql)); } }
java
@Override public void createCallableStatement(String sql) { if (!endpointConfiguration.isAutoCreateStatement()) { handleMessageAndCheckResponse(JdbcMessage.createCallableStatement(sql)); } }
[ "@", "Override", "public", "void", "createCallableStatement", "(", "String", "sql", ")", "{", "if", "(", "!", "endpointConfiguration", ".", "isAutoCreateStatement", "(", ")", ")", "{", "handleMessageAndCheckResponse", "(", "JdbcMessage", ".", "createCallableStatement"...
Creates a callable statement
[ "Creates", "a", "callable", "statement" ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-jdbc/src/main/java/com/consol/citrus/jdbc/server/JdbcEndpointAdapterController.java#L298-L303
train
citrusframework/citrus
modules/citrus-jdbc/src/main/java/com/consol/citrus/jdbc/server/JdbcEndpointAdapterController.java
JdbcEndpointAdapterController.getMessageType
private MessageType getMessageType(Message response) { String messageTypeString = (String) response.getHeader(MessageHeaders.MESSAGE_TYPE); if (MessageType.knows(messageTypeString)){ return MessageType.valueOf(messageTypeString.toUpperCase()); } return null; }
java
private MessageType getMessageType(Message response) { String messageTypeString = (String) response.getHeader(MessageHeaders.MESSAGE_TYPE); if (MessageType.knows(messageTypeString)){ return MessageType.valueOf(messageTypeString.toUpperCase()); } return null; }
[ "private", "MessageType", "getMessageType", "(", "Message", "response", ")", "{", "String", "messageTypeString", "=", "(", "String", ")", "response", ".", "getHeader", "(", "MessageHeaders", ".", "MESSAGE_TYPE", ")", ";", "if", "(", "MessageType", ".", "knows", ...
Determines the MessageType of the given response @param response The response to get the message type from @return The MessageType of the response
[ "Determines", "the", "MessageType", "of", "the", "given", "response" ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-jdbc/src/main/java/com/consol/citrus/jdbc/server/JdbcEndpointAdapterController.java#L310-L316
train
citrusframework/citrus
modules/citrus-jdbc/src/main/java/com/consol/citrus/jdbc/server/JdbcEndpointAdapterController.java
JdbcEndpointAdapterController.convertToPropertyList
private List<OpenConnection.Property> convertToPropertyList(Map<String, String> properties) { return properties.entrySet() .stream() .map(this::convertToProperty) .sorted(Comparator.comparingInt(OpenConnection.Property::hashCode)) .collect(Collectors.toList()); }
java
private List<OpenConnection.Property> convertToPropertyList(Map<String, String> properties) { return properties.entrySet() .stream() .map(this::convertToProperty) .sorted(Comparator.comparingInt(OpenConnection.Property::hashCode)) .collect(Collectors.toList()); }
[ "private", "List", "<", "OpenConnection", ".", "Property", ">", "convertToPropertyList", "(", "Map", "<", "String", ",", "String", ">", "properties", ")", "{", "return", "properties", ".", "entrySet", "(", ")", ".", "stream", "(", ")", ".", "map", "(", "...
Converts a property map propertyKey -> propertyValue to a list of OpenConnection.Properties @param properties The map to convert @return A list of Properties
[ "Converts", "a", "property", "map", "propertyKey", "-", ">", "propertyValue", "to", "a", "list", "of", "OpenConnection", ".", "Properties" ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-jdbc/src/main/java/com/consol/citrus/jdbc/server/JdbcEndpointAdapterController.java#L323-L329
train
citrusframework/citrus
modules/citrus-jdbc/src/main/java/com/consol/citrus/jdbc/server/JdbcEndpointAdapterController.java
JdbcEndpointAdapterController.convertToProperty
private OpenConnection.Property convertToProperty(Map.Entry<String, String> entry) { OpenConnection.Property property = new OpenConnection.Property(); property.setName(entry.getKey()); property.setValue(entry.getValue()); return property; }
java
private OpenConnection.Property convertToProperty(Map.Entry<String, String> entry) { OpenConnection.Property property = new OpenConnection.Property(); property.setName(entry.getKey()); property.setValue(entry.getValue()); return property; }
[ "private", "OpenConnection", ".", "Property", "convertToProperty", "(", "Map", ".", "Entry", "<", "String", ",", "String", ">", "entry", ")", "{", "OpenConnection", ".", "Property", "property", "=", "new", "OpenConnection", ".", "Property", "(", ")", ";", "p...
Converts a Map entry into a OpenConnection.Property @param entry The entry to convert @return the OpenConnection.Property representation
[ "Converts", "a", "Map", "entry", "into", "a", "OpenConnection", ".", "Property" ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-jdbc/src/main/java/com/consol/citrus/jdbc/server/JdbcEndpointAdapterController.java#L336-L341
train
citrusframework/citrus
modules/citrus-jdbc/src/main/java/com/consol/citrus/jdbc/server/JdbcEndpointAdapterController.java
JdbcEndpointAdapterController.handleMessageAndCheckResponse
private Message handleMessageAndCheckResponse(Message request) throws JdbcServerException { Message response = handleMessage(request); checkSuccess(response); return response; }
java
private Message handleMessageAndCheckResponse(Message request) throws JdbcServerException { Message response = handleMessage(request); checkSuccess(response); return response; }
[ "private", "Message", "handleMessageAndCheckResponse", "(", "Message", "request", ")", "throws", "JdbcServerException", "{", "Message", "response", "=", "handleMessage", "(", "request", ")", ";", "checkSuccess", "(", "response", ")", ";", "return", "response", ";", ...
Handle request message and check response is successful. @param request The request message to handle @return The response Message @throws JdbcServerException Thrown when the response has some exception header.
[ "Handle", "request", "message", "and", "check", "response", "is", "successful", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-jdbc/src/main/java/com/consol/citrus/jdbc/server/JdbcEndpointAdapterController.java#L349-L353
train
citrusframework/citrus
modules/citrus-jdbc/src/main/java/com/consol/citrus/jdbc/server/JdbcEndpointAdapterController.java
JdbcEndpointAdapterController.checkSuccess
private void checkSuccess(Message response) throws JdbcServerException { OperationResult operationResult = null; if (response instanceof JdbcMessage || response.getPayload() instanceof OperationResult) { operationResult = response.getPayload(OperationResult.class); } else if (response.getPayload() != null && StringUtils.hasText(response.getPayload(String.class))) { operationResult = (OperationResult) endpointConfiguration.getMarshaller().unmarshal(new StringSource(response.getPayload(String.class))); } if (!success(response, operationResult)) { throw new JdbcServerException(getExceptionMessage(response, operationResult)); } }
java
private void checkSuccess(Message response) throws JdbcServerException { OperationResult operationResult = null; if (response instanceof JdbcMessage || response.getPayload() instanceof OperationResult) { operationResult = response.getPayload(OperationResult.class); } else if (response.getPayload() != null && StringUtils.hasText(response.getPayload(String.class))) { operationResult = (OperationResult) endpointConfiguration.getMarshaller().unmarshal(new StringSource(response.getPayload(String.class))); } if (!success(response, operationResult)) { throw new JdbcServerException(getExceptionMessage(response, operationResult)); } }
[ "private", "void", "checkSuccess", "(", "Message", "response", ")", "throws", "JdbcServerException", "{", "OperationResult", "operationResult", "=", "null", ";", "if", "(", "response", "instanceof", "JdbcMessage", "||", "response", ".", "getPayload", "(", ")", "in...
Check that response is not having an exception message. @param response The response message to check @throws JdbcServerException In case the message contains a error.
[ "Check", "that", "response", "is", "not", "having", "an", "exception", "message", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-jdbc/src/main/java/com/consol/citrus/jdbc/server/JdbcEndpointAdapterController.java#L360-L371
train
citrusframework/citrus
modules/citrus-core/src/main/java/com/consol/citrus/functions/FunctionLibrary.java
FunctionLibrary.getFunction
public Function getFunction(String functionName) throws NoSuchFunctionException { if (!members.containsKey(functionName)) { throw new NoSuchFunctionException("Can not find function " + functionName + " in library " + name + " (" + prefix + ")"); } return members.get(functionName); }
java
public Function getFunction(String functionName) throws NoSuchFunctionException { if (!members.containsKey(functionName)) { throw new NoSuchFunctionException("Can not find function " + functionName + " in library " + name + " (" + prefix + ")"); } return members.get(functionName); }
[ "public", "Function", "getFunction", "(", "String", "functionName", ")", "throws", "NoSuchFunctionException", "{", "if", "(", "!", "members", ".", "containsKey", "(", "functionName", ")", ")", "{", "throw", "new", "NoSuchFunctionException", "(", "\"Can not find func...
Try to find function in library by name. @param functionName function name. @return the function instance. @throws NoSuchFunctionException
[ "Try", "to", "find", "function", "in", "library", "by", "name", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/functions/FunctionLibrary.java#L50-L56
train
citrusframework/citrus
modules/citrus-core/src/main/java/com/consol/citrus/functions/FunctionLibrary.java
FunctionLibrary.knowsFunction
public boolean knowsFunction(String functionName) { String functionPrefix = functionName.substring(0, functionName.indexOf(':') + 1); if (!functionPrefix.equals(prefix)) { return false; } return members.containsKey(functionName.substring(functionName.indexOf(':') + 1, functionName.indexOf('('))); }
java
public boolean knowsFunction(String functionName) { String functionPrefix = functionName.substring(0, functionName.indexOf(':') + 1); if (!functionPrefix.equals(prefix)) { return false; } return members.containsKey(functionName.substring(functionName.indexOf(':') + 1, functionName.indexOf('('))); }
[ "public", "boolean", "knowsFunction", "(", "String", "functionName", ")", "{", "String", "functionPrefix", "=", "functionName", ".", "substring", "(", "0", ",", "functionName", ".", "indexOf", "(", "'", "'", ")", "+", "1", ")", ";", "if", "(", "!", "func...
Does this function library know a function with the given name. @param functionName name to search for. @return boolean flag to mark existence.
[ "Does", "this", "function", "library", "know", "a", "function", "with", "the", "given", "name", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/functions/FunctionLibrary.java#L64-L72
train
citrusframework/citrus
modules/citrus-jmx/src/main/java/com/consol/citrus/jmx/model/ManagedBeanResult.java
ManagedBeanResult.getResultObject
public java.lang.Object getResultObject(ApplicationContext applicationContext) { if (object == null) { return null; } if (object.getValueObject() != null) { return object.getValueObject(); } try { Class argType = Class.forName(object.getType()); java.lang.Object value = null; if (object.getValue() != null) { value = object.getValue(); } else if (StringUtils.hasText(object.getRef()) && applicationContext != null) { value = applicationContext.getBean(object.getRef()); } if (value == null) { return null; } else if (argType.isInstance(value) || argType.isAssignableFrom(value.getClass())) { return argType.cast(value); } else if (Map.class.equals(argType)) { String mapString = value.toString(); Properties props = new Properties(); try { props.load(new StringReader(mapString.substring(1, mapString.length() - 1).replace(", ", "\n"))); } catch (IOException e) { throw new CitrusRuntimeException("Failed to reconstruct service result object of type map", e); } Map<String, String> map = new LinkedHashMap<>(); for (Map.Entry<java.lang.Object, java.lang.Object> entry : props.entrySet()) { map.put(entry.getKey().toString(), entry.getValue().toString()); } return map; } else { try { return new SimpleTypeConverter().convertIfNecessary(value, argType); } catch (ConversionNotSupportedException e) { if (String.class.equals(argType)) { return value.toString(); } throw e; } } } catch (ClassNotFoundException e) { throw new CitrusRuntimeException("Failed to construct service result object", e); } }
java
public java.lang.Object getResultObject(ApplicationContext applicationContext) { if (object == null) { return null; } if (object.getValueObject() != null) { return object.getValueObject(); } try { Class argType = Class.forName(object.getType()); java.lang.Object value = null; if (object.getValue() != null) { value = object.getValue(); } else if (StringUtils.hasText(object.getRef()) && applicationContext != null) { value = applicationContext.getBean(object.getRef()); } if (value == null) { return null; } else if (argType.isInstance(value) || argType.isAssignableFrom(value.getClass())) { return argType.cast(value); } else if (Map.class.equals(argType)) { String mapString = value.toString(); Properties props = new Properties(); try { props.load(new StringReader(mapString.substring(1, mapString.length() - 1).replace(", ", "\n"))); } catch (IOException e) { throw new CitrusRuntimeException("Failed to reconstruct service result object of type map", e); } Map<String, String> map = new LinkedHashMap<>(); for (Map.Entry<java.lang.Object, java.lang.Object> entry : props.entrySet()) { map.put(entry.getKey().toString(), entry.getValue().toString()); } return map; } else { try { return new SimpleTypeConverter().convertIfNecessary(value, argType); } catch (ConversionNotSupportedException e) { if (String.class.equals(argType)) { return value.toString(); } throw e; } } } catch (ClassNotFoundException e) { throw new CitrusRuntimeException("Failed to construct service result object", e); } }
[ "public", "java", ".", "lang", ".", "Object", "getResultObject", "(", "ApplicationContext", "applicationContext", ")", "{", "if", "(", "object", "==", "null", ")", "{", "return", "null", ";", "}", "if", "(", "object", ".", "getValueObject", "(", ")", "!=",...
Gets this service result as object casted to target type if necessary. @return
[ "Gets", "this", "service", "result", "as", "object", "casted", "to", "target", "type", "if", "necessary", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-jmx/src/main/java/com/consol/citrus/jmx/model/ManagedBeanResult.java#L72-L124
train
citrusframework/citrus
modules/citrus-core/src/main/java/com/consol/citrus/endpoint/AbstractEndpointBuilder.java
AbstractEndpointBuilder.initialize
public AbstractEndpointBuilder<T> initialize() { if (getEndpoint() instanceof InitializingBean) { try { ((InitializingBean) getEndpoint()).afterPropertiesSet(); } catch (Exception e) { throw new CitrusRuntimeException("Failed to initialize endpoint", e); } } return this; }
java
public AbstractEndpointBuilder<T> initialize() { if (getEndpoint() instanceof InitializingBean) { try { ((InitializingBean) getEndpoint()).afterPropertiesSet(); } catch (Exception e) { throw new CitrusRuntimeException("Failed to initialize endpoint", e); } } return this; }
[ "public", "AbstractEndpointBuilder", "<", "T", ">", "initialize", "(", ")", "{", "if", "(", "getEndpoint", "(", ")", "instanceof", "InitializingBean", ")", "{", "try", "{", "(", "(", "InitializingBean", ")", "getEndpoint", "(", ")", ")", ".", "afterPropertie...
Initializes the endpoint. @return
[ "Initializes", "the", "endpoint", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/endpoint/AbstractEndpointBuilder.java#L62-L72
train
citrusframework/citrus
modules/citrus-core/src/main/java/com/consol/citrus/endpoint/AbstractEndpointBuilder.java
AbstractEndpointBuilder.applicationContext
public AbstractEndpointBuilder<T> applicationContext(ApplicationContext applicationContext) { if (getEndpoint() instanceof ApplicationContextAware) { ((ApplicationContextAware) getEndpoint()).setApplicationContext(applicationContext); } if (getEndpoint() instanceof BeanFactoryAware) { ((BeanFactoryAware) getEndpoint()).setBeanFactory(applicationContext); } return this; }
java
public AbstractEndpointBuilder<T> applicationContext(ApplicationContext applicationContext) { if (getEndpoint() instanceof ApplicationContextAware) { ((ApplicationContextAware) getEndpoint()).setApplicationContext(applicationContext); } if (getEndpoint() instanceof BeanFactoryAware) { ((BeanFactoryAware) getEndpoint()).setBeanFactory(applicationContext); } return this; }
[ "public", "AbstractEndpointBuilder", "<", "T", ">", "applicationContext", "(", "ApplicationContext", "applicationContext", ")", "{", "if", "(", "getEndpoint", "(", ")", "instanceof", "ApplicationContextAware", ")", "{", "(", "(", "ApplicationContextAware", ")", "getEn...
Sets the Spring application context. @param applicationContext @return
[ "Sets", "the", "Spring", "application", "context", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/endpoint/AbstractEndpointBuilder.java#L79-L89
train
citrusframework/citrus
modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/builder/ExecuteSQLQueryBuilder.java
ExecuteSQLQueryBuilder.validate
public ExecuteSQLQueryBuilder validate(String column, String ... values) { action.getControlResultSet().put(column, Arrays.asList(values)); return this; }
java
public ExecuteSQLQueryBuilder validate(String column, String ... values) { action.getControlResultSet().put(column, Arrays.asList(values)); return this; }
[ "public", "ExecuteSQLQueryBuilder", "validate", "(", "String", "column", ",", "String", "...", "values", ")", "{", "action", ".", "getControlResultSet", "(", ")", ".", "put", "(", "column", ",", "Arrays", ".", "asList", "(", "values", ")", ")", ";", "retur...
Set expected control result set. Keys represent the column names, values the expected values. @param column @param values
[ "Set", "expected", "control", "result", "set", ".", "Keys", "represent", "the", "column", "names", "values", "the", "expected", "values", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/builder/ExecuteSQLQueryBuilder.java#L165-L168
train
citrusframework/citrus
modules/citrus-ftp/src/main/java/com/consol/citrus/ftp/server/FtpServerBuilder.java
FtpServerBuilder.server
public FtpServerBuilder server(org.apache.ftpserver.FtpServer server) { endpoint.setFtpServer(server); return this; }
java
public FtpServerBuilder server(org.apache.ftpserver.FtpServer server) { endpoint.setFtpServer(server); return this; }
[ "public", "FtpServerBuilder", "server", "(", "org", ".", "apache", ".", "ftpserver", ".", "FtpServer", "server", ")", "{", "endpoint", ".", "setFtpServer", "(", "server", ")", ";", "return", "this", ";", "}" ]
Sets the ftp server. @param server @return
[ "Sets", "the", "ftp", "server", "." ]
55c58ef74c01d511615e43646ca25c1b2301c56d
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-ftp/src/main/java/com/consol/citrus/ftp/server/FtpServerBuilder.java#L93-L96
train
structurizr/java
structurizr-client/src/com/structurizr/api/StructurizrClient.java
StructurizrClient.getWorkspace
public Workspace getWorkspace(long workspaceId) throws StructurizrClientException { if (workspaceId <= 0) { throw new IllegalArgumentException("The workspace ID must be a positive integer."); } try (CloseableHttpClient httpClient = HttpClients.createSystem()) { log.info("Getting workspace with ID " + workspaceId); HttpGet httpGet = new HttpGet(url + WORKSPACE_PATH + workspaceId); addHeaders(httpGet, "", ""); debugRequest(httpGet, null); try (CloseableHttpResponse response = httpClient.execute(httpGet)) { debugResponse(response); String json = EntityUtils.toString(response.getEntity()); if (response.getCode() == HttpStatus.SC_OK) { archiveWorkspace(workspaceId, json); if (encryptionStrategy == null) { return new JsonReader().read(new StringReader(json)); } else { EncryptedWorkspace encryptedWorkspace = new EncryptedJsonReader().read(new StringReader(json)); if (encryptedWorkspace.getEncryptionStrategy() != null) { encryptedWorkspace.getEncryptionStrategy().setPassphrase(encryptionStrategy.getPassphrase()); return encryptedWorkspace.getWorkspace(); } else { // this workspace isn't encrypted, even though the client has an encryption strategy set return new JsonReader().read(new StringReader(json)); } } } else { ApiResponse apiResponse = ApiResponse.parse(json); throw new StructurizrClientException(apiResponse.getMessage()); } } } catch (Exception e) { log.error(e); throw new StructurizrClientException(e); } }
java
public Workspace getWorkspace(long workspaceId) throws StructurizrClientException { if (workspaceId <= 0) { throw new IllegalArgumentException("The workspace ID must be a positive integer."); } try (CloseableHttpClient httpClient = HttpClients.createSystem()) { log.info("Getting workspace with ID " + workspaceId); HttpGet httpGet = new HttpGet(url + WORKSPACE_PATH + workspaceId); addHeaders(httpGet, "", ""); debugRequest(httpGet, null); try (CloseableHttpResponse response = httpClient.execute(httpGet)) { debugResponse(response); String json = EntityUtils.toString(response.getEntity()); if (response.getCode() == HttpStatus.SC_OK) { archiveWorkspace(workspaceId, json); if (encryptionStrategy == null) { return new JsonReader().read(new StringReader(json)); } else { EncryptedWorkspace encryptedWorkspace = new EncryptedJsonReader().read(new StringReader(json)); if (encryptedWorkspace.getEncryptionStrategy() != null) { encryptedWorkspace.getEncryptionStrategy().setPassphrase(encryptionStrategy.getPassphrase()); return encryptedWorkspace.getWorkspace(); } else { // this workspace isn't encrypted, even though the client has an encryption strategy set return new JsonReader().read(new StringReader(json)); } } } else { ApiResponse apiResponse = ApiResponse.parse(json); throw new StructurizrClientException(apiResponse.getMessage()); } } } catch (Exception e) { log.error(e); throw new StructurizrClientException(e); } }
[ "public", "Workspace", "getWorkspace", "(", "long", "workspaceId", ")", "throws", "StructurizrClientException", "{", "if", "(", "workspaceId", "<=", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"The workspace ID must be a positive integer.\"", ")", ...
Gets the workspace with the given ID. @param workspaceId the ID of your workspace @return a Workspace instance @throws StructurizrClientException if there are problems related to the network, authorization, JSON deserialization, etc
[ "Gets", "the", "workspace", "with", "the", "given", "ID", "." ]
4b204f077877a24bcac363f5ecf0e129a0f9f4c5
https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-client/src/com/structurizr/api/StructurizrClient.java#L272-L312
train
structurizr/java
structurizr-client/src/com/structurizr/api/StructurizrClient.java
StructurizrClient.putWorkspace
public void putWorkspace(long workspaceId, Workspace workspace) throws StructurizrClientException { if (workspace == null) { throw new IllegalArgumentException("The workspace must not be null."); } else if (workspaceId <= 0) { throw new IllegalArgumentException("The workspace ID must be a positive integer."); } try (CloseableHttpClient httpClient = HttpClients.createSystem()) { if (mergeFromRemote) { Workspace remoteWorkspace = getWorkspace(workspaceId); if (remoteWorkspace != null) { workspace.getViews().copyLayoutInformationFrom(remoteWorkspace.getViews()); workspace.getViews().getConfiguration().copyConfigurationFrom(remoteWorkspace.getViews().getConfiguration()); } } workspace.setId(workspaceId); workspace.setThumbnail(null); workspace.setLastModifiedDate(new Date()); workspace.setLastModifiedAgent(STRUCTURIZR_FOR_JAVA_AGENT); workspace.setLastModifiedUser(getUser()); workspace.countAndLogWarnings(); HttpPut httpPut = new HttpPut(url + WORKSPACE_PATH + workspaceId); StringWriter stringWriter = new StringWriter(); if (encryptionStrategy == null) { JsonWriter jsonWriter = new JsonWriter(false); jsonWriter.write(workspace, stringWriter); } else { EncryptedWorkspace encryptedWorkspace = new EncryptedWorkspace(workspace, encryptionStrategy); encryptionStrategy.setLocation(EncryptionLocation.Client); EncryptedJsonWriter jsonWriter = new EncryptedJsonWriter(false); jsonWriter.write(encryptedWorkspace, stringWriter); } StringEntity stringEntity = new StringEntity(stringWriter.toString(), ContentType.APPLICATION_JSON); httpPut.setEntity(stringEntity); addHeaders(httpPut, EntityUtils.toString(stringEntity), ContentType.APPLICATION_JSON.toString()); debugRequest(httpPut, EntityUtils.toString(stringEntity)); log.info("Putting workspace with ID " + workspaceId); try (CloseableHttpResponse response = httpClient.execute(httpPut)) { String json = EntityUtils.toString(response.getEntity()); if (response.getCode() == HttpStatus.SC_OK) { debugResponse(response); log.info(json); } else { ApiResponse apiResponse = ApiResponse.parse(json); throw new StructurizrClientException(apiResponse.getMessage()); } } } catch (Exception e) { log.error(e); throw new StructurizrClientException(e); } }
java
public void putWorkspace(long workspaceId, Workspace workspace) throws StructurizrClientException { if (workspace == null) { throw new IllegalArgumentException("The workspace must not be null."); } else if (workspaceId <= 0) { throw new IllegalArgumentException("The workspace ID must be a positive integer."); } try (CloseableHttpClient httpClient = HttpClients.createSystem()) { if (mergeFromRemote) { Workspace remoteWorkspace = getWorkspace(workspaceId); if (remoteWorkspace != null) { workspace.getViews().copyLayoutInformationFrom(remoteWorkspace.getViews()); workspace.getViews().getConfiguration().copyConfigurationFrom(remoteWorkspace.getViews().getConfiguration()); } } workspace.setId(workspaceId); workspace.setThumbnail(null); workspace.setLastModifiedDate(new Date()); workspace.setLastModifiedAgent(STRUCTURIZR_FOR_JAVA_AGENT); workspace.setLastModifiedUser(getUser()); workspace.countAndLogWarnings(); HttpPut httpPut = new HttpPut(url + WORKSPACE_PATH + workspaceId); StringWriter stringWriter = new StringWriter(); if (encryptionStrategy == null) { JsonWriter jsonWriter = new JsonWriter(false); jsonWriter.write(workspace, stringWriter); } else { EncryptedWorkspace encryptedWorkspace = new EncryptedWorkspace(workspace, encryptionStrategy); encryptionStrategy.setLocation(EncryptionLocation.Client); EncryptedJsonWriter jsonWriter = new EncryptedJsonWriter(false); jsonWriter.write(encryptedWorkspace, stringWriter); } StringEntity stringEntity = new StringEntity(stringWriter.toString(), ContentType.APPLICATION_JSON); httpPut.setEntity(stringEntity); addHeaders(httpPut, EntityUtils.toString(stringEntity), ContentType.APPLICATION_JSON.toString()); debugRequest(httpPut, EntityUtils.toString(stringEntity)); log.info("Putting workspace with ID " + workspaceId); try (CloseableHttpResponse response = httpClient.execute(httpPut)) { String json = EntityUtils.toString(response.getEntity()); if (response.getCode() == HttpStatus.SC_OK) { debugResponse(response); log.info(json); } else { ApiResponse apiResponse = ApiResponse.parse(json); throw new StructurizrClientException(apiResponse.getMessage()); } } } catch (Exception e) { log.error(e); throw new StructurizrClientException(e); } }
[ "public", "void", "putWorkspace", "(", "long", "workspaceId", ",", "Workspace", "workspace", ")", "throws", "StructurizrClientException", "{", "if", "(", "workspace", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"The workspace must not be...
Updates the given workspace. @param workspaceId the ID of your workspace @param workspace the workspace instance to update @throws StructurizrClientException if there are problems related to the network, authorization, JSON serialization, etc
[ "Updates", "the", "given", "workspace", "." ]
4b204f077877a24bcac363f5ecf0e129a0f9f4c5
https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-client/src/com/structurizr/api/StructurizrClient.java#L321-L379
train
structurizr/java
structurizr-plantuml/src/com/structurizr/io/plantuml/PlantUMLWriter.java
PlantUMLWriter.write
public void write(Workspace workspace, Writer writer) { if (workspace == null) { throw new IllegalArgumentException("A workspace must be provided."); } if (writer == null) { throw new IllegalArgumentException("A writer must be provided."); } workspace.getViews().getSystemLandscapeViews().forEach(v -> write(v, writer)); workspace.getViews().getSystemContextViews().forEach(v -> write(v, writer)); workspace.getViews().getContainerViews().forEach(v -> write(v, writer)); workspace.getViews().getComponentViews().forEach(v -> write(v, writer)); workspace.getViews().getDynamicViews().forEach(v -> write(v, writer)); workspace.getViews().getDeploymentViews().forEach(v -> write(v, writer)); }
java
public void write(Workspace workspace, Writer writer) { if (workspace == null) { throw new IllegalArgumentException("A workspace must be provided."); } if (writer == null) { throw new IllegalArgumentException("A writer must be provided."); } workspace.getViews().getSystemLandscapeViews().forEach(v -> write(v, writer)); workspace.getViews().getSystemContextViews().forEach(v -> write(v, writer)); workspace.getViews().getContainerViews().forEach(v -> write(v, writer)); workspace.getViews().getComponentViews().forEach(v -> write(v, writer)); workspace.getViews().getDynamicViews().forEach(v -> write(v, writer)); workspace.getViews().getDeploymentViews().forEach(v -> write(v, writer)); }
[ "public", "void", "write", "(", "Workspace", "workspace", ",", "Writer", "writer", ")", "{", "if", "(", "workspace", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"A workspace must be provided.\"", ")", ";", "}", "if", "(", "writer...
Writes the views in the given workspace as PlantUML definitions, to the specified writer. @param workspace the workspace containing the views to be written @param writer the Writer to write to
[ "Writes", "the", "views", "in", "the", "given", "workspace", "as", "PlantUML", "definitions", "to", "the", "specified", "writer", "." ]
4b204f077877a24bcac363f5ecf0e129a0f9f4c5
https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-plantuml/src/com/structurizr/io/plantuml/PlantUMLWriter.java#L133-L148
train
structurizr/java
structurizr-plantuml/src/com/structurizr/io/plantuml/PlantUMLWriter.java
PlantUMLWriter.toStdOut
public void toStdOut(Workspace workspace) { if (workspace == null) { throw new IllegalArgumentException("A workspace must be provided."); } StringWriter stringWriter = new StringWriter(); write(workspace, stringWriter); System.out.println(stringWriter.toString()); }
java
public void toStdOut(Workspace workspace) { if (workspace == null) { throw new IllegalArgumentException("A workspace must be provided."); } StringWriter stringWriter = new StringWriter(); write(workspace, stringWriter); System.out.println(stringWriter.toString()); }
[ "public", "void", "toStdOut", "(", "Workspace", "workspace", ")", "{", "if", "(", "workspace", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"A workspace must be provided.\"", ")", ";", "}", "StringWriter", "stringWriter", "=", "new", ...
Write the views in the given workspace as PlantUML definitions, to stdout. @param workspace the workspace containing the views to be written
[ "Write", "the", "views", "in", "the", "given", "workspace", "as", "PlantUML", "definitions", "to", "stdout", "." ]
4b204f077877a24bcac363f5ecf0e129a0f9f4c5
https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-plantuml/src/com/structurizr/io/plantuml/PlantUMLWriter.java#L155-L163
train
structurizr/java
structurizr-plantuml/src/com/structurizr/io/plantuml/PlantUMLWriter.java
PlantUMLWriter.write
public void write(View view, Writer writer) { if (view == null) { throw new IllegalArgumentException("A view must be provided."); } if (writer == null) { throw new IllegalArgumentException("A writer must be provided."); } if (SystemLandscapeView.class.isAssignableFrom(view.getClass())) { write((SystemLandscapeView) view, writer); } else if (SystemContextView.class.isAssignableFrom(view.getClass())) { write((SystemContextView) view, writer); } else if (ContainerView.class.isAssignableFrom(view.getClass())) { write((ContainerView) view, writer); } else if (ComponentView.class.isAssignableFrom(view.getClass())) { write((ComponentView) view, writer); } else if (DynamicView.class.isAssignableFrom(view.getClass())) { write((DynamicView) view, writer); } else if (DeploymentView.class.isAssignableFrom(view.getClass())) { write((DeploymentView) view, writer); } }
java
public void write(View view, Writer writer) { if (view == null) { throw new IllegalArgumentException("A view must be provided."); } if (writer == null) { throw new IllegalArgumentException("A writer must be provided."); } if (SystemLandscapeView.class.isAssignableFrom(view.getClass())) { write((SystemLandscapeView) view, writer); } else if (SystemContextView.class.isAssignableFrom(view.getClass())) { write((SystemContextView) view, writer); } else if (ContainerView.class.isAssignableFrom(view.getClass())) { write((ContainerView) view, writer); } else if (ComponentView.class.isAssignableFrom(view.getClass())) { write((ComponentView) view, writer); } else if (DynamicView.class.isAssignableFrom(view.getClass())) { write((DynamicView) view, writer); } else if (DeploymentView.class.isAssignableFrom(view.getClass())) { write((DeploymentView) view, writer); } }
[ "public", "void", "write", "(", "View", "view", ",", "Writer", "writer", ")", "{", "if", "(", "view", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"A view must be provided.\"", ")", ";", "}", "if", "(", "writer", "==", "null",...
Writes a single view as a PlantUML diagram definition, to the specified writer. @param view the view to write @param writer the Writer to write the PlantUML definition to
[ "Writes", "a", "single", "view", "as", "a", "PlantUML", "diagram", "definition", "to", "the", "specified", "writer", "." ]
4b204f077877a24bcac363f5ecf0e129a0f9f4c5
https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-plantuml/src/com/structurizr/io/plantuml/PlantUMLWriter.java#L193-L215
train
structurizr/java
structurizr-core/src/com/structurizr/model/Container.java
Container.getComponentWithName
public Component getComponentWithName(String name) { if (name == null || name.trim().length() == 0) { throw new IllegalArgumentException("A component name must be provided."); } Optional<Component> component = components.stream().filter(c -> name.equals(c.getName())).findFirst(); return component.orElse(null); }
java
public Component getComponentWithName(String name) { if (name == null || name.trim().length() == 0) { throw new IllegalArgumentException("A component name must be provided."); } Optional<Component> component = components.stream().filter(c -> name.equals(c.getName())).findFirst(); return component.orElse(null); }
[ "public", "Component", "getComponentWithName", "(", "String", "name", ")", "{", "if", "(", "name", "==", "null", "||", "name", ".", "trim", "(", ")", ".", "length", "(", ")", "==", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"A comp...
Gets the component with the specified name. @param name the name of the component @return the Component instance, or null if a component with the specified name does not exist @throws IllegalArgumentException if the name is null or empty
[ "Gets", "the", "component", "with", "the", "specified", "name", "." ]
4b204f077877a24bcac363f5ecf0e129a0f9f4c5
https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-core/src/com/structurizr/model/Container.java#L145-L152
train
structurizr/java
structurizr-core/src/com/structurizr/model/Container.java
Container.getComponentOfType
public Component getComponentOfType(String type) { if (type == null || type.trim().length() == 0) { throw new IllegalArgumentException("A component type must be provided."); } Optional<Component> component = components.stream().filter(c -> type.equals(c.getType().getType())).findFirst(); return component.orElse(null); }
java
public Component getComponentOfType(String type) { if (type == null || type.trim().length() == 0) { throw new IllegalArgumentException("A component type must be provided."); } Optional<Component> component = components.stream().filter(c -> type.equals(c.getType().getType())).findFirst(); return component.orElse(null); }
[ "public", "Component", "getComponentOfType", "(", "String", "type", ")", "{", "if", "(", "type", "==", "null", "||", "type", ".", "trim", "(", ")", ".", "length", "(", ")", "==", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"A compon...
Gets the component of the specified type. @param type the fully qualified type of the component @return the Component instance, or null if a component with the specified type does not exist @throws IllegalArgumentException if the type is null or empty
[ "Gets", "the", "component", "of", "the", "specified", "type", "." ]
4b204f077877a24bcac363f5ecf0e129a0f9f4c5
https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-core/src/com/structurizr/model/Container.java#L161-L168
train
structurizr/java
structurizr-analysis/src/com/structurizr/analysis/StructurizrAnnotationsComponentFinderStrategy.java
StructurizrAnnotationsComponentFinderStrategy.findUsesComponentAnnotations
private void findUsesComponentAnnotations(Component component, String typeName) { try { Class type = getTypeRepository().loadClass(typeName); for (Field field : type.getDeclaredFields()) { UsesComponent annotation = field.getAnnotation(UsesComponent.class); if (annotation != null) { String name = field.getType().getCanonicalName(); String description = field.getAnnotation(UsesComponent.class).description(); String technology = annotation.technology(); Component destination = componentFinder.getContainer().getComponentOfType(name); if (destination != null) { for (Relationship relationship : component.getRelationships()) { if (relationship.getDestination() == destination && StringUtils.isNullOrEmpty(relationship.getDescription())) { // only change the details of relationships that have no description component.getModel().modifyRelationship(relationship, description, technology); } } } else { log.warn("A component of type \"" + name + "\" could not be found."); } } } } catch (ClassNotFoundException e) { log.warn("Could not load type " + typeName); } }
java
private void findUsesComponentAnnotations(Component component, String typeName) { try { Class type = getTypeRepository().loadClass(typeName); for (Field field : type.getDeclaredFields()) { UsesComponent annotation = field.getAnnotation(UsesComponent.class); if (annotation != null) { String name = field.getType().getCanonicalName(); String description = field.getAnnotation(UsesComponent.class).description(); String technology = annotation.technology(); Component destination = componentFinder.getContainer().getComponentOfType(name); if (destination != null) { for (Relationship relationship : component.getRelationships()) { if (relationship.getDestination() == destination && StringUtils.isNullOrEmpty(relationship.getDescription())) { // only change the details of relationships that have no description component.getModel().modifyRelationship(relationship, description, technology); } } } else { log.warn("A component of type \"" + name + "\" could not be found."); } } } } catch (ClassNotFoundException e) { log.warn("Could not load type " + typeName); } }
[ "private", "void", "findUsesComponentAnnotations", "(", "Component", "component", ",", "String", "typeName", ")", "{", "try", "{", "Class", "type", "=", "getTypeRepository", "(", ")", ".", "loadClass", "(", "typeName", ")", ";", "for", "(", "Field", "field", ...
This will add a description to existing component dependencies, where they have been annotated @UsesComponent.
[ "This", "will", "add", "a", "description", "to", "existing", "component", "dependencies", "where", "they", "have", "been", "annotated" ]
4b204f077877a24bcac363f5ecf0e129a0f9f4c5
https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-analysis/src/com/structurizr/analysis/StructurizrAnnotationsComponentFinderStrategy.java#L78-L104
train
structurizr/java
structurizr-core/src/com/structurizr/model/SoftwareSystem.java
SoftwareSystem.setLocation
public void setLocation(Location location) { if (location != null) { this.location = location; } else { this.location = Location.Unspecified; } }
java
public void setLocation(Location location) { if (location != null) { this.location = location; } else { this.location = Location.Unspecified; } }
[ "public", "void", "setLocation", "(", "Location", "location", ")", "{", "if", "(", "location", "!=", "null", ")", "{", "this", ".", "location", "=", "location", ";", "}", "else", "{", "this", ".", "location", "=", "Location", ".", "Unspecified", ";", "...
Sets the location of this software system. @param location a Location instance
[ "Sets", "the", "location", "of", "this", "software", "system", "." ]
4b204f077877a24bcac363f5ecf0e129a0f9f4c5
https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-core/src/com/structurizr/model/SoftwareSystem.java#L49-L55
train
structurizr/java
structurizr-core/src/com/structurizr/model/Component.java
Component.addSupportingType
public CodeElement addSupportingType(String type) { CodeElement codeElement = new CodeElement(type); codeElement.setRole(CodeElementRole.Supporting); this.codeElements.add(codeElement); return codeElement; }
java
public CodeElement addSupportingType(String type) { CodeElement codeElement = new CodeElement(type); codeElement.setRole(CodeElementRole.Supporting); this.codeElements.add(codeElement); return codeElement; }
[ "public", "CodeElement", "addSupportingType", "(", "String", "type", ")", "{", "CodeElement", "codeElement", "=", "new", "CodeElement", "(", "type", ")", ";", "codeElement", ".", "setRole", "(", "CodeElementRole", ".", "Supporting", ")", ";", "this", ".", "cod...
Adds a supporting type to this Component. @param type the fully qualified type name @return a CodeElement representing the supporting type @throws IllegalArgumentException if the specified type is null
[ "Adds", "a", "supporting", "type", "to", "this", "Component", "." ]
4b204f077877a24bcac363f5ecf0e129a0f9f4c5
https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-core/src/com/structurizr/model/Component.java#L103-L109
train
structurizr/java
structurizr-core/src/com/structurizr/view/ViewSet.java
ViewSet.createSystemLandscapeView
public SystemLandscapeView createSystemLandscapeView(String key, String description) { assertThatTheViewKeyIsSpecifiedAndUnique(key); SystemLandscapeView view = new SystemLandscapeView(model, key, description); view.setViewSet(this); systemLandscapeViews.add(view); return view; }
java
public SystemLandscapeView createSystemLandscapeView(String key, String description) { assertThatTheViewKeyIsSpecifiedAndUnique(key); SystemLandscapeView view = new SystemLandscapeView(model, key, description); view.setViewSet(this); systemLandscapeViews.add(view); return view; }
[ "public", "SystemLandscapeView", "createSystemLandscapeView", "(", "String", "key", ",", "String", "description", ")", "{", "assertThatTheViewKeyIsSpecifiedAndUnique", "(", "key", ")", ";", "SystemLandscapeView", "view", "=", "new", "SystemLandscapeView", "(", "model", ...
Creates a system landscape view. @param key the key for the view (must be unique) @param description a description of the view @return an SystemLandscapeView object @throws IllegalArgumentException if the key is not unique
[ "Creates", "a", "system", "landscape", "view", "." ]
4b204f077877a24bcac363f5ecf0e129a0f9f4c5
https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-core/src/com/structurizr/view/ViewSet.java#L53-L60
train
structurizr/java
structurizr-core/src/com/structurizr/view/ViewSet.java
ViewSet.createSystemContextView
public SystemContextView createSystemContextView(SoftwareSystem softwareSystem, String key, String description) { assertThatTheSoftwareSystemIsNotNull(softwareSystem); assertThatTheViewKeyIsSpecifiedAndUnique(key); SystemContextView view = new SystemContextView(softwareSystem, key, description); view.setViewSet(this); systemContextViews.add(view); return view; }
java
public SystemContextView createSystemContextView(SoftwareSystem softwareSystem, String key, String description) { assertThatTheSoftwareSystemIsNotNull(softwareSystem); assertThatTheViewKeyIsSpecifiedAndUnique(key); SystemContextView view = new SystemContextView(softwareSystem, key, description); view.setViewSet(this); systemContextViews.add(view); return view; }
[ "public", "SystemContextView", "createSystemContextView", "(", "SoftwareSystem", "softwareSystem", ",", "String", "key", ",", "String", "description", ")", "{", "assertThatTheSoftwareSystemIsNotNull", "(", "softwareSystem", ")", ";", "assertThatTheViewKeyIsSpecifiedAndUnique", ...
Creates a system context view, where the scope of the view is the specified software system. @param softwareSystem the SoftwareSystem object representing the scope of the view @param key the key for the view (must be unique) @param description a description of the view @return a SystemContextView object @throws IllegalArgumentException if the software system is null or the key is not unique
[ "Creates", "a", "system", "context", "view", "where", "the", "scope", "of", "the", "view", "is", "the", "specified", "software", "system", "." ]
4b204f077877a24bcac363f5ecf0e129a0f9f4c5
https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-core/src/com/structurizr/view/ViewSet.java#L71-L79
train
structurizr/java
structurizr-core/src/com/structurizr/view/ViewSet.java
ViewSet.createContainerView
public ContainerView createContainerView(SoftwareSystem softwareSystem, String key, String description) { assertThatTheSoftwareSystemIsNotNull(softwareSystem); assertThatTheViewKeyIsSpecifiedAndUnique(key); ContainerView view = new ContainerView(softwareSystem, key, description); view.setViewSet(this); containerViews.add(view); return view; }
java
public ContainerView createContainerView(SoftwareSystem softwareSystem, String key, String description) { assertThatTheSoftwareSystemIsNotNull(softwareSystem); assertThatTheViewKeyIsSpecifiedAndUnique(key); ContainerView view = new ContainerView(softwareSystem, key, description); view.setViewSet(this); containerViews.add(view); return view; }
[ "public", "ContainerView", "createContainerView", "(", "SoftwareSystem", "softwareSystem", ",", "String", "key", ",", "String", "description", ")", "{", "assertThatTheSoftwareSystemIsNotNull", "(", "softwareSystem", ")", ";", "assertThatTheViewKeyIsSpecifiedAndUnique", "(", ...
Creates a container view, where the scope of the view is the specified software system. @param softwareSystem the SoftwareSystem object representing the scope of the view @param key the key for the view (must be unique) @param description a description of the view @return a ContainerView object @throws IllegalArgumentException if the software system is null or the key is not unique
[ "Creates", "a", "container", "view", "where", "the", "scope", "of", "the", "view", "is", "the", "specified", "software", "system", "." ]
4b204f077877a24bcac363f5ecf0e129a0f9f4c5
https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-core/src/com/structurizr/view/ViewSet.java#L90-L98
train
structurizr/java
structurizr-core/src/com/structurizr/view/ViewSet.java
ViewSet.createComponentView
public ComponentView createComponentView(Container container, String key, String description) { assertThatTheContainerIsNotNull(container); assertThatTheViewKeyIsSpecifiedAndUnique(key); ComponentView view = new ComponentView(container, key, description); view.setViewSet(this); componentViews.add(view); return view; }
java
public ComponentView createComponentView(Container container, String key, String description) { assertThatTheContainerIsNotNull(container); assertThatTheViewKeyIsSpecifiedAndUnique(key); ComponentView view = new ComponentView(container, key, description); view.setViewSet(this); componentViews.add(view); return view; }
[ "public", "ComponentView", "createComponentView", "(", "Container", "container", ",", "String", "key", ",", "String", "description", ")", "{", "assertThatTheContainerIsNotNull", "(", "container", ")", ";", "assertThatTheViewKeyIsSpecifiedAndUnique", "(", "key", ")", ";"...
Creates a component view, where the scope of the view is the specified container. @param container the Container object representing the scope of the view @param key the key for the view (must be unique) @param description a description of the view @return a ContainerView object @throws IllegalArgumentException if the container is null or the key is not unique
[ "Creates", "a", "component", "view", "where", "the", "scope", "of", "the", "view", "is", "the", "specified", "container", "." ]
4b204f077877a24bcac363f5ecf0e129a0f9f4c5
https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-core/src/com/structurizr/view/ViewSet.java#L109-L117
train
structurizr/java
structurizr-core/src/com/structurizr/view/ViewSet.java
ViewSet.createDynamicView
public DynamicView createDynamicView(String key, String description) { assertThatTheViewKeyIsSpecifiedAndUnique(key); DynamicView view = new DynamicView(model, key, description); view.setViewSet(this); dynamicViews.add(view); return view; }
java
public DynamicView createDynamicView(String key, String description) { assertThatTheViewKeyIsSpecifiedAndUnique(key); DynamicView view = new DynamicView(model, key, description); view.setViewSet(this); dynamicViews.add(view); return view; }
[ "public", "DynamicView", "createDynamicView", "(", "String", "key", ",", "String", "description", ")", "{", "assertThatTheViewKeyIsSpecifiedAndUnique", "(", "key", ")", ";", "DynamicView", "view", "=", "new", "DynamicView", "(", "model", ",", "key", ",", "descript...
Creates a dynamic view. @param key the key for the view (must be unique) @param description a description of the view @return a DynamicView object @throws IllegalArgumentException if the key is not unique
[ "Creates", "a", "dynamic", "view", "." ]
4b204f077877a24bcac363f5ecf0e129a0f9f4c5
https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-core/src/com/structurizr/view/ViewSet.java#L127-L134
train
structurizr/java
structurizr-core/src/com/structurizr/view/ViewSet.java
ViewSet.createDeploymentView
public DeploymentView createDeploymentView(String key, String description) { assertThatTheViewKeyIsSpecifiedAndUnique(key); DeploymentView view = new DeploymentView(model, key, description); view.setViewSet(this); deploymentViews.add(view); return view; }
java
public DeploymentView createDeploymentView(String key, String description) { assertThatTheViewKeyIsSpecifiedAndUnique(key); DeploymentView view = new DeploymentView(model, key, description); view.setViewSet(this); deploymentViews.add(view); return view; }
[ "public", "DeploymentView", "createDeploymentView", "(", "String", "key", ",", "String", "description", ")", "{", "assertThatTheViewKeyIsSpecifiedAndUnique", "(", "key", ")", ";", "DeploymentView", "view", "=", "new", "DeploymentView", "(", "model", ",", "key", ",",...
Creates a deployment view. @param key the key for the deployment view (must be unique) @param description a description of the view @return a DeploymentView object @throws IllegalArgumentException if the key is not unique
[ "Creates", "a", "deployment", "view", "." ]
4b204f077877a24bcac363f5ecf0e129a0f9f4c5
https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-core/src/com/structurizr/view/ViewSet.java#L197-L204
train
structurizr/java
structurizr-core/src/com/structurizr/view/ViewSet.java
ViewSet.createDeploymentView
public DeploymentView createDeploymentView(SoftwareSystem softwareSystem, String key, String description) { assertThatTheSoftwareSystemIsNotNull(softwareSystem); assertThatTheViewKeyIsSpecifiedAndUnique(key); DeploymentView view = new DeploymentView(softwareSystem, key, description); view.setViewSet(this); deploymentViews.add(view); return view; }
java
public DeploymentView createDeploymentView(SoftwareSystem softwareSystem, String key, String description) { assertThatTheSoftwareSystemIsNotNull(softwareSystem); assertThatTheViewKeyIsSpecifiedAndUnique(key); DeploymentView view = new DeploymentView(softwareSystem, key, description); view.setViewSet(this); deploymentViews.add(view); return view; }
[ "public", "DeploymentView", "createDeploymentView", "(", "SoftwareSystem", "softwareSystem", ",", "String", "key", ",", "String", "description", ")", "{", "assertThatTheSoftwareSystemIsNotNull", "(", "softwareSystem", ")", ";", "assertThatTheViewKeyIsSpecifiedAndUnique", "(",...
Creates a deployment view, where the scope of the view is the specified software system. @param softwareSystem the SoftwareSystem object representing the scope of the view @param key the key for the deployment view (must be unique) @param description a description of the view @return a DeploymentView object @throws IllegalArgumentException if the software system is null or the key is not unique
[ "Creates", "a", "deployment", "view", "where", "the", "scope", "of", "the", "view", "is", "the", "specified", "software", "system", "." ]
4b204f077877a24bcac363f5ecf0e129a0f9f4c5
https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-core/src/com/structurizr/view/ViewSet.java#L215-L223
train