From 7478ff924f2befe12da9dbb7a5784e17e173d603 Mon Sep 17 00:00:00 2001 From: Albert Cheng Date: Wed, 26 Jun 2013 15:31:25 -0700 Subject: [PATCH 1/3] update unit tests to fix failures on CI machines. --- .../services/media/MediaProcessorIntegrationTest.java | 5 ++--- .../services/scenarios/MediaServiceWrapper.java | 9 ++++----- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/MediaProcessorIntegrationTest.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/MediaProcessorIntegrationTest.java index 824c34d2dc935..26f11507aedf5 100644 --- a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/MediaProcessorIntegrationTest.java +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/MediaProcessorIntegrationTest.java @@ -38,13 +38,12 @@ private void verifyMediaProcessorInfo(String message, MediaProcessorInfo mediaPr } private void verifyMediaProcessorInfo(String message, String id, String name, String description, String sku, - String vendor, String version, MediaProcessorInfo mediaProcessorInfo) { + String vendor, MediaProcessorInfo mediaProcessorInfo) { assertEquals(message + " id", id, mediaProcessorInfo.getId()); assertEquals(message + " name", name, mediaProcessorInfo.getName()); assertEquals(message + " description", description, mediaProcessorInfo.getDescription()); assertEquals(message + " sku", sku, mediaProcessorInfo.getSku()); assertEquals(message + " vendor", vendor, mediaProcessorInfo.getVendor()); - assertEquals(message + " version", version, mediaProcessorInfo.getVersion()); } @Test @@ -73,6 +72,6 @@ public void listMediaProcessorWithOptionSuccess() throws ServiceException { assertEquals("listMediaProcessors size", 1, listMediaProcessorsResult.size()); MediaProcessorInfo mediaProcessorInfo = listMediaProcessorsResult.get(0); verifyMediaProcessorInfo("mediaProcessorInfo", "nb:mpid:UUID:aec03716-7c5e-4f68-b592-f4850eba9f10", - "Storage Decryption", "Storage Decryption", "", "Microsoft", "1.6", mediaProcessorInfo); + "Storage Decryption", "Storage Decryption", "", "Microsoft", mediaProcessorInfo); } } diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/scenarios/MediaServiceWrapper.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/scenarios/MediaServiceWrapper.java index c71781c96fe61..bc92439348ea8 100644 --- a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/scenarios/MediaServiceWrapper.java +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/scenarios/MediaServiceWrapper.java @@ -272,13 +272,13 @@ public Task.CreateBatchOperation createTaskOptions(String taskName, int inputAss String configuration = null; switch (encoderType) { case WindowsAzureMediaEncoder: - processor = getMediaProcessorIdByName(MEDIA_PROCESSOR_WINDOWS_AZURE_MEDIA_ENCODER, "2.2.0.0"); + processor = getMediaProcessorIdByName(MEDIA_PROCESSOR_WINDOWS_AZURE_MEDIA_ENCODER); // 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"; break; case StorageDecryption: - processor = getMediaProcessorIdByName(MEDIA_PROCESSOR_STORAGE_DECRYPTION, "1.6"); + processor = getMediaProcessorIdByName(MEDIA_PROCESSOR_STORAGE_DECRYPTION); configuration = null; break; default: @@ -296,10 +296,9 @@ private String getTaskBody(int inputAssetId, int outputAssetId) { + "JobOutputAsset(" + outputAssetId + ")"; } - private String getMediaProcessorIdByName(String processorName, String version) throws ServiceException { + private String getMediaProcessorIdByName(String processorName) throws ServiceException { EntityListOperation operation = MediaProcessor.list(); - operation.getQueryParameters().putSingle("$filter", - "(Name eq '" + processorName + "') and (Version eq '" + version + "')"); + operation.getQueryParameters().putSingle("$filter", "(Name eq '" + processorName + "')"); MediaProcessorInfo processor = service.list(operation).get(0); return processor.getId(); } From 200217c9ebf2d376863a618dd10af19bc5951d67 Mon Sep 17 00:00:00 2001 From: Albert Cheng Date: Wed, 26 Jun 2013 15:56:15 -0700 Subject: [PATCH 2/3] fix a broken unit test on CI machine. --- .../ServiceBusConnectionSettingsTest.java | 57 ++++++++++--------- 1 file changed, 29 insertions(+), 28 deletions(-) diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/serviceBus/implementation/ServiceBusConnectionSettingsTest.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/serviceBus/implementation/ServiceBusConnectionSettingsTest.java index ec64e7d76effb..263213071b87b 100644 --- a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/serviceBus/implementation/ServiceBusConnectionSettingsTest.java +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/serviceBus/implementation/ServiceBusConnectionSettingsTest.java @@ -1,25 +1,26 @@ /** * Copyright Microsoft Corporation - * + * * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package com.microsoft.windowsazure.services.serviceBus.implementation; -import com.microsoft.windowsazure.services.core.Configuration; -import com.microsoft.windowsazure.services.serviceBus.ServiceBusConfiguration; +import static junit.framework.Assert.*; + import org.junit.Test; -import static junit.framework.Assert.*; +import com.microsoft.windowsazure.services.core.Configuration; +import com.microsoft.windowsazure.services.serviceBus.ServiceBusConfiguration; public class ServiceBusConnectionSettingsTest { @@ -31,7 +32,8 @@ public void settingsAreParsedFromConnectionString() throws Exception { String connectionString = getConnectionString(ns, issuer, secret); - ServiceBusConnectionSettings settings = new ServiceBusConnectionSettings(connectionString, null, null, null, null); + ServiceBusConnectionSettings settings = new ServiceBusConnectionSettings(connectionString, null, null, null, + null); assertEquals(String.format("https://%1$s.servicebus.windows.net/", ns), settings.getUri()); assertEquals(String.format("https://%1$s-sb.accesscontrol.windows.net/WRAPv0.9", ns), settings.getWrapUri()); @@ -41,15 +43,16 @@ public void settingsAreParsedFromConnectionString() throws Exception { private String getConnectionString(String ns, String issuer, String secret) { return String.format( - "Endpoint=sb://%1$s.servicebus.windows.net/;SharedSecretIssuer=%2$s;SharedSecretValue=%3$s", - ns, issuer, secret); + "Endpoint=sb://%1$s.servicebus.windows.net/;SharedSecretIssuer=%2$s;SharedSecretValue=%3$s", ns, + issuer, secret); } private String getConnectionString(String ns, String stsEndpoint, String issuer, String secret) { - return String.format( - "Endpoint=sb://%1$s.servicebus.windows.net/;StsEndpoint=https://%1$s%4$s;SharedSecretIssuer=%2$s;SharedSecretValue=%3$s", - ns, issuer, secret, stsEndpoint); + return String + .format("Endpoint=sb://%1$s.servicebus.windows.net/;StsEndpoint=https://%1$s%4$s;SharedSecretIssuer=%2$s;SharedSecretValue=%3$s", + ns, issuer, secret, stsEndpoint); } + @Test public void settingsAreUsedFromConnectionStringInConfig() throws Exception { Configuration config = Configuration.load(); @@ -68,8 +71,8 @@ public void settingsAreUsedFromConnectionStringInConfig() throws Exception { public void settingsAreUsedFromIndividualSettingsInConfiguration() throws Exception { Configuration config = Configuration.load(); - ServiceBusConfiguration.configureWithWrapAuthentication(config, - "myNamespace", "owner", "secret", ".servicebus.windows.net/", "-sb.accesscontrol.windows.net/WRAPv0.9"); + ServiceBusConfiguration.configureWithWrapAuthentication(config, "myNamespace", "owner", "secret", + ".servicebus.windows.net/", "-sb.accesscontrol.windows.net/WRAPv0.9"); ServiceBusConnectionSettings settings = config.create(ServiceBusConnectionSettings.class); @@ -83,9 +86,8 @@ public void settingsAreUsedFromIndividualSettingsInConfiguration() throws Except public void settingsPreferConnectionStringIfBothPresentInConfiguration() throws Exception { Configuration config = Configuration.load(); - ServiceBusConfiguration.configureWithWrapAuthentication(config, - "myIndividualNamespace", "individualowner", "individualsecret", - ".servicebus.windows.net/", "-sb.accesscontrol.windows.net/WRAPv0.9"); + ServiceBusConfiguration.configureWithWrapAuthentication(config, "myIndividualNamespace", "individualowner", + "individualsecret", ".servicebus.windows.net/", "-sb.accesscontrol.windows.net/WRAPv0.9"); ServiceBusConfiguration.configureWithConnectionString(null, config, getConnectionString("myNamespaceCS", "ownerCS", "secretCS")); @@ -100,12 +102,11 @@ public void settingsPreferConnectionStringIfBothPresentInConfiguration() throws @Test public void canSetStSEndPointInConnectionString() throws Exception { - ServiceBusConnectionSettings settings = new ServiceBusConnectionSettings( - getConnectionString("myNs", "-some.accesscontrol.net", "owner", "secret"), - null, null, null, null); + ServiceBusConnectionSettings settings = new ServiceBusConnectionSettings(getConnectionString("myNs", + "-some.accesscontrol.net", "owner", "secret"), null, null, null, null); assertEquals("https://myNs.servicebus.windows.net/", settings.getUri()); - assertEquals("https://myNs-some.accesscontrol.net", settings.getWrapUri()); + assertEquals("https://myNs-some.accesscontrol.net/WRAPv0.9", settings.getWrapUri()); assertEquals("owner", settings.getWrapName()); assertEquals("secret", settings.getWrapPassword()); } From 2b5c3f6aff54b1b56c8c7313520ef0207892f059 Mon Sep 17 00:00:00 2001 From: Albert Cheng Date: Thu, 27 Jun 2013 10:45:18 -0700 Subject: [PATCH 3/3] code review feedback regarding media processor integrration test. --- .../services/media/MediaProcessorIntegrationTest.java | 1 + 1 file changed, 1 insertion(+) diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/MediaProcessorIntegrationTest.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/MediaProcessorIntegrationTest.java index 26f11507aedf5..8132e3d52e67f 100644 --- a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/MediaProcessorIntegrationTest.java +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/MediaProcessorIntegrationTest.java @@ -44,6 +44,7 @@ private void verifyMediaProcessorInfo(String message, String id, String name, St assertEquals(message + " description", description, mediaProcessorInfo.getDescription()); assertEquals(message + " sku", sku, mediaProcessorInfo.getSku()); assertEquals(message + " vendor", vendor, mediaProcessorInfo.getVendor()); + assertTrue(message + "version length > 0", mediaProcessorInfo.getVersion().length() > 0); } @Test