idx
int64
0
41.2k
question
stringlengths
74
4.04k
target
stringlengths
7
750
28,500
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 ( faultCo...
Parses the SOAP fault information .
28,501
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 ...
Parses the fault detail element .
28,502
public static FtpMessage command ( FTPCmd command ) { Command cmd = new Command ( ) ; cmd . setSignal ( command . getCommand ( ) ) ; return new FtpMessage ( cmd ) ; }
Sets the ftp command .
28,503
public static FtpMessage connect ( String sessionId ) { ConnectCommand cmd = new ConnectCommand ( ) ; cmd . setSignal ( "OPEN" ) ; cmd . setSessionId ( sessionId ) ; return new FtpMessage ( cmd ) ; }
Creates new connect command message .
28,504
public FtpMessage arguments ( String arguments ) { if ( command != null ) { command . setArguments ( arguments ) ; } setHeader ( FtpMessageHeaders . FTP_ARGS , arguments ) ; return this ; }
Sets the command args .
28,505
public String getSignal ( ) { return Optional . ofNullable ( getHeader ( FtpMessageHeaders . FTP_COMMAND ) ) . map ( Object :: toString ) . orElse ( null ) ; }
Gets the ftp command signal .
28,506
public String getArguments ( ) { return Optional . ofNullable ( getHeader ( FtpMessageHeaders . FTP_ARGS ) ) . map ( Object :: toString ) . orElse ( null ) ; }
Gets the command args .
28,507
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...
Gets the reply code .
28,508
public String getReplyString ( ) { Object replyString = getHeader ( FtpMessageHeaders . FTP_REPLY_STRING ) ; if ( replyString != null ) { return replyString . toString ( ) ; } return null ; }
Gets the reply string .
28,509
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 ; }
Gets the command result if any or tries to unmarshal String payload representation to an command result model .
28,510
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 ; }
Gets the command if any or tries to unmarshal String payload representation to an command model .
28,511
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 . getComman...
Gets command header as ftp signal from command object .
28,512
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 ( ) )...
Perform evaluation of boolean expression string .
28,513
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 ( val...
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
28,514
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 ( ) , value...
Evaluates a sub expression within a pair of parentheses and pushes its result onto the stack of values
28,515
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 ...
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
28,516
private static String replaceBooleanStringByIntegerRepresentation ( final String possibleBooleanString ) { if ( possibleBooleanString . equals ( TRUE . toString ( ) ) ) { return "1" ; } else if ( possibleBooleanString . equals ( FALSE . toString ( ) ) ) { return "0" ; } return possibleBooleanString ; }
Checks whether a String is a Boolean value and replaces it with its Integer representation true - > 1 false - > 0
28,517
private static boolean isSeparatorToken ( final char possibleSeparatorChar ) { for ( final SeparatorToken token : SeparatorToken . values ( ) ) { if ( token . value == possibleSeparatorChar ) { return true ; } } return false ; }
Checks whether a given character is a known separator token or no
28,518
private static String validateOperator ( final String operator ) { if ( ! OPERATORS . contains ( operator ) && ! BOOLEAN_OPERATORS . contains ( operator ) ) { throw new CitrusRuntimeException ( "Unknown operator '" + operator + "'" ) ; } return operator ; }
Check if operator is known to this class .
28,519
public void runPackages ( List < String > packages ) { CitrusAppConfiguration citrusAppConfiguration = new CitrusAppConfiguration ( ) ; citrusAppConfiguration . setIncludes ( Optional . ofNullable ( includes ) . orElse ( configuration . getIncludes ( ) ) ) ; citrusAppConfiguration . setPackages ( packages ) ; citrusApp...
Run Citrus application with given test package names .
28,520
public void runClasses ( List < TestClass > testClasses ) { CitrusAppConfiguration citrusAppConfiguration = new CitrusAppConfiguration ( ) ; citrusAppConfiguration . setTestClasses ( testClasses ) ; citrusAppConfiguration . setConfigClass ( configuration . getConfigClass ( ) ) ; citrusAppConfiguration . addDefaultPrope...
Run Citrus application with given test class names .
28,521
public boolean handleRequest ( MessageContext messageContext , Object endpoint ) throws Exception { logRequest ( "Received SOAP request" , messageContext , true ) ; return true ; }
Write request message to logger .
28,522
public boolean handleResponse ( MessageContext messageContext , Object endpoint ) throws Exception { logResponse ( "Sending SOAP response" , messageContext , false ) ; return true ; }
Write response message to logger .
28,523
public RestTemplate getRestTemplate ( ) { if ( restTemplate == null ) { restTemplate = new RestTemplate ( ) ; restTemplate . setRequestFactory ( getRequestFactory ( ) ) ; } restTemplate . setErrorHandler ( getErrorHandler ( ) ) ; if ( ! defaultAcceptHeader ) { for ( org . springframework . http . converter . HttpMessag...
Gets the restTemplate .
28,524
private String getNodeValue ( Node node ) { if ( node . getNodeType ( ) == Node . ELEMENT_NODE && node . getFirstChild ( ) != null ) { return node . getFirstChild ( ) . getNodeValue ( ) ; } else { return node . getNodeValue ( ) ; } }
Resolves an XML node s value
28,525
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 ....
Static number generator method .
28,526
public static String checkLeadingZeros ( String generated , boolean paddingOn ) { if ( paddingOn ) { return replaceLeadingZero ( generated ) ; } else { return removeLeadingZeros ( generated ) ; } }
Remove leading Zero numbers .
28,527
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...
Removes leading zero numbers if present .
28,528
private static String replaceLeadingZero ( String generated ) { if ( generated . charAt ( 0 ) == '0' ) { int replacement = 0 ; while ( replacement == 0 ) { replacement = generator . nextInt ( 10 ) ; } return replacement + generated . substring ( 1 ) ; } else { return generated ; } }
Replaces first leading zero number if present .
28,529
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...
Observes before suite event and tries to load Citrus remote extension properties .
28,530
private Properties getRemoteConfigurationProperties ( ) { ClassLoader ctcl = AccessController . doPrivileged ( new PrivilegedAction < ClassLoader > ( ) { public ClassLoader run ( ) { return Thread . currentThread ( ) . getContextClassLoader ( ) ; } } ) ; try { if ( log . isDebugEnabled ( ) ) { log . debug ( "Loading Ci...
Reads configuration properties from remote property file that has been added to the auxiliary archive .
28,531
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 (...
Reads without labels from expression string .
28,532
private Object handleInvocation ( ManagedBeanInvocation mbeanInvocation ) { Message response = endpointAdapter . handleMessage ( endpointConfiguration . getMessageConverter ( ) . convertInbound ( mbeanInvocation , endpointConfiguration , null ) ) ; ManagedBeanResult serviceResult = null ; if ( response != null && respo...
Handle managed bean invocation by delegating to endpoint adapter . Response is converted to proper method return result .
28,533
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 ( ( JSONObj...
Walks through the Json object structure and translates values based on element path if necessary .
28,534
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 ) ; }
Generates digest hexadecimal string representation of a key with given algorithm .
28,535
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 ( ) ...
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 .
28,536
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 ( ) ) ; T...
Add message payload as SOAP body element to the SOAP response .
28,537
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 ...
Translates message headers to SOAP headers in response .
28,538
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 namespa...
Get the default QName from local part .
28,539
protected static String getBaseKey ( ExtensionContext extensionContext ) { return extensionContext . getRequiredTestClass ( ) . getName ( ) + "." + extensionContext . getRequiredTestMethod ( ) . getName ( ) + "#" ; }
Gets base key for store .
28,540
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 PathMatchingResourcePattern...
Creates stream of dynamic tests based on package scan . Scans package for all Xml test case files and creates dynamic test instance for it .
28,541
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 ( Kubernete...
Request generating instantiation .
28,542
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 . s...
Check if variable expression is a custom function . Expression has to start with one of the registered function library prefix .
28,543
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 NoSuchF...
Get library for function prefix .
28,544
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 . getEndpointAda...
Post process endpoint .
28,545
private List < EndpointInterceptor > adaptInterceptors ( List < Object > interceptors ) { List < EndpointInterceptor > endpointInterceptors = new ArrayList < EndpointInterceptor > ( ) ; if ( interceptors != null ) { for ( Object interceptor : interceptors ) { if ( interceptor instanceof EndpointInterceptor ) { endpoint...
Adapts object list to endpoint interceptors .
28,546
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 ; }
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 .
28,547
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 ; }
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 .
28,548
public ZipMessage addEntry ( String fileName , byte [ ] content ) { Entry entry = new Entry ( fileName ) ; entry . setContent ( content ) ; addEntry ( entry ) ; return this ; }
Adds new zip archive entry with given content .
28,549
protected void handleInboundSoapMessage ( final org . springframework . ws . soap . SoapMessage soapMessage , final SoapMessage message , final WebServiceEndpointConfiguration endpointConfiguration ) { handleInboundNamespaces ( soapMessage , message ) ; handleInboundSoapHeaders ( soapMessage , message ) ; handleInbound...
Method handles SOAP specific message information such as SOAP action headers and SOAP attachments .
28,550
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 he...
Reads information from Http connection and adds them as Http marked headers to internal message representation .
28,551
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 ( it...
Reads all soap headers from web service message and adds them to message builder as normal headers . Also takes care of soap action header .
28,552
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 = ( SaajSoapMessag...
Adds a HTTP message header to the SOAP message .
28,553
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 ) { messa...
Adds all message properties from web service message to message builder as normal header entries .
28,554
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 So...
Adds attachments if present in soap web service message .
28,555
private String getHeaderName ( String name , Map < String , Object > receivedHeaders , TestContext context , HeaderValidationContext validationContext ) { String headerName = context . resolveDynamicValue ( name ) ; if ( ! receivedHeaders . containsKey ( headerName ) && validationContext . isHeaderNameIgnoreCase ( ) ) ...
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 .
28,556
public WaitHttpConditionBuilder status ( HttpStatus status ) { getCondition ( ) . setHttpResponseCode ( String . valueOf ( status . value ( ) ) ) ; return this ; }
Sets the Http status code to check .
28,557
public List < MessageValidator < ? extends ValidationContext > > findMessageValidators ( String messageType , Message message ) { List < MessageValidator < ? extends ValidationContext > > matchingValidators = new ArrayList < > ( ) ; for ( MessageValidator < ? extends ValidationContext > validator : messageValidators ) ...
Finds matching message validators for this message type .
28,558
public MessageValidator getDefaultMessageHeaderValidator ( ) { return messageValidators . stream ( ) . filter ( validator -> DefaultMessageHeaderValidator . class . isAssignableFrom ( validator . getClass ( ) ) ) . findFirst ( ) . orElse ( null ) ; }
Gets the default message header validator .
28,559
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 . setDefau...
Creates default JmsTemplate instance from connection factory and destination .
28,560
public FirefoxProfile getFirefoxProfile ( ) { if ( firefoxProfile == null ) { firefoxProfile = new FirefoxProfile ( ) ; firefoxProfile . setAcceptUntrustedCertificates ( true ) ; firefoxProfile . setAssumeUntrustedCertificateIssuer ( false ) ; firefoxProfile . setPreference ( "browser.download.folderList" , 2 ) ; firef...
Gets the firefoxProfile .
28,561
public void openConnection ( Map < String , String > properties ) throws JdbcServerException { if ( ! endpointConfiguration . isAutoConnect ( ) ) { List < OpenConnection . Property > propertyList = convertToPropertyList ( properties ) ; handleMessageAndCheckResponse ( JdbcMessage . openConnection ( propertyList ) ) ; }...
Opens the connection with the given properties
28,562
public void closeConnection ( ) throws JdbcServerException { if ( ! endpointConfiguration . isAutoConnect ( ) ) { handleMessageAndCheckResponse ( JdbcMessage . closeConnection ( ) ) ; } if ( connections . decrementAndGet ( ) < 0 ) { connections . set ( 0 ) ; } }
Closes the connection
28,563
public void createPreparedStatement ( String stmt ) throws JdbcServerException { if ( ! endpointConfiguration . isAutoCreateStatement ( ) ) { handleMessageAndCheckResponse ( JdbcMessage . createPreparedStatement ( stmt ) ) ; } }
Creates a prepared statement
28,564
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 ) ) ; }
Executes a given query and returns the mapped result
28,565
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 ) ) ; }
Executes the given statement
28,566
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_UPDA...
Executes the given update
28,567
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 . transactionSta...
Sets the transaction state of the database connection
28,568
public void commitStatements ( ) { if ( log . isDebugEnabled ( ) ) { log . debug ( String . format ( "Received transaction commit: '%s':%n" , endpointConfiguration . getServerConfiguration ( ) . getDatabaseName ( ) ) ) ; } if ( ! endpointConfiguration . isAutoTransactionHandling ( ) ) { handleMessageAndCheckResponse ( ...
Commits the transaction statements
28,569
public void rollbackStatements ( ) { if ( log . isDebugEnabled ( ) ) { log . debug ( String . format ( "Received transaction rollback: '%s':%n" , endpointConfiguration . getServerConfiguration ( ) . getDatabaseName ( ) ) ) ; } if ( ! endpointConfiguration . isAutoTransactionHandling ( ) ) { handleMessageAndCheckRespons...
Performs a rollback on the current transaction
28,570
public void createCallableStatement ( String sql ) { if ( ! endpointConfiguration . isAutoCreateStatement ( ) ) { handleMessageAndCheckResponse ( JdbcMessage . createCallableStatement ( sql ) ) ; } }
Creates a callable statement
28,571
private MessageType getMessageType ( Message response ) { String messageTypeString = ( String ) response . getHeader ( MessageHeaders . MESSAGE_TYPE ) ; if ( MessageType . knows ( messageTypeString ) ) { return MessageType . valueOf ( messageTypeString . toUpperCase ( ) ) ; } return null ; }
Determines the MessageType of the given response
28,572
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 ( ) ) ; }
Converts a property map propertyKey - > propertyValue to a list of OpenConnection . Properties
28,573
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 ; }
Converts a Map entry into a OpenConnection . Property
28,574
private Message handleMessageAndCheckResponse ( Message request ) throws JdbcServerException { Message response = handleMessage ( request ) ; checkSuccess ( response ) ; return response ; }
Handle request message and check response is successful .
28,575
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 ( ...
Check that response is not having an exception message .
28,576
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 ) ; }
Try to find function in library by name .
28,577
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 ...
Does this function library know a function with the given name .
28,578
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 ( ob...
Gets this service result as object casted to target type if necessary .
28,579
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 ; }
Initializes the endpoint .
28,580
public AbstractEndpointBuilder < T > applicationContext ( ApplicationContext applicationContext ) { if ( getEndpoint ( ) instanceof ApplicationContextAware ) { ( ( ApplicationContextAware ) getEndpoint ( ) ) . setApplicationContext ( applicationContext ) ; } if ( getEndpoint ( ) instanceof BeanFactoryAware ) { ( ( Bean...
Sets the Spring application context .
28,581
public ExecuteSQLQueryBuilder validate ( String column , String ... values ) { action . getControlResultSet ( ) . put ( column , Arrays . asList ( values ) ) ; return this ; }
Set expected control result set . Keys represent the column names values the expected values .
28,582
public FtpServerBuilder server ( org . apache . ftpserver . FtpServer server ) { endpoint . setFtpServer ( server ) ; return this ; }
Sets the ftp server .
28,583
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 " +...
Gets the workspace with the given ID .
28,584
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...
Updates the given workspace .
28,585
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 ( ) . forEa...
Writes the views in the given workspace as PlantUML definitions to the specified writer .
28,586
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 ( ) ) ; }
Write the views in the given workspace as PlantUML definitions to stdout .
28,587
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 ( ) ) ) { wr...
Writes a single view as a PlantUML diagram definition to the specified writer .
28,588
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 ( ...
Gets the component with the specified name .
28,589
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 ( ) ) ) . ...
Gets the component of the specified type .
28,590
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 n...
This will add a description to existing component dependencies where they have been annotated
28,591
public void setLocation ( Location location ) { if ( location != null ) { this . location = location ; } else { this . location = Location . Unspecified ; } }
Sets the location of this software system .
28,592
public CodeElement addSupportingType ( String type ) { CodeElement codeElement = new CodeElement ( type ) ; codeElement . setRole ( CodeElementRole . Supporting ) ; this . codeElements . add ( codeElement ) ; return codeElement ; }
Adds a supporting type to this Component .
28,593
public SystemLandscapeView createSystemLandscapeView ( String key , String description ) { assertThatTheViewKeyIsSpecifiedAndUnique ( key ) ; SystemLandscapeView view = new SystemLandscapeView ( model , key , description ) ; view . setViewSet ( this ) ; systemLandscapeViews . add ( view ) ; return view ; }
Creates a system landscape view .
28,594
public SystemContextView createSystemContextView ( SoftwareSystem softwareSystem , String key , String description ) { assertThatTheSoftwareSystemIsNotNull ( softwareSystem ) ; assertThatTheViewKeyIsSpecifiedAndUnique ( key ) ; SystemContextView view = new SystemContextView ( softwareSystem , key , description ) ; view...
Creates a system context view where the scope of the view is the specified software system .
28,595
public ContainerView createContainerView ( SoftwareSystem softwareSystem , String key , String description ) { assertThatTheSoftwareSystemIsNotNull ( softwareSystem ) ; assertThatTheViewKeyIsSpecifiedAndUnique ( key ) ; ContainerView view = new ContainerView ( softwareSystem , key , description ) ; view . setViewSet ( ...
Creates a container view where the scope of the view is the specified software system .
28,596
public ComponentView createComponentView ( Container container , String key , String description ) { assertThatTheContainerIsNotNull ( container ) ; assertThatTheViewKeyIsSpecifiedAndUnique ( key ) ; ComponentView view = new ComponentView ( container , key , description ) ; view . setViewSet ( this ) ; componentViews ....
Creates a component view where the scope of the view is the specified container .
28,597
public DynamicView createDynamicView ( String key , String description ) { assertThatTheViewKeyIsSpecifiedAndUnique ( key ) ; DynamicView view = new DynamicView ( model , key , description ) ; view . setViewSet ( this ) ; dynamicViews . add ( view ) ; return view ; }
Creates a dynamic view .
28,598
public DeploymentView createDeploymentView ( String key , String description ) { assertThatTheViewKeyIsSpecifiedAndUnique ( key ) ; DeploymentView view = new DeploymentView ( model , key , description ) ; view . setViewSet ( this ) ; deploymentViews . add ( view ) ; return view ; }
Creates a deployment view .
28,599
public DeploymentView createDeploymentView ( SoftwareSystem softwareSystem , String key , String description ) { assertThatTheSoftwareSystemIsNotNull ( softwareSystem ) ; assertThatTheViewKeyIsSpecifiedAndUnique ( key ) ; DeploymentView view = new DeploymentView ( softwareSystem , key , description ) ; view . setViewSe...
Creates a deployment view where the scope of the view is the specified software system .