idx int64 0 41.2k | question stringlengths 74 4.04k | target stringlengths 7 750 |
|---|---|---|
27,900 | public void setScalarSerializer ( Class type , ScalarSerializer serializer ) { if ( type == null ) throw new IllegalArgumentException ( "type cannot be null." ) ; if ( serializer == null ) throw new IllegalArgumentException ( "serializer cannot be null." ) ; scalarSerializers . put ( type , serializer ) ; } | Adds a serializer for the specified scalar type . |
27,901 | public void setPropertyElementType ( Class type , String propertyName , Class elementType ) { if ( type == null ) throw new IllegalArgumentException ( "type cannot be null." ) ; if ( propertyName == null ) throw new IllegalArgumentException ( "propertyName cannot be null." ) ; if ( elementType == null ) throw new Illeg... | Sets the default type of elements in a Collection or Map property . No tag will be output for elements of this type . This type will be used for each element if no tag is found . |
27,902 | public void setPropertyDefaultType ( Class type , String propertyName , Class defaultType ) { if ( type == null ) throw new IllegalArgumentException ( "type cannot be null." ) ; if ( propertyName == null ) throw new IllegalArgumentException ( "propertyName cannot be null." ) ; if ( defaultType == null ) throw new Illeg... | Sets the default type of a property . No tag will be output for values of this type . This type will be used if no tag is found . |
27,903 | public < T > T read ( Class < T > type ) throws YamlException { return read ( type , null ) ; } | Reads an object of the specified type from YAML . |
27,904 | public < T > T read ( Class < T > type , Class elementType ) throws YamlException { try { while ( true ) { Event event = parser . getNextEvent ( ) ; if ( event == null ) return null ; if ( event . type == STREAM_END ) return null ; if ( event . type == DOCUMENT_START ) break ; } return ( T ) readValue ( type , elementT... | Reads an array Map List or Collection object of the specified type from YAML using the specified element type . |
27,905 | protected Object readValue ( Class type , Class elementType , Class defaultType ) throws YamlException , ParserException , TokenizerException { String tag = null , anchor = null ; Event event = parser . peekNextEvent ( ) ; switch ( event . type ) { case ALIAS : parser . getNextEvent ( ) ; anchor = ( ( AliasEvent ) even... | Reads an object from the YAML . Can be overidden to take some action for any of the objects returned . |
27,906 | protected Object createObject ( Class type ) throws InvocationTargetException { DeferredConstruction deferredConstruction = Beans . getDeferredConstruction ( type , config ) ; if ( deferredConstruction != null ) return deferredConstruction ; return Beans . createObject ( type , config . privateConstructors ) ; } | Returns a new object of the requested type . |
27,907 | private final void error ( String message , CharSequence identifier ) { if ( badHtmlHandler != Handler . DO_NOTHING ) { badHtmlHandler . handle ( message + " : " + identifier ) ; } } | Called when the series of calls make no sense . May be overridden to throw an unchecked throwable to log or to take some other action . |
27,908 | static String safeName ( String unsafeElementName ) { String elementName = HtmlLexer . canonicalName ( unsafeElementName ) ; switch ( elementName . length ( ) ) { case 3 : if ( "xmp" . equals ( elementName ) ) { return "pre" ; } break ; case 7 : if ( "listing" . equals ( elementName ) ) { return "pre" ; } break ; case ... | Canonicalizes the element name and possibly substitutes an alternative that has more consistent semantics . |
27,909 | public Trie lookup ( char ch ) { int i = Arrays . binarySearch ( childMap , ch ) ; return i >= 0 ? children [ i ] : null ; } | The child corresponding to the given character . |
27,910 | public Trie lookup ( CharSequence s ) { Trie t = this ; for ( int i = 0 , n = s . length ( ) ; i < n ; ++ i ) { t = t . lookup ( s . charAt ( i ) ) ; if ( null == t ) { break ; } } return t ; } | The descendant of this trie corresponding to the string for this trie appended with s . |
27,911 | static String normalizeUri ( String s ) { int n = s . length ( ) ; boolean colonsIrrelevant = false ; for ( int i = 0 ; i < n ; ++ i ) { char ch = s . charAt ( i ) ; switch ( ch ) { case '/' : case '#' : case '?' : case ':' : colonsIrrelevant = true ; break ; case '(' : case ')' : case '{' : case '}' : return normalize... | Percent encodes anything that looks like a colon or a parenthesis . |
27,912 | public boolean canContain ( int parent , int child ) { if ( nofeatureElements . get ( parent ) ) { return true ; } return child == TEXT_NODE ? canContainText ( parent ) : canContain . get ( parent , child ) ; } | True if parent can directly contain child . |
27,913 | int [ ] impliedElements ( int anc , int desc ) { if ( desc == SCRIPT_TAG || desc == STYLE_TAG ) { return ZERO_INTS ; } FreeWrapper wrapper = desc != TEXT_NODE && desc < FREE_WRAPPERS . length ? FREE_WRAPPERS [ desc ] : null ; if ( wrapper != null ) { if ( anc < wrapper . allowedContainers . length && ! wrapper . allowe... | Elements in order which are implicitly opened when a descendant tag is lexically nested within an ancestor . |
27,914 | static String canonicalName ( String elementOrAttribName ) { return elementOrAttribName . indexOf ( ':' ) >= 0 ? elementOrAttribName : Strings . toLowerCase ( elementOrAttribName ) ; } | Normalize case of names that are not name - spaced . This lower - cases HTML element and attribute names but not ones for embedded SVG or MATHML . |
27,915 | protected HtmlToken produce ( ) { HtmlToken token = readToken ( ) ; if ( token == null ) { return null ; } switch ( token . type ) { case TAGBEGIN : state = State . IN_TAG ; break ; case TAGEND : if ( state == State . SAW_EQ && HtmlTokenType . TAGEND == token . type ) { pushbackToken ( token ) ; state = State . IN_TAG ... | Makes sure that this . token contains a token if one is available . This may require fetching and combining multiple tokens from the underlying splitter . |
27,916 | private HtmlToken collapseSubsequent ( HtmlToken token ) { HtmlToken collapsed = token ; for ( HtmlToken next ; ( next = peekToken ( 0 ) ) != null && next . type == token . type ; readToken ( ) ) { collapsed = join ( collapsed , next ) ; } return collapsed ; } | Collapses all the following tokens of the same type into this . token . |
27,917 | private static boolean isValuelessAttribute ( String attribName ) { boolean valueless = VALUELESS_ATTRIB_NAMES . contains ( Strings . toLowerCase ( attribName ) ) ; return valueless ; } | Can the attribute appear in HTML without a value . |
27,918 | protected HtmlToken produce ( ) { HtmlToken token = parseToken ( ) ; if ( null == token ) { return null ; } if ( inEscapeExemptBlock ) { if ( token . type != HtmlTokenType . SERVERCODE ) { token = reclassify ( token , ( this . textEscapingMode == HtmlTextEscapingMode . RCDATA ? HtmlTokenType . TEXT : HtmlTokenType . UN... | Make sure that there is a token ready to yield in this . token . |
27,919 | public HtmlPolicyBuilder allowElements ( ElementPolicy policy , String ... elementNames ) { invalidateCompiledState ( ) ; for ( String elementName : elementNames ) { elementName = HtmlLexer . canonicalName ( elementName ) ; ElementPolicy newPolicy = ElementPolicy . Util . join ( elPolicies . get ( elementName ) , polic... | Allow the given elements with the given policy . |
27,920 | public HtmlPolicyBuilder allowWithoutAttributes ( String ... elementNames ) { invalidateCompiledState ( ) ; for ( String elementName : elementNames ) { elementName = HtmlLexer . canonicalName ( elementName ) ; skipIfEmpty . remove ( elementName ) ; } return this ; } | Assuming the given elements are allowed allows them to appear without attributes . |
27,921 | public HtmlPolicyBuilder disallowWithoutAttributes ( String ... elementNames ) { invalidateCompiledState ( ) ; for ( String elementName : elementNames ) { elementName = HtmlLexer . canonicalName ( elementName ) ; skipIfEmpty . add ( elementName ) ; } return this ; } | Disallows the given elements from appearing without attributes . |
27,922 | public AttributeBuilder allowAttributes ( String ... attributeNames ) { ImmutableList . Builder < String > b = ImmutableList . builder ( ) ; for ( String attributeName : attributeNames ) { b . add ( HtmlLexer . canonicalName ( attributeName ) ) ; } return new AttributeBuilder ( b . build ( ) ) ; } | Returns an object that lets you associate policies with the given attributes and allow them globally or on specific elements . |
27,923 | public HtmlPolicyBuilder withPreprocessor ( HtmlStreamEventProcessor pp ) { this . preprocessor = HtmlStreamEventProcessor . Processors . compose ( this . preprocessor , pp ) ; return this ; } | Inserts a pre - processor into the pipeline between the lexer and the policy . Pre - processors receive HTML events before the policy so the policy will be applied to anything they add . Pre - processors are not in the TCB since they cannot bypass the policy . |
27,924 | public static void main ( String [ ] args ) throws IOException { if ( args . length != 0 ) { System . err . println ( "Reads from STDIN and writes to STDOUT" ) ; System . exit ( - 1 ) ; } System . err . println ( "[Reading from STDIN]" ) ; String html = CharStreams . toString ( new InputStreamReader ( System . in , Cha... | A test - bed that reads HTML from stdin and writes sanitized content to stdout . |
27,925 | public static String decodeHtml ( String s ) { int firstAmp = s . indexOf ( '&' ) ; int safeLimit = longestPrefixOfGoodCodeunits ( s ) ; if ( ( firstAmp & safeLimit ) < 0 ) { return s ; } StringBuilder sb ; { int n = s . length ( ) ; sb = new StringBuilder ( n ) ; int pos = 0 ; int amp = firstAmp ; while ( amp >= 0 ) {... | Decodes HTML entities to produce a string containing only valid Unicode scalar values . |
27,926 | static String stripBannedCodeunits ( String s ) { int safeLimit = longestPrefixOfGoodCodeunits ( s ) ; if ( safeLimit < 0 ) { return s ; } StringBuilder sb = new StringBuilder ( s ) ; stripBannedCodeunits ( sb , safeLimit ) ; return sb . toString ( ) ; } | Returns the portion of its input that consists of XML safe chars . |
27,927 | private static int longestPrefixOfGoodCodeunits ( String s ) { int n = s . length ( ) , i ; for ( i = 0 ; i < n ; ++ i ) { char ch = s . charAt ( i ) ; if ( ch < 0x20 ) { if ( IS_BANNED_ASCII [ ch ] ) { return i ; } } else if ( 0xd800 <= ch ) { if ( ch <= 0xdfff ) { if ( i + 1 < n && Character . isSurrogatePair ( ch , ... | The number of code - units at the front of s that form code - points in the XML Character production . |
27,928 | private boolean canContain ( int child , int container , int containerIndexOnStack ) { Preconditions . checkArgument ( containerIndexOnStack >= 0 ) ; int anc = container ; int ancIndexOnStack = containerIndexOnStack ; while ( true ) { if ( METADATA . canContain ( anc , child ) ) { return true ; } if ( ! TRANSPARENT . g... | Takes into account transparency when figuring out what can be contained . |
27,929 | public static void run ( Appendable out , String ... inputs ) throws IOException { PolicyFactory policyBuilder = new HtmlPolicyBuilder ( ) . allowAttributes ( "src" ) . onElements ( "img" ) . allowAttributes ( "href" ) . onElements ( "a" ) . allowStandardUrlProtocols ( ) . allowElements ( "a" , "label" , "h1" , "h2" , ... | Sanitizes inputs to out . |
27,930 | public PolicyFactory and ( PolicyFactory f ) { ImmutableMap . Builder < String , ElementAndAttributePolicies > b = ImmutableMap . builder ( ) ; for ( Map . Entry < String , ElementAndAttributePolicies > e : policies . entrySet ( ) ) { String elName = e . getKey ( ) ; ElementAndAttributePolicies p = e . getValue ( ) ; E... | Produces a factory that allows the union of the grants and intersects policies where they overlap on a particular granted attribute or element name . |
27,931 | static String cssContent ( String token ) { int n = token . length ( ) ; int pos = 0 ; StringBuilder sb = null ; if ( n >= 2 ) { char ch0 = token . charAt ( 0 ) ; if ( ch0 == '"' || ch0 == '\'' ) { if ( ch0 == token . charAt ( n - 1 ) ) { pos = 1 ; -- n ; sb = new StringBuilder ( n ) ; } } } for ( int esc ; ( esc = tok... | Decodes any escape sequences and strips any quotes from the input . |
27,932 | private static void quickSort ( int [ ] order , double [ ] values , int start , int end , int limit ) { while ( end - start > limit ) { int pivotIndex = start + prng . nextInt ( end - start ) ; double pivotValue = values [ order [ pivotIndex ] ] ; swap ( order , start , pivotIndex ) ; int low = start + 1 ; int high = e... | Standard quick sort except that sorting is done on an index array rather than the values themselves |
27,933 | private static void quickSort ( double [ ] key , double [ ] [ ] values , int start , int end , int limit ) { while ( end - start > limit ) { int a = start ; int b = ( start + end ) / 2 ; int c = end - 1 ; int pivotIndex ; double pivotValue ; double va = key [ a ] ; double vb = key [ b ] ; double vc = key [ c ] ; if ( v... | Standard quick sort except that sorting rearranges parallel arrays |
27,934 | @ SuppressWarnings ( "SameParameterValue" ) private static void insertionSort ( double [ ] key , double [ ] [ ] values , int start , int end , int limit ) { for ( int i = start + 1 ; i < end ; i ++ ) { double v = key [ i ] ; int m = Math . max ( i - limit , start ) ; for ( int j = i ; j >= m ; j -- ) { if ( j == m || k... | Limited range insertion sort . We assume that no element has to move more than limit steps because quick sort has done its thing . This version works on parallel arrays of keys and values . |
27,935 | @ SuppressWarnings ( "UnusedDeclaration" ) public static void checkPartition ( int [ ] order , double [ ] values , double pivotValue , int start , int low , int high , int end ) { if ( order . length != values . length ) { throw new IllegalArgumentException ( "Arguments must be same size" ) ; } if ( ! ( start >= 0 && l... | Check that a partition step was done correctly . For debugging and testing . |
27,936 | @ SuppressWarnings ( "SameParameterValue" ) private static void insertionSort ( int [ ] order , double [ ] values , int start , int n , int limit ) { for ( int i = start + 1 ; i < n ; i ++ ) { int t = order [ i ] ; double v = values [ order [ i ] ] ; int m = Math . max ( i - limit , start ) ; for ( int j = i ; j >= m ;... | Limited range insertion sort . We assume that no element has to move more than limit steps because quick sort has done its thing . |
27,937 | static double quantile ( double index , double previousIndex , double nextIndex , double previousMean , double nextMean ) { final double delta = nextIndex - previousIndex ; final double previousWeight = ( nextIndex - index ) / delta ; final double nextWeight = ( index - previousIndex ) / delta ; return previousMean * p... | Computes an interpolated value of a quantile that is between two centroids . |
27,938 | public void add ( double centroid , int count , List < Double > data ) { this . centroid = centroid ; this . count = count ; this . data = data ; tree . add ( ) ; } | Add the provided centroid to the tree . |
27,939 | @ SuppressWarnings ( "WeakerAccess" ) public void update ( int node , double centroid , int count , List < Double > data , boolean forceInPlace ) { if ( centroid == centroids [ node ] || forceInPlace ) { centroids [ node ] = centroid ; counts [ node ] = count ; if ( datas != null ) { datas [ node ] = data ; } } else { ... | Update values associated with a node readjusting the tree if necessary . |
27,940 | public int smallByteSize ( ) { int bound = byteSize ( ) ; ByteBuffer buf = ByteBuffer . allocate ( bound ) ; asSmallBytes ( buf ) ; return buf . position ( ) ; } | Returns an upper bound on the number of bytes that will be required to represent this histogram in the tighter representation . |
27,941 | public void asBytes ( ByteBuffer buf ) { buf . putInt ( VERBOSE_ENCODING ) ; buf . putDouble ( min ) ; buf . putDouble ( max ) ; buf . putDouble ( ( float ) compression ( ) ) ; buf . putInt ( summary . size ( ) ) ; for ( Centroid centroid : summary ) { buf . putDouble ( centroid . mean ( ) ) ; } for ( Centroid centroid... | Outputs a histogram as bytes using a particularly cheesy encoding . |
27,942 | @ SuppressWarnings ( "WeakerAccess" ) public static AVLTreeDigest fromBytes ( ByteBuffer buf ) { int encoding = buf . getInt ( ) ; if ( encoding == VERBOSE_ENCODING ) { double min = buf . getDouble ( ) ; double max = buf . getDouble ( ) ; double compression = buf . getDouble ( ) ; AVLTreeDigest r = new AVLTreeDigest ( ... | Reads a histogram from a byte buffer |
27,943 | @ SuppressWarnings ( "WeakerAccess" ) public static double compareChi2 ( TDigest dist1 , TDigest dist2 , double [ ] qCuts ) { double [ ] [ ] count = new double [ 2 ] [ ] ; count [ 0 ] = new double [ qCuts . length + 1 ] ; count [ 1 ] = new double [ qCuts . length + 1 ] ; double oldQ = 0 ; double oldQ2 = 0 ; for ( int i... | Use a log - likelihood ratio test to compare two distributions . This is done by estimating counts in quantile ranges from each distribution and then comparing those counts using a multinomial test . The result should be asymptotically chi^2 distributed if the data comes from the same distribution but this isn t so muc... |
27,944 | public int find ( ) { for ( int node = root ; node != NIL ; ) { final int cmp = compare ( node ) ; if ( cmp < 0 ) { node = left ( node ) ; } else if ( cmp > 0 ) { node = right ( node ) ; } else { return node ; } } return NIL ; } | Find a node in this tree . |
27,945 | public void remove ( int node ) { if ( node == NIL ) { throw new IllegalArgumentException ( ) ; } if ( left ( node ) != NIL && right ( node ) != NIL ) { final int next = next ( node ) ; assert next != NIL ; swap ( node , next ) ; } assert left ( node ) == NIL || right ( node ) == NIL ; final int parent = parent ( node ... | Remove the specified node from the tree . |
27,946 | public String getMessageId ( ) { Object messageId = getHeader ( JmsMessageHeaders . MESSAGE_ID ) ; if ( messageId != null ) { return messageId . toString ( ) ; } return null ; } | Gets the JMS messageId header . |
27,947 | public String getCorrelationId ( ) { Object correlationId = getHeader ( JmsMessageHeaders . CORRELATION_ID ) ; if ( correlationId != null ) { return correlationId . toString ( ) ; } return null ; } | Gets the JMS correlationId header . |
27,948 | public Destination getReplyTo ( ) { Object replyTo = getHeader ( JmsMessageHeaders . REPLY_TO ) ; if ( replyTo != null ) { return ( Destination ) replyTo ; } return null ; } | Gets the JMS reply to header . |
27,949 | public String getRedelivered ( ) { Object redelivered = getHeader ( JmsMessageHeaders . REDELIVERED ) ; if ( redelivered != null ) { return redelivered . toString ( ) ; } return null ; } | Gets the JMS redelivered header . |
27,950 | public String getType ( ) { Object type = getHeader ( JmsMessageHeaders . TYPE ) ; if ( type != null ) { return type . toString ( ) ; } return null ; } | Gets the JMS type header . |
27,951 | private void performSchemaValidation ( Message receivedMessage , JsonMessageValidationContext validationContext ) { log . debug ( "Starting Json schema validation ..." ) ; ProcessingReport report = jsonSchemaValidation . validate ( receivedMessage , schemaRepositories , validationContext , applicationContext ) ; if ( !... | Performs the schema validation for the given message under consideration of the given validation context |
27,952 | private String constructErrorMessage ( ProcessingReport report ) { StringBuilder stringBuilder = new StringBuilder ( ) ; stringBuilder . append ( "Json validation failed: " ) ; report . forEach ( processingMessage -> stringBuilder . append ( processingMessage . getMessage ( ) ) ) ; return stringBuilder . toString ( ) ;... | Constructs the error message of a failed validation based on the processing report passed from com . github . fge . jsonschema . core . report |
27,953 | public static boolean isSpringInternalHeader ( String headerName ) { if ( headerName . startsWith ( "springintegration_" ) ) { return true ; } else if ( headerName . equals ( MessageHeaders . ID ) ) { return true ; } else if ( headerName . equals ( MessageHeaders . TIMESTAMP ) ) { return true ; } else if ( headerName .... | Check if given header name belongs to Spring Integration internal headers . |
27,954 | public static SoapAttachment parseAttachment ( Element attachmentElement ) { SoapAttachment soapAttachment = new SoapAttachment ( ) ; if ( attachmentElement . hasAttribute ( "content-id" ) ) { soapAttachment . setContentId ( attachmentElement . getAttribute ( "content-id" ) ) ; } if ( attachmentElement . hasAttribute (... | Parse the attachment element with all children and attributes . |
27,955 | public ObjectName createObjectName ( ) { try { if ( StringUtils . hasText ( objectName ) ) { return new ObjectName ( objectDomain + ":" + objectName ) ; } if ( type != null ) { if ( StringUtils . hasText ( objectDomain ) ) { return new ObjectName ( objectDomain , "type" , type . getSimpleName ( ) ) ; } return new Objec... | Constructs proper object name either from given domain and name property or by evaluating the mbean type class information . |
27,956 | public MBeanInfo createMBeanInfo ( ) { if ( type != null ) { return new MBeanInfo ( type . getName ( ) , description , getAttributeInfo ( ) , getConstructorInfo ( ) , getOperationInfo ( ) , getNotificationInfo ( ) ) ; } else { return new MBeanInfo ( name , description , getAttributeInfo ( ) , getConstructorInfo ( ) , g... | Create managed bean info with all constructors operations notifications and attributes . |
27,957 | private MBeanOperationInfo [ ] getOperationInfo ( ) { final List < MBeanOperationInfo > infoList = new ArrayList < > ( ) ; if ( type != null ) { ReflectionUtils . doWithMethods ( type , new ReflectionUtils . MethodCallback ( ) { public void doWith ( Method method ) throws IllegalArgumentException , IllegalAccessExcepti... | Create this managed bean operations info . |
27,958 | private MBeanConstructorInfo [ ] getConstructorInfo ( ) { final List < MBeanConstructorInfo > infoList = new ArrayList < > ( ) ; if ( type != null ) { for ( Constructor constructor : type . getConstructors ( ) ) { infoList . add ( new MBeanConstructorInfo ( constructor . toGenericString ( ) , constructor ) ) ; } } retu... | Create this managed bean constructor info . |
27,959 | private MBeanAttributeInfo [ ] getAttributeInfo ( ) { final List < MBeanAttributeInfo > infoList = new ArrayList < > ( ) ; if ( type != null ) { final List < String > attributes = new ArrayList < > ( ) ; if ( type . isInterface ( ) ) { ReflectionUtils . doWithMethods ( type , new ReflectionUtils . MethodCallback ( ) { ... | Create this managed bean attributes info . |
27,960 | public void finish ( ) throws IOException { if ( printWriter != null ) { printWriter . close ( ) ; } if ( outputStream != null ) { outputStream . close ( ) ; } } | Finish response stream by closing . |
27,961 | public void postRegisterUrlHandlers ( Map < String , Object > wsHandlers ) { registerHandlers ( wsHandlers ) ; for ( Object handler : wsHandlers . values ( ) ) { if ( handler instanceof Lifecycle ) { ( ( Lifecycle ) handler ) . start ( ) ; } } } | Workaround for registering the WebSocket request handlers after the spring context has been initialised . |
27,962 | public AbstractMessageContentBuilder constructMessageBuilder ( Element messageElement ) { AbstractMessageContentBuilder messageBuilder = null ; if ( messageElement != null ) { messageBuilder = parsePayloadTemplateBuilder ( messageElement ) ; if ( messageBuilder == null ) { messageBuilder = parseScriptBuilder ( messageE... | Static parse method taking care of basic message element parsing . |
27,963 | private PayloadTemplateMessageBuilder parsePayloadTemplateBuilder ( Element messageElement ) { PayloadTemplateMessageBuilder messageBuilder ; messageBuilder = parsePayloadElement ( messageElement ) ; Element xmlDataElement = DomUtils . getChildElementByTagName ( messageElement , "data" ) ; if ( xmlDataElement != null )... | Parses message payload template information given in message element . |
27,964 | protected void parseHeaderElements ( Element actionElement , AbstractMessageContentBuilder messageBuilder , List < ValidationContext > validationContexts ) { Element headerElement = DomUtils . getChildElementByTagName ( actionElement , "header" ) ; Map < String , Object > messageHeaders = new LinkedHashMap < > ( ) ; if... | Parse message header elements in action and add headers to message content builder . |
27,965 | protected void parseExtractHeaderElements ( Element element , List < VariableExtractor > variableExtractors ) { Element extractElement = DomUtils . getChildElementByTagName ( element , "extract" ) ; Map < String , String > extractHeaderValues = new HashMap < > ( ) ; if ( extractElement != null ) { List < ? > headerValu... | Parses header extract information . |
27,966 | public String build ( ) { StringBuilder scriptBuilder = new StringBuilder ( ) ; StringBuilder scriptBody = new StringBuilder ( ) ; String importStmt = "import " ; try { if ( scriptCode . contains ( importStmt ) ) { BufferedReader reader = new BufferedReader ( new StringReader ( scriptCode ) ) ; String line ; while ( ( ... | Builds the final script . |
27,967 | public static TemplateBasedScriptBuilder fromTemplateResource ( Resource scriptTemplateResource ) { try { return new TemplateBasedScriptBuilder ( FileUtils . readToString ( scriptTemplateResource . getInputStream ( ) ) ) ; } catch ( IOException e ) { throw new CitrusRuntimeException ( "Error loading script template fro... | Static construction method returning a fully qualified instance of this builder . |
27,968 | private ResponseEntity < ? > handleRequestInternal ( HttpMethod method , HttpEntity < ? > requestEntity ) { HttpMessage request = endpointConfiguration . getMessageConverter ( ) . convertInbound ( requestEntity , endpointConfiguration , null ) ; HttpServletRequest servletRequest = ( ( ServletRequestAttributes ) Request... | Handles requests with endpoint adapter implementation . Previously sets Http request method as header parameter . |
27,969 | public Message buildMessageContent ( final TestContext context , final String messageType , final MessageDirection direction ) { final Object payload = buildMessagePayload ( context , messageType ) ; try { Message message = new DefaultMessage ( payload , buildMessageHeaders ( context , messageType ) ) ; message . setNa... | Constructs the control message with headers and payload coming from subclass implementation . |
27,970 | public Map < String , Object > buildMessageHeaders ( final TestContext context , final String messageType ) { try { final Map < String , Object > headers = context . resolveDynamicValuesInMap ( messageHeaders ) ; headers . put ( MessageHeaders . MESSAGE_TYPE , messageType ) ; for ( final Map . Entry < String , Object >... | Build message headers . |
27,971 | public List < String > buildMessageHeaderData ( final TestContext context ) { final List < String > headerDataList = new ArrayList < > ( ) ; for ( final String headerResourcePath : headerResources ) { try { headerDataList . add ( context . replaceDynamicContentInString ( FileUtils . readToString ( FileUtils . getFileRe... | Build message header data . |
27,972 | public SoapServerFaultResponseActionBuilder attachment ( String contentId , String contentType , String content ) { SoapAttachment attachment = new SoapAttachment ( ) ; attachment . setContentId ( contentId ) ; attachment . setContentType ( contentType ) ; attachment . setContent ( content ) ; getAction ( ) . getAttach... | Sets the attachment with string content . |
27,973 | public SoapServerFaultResponseActionBuilder charset ( String charsetName ) { if ( ! getAction ( ) . getAttachments ( ) . isEmpty ( ) ) { getAction ( ) . getAttachments ( ) . get ( getAction ( ) . getAttachments ( ) . size ( ) - 1 ) . setCharsetName ( charsetName ) ; } return this ; } | Sets the charset name for this send action builder s attachment . |
27,974 | public SoapServerFaultResponseActionBuilder faultDetailResource ( Resource resource , Charset charset ) { try { getAction ( ) . getFaultDetails ( ) . add ( FileUtils . readToString ( resource , charset ) ) ; } catch ( IOException e ) { throw new CitrusRuntimeException ( "Failed to read fault detail resource" , e ) ; } ... | Adds a fault detail from file resource . |
27,975 | public static CitrusConfiguration from ( Properties extensionProperties ) { CitrusConfiguration configuration = new CitrusConfiguration ( extensionProperties ) ; configuration . setCitrusVersion ( getProperty ( extensionProperties , "citrusVersion" ) ) ; if ( extensionProperties . containsKey ( "autoPackage" ) ) { conf... | Constructs Citrus configuration instance from given property set . |
27,976 | private static String getProperty ( Properties extensionProperties , String propertyName ) { if ( extensionProperties . containsKey ( propertyName ) ) { Object value = extensionProperties . get ( propertyName ) ; if ( value != null ) { return value . toString ( ) ; } } return null ; } | Try to read property from property set . When not set or null value return null else return String representation of value object . |
27,977 | private static Properties readPropertiesFromDescriptor ( ArquillianDescriptor descriptor ) { for ( ExtensionDef extension : descriptor . getExtensions ( ) ) { if ( CitrusExtensionConstants . CITRUS_EXTENSION_QUALIFIER . equals ( extension . getExtensionName ( ) ) ) { Properties properties = new Properties ( ) ; propert... | Find Citrus extension configuration in descriptor and read properties . |
27,978 | protected Resource loadSchemaResources ( ) { PathMatchingResourcePatternResolver resourcePatternResolver = new PathMatchingResourcePatternResolver ( ) ; for ( String location : schemas ) { try { Resource [ ] findings = resourcePatternResolver . getResources ( location ) ; for ( Resource finding : findings ) { if ( find... | Loads all schema resource files from schema locations . |
27,979 | public boolean isLast ( ) { Object isLast = getHeader ( WebSocketMessageHeaders . WEB_SOCKET_IS_LAST ) ; if ( isLast != null ) { if ( isLast instanceof String ) { return Boolean . valueOf ( isLast . toString ( ) ) ; } else { return ( Boolean ) isLast ; } } return true ; } | Gets the isLast flag from message headers . |
27,980 | private OperationResult getOperationResult ( ) { if ( operationResult == null ) { this . operationResult = ( OperationResult ) marshaller . unmarshal ( new StringSource ( getPayload ( String . class ) ) ) ; } return operationResult ; } | Gets the operation result if any or tries to unmarshal String payload representation to an operation result model . |
27,981 | private Operation getOperation ( ) { if ( operation == null ) { this . operation = ( Operation ) marshaller . unmarshal ( new StringSource ( getPayload ( String . class ) ) ) ; } return operation ; } | Gets the operation if any or tries to unmarshal String payload representation to an operation model . |
27,982 | String getPayloadAsString ( Message < ? > message ) { if ( message . getPayload ( ) instanceof com . consol . citrus . message . Message ) { return ( ( com . consol . citrus . message . Message ) message . getPayload ( ) ) . getPayload ( String . class ) ; } else { return message . getPayload ( ) . toString ( ) ; } } | Reads message payload as String either from message object directly or from nested Citrus message representation . |
27,983 | protected boolean evaluate ( String value ) { if ( ValidationMatcherUtils . isValidationMatcherExpression ( matchingValue ) ) { try { ValidationMatcherUtils . resolveValidationMatcher ( selectKey , value , matchingValue , context ) ; return true ; } catch ( ValidationException e ) { return false ; } } else { return val... | Evaluates given value to match this selectors matching condition . Automatically supports validation matcher expressions . |
27,984 | protected FtpMessage createDir ( CommandType ftpCommand ) { try { sftp . mkdir ( ftpCommand . getArguments ( ) ) ; return FtpMessage . result ( FTPReply . PATHNAME_CREATED , "Pathname created" , true ) ; } catch ( SftpException e ) { throw new CitrusRuntimeException ( "Failed to execute ftp command" , e ) ; } } | Execute mkDir command and create new directory . |
27,985 | public LSParser createLSParser ( ) { LSParser parser = domImpl . createLSParser ( DOMImplementationLS . MODE_SYNCHRONOUS , null ) ; configureParser ( parser ) ; return parser ; } | Creates basic LSParser instance and sets common properties and configuration parameters . |
27,986 | protected void configureParser ( LSParser parser ) { for ( Map . Entry < String , Object > setting : parseSettings . entrySet ( ) ) { setParserConfigParameter ( parser , setting . getKey ( ) , setting . getValue ( ) ) ; } } | Set parser configuration based on this configurers settings . |
27,987 | protected void configureSerializer ( LSSerializer serializer ) { for ( Map . Entry < String , Object > setting : serializeSettings . entrySet ( ) ) { setSerializerConfigParameter ( serializer , setting . getKey ( ) , setting . getValue ( ) ) ; } } | Set serializer configuration based on this configurers settings . |
27,988 | private void setDefaultParseSettings ( ) { if ( ! parseSettings . containsKey ( CDATA_SECTIONS ) ) { parseSettings . put ( CDATA_SECTIONS , true ) ; } if ( ! parseSettings . containsKey ( SPLIT_CDATA_SECTIONS ) ) { parseSettings . put ( SPLIT_CDATA_SECTIONS , false ) ; } if ( ! parseSettings . containsKey ( VALIDATE_IF... | Sets the default parse settings . |
27,989 | private void setDefaultSerializeSettings ( ) { if ( ! serializeSettings . containsKey ( ELEMENT_CONTENT_WHITESPACE ) ) { serializeSettings . put ( ELEMENT_CONTENT_WHITESPACE , true ) ; } if ( ! serializeSettings . containsKey ( SPLIT_CDATA_SECTIONS ) ) { serializeSettings . put ( SPLIT_CDATA_SECTIONS , false ) ; } if (... | Sets the default serialize settings . |
27,990 | public void addPart ( AttachmentPart part ) { if ( attachments == null ) { attachments = new BodyPart . Attachments ( ) ; } this . attachments . add ( part ) ; } | Adds new attachment part . |
27,991 | public static String getBinding ( String resourcePath ) { if ( resourcePath . contains ( "/" ) ) { return resourcePath . substring ( resourcePath . indexOf ( '/' ) + 1 ) ; } return null ; } | Extract service binding information from endpoint resource path . This is usualle the path after the port specification . |
27,992 | public static String getHost ( String resourcePath ) { String hostSpec ; if ( resourcePath . contains ( ":" ) ) { hostSpec = resourcePath . split ( ":" ) [ 0 ] ; } else { hostSpec = resourcePath ; } if ( hostSpec . contains ( "/" ) ) { hostSpec = hostSpec . substring ( 0 , hostSpec . indexOf ( '/' ) ) ; } return hostSp... | Extract host name from resource path . |
27,993 | public static SoapAttachment from ( Attachment attachment ) { SoapAttachment soapAttachment = new SoapAttachment ( ) ; String contentId = attachment . getContentId ( ) ; if ( contentId . startsWith ( "<" ) && contentId . endsWith ( ">" ) ) { contentId = contentId . substring ( 1 , contentId . length ( ) - 1 ) ; } soapA... | Static construction method from Spring mime attachment . |
27,994 | public String getContent ( ) { if ( content != null ) { return context != null ? context . replaceDynamicContentInString ( content ) : content ; } else if ( StringUtils . hasText ( getContentResourcePath ( ) ) && getContentType ( ) . startsWith ( "text" ) ) { try { String fileContent = FileUtils . readToString ( new Pa... | Get the content body . |
27,995 | public String getContentResourcePath ( ) { if ( contentResourcePath != null && context != null ) { return context . replaceDynamicContentInString ( contentResourcePath ) ; } else { return contentResourcePath ; } } | Get the content file resource path . |
27,996 | public void extractVariables ( Message message , TestContext context ) { if ( CollectionUtils . isEmpty ( headerMappings ) ) { return ; } for ( Entry < String , String > entry : headerMappings . entrySet ( ) ) { String headerElementName = entry . getKey ( ) ; String targetVariableName = entry . getValue ( ) ; if ( mess... | Reads header information and saves new test variables . |
27,997 | public < T extends KubernetesCommand > T command ( T command ) { action . setCommand ( command ) ; return command ; } | Use a kubernetes command . |
27,998 | private Message receive ( TestContext context ) { Endpoint messageEndpoint = getOrCreateEndpoint ( context ) ; return receiveTimeout > 0 ? messageEndpoint . createConsumer ( ) . receive ( context , receiveTimeout ) : messageEndpoint . createConsumer ( ) . receive ( context , messageEndpoint . getEndpointConfiguration (... | Receives the message with respective message receiver implementation . |
27,999 | private Message receiveSelected ( TestContext context , String selectorString ) { if ( log . isDebugEnabled ( ) ) { log . debug ( "Setting message selector: '" + selectorString + "'" ) ; } Endpoint messageEndpoint = getOrCreateEndpoint ( context ) ; Consumer consumer = messageEndpoint . createConsumer ( ) ; if ( consum... | Receives the message with the respective message receiver implementation also using a message selector . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.