From 1869bf8a2d5a9dbfbacab84d2cf5617ccbb39ee1 Mon Sep 17 00:00:00 2001 From: Albert Cheng Date: Fri, 28 Jun 2013 13:35:32 -0700 Subject: [PATCH 1/5] reduce the chance of potential unit test failure. --- .../scenarios/MediaServiceScenarioTest.java | 6 ++++-- .../services/scenarios/MediaServiceWrapper.java | 13 +++++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/scenarios/MediaServiceScenarioTest.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/scenarios/MediaServiceScenarioTest.java index 41bc23269daba..0d4ef704f2233 100644 --- a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/scenarios/MediaServiceScenarioTest.java +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/scenarios/MediaServiceScenarioTest.java @@ -40,6 +40,7 @@ public class MediaServiceScenarioTest extends ScenarioTestBase { private static final String rootTestAssetPrefix = "testAssetPrefix-"; + private static final String testJobPrefix = "testJobPrefix"; private static String testAssetPrefix; private static MediaServiceWrapper wrapper; private static MediaServiceValidation validator; @@ -57,6 +58,7 @@ public static void setup() throws ServiceException { public static void cleanup() throws ServiceException { wrapper.removeAllAssetsWithPrefix(rootTestAssetPrefix); wrapper.removeAllAccessPoliciesWithPrefix(); + wrapper.removeAllJobWithPrefix(testJobPrefix); } @Test @@ -119,7 +121,7 @@ public void createJob() throws Exception { wrapper.uploadFilesToAsset(asset, 10, getTestAssetFiles()); signalSetupFinished(); - String jobName = "my job createJob" + UUID.randomUUID().toString(); + String jobName = testJobPrefix + UUID.randomUUID().toString(); JobInfo job = wrapper.createJob(jobName, asset, createTasks()); validator.validateJob(job, jobName, asset, createTasks()); } @@ -129,7 +131,7 @@ public void transformAsset() throws Exception { signalSetupStarting(); AssetInfo asset = wrapper.createAsset(testAssetPrefix + "transformAsset", AssetOption.None); wrapper.uploadFilesToAsset(asset, 10, getTestAssetFiles()); - String jobName = "my job transformAsset" + UUID.randomUUID().toString(); + String jobName = testJobPrefix + UUID.randomUUID().toString(); JobInfo job = wrapper.createJob(jobName, asset, wrapper.createTaskOptions("Transform", 0, 0, EncoderType.WindowsAzureMediaEncoder)); 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 bb996eb10b77b..8b8779d173b55 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 @@ -432,6 +432,19 @@ public void removeAllAccessPoliciesWithPrefix() throws ServiceException { } } + public void removeAllJobWithPrefix(String testJobPrefix) throws ServiceException { + List jobInfos = service.list(Job.list()); + for (JobInfo jobInfo : jobInfos) { + if (jobInfo.getName().startsWith(testJobPrefix)) { + try { + service.delete(Job.delete(jobInfo.getId())); + } + catch (ServiceException e) { + } + } + } + } + private static class EncryptionHelper { public static boolean canUseStrongCrypto() { try { From 02c8337c8979a5fc2efc65b49e80eaa3f73caf39 Mon Sep 17 00:00:00 2001 From: Albert Cheng Date: Mon, 15 Jul 2013 12:38:25 -0700 Subject: [PATCH 2/5] remove warnings! --- .../windowsazure/services/serviceBus/Util.java | 18 ++++++++---------- .../table/implementation/TableRestProxy.java | 3 --- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/Util.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/Util.java index 026cb9c517718..128e23fe2f506 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/Util.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/Util.java @@ -2,15 +2,15 @@ * 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 + * 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. + * 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; @@ -20,12 +20,10 @@ public class Util { public static Iterable iterateQueues(ServiceBusContract service) throws ServiceException { - // TODO: iterate over link rel=next pagination return service.listQueues().getItems(); } public static Iterable iterateTopics(ServiceBusContract service) throws ServiceException { - // TODO: iterate over link rel=next pagination return service.listTopics().getItems(); } } diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/implementation/TableRestProxy.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/implementation/TableRestProxy.java index 0daec9926c025..93cfbc41eb628 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/implementation/TableRestProxy.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/implementation/TableRestProxy.java @@ -157,7 +157,6 @@ private void ThrowIfError(ClientResponse r) { } private String encodeODataURIValue(String value) { - //TODO: Unclear if OData value in URI's need to be encoded or not return value; } @@ -757,7 +756,6 @@ private DataSource createBatchInsertOrUpdateEntityPart(String table, Entity enti headers.addHeader("If-Match", entity.getEtag()); } - //TODO: Review code to make sure encoding is correct ByteArrayOutputStream httpRequest = new ByteArrayOutputStream(); httpReaderWriter.appendMethod(httpRequest, verb, path); httpReaderWriter.appendHeaders(httpRequest, headers); @@ -780,7 +778,6 @@ private DataSource createBatchDeleteEntityPart(String table, String partitionKey headers.addHeader("Content-ID", Integer.toString(contentId)); headers.addHeader("If-Match", etag == null ? "*" : etag); - //TODO: Review code to make sure encoding is correct ByteArrayOutputStream httpRequest = new ByteArrayOutputStream(); httpReaderWriter.appendMethod(httpRequest, "DELETE", path); httpReaderWriter.appendHeaders(httpRequest, headers); From 29a1551eae05f11fc58b04b20a397fb6d044ef51 Mon Sep 17 00:00:00 2001 From: Albert Cheng Date: Thu, 18 Jul 2013 10:35:37 -0700 Subject: [PATCH 3/5] a unit test trying to repeat service bus large message failure. --- .../serviceBus/ServiceBusIntegrationTest.java | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/serviceBus/ServiceBusIntegrationTest.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/serviceBus/ServiceBusIntegrationTest.java index 971df258c02cb..51462c07c5fcf 100644 --- a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/serviceBus/ServiceBusIntegrationTest.java +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/serviceBus/ServiceBusIntegrationTest.java @@ -67,6 +67,14 @@ public class ServiceBusIntegrationTest extends IntegrationTestBase { .setTimeout(5); static ReceiveMessageOptions PEEK_LOCK_5_SECONDS = new ReceiveMessageOptions().setPeekLock().setTimeout(5); + private String createLongString(int length) { + String result = new String(); + for (int i = 0; i < length; i++) { + result = result + "a"; + } + return result; + } + @Before public void createService() throws Exception { // reinitialize configuration from known state @@ -278,6 +286,26 @@ public void receiveMessageWorks() throws Exception { assertArrayEquals("Hello World".getBytes(), Arrays.copyOf(data, size)); } + @Test + public void receiveLargeMessageWorks() throws Exception { + // Arrange + String queueName = "TestReceiveLargeMessageWorks"; + service.createQueue(new QueueInfo(queueName)); + String expectedBody = createLongString(64000); + BrokeredMessage expectedMessage = new BrokeredMessage(expectedBody); + service.sendQueueMessage(queueName, expectedMessage); + + // Act + BrokeredMessage message = service.receiveQueueMessage(queueName, RECEIVE_AND_DELETE_5_SECONDS).getValue(); + byte[] data = new byte[64000]; + int size = message.getBody().read(data); + + // Assert + assertEquals(expectedBody.length(), size); + assertArrayEquals(expectedBody.getBytes(), Arrays.copyOf(data, size)); + + } + @Test public void renewSubscriptionMessageLockWorks() throws Exception { // Arrange From f603bce889e9333a7d585eb17b8954c22a09fb72 Mon Sep 17 00:00:00 2001 From: Albert Cheng Date: Thu, 18 Jul 2013 15:13:04 -0700 Subject: [PATCH 4/5] fix a minor bug in statusline --- .../windowsazure/services/media/implementation/StatusLine.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/StatusLine.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/StatusLine.java index 7fcc5d5ea948b..1b330c9e93bca 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/StatusLine.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/StatusLine.java @@ -59,7 +59,7 @@ private static void expect(Reader reader, String string) { ch = reader.read(); if (ch != byteArray[i]) { throw new RuntimeException(String.format("Expected '%s', found '%s' instead", string, - string.substring(0, i) + ch)); + string.substring(0, i) + (char) ch)); } } } From abc8d3cd2488fdee54316eb93c7a9f007a3f440e Mon Sep 17 00:00:00 2001 From: Albert Cheng Date: Tue, 30 Jul 2013 17:27:16 -0700 Subject: [PATCH 5/5] move some classes that should belong to core to the core. --- .../windowsazure/services/blob/Exports.java | 2 +- .../BlobOperationRestProxy.java | 1 + .../blob/implementation/BlobRestProxy.java | 1 + .../ContainerACLDateAdapter.java | 18 +++++---- .../blob/implementation/SharedKeyFilter.java | 1 + .../implementation/SharedKeyLiteFilter.java | 1 + .../services/blob/models/AccessCondition.java | 2 +- .../services/blob/models/BlobProperties.java | 2 +- .../blob/models/ListContainersResult.java | 2 +- .../ISO8601DateConverter.java | 2 +- .../RFC1123DateAdapter.java | 18 ++++----- .../RFC1123DateConverter.java | 18 ++++----- .../implementation/MediaBlobRestProxy.java | 2 +- .../queue/implementation/QueueRestProxy.java | 2 +- .../queue/models/ListMessagesResult.java | 2 +- .../queue/models/PeekMessagesResult.java | 2 +- .../implementation/AtomReaderWriter.java | 39 ++++++++++++------- .../DefaultEdmValueConverter.java | 2 +- .../table/implementation/TableRestProxy.java | 4 +- .../ISO8601DateConverterTests.java | 2 +- .../implementation/AtomReaderWriterTests.java | 2 +- 21 files changed, 71 insertions(+), 54 deletions(-) rename microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/{blob/implementation => core}/ISO8601DateConverter.java (98%) rename microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/{blob/implementation => core}/RFC1123DateAdapter.java (51%) rename microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/{blob/implementation => core}/RFC1123DateConverter.java (66%) rename microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/{blob/implementation => core}/ISO8601DateConverterTests.java (98%) diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/Exports.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/Exports.java index 7dfef8f100dbd..d4a5a7269bd65 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/Exports.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/Exports.java @@ -16,10 +16,10 @@ import com.microsoft.windowsazure.services.blob.implementation.BlobExceptionProcessor; import com.microsoft.windowsazure.services.blob.implementation.BlobRestProxy; -import com.microsoft.windowsazure.services.blob.implementation.ISO8601DateConverter; import com.microsoft.windowsazure.services.blob.implementation.SharedKeyFilter; import com.microsoft.windowsazure.services.blob.implementation.SharedKeyLiteFilter; import com.microsoft.windowsazure.services.core.Builder; +import com.microsoft.windowsazure.services.core.ISO8601DateConverter; import com.microsoft.windowsazure.services.core.UserAgentFilter; public class Exports implements Builder.Exports { diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/implementation/BlobOperationRestProxy.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/implementation/BlobOperationRestProxy.java index 5b865241508f4..4a9daa0e4b2b1 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/implementation/BlobOperationRestProxy.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/implementation/BlobOperationRestProxy.java @@ -67,6 +67,7 @@ import com.microsoft.windowsazure.services.blob.models.SetBlobPropertiesOptions; import com.microsoft.windowsazure.services.blob.models.SetBlobPropertiesResult; import com.microsoft.windowsazure.services.blob.models.SetContainerMetadataOptions; +import com.microsoft.windowsazure.services.core.RFC1123DateConverter; import com.microsoft.windowsazure.services.core.ServiceException; import com.microsoft.windowsazure.services.core.ServiceFilter; import com.microsoft.windowsazure.services.core.utils.CommaStringBuilder; diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/implementation/BlobRestProxy.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/implementation/BlobRestProxy.java index ed87b549f79be..3c5c7325d1c19 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/implementation/BlobRestProxy.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/implementation/BlobRestProxy.java @@ -21,6 +21,7 @@ import com.microsoft.windowsazure.services.blob.BlobConfiguration; import com.microsoft.windowsazure.services.blob.BlobContract; +import com.microsoft.windowsazure.services.core.RFC1123DateConverter; import com.microsoft.windowsazure.services.core.ServiceFilter; import com.microsoft.windowsazure.services.core.UserAgentFilter; import com.microsoft.windowsazure.services.core.utils.pipeline.HttpURLConnectionClient; diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/implementation/ContainerACLDateAdapter.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/implementation/ContainerACLDateAdapter.java index 06ef3c975a264..5697162a06ab6 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/implementation/ContainerACLDateAdapter.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/implementation/ContainerACLDateAdapter.java @@ -2,15 +2,15 @@ * 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 + * 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. + * 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.blob.implementation; @@ -18,6 +18,8 @@ import javax.xml.bind.annotation.adapters.XmlAdapter; +import com.microsoft.windowsazure.services.core.ISO8601DateConverter; + /* * JAXB adapter for a "not quite" ISO 8601 date time element */ diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/implementation/SharedKeyFilter.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/implementation/SharedKeyFilter.java index b3ab2cd850cef..6030c865d47b5 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/implementation/SharedKeyFilter.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/implementation/SharedKeyFilter.java @@ -26,6 +26,7 @@ import com.microsoft.windowsazure.services.blob.BlobConfiguration; import com.microsoft.windowsazure.services.blob.implementation.SharedKeyUtils.QueryParam; +import com.microsoft.windowsazure.services.core.RFC1123DateConverter; import com.microsoft.windowsazure.services.core.utils.pipeline.EntityStreamingListener; import com.sun.jersey.api.client.ClientHandlerException; import com.sun.jersey.api.client.ClientRequest; diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/implementation/SharedKeyLiteFilter.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/implementation/SharedKeyLiteFilter.java index 696c73cd6d901..5600b07e8ecdb 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/implementation/SharedKeyLiteFilter.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/implementation/SharedKeyLiteFilter.java @@ -24,6 +24,7 @@ import com.microsoft.windowsazure.services.blob.BlobConfiguration; import com.microsoft.windowsazure.services.blob.implementation.SharedKeyUtils.QueryParam; +import com.microsoft.windowsazure.services.core.RFC1123DateConverter; import com.microsoft.windowsazure.services.core.utils.pipeline.EntityStreamingListener; import com.sun.jersey.api.client.ClientHandlerException; import com.sun.jersey.api.client.ClientRequest; diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/AccessCondition.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/AccessCondition.java index f9a24919bdc01..cd4a21fb17bf5 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/AccessCondition.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/AccessCondition.java @@ -16,7 +16,7 @@ import java.util.Date; -import com.microsoft.windowsazure.services.blob.implementation.RFC1123DateConverter; +import com.microsoft.windowsazure.services.core.RFC1123DateConverter; /** * Represents a set of access conditions for operations that use storage services. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/BlobProperties.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/BlobProperties.java index 630e1a9fb2696..a19d7e73f8c95 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/BlobProperties.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/BlobProperties.java @@ -19,7 +19,7 @@ import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; -import com.microsoft.windowsazure.services.blob.implementation.RFC1123DateAdapter; +import com.microsoft.windowsazure.services.core.RFC1123DateAdapter; /** * Represents the HTML properties and system properties that may be set on a blob. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/ListContainersResult.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/ListContainersResult.java index 17c6d23aea2b4..e3e7a035b6f77 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/ListContainersResult.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/ListContainersResult.java @@ -26,7 +26,7 @@ import com.microsoft.windowsazure.services.blob.BlobContract; import com.microsoft.windowsazure.services.blob.implementation.MetadataAdapter; -import com.microsoft.windowsazure.services.blob.implementation.RFC1123DateAdapter; +import com.microsoft.windowsazure.services.core.RFC1123DateAdapter; /** * A wrapper class for the response returned from a Blob Service REST API List Containers operation. This is returned by diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/implementation/ISO8601DateConverter.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/ISO8601DateConverter.java similarity index 98% rename from microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/implementation/ISO8601DateConverter.java rename to microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/ISO8601DateConverter.java index cac734d4dc6e2..71d5bc3d4992f 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/implementation/ISO8601DateConverter.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/ISO8601DateConverter.java @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.microsoft.windowsazure.services.blob.implementation; +package com.microsoft.windowsazure.services.core; import java.text.DateFormat; import java.text.ParseException; diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/implementation/RFC1123DateAdapter.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/RFC1123DateAdapter.java similarity index 51% rename from microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/implementation/RFC1123DateAdapter.java rename to microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/RFC1123DateAdapter.java index aff36b78c73e7..559abd770daab 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/implementation/RFC1123DateAdapter.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/RFC1123DateAdapter.java @@ -2,17 +2,17 @@ * 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 + * 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. + * 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.blob.implementation; +package com.microsoft.windowsazure.services.core; import java.util.Date; diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/implementation/RFC1123DateConverter.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/RFC1123DateConverter.java similarity index 66% rename from microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/implementation/RFC1123DateConverter.java rename to microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/RFC1123DateConverter.java index 91d2acda79bb9..418a5782ba4b9 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/implementation/RFC1123DateConverter.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/RFC1123DateConverter.java @@ -2,17 +2,17 @@ * 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 + * 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. + * 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.blob.implementation; +package com.microsoft.windowsazure.services.core; import java.text.DateFormat; import java.text.ParseException; diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/MediaBlobRestProxy.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/MediaBlobRestProxy.java index 46d0ba286ee96..a698b280f7ce9 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/MediaBlobRestProxy.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/MediaBlobRestProxy.java @@ -19,7 +19,7 @@ import com.microsoft.windowsazure.services.blob.BlobContract; import com.microsoft.windowsazure.services.blob.implementation.BlobOperationRestProxy; -import com.microsoft.windowsazure.services.blob.implementation.RFC1123DateConverter; +import com.microsoft.windowsazure.services.core.RFC1123DateConverter; import com.microsoft.windowsazure.services.core.ServiceFilter; import com.sun.jersey.api.client.Client; diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/implementation/QueueRestProxy.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/implementation/QueueRestProxy.java index 454f51e44c9d7..27d2576bbd9f0 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/implementation/QueueRestProxy.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/implementation/QueueRestProxy.java @@ -21,7 +21,7 @@ import javax.inject.Inject; import javax.inject.Named; -import com.microsoft.windowsazure.services.blob.implementation.RFC1123DateConverter; +import com.microsoft.windowsazure.services.core.RFC1123DateConverter; import com.microsoft.windowsazure.services.core.ServiceException; import com.microsoft.windowsazure.services.core.ServiceFilter; import com.microsoft.windowsazure.services.core.UserAgentFilter; diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/models/ListMessagesResult.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/models/ListMessagesResult.java index 04f85095706dc..4c83ca513ee4b 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/models/ListMessagesResult.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/models/ListMessagesResult.java @@ -22,7 +22,7 @@ import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; -import com.microsoft.windowsazure.services.blob.implementation.RFC1123DateAdapter; +import com.microsoft.windowsazure.services.core.RFC1123DateAdapter; import com.microsoft.windowsazure.services.queue.QueueContract; /** diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/models/PeekMessagesResult.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/models/PeekMessagesResult.java index 34fc7f725ffaf..aac5f1990cb06 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/models/PeekMessagesResult.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/models/PeekMessagesResult.java @@ -22,7 +22,7 @@ import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; -import com.microsoft.windowsazure.services.blob.implementation.RFC1123DateAdapter; +import com.microsoft.windowsazure.services.core.RFC1123DateAdapter; import com.microsoft.windowsazure.services.queue.QueueContract; /** diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/implementation/AtomReaderWriter.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/implementation/AtomReaderWriter.java index fc4003870ce83..18e20e08abb58 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/implementation/AtomReaderWriter.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/implementation/AtomReaderWriter.java @@ -1,11 +1,11 @@ /** * 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. @@ -29,7 +29,7 @@ import javax.xml.stream.XMLStreamReader; import javax.xml.stream.XMLStreamWriter; -import com.microsoft.windowsazure.services.blob.implementation.ISO8601DateConverter; +import com.microsoft.windowsazure.services.core.ISO8601DateConverter; import com.microsoft.windowsazure.services.core.utils.DateFactory; import com.microsoft.windowsazure.services.table.EdmValueConverter; import com.microsoft.windowsazure.services.table.models.Entity; @@ -84,7 +84,8 @@ public void write(XMLStreamWriter writer) throws XMLStreamException { if (value != null) { writer.writeCharacters(value); - } else { + } + else { writer.writeAttribute("m:null", "true"); } @@ -107,7 +108,8 @@ public List parseTableEntries(InputStream stream) { // Process "entry" elements only if (isStartElement(xmlr, "entry")) { result.add(parseTableEntry(xmlr)); - } else { + } + else { nextSignificant(xmlr); } } @@ -116,7 +118,8 @@ public List parseTableEntries(InputStream stream) { expect(xmlr, XMLStreamConstants.END_DOCUMENT); return result; - } catch (XMLStreamException e) { + } + catch (XMLStreamException e) { throw new RuntimeException(e); } } @@ -130,7 +133,8 @@ public TableEntry parseTableEntry(InputStream stream) { expect(xmlr, XMLStreamConstants.END_DOCUMENT); return result; - } catch (XMLStreamException e) { + } + catch (XMLStreamException e) { throw new RuntimeException(e); } } @@ -147,7 +151,8 @@ public List parseEntityEntries(InputStream stream) { // Process "entry" elements only if (isStartElement(xmlr, "entry")) { result.add(parseEntityEntry(xmlr)); - } else { + } + else { nextSignificant(xmlr); } } @@ -156,7 +161,8 @@ public List parseEntityEntries(InputStream stream) { expect(xmlr, XMLStreamConstants.END_DOCUMENT); return result; - } catch (XMLStreamException e) { + } + catch (XMLStreamException e) { throw new RuntimeException(e); } } @@ -170,7 +176,8 @@ public Entity parseEntityEntry(InputStream stream) { expect(xmlr, XMLStreamConstants.END_DOCUMENT); return result; - } catch (XMLStreamException e) { + } + catch (XMLStreamException e) { throw new RuntimeException(e); } } @@ -220,7 +227,8 @@ private InputStream generateEntry(PropertiesWriter propertiesWriter) { writer.close(); return new ByteArrayInputStream(stream.toByteArray()); - } catch (XMLStreamException e) { + } + catch (XMLStreamException e) { throw new RuntimeException(e); } } @@ -235,7 +243,8 @@ private TableEntry parseTableEntry(XMLStreamReader xmlr) throws XMLStreamExcepti Map properties = parseEntryProperties(xmlr); result.setName((String) properties.get("TableName").getValue()); - } else { + } + else { nextSignificant(xmlr); } } @@ -254,7 +263,8 @@ private Entity parseEntityEntry(XMLStreamReader xmlr) throws XMLStreamException while (!isEndElement(xmlr, "entry")) { if (isStartElement(xmlr, "properties")) { result.setProperties(parseEntryProperties(xmlr)); - } else { + } + else { nextSignificant(xmlr); } } @@ -326,7 +336,8 @@ private void expect(XMLStreamReader xmlr, int eventType, String localName) throw private String encodeNumericCharacterReference(String value) { if (value == null) { return null; - } else { + } + else { char[] charArray = value.toCharArray(); StringBuffer stringBuffer = new StringBuffer(); for (int index = 0; index < charArray.length; index++) { diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/implementation/DefaultEdmValueConverter.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/implementation/DefaultEdmValueConverter.java index cdf08312d8ae1..de73a55c8c627 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/implementation/DefaultEdmValueConverter.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/implementation/DefaultEdmValueConverter.java @@ -20,7 +20,7 @@ import javax.inject.Inject; -import com.microsoft.windowsazure.services.blob.implementation.ISO8601DateConverter; +import com.microsoft.windowsazure.services.core.ISO8601DateConverter; import com.microsoft.windowsazure.services.table.EdmValueConverter; import com.microsoft.windowsazure.services.table.models.EdmType; import com.sun.jersey.core.util.Base64; diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/implementation/TableRestProxy.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/implementation/TableRestProxy.java index 0daec9926c025..6ffde10657f97 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/implementation/TableRestProxy.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/implementation/TableRestProxy.java @@ -39,8 +39,8 @@ import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; -import com.microsoft.windowsazure.services.blob.implementation.ISO8601DateConverter; -import com.microsoft.windowsazure.services.blob.implementation.RFC1123DateConverter; +import com.microsoft.windowsazure.services.core.ISO8601DateConverter; +import com.microsoft.windowsazure.services.core.RFC1123DateConverter; import com.microsoft.windowsazure.services.core.ServiceException; import com.microsoft.windowsazure.services.core.ServiceFilter; import com.microsoft.windowsazure.services.core.UserAgentFilter; diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/blob/implementation/ISO8601DateConverterTests.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/core/ISO8601DateConverterTests.java similarity index 98% rename from microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/blob/implementation/ISO8601DateConverterTests.java rename to microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/core/ISO8601DateConverterTests.java index 669b1a29fb88d..f25703bad210a 100644 --- a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/blob/implementation/ISO8601DateConverterTests.java +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/core/ISO8601DateConverterTests.java @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.microsoft.windowsazure.services.blob.implementation; +package com.microsoft.windowsazure.services.core; import static org.junit.Assert.*; diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/table/implementation/AtomReaderWriterTests.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/table/implementation/AtomReaderWriterTests.java index 1a2fd1ef0895d..03e5e11400522 100644 --- a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/table/implementation/AtomReaderWriterTests.java +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/table/implementation/AtomReaderWriterTests.java @@ -22,7 +22,7 @@ import org.junit.Test; -import com.microsoft.windowsazure.services.blob.implementation.ISO8601DateConverter; +import com.microsoft.windowsazure.services.core.ISO8601DateConverter; import com.microsoft.windowsazure.services.core.utils.DefaultDateFactory; import com.microsoft.windowsazure.services.table.IntegrationTestBase; import com.microsoft.windowsazure.services.table.models.TableEntry;