Skip to content

Commit

Permalink
restore some unitTest setting
Browse files Browse the repository at this point in the history
  • Loading branch information
brischan committed Aug 13, 2021
1 parent 19baca5 commit da9290d
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 12 deletions.
29 changes: 23 additions & 6 deletions QCloudCSharpSDK/COSXMLTests/ObjectTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1211,7 +1211,8 @@ public void TestDownloadTaskInteractive()
public void TestDownloadResumableTask()
{
//执行请求
GetObjectRequest getRequest = new GetObjectRequest(bucket, "exampleobject", localDir, "exampleobject");
GetObjectRequest getRequest = new GetObjectRequest(bucket, "bigObject1619585110", localDir, "bigObject1619585110");
getRequest.LimitTraffic(8 * 1024 * 1024);

COSXMLDownloadTask downloadTask = new COSXMLDownloadTask(getRequest);
downloadTask.SetResumableDownload(true);
Expand All @@ -1220,14 +1221,30 @@ public void TestDownloadResumableTask()
downloadTask.progressCallback = delegate (long completed, long total)
{
progrss = completed * 100.0 / total;
Console.WriteLine(String.Format("progress = {0:##.##}%", progrss));
// Console.WriteLine(String.Format("progress = {0:##.##}%", progrss));
};

Task<COSXML.Transfer.COSXMLDownloadTask.DownloadTaskResult> task = transferManager.DownloadAsync(downloadTask);
var asyncTask = transferManager.DownloadAsync(downloadTask);

Thread.Sleep(200);
Console.WriteLine(task.Result.GetResultInfo());
Assert.True(task.Result.IsSuccessful());
asyncTask = downloadTask.AsyncTask<COSXMLDownloadTask.DownloadTaskResult>();
asyncTask.Wait();

if (downloadTask.State() != TaskState.Completed && downloadTask.State() != TaskState.Failed)
{
Console.WriteLine("downloadTask.State() = " + downloadTask.State());
Console.WriteLine("localFileCrc64 = " + downloadTask.GetLocalFileCrc64());
if (progrss < 100)
{
downloadTask.Cancel();
}

Thread.Sleep(500);
}
else
{
Console.WriteLine("localFileCrc64 = " + downloadTask.GetLocalFileCrc64());
Thread.Sleep(500);
}
}

[Test()]
Expand Down
12 changes: 6 additions & 6 deletions QCloudCSharpSDK/COSXMLTests/QCloudServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,19 +48,19 @@ private QCloudServer()
QLog.SetLogLevel(Level.V);

uin = "3472213910";
appid = "1251668577";
appid = "1252246555";
bucketVersioning = "dotnet-ut-versioning-1252246555";
regionForBucketVersioning = "ap-beijing";
bucketForObjectTest = "examplebucket-0706-1251668577";
bucketForObjectTest = "dotnet-ut-obj-1252246555";
bucketForLoggingTarget = "dotnet-ut-logging-target-1252246555";
region = "ap-guangzhou";

secretId = Environment.GetEnvironmentVariable("SECRET_ID");
secretKey = Environment.GetEnvironmentVariable("SECRET_KEY");
secretId = Environment.GetEnvironmentVariable("COS_KEY");
secretKey = Environment.GetEnvironmentVariable("COS_SECRET");
if (secretId == null)
{
secretId = Environment.GetEnvironmentVariable("SECRET_ID", EnvironmentVariableTarget.Machine);
secretKey = Environment.GetEnvironmentVariable("SECRET_KEY", EnvironmentVariableTarget.Machine);
secretId = Environment.GetEnvironmentVariable("COS_KEY", EnvironmentVariableTarget.Machine);
secretKey = Environment.GetEnvironmentVariable("COS_SECRET", EnvironmentVariableTarget.Machine);
}

CosXmlConfig config = new CosXmlConfig.Builder()
Expand Down

0 comments on commit da9290d

Please sign in to comment.