Classes

  ClassDescription
Public classVCOverride
Class contains mock functions for testing higher level modules that depend on VcClient. User can override these functions to throw exceptions, return expected values. For more information see Override.
Public classVirtualJobManager
Creates a memory container for managing jobs in a format compatible with VCOverride. This class is not thread-safe.

Examples

General usage:
CopyC#
// Initialize jom manager
// 
VirtualJobManager jobManager = new VirtualJobManager();
VC.Override.Attach(jobManager);

try
{
    // Run tested method here, like
    // 
    JobInfo jobInfo = MyClass.SubmitReportJob();

    // Manipulate job status
    // 
    jobManager.StartJob(jobInfo.ID);

    // Run other tested method
    // 
    MyClass.CancelReportJobs(new JobInfo[] { jobInfo });

    ...
}
finally
{
    VC.Override.Clear();
}
Public classVirtualStreamManager
This class helps unit testing of modules that depend on VcClient.VC stream related functions. Instead of streams on remote server it creates files in local directory and overrides default API to emulate Cosmos workflow. This class is not thread-safe.

Examples

General usage:
CopyC#
// Initialize stream manager (using is required to destroy cosmos local directory after test)
// You can also consider to create this object once for test class.
// 
using (VirtualStreamManager streamManager = new VirtualStreamManager())
{
    VC.Override.Attach(streamManager);

    try
    {
        // Run tested method here, like
        // 
        MyClass.CreateReportSteams();

        // Manipulate streams
        // 
        streamManager.Delete("/my/stream");

        // Run other tested method
        // 
        MyClass.VerifyReportStreamsExist();

        ...
    }
    finally
    {
        VC.Override.Clear();
    }

    Assert.AreEqual(0, streamManager.OpenedStreams.Count);
}
Protected classVirtualStreamManager..::..ReadOnlyStream
Object represents a read only file stream that maps to original file part defined by offset and length parameters. Class was created to implement compartible Cosmos streams features.

Delegates

  DelegateDescription
Public delegateAppend
This function appends the given data in byte array to the specified stream. The append starts at the given streamFixedOffset in the destination stream. If the stream already contains data in the streamFixedOffset position and it is different from the data that is being appended, then this operation will fail.
Public delegateAppendFile
This function appends the given file to the specified stream. The data will be read from the local file starting at offset and the number of bits appended will be equal to length. The append starts at the given streamFixedOffset in the destination stream. If the stream already contains data in the streamFixedOffset position and it is different from the data that is being appended, then this operation will fail.
Public delegateCancelJob
This function deletes the job with a given job id.
Public delegateConcatenate
This function concatenates two given streams.
Public delegateCreate
This fuction creates a stream on the virtual cluster. It will also assign the expiration time for the stream.
Public delegateDelete
This function deletes the given stream.
Public delegateDeleteJob
This function deletes the job with a given job id.
Public delegateDownload
This function downloads a stream on the virtual cluster to the local machine. The download will start at the specified offset and copy "length" number of bits.
Public delegateEncode
This function encodes the given username with the given password.
Public delegateFindJobs
This function finds jobs based on a given set of finding parameters.
Public delegateFindJobsFile
Find qualified jobs and write response to output file.
Public delegateGetDataUploadProgress
Gets CDL v2 data upload progress metrics for a given day or hour.
Public delegateGetDirectoryInfo
This function gets the StreamInfo for a given directory.
Public delegateGetJobInfo
Gets the information about the job with a given job id.
Public delegateGetJobInfoByUrl
Gets the information about the job with a given job id.
Public delegateGetJobInfoFile
This function gets the information about the job with a given job id and writes it to the given file.
Public delegateGetJobsList
This function gets the list of jobs and their status etc. for the given VC name. It also filters the job list based on submittedBy, jobstate and submitDate.
Public delegateGetJobsListFile
This function generates an XML file containing the list of jobs and their status etc. for the given VC name. It also filters the job list based on submittedBy, jobstate and submitDate.
Public delegateGetJobStatistics
This function returns the JobStatistics object that contains statistical information about each stage. The object includes information about the number of vertices failed, succeeded, data read, etc.
Public delegateGetStreamInfo
Gets the StreamInfo for a stream.
Public delegateGetStreamSetInfo
This function gets the StreamInfo of each stream in the given streamset.
Public delegateGetVcList
Get a list of VCs in this cluster
Public delegateLogAppend
This appends the given data in the byte array to the log stream on the virtual cluster whose "key" and "value" match the key and value. hmKeyValue contains keyvalue pairs and the append operation will be performed for each keyvalue pair.
Public delegateLogAppendFile
This appends the data in the given file to the log stream on the virtual cluster whose "key" and "value" match the key and value. hmKeyValue contains keyvalue pairs and the append operation will be performed for each keyvalue pair.
Public delegateLogAppendWithArrayOffset
This appends the given data in the byte array to the log stream on the virtual cluster whose "key" and "value" match the key and value. hmKeyValue contains keyvalue pairs and the append operation will be performed for each keyvalue pair.
Public delegateNormalizeHttpPath
Gets the normalized version of the given HTTP path.
Public delegatePurge
This function purges the given stream.
Public delegateReadStream
This function reads a stream from the virtual cluster and returns a stream object. The stream will be read from the specified offset for the given length.
Public delegateRename
This function renames the given stream.
Public delegateRename2
This function renames the given stream.
Public delegateSealStream
Seals the last extent in a Cosmos stream. Seal happens automatically when calling AppendFile(), but if you are uploading using Append() you may want to call this when you know there will be no more data to upload.
Public delegateSetDefaultCredentials
This will use the logged in machine credential for all the authentication with virtual clusters. For example, if the windows machine running this library is running under PHX\johndoe, that will be the credential used for virtual cluster authentication. Using default credentials gives the advantage of not having to encode the user credentials. Also, you can set the virtual cluster name and proxy using the corresponding parameters.
Public delegateSetStreamExpirationTime
This function sets the expiration time for a given stream.
Public delegateSetStreamFlags
This function set stream flags to the corresponding value.
Public delegateSetup
Setup method allows the user to associate a VC name, proxy, and username with the VC and SCOPE static class. The settings will be used for all the future references to Scope and VC, unless it's modified. In case, only one of the parameters needs to be set, use null for other values. Also, note that everytime Setup is used, the previous setup will be overwritten.

Examples

Here are some of the usages of this function. In the following example, the VC and proxy are set. Note that,
CopyC#
VC.Setup("vc://cotest1/cosmosAdmin", null, "http://itgproxy");
In the following example, only the username is set.
CopyC#
VC.Setup(null, "PHX\Johndoe", null);
Public delegateStreamExists
This function checks if a given stream exists or not.
Public delegateSubmitAlgebraJob Obsolete.
Submitting a xmlAlgebra job
Public delegateSubmitCmdLineJob Obsolete.
Submitting a command line job
Public delegateSubmitJob
Submitting a job
Public delegateUpload
This function uploads the given byte array data to the vc.
Public delegateUploadFile
This function uploads the given file to the vc. The data will be read from the local file starting at offset and the number of bits appended will be equal to length.
Public delegateYieldJobByID
Yield job.
Public delegateYieldJobByUrl
Yield job.