Skip to content

Commit

Permalink
update sdk to Marquis PFR Indexer v3.1.0.381
Browse files Browse the repository at this point in the history
  • Loading branch information
Sharon Shabtai committed Jan 10, 2017
1 parent 7808adc commit 3b209d1
Show file tree
Hide file tree
Showing 8 changed files with 55 additions and 11 deletions.
5 changes: 5 additions & 0 deletions TpfrClient/Model/IndexStatus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
* ****************************************************************************
*/

using System;

namespace TpfrClient.Model
{
public class IndexStatus
Expand All @@ -22,6 +24,9 @@ public class IndexStatus
public string FileStartTc { get; set; }
public string FileDuration { get; set; }
public string FileFrameRate { get; set; }
public string ErrorCode { get; set; }
public string ErrorMessage { get; set; }

}

public enum IndexResult
Expand Down
2 changes: 2 additions & 0 deletions TpfrClient/Model/ReWrapStatus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ public class ReWrapStatus
public string Error { get; set; }
public Phase? Phase { get; set; }
public string Percentcomplete { get; set; }
public string ErrorCode { get; set; }
public string ErrorMessage { get; set; }
}

public enum Phase
Expand Down
4 changes: 3 additions & 1 deletion TpfrClient/ResponseParsers/IndexResponseParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ public IndexStatus Parse(IHttpWebResponse response)
IndexTime = element.AttributeTextOrNull("IndexTime"),
FileStartTc = element.AttributeTextOrNull("FileStartTC"),
FileDuration = element.AttributeTextOrNull("FileDuration"),
FileFrameRate = element.AttributeTextOrNull("FileFrameRate")
FileFrameRate = element.AttributeTextOrNull("FileFrameRate"),
ErrorCode = element.AttributeTextOrNull("errorCode"),
ErrorMessage = element.AttributeTextOrNull("errorStr")
};
}
}
Expand Down
2 changes: 2 additions & 0 deletions TpfrClient/ResponseParsers/ReWrapStatusResponseParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ public ReWrapStatus Parse(IHttpWebResponse response)
Phase = ResponseParseUtils.GetPhaseResult(element.AttributeTextOrNull("phase")),
Percentcomplete = element.AttributeTextOrNull("percentcomplete"),
Error = element.AttributeTextOrNull("error"),
ErrorCode = element.AttributeTextOrNull("errorCode"),
ErrorMessage = element.AttributeTextOrNull("errorStr")
};
}
}
Expand Down
33 changes: 31 additions & 2 deletions TpfrClientIntegrationTest/TpfrClientIntegrationTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ public void TestFailedFileIndex()
{
var status = _client.IndexFile(new IndexFileRequest($"{_path}error.mov"));
Assert.AreEqual(IndexResult.Failed, status.IndexResult);
Assert.AreEqual("-2132778994", status.ErrorCode);
Assert.AreEqual(@"Failed to parse MOV file [\\ISV_RETROSPECT1\Share\error.mov] Error [Source could not be opened.]", status.ErrorMessage);
}

[Test]
Expand Down Expand Up @@ -108,13 +110,23 @@ public void TestQuestionTimecodeFileNotFound()
[Test]
public void TestReWrap()
{
var firstFrame = new TimeCode("00:00:00:00");
var lastFrame = new TimeCode("00:00:10:00");
var firstFrame = new TimeCode("01:00:00;00");
var lastFrame = new TimeCode("01:00:10;00");
var response = _client.ReWrap(new ReWrapRequest($"{_path}sample.mov", firstFrame, lastFrame, "29.97",
$"{_path}sample_10sec.mov", "sampleRestore"));
Assert.AreEqual(ReWrapResult.Succeeded, response.Result);
}

[Test]
public void TestReWrapWithBadRestoreFile()
{
var firstFrame = new TimeCode("00:00:00;00");
var lastFrame = new TimeCode("00:00:10;00");
var response = _client.ReWrap(new ReWrapRequest($"{_path}sample.mov", firstFrame, lastFrame, "29.97",
$"{_path}Sample_10sec.mov", "errorSampleRestore"));
Assert.AreEqual(ReWrapResult.Succeeded, response.Result);
}

[Test]
public void TestReWrapErrorBadFramerate()
{
Expand All @@ -132,5 +144,22 @@ public void TestReWrapStatus()
var reWrapStatus = _client.ReWrapStatus(new ReWrapStatusRequest("sampleRestore"));
Assert.AreEqual(Phase.Complete, reWrapStatus.Phase);
}

[Test]
public void TestReWrapStatusError()
{
var reWrapStatus = _client.ReWrapStatus(new ReWrapStatusRequest("errorSampleRestore"));
Assert.AreEqual(Phase.Failed, reWrapStatus.Phase);
Assert.AreEqual("0", reWrapStatus.Percentcomplete);
Assert.AreEqual("Requested subclip out of bounds.", reWrapStatus.ErrorMessage);
}

[Test]
public void TestReWrapStatusJobNotFound()
{
var reWrapStatus = _client.ReWrapStatus(new ReWrapStatusRequest("notFound"));
Assert.AreEqual(null, reWrapStatus.Phase);
Assert.AreEqual("Job not found", reWrapStatus.Error);
}
}
}
2 changes: 1 addition & 1 deletion TpfrClientTest/TestFiles/FailedToIndex.xml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
<?xml version="1.0" encoding="utf-8" ?>
<IndexerReport IndexResult="Failed" IndexTime="2011/10/21 15:30:15"/>
<IndexerReport IndexResult="Failed" IndexTime="2011/10/21 15:30:15" errorCode="400" errorStr="Failed to index"/>
2 changes: 1 addition & 1 deletion TpfrClientTest/TestFiles/JobFailed.xml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
<?xml version="1.0" encoding="utf-8" ?>
<partialfilestatus phase="Failed" percentcomplete="0"/>
<partialfilestatus phase="Failed" percentcomplete="0" errorCode="-2132778983" errorStr="Failed to create file"/>
16 changes: 10 additions & 6 deletions TpfrClientTest/TpfrClientTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@ public class TpfrClientTest

private static readonly object[] ReWrapStatusObjects =
{
new object[] {"JobPending.xml", Phase.Pending, "0"},
new object[] {"JobParsing.xml", Phase.Parsing, "25"},
new object[] {"JobTransferring.xml", Phase.Transferring, "50"},
new object[] {"JobComplete.xml", Phase.Complete, "100"},
new object[] {"JobFailed.xml", Phase.Failed, "0"}
new object[] {"JobPending.xml", Phase.Pending, "0", null, null},
new object[] {"JobParsing.xml", Phase.Parsing, "25", null, null},
new object[] {"JobTransferring.xml", Phase.Transferring, "50", null, null},
new object[] {"JobComplete.xml", Phase.Complete, "100", null, null},
new object[] {"JobFailed.xml", Phase.Failed, "0", "-2132778983", "Failed to create file" }
};

[Test]
Expand All @@ -85,7 +85,7 @@ public void TesReWrapError()

[Test]
[TestCaseSource(nameof(ReWrapStatusObjects))]
public void TesReWrapStatus(string xmlFile, Phase phase, string percentComplete)
public void TesReWrapStatus(string xmlFile, Phase phase, string percentComplete, string errorCode, string errorMessage)
{
var mockNetwork = new Mock<INetwork>(MockBehavior.Strict);
mockNetwork
Expand All @@ -97,6 +97,8 @@ public void TesReWrapStatus(string xmlFile, Phase phase, string percentComplete)

Assert.AreEqual(phase, status.Phase);
Assert.AreEqual(percentComplete, status.Percentcomplete);
Assert.AreEqual(errorCode, status.ErrorCode);
Assert.AreEqual(errorMessage, status.ErrorMessage);

mockNetwork.VerifyAll();
}
Expand All @@ -121,6 +123,8 @@ public void TestFailedIndexFile()

Assert.AreEqual(IndexResult.Failed, status.IndexResult);
Assert.AreEqual("2011/10/21 15:30:15", status.IndexTime);
Assert.AreEqual("400", status.ErrorCode);
Assert.AreEqual("Failed to index", status.ErrorMessage);

mockNetwork.VerifyAll();
}
Expand Down

0 comments on commit 3b209d1

Please sign in to comment.