Skip to content

Commit

Permalink
Merge pull request Azure#30 from jcookems/fix622
Browse files Browse the repository at this point in the history
Replace "magic" ids with a named constant
  • Loading branch information
jcookems committed Jan 16, 2013
2 parents 9f2a739 + fdfdaed commit f6e6b72
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ public void canGetParentBackFromAsset() throws ServiceException, InterruptedExce

String jobName = testJobPrefix + "createJobSuccess";
CreateBatchOperation taskCreator = Task
.create("nb:mpid:UUID:2f381738-c504-4e4a-a38e-d199e207fcd5",
.create(MEDIA_ENCODER_MEDIA_PROCESSOR_2_2_0_0_ID,
"<taskBody>" + "<inputAsset>JobInputAsset(0)</inputAsset>"
+ "<outputAsset>JobOutputAsset(0)</outputAsset>" + "</taskBody>")
.setConfiguration("H.264 256k DSL CBR").setName("My encoding Task");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ public abstract class IntegrationTestBase {
protected static final String validButNonexistAccessPolicyId = "nb:pid:UUID:38dcb3a0-ef64-4ad0-bbb5-67a14c6df2f7";
protected static final String validButNonexistLocatorId = "nb:lid:UUID:92a70402-fca9-4aa3-80d7-d4de3792a27a";

protected static final String MEDIA_ENCODER_MEDIA_PROCESSOR_2_2_0_0_ID = "nb:mpid:UUID:70bdc2c3-ebf4-42a9-8542-5afc1e55d217";

protected static final String invalidId = "notAValidId";

@Rule
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ private JobInfo createJob(String name) throws ServiceException {

private CreateBatchOperation getTaskCreator(int outputAssetPosition) {
return Task
.create("nb:mpid:UUID:2f381738-c504-4e4a-a38e-d199e207fcd5",
.create(MEDIA_ENCODER_MEDIA_PROCESSOR_2_2_0_0_ID,
"<taskBody>" + "<inputAsset>JobInputAsset(0)</inputAsset>" + "<outputAsset>JobOutputAsset("
+ outputAssetPosition + ")</outputAsset>" + "</taskBody>")
.setConfiguration("H.264 256k DSL CBR").setName("My encoding Task");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ public class TaskIntegrationTest extends IntegrationTestBase {
private static AssetInfo assetInfo;
private Creator jobCreator;

private static final String commonMediaProcessorId = "nb:mpid:UUID:2f381738-c504-4e4a-a38e-d199e207fcd5";
private static final String commonConfiguration = "H.264 256k DSL CBR";

@BeforeClass
Expand All @@ -66,7 +65,7 @@ public void createTaskSuccess() throws ServiceException, UnsupportedEncodingExce
// Arrange

// Required
String mediaProcessorId = commonMediaProcessorId;
String mediaProcessorId = MEDIA_ENCODER_MEDIA_PROCESSOR_2_2_0_0_ID;
String taskBody = constructTaskBody(0);

// Optional parameters
Expand Down Expand Up @@ -102,7 +101,7 @@ public void createTwoTasksSuccess() throws ServiceException {
// Arrange

// Required
String mediaProcessorId = commonMediaProcessorId;
String mediaProcessorId = MEDIA_ENCODER_MEDIA_PROCESSOR_2_2_0_0_ID;
String[] taskBodies = new String[] { constructTaskBody(0), constructTaskBody(1) };

// Optional parameters
Expand Down Expand Up @@ -136,7 +135,7 @@ public void createTwoTasksSuccess() throws ServiceException {
@Test
public void canListTasksWithOptions() throws ServiceException {
// Arrange
String mediaProcessorId = commonMediaProcessorId;
String mediaProcessorId = MEDIA_ENCODER_MEDIA_PROCESSOR_2_2_0_0_ID;
String configuration = commonConfiguration;
String[] taskNameSuffixes = new String[] { "A", "B", "C", "D" };
String baseName = "My encoding Task " + UUID.randomUUID().toString();
Expand All @@ -163,7 +162,7 @@ public void canListTasksWithOptions() throws ServiceException {
@Test
public void cancelTaskSuccess() throws ServiceException, InterruptedException {
// Arrange
String mediaProcessorId = commonMediaProcessorId;
String mediaProcessorId = MEDIA_ENCODER_MEDIA_PROCESSOR_2_2_0_0_ID;
String taskBody = constructTaskBody(0);
String configuration = commonConfiguration;
String name = "My encoding Task " + UUID.randomUUID().toString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -313,15 +313,15 @@ public Task.CreateBatchOperation createTaskOptions(String taskName, int inputAss
String configuration = null;
switch (encoderType) {
case Mp4ToSmoothStream:
processor = getMediaProcessorIdByName(MEDIA_PROCESSOR_MP4_TO_SMOOTH_STREAMS, "2.1.0.0");
processor = getMediaProcessorIdByName(MEDIA_PROCESSOR_MP4_TO_SMOOTH_STREAMS, "2.2.0.0");
configuration = configMp4ToSmoothStreams;
break;
case SmoothStreamsToHls:
processor = getMediaProcessorIdByName(MEDIA_PROCESSOR_SMOOTH_STREAMS_TO_HLS, "2.1.0.0");
processor = getMediaProcessorIdByName(MEDIA_PROCESSOR_SMOOTH_STREAMS_TO_HLS, "2.2.0.0");
configuration = configSmoothStreamsToAppleHttpLiveStreams;
break;
case WindowsAzureMediaEncoder:
processor = getMediaProcessorIdByName(MEDIA_PROCESSOR_WINDOWS_AZURE_MEDIA_ENCODER, "2.1.1.0");
processor = getMediaProcessorIdByName(MEDIA_PROCESSOR_WINDOWS_AZURE_MEDIA_ENCODER, "2.2.0.0");
// Full list of configurations strings for version 2.1 is at:
// http://msdn.microsoft.com/en-us/library/jj129582.aspx
configuration = "VC1 Broadband SD 4x3";
Expand Down

0 comments on commit f6e6b72

Please sign in to comment.