idx
int64
0
41.2k
question
stringlengths
83
4.15k
target
stringlengths
5
715
27,700
public static PredicateExpression all ( Object ... rhs ) { PredicateExpression ex = new PredicateExpression ( "$all" , rhs ) ; if ( rhs . length == 1 ) { ex . single = true ; } return ex ; }
Matches an array value if it contains all the elements of the argument array
27,701
public ReplicationResult trigger ( ) { assertNotEmpty ( source , "Source" ) ; assertNotEmpty ( target , "Target" ) ; InputStream response = null ; try { JsonObject json = createJson ( ) ; if ( log . isLoggable ( Level . FINE ) ) { log . fine ( json . toString ( ) ) ; } final URI uri = new DatabaseURIHelper ( client . g...
Triggers a replication request .
27,702
public Replication targetOauth ( String consumerSecret , String consumerKey , String tokenSecret , String token ) { targetOauth = new JsonObject ( ) ; this . consumerSecret = consumerSecret ; this . consumerKey = consumerKey ; this . tokenSecret = tokenSecret ; this . token = token ; return this ; }
Authenticate with the target database using OAuth .
27,703
public static HttpConnection createPost ( URI uri , String body , String contentType ) { HttpConnection connection = Http . POST ( uri , "application/json" ) ; if ( body != null ) { setEntity ( connection , body , contentType ) ; } return connection ; }
create a HTTP POST request .
27,704
public static void setEntity ( HttpConnection connnection , String body , String contentType ) { connnection . requestProperties . put ( "Content-type" , contentType ) ; connnection . setRequestBody ( body ) ; }
Sets a JSON String as a request entity .
27,705
public < T > void setState ( HttpConnectionInterceptor interceptor , String stateName , T stateObjectToStore ) { Map < String , Object > state = interceptorStates . get ( interceptor ) ; if ( state == null ) { interceptorStates . put ( interceptor , ( state = new ConcurrentHashMap < String , Object > ( ) ) ) ; } state ...
Store some state on this request context associated with the specified interceptor instance . Used where a single interceptor instance needs to associate state with each HTTP request .
27,706
public < T > T getState ( HttpConnectionInterceptor interceptor , String stateName , Class < T > stateType ) { Map < String , Object > state = interceptorStates . get ( interceptor ) ; if ( state != null ) { return stateType . cast ( state . get ( stateName ) ) ; } else { return null ; } }
Retrieve the state object associated with the specified interceptor instance and property name on this request context .
27,707
public DesignDocument get ( String id ) { assertNotEmpty ( id , "id" ) ; return db . find ( DesignDocument . class , ensureDesignPrefix ( id ) ) ; }
Gets a design document from the database .
27,708
public DesignDocument get ( String id , String rev ) { assertNotEmpty ( id , "id" ) ; assertNotEmpty ( id , "rev" ) ; return db . find ( DesignDocument . class , ensureDesignPrefix ( id ) , rev ) ; }
Gets a design document using the id and revision from the database .
27,709
public Response remove ( String id ) { assertNotEmpty ( id , "id" ) ; id = ensureDesignPrefix ( id ) ; String revision = null ; revision = client . executeRequest ( Http . HEAD ( new DatabaseURIHelper ( db . getDBUri ( ) ) . documentUri ( id ) ) ) . getConnection ( ) . getHeaderField ( "ETag" ) ; if ( revision != null ...
Removes a design document from the database .
27,710
public Response remove ( String id , String rev ) { assertNotEmpty ( id , "id" ) ; assertNotEmpty ( id , "rev" ) ; return db . remove ( ensureDesignPrefix ( id ) , rev ) ; }
Removes a design document using the id and rev from the database .
27,711
public Response remove ( DesignDocument designDocument ) { assertNotEmpty ( designDocument , "DesignDocument" ) ; ensureDesignPrefixObject ( designDocument ) ; return db . remove ( designDocument ) ; }
Removes a design document using DesignDocument object from the database .
27,712
public List < DesignDocument > list ( ) throws IOException { return db . getAllDocsRequestBuilder ( ) . startKey ( "_design/" ) . endKey ( "_design0" ) . inclusiveEnd ( false ) . includeDocs ( true ) . build ( ) . getResponse ( ) . getDocsAs ( DesignDocument . class ) ; }
Performs a query to retrieve all the design documents defined in the database .
27,713
public static List < DesignDocument > fromDirectory ( File directory ) throws FileNotFoundException { List < DesignDocument > designDocuments = new ArrayList < DesignDocument > ( ) ; if ( directory . isDirectory ( ) ) { Collection < File > files = FileUtils . listFiles ( directory , null , true ) ; for ( File designDoc...
Deserialize a directory of javascript design documents to a List of DesignDocument objects .
27,714
public static DesignDocument fromFile ( File file ) throws FileNotFoundException { assertNotEmpty ( file , "Design js file" ) ; DesignDocument designDocument ; Gson gson = new Gson ( ) ; InputStreamReader reader = null ; try { reader = new InputStreamReader ( new FileInputStream ( file ) , "UTF-8" ) ; designDocument = ...
Deserialize a javascript design document file to a DesignDocument object .
27,715
static < K , V > ViewQueryParameters < K , V > forwardPaginationQueryParameters ( ViewQueryParameters < K , V > initialQueryParameters , K startkey , String startkey_docid ) { ViewQueryParameters < K , V > pageParameters = initialQueryParameters . copy ( ) ; pageParameters . setStartKey ( startkey ) ; pageParameters . ...
Generate query parameters for a forward page with the specified start key .
27,716
public static HttpConnection connect ( String requestMethod , URL url , String contentType ) { return new HttpConnection ( requestMethod , url , contentType ) ; }
low level http operations
27,717
public B partialFilterSelector ( Selector selector ) { instance . def . selector = Helpers . getJsonObjectFromSelector ( selector ) ; return returnThis ( ) ; }
Configure a selector to choose documents that should be added to the index .
27,718
protected B fields ( List < F > fields ) { if ( instance . def . fields == null ) { instance . def . fields = new ArrayList < F > ( fields . size ( ) ) ; } instance . def . fields . addAll ( fields ) ; return returnThis ( ) ; }
Add fields to the text index configuration .
27,719
public SchedulerDocsResponse . Doc schedulerDoc ( String docId ) { assertNotEmpty ( docId , "docId" ) ; return this . get ( new DatabaseURIHelper ( getBaseUri ( ) ) . path ( "_scheduler" ) . path ( "docs" ) . path ( "_replicator" ) . path ( docId ) . build ( ) , SchedulerDocsResponse . Doc . class ) ; }
Get replication document state for a given replication document ID .
27,720
public List < String > uuids ( long count ) { final URI uri = new URIBase ( clientUri ) . path ( "_uuids" ) . query ( "count" , count ) . build ( ) ; final JsonObject json = get ( uri , JsonObject . class ) ; return getGson ( ) . fromJson ( json . get ( "uuids" ) . toString ( ) , DeserializationTypes . STRINGS ) ; }
Request a database sends a list of UUIDs .
27,721
public Response executeToResponse ( HttpConnection connection ) { InputStream is = null ; try { is = this . executeToInputStream ( connection ) ; Response response = getResponse ( is , Response . class , getGson ( ) ) ; response . setStatusCode ( connection . getConnection ( ) . getResponseCode ( ) ) ; response . setRe...
Executes a HTTP request and parses the JSON response into a Response instance .
27,722
Response delete ( URI uri ) { HttpConnection connection = Http . DELETE ( uri ) ; return executeToResponse ( connection ) ; }
Performs a HTTP DELETE request .
27,723
public < T > T get ( URI uri , Class < T > classType ) { HttpConnection connection = Http . GET ( uri ) ; InputStream response = executeToInputStream ( connection ) ; try { return getResponse ( response , classType , getGson ( ) ) ; } finally { close ( response ) ; } }
Performs a HTTP GET request .
27,724
Response put ( URI uri , InputStream instream , String contentType ) { HttpConnection connection = Http . PUT ( uri , contentType ) ; connection . setRequestBody ( instream ) ; return executeToResponse ( connection ) ; }
Performs a HTTP PUT request saves an attachment .
27,725
public HttpConnection execute ( HttpConnection connection ) { connection . connectionFactory = factory ; connection . requestProperties . put ( "Accept" , "application/json" ) ; connection . responseInterceptors . addAll ( this . responseInterceptors ) ; connection . requestInterceptors . addAll ( this . requestInterce...
Execute a HTTP request and handle common error cases .
27,726
private static String loadUA ( ClassLoader loader , String filename ) { String ua = "cloudant-http" ; String version = "unknown" ; final InputStream propStream = loader . getResourceAsStream ( filename ) ; final Properties properties = new Properties ( ) ; try { if ( propStream != null ) { try { properties . load ( pro...
Loads the properties file using the classloader provided . Creating a string from the properties user . agent . name and user . agent . version .
27,727
private String getBearerToken ( HttpConnectionInterceptorContext context ) { final AtomicReference < String > iamTokenResponse = new AtomicReference < String > ( ) ; boolean result = super . requestCookie ( context , iamServerUrl , iamTokenRequestBody , "application/x-www-form-urlencoded" , "application/json" , new Sto...
get bearer token returned by IAM in JSON format
27,728
public QueryBuilder useIndex ( String designDocument , String indexName ) { useIndex = new String [ ] { designDocument , indexName } ; return this ; }
Instruct a query to use a specific index .
27,729
private static String quoteSort ( Sort [ ] sort ) { LinkedList < String > sorts = new LinkedList < String > ( ) ; for ( Sort pair : sort ) { sorts . add ( String . format ( "{%s: %s}" , Helpers . quote ( pair . getName ( ) ) , Helpers . quote ( pair . getOrder ( ) . toString ( ) ) ) ) ; } return sorts . toString ( ) ; ...
sorts are a bit more awkward and need a helper ...
27,730
public < K , V > MultipleRequestBuilder < K , V > newMultipleRequest ( Key . Type < K > keyType , Class < V > valueType ) { return new MultipleRequestBuilderImpl < K , V > ( newViewRequestParameters ( keyType . getType ( ) , valueType ) ) ; }
Create a new builder for multiple unpaginated requests on the view .
27,731
public < T > T find ( Class < T > classType , String id , String rev ) { assertNotEmpty ( classType , "Class" ) ; assertNotEmpty ( id , "id" ) ; assertNotEmpty ( id , "rev" ) ; final URI uri = new DatabaseURIHelper ( dbUri ) . documentUri ( id , "rev" , rev ) ; return couchDbClient . get ( uri , classType ) ; }
Finds an Object of the specified type .
27,732
public boolean contains ( String id ) { assertNotEmpty ( id , "id" ) ; InputStream response = null ; try { response = couchDbClient . head ( new DatabaseURIHelper ( dbUri ) . documentUri ( id ) ) ; } catch ( NoDocumentException e ) { return false ; } finally { close ( response ) ; } return true ; }
Checks if a document exist in the database .
27,733
public List < Response > bulk ( List < ? > objects , boolean allOrNothing ) { assertNotEmpty ( objects , "objects" ) ; InputStream responseStream = null ; HttpConnection connection ; try { final JsonObject jsonObject = new JsonObject ( ) ; if ( allOrNothing ) { jsonObject . addProperty ( "all_or_nothing" , true ) ; } f...
Performs a Bulk Documents insert request .
27,734
public < T > List < T > query ( String query , Class < T > classOfT ) { InputStream instream = null ; List < T > result = new ArrayList < T > ( ) ; try { Reader reader = new InputStreamReader ( instream = queryForStream ( query ) , "UTF-8" ) ; JsonObject json = new JsonParser ( ) . parse ( reader ) . getAsJsonObject ( ...
Queries a Search Index and returns ungrouped results . In case the query used grouping an empty list is returned
27,735
public < T > Map < String , List < T > > queryGroups ( String query , Class < T > classOfT ) { InputStream instream = null ; try { Reader reader = new InputStreamReader ( instream = queryForStream ( query ) , "UTF-8" ) ; JsonObject json = new JsonParser ( ) . parse ( reader ) . getAsJsonObject ( ) ; Map < String , List...
Queries a Search Index and returns grouped results in a map where key of the map is the groupName . In case the query didnt use grouping an empty map is returned
27,736
public Search groupField ( String fieldName , boolean isNumber ) { assertNotEmpty ( fieldName , "fieldName" ) ; if ( isNumber ) { databaseHelper . query ( "group_field" , fieldName + "<number>" ) ; } else { databaseHelper . query ( "group_field" , fieldName ) ; } return this ; }
Group results by the specified field .
27,737
public Search counts ( String [ ] countsfields ) { assert ( countsfields . length > 0 ) ; JsonArray countsJsonArray = new JsonArray ( ) ; for ( String countsfield : countsfields ) { JsonPrimitive element = new JsonPrimitive ( countsfield ) ; countsJsonArray . add ( element ) ; } databaseHelper . query ( "counts" , coun...
Array of fieldNames for which counts should be produced
27,738
public List < Index < Field > > allIndexes ( ) { List < Index < Field > > indexesOfAnyType = new ArrayList < Index < Field > > ( ) ; indexesOfAnyType . addAll ( listIndexType ( null , ListableIndex . class ) ) ; return indexesOfAnyType ; }
All the indexes defined in the database . Type widening means that the returned Index objects are limited to the name design document and type of the index and the names of the fields .
27,739
private < T extends Index > List < T > listIndexType ( String type , Class < T > modelType ) { List < T > indexesOfType = new ArrayList < T > ( ) ; Gson g = new Gson ( ) ; for ( JsonElement index : indexes ) { if ( index . isJsonObject ( ) ) { JsonObject indexDefinition = index . getAsJsonObject ( ) ; JsonElement index...
Utility to list indexes of a given type .
27,740
String encodePath ( String in ) { try { String encodedString = HierarchicalUriComponents . encodeUriComponent ( in , "UTF-8" , HierarchicalUriComponents . Type . PATH_SEGMENT ) ; if ( encodedString . startsWith ( _design_prefix_encoded ) || encodedString . startsWith ( _local_prefix_encoded ) ) { return encodedString ....
Encode a path in a manner suitable for a GET request
27,741
public URI build ( ) { try { String uriString = String . format ( "%s%s" , baseUri . toASCIIString ( ) , ( path . isEmpty ( ) ? "" : path ) ) ; if ( qParams != null && qParams . size ( ) > 0 ) { if ( ! completeQuery . isEmpty ( ) ) { uriString = String . format ( "%s?%s&%s" , uriString , getJoinedQuery ( qParams . getP...
Build and return the complete URI containing values such as the document ID attachment ID and query syntax .
27,742
public static ClientBuilder account ( String account ) { logger . config ( "Account: " + account ) ; return ClientBuilder . url ( convertStringToURL ( String . format ( "https://%s.cloudant.com" , account ) ) ) ; }
Constructs a new ClientBuilder for building a CloudantClient instance to connect to the Cloudant server with the specified account .
27,743
public HttpConnection setRequestBody ( final String input ) { try { final byte [ ] inputBytes = input . getBytes ( "UTF-8" ) ; return setRequestBody ( inputBytes ) ; } catch ( UnsupportedEncodingException e ) { throw new RuntimeException ( e ) ; } }
Set the String of request body data to be sent to the server .
27,744
public HttpConnection setRequestBody ( final InputStream input , final long inputLength ) { try { return setRequestBody ( new InputStreamWrappingGenerator ( input , inputLength ) , inputLength ) ; } catch ( IOException e ) { logger . log ( Level . SEVERE , "Error copying input stream for request body" , e ) ; throw new...
Set the InputStream of request body data of known length to be sent to the server .
27,745
private String getLogRequestIdentifier ( ) { if ( logIdentifier == null ) { logIdentifier = String . format ( "%s-%s %s %s" , Integer . toHexString ( hashCode ( ) ) , numberOfRetries , connection . getRequestMethod ( ) , connection . getURL ( ) ) ; } return logIdentifier ; }
Get a prefix for the log message to help identify which request is which and which responses belong to which requests .
27,746
private PGPSecretKey getSecretKey ( InputStream input , String keyId ) throws IOException , PGPException { PGPSecretKeyRingCollection keyrings = new PGPSecretKeyRingCollection ( PGPUtil . getDecoderStream ( input ) , new JcaKeyFingerprintCalculator ( ) ) ; Iterator rIt = keyrings . getKeyRings ( ) ; while ( rIt . hasNe...
Returns the secret key matching the specified identifier .
27,747
private String trim ( String line ) { char [ ] chars = line . toCharArray ( ) ; int len = chars . length ; while ( len > 0 ) { if ( ! Character . isWhitespace ( chars [ len - 1 ] ) ) { break ; } len -- ; } return line . substring ( 0 , len ) ; }
Trim the trailing spaces .
27,748
public void validate ( ) throws PackagingException { if ( control == null || ! control . isDirectory ( ) ) { throw new PackagingException ( "The 'control' attribute doesn't point to a directory. " + control ) ; } if ( changesIn != null ) { if ( changesIn . exists ( ) && ( ! changesIn . isFile ( ) || ! changesIn . canRe...
Validates the input parameters .
27,749
protected String getUserDefinedFieldName ( String field ) { int index = field . indexOf ( '-' ) ; char letter = getUserDefinedFieldLetter ( ) ; for ( int i = 0 ; i < index ; ++ i ) { if ( field . charAt ( i ) == letter ) { return field . substring ( index + 1 ) ; } } return null ; }
Returns the user defined field without its prefix .
27,750
public static String replaceVariables ( final VariableResolver pResolver , final String pExpression , final String pOpen , final String pClose ) { final char [ ] open = pOpen . toCharArray ( ) ; final char [ ] close = pClose . toCharArray ( ) ; final StringBuilder out = new StringBuilder ( ) ; StringBuilder sb = new St...
Substitute the variables in the given expression with the values from the resolver
27,751
public static byte [ ] toUnixLineEndings ( InputStream input ) throws IOException { String encoding = "ISO-8859-1" ; FixCrLfFilter filter = new FixCrLfFilter ( new InputStreamReader ( input , encoding ) ) ; filter . setEol ( FixCrLfFilter . CrLf . newInstance ( "unix" ) ) ; ByteArrayOutputStream filteredFile = new Byte...
Replaces new line delimiters in the input stream with the Unix line feed .
27,752
public static String movePath ( final String file , final String target ) { final String name = new File ( file ) . getName ( ) ; return target . endsWith ( "/" ) ? target + name : target + '/' + name ; }
Construct new path by replacing file directory part . No files are actually modified .
27,753
public static String lookupIfEmpty ( final String value , final Map < String , String > props , final String key ) { return value != null ? value : props . get ( key ) ; }
Extracts value from map if given value is null .
27,754
public static Collection < String > getKnownPGPSecureRingLocations ( ) { final LinkedHashSet < String > locations = new LinkedHashSet < String > ( ) ; final String os = System . getProperty ( "os.name" ) ; final boolean runOnWindows = os == null || os . toLowerCase ( ) . contains ( "win" ) ; if ( runOnWindows ) { final...
Get the known locations where the secure keyring can be located . Looks through known locations of the GNU PG secure keyring .
27,755
public static File guessKeyRingFile ( ) throws FileNotFoundException { final Collection < String > possibleLocations = getKnownPGPSecureRingLocations ( ) ; for ( final String location : possibleLocations ) { final File candidate = new File ( location ) ; if ( candidate . exists ( ) ) { return candidate ; } } final Stri...
Tries to guess location of the user secure keyring using various heuristics .
27,756
public static String defaultString ( final String str , final String fallback ) { return isNullOrEmpty ( str ) ? fallback : str ; }
Return fallback if first string is null or empty
27,757
static TarArchiveEntry defaultFileEntryWithName ( final String fileName ) { TarArchiveEntry entry = new TarArchiveEntry ( fileName , true ) ; entry . setUserId ( ROOT_UID ) ; entry . setUserName ( ROOT_NAME ) ; entry . setGroupId ( ROOT_UID ) ; entry . setGroupName ( ROOT_NAME ) ; entry . setMode ( TarArchiveEntry . DE...
Creates a tar file entry with defaults parameters .
27,758
static TarArchiveEntry defaultDirEntryWithName ( final String dirName ) { TarArchiveEntry entry = new TarArchiveEntry ( dirName , true ) ; entry . setUserId ( ROOT_UID ) ; entry . setUserName ( ROOT_NAME ) ; entry . setGroupId ( ROOT_UID ) ; entry . setGroupName ( ROOT_NAME ) ; entry . setMode ( TarArchiveEntry . DEFAU...
Creates a tar directory entry with defaults parameters .
27,759
static void produceInputStreamWithEntry ( final DataConsumer consumer , final InputStream inputStream , final TarArchiveEntry entry ) throws IOException { try { consumer . onEachFile ( inputStream , entry ) ; } finally { IOUtils . closeQuietly ( inputStream ) ; } }
Feeds input stream to data consumer using metadata from tar entry .
27,760
public String format ( String value ) { StringBuilder s = new StringBuilder ( ) ; if ( value != null && value . trim ( ) . length ( ) > 0 ) { boolean continuationLine = false ; s . append ( getName ( ) ) . append ( ":" ) ; if ( isFirstLineEmpty ( ) ) { s . append ( "\n" ) ; continuationLine = true ; } try { BufferedRea...
Returns the field with the specified value properly formatted . Multiline values are automatically indented and dots are added on the empty lines .
27,761
public void initialize ( BinaryPackageControlFile packageControlFile ) { set ( "Binary" , packageControlFile . get ( "Package" ) ) ; set ( "Source" , Utils . defaultString ( packageControlFile . get ( "Source" ) , packageControlFile . get ( "Package" ) ) ) ; set ( "Architecture" , packageControlFile . get ( "Architectu...
Initializes the fields on the changes file with the values of the specified binary package control file .
27,762
private void initializeSignProperties ( ) { if ( ! signPackage && ! signChanges ) { return ; } if ( key != null && keyring != null && passphrase != null ) { return ; } Map < String , String > properties = readPropertiesFromActiveProfiles ( signCfgPrefix , KEY , KEYRING , PASSPHRASE ) ; key = lookupIfEmpty ( key , prope...
Initializes unspecified sign properties using available defaults and global settings .
27,763
public Map < String , String > readPropertiesFromActiveProfiles ( final String prefix , final String ... properties ) { if ( settings == null ) { console . debug ( "No maven setting injected" ) ; return Collections . emptyMap ( ) ; } final List < String > activeProfilesList = settings . getActiveProfiles ( ) ; if ( act...
Read properties from the active profiles .
27,764
void buildControl ( BinaryPackageControlFile packageControlFile , File [ ] controlFiles , List < String > conffiles , StringBuilder checksums , File output ) throws IOException , ParseException { final File dir = output . getParentFile ( ) ; if ( dir != null && ( ! dir . exists ( ) || ! dir . isDirectory ( ) ) ) { thro...
Build control archive of the deb
27,765
public static String get ( String url , Map < String , String > customHeaders , Map < String , String > params ) throws URISyntaxException , IOException , HTTPException { LOGGER . log ( Level . INFO , "Sending GET request to the url {0}" , url ) ; URIBuilder uriBuilder = new URIBuilder ( url ) ; if ( params != null && ...
Send get request .
27,766
public static String post ( String url , Map < String , String > customHeaders , Map < String , String > params ) throws IOException , HTTPException { LOGGER . log ( Level . INFO , "Sending POST request to the url {0}" , url ) ; HttpPost httpPost = new HttpPost ( url ) ; populateHeaders ( httpPost , customHeaders ) ; i...
Send post request .
27,767
public T reverse ( ) { String id = getId ( ) ; String REVERSE = "_REVERSE" ; if ( id . endsWith ( REVERSE ) ) { setId ( id . substring ( 0 , id . length ( ) - REVERSE . length ( ) ) ) ; } float start = mStart ; float end = mEnd ; mStart = end ; mEnd = start ; mReverse = ! mReverse ; return self ( ) ; }
Reverse how the transition is applied such that the transition previously performed when progress = start of range is only performed when progress = end of range
27,768
public T transitFloat ( int propertyId , float ... vals ) { String property = getPropertyName ( propertyId ) ; mHolders . put ( propertyId , PropertyValuesHolder . ofFloat ( property , vals ) ) ; mShadowHolders . put ( propertyId , ShadowValuesHolder . ofFloat ( property , vals ) ) ; return self ( ) ; }
Transits a float propertyId from the start value to the end value .
27,769
public T transitInt ( int propertyId , int ... vals ) { String property = getPropertyName ( propertyId ) ; mHolders . put ( propertyId , PropertyValuesHolder . ofInt ( property , vals ) ) ; mShadowHolders . put ( propertyId , ShadowValuesHolder . ofInt ( property , vals ) ) ; return self ( ) ; }
Transits a float property from the start value to the end value .
27,770
public boolean isCompatible ( AbstractTransition another ) { if ( getClass ( ) . equals ( another . getClass ( ) ) && mTarget == another . mTarget && mReverse == another . mReverse && ( ( mInterpolator == null && another . mInterpolator == null ) || mInterpolator . getClass ( ) . equals ( another . mInterpolator . getC...
Checks to see if another AbstractTransition s states is isCompatible for merging .
27,771
public boolean merge ( AbstractTransition another ) { if ( ! isCompatible ( another ) ) { return false ; } if ( another . mId != null ) { if ( mId == null ) { mId = another . mId ; } else { StringBuilder sb = new StringBuilder ( mId . length ( ) + another . mId . length ( ) ) ; sb . append ( mId ) ; sb . append ( "_MER...
Merge another AbstractTransition s states into this object such that the other AbstractTransition can be discarded .
27,772
public void removeAllAnimations ( ) { for ( int i = 0 , size = mAnimationList . size ( ) ; i < size ; i ++ ) { mAnimationList . get ( i ) . removeAnimationListener ( mAnimationListener ) ; } mAnimationList . clear ( ) ; }
Stops and clears all transitions
27,773
public void stopTransition ( ) { for ( int i = 0 , size = mListenerList . size ( ) ; i < size ; i ++ ) { mListenerList . get ( i ) . onTransitionEnd ( this ) ; } for ( int i = 0 , size = mTransitionList . size ( ) ; i < size ; i ++ ) { mTransitionList . get ( i ) . stopTransition ( ) ; } }
Stops all transitions .
27,774
public void start ( ) { if ( TransitionConfig . isDebug ( ) ) { getTransitionStateHolder ( ) . start ( ) ; } mLastProgress = Float . MIN_VALUE ; TransitionController transitionController ; for ( int i = 0 , size = mTransitionControls . size ( ) ; i < size ; i ++ ) { transitionController = mTransitionControls . get ( i ...
Starts the transition
27,775
public void end ( ) { if ( TransitionConfig . isPrintDebug ( ) ) { getTransitionStateHolder ( ) . end ( ) ; getTransitionStateHolder ( ) . print ( ) ; } for ( int i = 0 , size = mTransitionControls . size ( ) ; i < size ; i ++ ) { mTransitionControls . get ( i ) . end ( ) ; } }
Ends the transition
27,776
public void reverse ( ) { for ( int i = 0 , size = mTransitionControls . size ( ) ; i < size ; i ++ ) { mTransitionControls . get ( i ) . reverse ( ) ; } }
Reverses all the TransitionControllers managed by this TransitionManager
27,777
private LoginContext getClientLoginContext ( ) throws LoginException { Configuration config = new Configuration ( ) { public AppConfigurationEntry [ ] getAppConfigurationEntry ( String name ) { Map < String , String > options = new HashMap < String , String > ( ) ; options . put ( "multi-threaded" , "true" ) ; options ...
Provides a RunAs client login context
27,778
public static void mainInternal ( String [ ] args ) throws Exception { Options options = new Options ( ) ; CmdLineParser parser = new CmdLineParser ( options ) ; try { parser . parseArgument ( args ) ; } catch ( CmdLineException e ) { helpScreen ( parser ) ; return ; } try { List < String > configs = new ArrayList < > ...
Entry point with no system exit
27,779
public static < T > T assertNull ( T value , String message ) { if ( value != null ) throw new IllegalStateException ( message ) ; return value ; }
Throws an IllegalStateException when the given value is not null .
27,780
public static < T > T assertNotNull ( T value , String message ) { if ( value == null ) throw new IllegalStateException ( message ) ; return value ; }
Throws an IllegalStateException when the given value is null .
27,781
public static Boolean assertTrue ( Boolean value , String message ) { if ( ! Boolean . valueOf ( value ) ) throw new IllegalStateException ( message ) ; return value ; }
Throws an IllegalStateException when the given value is not true .
27,782
public static Boolean assertFalse ( Boolean value , String message ) { if ( Boolean . valueOf ( value ) ) throw new IllegalStateException ( message ) ; return value ; }
Throws an IllegalStateException when the given value is not false .
27,783
public static < T > T assertNotNull ( T value , String name ) { if ( value == null ) throw new IllegalArgumentException ( "Null " + name ) ; return value ; }
Throws an IllegalArgumentException when the given value is null .
27,784
public static Boolean assertTrue ( Boolean value , String message ) { if ( ! Boolean . valueOf ( value ) ) throw new IllegalArgumentException ( message ) ; return value ; }
Throws an IllegalArgumentException when the given value is not true .
27,785
public static Boolean assertFalse ( Boolean value , String message ) { if ( Boolean . valueOf ( value ) ) throw new IllegalArgumentException ( message ) ; return value ; }
Throws an IllegalArgumentException when the given value is not false .
27,786
public void retrieveEngine ( ) throws GeneralSecurityException , IOException { if ( serverEngineFactory == null ) { return ; } engine = serverEngineFactory . retrieveHTTPServerEngine ( nurl . getPort ( ) ) ; if ( engine == null ) { engine = serverEngineFactory . getHTTPServerEngine ( nurl . getHost ( ) , nurl . getPort...
Post - configure retreival of server engine .
27,787
public void finalizeConfig ( ) { assert ! configFinalized ; try { retrieveEngine ( ) ; } catch ( Exception e ) { throw new RuntimeException ( e . getMessage ( ) , e ) ; } configFinalized = true ; }
This method is used to finalize the configuration after the configuration items have been set .
27,788
public File getStylesheetPath ( ) { String path = System . getProperty ( STYLESHEET_KEY ) ; return path == null ? null : new File ( path ) ; }
If a custom CSS file has been specified returns the path . Otherwise returns null .
27,789
private Collection < TestClassResults > flattenResults ( List < ISuite > suites ) { Map < IClass , TestClassResults > flattenedResults = new HashMap < IClass , TestClassResults > ( ) ; for ( ISuite suite : suites ) { for ( ISuiteResult suiteResult : suite . getResults ( ) . values ( ) ) { organiseByClass ( suiteResult ...
Flatten a list of test suite results into a collection of results grouped by test class . This method basically strips away the TestNG way of organising tests and arranges the results by test class .
27,790
private TestClassResults getResultsForClass ( Map < IClass , TestClassResults > flattenedResults , ITestResult testResult ) { TestClassResults resultsForClass = flattenedResults . get ( testResult . getTestClass ( ) ) ; if ( resultsForClass == null ) { resultsForClass = new TestClassResults ( testResult . getTestClass ...
Look - up the results data for a particular test class .
27,791
protected VelocityContext createContext ( ) { VelocityContext context = new VelocityContext ( ) ; context . put ( META_KEY , META ) ; context . put ( UTILS_KEY , UTILS ) ; context . put ( MESSAGES_KEY , MESSAGES ) ; return context ; }
Helper method that creates a Velocity context and initialises it with a reference to the ReportNG utils report metadata and localised messages .
27,792
protected void generateFile ( File file , String templateName , VelocityContext context ) throws Exception { Writer writer = new BufferedWriter ( new FileWriter ( file ) ) ; try { Velocity . mergeTemplate ( classpathPrefix + templateName , ENCODING , context , writer ) ; writer . flush ( ) ; } finally { writer . close ...
Generate the specified output file by merging the specified Velocity template with the supplied context .
27,793
protected void copyClasspathResource ( File outputDirectory , String resourceName , String targetFileName ) throws IOException { String resourcePath = classpathPrefix + resourceName ; InputStream resourceStream = getClass ( ) . getClassLoader ( ) . getResourceAsStream ( resourcePath ) ; copyStream ( outputDirectory , r...
Copy a single named resource from the classpath to the output directory .
27,794
protected void copyFile ( File outputDirectory , File sourceFile , String targetFileName ) throws IOException { InputStream fileStream = new FileInputStream ( sourceFile ) ; try { copyStream ( outputDirectory , fileStream , targetFileName ) ; } finally { fileStream . close ( ) ; } }
Copy a single named file to the output directory .
27,795
protected void copyStream ( File outputDirectory , InputStream stream , String targetFileName ) throws IOException { File resourceFile = new File ( outputDirectory , targetFileName ) ; BufferedReader reader = null ; Writer writer = null ; try { reader = new BufferedReader ( new InputStreamReader ( stream , ENCODING ) )...
Helper method to copy the contents of a stream to a file .
27,796
protected void removeEmptyDirectories ( File outputDirectory ) { if ( outputDirectory . exists ( ) ) { for ( File file : outputDirectory . listFiles ( new EmptyDirectoryFilter ( ) ) ) { file . delete ( ) ; } } }
Deletes any empty directories under the output directory . These directories are created by TestNG for its own reports regardless of whether those reports are generated . If you are using the default TestNG reports as well as ReportNG these directories will not be empty and will be retained . Otherwise they will be rem...
27,797
public void generateReport ( List < XmlSuite > xmlSuites , List < ISuite > suites , String outputDirectoryName ) { removeEmptyDirectories ( new File ( outputDirectoryName ) ) ; boolean useFrames = System . getProperty ( FRAMES_PROPERTY , "true" ) . equals ( "true" ) ; boolean onlyFailures = System . getProperty ( ONLY_...
Generates a set of HTML files that contain data about the outcome of the specified test suites .
27,798
private void createFrameset ( File outputDirectory ) throws Exception { VelocityContext context = createContext ( ) ; generateFile ( new File ( outputDirectory , INDEX_FILE ) , INDEX_FILE + TEMPLATE_EXTENSION , context ) ; }
Create the index file that sets up the frameset .
27,799
private void createSuiteList ( List < ISuite > suites , File outputDirectory , boolean onlyFailures ) throws Exception { VelocityContext context = createContext ( ) ; context . put ( SUITES_KEY , suites ) ; context . put ( ONLY_FAILURES_KEY , onlyFailures ) ; generateFile ( new File ( outputDirectory , SUITES_FILE ) , ...
Create the navigation frame .