From 811ae672fff931fb3b26016f3b2213813a64d63b Mon Sep 17 00:00:00 2001 From: Albert Cheng Date: Wed, 17 Apr 2013 11:51:26 -0700 Subject: [PATCH 01/25] update queue. --- .../serviceBus/ServiceBusContract.java | 40 +++++++++++++++---- .../ServiceBusExceptionProcessor.java | 13 ++++++ .../implementation/ServiceBusRestProxy.java | 6 +++ .../serviceBus/ServiceBusIntegrationTest.java | 14 +++++++ 4 files changed, 65 insertions(+), 8 deletions(-) diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/ServiceBusContract.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/ServiceBusContract.java index 6d6d373b1104..0b2befa6f5ff 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/ServiceBusContract.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/ServiceBusContract.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; @@ -254,8 +254,32 @@ ReceiveSubscriptionMessageResult receiveSubscriptionMessage(String topicPath, St */ ListQueuesResult listQueues() throws ServiceException; + /** + * Returns a list of queues. + * + * @param options + * A ListQueueOptions object that represents the options to list the queue. + * + * @return A ListQueuesResult object that represents the result. + * + * @exception ServiceException + * If a service exception is encountered. + */ ListQueuesResult listQueues(ListQueuesOptions options) throws ServiceException; + /** + * Updates the information of a queue. + * + * @param queueInfo + * The information of a queue to be updated. + * + * @return A QueueInfo object that represents the updated queue. + * + * @throws ServiceException + * If a service exception is encountered. + */ + QueueInfo updateQueue(QueueInfo queueInfo) throws ServiceException; + /** * Creates a topic. * diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/ServiceBusExceptionProcessor.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/ServiceBusExceptionProcessor.java index 567ae5cedd0b..594bfdb7dd15 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/ServiceBusExceptionProcessor.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/ServiceBusExceptionProcessor.java @@ -238,6 +238,19 @@ public ListQueuesResult listQueues() throws ServiceException { } } + @Override + public QueueInfo updateQueue(QueueInfo queueInfo) throws ServiceException { + try { + return next.updateQueue(queueInfo); + } + catch (UniformInterfaceException e) { + throw processCatch(new ServiceException(e)); + } + catch (ClientHandlerException e) { + throw processCatch(new ServiceException(e)); + } + } + @Override public CreateTopicResult createTopic(TopicInfo topic) throws ServiceException { try { diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/ServiceBusRestProxy.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/ServiceBusRestProxy.java index b2007513afb2..1ee2a2c813bb 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/ServiceBusRestProxy.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/ServiceBusRestProxy.java @@ -288,6 +288,12 @@ public ListQueuesResult listQueues(ListQueuesOptions options) throws ServiceExce return result; } + @Override + public QueueInfo updateQueue(QueueInfo queueInfo) throws ServiceException { + return getResource().path(queueInfo.getPath()).type("application/atom+xml;type=entry;charset=utf-8") + .header("If-Match", "*").put(QueueInfo.class, queueInfo); + } + private WebResource listOptions(AbstractListOptions options, WebResource path) { if (options.getTop() != null) { path = path.queryParam("$top", options.getTop().toString()); 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 bd86d9b7abf9..965e75103ac5 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 @@ -108,6 +108,20 @@ public void createQueueWorks() throws Exception { assertEquals("TestCreateQueueWorks", saved.getPath()); } + @Test + public void updateQueueWorks() throws Exception { + // Arrange + QueueInfo queue = new QueueInfo("TestUpdateQueueWorks").setMaxSizeInMegabytes(1024L); + QueueInfo originalQueue = service.createQueue(queue).getValue(); + Long expectedMaxSizeInMegaBytes = 512L; + + // Act + QueueInfo updatedQueue = service.updateQueue(originalQueue.setMaxSizeInMegabytes(512L)); + + // Assert + assertEquals(expectedMaxSizeInMegaBytes, updatedQueue.getMaxSizeInMegabytes()); + } + @Test public void getQueueWorks() throws Exception { // Arrange From 786dd2ea9507d494b22b2d3d898c156299e8bfef Mon Sep 17 00:00:00 2001 From: Albert Cheng Date: Wed, 17 Apr 2013 17:30:05 -0700 Subject: [PATCH 02/25] update service bus topic. --- .../serviceBus/ServiceBusContract.java | 190 +++++++++--------- .../ServiceBusExceptionProcessor.java | 13 ++ .../implementation/ServiceBusRestProxy.java | 6 + .../serviceBus/ServiceBusIntegrationTest.java | 16 ++ 4 files changed, 131 insertions(+), 94 deletions(-) diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/ServiceBusContract.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/ServiceBusContract.java index 0b2befa6f5ff..1369c05e85d0 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/ServiceBusContract.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/ServiceBusContract.java @@ -42,6 +42,7 @@ import com.microsoft.windowsazure.services.serviceBus.models.SubscriptionInfo; import com.microsoft.windowsazure.services.serviceBus.models.TopicInfo; +// TODO: Auto-generated Javadoc /** * * Defines the service bus contract. @@ -56,9 +57,8 @@ public interface ServiceBusContract extends FilterableServiceString object that represents the name of the queue to which the message will be sent. * @param message * A Message object that represents the message to send. - * - * @exception ServiceException - * If a service exception is encountered. + * @throws ServiceException + * If a service exception is encountered. */ void sendQueueMessage(String queuePath, BrokeredMessage message) throws ServiceException; @@ -67,12 +67,9 @@ public interface ServiceBusContract extends FilterableServiceString object that represents the name of the queue from which to receive the message. - * * @return A ReceiveQueueMessageResult object that represents the result. - * - * @exception ServiceException - * If a service exception is encountered. - * + * @throws ServiceException + * If a service exception is encountered. */ ReceiveQueueMessageResult receiveQueueMessage(String queuePath) throws ServiceException; @@ -81,14 +78,11 @@ public interface ServiceBusContract extends FilterableServiceString object that represents the name of the queue from which to receive the message. - * * @param options * A ReceiveMessageOptions object that represents the receive message options. - * * @return A ReceiveQueueMessageResult object that represents the result. - * - * @exception ServiceException - * If a service exception is encountered. + * @throws ServiceException + * If a service exception is encountered. */ ReceiveQueueMessageResult receiveQueueMessage(String queuePath, ReceiveMessageOptions options) throws ServiceException; @@ -100,9 +94,8 @@ ReceiveQueueMessageResult receiveQueueMessage(String queuePath, ReceiveMessageOp * A String object that represents the name of the topic to which the message will be sent. * @param message * A Message object that represents the message to send. - * - * @exception ServiceException - * If a service exception is encountered. + * @throws ServiceException + * If a service exception is encountered. */ void sendTopicMessage(String topicPath, BrokeredMessage message) throws ServiceException; @@ -114,11 +107,9 @@ ReceiveQueueMessageResult receiveQueueMessage(String queuePath, ReceiveMessageOp * @param subscriptionName * A String object that represents the name of the subscription from the message will be * received. - * * @return A ReceiveSubscriptionMessageResult object that represents the result. - * - * @exception ServiceException - * If a service exception is encountered. + * @throws ServiceException + * If a service exception is encountered. */ ReceiveSubscriptionMessageResult receiveSubscriptionMessage(String topicPath, String subscriptionName) throws ServiceException; @@ -133,12 +124,9 @@ ReceiveSubscriptionMessageResult receiveSubscriptionMessage(String topicPath, St * received. * @param options * A ReceiveMessageOptions object that represents the receive message options. - * * @return A ReceiveSubscriptionMessageResult object that represents the result. - * - * @exception ServiceException - * If a service exception is encountered. - * + * @throws ServiceException + * If a service exception is encountered. */ ReceiveSubscriptionMessageResult receiveSubscriptionMessage(String topicPath, String subscriptionName, ReceiveMessageOptions options) throws ServiceException; @@ -148,9 +136,8 @@ ReceiveSubscriptionMessageResult receiveSubscriptionMessage(String topicPath, St * * @param message * A Message object that represents the message to unlock. - * - * @exception ServiceException - * If a service exception is encountered. + * @throws ServiceException + * If a service exception is encountered. */ void unlockMessage(BrokeredMessage message) throws ServiceException; @@ -201,9 +188,8 @@ ReceiveSubscriptionMessageResult receiveSubscriptionMessage(String topicPath, St * * @param message * A Message object that represents the message to delete. - * - * @exception ServiceException - * If a service exception is encountered. + * @throws ServiceException + * If a service exception is encountered. */ void deleteMessage(BrokeredMessage message) throws ServiceException; @@ -212,11 +198,9 @@ ReceiveSubscriptionMessageResult receiveSubscriptionMessage(String topicPath, St * * @param queue * A Queue object that represents the queue to create. - * * @return A CreateQueueResult object that represents the result. - * - * @exception ServiceException - * If a service exception is encountered. + * @throws ServiceException + * If a service exception is encountered. */ CreateQueueResult createQueue(QueueInfo queue) throws ServiceException; @@ -225,9 +209,8 @@ ReceiveSubscriptionMessageResult receiveSubscriptionMessage(String topicPath, St * * @param queuePath * A String object that represents the name of the queue to delete. - * - * @exception ServiceException - * If a service exception is encountered. + * @throws ServiceException + * If a service exception is encountered. */ void deleteQueue(String queuePath) throws ServiceException; @@ -236,11 +219,9 @@ ReceiveSubscriptionMessageResult receiveSubscriptionMessage(String topicPath, St * * @param queuePath * A String object that represents the name of the queue to retrieve. - * * @return A GetQueueResult object that represents the result. - * - * @exception ServiceException - * If a service exception is encountered. + * @throws ServiceException + * If a service exception is encountered. */ GetQueueResult getQueue(String queuePath) throws ServiceException; @@ -248,9 +229,8 @@ ReceiveSubscriptionMessageResult receiveSubscriptionMessage(String topicPath, St * Returns a list of queues. * * @return A ListQueuesResult object that represents the result. - * - * @exception ServiceException - * If a service exception is encountered. + * @throws ServiceException + * If a service exception is encountered. */ ListQueuesResult listQueues() throws ServiceException; @@ -259,11 +239,9 @@ ReceiveSubscriptionMessageResult receiveSubscriptionMessage(String topicPath, St * * @param options * A ListQueueOptions object that represents the options to list the queue. - * * @return A ListQueuesResult object that represents the result. - * - * @exception ServiceException - * If a service exception is encountered. + * @throws ServiceException + * If a service exception is encountered. */ ListQueuesResult listQueues(ListQueuesOptions options) throws ServiceException; @@ -285,11 +263,9 @@ ReceiveSubscriptionMessageResult receiveSubscriptionMessage(String topicPath, St * * @param topic * A Topic object that represents the topic to create. - * * @return A CreateTopicResult object that represents the result. - * - * @exception ServiceException - * If a service exception is encountered. + * @throws ServiceException + * If a service exception is encountered. */ CreateTopicResult createTopic(TopicInfo topic) throws ServiceException; @@ -298,9 +274,8 @@ ReceiveSubscriptionMessageResult receiveSubscriptionMessage(String topicPath, St * * @param topicPath * A String object that represents the name of the queue to delete. - * - * @exception ServiceException - * If a service exception is encountered. + * @throws ServiceException + * If a service exception is encountered. */ void deleteTopic(String topicPath) throws ServiceException; @@ -309,11 +284,9 @@ ReceiveSubscriptionMessageResult receiveSubscriptionMessage(String topicPath, St * * @param topicPath * A String object that represents the name of the topic to retrieve. - * * @return A GetTopicResult object that represents the result. - * - * @exception ServiceException - * If a service exception is encountered. + * @throws ServiceException + * If a service exception is encountered. */ GetTopicResult getTopic(String topicPath) throws ServiceException; @@ -321,14 +294,34 @@ ReceiveSubscriptionMessageResult receiveSubscriptionMessage(String topicPath, St * Returns a list of topics. * * @return A ListTopicsResult object that represents the result. - * - * @exception ServiceException - * If a service exception is encountered. + * @throws ServiceException + * If a service exception is encountered. */ ListTopicsResult listTopics() throws ServiceException; + /** + * Returns a list of topics. + * + * @param options + * A ListTopicsOptions object that represents the options to list the topic. + * @return A ListTopicsResult object that represents the result. + * @throws ServiceException + * If a service exception is encountered. + */ ListTopicsResult listTopics(ListTopicsOptions options) throws ServiceException; + /** + * Updates a topic. + * + * @param topicInfo + * A TopicInfo object that represents the topic to be updated. + * + * @return A TopicInfo object that represents the update topic result. + * @throws ServiceException + * If a service exception is encountered. + */ + TopicInfo updateTopic(TopicInfo topicInfo) throws ServiceException; + /** * Creates a subscription. * @@ -336,11 +329,9 @@ ReceiveSubscriptionMessageResult receiveSubscriptionMessage(String topicPath, St * A String object that represents the name of the topic for the subscription. * @param subscription * A Subscription object that represents the subscription to create. - * * @return A CreateSubscriptionResult object that represents the result. - * - * @exception ServiceException - * If a service exception is encountered. + * @throws ServiceException + * If a service exception is encountered. */ CreateSubscriptionResult createSubscription(String topicPath, SubscriptionInfo subscription) throws ServiceException; @@ -350,12 +341,10 @@ CreateSubscriptionResult createSubscription(String topicPath, SubscriptionInfo s * * @param topicPath * A String object that represents the name of the topic for the subscription. - * * @param subscriptionName * A String object that represents the name of the subscription to delete. - * - * @exception ServiceException - * If a service exception is encountered. + * @throws ServiceException + * If a service exception is encountered. */ void deleteSubscription(String topicPath, String subscriptionName) throws ServiceException; @@ -366,12 +355,10 @@ CreateSubscriptionResult createSubscription(String topicPath, SubscriptionInfo s * A String object that represents the name of the topic for the subscription. * @param subscriptionName * A String object that represents the name of the subscription to retrieve. - * * @return A GetSubscriptionResult object that represents the result. * A String object that represents the name of the subscription to retrieve. - * - * @exception ServiceException - * If a service exception is encountered. + * @throws ServiceException + * If a service exception is encountered. */ GetSubscriptionResult getSubscription(String topicPath, String subscriptionName) throws ServiceException; @@ -380,14 +367,23 @@ CreateSubscriptionResult createSubscription(String topicPath, SubscriptionInfo s * * @param topicPath * A String object that represents the name of the topic for the subscriptions to retrieve. - * * @return A ListSubscriptionsResult object that represents the result. - * - * @exception ServiceException - * If a service exception is encountered. + * @throws ServiceException + * If a service exception is encountered. */ ListSubscriptionsResult listSubscriptions(String topicPath) throws ServiceException; + /** + * List subscriptions. + * + * @param topicPath + * the topic path + * @param options + * the options + * @return the list subscriptions result + * @throws ServiceException + * the service exception + */ ListSubscriptionsResult listSubscriptions(String topicPath, ListSubscriptionsOptions options) throws ServiceException; @@ -401,11 +397,9 @@ ListSubscriptionsResult listSubscriptions(String topicPath, ListSubscriptionsOpt * created. * @param rule * A Rule object that represents the rule to create. - * * @return A CreateRuleResult object that represents the result. - * - * @exception ServiceException - * If a service exception is encountered. + * @throws ServiceException + * If a service exception is encountered. */ CreateRuleResult createRule(String topicPath, String subscriptionName, RuleInfo rule) throws ServiceException; @@ -419,9 +413,8 @@ ListSubscriptionsResult listSubscriptions(String topicPath, ListSubscriptionsOpt * deleted. * @param ruleName * A String object that represents the name of the rule to delete. - * - * @exception ServiceException - * If a service exception is encountered. + * @throws ServiceException + * If a service exception is encountered. */ void deleteRule(String topicPath, String subscriptionName, String ruleName) throws ServiceException; @@ -435,11 +428,9 @@ ListSubscriptionsResult listSubscriptions(String topicPath, ListSubscriptionsOpt * retrieved. * @param ruleName * A String object that represents the name of the rule to retrieve. - * * @return A GetRuleResult object that represents the result. - * - * @exception ServiceException - * If a service exception is encountered. + * @throws ServiceException + * If a service exception is encountered. */ GetRuleResult getRule(String topicPath, String subscriptionName, String ruleName) throws ServiceException; @@ -451,14 +442,25 @@ ListSubscriptionsResult listSubscriptions(String topicPath, ListSubscriptionsOpt * @param subscriptionName * A String object that represents the name of the subscription whose rules are being * retrieved. - * * @return A ListRulesResult object that represents the result. - * - * @exception ServiceException - * If a service exception is encountered. + * @throws ServiceException + * If a service exception is encountered. */ ListRulesResult listRules(String topicPath, String subscriptionName) throws ServiceException; + /** + * List rules. + * + * @param topicPath + * the topic path + * @param subscriptionName + * the subscription name + * @param options + * the options + * @return the list rules result + * @throws ServiceException + * the service exception + */ ListRulesResult listRules(String topicPath, String subscriptionName, ListRulesOptions options) throws ServiceException; } diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/ServiceBusExceptionProcessor.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/ServiceBusExceptionProcessor.java index 594bfdb7dd15..5620585bd17a 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/ServiceBusExceptionProcessor.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/ServiceBusExceptionProcessor.java @@ -303,6 +303,19 @@ public ListTopicsResult listTopics() throws ServiceException { } } + @Override + public TopicInfo updateTopic(TopicInfo topicInfo) throws ServiceException { + try { + return next.updateTopic(topicInfo); + } + catch (UniformInterfaceException e) { + throw processCatch(new ServiceException(e)); + } + catch (ClientHandlerException e) { + throw processCatch(new ServiceException(e)); + } + } + @Override public CreateSubscriptionResult createSubscription(String topicPath, SubscriptionInfo subscription) throws ServiceException { diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/ServiceBusRestProxy.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/ServiceBusRestProxy.java index 1ee2a2c813bb..a5f2d9c01923 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/ServiceBusRestProxy.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/ServiceBusRestProxy.java @@ -332,6 +332,12 @@ public ListTopicsResult listTopics(ListTopicsOptions options) throws ServiceExce return result; } + @Override + public TopicInfo updateTopic(TopicInfo topicInfo) throws ServiceException { + return getResource().path(topicInfo.getPath()).type("application/atom+xml;type=entry;charset=utf-8") + .header("If-Match", "*").put(TopicInfo.class, topicInfo); + } + @Override public CreateSubscriptionResult createSubscription(String topicPath, SubscriptionInfo subscription) { return new CreateSubscriptionResult(getResource().path(topicPath).path("subscriptions") 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 965e75103ac5..6259b2d55871 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 @@ -307,6 +307,22 @@ public void topicCanBeCreatedListedFetchedAndDeleted() throws ServiceException { assertEquals(listed.getItems().size() - 1, listed2.getItems().size()); } + @Test + public void topicCanBeUpdated() throws ServiceException { + // Arrange + String topicName = "testTopicCanBeUpdated"; + Long expectedMaxSizeInMegabytes = 2048L; + + // Act + TopicInfo createdTopicInfo = service.createTopic( + new TopicInfo().setPath(topicName).setMaxSizeInMegabytes(1024L)).getValue(); + TopicInfo updatedTopicInfo = service.updateTopic(createdTopicInfo + .setMaxSizeInMegabytes(expectedMaxSizeInMegabytes)); + + // Assert + assertEquals(expectedMaxSizeInMegabytes, updatedTopicInfo.getMaxSizeInMegabytes()); + } + @Test public void filterCanSeeAndChangeRequestOrResponse() throws ServiceException { // Arrange From 9109a1cc51420e5cc39bc2b9faa3b268c037138e Mon Sep 17 00:00:00 2001 From: Albert Cheng Date: Wed, 17 Apr 2013 17:44:29 -0700 Subject: [PATCH 03/25] Minor change to update topic. --- .../windowsazure/services/serviceBus/ServiceBusContract.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/ServiceBusContract.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/ServiceBusContract.java index 1369c05e85d0..2f638cc89375 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/ServiceBusContract.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/ServiceBusContract.java @@ -42,7 +42,6 @@ import com.microsoft.windowsazure.services.serviceBus.models.SubscriptionInfo; import com.microsoft.windowsazure.services.serviceBus.models.TopicInfo; -// TODO: Auto-generated Javadoc /** * * Defines the service bus contract. @@ -454,12 +453,12 @@ ListSubscriptionsResult listSubscriptions(String topicPath, ListSubscriptionsOpt * @param topicPath * the topic path * @param subscriptionName - * the subscription name + * the name of the subscription * @param options * the options * @return the list rules result * @throws ServiceException - * the service exception + * If a service exception is encountered. */ ListRulesResult listRules(String topicPath, String subscriptionName, ListRulesOptions options) throws ServiceException; From 4c84ba2bb742e53743b6b3f72dfda3b5234b2ad0 Mon Sep 17 00:00:00 2001 From: Albert Cheng Date: Thu, 18 Apr 2013 15:52:48 -0700 Subject: [PATCH 04/25] Enable update subscription. --- .../serviceBus/ServiceBusContract.java | 46 +++++++++++++++++++ .../ServiceBusExceptionProcessor.java | 14 ++++++ .../implementation/ServiceBusRestProxy.java | 8 ++++ .../serviceBus/ServiceBusIntegrationTest.java | 17 +++++++ 4 files changed, 85 insertions(+) diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/ServiceBusContract.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/ServiceBusContract.java index 0b2befa6f5ff..bfbb803ec16b 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/ServiceBusContract.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/ServiceBusContract.java @@ -388,9 +388,39 @@ CreateSubscriptionResult createSubscription(String topicPath, SubscriptionInfo s */ ListSubscriptionsResult listSubscriptions(String topicPath) throws ServiceException; + /** + * Returns a list of subscriptions. + * + * @param topicPath + * A String object that represents the name of the topic for the subscriptions to retrieve. + * + * @param options + * A ListSubscriptionsOptions object that represents the options to list subscriptions. + * + * @return A ListSubscriptionsResult object that represents the result. + * + * @exception ServiceException + * If a service exception is encountered. + */ ListSubscriptionsResult listSubscriptions(String topicPath, ListSubscriptionsOptions options) throws ServiceException; + /** + * Updates a subscription. + * + * @param topicName + * A String option which represents the name of the topic. + * + * @param subscriptionInfo + * A SubscriptionInfo option which represents the information of the subscription. + * + * @return A SubscriptionInfo object that represents the result. + * + * @exception ServiceException + * If a service exception is encountered. + */ + SubscriptionInfo updateSubscription(String topicName, SubscriptionInfo subscriptionInfo) throws ServiceException; + /** * Creates a rule. * @@ -459,6 +489,22 @@ ListSubscriptionsResult listSubscriptions(String topicPath, ListSubscriptionsOpt */ ListRulesResult listRules(String topicPath, String subscriptionName) throws ServiceException; + /** + * Returns a list of rules. + * + * @param topicPath + * A String object that represents the name of the topic for the subscription. + * @param subscriptionName + * A String object that represents the name of the subscription whose rules are being + * retrieved. + * @param options + * A ListRulesOptions object that represents the options to retrieve rules. + * + * @return A ListRulesResult object that represents the result. + * + * @exception ServiceException + * If a service exception is encountered. + */ ListRulesResult listRules(String topicPath, String subscriptionName, ListRulesOptions options) throws ServiceException; } diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/ServiceBusExceptionProcessor.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/ServiceBusExceptionProcessor.java index 594bfdb7dd15..5b892ec3646e 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/ServiceBusExceptionProcessor.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/ServiceBusExceptionProcessor.java @@ -356,6 +356,20 @@ public ListSubscriptionsResult listSubscriptions(String topicPath) throws Servic } } + @Override + public SubscriptionInfo updateSubscription(String topicName, SubscriptionInfo subscriptionInfo) + throws ServiceException { + try { + return next.updateSubscription(topicName, subscriptionInfo); + } + catch (UniformInterfaceException e) { + throw processCatch(new ServiceException(e)); + } + catch (ClientHandlerException e) { + throw processCatch(new ServiceException(e)); + } + } + @Override public CreateRuleResult createRule(String topicPath, String subscriptionName, RuleInfo rule) throws ServiceException { diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/ServiceBusRestProxy.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/ServiceBusRestProxy.java index 1ee2a2c813bb..0c3a76a90ba9 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/ServiceBusRestProxy.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/ServiceBusRestProxy.java @@ -362,6 +362,14 @@ public ListSubscriptionsResult listSubscriptions(String topicPath, ListSubscript return result; } + @Override + public SubscriptionInfo updateSubscription(String topicName, SubscriptionInfo subscriptionInfo) + throws ServiceException { + return getResource().path(topicName).path("subscriptions").path(subscriptionInfo.getName()) + .type("application/atom+xml;type=entry;charset=utf-8").header("If-Match", "*") + .put(SubscriptionInfo.class, subscriptionInfo); + } + @Override public CreateRuleResult createRule(String topicPath, String subscriptionName, RuleInfo rule) { return new CreateRuleResult(getResource().path(topicPath).path("subscriptions").path(subscriptionName) 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 965e75103ac5..55016a3454d5 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 @@ -419,6 +419,23 @@ public void subscriptionWillReceiveMessage() throws Exception { assertEquals("text/html", message.getContentType()); } + @Test + public void subscriptionCanBeUpdated() throws Exception { + // Arrange + String topicName = "testSubscriptionCanBeUpdated"; + service.createTopic(new TopicInfo(topicName)); + SubscriptionInfo originalSubscription = service.createSubscription(topicName, new SubscriptionInfo("sub")) + .getValue(); + Integer expectedMaxDeliveryCount = 1024; + + // Act + SubscriptionInfo updatedSubscription = service.updateSubscription(topicName, + originalSubscription.setMaxDeliveryCount(expectedMaxDeliveryCount)); + + // Assert + assertEquals(expectedMaxDeliveryCount, updatedSubscription.getMaxDeliveryCount()); + } + @Test public void rulesCanBeCreatedOnSubscriptions() throws Exception { // Arrange From b84180e1012c4b2649e8108d40aad6147c727111 Mon Sep 17 00:00:00 2001 From: Albert Cheng Date: Mon, 22 Apr 2013 17:12:50 -0700 Subject: [PATCH 05/25] initial checkin to update QueueDescription --- .../services/serviceBus/models/QueueInfo.java | 140 +++++++++++++++++ ...netservices.2010.10.servicebus.connect.xsd | 141 +++++++++++++++++- 2 files changed, 280 insertions(+), 1 deletion(-) diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/QueueInfo.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/QueueInfo.java index 676cb1bfd318..cbbfb62a2cf3 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/QueueInfo.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/QueueInfo.java @@ -14,12 +14,17 @@ */ package com.microsoft.windowsazure.services.serviceBus.models; +import java.util.Date; + import javax.ws.rs.core.MediaType; import javax.xml.datatype.Duration; +import com.microsoft.windowsazure.services.serviceBus.implementation.AuthorizationRule; +import com.microsoft.windowsazure.services.serviceBus.implementation.AuthorizationRules; import com.microsoft.windowsazure.services.serviceBus.implementation.Content; import com.microsoft.windowsazure.services.serviceBus.implementation.Entry; import com.microsoft.windowsazure.services.serviceBus.implementation.EntryModel; +import com.microsoft.windowsazure.services.serviceBus.implementation.MessageCountDetails; import com.microsoft.windowsazure.services.serviceBus.implementation.QueueDescription; /** @@ -191,6 +196,16 @@ public QueueInfo setDefaultMessageTimeToLive(Duration value) { return this; } + public Duration getAutoDeleteOnIdle() + { + return getModel().getAutoDeleteOnIdle(); + } + + public QueueInfo setAutoDeleteOnIdle(Duration duration) { + getModel().setAutoDeleteOnIdle(duration); + return this; + } + /** * Indicates whether dead lettering is in effect upon message expiration. * @@ -299,5 +314,130 @@ public Long getSizeInBytes() { public Long getMessageCount() { return getModel().getMessageCount(); } + + public MessageCountDetails getMessageCountDetails() + { + return getModel().getMessageCountDetails(); + } + public AuthorizationRules getAuthorization() + { + return getModel().getAuthorization(); + } + + public QueueInfo setAuthorization(AuthorizationRules authorizationRules) + { + getModel().setAuthorization(authorizationRules); + return this; + } + + public Boolean getIsAnonymousAccessible() + { + return getModel().getIsAnonymousAccessible(); + } + + public QueueInfo setIsAnonymouseAccessible(Boolean isAnonymousAccessible) + { + getModel().setIsAnonymousAccessible(isAnonymousAccessible); + return this; + } + + public Boolean getSupportOrdering() + { + return getModel().getSupportOrdering(); + } + + public QueueInfo setSupportOrdering(Boolean supportOrdering) + { + getModel().setSupportOrdering(supportOrdering); + return this; + } + + public EntityStatus getEntityStatus() + { + return getModel().getEntityStatus(); + } + + public QueueInfo setEntityStatus(EntityStatus entityStatus) + { + getModel().setEntityStatus(entityStatus); + return this; + } + + public EntityAvailabilityStatus getEntityAvailabilityStatus() + { + return getModel().getEntityAvailabilityStatus(); + } + + public QueueInfo setEntityAvailabilityStatus(EntityAvailabilityStatus entityAvailabilityStatus) + { + getModel().setEntityAvailabilityStatus(entityAvailabilityStatus); + return this; + } + + public String getForwardTo() + { + return getModel().getForwardTo(); + } + + public QueueInfo setForwardTo(String forwardTo) + { + getModel().setForwardTo(forwardTo); + return this; + } + + public Date getCreatedAt() + { + return getModel().getCreatedAt(); + } + + public QueueInfo setCreatedAt(Date createdAt) + { + getModel().setCreatedAt(createdAt); + return this; + } + + public Date getUpdatedAt() + { + return getModel().getUpdatedAt(); + } + + public QueueInfo setUpdatedAt(Date updatedAt) + { + getModel().setUpdatedAt(updatedAt); + return this; + } + + public Date getAccessedAt() + { + return getModel().getAccessedAt(); + } + + public QueueInfo setAccessedAt(Date accessedAt) + { + getModel().setAccessedAt(accessedAt); + return this; + } + + public Date PartitioningPolicy getPartitioningPolicy() + { + return getModel().getPartitioningPolicy(); + } + + public QueueInfo setPartitioningPolicy(PartitioningPolicy partitioningPolicy) + { + getModel().setPartitioningPolicy(partitioningPolicy); + return this; + } + + public String setUserMetadata() + { + return getModel().getUserMetadata(); + } + + public QueueInfo setUserMetadata(String userMetadata) + { + getModel().setUserMetadata(userMetadata); + return this; + } } diff --git a/microsoft-azure-api/src/main/resources/schemas.microsoft.com.netservices.2010.10.servicebus.connect.xsd b/microsoft-azure-api/src/main/resources/schemas.microsoft.com.netservices.2010.10.servicebus.connect.xsd index 31d324b76fbe..e99d9e665bf3 100644 --- a/microsoft-azure-api/src/main/resources/schemas.microsoft.com.netservices.2010.10.servicebus.connect.xsd +++ b/microsoft-azure-api/src/main/resources/schemas.microsoft.com.netservices.2010.10.servicebus.connect.xsd @@ -57,6 +57,13 @@ + + + + + + + @@ -99,6 +106,83 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -220,6 +304,61 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -300,4 +439,4 @@ - \ No newline at end of file + From 0d77d6489cf59d5f3e21d6efa9001467d92597e5 Mon Sep 17 00:00:00 2001 From: Albert Cheng Date: Mon, 22 Apr 2013 19:29:43 -0700 Subject: [PATCH 06/25] update the product code to make sure that the new QueueInfo is buildable. --- .../services/serviceBus/models/QueueInfo.java | 172 ++++++++---------- ...netservices.2010.10.servicebus.connect.xsd | 51 +++--- 2 files changed, 105 insertions(+), 118 deletions(-) diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/QueueInfo.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/QueueInfo.java index cbbfb62a2cf3..5ff8b606c03b 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/QueueInfo.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/QueueInfo.java @@ -2,29 +2,31 @@ * 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.models; -import java.util.Date; +import java.util.Calendar; import javax.ws.rs.core.MediaType; import javax.xml.datatype.Duration; -import com.microsoft.windowsazure.services.serviceBus.implementation.AuthorizationRule; import com.microsoft.windowsazure.services.serviceBus.implementation.AuthorizationRules; import com.microsoft.windowsazure.services.serviceBus.implementation.Content; +import com.microsoft.windowsazure.services.serviceBus.implementation.EntityAvailabilityStatus; +import com.microsoft.windowsazure.services.serviceBus.implementation.EntityStatus; import com.microsoft.windowsazure.services.serviceBus.implementation.Entry; import com.microsoft.windowsazure.services.serviceBus.implementation.EntryModel; import com.microsoft.windowsazure.services.serviceBus.implementation.MessageCountDetails; +import com.microsoft.windowsazure.services.serviceBus.implementation.PartitioningPolicy; import com.microsoft.windowsazure.services.serviceBus.implementation.QueueDescription; /** @@ -196,16 +198,15 @@ public QueueInfo setDefaultMessageTimeToLive(Duration value) { return this; } - public Duration getAutoDeleteOnIdle() - { + public Duration getAutoDeleteOnIdle() { return getModel().getAutoDeleteOnIdle(); } - + public QueueInfo setAutoDeleteOnIdle(Duration duration) { getModel().setAutoDeleteOnIdle(duration); return this; } - + /** * Indicates whether dead lettering is in effect upon message expiration. * @@ -314,130 +315,107 @@ public Long getSizeInBytes() { public Long getMessageCount() { return getModel().getMessageCount(); } - - public MessageCountDetails getMessageCountDetails() - { - return getModel().getMessageCountDetails(); + + public MessageCountDetails getCountDetails() { + return getModel().getCountDetails(); } - public AuthorizationRules getAuthorization() - { - return getModel().getAuthorization(); + public AuthorizationRules getAuthorizationRules() { + return getModel().getAuthorizationRules(); } - - public QueueInfo setAuthorization(AuthorizationRules authorizationRules) - { - getModel().setAuthorization(authorizationRules); - return this; + + public QueueInfo setAuthorization(AuthorizationRules authorizationRules) { + getModel().setAuthorizationRules(authorizationRules); + return this; } - - public Boolean getIsAnonymousAccessible() - { - return getModel().getIsAnonymousAccessible(); + + public Boolean getIsAnonymousAccessible() { + return getModel().isIsAnonymousAccessible(); } - - public QueueInfo setIsAnonymouseAccessible(Boolean isAnonymousAccessible) - { + + public QueueInfo setIsAnonymouseAccessible(Boolean isAnonymousAccessible) { getModel().setIsAnonymousAccessible(isAnonymousAccessible); return this; } - - public Boolean getSupportOrdering() - { - return getModel().getSupportOrdering(); + + public Boolean getSupportOrdering() { + return getModel().isSupportOrdering(); } - - public QueueInfo setSupportOrdering(Boolean supportOrdering) - { + + public QueueInfo setSupportOrdering(Boolean supportOrdering) { getModel().setSupportOrdering(supportOrdering); - return this; - } - - public EntityStatus getEntityStatus() - { - return getModel().getEntityStatus(); - } - - public QueueInfo setEntityStatus(EntityStatus entityStatus) - { - getModel().setEntityStatus(entityStatus); - return this; - } - - public EntityAvailabilityStatus getEntityAvailabilityStatus() - { + return this; + } + + public EntityStatus getStatus() { + return getModel().getStatus(); + } + + public QueueInfo setStatus(EntityStatus entityStatus) { + getModel().setStatus(entityStatus); + return this; + } + + public EntityAvailabilityStatus getEntityAvailabilityStatus() { return getModel().getEntityAvailabilityStatus(); } - - public QueueInfo setEntityAvailabilityStatus(EntityAvailabilityStatus entityAvailabilityStatus) - { + + public QueueInfo setEntityAvailabilityStatus(EntityAvailabilityStatus entityAvailabilityStatus) { getModel().setEntityAvailabilityStatus(entityAvailabilityStatus); - return this; + return this; } - - public String getForwardTo() - { + + public String getForwardTo() { return getModel().getForwardTo(); } - - public QueueInfo setForwardTo(String forwardTo) - { + + public QueueInfo setForwardTo(String forwardTo) { getModel().setForwardTo(forwardTo); return this; } - - public Date getCreatedAt() - { + + public Calendar getCreatedAt() { return getModel().getCreatedAt(); } - - public QueueInfo setCreatedAt(Date createdAt) - { + + public QueueInfo setCreatedAt(Calendar createdAt) { getModel().setCreatedAt(createdAt); return this; } - - public Date getUpdatedAt() - { + + public Calendar getUpdatedAt() { return getModel().getUpdatedAt(); } - - public QueueInfo setUpdatedAt(Date updatedAt) - { + + public QueueInfo setUpdatedAt(Calendar updatedAt) { getModel().setUpdatedAt(updatedAt); return this; } - - public Date getAccessedAt() - { + + public Calendar getAccessedAt() { return getModel().getAccessedAt(); } - - public QueueInfo setAccessedAt(Date accessedAt) - { + + public QueueInfo setAccessedAt(Calendar accessedAt) { getModel().setAccessedAt(accessedAt); return this; } - - public Date PartitioningPolicy getPartitioningPolicy() - { + + public PartitioningPolicy getPartitioningPolicy() { return getModel().getPartitioningPolicy(); } - - public QueueInfo setPartitioningPolicy(PartitioningPolicy partitioningPolicy) - { + + public QueueInfo setPartitioningPolicy(PartitioningPolicy partitioningPolicy) { getModel().setPartitioningPolicy(partitioningPolicy); return this; } - - public String setUserMetadata() - { + + public String setUserMetadata() { return getModel().getUserMetadata(); } - - public QueueInfo setUserMetadata(String userMetadata) - { + + public QueueInfo setUserMetadata(String userMetadata) { getModel().setUserMetadata(userMetadata); - return this; + return this; } } diff --git a/microsoft-azure-api/src/main/resources/schemas.microsoft.com.netservices.2010.10.servicebus.connect.xsd b/microsoft-azure-api/src/main/resources/schemas.microsoft.com.netservices.2010.10.servicebus.connect.xsd index e99d9e665bf3..7e66e27b33ea 100644 --- a/microsoft-azure-api/src/main/resources/schemas.microsoft.com.netservices.2010.10.servicebus.connect.xsd +++ b/microsoft-azure-api/src/main/resources/schemas.microsoft.com.netservices.2010.10.servicebus.connect.xsd @@ -2,18 +2,20 @@ + @@ -57,13 +59,6 @@ - - - - - - - @@ -106,63 +101,77 @@ - + - + + + + + + + + - + - + - + - + - + - + - + + + + + + + + @@ -176,7 +185,7 @@ - + From ed53fd26dcd1ad3c42e44163d694dab473e408f8 Mon Sep 17 00:00:00 2001 From: Albert Cheng Date: Tue, 23 Apr 2013 14:11:08 -0700 Subject: [PATCH 07/25] initial check in for the scaffold of the QueueInfoTest --- ...netservices.2010.10.servicebus.connect.xsd | 4 +- .../serviceBus/models/QueueInfoTest.java | 151 ++++++++++++++++++ 2 files changed, 153 insertions(+), 2 deletions(-) create mode 100644 microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/serviceBus/models/QueueInfoTest.java diff --git a/microsoft-azure-api/src/main/resources/schemas.microsoft.com.netservices.2010.10.servicebus.connect.xsd b/microsoft-azure-api/src/main/resources/schemas.microsoft.com.netservices.2010.10.servicebus.connect.xsd index 7e66e27b33ea..6966e340ecb2 100644 --- a/microsoft-azure-api/src/main/resources/schemas.microsoft.com.netservices.2010.10.servicebus.connect.xsd +++ b/microsoft-azure-api/src/main/resources/schemas.microsoft.com.netservices.2010.10.servicebus.connect.xsd @@ -2,8 +2,8 @@ Date: Tue, 23 Apr 2013 16:54:55 -0700 Subject: [PATCH 08/25] update unit test for QueueInfo --- .../services/serviceBus/models/QueueInfo.java | 10 +- .../serviceBus/models/QueueInfoTest.java | 134 +++++++++++++++++- 2 files changed, 139 insertions(+), 5 deletions(-) diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/QueueInfo.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/QueueInfo.java index 5ff8b606c03b..8e0d572d69ab 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/QueueInfo.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/QueueInfo.java @@ -307,6 +307,11 @@ public Long getSizeInBytes() { return getModel().getSizeInBytes(); } + public QueueInfo setSizeInBytes(Long sizeInBytes) { + getModel().setSizeInBytes(sizeInBytes); + return this; + } + /** * Returns the number of messages in the queue. * @@ -320,7 +325,7 @@ public MessageCountDetails getCountDetails() { return getModel().getCountDetails(); } - public AuthorizationRules getAuthorizationRules() { + public AuthorizationRules getAuthorization() { return getModel().getAuthorizationRules(); } @@ -329,7 +334,7 @@ public QueueInfo setAuthorization(AuthorizationRules authorizationRules) { return this; } - public Boolean getIsAnonymousAccessible() { + public Boolean isAnonymousAccessible() { return getModel().isIsAnonymousAccessible(); } @@ -418,4 +423,5 @@ public QueueInfo setUserMetadata(String userMetadata) { getModel().setUserMetadata(userMetadata); return this; } + } diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/serviceBus/models/QueueInfoTest.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/serviceBus/models/QueueInfoTest.java index 616160c28f0f..f62623effd9b 100644 --- a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/serviceBus/models/QueueInfoTest.java +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/serviceBus/models/QueueInfoTest.java @@ -16,91 +16,219 @@ import static org.junit.Assert.*; +import javax.xml.datatype.Duration; + import org.junit.Test; +import com.microsoft.windowsazure.services.serviceBus.implementation.AuthorizationRules; +import com.microsoft.windowsazure.services.serviceBus.implementation.EntityStatus; + public class QueueInfoTest { @Test public void testGetSetLockDuration() { // Arrange + Duration expectedLockDuration = Duration.create(); QueueInfo QueueInfo = new QueueInfo(); // Act - String actualId = QueueInfo.getId(); + Duration actualLockDuration = QueueInfo.setLockDuration(expectedLockDuration).getLockDuration(); // Assert - assertEquals(expectedId, actualId); + assertEquals(expectedLockDuration, actualLockDuration); } @Test public void testGetSetMaxSizeInMegabytes() { + // Arrange + Long expectedMaxSizeInMegabytes = 1024L; + QueueInfo QueueInfo = new QueueInfo(); + + // Act + Long actualMaxSizeInMegabytes = QueueInfo.setMaxSizeInMegabytes(expectedMaxSizeInMegabytes) + .getMaxSizeInMegabytes(); + + // Assert + assertEquals(expectedMaxSizeInMegabytes, actualMaxSizeInMegabytes); } @Test public void testGetSetRequiresDuplicateDetection() { + // Arrange + Boolean expectedRequiresDuplicateDetection = true; + QueueInfo QueueInfo = new QueueInfo(); + + // Act + Boolean actualRequiresDuplicateDetection = QueueInfo.setRequiresDuplicateDetection( + expectedRequiresDuplicateDetection).isRequiresDuplicateDetection(); + + // Assert + assertEquals(expectedRequiresDuplicateDetection, actualRequiresDuplicateDetection); } @Test public void testGetSetRequiresSession() { + // Arrange + Boolean expectedRequiresSession = true; + QueueInfo QueueInfo = new QueueInfo(); + + // Act + Boolean actualRequiresSession = QueueInfo.setRequiresSession(expectedRequiresSession).isRequiresSession(); + // Assert + assertEquals(expectedRequiresSession, actualRequiresSession); } @Test public void testGetSetDefaultMessageTimeToLive() { + // Arrange + Duration expectedDefaultMessageTimeToLive = Duration.create(); + QueueInfo QueueInfo = new QueueInfo(); + // Act + Duration actualDefaultMessageTimeToLive = QueueInfo.setDefaultMessageTimeToLive( + expectedDefaultMessageTimeToLive).getDefaultMessageTimeToLive(); + + // Assert + assertEquals(expectedDefaultMessageTimeToLive, actualDefaultMessageTimeToLive); } @Test public void testGetSetDeadLetteringOnMessageExpiration() { + // Arrange + Boolean expectedDeadLetteringOnMessageExpiration = true; + QueueInfo QueueInfo = new QueueInfo(); + + // Act + Boolean actualDeadLetteringOnMessageExpiration = QueueInfo.setDeadLetteringOnMessageExpiration( + expectedDeadLetteringOnMessageExpiration).isDeadLetteringOnMessageExpiration(); + // Assert + assertEquals(expectedDeadLetteringOnMessageExpiration, actualDeadLetteringOnMessageExpiration); } @Test public void testGetSetDuplicateDetectionHistoryTimeWindow() { + // Arrange + Duration expectedDefaultMessageTimeToLive = Duration.create(); + QueueInfo QueueInfo = new QueueInfo(); + + // Act + Duration actualDefaultMessageTimeToLive = QueueInfo.setDefaultMessageTimeToLive( + expectedDefaultMessageTimeToLive).getDefaultMessageTimeToLive(); + // Assert + assertEquals(expectedDefaultMessageTimeToLive, actualDefaultMessageTimeToLive); } @Test public void testGetSetMaxDeliveryCount() { + // Arrange + Integer expectedMaxDeliveryCount = 1024; + QueueInfo QueueInfo = new QueueInfo(); + + // Act + Integer actualMaxDeliveryCount = QueueInfo.setMaxDeliveryCount(expectedMaxDeliveryCount).getMaxDeliveryCount(); + // Assert + assertEquals(expectedMaxDeliveryCount, actualMaxDeliveryCount); } @Test public void testGetSetEnableBatchedOperations() { + // Arrange + Boolean expectedEnableBatchedOperations = true; + QueueInfo QueueInfo = new QueueInfo(); + + // Act + Boolean actualEnableBatchedOperations = QueueInfo.setEnableBatchedOperations(expectedEnableBatchedOperations) + .isEnableBatchedOperations(); + // Assert + assertEquals(expectedEnableBatchedOperations, actualEnableBatchedOperations); } @Test public void testGetSetSizeInBytes() { + // Arrange + Long expectedSizeInBytes = 1024L; + QueueInfo QueueInfo = new QueueInfo(); + // Act + Long actualSizeInBytes = QueueInfo.setSizeInBytes(expectedSizeInBytes).getSizeInBytes(); + + // Assert + assertEquals(expectedSizeInBytes, actualSizeInBytes); } @Test public void testGetSetMessageCount() { + // Arrange + Long expectedMessageCount = 1024L; + QueueInfo QueueInfo = new QueueInfo(); + // Act + Long actualMessageCount = QueueInfo.setSizeInBytes(expectedMessageCount).getMessageCount(); + + // Assert + assertEquals(expectedMessageCount, actualMessageCount); } @Test public void testGetSetIsAnonymousAccessible() { + // Arrange + Boolean expectedIsAnonymousAccessible = true; + QueueInfo QueueInfo = new QueueInfo(); + // Act + Boolean actualIsAnonymousAccessible = QueueInfo.setEnableBatchedOperations(expectedIsAnonymousAccessible) + .isAnonymousAccessible(); + + // Assert + assertEquals(expectedIsAnonymousAccessible, actualIsAnonymousAccessible); } @Test - public void testGetSetAuthorizationRules() { + public void testGetSetAuthorization() { + // Arrange + AuthorizationRules expectedAuthorizationRules = new AuthorizationRules(); + QueueInfo QueueInfo = new QueueInfo(); + // Act + AuthorizationRules actualAuthorizationRules = QueueInfo.setAuthorization(expectedAuthorizationRules) + .getAuthorization(); + + // Assert + assertEquals(expectedAuthorizationRules, actualAuthorizationRules); } @Test public void testGetSetStatus() { + // Arrange + EntityStatus expectedEntityStatus = EntityStatus.ACTIVE; + QueueInfo QueueInfo = new QueueInfo(); + + // Act + EntityStatus actualEntityStatus = QueueInfo.setStatus(expectedEntityStatus).getStatus(); + // Assert + assertEquals(expectedEntityStatus, actualEntityStatus); } @Test public void testGetSetForwardTo() { + // Arrange + String expectedForwardTo = "forwardTo"; + QueueInfo QueueInfo = new QueueInfo(); + + // Act + String actualForwardTo = QueueInfo.setForwardTo(expectedForwardTo).getForwardTo(); + // Assert + assertEquals(expectedForwardTo, actualForwardTo); } @Test From da53615f397b9c32fb1cf84867e2c2c4ce6669f6 Mon Sep 17 00:00:00 2001 From: Albert Cheng Date: Tue, 23 Apr 2013 17:41:03 -0700 Subject: [PATCH 09/25] all the queue info unit tests passes. --- .../services/serviceBus/models/QueueInfo.java | 15 ++- .../serviceBus/models/QueueInfoTest.java | 103 +++++++++++++++++- 2 files changed, 110 insertions(+), 8 deletions(-) diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/QueueInfo.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/QueueInfo.java index 8e0d572d69ab..961c8340bd27 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/QueueInfo.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/QueueInfo.java @@ -321,6 +321,16 @@ public Long getMessageCount() { return getModel().getMessageCount(); } + public QueueInfo setMessageCount(Long messageCount) { + getModel().setMessageCount(messageCount); + return this; + } + + public QueueInfo setCountDetails(MessageCountDetails countDetails) { + getModel().setCountDetails(countDetails); + return this; + } + public MessageCountDetails getCountDetails() { return getModel().getCountDetails(); } @@ -338,12 +348,12 @@ public Boolean isAnonymousAccessible() { return getModel().isIsAnonymousAccessible(); } - public QueueInfo setIsAnonymouseAccessible(Boolean isAnonymousAccessible) { + public QueueInfo setIsAnonymousAccessible(Boolean isAnonymousAccessible) { getModel().setIsAnonymousAccessible(isAnonymousAccessible); return this; } - public Boolean getSupportOrdering() { + public Boolean isSupportOrdering() { return getModel().isSupportOrdering(); } @@ -423,5 +433,4 @@ public QueueInfo setUserMetadata(String userMetadata) { getModel().setUserMetadata(userMetadata); return this; } - } diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/serviceBus/models/QueueInfoTest.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/serviceBus/models/QueueInfoTest.java index f62623effd9b..6303db54332e 100644 --- a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/serviceBus/models/QueueInfoTest.java +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/serviceBus/models/QueueInfoTest.java @@ -16,19 +16,37 @@ import static org.junit.Assert.*; +import java.util.Calendar; + +import javax.xml.datatype.DatatypeConfigurationException; +import javax.xml.datatype.DatatypeFactory; import javax.xml.datatype.Duration; import org.junit.Test; import com.microsoft.windowsazure.services.serviceBus.implementation.AuthorizationRules; +import com.microsoft.windowsazure.services.serviceBus.implementation.EntityAvailabilityStatus; import com.microsoft.windowsazure.services.serviceBus.implementation.EntityStatus; +import com.microsoft.windowsazure.services.serviceBus.implementation.MessageCountDetails; +import com.microsoft.windowsazure.services.serviceBus.implementation.PartitioningPolicy; public class QueueInfoTest { + private Duration createDuration(int milliSeconds) { + DatatypeFactory datatypeFactory; + try { + datatypeFactory = DatatypeFactory.newInstance(); + } + catch (DatatypeConfigurationException e) { + throw new RuntimeException(e); + } + return datatypeFactory.newDuration(milliSeconds); + } + @Test public void testGetSetLockDuration() { // Arrange - Duration expectedLockDuration = Duration.create(); + Duration expectedLockDuration = createDuration(100); QueueInfo QueueInfo = new QueueInfo(); // Act @@ -85,7 +103,7 @@ public void testGetSetRequiresSession() { @Test public void testGetSetDefaultMessageTimeToLive() { // Arrange - Duration expectedDefaultMessageTimeToLive = Duration.create(); + Duration expectedDefaultMessageTimeToLive = createDuration(100); QueueInfo QueueInfo = new QueueInfo(); // Act @@ -113,7 +131,7 @@ public void testGetSetDeadLetteringOnMessageExpiration() { @Test public void testGetSetDuplicateDetectionHistoryTimeWindow() { // Arrange - Duration expectedDefaultMessageTimeToLive = Duration.create(); + Duration expectedDefaultMessageTimeToLive = createDuration(100); QueueInfo QueueInfo = new QueueInfo(); // Act @@ -171,7 +189,7 @@ public void testGetSetMessageCount() { QueueInfo QueueInfo = new QueueInfo(); // Act - Long actualMessageCount = QueueInfo.setSizeInBytes(expectedMessageCount).getMessageCount(); + Long actualMessageCount = QueueInfo.setMessageCount(expectedMessageCount).getMessageCount(); // Assert assertEquals(expectedMessageCount, actualMessageCount); @@ -184,7 +202,7 @@ public void testGetSetIsAnonymousAccessible() { QueueInfo QueueInfo = new QueueInfo(); // Act - Boolean actualIsAnonymousAccessible = QueueInfo.setEnableBatchedOperations(expectedIsAnonymousAccessible) + Boolean actualIsAnonymousAccessible = QueueInfo.setIsAnonymousAccessible(expectedIsAnonymousAccessible) .isAnonymousAccessible(); // Assert @@ -233,47 +251,122 @@ public void testGetSetForwardTo() { @Test public void testGetSetCreatedAt() { + // Arrange + Calendar expectedCreatedAt = Calendar.getInstance(); + QueueInfo QueueInfo = new QueueInfo(); + + // Act + Calendar actualCreatedAt = QueueInfo.setCreatedAt(expectedCreatedAt).getCreatedAt(); + // Assert + assertEquals(expectedCreatedAt, actualCreatedAt); } @Test public void testGetSetUpdatedAt() { + // Arrange + Calendar expectedUpdatedAt = Calendar.getInstance(); + QueueInfo QueueInfo = new QueueInfo(); + + // Act + Calendar actualUpdatedAt = QueueInfo.setUpdatedAt(expectedUpdatedAt).getUpdatedAt(); + // Assert + assertEquals(expectedUpdatedAt, actualUpdatedAt); } @Test public void testGetSetAccessedAt() { + // Arrange + Calendar expectedAccessedAt = Calendar.getInstance(); + QueueInfo QueueInfo = new QueueInfo(); + // Act + Calendar actualAccessedAt = QueueInfo.setAccessedAt(expectedAccessedAt).getAccessedAt(); + + // Assert + assertEquals(expectedAccessedAt, actualAccessedAt); } @Test public void testGetSetUserMetadata() { + // Arrange + Calendar expectedAccessedAt = Calendar.getInstance(); + QueueInfo QueueInfo = new QueueInfo(); + + // Act + Calendar actualAccessedAt = QueueInfo.setAccessedAt(expectedAccessedAt).getAccessedAt(); + // Assert + assertEquals(expectedAccessedAt, actualAccessedAt); } @Test public void testGetSetSupportOrdering() { + // Arrange + Boolean expectedIsSupportOrdering = true; + QueueInfo QueueInfo = new QueueInfo(); + + // Act + Boolean actualIsSupportOrdering = QueueInfo.setSupportOrdering(expectedIsSupportOrdering).isSupportOrdering(); + // Assert + assertEquals(expectedIsSupportOrdering, actualIsSupportOrdering); } @Test public void testGetSetCountDetails() { + // Arrange + MessageCountDetails expectedCountDetails = new MessageCountDetails(); + QueueInfo QueueInfo = new QueueInfo(); + // Act + MessageCountDetails actualCountDetails = QueueInfo.setCountDetails(expectedCountDetails).getCountDetails(); + + // Assert + assertEquals(expectedCountDetails, actualCountDetails); } @Test public void testGetSetAutoDeleteOnIdle() { + // Arrange + Duration expectedIsAutoDeleteOnIdle = createDuration(100); + QueueInfo QueueInfo = new QueueInfo(); + + // Act + Duration actualIsAutoDeleteOnIdle = QueueInfo.setAutoDeleteOnIdle(expectedIsAutoDeleteOnIdle) + .getAutoDeleteOnIdle(); + // Assert + assertEquals(expectedIsAutoDeleteOnIdle, actualIsAutoDeleteOnIdle); } @Test public void testGetSetPartioningPolicy() { + // Arrange + PartitioningPolicy expectedPartitioningPolicy = PartitioningPolicy.NO_PARTITIONING; + QueueInfo QueueInfo = new QueueInfo(); + + // Act + PartitioningPolicy actualPartitioningPolicy = QueueInfo.setPartitioningPolicy(expectedPartitioningPolicy) + .getPartitioningPolicy(); + // Assert + assertEquals(expectedPartitioningPolicy, actualPartitioningPolicy); } @Test public void testGetSetEntityAvailabilityStatus() { + // Arrange + EntityAvailabilityStatus expectedEntityAvailabilityStatus = EntityAvailabilityStatus.AVAILABLE; + QueueInfo QueueInfo = new QueueInfo(); + // Act + EntityAvailabilityStatus actualEntityAvailabilityStatus = QueueInfo.setEntityAvailabilityStatus( + expectedEntityAvailabilityStatus).getEntityAvailabilityStatus(); + + // Assert + assertEquals(expectedEntityAvailabilityStatus, actualEntityAvailabilityStatus); } } From a56d910250d7ac37eb91a5f21bd4916b9540d5bc Mon Sep 17 00:00:00 2001 From: Albert Cheng Date: Wed, 24 Apr 2013 10:30:42 -0700 Subject: [PATCH 10/25] ensure all the unit tests passes. --- .../services/serviceBus/models/QueueInfo.java | 186 +++++++++++++++++- .../serviceBus/models/QueueInfoTest.java | 96 ++++----- 2 files changed, 226 insertions(+), 56 deletions(-) diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/QueueInfo.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/QueueInfo.java index 961c8340bd27..07a79e8dfe5e 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/QueueInfo.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/QueueInfo.java @@ -80,7 +80,7 @@ public String getPath() { * @param value * A String that represents the name of the queue. * - * @return A Queue object that represents the updated queue. + * @return A QueueInfo object that represents the updated queue. */ public QueueInfo setPath(String value) { getEntry().setTitle(value); @@ -102,7 +102,7 @@ public Duration getLockDuration() { * @param value * The duration, in seconds, of the lock. * - * @return A Queue object that represents the updated queue. + * @return A QueueInfo object that represents the updated queue. */ public QueueInfo setLockDuration(Duration value) { getModel().setLockDuration(value); @@ -124,7 +124,7 @@ public Long getMaxSizeInMegabytes() { * @param value * The maximum size, in megabytes, of the queue. * - * @return A Queue object that represents the updated queue. + * @return A QueueInfo object that represents the updated queue. */ public QueueInfo setMaxSizeInMegabytes(Long value) { getModel().setMaxSizeInMegabytes(value); @@ -146,7 +146,7 @@ public Boolean isRequiresDuplicateDetection() { * @param value * true if duplicate message detection is required; otherwise, false. * - * @return A Queue object that represents the updated queue. + * @return A QueueInfo object that represents the updated queue. */ public QueueInfo setRequiresDuplicateDetection(Boolean value) { getModel().setRequiresDuplicateDetection(value); @@ -168,7 +168,7 @@ public Boolean isRequiresSession() { * @param value * true if the queue is session aware; otherwise, false. * - * @return A Queue object that represents the updated queue. + * @return A QueueInfo object that represents the updated queue. */ public QueueInfo setRequiresSession(Boolean value) { getModel().setRequiresSession(value); @@ -191,19 +191,31 @@ public Duration getDefaultMessageTimeToLive() { * @param value * A Duration object that represents the default message TTL. * - * @return A Queue object that represents the updated queue. + * @return A QueueInfo object that represents the updated queue. */ public QueueInfo setDefaultMessageTimeToLive(Duration value) { getModel().setDefaultMessageTimeToLive(value); return this; } + /** + * Gets the time span before auto deletion starts. + * + * @return A Duration object that represents the time span before auto deletion. + */ public Duration getAutoDeleteOnIdle() { return getModel().getAutoDeleteOnIdle(); } - public QueueInfo setAutoDeleteOnIdle(Duration duration) { - getModel().setAutoDeleteOnIdle(duration); + /** + * Sets the time span before auto deletion starts. + * + * @param autoDeleteOnIdle + * A Duration object that represents the time span before auto deletion starts. + * @return A QueueInfo object that represents the updated queue. + */ + public QueueInfo setAutoDeleteOnIdle(Duration autoDeleteOnIdle) { + getModel().setAutoDeleteOnIdle(autoDeleteOnIdle); return this; } @@ -307,6 +319,13 @@ public Long getSizeInBytes() { return getModel().getSizeInBytes(); } + /** + * Sets the size in bytes. + * + * @param sizeInBytes + * the size in bytes + * @return the queue info + */ public QueueInfo setSizeInBytes(Long sizeInBytes) { getModel().setSizeInBytes(sizeInBytes); return this; @@ -321,114 +340,265 @@ public Long getMessageCount() { return getModel().getMessageCount(); } + /** + * Sets the message count. + * + * @param messageCount + * the message count + * @return the queue info + */ public QueueInfo setMessageCount(Long messageCount) { getModel().setMessageCount(messageCount); return this; } + /** + * Sets the count details. + * + * @param countDetails + * the count details + * @return the queue info + */ public QueueInfo setCountDetails(MessageCountDetails countDetails) { getModel().setCountDetails(countDetails); return this; } + /** + * Gets the count details. + * + * @return the count details + */ public MessageCountDetails getCountDetails() { return getModel().getCountDetails(); } + /** + * Gets the authorization. + * + * @return the authorization + */ public AuthorizationRules getAuthorization() { return getModel().getAuthorizationRules(); } + /** + * Sets the authorization. + * + * @param authorizationRules + * the authorization rules + * @return the queue info + */ public QueueInfo setAuthorization(AuthorizationRules authorizationRules) { getModel().setAuthorizationRules(authorizationRules); return this; } + /** + * Checks if is anonymous accessible. + * + * @return the boolean + */ public Boolean isAnonymousAccessible() { return getModel().isIsAnonymousAccessible(); } + /** + * Sets the is anonymous accessible. + * + * @param isAnonymousAccessible + * the is anonymous accessible + * @return the queue info + */ public QueueInfo setIsAnonymousAccessible(Boolean isAnonymousAccessible) { getModel().setIsAnonymousAccessible(isAnonymousAccessible); return this; } + /** + * Checks if is support ordering. + * + * @return the boolean + */ public Boolean isSupportOrdering() { return getModel().isSupportOrdering(); } + /** + * Sets the support ordering. + * + * @param supportOrdering + * the support ordering + * @return the queue info + */ public QueueInfo setSupportOrdering(Boolean supportOrdering) { getModel().setSupportOrdering(supportOrdering); return this; } + /** + * Gets the status. + * + * @return the status + */ public EntityStatus getStatus() { return getModel().getStatus(); } + /** + * Sets the status. + * + * @param entityStatus + * the entity status + * @return the queue info + */ public QueueInfo setStatus(EntityStatus entityStatus) { getModel().setStatus(entityStatus); return this; } + /** + * Gets the entity availability status. + * + * @return the entity availability status + */ public EntityAvailabilityStatus getEntityAvailabilityStatus() { return getModel().getEntityAvailabilityStatus(); } + /** + * Sets the entity availability status. + * + * @param entityAvailabilityStatus + * the entity availability status + * @return the queue info + */ public QueueInfo setEntityAvailabilityStatus(EntityAvailabilityStatus entityAvailabilityStatus) { getModel().setEntityAvailabilityStatus(entityAvailabilityStatus); return this; } + /** + * Gets the forward to. + * + * @return the forward to + */ public String getForwardTo() { return getModel().getForwardTo(); } + /** + * Sets the forward to. + * + * @param forwardTo + * the forward to + * @return the queue info + */ public QueueInfo setForwardTo(String forwardTo) { getModel().setForwardTo(forwardTo); return this; } + /** + * Gets the created at. + * + * @return the created at + */ public Calendar getCreatedAt() { return getModel().getCreatedAt(); } + /** + * Sets the created at. + * + * @param createdAt + * the created at + * @return the queue info + */ public QueueInfo setCreatedAt(Calendar createdAt) { getModel().setCreatedAt(createdAt); return this; } + /** + * Gets the updated at. + * + * @return the updated at + */ public Calendar getUpdatedAt() { return getModel().getUpdatedAt(); } + /** + * Sets the updated at. + * + * @param updatedAt + * the updated at + * @return the queue info + */ public QueueInfo setUpdatedAt(Calendar updatedAt) { getModel().setUpdatedAt(updatedAt); return this; } + /** + * Gets the accessed at. + * + * @return the accessed at + */ public Calendar getAccessedAt() { return getModel().getAccessedAt(); } + /** + * Sets the accessed at. + * + * @param accessedAt + * the accessed at + * @return the queue info + */ public QueueInfo setAccessedAt(Calendar accessedAt) { getModel().setAccessedAt(accessedAt); return this; } + /** + * Gets the partitioning policy. + * + * @return the partitioning policy + */ public PartitioningPolicy getPartitioningPolicy() { return getModel().getPartitioningPolicy(); } + /** + * Sets the partitioning policy. + * + * @param partitioningPolicy + * the partitioning policy + * @return the queue info + */ public QueueInfo setPartitioningPolicy(PartitioningPolicy partitioningPolicy) { getModel().setPartitioningPolicy(partitioningPolicy); return this; } + /** + * Sets the user metadata. + * + * @return the string + */ public String setUserMetadata() { return getModel().getUserMetadata(); } + /** + * Sets the user metadata. + * + * @param userMetadata + * the user metadata + * @return the queue info + */ public QueueInfo setUserMetadata(String userMetadata) { getModel().setUserMetadata(userMetadata); return this; diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/serviceBus/models/QueueInfoTest.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/serviceBus/models/QueueInfoTest.java index 6303db54332e..2cd89c55de8d 100644 --- a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/serviceBus/models/QueueInfoTest.java +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/serviceBus/models/QueueInfoTest.java @@ -47,10 +47,10 @@ private Duration createDuration(int milliSeconds) { public void testGetSetLockDuration() { // Arrange Duration expectedLockDuration = createDuration(100); - QueueInfo QueueInfo = new QueueInfo(); + QueueInfo queueInfo = new QueueInfo(); // Act - Duration actualLockDuration = QueueInfo.setLockDuration(expectedLockDuration).getLockDuration(); + Duration actualLockDuration = queueInfo.setLockDuration(expectedLockDuration).getLockDuration(); // Assert assertEquals(expectedLockDuration, actualLockDuration); @@ -61,10 +61,10 @@ public void testGetSetLockDuration() { public void testGetSetMaxSizeInMegabytes() { // Arrange Long expectedMaxSizeInMegabytes = 1024L; - QueueInfo QueueInfo = new QueueInfo(); + QueueInfo queueInfo = new QueueInfo(); // Act - Long actualMaxSizeInMegabytes = QueueInfo.setMaxSizeInMegabytes(expectedMaxSizeInMegabytes) + Long actualMaxSizeInMegabytes = queueInfo.setMaxSizeInMegabytes(expectedMaxSizeInMegabytes) .getMaxSizeInMegabytes(); // Assert @@ -76,10 +76,10 @@ public void testGetSetMaxSizeInMegabytes() { public void testGetSetRequiresDuplicateDetection() { // Arrange Boolean expectedRequiresDuplicateDetection = true; - QueueInfo QueueInfo = new QueueInfo(); + QueueInfo queueInfo = new QueueInfo(); // Act - Boolean actualRequiresDuplicateDetection = QueueInfo.setRequiresDuplicateDetection( + Boolean actualRequiresDuplicateDetection = queueInfo.setRequiresDuplicateDetection( expectedRequiresDuplicateDetection).isRequiresDuplicateDetection(); // Assert @@ -91,10 +91,10 @@ public void testGetSetRequiresDuplicateDetection() { public void testGetSetRequiresSession() { // Arrange Boolean expectedRequiresSession = true; - QueueInfo QueueInfo = new QueueInfo(); + QueueInfo queueInfo = new QueueInfo(); // Act - Boolean actualRequiresSession = QueueInfo.setRequiresSession(expectedRequiresSession).isRequiresSession(); + Boolean actualRequiresSession = queueInfo.setRequiresSession(expectedRequiresSession).isRequiresSession(); // Assert assertEquals(expectedRequiresSession, actualRequiresSession); @@ -104,10 +104,10 @@ public void testGetSetRequiresSession() { public void testGetSetDefaultMessageTimeToLive() { // Arrange Duration expectedDefaultMessageTimeToLive = createDuration(100); - QueueInfo QueueInfo = new QueueInfo(); + QueueInfo queueInfo = new QueueInfo(); // Act - Duration actualDefaultMessageTimeToLive = QueueInfo.setDefaultMessageTimeToLive( + Duration actualDefaultMessageTimeToLive = queueInfo.setDefaultMessageTimeToLive( expectedDefaultMessageTimeToLive).getDefaultMessageTimeToLive(); // Assert @@ -118,10 +118,10 @@ public void testGetSetDefaultMessageTimeToLive() { public void testGetSetDeadLetteringOnMessageExpiration() { // Arrange Boolean expectedDeadLetteringOnMessageExpiration = true; - QueueInfo QueueInfo = new QueueInfo(); + QueueInfo queueInfo = new QueueInfo(); // Act - Boolean actualDeadLetteringOnMessageExpiration = QueueInfo.setDeadLetteringOnMessageExpiration( + Boolean actualDeadLetteringOnMessageExpiration = queueInfo.setDeadLetteringOnMessageExpiration( expectedDeadLetteringOnMessageExpiration).isDeadLetteringOnMessageExpiration(); // Assert @@ -132,10 +132,10 @@ public void testGetSetDeadLetteringOnMessageExpiration() { public void testGetSetDuplicateDetectionHistoryTimeWindow() { // Arrange Duration expectedDefaultMessageTimeToLive = createDuration(100); - QueueInfo QueueInfo = new QueueInfo(); + QueueInfo queueInfo = new QueueInfo(); // Act - Duration actualDefaultMessageTimeToLive = QueueInfo.setDefaultMessageTimeToLive( + Duration actualDefaultMessageTimeToLive = queueInfo.setDefaultMessageTimeToLive( expectedDefaultMessageTimeToLive).getDefaultMessageTimeToLive(); // Assert @@ -146,10 +146,10 @@ public void testGetSetDuplicateDetectionHistoryTimeWindow() { public void testGetSetMaxDeliveryCount() { // Arrange Integer expectedMaxDeliveryCount = 1024; - QueueInfo QueueInfo = new QueueInfo(); + QueueInfo queueInfo = new QueueInfo(); // Act - Integer actualMaxDeliveryCount = QueueInfo.setMaxDeliveryCount(expectedMaxDeliveryCount).getMaxDeliveryCount(); + Integer actualMaxDeliveryCount = queueInfo.setMaxDeliveryCount(expectedMaxDeliveryCount).getMaxDeliveryCount(); // Assert assertEquals(expectedMaxDeliveryCount, actualMaxDeliveryCount); @@ -159,10 +159,10 @@ public void testGetSetMaxDeliveryCount() { public void testGetSetEnableBatchedOperations() { // Arrange Boolean expectedEnableBatchedOperations = true; - QueueInfo QueueInfo = new QueueInfo(); + QueueInfo queueInfo = new QueueInfo(); // Act - Boolean actualEnableBatchedOperations = QueueInfo.setEnableBatchedOperations(expectedEnableBatchedOperations) + Boolean actualEnableBatchedOperations = queueInfo.setEnableBatchedOperations(expectedEnableBatchedOperations) .isEnableBatchedOperations(); // Assert @@ -173,10 +173,10 @@ public void testGetSetEnableBatchedOperations() { public void testGetSetSizeInBytes() { // Arrange Long expectedSizeInBytes = 1024L; - QueueInfo QueueInfo = new QueueInfo(); + QueueInfo queueInfo = new QueueInfo(); // Act - Long actualSizeInBytes = QueueInfo.setSizeInBytes(expectedSizeInBytes).getSizeInBytes(); + Long actualSizeInBytes = queueInfo.setSizeInBytes(expectedSizeInBytes).getSizeInBytes(); // Assert assertEquals(expectedSizeInBytes, actualSizeInBytes); @@ -186,10 +186,10 @@ public void testGetSetSizeInBytes() { public void testGetSetMessageCount() { // Arrange Long expectedMessageCount = 1024L; - QueueInfo QueueInfo = new QueueInfo(); + QueueInfo queueInfo = new QueueInfo(); // Act - Long actualMessageCount = QueueInfo.setMessageCount(expectedMessageCount).getMessageCount(); + Long actualMessageCount = queueInfo.setMessageCount(expectedMessageCount).getMessageCount(); // Assert assertEquals(expectedMessageCount, actualMessageCount); @@ -199,10 +199,10 @@ public void testGetSetMessageCount() { public void testGetSetIsAnonymousAccessible() { // Arrange Boolean expectedIsAnonymousAccessible = true; - QueueInfo QueueInfo = new QueueInfo(); + QueueInfo queueInfo = new QueueInfo(); // Act - Boolean actualIsAnonymousAccessible = QueueInfo.setIsAnonymousAccessible(expectedIsAnonymousAccessible) + Boolean actualIsAnonymousAccessible = queueInfo.setIsAnonymousAccessible(expectedIsAnonymousAccessible) .isAnonymousAccessible(); // Assert @@ -213,10 +213,10 @@ public void testGetSetIsAnonymousAccessible() { public void testGetSetAuthorization() { // Arrange AuthorizationRules expectedAuthorizationRules = new AuthorizationRules(); - QueueInfo QueueInfo = new QueueInfo(); + QueueInfo queueInfo = new QueueInfo(); // Act - AuthorizationRules actualAuthorizationRules = QueueInfo.setAuthorization(expectedAuthorizationRules) + AuthorizationRules actualAuthorizationRules = queueInfo.setAuthorization(expectedAuthorizationRules) .getAuthorization(); // Assert @@ -227,10 +227,10 @@ public void testGetSetAuthorization() { public void testGetSetStatus() { // Arrange EntityStatus expectedEntityStatus = EntityStatus.ACTIVE; - QueueInfo QueueInfo = new QueueInfo(); + QueueInfo queueInfo = new QueueInfo(); // Act - EntityStatus actualEntityStatus = QueueInfo.setStatus(expectedEntityStatus).getStatus(); + EntityStatus actualEntityStatus = queueInfo.setStatus(expectedEntityStatus).getStatus(); // Assert assertEquals(expectedEntityStatus, actualEntityStatus); @@ -240,10 +240,10 @@ public void testGetSetStatus() { public void testGetSetForwardTo() { // Arrange String expectedForwardTo = "forwardTo"; - QueueInfo QueueInfo = new QueueInfo(); + QueueInfo queueInfo = new QueueInfo(); // Act - String actualForwardTo = QueueInfo.setForwardTo(expectedForwardTo).getForwardTo(); + String actualForwardTo = queueInfo.setForwardTo(expectedForwardTo).getForwardTo(); // Assert assertEquals(expectedForwardTo, actualForwardTo); @@ -253,10 +253,10 @@ public void testGetSetForwardTo() { public void testGetSetCreatedAt() { // Arrange Calendar expectedCreatedAt = Calendar.getInstance(); - QueueInfo QueueInfo = new QueueInfo(); + QueueInfo queueInfo = new QueueInfo(); // Act - Calendar actualCreatedAt = QueueInfo.setCreatedAt(expectedCreatedAt).getCreatedAt(); + Calendar actualCreatedAt = queueInfo.setCreatedAt(expectedCreatedAt).getCreatedAt(); // Assert assertEquals(expectedCreatedAt, actualCreatedAt); @@ -266,10 +266,10 @@ public void testGetSetCreatedAt() { public void testGetSetUpdatedAt() { // Arrange Calendar expectedUpdatedAt = Calendar.getInstance(); - QueueInfo QueueInfo = new QueueInfo(); + QueueInfo queueInfo = new QueueInfo(); // Act - Calendar actualUpdatedAt = QueueInfo.setUpdatedAt(expectedUpdatedAt).getUpdatedAt(); + Calendar actualUpdatedAt = queueInfo.setUpdatedAt(expectedUpdatedAt).getUpdatedAt(); // Assert assertEquals(expectedUpdatedAt, actualUpdatedAt); @@ -279,10 +279,10 @@ public void testGetSetUpdatedAt() { public void testGetSetAccessedAt() { // Arrange Calendar expectedAccessedAt = Calendar.getInstance(); - QueueInfo QueueInfo = new QueueInfo(); + QueueInfo queueInfo = new QueueInfo(); // Act - Calendar actualAccessedAt = QueueInfo.setAccessedAt(expectedAccessedAt).getAccessedAt(); + Calendar actualAccessedAt = queueInfo.setAccessedAt(expectedAccessedAt).getAccessedAt(); // Assert assertEquals(expectedAccessedAt, actualAccessedAt); @@ -292,10 +292,10 @@ public void testGetSetAccessedAt() { public void testGetSetUserMetadata() { // Arrange Calendar expectedAccessedAt = Calendar.getInstance(); - QueueInfo QueueInfo = new QueueInfo(); + QueueInfo queueInfo = new QueueInfo(); // Act - Calendar actualAccessedAt = QueueInfo.setAccessedAt(expectedAccessedAt).getAccessedAt(); + Calendar actualAccessedAt = queueInfo.setAccessedAt(expectedAccessedAt).getAccessedAt(); // Assert assertEquals(expectedAccessedAt, actualAccessedAt); @@ -305,10 +305,10 @@ public void testGetSetUserMetadata() { public void testGetSetSupportOrdering() { // Arrange Boolean expectedIsSupportOrdering = true; - QueueInfo QueueInfo = new QueueInfo(); + QueueInfo queueInfo = new QueueInfo(); // Act - Boolean actualIsSupportOrdering = QueueInfo.setSupportOrdering(expectedIsSupportOrdering).isSupportOrdering(); + Boolean actualIsSupportOrdering = queueInfo.setSupportOrdering(expectedIsSupportOrdering).isSupportOrdering(); // Assert assertEquals(expectedIsSupportOrdering, actualIsSupportOrdering); @@ -318,10 +318,10 @@ public void testGetSetSupportOrdering() { public void testGetSetCountDetails() { // Arrange MessageCountDetails expectedCountDetails = new MessageCountDetails(); - QueueInfo QueueInfo = new QueueInfo(); + QueueInfo queueInfo = new QueueInfo(); // Act - MessageCountDetails actualCountDetails = QueueInfo.setCountDetails(expectedCountDetails).getCountDetails(); + MessageCountDetails actualCountDetails = queueInfo.setCountDetails(expectedCountDetails).getCountDetails(); // Assert assertEquals(expectedCountDetails, actualCountDetails); @@ -331,10 +331,10 @@ public void testGetSetCountDetails() { public void testGetSetAutoDeleteOnIdle() { // Arrange Duration expectedIsAutoDeleteOnIdle = createDuration(100); - QueueInfo QueueInfo = new QueueInfo(); + QueueInfo queueInfo = new QueueInfo(); // Act - Duration actualIsAutoDeleteOnIdle = QueueInfo.setAutoDeleteOnIdle(expectedIsAutoDeleteOnIdle) + Duration actualIsAutoDeleteOnIdle = queueInfo.setAutoDeleteOnIdle(expectedIsAutoDeleteOnIdle) .getAutoDeleteOnIdle(); // Assert @@ -345,10 +345,10 @@ public void testGetSetAutoDeleteOnIdle() { public void testGetSetPartioningPolicy() { // Arrange PartitioningPolicy expectedPartitioningPolicy = PartitioningPolicy.NO_PARTITIONING; - QueueInfo QueueInfo = new QueueInfo(); + QueueInfo queueInfo = new QueueInfo(); // Act - PartitioningPolicy actualPartitioningPolicy = QueueInfo.setPartitioningPolicy(expectedPartitioningPolicy) + PartitioningPolicy actualPartitioningPolicy = queueInfo.setPartitioningPolicy(expectedPartitioningPolicy) .getPartitioningPolicy(); // Assert @@ -359,10 +359,10 @@ public void testGetSetPartioningPolicy() { public void testGetSetEntityAvailabilityStatus() { // Arrange EntityAvailabilityStatus expectedEntityAvailabilityStatus = EntityAvailabilityStatus.AVAILABLE; - QueueInfo QueueInfo = new QueueInfo(); + QueueInfo queueInfo = new QueueInfo(); // Act - EntityAvailabilityStatus actualEntityAvailabilityStatus = QueueInfo.setEntityAvailabilityStatus( + EntityAvailabilityStatus actualEntityAvailabilityStatus = queueInfo.setEntityAvailabilityStatus( expectedEntityAvailabilityStatus).getEntityAvailabilityStatus(); // Assert From 2a601b070702a4c51e61c65e7dbebeb6cc09c1bb Mon Sep 17 00:00:00 2001 From: Albert Cheng Date: Wed, 24 Apr 2013 10:54:52 -0700 Subject: [PATCH 11/25] update queue info. --- .../services/serviceBus/models/QueueInfo.java | 92 +++++++++---------- .../serviceBus/models/QueueInfoTest.java | 6 +- 2 files changed, 49 insertions(+), 49 deletions(-) diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/QueueInfo.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/QueueInfo.java index 07a79e8dfe5e..5f152b54b1cf 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/QueueInfo.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/QueueInfo.java @@ -35,7 +35,7 @@ public class QueueInfo extends EntryModel { /** - * Creates an instance of the Queue class. + * Creates an instance of the QueueInfo class. */ public QueueInfo() { super(new Entry(), new QueueDescription()); @@ -45,7 +45,7 @@ public QueueInfo() { } /** - * Creates an instance of the Queue class using the specified entry. + * Creates an instance of the QueueInfo class using the specified entry. * * @param entry * An Entry object. @@ -55,7 +55,7 @@ public QueueInfo(Entry entry) { } /** - * Creates an instance of the Queue class using the specified name. + * Creates an instance of the QueueInfo class using the specified name. * * @param path * A String object that represents the name of the queue. @@ -234,7 +234,7 @@ public Boolean isDeadLetteringOnMessageExpiration() { * @param value * true if dead lettering is in effect; otherwise, false. * - * @return A Queue object that represents the updated queue. + * @return A QueueInfo object that represents the updated queue. */ public QueueInfo setDeadLetteringOnMessageExpiration(Boolean value) { getModel().setDeadLetteringOnMessageExpiration(value); @@ -259,7 +259,7 @@ public Duration getDuplicateDetectionHistoryTimeWindow() { * @param value * A Duration object that represents the time span for detecting message duplication. * - * @return A Queue object that represents the updated queue. + * @return A QueueInfo object that represents the updated queue. */ public QueueInfo setDuplicateDetectionHistoryTimeWindow(Duration value) { getModel().setDuplicateDetectionHistoryTimeWindow(value); @@ -269,7 +269,7 @@ public QueueInfo setDuplicateDetectionHistoryTimeWindow(Duration value) { /** * Returns the maximum delivery count for the queue. * - * @return The maximum delivery count. + * @return An Integer object that represents the maximum delivery count. */ public Integer getMaxDeliveryCount() { return getModel().getMaxDeliveryCount(); @@ -281,7 +281,7 @@ public Integer getMaxDeliveryCount() { * @param value * The maximum delivery count for the queue. * - * @return A Queue object that represents the updated queue. + * @return A QueueInfo object that represents the updated queue. */ public QueueInfo setMaxDeliveryCount(Integer value) { getModel().setMaxDeliveryCount(value); @@ -303,7 +303,7 @@ public Boolean isEnableBatchedOperations() { * @param value * true if batch operations are enabled; otherwise, false. * - * @return A Queue object that represents the updated queue. + * @return A QueueInfo object that represents the updated queue. */ public QueueInfo setEnableBatchedOperations(Boolean value) { getModel().setEnableBatchedOperations(value); @@ -313,7 +313,7 @@ public QueueInfo setEnableBatchedOperations(Boolean value) { /** * Returns the size of the queue. * - * @return The size, in bytes, of the queue. + * @return A Long object that represents the size of the queue in bytes. */ public Long getSizeInBytes() { return getModel().getSizeInBytes(); @@ -324,7 +324,7 @@ public Long getSizeInBytes() { * * @param sizeInBytes * the size in bytes - * @return the queue info + * @return A QueueInfo object that represents the updated queue. */ public QueueInfo setSizeInBytes(Long sizeInBytes) { getModel().setSizeInBytes(sizeInBytes); @@ -334,7 +334,7 @@ public QueueInfo setSizeInBytes(Long sizeInBytes) { /** * Returns the number of messages in the queue. * - * @return The number of messages in the queue. + * @return A Long object that represents the number of messages in the queue. */ public Long getMessageCount() { return getModel().getMessageCount(); @@ -345,7 +345,7 @@ public Long getMessageCount() { * * @param messageCount * the message count - * @return the queue info + * @return A QueueInfo object that represents the updated queue. */ public QueueInfo setMessageCount(Long messageCount) { getModel().setMessageCount(messageCount); @@ -356,8 +356,8 @@ public QueueInfo setMessageCount(Long messageCount) { * Sets the count details. * * @param countDetails - * the count details - * @return the queue info + * A MessageCountDetails object that contains the details of the message count. + * @return A QueueInfo object that represents the updated queue. */ public QueueInfo setCountDetails(MessageCountDetails countDetails) { getModel().setCountDetails(countDetails); @@ -367,7 +367,7 @@ public QueueInfo setCountDetails(MessageCountDetails countDetails) { /** * Gets the count details. * - * @return the count details + * @return A MessageCountDetails object that contains the details of the message count. */ public MessageCountDetails getCountDetails() { return getModel().getCountDetails(); @@ -376,7 +376,7 @@ public MessageCountDetails getCountDetails() { /** * Gets the authorization. * - * @return the authorization + * @return A AuthorizationRules instance which contains the rules of the authorization. */ public AuthorizationRules getAuthorization() { return getModel().getAuthorizationRules(); @@ -387,7 +387,7 @@ public AuthorizationRules getAuthorization() { * * @param authorizationRules * the authorization rules - * @return the queue info + * @return A QueueInfo object that represents the updated queue. */ public QueueInfo setAuthorization(AuthorizationRules authorizationRules) { getModel().setAuthorizationRules(authorizationRules); @@ -397,7 +397,7 @@ public QueueInfo setAuthorization(AuthorizationRules authorizationRules) { /** * Checks if is anonymous accessible. * - * @return the boolean + * @return true if the queue can be accessed anonymously. Otherwise, false. */ public Boolean isAnonymousAccessible() { return getModel().isIsAnonymousAccessible(); @@ -408,7 +408,7 @@ public Boolean isAnonymousAccessible() { * * @param isAnonymousAccessible * the is anonymous accessible - * @return the queue info + * @return A QueueInfo object that represents the updated queue. */ public QueueInfo setIsAnonymousAccessible(Boolean isAnonymousAccessible) { getModel().setIsAnonymousAccessible(isAnonymousAccessible); @@ -418,7 +418,7 @@ public QueueInfo setIsAnonymousAccessible(Boolean isAnonymousAccessible) { /** * Checks if is support ordering. * - * @return the boolean + * @return true if ordering is supported, otherwise, false. */ public Boolean isSupportOrdering() { return getModel().isSupportOrdering(); @@ -428,8 +428,8 @@ public Boolean isSupportOrdering() { * Sets the support ordering. * * @param supportOrdering - * the support ordering - * @return the queue info + * A Boolean object represents whether the queue supports ordering. + * @return A QueueInfo object that represents the updated queue. */ public QueueInfo setSupportOrdering(Boolean supportOrdering) { getModel().setSupportOrdering(supportOrdering); @@ -439,7 +439,7 @@ public QueueInfo setSupportOrdering(Boolean supportOrdering) { /** * Gets the status. * - * @return the status + * @return A EntityStatus object. */ public EntityStatus getStatus() { return getModel().getStatus(); @@ -450,7 +450,7 @@ public EntityStatus getStatus() { * * @param entityStatus * the entity status - * @return the queue info + * @return A QueueInfo object that represents the updated queue. */ public QueueInfo setStatus(EntityStatus entityStatus) { getModel().setStatus(entityStatus); @@ -460,7 +460,7 @@ public QueueInfo setStatus(EntityStatus entityStatus) { /** * Gets the entity availability status. * - * @return the entity availability status + * @return A EntityAvailabilityStatus object which represents the availability status of the entity. */ public EntityAvailabilityStatus getEntityAvailabilityStatus() { return getModel().getEntityAvailabilityStatus(); @@ -470,8 +470,8 @@ public EntityAvailabilityStatus getEntityAvailabilityStatus() { * Sets the entity availability status. * * @param entityAvailabilityStatus - * the entity availability status - * @return the queue info + * A EntityAvailabilityStatus object. + * @return A QueueInfo object that represents the updated queue. */ public QueueInfo setEntityAvailabilityStatus(EntityAvailabilityStatus entityAvailabilityStatus) { getModel().setEntityAvailabilityStatus(entityAvailabilityStatus); @@ -491,8 +491,8 @@ public String getForwardTo() { * Sets the forward to. * * @param forwardTo - * the forward to - * @return the queue info + * A String object represents which queue the messages will be forwarded to. + * @return A QueueInfo object that represents the updated queue. */ public QueueInfo setForwardTo(String forwardTo) { getModel().setForwardTo(forwardTo); @@ -502,7 +502,7 @@ public QueueInfo setForwardTo(String forwardTo) { /** * Gets the created at. * - * @return the created at + * @return A Calendar object which represents the time of the queue created at. */ public Calendar getCreatedAt() { return getModel().getCreatedAt(); @@ -512,8 +512,8 @@ public Calendar getCreatedAt() { * Sets the created at. * * @param createdAt - * the created at - * @return the queue info + * A Calendar ojbect which represnets the time of the queue created at. + * @return A QueueInfo object that represents the updated queue. */ public QueueInfo setCreatedAt(Calendar createdAt) { getModel().setCreatedAt(createdAt); @@ -523,7 +523,7 @@ public QueueInfo setCreatedAt(Calendar createdAt) { /** * Gets the updated at. * - * @return the updated at + * @return A Calendar object which represents the time that the queue was updated at. */ public Calendar getUpdatedAt() { return getModel().getUpdatedAt(); @@ -533,8 +533,8 @@ public Calendar getUpdatedAt() { * Sets the updated at. * * @param updatedAt - * the updated at - * @return the queue info + * A Calendar object which represents the time that the queue was updated at. + * @return A QueueInfo object that represents the updated queue. */ public QueueInfo setUpdatedAt(Calendar updatedAt) { getModel().setUpdatedAt(updatedAt); @@ -544,7 +544,7 @@ public QueueInfo setUpdatedAt(Calendar updatedAt) { /** * Gets the accessed at. * - * @return the accessed at + * @return A Calendar object which represents the time that the queue was accessed at. */ public Calendar getAccessedAt() { return getModel().getAccessedAt(); @@ -554,8 +554,8 @@ public Calendar getAccessedAt() { * Sets the accessed at. * * @param accessedAt - * the accessed at - * @return the queue info + * A Calendar object which represents the time that the queue was accessed at. + * @return A QueueInfo object that represents the updated queue. */ public QueueInfo setAccessedAt(Calendar accessedAt) { getModel().setAccessedAt(accessedAt); @@ -565,7 +565,7 @@ public QueueInfo setAccessedAt(Calendar accessedAt) { /** * Gets the partitioning policy. * - * @return the partitioning policy + * @return A PartitioningPolicy represents the partitioning policy. */ public PartitioningPolicy getPartitioningPolicy() { return getModel().getPartitioningPolicy(); @@ -575,8 +575,8 @@ public PartitioningPolicy getPartitioningPolicy() { * Sets the partitioning policy. * * @param partitioningPolicy - * the partitioning policy - * @return the queue info + * A PartitioningPolicy represents the partitioning policy. + * @return A QueueInfo object that represents the updated queue. */ public QueueInfo setPartitioningPolicy(PartitioningPolicy partitioningPolicy) { getModel().setPartitioningPolicy(partitioningPolicy); @@ -584,11 +584,11 @@ public QueueInfo setPartitioningPolicy(PartitioningPolicy partitioningPolicy) { } /** - * Sets the user metadata. + * Gets the user metadata. * - * @return the string + * @return A String objects which contains the user metadata. */ - public String setUserMetadata() { + public String getUserMetadata() { return getModel().getUserMetadata(); } @@ -596,8 +596,8 @@ public String setUserMetadata() { * Sets the user metadata. * * @param userMetadata - * the user metadata - * @return the queue info + * A String objects which contains the user metadata. + * @return A QueueInfo object that represents the updated queue. */ public QueueInfo setUserMetadata(String userMetadata) { getModel().setUserMetadata(userMetadata); diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/serviceBus/models/QueueInfoTest.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/serviceBus/models/QueueInfoTest.java index 2cd89c55de8d..80887432d940 100644 --- a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/serviceBus/models/QueueInfoTest.java +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/serviceBus/models/QueueInfoTest.java @@ -291,14 +291,14 @@ public void testGetSetAccessedAt() { @Test public void testGetSetUserMetadata() { // Arrange - Calendar expectedAccessedAt = Calendar.getInstance(); + String expectedUserMetadata = "expectedUserMetaData"; QueueInfo queueInfo = new QueueInfo(); // Act - Calendar actualAccessedAt = queueInfo.setAccessedAt(expectedAccessedAt).getAccessedAt(); + String actualUserMetadata = queueInfo.setUserMetadata(expectedUserMetadata).getUserMetadata(); // Assert - assertEquals(expectedAccessedAt, actualAccessedAt); + assertEquals(expectedUserMetadata, actualUserMetadata); } @Test From 028d7fdb0f3995c9ed7fc616b71fea06904f7281 Mon Sep 17 00:00:00 2001 From: Albert Cheng Date: Thu, 25 Apr 2013 16:48:04 -0700 Subject: [PATCH 12/25] update the schema for Topic, Subscription and Rule. --- ...netservices.2010.10.servicebus.connect.xsd | 189 ++++++++++++++++++ 1 file changed, 189 insertions(+) diff --git a/microsoft-azure-api/src/main/resources/schemas.microsoft.com.netservices.2010.10.servicebus.connect.xsd b/microsoft-azure-api/src/main/resources/schemas.microsoft.com.netservices.2010.10.servicebus.connect.xsd index 6966e340ecb2..70c4d4e7ed41 100644 --- a/microsoft-azure-api/src/main/resources/schemas.microsoft.com.netservices.2010.10.servicebus.connect.xsd +++ b/microsoft-azure-api/src/main/resources/schemas.microsoft.com.netservices.2010.10.servicebus.connect.xsd @@ -260,6 +260,69 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -279,6 +342,27 @@ + + + + + + + + + + + + + + + + + + + + + @@ -445,6 +529,111 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 1451eb7ce143960ba6989f389701f58ad316baa9 Mon Sep 17 00:00:00 2001 From: Albert Cheng Date: Thu, 25 Apr 2013 17:33:00 -0700 Subject: [PATCH 13/25] implement RuleInfo. --- .../services/serviceBus/models/RuleInfo.java | 20 + .../services/serviceBus/models/TopicInfo.java | 21 +- .../serviceBus/models/RuleInfoTest.java | 94 +++++ .../models/SubscriptionInfoTest.java | 376 ++++++++++++++++++ .../serviceBus/models/TopicInfoTest.java | 372 +++++++++++++++++ 5 files changed, 875 insertions(+), 8 deletions(-) create mode 100644 microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/serviceBus/models/RuleInfoTest.java create mode 100644 microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/serviceBus/models/SubscriptionInfoTest.java create mode 100644 microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/serviceBus/models/TopicInfoTest.java diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/RuleInfo.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/RuleInfo.java index c5e862bbc1df..2004c57fa03f 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/RuleInfo.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/RuleInfo.java @@ -14,6 +14,8 @@ */ package com.microsoft.windowsazure.services.serviceBus.models; +import java.util.Calendar; + import javax.ws.rs.core.MediaType; import com.microsoft.windowsazure.services.serviceBus.implementation.Content; @@ -171,4 +173,22 @@ public RuleInfo withSqlRuleAction(String sqlExpression) { action.setCompatibilityLevel(20); return setAction(action); } + + public RuleInfo setTag(String tag) { + getModel().setTag(tag); + return this; + } + + public String getTag() { + return getModel().getTag(); + } + + public RuleInfo setCreatedAt(Calendar createdAt) { + getModel().setCreatedAt(createdAt); + return this; + } + + public Calendar getCreatedAt() { + return getModel().getCreatedAt(); + } } diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/TopicInfo.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/TopicInfo.java index d53474146682..ff31532ccdd2 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/TopicInfo.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/TopicInfo.java @@ -2,21 +2,22 @@ * 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.models; import javax.ws.rs.core.MediaType; import javax.xml.datatype.Duration; +import com.microsoft.windowsazure.services.serviceBus.implementation.AuthorizationRules; import com.microsoft.windowsazure.services.serviceBus.implementation.Content; import com.microsoft.windowsazure.services.serviceBus.implementation.Entry; import com.microsoft.windowsazure.services.serviceBus.implementation.EntryModel; @@ -199,4 +200,8 @@ public Long getSizeInBytes() { return getModel().getSizeInBytes(); } + public TopicInfo setAuthorization(AuthorizationRules authorizationRules) { + getModel().setAuthorizationRules(authorizationRules); + return this; + } } diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/serviceBus/models/RuleInfoTest.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/serviceBus/models/RuleInfoTest.java new file mode 100644 index 000000000000..1e0558302165 --- /dev/null +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/serviceBus/models/RuleInfoTest.java @@ -0,0 +1,94 @@ +/** + * 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. + */ +package com.microsoft.windowsazure.services.serviceBus.models; + +import static org.junit.Assert.*; + +import java.util.Calendar; + +import org.junit.Test; + +import com.microsoft.windowsazure.services.serviceBus.implementation.Filter; +import com.microsoft.windowsazure.services.serviceBus.implementation.RuleAction; + +public class RuleInfoTest { + + @Test + public void testGetSetFilter() { + // Arrange + Filter expectedFilter = new Filter(); + RuleInfo RuleInfo = new RuleInfo(); + + // Act + Filter actualFilter = RuleInfo.setFilter(expectedFilter).getFilter(); + + // Assert + assertEquals(expectedFilter, actualFilter); + + } + + @Test + public void testGetSetAction() { + // Arrange + RuleAction expectedAction = new RuleAction(); + RuleInfo RuleInfo = new RuleInfo(); + + // Act + RuleAction actualAction = RuleInfo.setAction(expectedAction).getAction(); + + // Assert + assertEquals(expectedAction, actualAction); + } + + @Test + public void testGetSetTag() { + // Arrange + String expectedTag = "expectedTag"; + RuleInfo RuleInfo = new RuleInfo(); + + // Act + String actualTag = RuleInfo.setTag(expectedTag).getTag(); + + // Assert + assertEquals(expectedTag, actualTag); + } + + @Test + public void testGetSetName() { + // Arrange + String expectedName = "expectedName"; + RuleInfo RuleInfo = new RuleInfo(); + + // Act + String actualName = RuleInfo.setName(expectedName).getName(); + + // Assert + assertEquals(expectedName, actualName); + } + + @Test + public void testGetSetCreatedAt() { + // Arrange + Calendar expectedCreatedAt = Calendar.getInstance(); + RuleInfo RuleInfo = new RuleInfo(); + + // Act + Calendar actualCreatedAt = RuleInfo.setCreatedAt(expectedCreatedAt).getCreatedAt(); + + // Assert + assertEquals(expectedCreatedAt, actualCreatedAt); + } + +} diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/serviceBus/models/SubscriptionInfoTest.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/serviceBus/models/SubscriptionInfoTest.java new file mode 100644 index 000000000000..9dc67b8c701f --- /dev/null +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/serviceBus/models/SubscriptionInfoTest.java @@ -0,0 +1,376 @@ +/** + * 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. + */ +package com.microsoft.windowsazure.services.serviceBus.models; + +import static org.junit.Assert.*; + +import java.util.Calendar; + +import javax.xml.datatype.DatatypeConfigurationException; +import javax.xml.datatype.DatatypeFactory; +import javax.xml.datatype.Duration; + +import org.junit.Test; + +import com.microsoft.windowsazure.services.serviceBus.implementation.AuthorizationRules; +import com.microsoft.windowsazure.services.serviceBus.implementation.EntityAvailabilityStatus; +import com.microsoft.windowsazure.services.serviceBus.implementation.EntityStatus; +import com.microsoft.windowsazure.services.serviceBus.implementation.MessageCountDetails; +import com.microsoft.windowsazure.services.serviceBus.implementation.PartitioningPolicy; + +public class SubscriptionInfoTest { + + private Duration createDuration(int milliSeconds) { + DatatypeFactory datatypeFactory; + try { + datatypeFactory = DatatypeFactory.newInstance(); + } + catch (DatatypeConfigurationException e) { + throw new RuntimeException(e); + } + return datatypeFactory.newDuration(milliSeconds); + } + + @Test + public void testGetSetLockDuration() { + // Arrange + Duration expectedLockDuration = createDuration(100); + SubscriptionInfo SubscriptionInfo = new SubscriptionInfo(); + + // Act + Duration actualLockDuration = SubscriptionInfo.setLockDuration(expectedLockDuration).getLockDuration(); + + // Assert + assertEquals(expectedLockDuration, actualLockDuration); + + } + + @Test + public void testGetSetMaxSizeInMegabytes() { + // Arrange + Long expectedMaxSizeInMegabytes = 1024L; + SubscriptionInfo SubscriptionInfo = new SubscriptionInfo(); + + // Act + Long actualMaxSizeInMegabytes = SubscriptionInfo.setMaxSizeInMegabytes(expectedMaxSizeInMegabytes) + .getMaxSizeInMegabytes(); + + // Assert + assertEquals(expectedMaxSizeInMegabytes, actualMaxSizeInMegabytes); + + } + + @Test + public void testGetSetRequiresDuplicateDetection() { + // Arrange + Boolean expectedRequiresDuplicateDetection = true; + SubscriptionInfo SubscriptionInfo = new SubscriptionInfo(); + + // Act + Boolean actualRequiresDuplicateDetection = SubscriptionInfo.setRequiresDuplicateDetection( + expectedRequiresDuplicateDetection).isRequiresDuplicateDetection(); + + // Assert + assertEquals(expectedRequiresDuplicateDetection, actualRequiresDuplicateDetection); + + } + + @Test + public void testGetSetRequiresSession() { + // Arrange + Boolean expectedRequiresSession = true; + SubscriptionInfo SubscriptionInfo = new SubscriptionInfo(); + + // Act + Boolean actualRequiresSession = SubscriptionInfo.setRequiresSession(expectedRequiresSession) + .isRequiresSession(); + + // Assert + assertEquals(expectedRequiresSession, actualRequiresSession); + } + + @Test + public void testGetSetDefaultMessageTimeToLive() { + // Arrange + Duration expectedDefaultMessageTimeToLive = createDuration(100); + SubscriptionInfo SubscriptionInfo = new SubscriptionInfo(); + + // Act + Duration actualDefaultMessageTimeToLive = SubscriptionInfo.setDefaultMessageTimeToLive( + expectedDefaultMessageTimeToLive).getDefaultMessageTimeToLive(); + + // Assert + assertEquals(expectedDefaultMessageTimeToLive, actualDefaultMessageTimeToLive); + } + + @Test + public void testGetSetDeadLetteringOnMessageExpiration() { + // Arrange + Boolean expectedDeadLetteringOnMessageExpiration = true; + SubscriptionInfo SubscriptionInfo = new SubscriptionInfo(); + + // Act + Boolean actualDeadLetteringOnMessageExpiration = SubscriptionInfo.setDeadLetteringOnMessageExpiration( + expectedDeadLetteringOnMessageExpiration).isDeadLetteringOnMessageExpiration(); + + // Assert + assertEquals(expectedDeadLetteringOnMessageExpiration, actualDeadLetteringOnMessageExpiration); + } + + @Test + public void testGetSetDuplicateDetectionHistoryTimeWindow() { + // Arrange + Duration expectedDefaultMessageTimeToLive = createDuration(100); + SubscriptionInfo SubscriptionInfo = new SubscriptionInfo(); + + // Act + Duration actualDefaultMessageTimeToLive = SubscriptionInfo.setDefaultMessageTimeToLive( + expectedDefaultMessageTimeToLive).getDefaultMessageTimeToLive(); + + // Assert + assertEquals(expectedDefaultMessageTimeToLive, actualDefaultMessageTimeToLive); + } + + @Test + public void testGetSetMaxDeliveryCount() { + // Arrange + Integer expectedMaxDeliveryCount = 1024; + SubscriptionInfo SubscriptionInfo = new SubscriptionInfo(); + + // Act + Integer actualMaxDeliveryCount = SubscriptionInfo.setMaxDeliveryCount(expectedMaxDeliveryCount) + .getMaxDeliveryCount(); + + // Assert + assertEquals(expectedMaxDeliveryCount, actualMaxDeliveryCount); + } + + @Test + public void testGetSetEnableBatchedOperations() { + // Arrange + Boolean expectedEnableBatchedOperations = true; + SubscriptionInfo SubscriptionInfo = new SubscriptionInfo(); + + // Act + Boolean actualEnableBatchedOperations = SubscriptionInfo.setEnableBatchedOperations( + expectedEnableBatchedOperations).isEnableBatchedOperations(); + + // Assert + assertEquals(expectedEnableBatchedOperations, actualEnableBatchedOperations); + } + + @Test + public void testGetSetSizeInBytes() { + // Arrange + Long expectedSizeInBytes = 1024L; + SubscriptionInfo SubscriptionInfo = new SubscriptionInfo(); + + // Act + Long actualSizeInBytes = SubscriptionInfo.setSizeInBytes(expectedSizeInBytes).getSizeInBytes(); + + // Assert + assertEquals(expectedSizeInBytes, actualSizeInBytes); + } + + @Test + public void testGetSetMessageCount() { + // Arrange + Long expectedMessageCount = 1024L; + SubscriptionInfo SubscriptionInfo = new SubscriptionInfo(); + + // Act + Long actualMessageCount = SubscriptionInfo.setMessageCount(expectedMessageCount).getMessageCount(); + + // Assert + assertEquals(expectedMessageCount, actualMessageCount); + } + + @Test + public void testGetSetIsAnonymousAccessible() { + // Arrange + Boolean expectedIsAnonymousAccessible = true; + SubscriptionInfo SubscriptionInfo = new SubscriptionInfo(); + + // Act + Boolean actualIsAnonymousAccessible = SubscriptionInfo.setIsAnonymousAccessible(expectedIsAnonymousAccessible) + .isAnonymousAccessible(); + + // Assert + assertEquals(expectedIsAnonymousAccessible, actualIsAnonymousAccessible); + } + + @Test + public void testGetSetAuthorization() { + // Arrange + AuthorizationRules expectedAuthorizationRules = new AuthorizationRules(); + SubscriptionInfo SubscriptionInfo = new SubscriptionInfo(); + + // Act + AuthorizationRules actualAuthorizationRules = SubscriptionInfo.setAuthorization(expectedAuthorizationRules) + .getAuthorization(); + + // Assert + assertEquals(expectedAuthorizationRules, actualAuthorizationRules); + } + + @Test + public void testGetSetStatus() { + // Arrange + EntityStatus expectedEntityStatus = EntityStatus.ACTIVE; + SubscriptionInfo SubscriptionInfo = new SubscriptionInfo(); + + // Act + EntityStatus actualEntityStatus = SubscriptionInfo.setStatus(expectedEntityStatus).getStatus(); + + // Assert + assertEquals(expectedEntityStatus, actualEntityStatus); + } + + @Test + public void testGetSetForwardTo() { + // Arrange + String expectedForwardTo = "forwardTo"; + SubscriptionInfo SubscriptionInfo = new SubscriptionInfo(); + + // Act + String actualForwardTo = SubscriptionInfo.setForwardTo(expectedForwardTo).getForwardTo(); + + // Assert + assertEquals(expectedForwardTo, actualForwardTo); + } + + @Test + public void testGetSetCreatedAt() { + // Arrange + Calendar expectedCreatedAt = Calendar.getInstance(); + SubscriptionInfo SubscriptionInfo = new SubscriptionInfo(); + + // Act + Calendar actualCreatedAt = SubscriptionInfo.setCreatedAt(expectedCreatedAt).getCreatedAt(); + + // Assert + assertEquals(expectedCreatedAt, actualCreatedAt); + } + + @Test + public void testGetSetUpdatedAt() { + // Arrange + Calendar expectedUpdatedAt = Calendar.getInstance(); + SubscriptionInfo SubscriptionInfo = new SubscriptionInfo(); + + // Act + Calendar actualUpdatedAt = SubscriptionInfo.setUpdatedAt(expectedUpdatedAt).getUpdatedAt(); + + // Assert + assertEquals(expectedUpdatedAt, actualUpdatedAt); + } + + @Test + public void testGetSetAccessedAt() { + // Arrange + Calendar expectedAccessedAt = Calendar.getInstance(); + SubscriptionInfo SubscriptionInfo = new SubscriptionInfo(); + + // Act + Calendar actualAccessedAt = SubscriptionInfo.setAccessedAt(expectedAccessedAt).getAccessedAt(); + + // Assert + assertEquals(expectedAccessedAt, actualAccessedAt); + } + + @Test + public void testGetSetUserMetadata() { + // Arrange + String expectedUserMetadata = "expectedUserMetaData"; + SubscriptionInfo SubscriptionInfo = new SubscriptionInfo(); + + // Act + String actualUserMetadata = SubscriptionInfo.setUserMetadata(expectedUserMetadata).getUserMetadata(); + + // Assert + assertEquals(expectedUserMetadata, actualUserMetadata); + } + + @Test + public void testGetSetSupportOrdering() { + // Arrange + Boolean expectedIsSupportOrdering = true; + SubscriptionInfo SubscriptionInfo = new SubscriptionInfo(); + + // Act + Boolean actualIsSupportOrdering = SubscriptionInfo.setSupportOrdering(expectedIsSupportOrdering) + .isSupportOrdering(); + + // Assert + assertEquals(expectedIsSupportOrdering, actualIsSupportOrdering); + } + + @Test + public void testGetSetCountDetails() { + // Arrange + MessageCountDetails expectedCountDetails = new MessageCountDetails(); + SubscriptionInfo SubscriptionInfo = new SubscriptionInfo(); + + // Act + MessageCountDetails actualCountDetails = SubscriptionInfo.setCountDetails(expectedCountDetails) + .getCountDetails(); + + // Assert + assertEquals(expectedCountDetails, actualCountDetails); + } + + @Test + public void testGetSetAutoDeleteOnIdle() { + // Arrange + Duration expectedIsAutoDeleteOnIdle = createDuration(100); + SubscriptionInfo SubscriptionInfo = new SubscriptionInfo(); + + // Act + Duration actualIsAutoDeleteOnIdle = SubscriptionInfo.setAutoDeleteOnIdle(expectedIsAutoDeleteOnIdle) + .getAutoDeleteOnIdle(); + + // Assert + assertEquals(expectedIsAutoDeleteOnIdle, actualIsAutoDeleteOnIdle); + } + + @Test + public void testGetSetPartioningPolicy() { + // Arrange + PartitioningPolicy expectedPartitioningPolicy = PartitioningPolicy.NO_PARTITIONING; + SubscriptionInfo SubscriptionInfo = new SubscriptionInfo(); + + // Act + PartitioningPolicy actualPartitioningPolicy = SubscriptionInfo + .setPartitioningPolicy(expectedPartitioningPolicy).getPartitioningPolicy(); + + // Assert + assertEquals(expectedPartitioningPolicy, actualPartitioningPolicy); + } + + @Test + public void testGetSetEntityAvailabilityStatus() { + // Arrange + EntityAvailabilityStatus expectedEntityAvailabilityStatus = EntityAvailabilityStatus.AVAILABLE; + SubscriptionInfo SubscriptionInfo = new SubscriptionInfo(); + + // Act + EntityAvailabilityStatus actualEntityAvailabilityStatus = SubscriptionInfo.setEntityAvailabilityStatus( + expectedEntityAvailabilityStatus).getEntityAvailabilityStatus(); + + // Assert + assertEquals(expectedEntityAvailabilityStatus, actualEntityAvailabilityStatus); + } + +} diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/serviceBus/models/TopicInfoTest.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/serviceBus/models/TopicInfoTest.java new file mode 100644 index 000000000000..e616f9b950e1 --- /dev/null +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/serviceBus/models/TopicInfoTest.java @@ -0,0 +1,372 @@ +/** + * 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. + */ +package com.microsoft.windowsazure.services.serviceBus.models; + +import static org.junit.Assert.*; + +import java.util.Calendar; + +import javax.xml.datatype.DatatypeConfigurationException; +import javax.xml.datatype.DatatypeFactory; +import javax.xml.datatype.Duration; + +import org.junit.Test; + +import com.microsoft.windowsazure.services.serviceBus.implementation.AuthorizationRules; +import com.microsoft.windowsazure.services.serviceBus.implementation.EntityAvailabilityStatus; +import com.microsoft.windowsazure.services.serviceBus.implementation.EntityStatus; +import com.microsoft.windowsazure.services.serviceBus.implementation.MessageCountDetails; +import com.microsoft.windowsazure.services.serviceBus.implementation.PartitioningPolicy; + +public class TopicInfoTest { + + private Duration createDuration(int milliSeconds) { + DatatypeFactory datatypeFactory; + try { + datatypeFactory = DatatypeFactory.newInstance(); + } + catch (DatatypeConfigurationException e) { + throw new RuntimeException(e); + } + return datatypeFactory.newDuration(milliSeconds); + } + + @Test + public void testGetSetLockDuration() { + // Arrange + Duration expectedLockDuration = createDuration(100); + TopicInfo TopicInfo = new TopicInfo(); + + // Act + Duration actualLockDuration = TopicInfo.setLockDuration(expectedLockDuration).getLockDuration(); + + // Assert + assertEquals(expectedLockDuration, actualLockDuration); + + } + + @Test + public void testGetSetMaxSizeInMegabytes() { + // Arrange + Long expectedMaxSizeInMegabytes = 1024L; + TopicInfo TopicInfo = new TopicInfo(); + + // Act + Long actualMaxSizeInMegabytes = TopicInfo.setMaxSizeInMegabytes(expectedMaxSizeInMegabytes) + .getMaxSizeInMegabytes(); + + // Assert + assertEquals(expectedMaxSizeInMegabytes, actualMaxSizeInMegabytes); + + } + + @Test + public void testGetSetRequiresDuplicateDetection() { + // Arrange + Boolean expectedRequiresDuplicateDetection = true; + TopicInfo TopicInfo = new TopicInfo(); + + // Act + Boolean actualRequiresDuplicateDetection = TopicInfo.setRequiresDuplicateDetection( + expectedRequiresDuplicateDetection).isRequiresDuplicateDetection(); + + // Assert + assertEquals(expectedRequiresDuplicateDetection, actualRequiresDuplicateDetection); + + } + + @Test + public void testGetSetRequiresSession() { + // Arrange + Boolean expectedRequiresSession = true; + TopicInfo TopicInfo = new TopicInfo(); + + // Act + Boolean actualRequiresSession = TopicInfo.setRequiresSession(expectedRequiresSession).isRequiresSession(); + + // Assert + assertEquals(expectedRequiresSession, actualRequiresSession); + } + + @Test + public void testGetSetDefaultMessageTimeToLive() { + // Arrange + Duration expectedDefaultMessageTimeToLive = createDuration(100); + TopicInfo TopicInfo = new TopicInfo(); + + // Act + Duration actualDefaultMessageTimeToLive = TopicInfo.setDefaultMessageTimeToLive( + expectedDefaultMessageTimeToLive).getDefaultMessageTimeToLive(); + + // Assert + assertEquals(expectedDefaultMessageTimeToLive, actualDefaultMessageTimeToLive); + } + + @Test + public void testGetSetDeadLetteringOnMessageExpiration() { + // Arrange + Boolean expectedDeadLetteringOnMessageExpiration = true; + TopicInfo TopicInfo = new TopicInfo(); + + // Act + Boolean actualDeadLetteringOnMessageExpiration = TopicInfo.setDeadLetteringOnMessageExpiration( + expectedDeadLetteringOnMessageExpiration).isDeadLetteringOnMessageExpiration(); + + // Assert + assertEquals(expectedDeadLetteringOnMessageExpiration, actualDeadLetteringOnMessageExpiration); + } + + @Test + public void testGetSetDuplicateDetectionHistoryTimeWindow() { + // Arrange + Duration expectedDefaultMessageTimeToLive = createDuration(100); + TopicInfo TopicInfo = new TopicInfo(); + + // Act + Duration actualDefaultMessageTimeToLive = TopicInfo.setDefaultMessageTimeToLive( + expectedDefaultMessageTimeToLive).getDefaultMessageTimeToLive(); + + // Assert + assertEquals(expectedDefaultMessageTimeToLive, actualDefaultMessageTimeToLive); + } + + @Test + public void testGetSetMaxDeliveryCount() { + // Arrange + Integer expectedMaxDeliveryCount = 1024; + TopicInfo TopicInfo = new TopicInfo(); + + // Act + Integer actualMaxDeliveryCount = TopicInfo.setMaxDeliveryCount(expectedMaxDeliveryCount).getMaxDeliveryCount(); + + // Assert + assertEquals(expectedMaxDeliveryCount, actualMaxDeliveryCount); + } + + @Test + public void testGetSetEnableBatchedOperations() { + // Arrange + Boolean expectedEnableBatchedOperations = true; + TopicInfo TopicInfo = new TopicInfo(); + + // Act + Boolean actualEnableBatchedOperations = TopicInfo.setEnableBatchedOperations(expectedEnableBatchedOperations) + .isEnableBatchedOperations(); + + // Assert + assertEquals(expectedEnableBatchedOperations, actualEnableBatchedOperations); + } + + @Test + public void testGetSetSizeInBytes() { + // Arrange + Long expectedSizeInBytes = 1024L; + TopicInfo TopicInfo = new TopicInfo(); + + // Act + Long actualSizeInBytes = TopicInfo.setSizeInBytes(expectedSizeInBytes).getSizeInBytes(); + + // Assert + assertEquals(expectedSizeInBytes, actualSizeInBytes); + } + + @Test + public void testGetSetMessageCount() { + // Arrange + Long expectedMessageCount = 1024L; + TopicInfo TopicInfo = new TopicInfo(); + + // Act + Long actualMessageCount = TopicInfo.setMessageCount(expectedMessageCount).getMessageCount(); + + // Assert + assertEquals(expectedMessageCount, actualMessageCount); + } + + @Test + public void testGetSetIsAnonymousAccessible() { + // Arrange + Boolean expectedIsAnonymousAccessible = true; + TopicInfo TopicInfo = new TopicInfo(); + + // Act + Boolean actualIsAnonymousAccessible = TopicInfo.setIsAnonymousAccessible(expectedIsAnonymousAccessible) + .isAnonymousAccessible(); + + // Assert + assertEquals(expectedIsAnonymousAccessible, actualIsAnonymousAccessible); + } + + @Test + public void testGetSetAuthorization() { + // Arrange + AuthorizationRules expectedAuthorizationRules = new AuthorizationRules(); + TopicInfo TopicInfo = new TopicInfo(); + + // Act + AuthorizationRules actualAuthorizationRules = TopicInfo.setAuthorization(expectedAuthorizationRules) + .getAuthorization(); + + // Assert + assertEquals(expectedAuthorizationRules, actualAuthorizationRules); + } + + @Test + public void testGetSetStatus() { + // Arrange + EntityStatus expectedEntityStatus = EntityStatus.ACTIVE; + TopicInfo TopicInfo = new TopicInfo(); + + // Act + EntityStatus actualEntityStatus = TopicInfo.setStatus(expectedEntityStatus).getStatus(); + + // Assert + assertEquals(expectedEntityStatus, actualEntityStatus); + } + + @Test + public void testGetSetForwardTo() { + // Arrange + String expectedForwardTo = "forwardTo"; + TopicInfo TopicInfo = new TopicInfo(); + + // Act + String actualForwardTo = TopicInfo.setForwardTo(expectedForwardTo).getForwardTo(); + + // Assert + assertEquals(expectedForwardTo, actualForwardTo); + } + + @Test + public void testGetSetCreatedAt() { + // Arrange + Calendar expectedCreatedAt = Calendar.getInstance(); + TopicInfo TopicInfo = new TopicInfo(); + + // Act + Calendar actualCreatedAt = TopicInfo.setCreatedAt(expectedCreatedAt).getCreatedAt(); + + // Assert + assertEquals(expectedCreatedAt, actualCreatedAt); + } + + @Test + public void testGetSetUpdatedAt() { + // Arrange + Calendar expectedUpdatedAt = Calendar.getInstance(); + TopicInfo TopicInfo = new TopicInfo(); + + // Act + Calendar actualUpdatedAt = TopicInfo.setUpdatedAt(expectedUpdatedAt).getUpdatedAt(); + + // Assert + assertEquals(expectedUpdatedAt, actualUpdatedAt); + } + + @Test + public void testGetSetAccessedAt() { + // Arrange + Calendar expectedAccessedAt = Calendar.getInstance(); + TopicInfo TopicInfo = new TopicInfo(); + + // Act + Calendar actualAccessedAt = TopicInfo.setAccessedAt(expectedAccessedAt).getAccessedAt(); + + // Assert + assertEquals(expectedAccessedAt, actualAccessedAt); + } + + @Test + public void testGetSetUserMetadata() { + // Arrange + String expectedUserMetadata = "expectedUserMetaData"; + TopicInfo TopicInfo = new TopicInfo(); + + // Act + String actualUserMetadata = TopicInfo.setUserMetadata(expectedUserMetadata).getUserMetadata(); + + // Assert + assertEquals(expectedUserMetadata, actualUserMetadata); + } + + @Test + public void testGetSetSupportOrdering() { + // Arrange + Boolean expectedIsSupportOrdering = true; + TopicInfo TopicInfo = new TopicInfo(); + + // Act + Boolean actualIsSupportOrdering = TopicInfo.setSupportOrdering(expectedIsSupportOrdering).isSupportOrdering(); + + // Assert + assertEquals(expectedIsSupportOrdering, actualIsSupportOrdering); + } + + @Test + public void testGetSetCountDetails() { + // Arrange + MessageCountDetails expectedCountDetails = new MessageCountDetails(); + TopicInfo TopicInfo = new TopicInfo(); + + // Act + MessageCountDetails actualCountDetails = TopicInfo.setCountDetails(expectedCountDetails).getCountDetails(); + + // Assert + assertEquals(expectedCountDetails, actualCountDetails); + } + + @Test + public void testGetSetAutoDeleteOnIdle() { + // Arrange + Duration expectedIsAutoDeleteOnIdle = createDuration(100); + TopicInfo TopicInfo = new TopicInfo(); + + // Act + Duration actualIsAutoDeleteOnIdle = TopicInfo.setAutoDeleteOnIdle(expectedIsAutoDeleteOnIdle) + .getAutoDeleteOnIdle(); + + // Assert + assertEquals(expectedIsAutoDeleteOnIdle, actualIsAutoDeleteOnIdle); + } + + @Test + public void testGetSetPartioningPolicy() { + // Arrange + PartitioningPolicy expectedPartitioningPolicy = PartitioningPolicy.NO_PARTITIONING; + TopicInfo TopicInfo = new TopicInfo(); + + // Act + PartitioningPolicy actualPartitioningPolicy = TopicInfo.setPartitioningPolicy(expectedPartitioningPolicy) + .getPartitioningPolicy(); + + // Assert + assertEquals(expectedPartitioningPolicy, actualPartitioningPolicy); + } + + @Test + public void testGetSetEntityAvailabilityStatus() { + // Arrange + EntityAvailabilityStatus expectedEntityAvailabilityStatus = EntityAvailabilityStatus.AVAILABLE; + TopicInfo TopicInfo = new TopicInfo(); + + // Act + EntityAvailabilityStatus actualEntityAvailabilityStatus = TopicInfo.setEntityAvailabilityStatus( + expectedEntityAvailabilityStatus).getEntityAvailabilityStatus(); + + // Assert + assertEquals(expectedEntityAvailabilityStatus, actualEntityAvailabilityStatus); + } + +} From 4e4b921674e80b6647e029fe86d337f5cb2f74d8 Mon Sep 17 00:00:00 2001 From: Albert Cheng Date: Thu, 25 Apr 2013 18:16:45 -0700 Subject: [PATCH 14/25] add support for properties in subscription. --- .../serviceBus/models/SubscriptionInfo.java | 108 +++++++++++++-- .../models/SubscriptionInfoTest.java | 129 +++--------------- 2 files changed, 122 insertions(+), 115 deletions(-) diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/SubscriptionInfo.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/SubscriptionInfo.java index fd65bedd66b7..f8a05fd82190 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/SubscriptionInfo.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/SubscriptionInfo.java @@ -2,24 +2,29 @@ * 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.models; +import java.util.Calendar; + import javax.ws.rs.core.MediaType; import javax.xml.datatype.Duration; import com.microsoft.windowsazure.services.serviceBus.implementation.Content; +import com.microsoft.windowsazure.services.serviceBus.implementation.EntityAvailabilityStatus; +import com.microsoft.windowsazure.services.serviceBus.implementation.EntityStatus; import com.microsoft.windowsazure.services.serviceBus.implementation.Entry; import com.microsoft.windowsazure.services.serviceBus.implementation.EntryModel; +import com.microsoft.windowsazure.services.serviceBus.implementation.MessageCountDetails; import com.microsoft.windowsazure.services.serviceBus.implementation.RuleDescription; import com.microsoft.windowsazure.services.serviceBus.implementation.SubscriptionDescription; @@ -266,4 +271,91 @@ public SubscriptionInfo setEnableBatchedOperations(Boolean value) { getModel().setEnableBatchedOperations(value); return this; } + + public SubscriptionInfo setMessageCount(Long messageCount) { + getModel().setMessageCount(messageCount); + return this; + } + + public SubscriptionInfo setStatus(EntityStatus entityStatus) { + getModel().setStatus(entityStatus); + return this; + } + + public EntityStatus getStatus() { + return getModel().getStatus(); + } + + public SubscriptionInfo setForwardTo(String forwardTo) { + getModel().setForwardTo(forwardTo); + return this; + } + + public String getForwardTo() { + return getModel().getForwardTo(); + } + + public SubscriptionInfo setCreatedAt(Calendar createdAt) { + getModel().setCreatedAt(createdAt); + return this; + } + + public Calendar getCreatedAt() { + return getModel().getCreatedAt(); + } + + public SubscriptionInfo setUpdatedAt(Calendar updatedAt) { + getModel().setUpdatedAt(updatedAt); + return this; + } + + public Calendar getUpdatedAt() { + return getModel().getUpdatedAt(); + } + + public SubscriptionInfo setAccessedAt(Calendar accessedAt) { + getModel().setAccessedAt(accessedAt); + return this; + } + + public Calendar getAccessedAt() { + return getModel().getAccessedAt(); + } + + public SubscriptionInfo setUserMetadata(String userMetadata) { + getModel().setUserMetadata(userMetadata); + return this; + } + + public String getUserMetadata() { + return getModel().getUserMetadata(); + } + + public SubscriptionInfo setCountDetails(MessageCountDetails countDetails) { + getModel().setCountDetails(countDetails); + return this; + } + + public MessageCountDetails getCountDetails() { + return getModel().getCountDetails(); + } + + public SubscriptionInfo setAutoDeleteOnIdle(Duration autoDeleteOnIdle) { + getModel().setAutoDeleteOnIdle(autoDeleteOnIdle); + return this; + } + + public Duration getAutoDeleteOnIdle() { + return getModel().getAutoDeleteOnIdle(); + } + + public SubscriptionInfo setEntityAvailabilityStatus(EntityAvailabilityStatus entityAvailabilityStatus) { + getModel().setEntityAvailabilityStatus(entityAvailabilityStatus); + return this; + } + + public EntityAvailabilityStatus getEntityAvailabilityStatus() { + return getModel().getEntityAvailabilityStatus(); + } + } diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/serviceBus/models/SubscriptionInfoTest.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/serviceBus/models/SubscriptionInfoTest.java index 9dc67b8c701f..c1d440dba015 100644 --- a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/serviceBus/models/SubscriptionInfoTest.java +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/serviceBus/models/SubscriptionInfoTest.java @@ -24,11 +24,10 @@ import org.junit.Test; -import com.microsoft.windowsazure.services.serviceBus.implementation.AuthorizationRules; import com.microsoft.windowsazure.services.serviceBus.implementation.EntityAvailabilityStatus; import com.microsoft.windowsazure.services.serviceBus.implementation.EntityStatus; import com.microsoft.windowsazure.services.serviceBus.implementation.MessageCountDetails; -import com.microsoft.windowsazure.services.serviceBus.implementation.PartitioningPolicy; +import com.microsoft.windowsazure.services.serviceBus.implementation.RuleDescription; public class SubscriptionInfoTest { @@ -57,36 +56,6 @@ public void testGetSetLockDuration() { } - @Test - public void testGetSetMaxSizeInMegabytes() { - // Arrange - Long expectedMaxSizeInMegabytes = 1024L; - SubscriptionInfo SubscriptionInfo = new SubscriptionInfo(); - - // Act - Long actualMaxSizeInMegabytes = SubscriptionInfo.setMaxSizeInMegabytes(expectedMaxSizeInMegabytes) - .getMaxSizeInMegabytes(); - - // Assert - assertEquals(expectedMaxSizeInMegabytes, actualMaxSizeInMegabytes); - - } - - @Test - public void testGetSetRequiresDuplicateDetection() { - // Arrange - Boolean expectedRequiresDuplicateDetection = true; - SubscriptionInfo SubscriptionInfo = new SubscriptionInfo(); - - // Act - Boolean actualRequiresDuplicateDetection = SubscriptionInfo.setRequiresDuplicateDetection( - expectedRequiresDuplicateDetection).isRequiresDuplicateDetection(); - - // Assert - assertEquals(expectedRequiresDuplicateDetection, actualRequiresDuplicateDetection); - - } - @Test public void testGetSetRequiresSession() { // Arrange @@ -130,58 +99,32 @@ public void testGetSetDeadLetteringOnMessageExpiration() { } @Test - public void testGetSetDuplicateDetectionHistoryTimeWindow() { - // Arrange - Duration expectedDefaultMessageTimeToLive = createDuration(100); - SubscriptionInfo SubscriptionInfo = new SubscriptionInfo(); - - // Act - Duration actualDefaultMessageTimeToLive = SubscriptionInfo.setDefaultMessageTimeToLive( - expectedDefaultMessageTimeToLive).getDefaultMessageTimeToLive(); - - // Assert - assertEquals(expectedDefaultMessageTimeToLive, actualDefaultMessageTimeToLive); - } - - @Test - public void testGetSetMaxDeliveryCount() { - // Arrange - Integer expectedMaxDeliveryCount = 1024; - SubscriptionInfo SubscriptionInfo = new SubscriptionInfo(); - - // Act - Integer actualMaxDeliveryCount = SubscriptionInfo.setMaxDeliveryCount(expectedMaxDeliveryCount) - .getMaxDeliveryCount(); - - // Assert - assertEquals(expectedMaxDeliveryCount, actualMaxDeliveryCount); - } - - @Test - public void testGetSetEnableBatchedOperations() { + public void testGetSetDeadLetteringOnFilterEvaluationExceptions() { // Arrange - Boolean expectedEnableBatchedOperations = true; + Boolean expectedDeadLetteringOnFilterEvaluationExceptions = true; SubscriptionInfo SubscriptionInfo = new SubscriptionInfo(); // Act - Boolean actualEnableBatchedOperations = SubscriptionInfo.setEnableBatchedOperations( - expectedEnableBatchedOperations).isEnableBatchedOperations(); + Boolean actualDeadLetteringOnFilterEvaluationExceptions = SubscriptionInfo + .setDeadLetteringOnFilterEvaluationExceptions(expectedDeadLetteringOnFilterEvaluationExceptions) + .isDeadLetteringOnFilterEvaluationExceptions(); // Assert - assertEquals(expectedEnableBatchedOperations, actualEnableBatchedOperations); + assertEquals(expectedDeadLetteringOnFilterEvaluationExceptions, actualDeadLetteringOnFilterEvaluationExceptions); } @Test - public void testGetSetSizeInBytes() { + public void testGetSetDefaultRuleDescription() { // Arrange - Long expectedSizeInBytes = 1024L; + RuleDescription expectedDefaultRuleDescription = new RuleDescription(); SubscriptionInfo SubscriptionInfo = new SubscriptionInfo(); // Act - Long actualSizeInBytes = SubscriptionInfo.setSizeInBytes(expectedSizeInBytes).getSizeInBytes(); + RuleDescription actualDefaultRuleDescription = SubscriptionInfo.setDefaultRuleDescription( + expectedDefaultRuleDescription).getDefaultRuleDescription(); // Assert - assertEquals(expectedSizeInBytes, actualSizeInBytes); + assertEquals(expectedDefaultRuleDescription, actualDefaultRuleDescription); } @Test @@ -198,31 +141,31 @@ public void testGetSetMessageCount() { } @Test - public void testGetSetIsAnonymousAccessible() { + public void testGetSetMaxDeliveryCount() { // Arrange - Boolean expectedIsAnonymousAccessible = true; + Integer expectedMaxDeliveryCount = 1024; SubscriptionInfo SubscriptionInfo = new SubscriptionInfo(); // Act - Boolean actualIsAnonymousAccessible = SubscriptionInfo.setIsAnonymousAccessible(expectedIsAnonymousAccessible) - .isAnonymousAccessible(); + Integer actualMaxDeliveryCount = SubscriptionInfo.setMaxDeliveryCount(expectedMaxDeliveryCount) + .getMaxDeliveryCount(); // Assert - assertEquals(expectedIsAnonymousAccessible, actualIsAnonymousAccessible); + assertEquals(expectedMaxDeliveryCount, actualMaxDeliveryCount); } @Test - public void testGetSetAuthorization() { + public void testGetSetEnableBatchedOperations() { // Arrange - AuthorizationRules expectedAuthorizationRules = new AuthorizationRules(); + Boolean expectedEnableBatchedOperations = true; SubscriptionInfo SubscriptionInfo = new SubscriptionInfo(); // Act - AuthorizationRules actualAuthorizationRules = SubscriptionInfo.setAuthorization(expectedAuthorizationRules) - .getAuthorization(); + Boolean actualEnableBatchedOperations = SubscriptionInfo.setEnableBatchedOperations( + expectedEnableBatchedOperations).isEnableBatchedOperations(); // Assert - assertEquals(expectedAuthorizationRules, actualAuthorizationRules); + assertEquals(expectedEnableBatchedOperations, actualEnableBatchedOperations); } @Test @@ -303,20 +246,6 @@ public void testGetSetUserMetadata() { assertEquals(expectedUserMetadata, actualUserMetadata); } - @Test - public void testGetSetSupportOrdering() { - // Arrange - Boolean expectedIsSupportOrdering = true; - SubscriptionInfo SubscriptionInfo = new SubscriptionInfo(); - - // Act - Boolean actualIsSupportOrdering = SubscriptionInfo.setSupportOrdering(expectedIsSupportOrdering) - .isSupportOrdering(); - - // Assert - assertEquals(expectedIsSupportOrdering, actualIsSupportOrdering); - } - @Test public void testGetSetCountDetails() { // Arrange @@ -345,20 +274,6 @@ public void testGetSetAutoDeleteOnIdle() { assertEquals(expectedIsAutoDeleteOnIdle, actualIsAutoDeleteOnIdle); } - @Test - public void testGetSetPartioningPolicy() { - // Arrange - PartitioningPolicy expectedPartitioningPolicy = PartitioningPolicy.NO_PARTITIONING; - SubscriptionInfo SubscriptionInfo = new SubscriptionInfo(); - - // Act - PartitioningPolicy actualPartitioningPolicy = SubscriptionInfo - .setPartitioningPolicy(expectedPartitioningPolicy).getPartitioningPolicy(); - - // Assert - assertEquals(expectedPartitioningPolicy, actualPartitioningPolicy); - } - @Test public void testGetSetEntityAvailabilityStatus() { // Arrange From 49aaeccd4f3cfdf8cb19495be5baa40b04df5983 Mon Sep 17 00:00:00 2001 From: Albert Cheng Date: Fri, 26 Apr 2013 10:46:23 -0700 Subject: [PATCH 15/25] update Topic Info for service bus. --- .../services/serviceBus/models/TopicInfo.java | 141 +++++++++++++++ ...netservices.2010.10.servicebus.connect.xsd | 2 +- .../serviceBus/models/TopicInfoTest.java | 168 +++++++----------- 3 files changed, 207 insertions(+), 104 deletions(-) diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/TopicInfo.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/TopicInfo.java index ff31532ccdd2..7f8c5fd4510d 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/TopicInfo.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/TopicInfo.java @@ -14,13 +14,19 @@ */ package com.microsoft.windowsazure.services.serviceBus.models; +import java.util.Calendar; + import javax.ws.rs.core.MediaType; import javax.xml.datatype.Duration; import com.microsoft.windowsazure.services.serviceBus.implementation.AuthorizationRules; import com.microsoft.windowsazure.services.serviceBus.implementation.Content; +import com.microsoft.windowsazure.services.serviceBus.implementation.EntityAvailabilityStatus; +import com.microsoft.windowsazure.services.serviceBus.implementation.EntityStatus; import com.microsoft.windowsazure.services.serviceBus.implementation.Entry; import com.microsoft.windowsazure.services.serviceBus.implementation.EntryModel; +import com.microsoft.windowsazure.services.serviceBus.implementation.MessageCountDetails; +import com.microsoft.windowsazure.services.serviceBus.implementation.PartitioningPolicy; import com.microsoft.windowsazure.services.serviceBus.implementation.TopicDescription; /** @@ -200,8 +206,143 @@ public Long getSizeInBytes() { return getModel().getSizeInBytes(); } + public TopicInfo setSizeInBytes(Long sizeInBytes) { + getModel().setSizeInBytes(sizeInBytes); + return this; + } + public TopicInfo setAuthorization(AuthorizationRules authorizationRules) { getModel().setAuthorizationRules(authorizationRules); return this; } + + public AuthorizationRules getAuthorization() { + return getModel().getAuthorizationRules(); + } + + public TopicInfo setFilteringMessageBeforePublishing(Boolean filteringMessageBeforePublishing) { + getModel().setFilteringMessagesBeforePublishing(filteringMessageBeforePublishing); + return this; + } + + public Boolean isFilteringMessageBeforePublishing() { + return getModel().isFilteringMessagesBeforePublishing(); + } + + public TopicInfo setAnonymousAccessible(Boolean anonymousAccessible) { + getModel().setIsAnonymousAcessible(anonymousAccessible); + return this; + } + + public Boolean isAnonymousAccessible() { + return getModel().isIsAnonymousAcessible(); + } + + public TopicInfo setStatus(EntityStatus status) { + getModel().setStatus(status); + return this; + } + + public EntityStatus getStatus() { + return getModel().getStatus(); + } + + public TopicInfo setForwardTo(String forwardTo) { + getModel().setForwardTo(forwardTo); + return this; + } + + public String getForwardTo() { + return getModel().getForwardTo(); + } + + public TopicInfo setCreatedAt(Calendar createdAt) { + getModel().setCreatedAt(createdAt); + return this; + } + + public Calendar getCreatedAt() { + return getModel().getCreatedAt(); + } + + public TopicInfo setUpdatedAt(Calendar updatedAt) { + getModel().setUpdatedAt(updatedAt); + return this; + } + + public Calendar getUpdatedAt() { + return getModel().getCreatedAt(); + } + + public TopicInfo setAccessedAt(Calendar accessedAt) { + getModel().setAccessedAt(accessedAt); + return this; + } + + public Calendar getAccessedAt() { + return getModel().getAccessedAt(); + } + + public TopicInfo setUserMetadata(String userMetadata) { + getModel().setUserMetadata(userMetadata); + return this; + } + + public String getUserMetadata() { + return getModel().getUserMetadata(); + } + + public TopicInfo setSupportOrdering(Boolean supportOrdering) { + getModel().setSupportOrdering(supportOrdering); + return this; + } + + public Boolean isSupportOrdering() { + return getModel().isSupportOrdering(); + } + + public TopicInfo setSubscriptionCount(Integer subscriptionCount) { + getModel().setSubscriptionCount(subscriptionCount); + return this; + } + + public Integer getSubscriptionCount() { + return getModel().getSubscriptionCount(); + } + + public TopicInfo setCountDetails(MessageCountDetails countDetails) { + getModel().setCountDetail(countDetails); + return this; + } + + public MessageCountDetails getCountDetails() { + return getModel().getCountDetail(); + } + + public TopicInfo setAutoDeleteOnIdle(Duration autoDeleteOnIdle) { + getModel().setAutoDeleteOnIdle(autoDeleteOnIdle); + return this; + } + + public Duration getAutoDeleteOnIdle() { + return getModel().getAutoDeleteOnIdle(); + } + + public TopicInfo setPartitioningPolicy(PartitioningPolicy partitioningPolicy) { + getModel().setPartitioningPolicy(partitioningPolicy); + return this; + } + + public PartitioningPolicy getPartitioningPolicy() { + return getModel().getPartitioningPolicy(); + } + + public TopicInfo setEntityAvailabilityStatus(EntityAvailabilityStatus entityAvailabilityStatus) { + getModel().setEntityAvailabilityStatus(entityAvailabilityStatus); + return this; + } + + public EntityAvailabilityStatus getEntityAvailabilityStatus() { + return getModel().getEntityAvailabilityStatus(); + } } diff --git a/microsoft-azure-api/src/main/resources/schemas.microsoft.com.netservices.2010.10.servicebus.connect.xsd b/microsoft-azure-api/src/main/resources/schemas.microsoft.com.netservices.2010.10.servicebus.connect.xsd index 70c4d4e7ed41..a4c3eb255350 100644 --- a/microsoft-azure-api/src/main/resources/schemas.microsoft.com.netservices.2010.10.servicebus.connect.xsd +++ b/microsoft-azure-api/src/main/resources/schemas.microsoft.com.netservices.2010.10.servicebus.connect.xsd @@ -529,7 +529,7 @@ - + diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/serviceBus/models/TopicInfoTest.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/serviceBus/models/TopicInfoTest.java index e616f9b950e1..605227a0e721 100644 --- a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/serviceBus/models/TopicInfoTest.java +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/serviceBus/models/TopicInfoTest.java @@ -44,16 +44,17 @@ private Duration createDuration(int milliSeconds) { } @Test - public void testGetSetLockDuration() { + public void testGetSetDefaultMessageTimeToLive() { // Arrange - Duration expectedLockDuration = createDuration(100); - TopicInfo TopicInfo = new TopicInfo(); + Duration expectedDefaultMessageTimeToLive = createDuration(1024); + TopicInfo topicInfo = new TopicInfo(); // Act - Duration actualLockDuration = TopicInfo.setLockDuration(expectedLockDuration).getLockDuration(); + Duration actualDefaultMessageTimeToLive = topicInfo.setDefaultMessageTimeToLive( + expectedDefaultMessageTimeToLive).getDefaultMessageTimeToLive(); // Assert - assertEquals(expectedLockDuration, actualLockDuration); + assertEquals(expectedDefaultMessageTimeToLive, actualDefaultMessageTimeToLive); } @@ -61,10 +62,10 @@ public void testGetSetLockDuration() { public void testGetSetMaxSizeInMegabytes() { // Arrange Long expectedMaxSizeInMegabytes = 1024L; - TopicInfo TopicInfo = new TopicInfo(); + TopicInfo topicInfo = new TopicInfo(); // Act - Long actualMaxSizeInMegabytes = TopicInfo.setMaxSizeInMegabytes(expectedMaxSizeInMegabytes) + Long actualMaxSizeInMegabytes = topicInfo.setMaxSizeInMegabytes(expectedMaxSizeInMegabytes) .getMaxSizeInMegabytes(); // Assert @@ -76,10 +77,10 @@ public void testGetSetMaxSizeInMegabytes() { public void testGetSetRequiresDuplicateDetection() { // Arrange Boolean expectedRequiresDuplicateDetection = true; - TopicInfo TopicInfo = new TopicInfo(); + TopicInfo topicInfo = new TopicInfo(); // Act - Boolean actualRequiresDuplicateDetection = TopicInfo.setRequiresDuplicateDetection( + Boolean actualRequiresDuplicateDetection = topicInfo.setRequiresDuplicateDetection( expectedRequiresDuplicateDetection).isRequiresDuplicateDetection(); // Assert @@ -87,82 +88,28 @@ public void testGetSetRequiresDuplicateDetection() { } - @Test - public void testGetSetRequiresSession() { - // Arrange - Boolean expectedRequiresSession = true; - TopicInfo TopicInfo = new TopicInfo(); - - // Act - Boolean actualRequiresSession = TopicInfo.setRequiresSession(expectedRequiresSession).isRequiresSession(); - - // Assert - assertEquals(expectedRequiresSession, actualRequiresSession); - } - - @Test - public void testGetSetDefaultMessageTimeToLive() { - // Arrange - Duration expectedDefaultMessageTimeToLive = createDuration(100); - TopicInfo TopicInfo = new TopicInfo(); - - // Act - Duration actualDefaultMessageTimeToLive = TopicInfo.setDefaultMessageTimeToLive( - expectedDefaultMessageTimeToLive).getDefaultMessageTimeToLive(); - - // Assert - assertEquals(expectedDefaultMessageTimeToLive, actualDefaultMessageTimeToLive); - } - - @Test - public void testGetSetDeadLetteringOnMessageExpiration() { - // Arrange - Boolean expectedDeadLetteringOnMessageExpiration = true; - TopicInfo TopicInfo = new TopicInfo(); - - // Act - Boolean actualDeadLetteringOnMessageExpiration = TopicInfo.setDeadLetteringOnMessageExpiration( - expectedDeadLetteringOnMessageExpiration).isDeadLetteringOnMessageExpiration(); - - // Assert - assertEquals(expectedDeadLetteringOnMessageExpiration, actualDeadLetteringOnMessageExpiration); - } - @Test public void testGetSetDuplicateDetectionHistoryTimeWindow() { // Arrange Duration expectedDefaultMessageTimeToLive = createDuration(100); - TopicInfo TopicInfo = new TopicInfo(); + TopicInfo topicInfo = new TopicInfo(); // Act - Duration actualDefaultMessageTimeToLive = TopicInfo.setDefaultMessageTimeToLive( + Duration actualDefaultMessageTimeToLive = topicInfo.setDefaultMessageTimeToLive( expectedDefaultMessageTimeToLive).getDefaultMessageTimeToLive(); // Assert assertEquals(expectedDefaultMessageTimeToLive, actualDefaultMessageTimeToLive); } - @Test - public void testGetSetMaxDeliveryCount() { - // Arrange - Integer expectedMaxDeliveryCount = 1024; - TopicInfo TopicInfo = new TopicInfo(); - - // Act - Integer actualMaxDeliveryCount = TopicInfo.setMaxDeliveryCount(expectedMaxDeliveryCount).getMaxDeliveryCount(); - - // Assert - assertEquals(expectedMaxDeliveryCount, actualMaxDeliveryCount); - } - @Test public void testGetSetEnableBatchedOperations() { // Arrange Boolean expectedEnableBatchedOperations = true; - TopicInfo TopicInfo = new TopicInfo(); + TopicInfo topicInfo = new TopicInfo(); // Act - Boolean actualEnableBatchedOperations = TopicInfo.setEnableBatchedOperations(expectedEnableBatchedOperations) + Boolean actualEnableBatchedOperations = topicInfo.setEnableBatchedOperations(expectedEnableBatchedOperations) .isEnableBatchedOperations(); // Assert @@ -173,50 +120,51 @@ public void testGetSetEnableBatchedOperations() { public void testGetSetSizeInBytes() { // Arrange Long expectedSizeInBytes = 1024L; - TopicInfo TopicInfo = new TopicInfo(); + TopicInfo topicInfo = new TopicInfo(); // Act - Long actualSizeInBytes = TopicInfo.setSizeInBytes(expectedSizeInBytes).getSizeInBytes(); + Long actualSizeInBytes = topicInfo.setSizeInBytes(expectedSizeInBytes).getSizeInBytes(); // Assert assertEquals(expectedSizeInBytes, actualSizeInBytes); } @Test - public void testGetSetMessageCount() { + public void testGetSetFilteringMessageBeforePublishing() { // Arrange - Long expectedMessageCount = 1024L; - TopicInfo TopicInfo = new TopicInfo(); + Boolean expectedFilteringMessageBeforePublishing = true; + TopicInfo topicInfo = new TopicInfo(); // Act - Long actualMessageCount = TopicInfo.setMessageCount(expectedMessageCount).getMessageCount(); + Boolean actualFilteringMessageBeforePublishing = topicInfo.setFilteringMessageBeforePublishing( + expectedFilteringMessageBeforePublishing).isFilteringMessageBeforePublishing(); // Assert - assertEquals(expectedMessageCount, actualMessageCount); + assertEquals(expectedFilteringMessageBeforePublishing, actualFilteringMessageBeforePublishing); } @Test - public void testGetSetIsAnonymousAccessible() { + public void testGetSetAnonymousAccessible() { // Arrange - Boolean expectedIsAnonymousAccessible = true; - TopicInfo TopicInfo = new TopicInfo(); + Boolean expectedAnonymousAccessible = true; + TopicInfo topicInfo = new TopicInfo(); // Act - Boolean actualIsAnonymousAccessible = TopicInfo.setIsAnonymousAccessible(expectedIsAnonymousAccessible) + Boolean actualAnonymousAccessible = topicInfo.setAnonymousAccessible(expectedAnonymousAccessible) .isAnonymousAccessible(); // Assert - assertEquals(expectedIsAnonymousAccessible, actualIsAnonymousAccessible); + assertEquals(expectedAnonymousAccessible, actualAnonymousAccessible); } @Test public void testGetSetAuthorization() { // Arrange AuthorizationRules expectedAuthorizationRules = new AuthorizationRules(); - TopicInfo TopicInfo = new TopicInfo(); + TopicInfo topicInfo = new TopicInfo(); // Act - AuthorizationRules actualAuthorizationRules = TopicInfo.setAuthorization(expectedAuthorizationRules) + AuthorizationRules actualAuthorizationRules = topicInfo.setAuthorization(expectedAuthorizationRules) .getAuthorization(); // Assert @@ -227,10 +175,10 @@ public void testGetSetAuthorization() { public void testGetSetStatus() { // Arrange EntityStatus expectedEntityStatus = EntityStatus.ACTIVE; - TopicInfo TopicInfo = new TopicInfo(); + TopicInfo topicInfo = new TopicInfo(); // Act - EntityStatus actualEntityStatus = TopicInfo.setStatus(expectedEntityStatus).getStatus(); + EntityStatus actualEntityStatus = topicInfo.setStatus(expectedEntityStatus).getStatus(); // Assert assertEquals(expectedEntityStatus, actualEntityStatus); @@ -240,10 +188,10 @@ public void testGetSetStatus() { public void testGetSetForwardTo() { // Arrange String expectedForwardTo = "forwardTo"; - TopicInfo TopicInfo = new TopicInfo(); + TopicInfo topicInfo = new TopicInfo(); // Act - String actualForwardTo = TopicInfo.setForwardTo(expectedForwardTo).getForwardTo(); + String actualForwardTo = topicInfo.setForwardTo(expectedForwardTo).getForwardTo(); // Assert assertEquals(expectedForwardTo, actualForwardTo); @@ -253,10 +201,10 @@ public void testGetSetForwardTo() { public void testGetSetCreatedAt() { // Arrange Calendar expectedCreatedAt = Calendar.getInstance(); - TopicInfo TopicInfo = new TopicInfo(); + TopicInfo topicInfo = new TopicInfo(); // Act - Calendar actualCreatedAt = TopicInfo.setCreatedAt(expectedCreatedAt).getCreatedAt(); + Calendar actualCreatedAt = topicInfo.setCreatedAt(expectedCreatedAt).getCreatedAt(); // Assert assertEquals(expectedCreatedAt, actualCreatedAt); @@ -266,10 +214,10 @@ public void testGetSetCreatedAt() { public void testGetSetUpdatedAt() { // Arrange Calendar expectedUpdatedAt = Calendar.getInstance(); - TopicInfo TopicInfo = new TopicInfo(); + TopicInfo topicInfo = new TopicInfo(); // Act - Calendar actualUpdatedAt = TopicInfo.setUpdatedAt(expectedUpdatedAt).getUpdatedAt(); + Calendar actualUpdatedAt = topicInfo.setUpdatedAt(expectedUpdatedAt).getUpdatedAt(); // Assert assertEquals(expectedUpdatedAt, actualUpdatedAt); @@ -279,10 +227,10 @@ public void testGetSetUpdatedAt() { public void testGetSetAccessedAt() { // Arrange Calendar expectedAccessedAt = Calendar.getInstance(); - TopicInfo TopicInfo = new TopicInfo(); + TopicInfo topicInfo = new TopicInfo(); // Act - Calendar actualAccessedAt = TopicInfo.setAccessedAt(expectedAccessedAt).getAccessedAt(); + Calendar actualAccessedAt = topicInfo.setAccessedAt(expectedAccessedAt).getAccessedAt(); // Assert assertEquals(expectedAccessedAt, actualAccessedAt); @@ -292,10 +240,10 @@ public void testGetSetAccessedAt() { public void testGetSetUserMetadata() { // Arrange String expectedUserMetadata = "expectedUserMetaData"; - TopicInfo TopicInfo = new TopicInfo(); + TopicInfo topicInfo = new TopicInfo(); // Act - String actualUserMetadata = TopicInfo.setUserMetadata(expectedUserMetadata).getUserMetadata(); + String actualUserMetadata = topicInfo.setUserMetadata(expectedUserMetadata).getUserMetadata(); // Assert assertEquals(expectedUserMetadata, actualUserMetadata); @@ -305,23 +253,37 @@ public void testGetSetUserMetadata() { public void testGetSetSupportOrdering() { // Arrange Boolean expectedIsSupportOrdering = true; - TopicInfo TopicInfo = new TopicInfo(); + TopicInfo topicInfo = new TopicInfo(); // Act - Boolean actualIsSupportOrdering = TopicInfo.setSupportOrdering(expectedIsSupportOrdering).isSupportOrdering(); + Boolean actualIsSupportOrdering = topicInfo.setSupportOrdering(expectedIsSupportOrdering).isSupportOrdering(); // Assert assertEquals(expectedIsSupportOrdering, actualIsSupportOrdering); } + @Test + public void testGetSetSubscriptionCount() { + // Arrange + Integer expectedSubscriptionCount = 1024; + TopicInfo topicInfo = new TopicInfo(); + + // Act + Integer actualSubscriptionCount = topicInfo.setSubscriptionCount(expectedSubscriptionCount) + .getSubscriptionCount(); + + // Assert + assertEquals(expectedSubscriptionCount, actualSubscriptionCount); + } + @Test public void testGetSetCountDetails() { // Arrange MessageCountDetails expectedCountDetails = new MessageCountDetails(); - TopicInfo TopicInfo = new TopicInfo(); + TopicInfo topicInfo = new TopicInfo(); // Act - MessageCountDetails actualCountDetails = TopicInfo.setCountDetails(expectedCountDetails).getCountDetails(); + MessageCountDetails actualCountDetails = topicInfo.setCountDetails(expectedCountDetails).getCountDetails(); // Assert assertEquals(expectedCountDetails, actualCountDetails); @@ -331,10 +293,10 @@ public void testGetSetCountDetails() { public void testGetSetAutoDeleteOnIdle() { // Arrange Duration expectedIsAutoDeleteOnIdle = createDuration(100); - TopicInfo TopicInfo = new TopicInfo(); + TopicInfo topicInfo = new TopicInfo(); // Act - Duration actualIsAutoDeleteOnIdle = TopicInfo.setAutoDeleteOnIdle(expectedIsAutoDeleteOnIdle) + Duration actualIsAutoDeleteOnIdle = topicInfo.setAutoDeleteOnIdle(expectedIsAutoDeleteOnIdle) .getAutoDeleteOnIdle(); // Assert @@ -345,10 +307,10 @@ public void testGetSetAutoDeleteOnIdle() { public void testGetSetPartioningPolicy() { // Arrange PartitioningPolicy expectedPartitioningPolicy = PartitioningPolicy.NO_PARTITIONING; - TopicInfo TopicInfo = new TopicInfo(); + TopicInfo topicInfo = new TopicInfo(); // Act - PartitioningPolicy actualPartitioningPolicy = TopicInfo.setPartitioningPolicy(expectedPartitioningPolicy) + PartitioningPolicy actualPartitioningPolicy = topicInfo.setPartitioningPolicy(expectedPartitioningPolicy) .getPartitioningPolicy(); // Assert @@ -359,10 +321,10 @@ public void testGetSetPartioningPolicy() { public void testGetSetEntityAvailabilityStatus() { // Arrange EntityAvailabilityStatus expectedEntityAvailabilityStatus = EntityAvailabilityStatus.AVAILABLE; - TopicInfo TopicInfo = new TopicInfo(); + TopicInfo topicInfo = new TopicInfo(); // Act - EntityAvailabilityStatus actualEntityAvailabilityStatus = TopicInfo.setEntityAvailabilityStatus( + EntityAvailabilityStatus actualEntityAvailabilityStatus = topicInfo.setEntityAvailabilityStatus( expectedEntityAvailabilityStatus).getEntityAvailabilityStatus(); // Assert From 5900a32f7e81e2944298619c19642f9805cb14ce Mon Sep 17 00:00:00 2001 From: Albert Cheng Date: Fri, 26 Apr 2013 10:50:46 -0700 Subject: [PATCH 16/25] generates Javadoc for Rule/Subscription/Topic. --- .../services/serviceBus/models/RuleInfo.java | 60 ++++++ .../serviceBus/models/SubscriptionInfo.java | 115 +++++++++++ .../services/serviceBus/models/TopicInfo.java | 187 ++++++++++++++++++ 3 files changed, 362 insertions(+) diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/RuleInfo.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/RuleInfo.java index 2004c57fa03f..0b4fb416e5f3 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/RuleInfo.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/RuleInfo.java @@ -135,12 +135,26 @@ public RuleInfo setAction(RuleAction value) { return this; } + /** + * With correlation id filter. + * + * @param correlationId + * the correlation id + * @return the rule info + */ public RuleInfo withCorrelationIdFilter(String correlationId) { CorrelationFilter filter = new CorrelationFilter(); filter.setCorrelationId(correlationId); return setFilter(filter); } + /** + * With sql expression filter. + * + * @param sqlExpression + * the sql expression + * @return the rule info + */ public RuleInfo withSqlExpressionFilter(String sqlExpression) { SqlFilter filter = new SqlFilter(); filter.setSqlExpression(sqlExpression); @@ -148,6 +162,11 @@ public RuleInfo withSqlExpressionFilter(String sqlExpression) { return setFilter(filter); } + /** + * With true filter. + * + * @return the rule info + */ public RuleInfo withTrueFilter() { TrueFilter filter = new TrueFilter(); filter.setCompatibilityLevel(20); @@ -155,6 +174,11 @@ public RuleInfo withTrueFilter() { return setFilter(filter); } + /** + * With false filter. + * + * @return the rule info + */ public RuleInfo withFalseFilter() { FalseFilter filter = new FalseFilter(); filter.setCompatibilityLevel(20); @@ -162,11 +186,23 @@ public RuleInfo withFalseFilter() { return setFilter(filter); } + /** + * With empty rule action. + * + * @return the rule info + */ public RuleInfo withEmptyRuleAction() { EmptyRuleAction action = new EmptyRuleAction(); return setAction(action); } + /** + * With sql rule action. + * + * @param sqlExpression + * the sql expression + * @return the rule info + */ public RuleInfo withSqlRuleAction(String sqlExpression) { SqlRuleAction action = new SqlRuleAction(); action.setSqlExpression(sqlExpression); @@ -174,20 +210,44 @@ public RuleInfo withSqlRuleAction(String sqlExpression) { return setAction(action); } + /** + * Sets the tag. + * + * @param tag + * the tag + * @return the rule info + */ public RuleInfo setTag(String tag) { getModel().setTag(tag); return this; } + /** + * Gets the tag. + * + * @return the tag + */ public String getTag() { return getModel().getTag(); } + /** + * Sets the created at. + * + * @param createdAt + * the created at + * @return the rule info + */ public RuleInfo setCreatedAt(Calendar createdAt) { getModel().setCreatedAt(createdAt); return this; } + /** + * Gets the created at. + * + * @return the created at + */ public Calendar getCreatedAt() { return getModel().getCreatedAt(); } diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/SubscriptionInfo.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/SubscriptionInfo.java index f8a05fd82190..92b08247a1e9 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/SubscriptionInfo.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/SubscriptionInfo.java @@ -272,88 +272,203 @@ public SubscriptionInfo setEnableBatchedOperations(Boolean value) { return this; } + /** + * Sets the message count. + * + * @param messageCount + * the message count + * @return the subscription info + */ public SubscriptionInfo setMessageCount(Long messageCount) { getModel().setMessageCount(messageCount); return this; } + /** + * Sets the status. + * + * @param entityStatus + * the entity status + * @return the subscription info + */ public SubscriptionInfo setStatus(EntityStatus entityStatus) { getModel().setStatus(entityStatus); return this; } + /** + * Gets the status. + * + * @return the status + */ public EntityStatus getStatus() { return getModel().getStatus(); } + /** + * Sets the forward to. + * + * @param forwardTo + * the forward to + * @return the subscription info + */ public SubscriptionInfo setForwardTo(String forwardTo) { getModel().setForwardTo(forwardTo); return this; } + /** + * Gets the forward to. + * + * @return the forward to + */ public String getForwardTo() { return getModel().getForwardTo(); } + /** + * Sets the created at. + * + * @param createdAt + * the created at + * @return the subscription info + */ public SubscriptionInfo setCreatedAt(Calendar createdAt) { getModel().setCreatedAt(createdAt); return this; } + /** + * Gets the created at. + * + * @return the created at + */ public Calendar getCreatedAt() { return getModel().getCreatedAt(); } + /** + * Sets the updated at. + * + * @param updatedAt + * the updated at + * @return the subscription info + */ public SubscriptionInfo setUpdatedAt(Calendar updatedAt) { getModel().setUpdatedAt(updatedAt); return this; } + /** + * Gets the updated at. + * + * @return the updated at + */ public Calendar getUpdatedAt() { return getModel().getUpdatedAt(); } + /** + * Sets the accessed at. + * + * @param accessedAt + * the accessed at + * @return the subscription info + */ public SubscriptionInfo setAccessedAt(Calendar accessedAt) { getModel().setAccessedAt(accessedAt); return this; } + /** + * Gets the accessed at. + * + * @return the accessed at + */ public Calendar getAccessedAt() { return getModel().getAccessedAt(); } + /** + * Sets the user metadata. + * + * @param userMetadata + * the user metadata + * @return the subscription info + */ public SubscriptionInfo setUserMetadata(String userMetadata) { getModel().setUserMetadata(userMetadata); return this; } + /** + * Gets the user metadata. + * + * @return the user metadata + */ public String getUserMetadata() { return getModel().getUserMetadata(); } + /** + * Sets the count details. + * + * @param countDetails + * the count details + * @return the subscription info + */ public SubscriptionInfo setCountDetails(MessageCountDetails countDetails) { getModel().setCountDetails(countDetails); return this; } + /** + * Gets the count details. + * + * @return the count details + */ public MessageCountDetails getCountDetails() { return getModel().getCountDetails(); } + /** + * Sets the auto delete on idle. + * + * @param autoDeleteOnIdle + * the auto delete on idle + * @return the subscription info + */ public SubscriptionInfo setAutoDeleteOnIdle(Duration autoDeleteOnIdle) { getModel().setAutoDeleteOnIdle(autoDeleteOnIdle); return this; } + /** + * Gets the auto delete on idle. + * + * @return the auto delete on idle + */ public Duration getAutoDeleteOnIdle() { return getModel().getAutoDeleteOnIdle(); } + /** + * Sets the entity availability status. + * + * @param entityAvailabilityStatus + * the entity availability status + * @return the subscription info + */ public SubscriptionInfo setEntityAvailabilityStatus(EntityAvailabilityStatus entityAvailabilityStatus) { getModel().setEntityAvailabilityStatus(entityAvailabilityStatus); return this; } + /** + * Gets the entity availability status. + * + * @return the entity availability status + */ public EntityAvailabilityStatus getEntityAvailabilityStatus() { return getModel().getEntityAvailabilityStatus(); } diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/TopicInfo.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/TopicInfo.java index 7f8c5fd4510d..26f33b1c4f40 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/TopicInfo.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/TopicInfo.java @@ -206,142 +206,329 @@ public Long getSizeInBytes() { return getModel().getSizeInBytes(); } + /** + * Sets the size in bytes. + * + * @param sizeInBytes + * the size in bytes + * @return the topic info + */ public TopicInfo setSizeInBytes(Long sizeInBytes) { getModel().setSizeInBytes(sizeInBytes); return this; } + /** + * Sets the authorization. + * + * @param authorizationRules + * the authorization rules + * @return the topic info + */ public TopicInfo setAuthorization(AuthorizationRules authorizationRules) { getModel().setAuthorizationRules(authorizationRules); return this; } + /** + * Gets the authorization. + * + * @return the authorization + */ public AuthorizationRules getAuthorization() { return getModel().getAuthorizationRules(); } + /** + * Sets the filtering message before publishing. + * + * @param filteringMessageBeforePublishing + * the filtering message before publishing + * @return the topic info + */ public TopicInfo setFilteringMessageBeforePublishing(Boolean filteringMessageBeforePublishing) { getModel().setFilteringMessagesBeforePublishing(filteringMessageBeforePublishing); return this; } + /** + * Checks if is filtering message before publishing. + * + * @return the boolean + */ public Boolean isFilteringMessageBeforePublishing() { return getModel().isFilteringMessagesBeforePublishing(); } + /** + * Sets the anonymous accessible. + * + * @param anonymousAccessible + * the anonymous accessible + * @return the topic info + */ public TopicInfo setAnonymousAccessible(Boolean anonymousAccessible) { getModel().setIsAnonymousAcessible(anonymousAccessible); return this; } + /** + * Checks if is anonymous accessible. + * + * @return the boolean + */ public Boolean isAnonymousAccessible() { return getModel().isIsAnonymousAcessible(); } + /** + * Sets the status. + * + * @param status + * the status + * @return the topic info + */ public TopicInfo setStatus(EntityStatus status) { getModel().setStatus(status); return this; } + /** + * Gets the status. + * + * @return the status + */ public EntityStatus getStatus() { return getModel().getStatus(); } + /** + * Sets the forward to. + * + * @param forwardTo + * the forward to + * @return the topic info + */ public TopicInfo setForwardTo(String forwardTo) { getModel().setForwardTo(forwardTo); return this; } + /** + * Gets the forward to. + * + * @return the forward to + */ public String getForwardTo() { return getModel().getForwardTo(); } + /** + * Sets the created at. + * + * @param createdAt + * the created at + * @return the topic info + */ public TopicInfo setCreatedAt(Calendar createdAt) { getModel().setCreatedAt(createdAt); return this; } + /** + * Gets the created at. + * + * @return the created at + */ public Calendar getCreatedAt() { return getModel().getCreatedAt(); } + /** + * Sets the updated at. + * + * @param updatedAt + * the updated at + * @return the topic info + */ public TopicInfo setUpdatedAt(Calendar updatedAt) { getModel().setUpdatedAt(updatedAt); return this; } + /** + * Gets the updated at. + * + * @return the updated at + */ public Calendar getUpdatedAt() { return getModel().getCreatedAt(); } + /** + * Sets the accessed at. + * + * @param accessedAt + * the accessed at + * @return the topic info + */ public TopicInfo setAccessedAt(Calendar accessedAt) { getModel().setAccessedAt(accessedAt); return this; } + /** + * Gets the accessed at. + * + * @return the accessed at + */ public Calendar getAccessedAt() { return getModel().getAccessedAt(); } + /** + * Sets the user metadata. + * + * @param userMetadata + * the user metadata + * @return the topic info + */ public TopicInfo setUserMetadata(String userMetadata) { getModel().setUserMetadata(userMetadata); return this; } + /** + * Gets the user metadata. + * + * @return the user metadata + */ public String getUserMetadata() { return getModel().getUserMetadata(); } + /** + * Sets the support ordering. + * + * @param supportOrdering + * the support ordering + * @return the topic info + */ public TopicInfo setSupportOrdering(Boolean supportOrdering) { getModel().setSupportOrdering(supportOrdering); return this; } + /** + * Checks if is support ordering. + * + * @return the boolean + */ public Boolean isSupportOrdering() { return getModel().isSupportOrdering(); } + /** + * Sets the subscription count. + * + * @param subscriptionCount + * the subscription count + * @return the topic info + */ public TopicInfo setSubscriptionCount(Integer subscriptionCount) { getModel().setSubscriptionCount(subscriptionCount); return this; } + /** + * Gets the subscription count. + * + * @return the subscription count + */ public Integer getSubscriptionCount() { return getModel().getSubscriptionCount(); } + /** + * Sets the count details. + * + * @param countDetails + * the count details + * @return the topic info + */ public TopicInfo setCountDetails(MessageCountDetails countDetails) { getModel().setCountDetail(countDetails); return this; } + /** + * Gets the count details. + * + * @return the count details + */ public MessageCountDetails getCountDetails() { return getModel().getCountDetail(); } + /** + * Sets the auto delete on idle. + * + * @param autoDeleteOnIdle + * the auto delete on idle + * @return the topic info + */ public TopicInfo setAutoDeleteOnIdle(Duration autoDeleteOnIdle) { getModel().setAutoDeleteOnIdle(autoDeleteOnIdle); return this; } + /** + * Gets the auto delete on idle. + * + * @return the auto delete on idle + */ public Duration getAutoDeleteOnIdle() { return getModel().getAutoDeleteOnIdle(); } + /** + * Sets the partitioning policy. + * + * @param partitioningPolicy + * the partitioning policy + * @return the topic info + */ public TopicInfo setPartitioningPolicy(PartitioningPolicy partitioningPolicy) { getModel().setPartitioningPolicy(partitioningPolicy); return this; } + /** + * Gets the partitioning policy. + * + * @return the partitioning policy + */ public PartitioningPolicy getPartitioningPolicy() { return getModel().getPartitioningPolicy(); } + /** + * Sets the entity availability status. + * + * @param entityAvailabilityStatus + * the entity availability status + * @return the topic info + */ public TopicInfo setEntityAvailabilityStatus(EntityAvailabilityStatus entityAvailabilityStatus) { getModel().setEntityAvailabilityStatus(entityAvailabilityStatus); return this; } + /** + * Gets the entity availability status. + * + * @return the entity availability status + */ public EntityAvailabilityStatus getEntityAvailabilityStatus() { return getModel().getEntityAvailabilityStatus(); } From 824372a63aff9df1c0495d7eba5831d16d4a64f4 Mon Sep 17 00:00:00 2001 From: Albert Cheng Date: Fri, 26 Apr 2013 15:33:04 -0700 Subject: [PATCH 17/25] improve javadoc for queue/topic/rule/subscription. --- .../services/serviceBus/models/QueueInfo.java | 2 +- .../services/serviceBus/models/RuleInfo.java | 38 +++---- .../serviceBus/models/SubscriptionInfo.java | 68 +++++------ .../services/serviceBus/models/TopicInfo.java | 106 +++++++++--------- 4 files changed, 107 insertions(+), 107 deletions(-) diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/QueueInfo.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/QueueInfo.java index 5f152b54b1cf..13331714b40f 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/QueueInfo.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/QueueInfo.java @@ -481,7 +481,7 @@ public QueueInfo setEntityAvailabilityStatus(EntityAvailabilityStatus entityAvai /** * Gets the forward to. * - * @return the forward to + * @return A String object represents which queue the messages will be forwarded to. */ public String getForwardTo() { return getModel().getForwardTo(); diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/RuleInfo.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/RuleInfo.java index 0b4fb416e5f3..bfd82d1d29f8 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/RuleInfo.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/RuleInfo.java @@ -37,7 +37,7 @@ public class RuleInfo extends EntryModel { /** - * Creates an instance of the Rule class. + * Creates an instance of the RuleInfo class. */ public RuleInfo() { super(new Entry(), new RuleDescription()); @@ -47,7 +47,7 @@ public RuleInfo() { } /** - * Creates an instance of the Rule class using the specified entry. + * Creates an instance of the RuleInfo class using the specified entry. * * @param entry * An Entry object. @@ -58,7 +58,7 @@ public RuleInfo(Entry entry) { } /** - * Creates an instance of the Rule class using the specified name. + * Creates an instance of the RuleInfo class using the specified name. * * @param name * A String object that represents the name of the rule. @@ -84,7 +84,7 @@ public String getName() { * @param value * A String object that represents the name of the rule. * - * @return A Rule object that represents the updated rule. + * @return A RuleInfo object that represents the updated rule. */ public RuleInfo setName(String value) { getEntry().setTitle(value); @@ -106,7 +106,7 @@ public Filter getFilter() { * @param value * A Filter object that represents the filter of the rule. * - * @return A Rule object that represents the updated rule. + * @return A RuleInfo object that represents the updated rule. */ public RuleInfo setFilter(Filter value) { getModel().setFilter(value); @@ -128,7 +128,7 @@ public RuleAction getAction() { * @param value * A RuleAction object that represents the rule action. * - * @return A Rule object that represents the updated rule. + * @return A RuleInfo object that represents the updated rule. */ public RuleInfo setAction(RuleAction value) { getModel().setAction(value); @@ -140,7 +140,7 @@ public RuleInfo setAction(RuleAction value) { * * @param correlationId * the correlation id - * @return the rule info + * @return A RuleInfo object that represents the updated rule. */ public RuleInfo withCorrelationIdFilter(String correlationId) { CorrelationFilter filter = new CorrelationFilter(); @@ -153,7 +153,7 @@ public RuleInfo withCorrelationIdFilter(String correlationId) { * * @param sqlExpression * the sql expression - * @return the rule info + * @return A RuleInfo object that represents the updated rule. */ public RuleInfo withSqlExpressionFilter(String sqlExpression) { SqlFilter filter = new SqlFilter(); @@ -165,7 +165,7 @@ public RuleInfo withSqlExpressionFilter(String sqlExpression) { /** * With true filter. * - * @return the rule info + * @return A RuleInfo object that represents the updated rule. */ public RuleInfo withTrueFilter() { TrueFilter filter = new TrueFilter(); @@ -177,7 +177,7 @@ public RuleInfo withTrueFilter() { /** * With false filter. * - * @return the rule info + * @return A RuleInfo object that represents the updated rule. */ public RuleInfo withFalseFilter() { FalseFilter filter = new FalseFilter(); @@ -189,7 +189,7 @@ public RuleInfo withFalseFilter() { /** * With empty rule action. * - * @return the rule info + * @return A RuleInfo object that represents the updated rule. */ public RuleInfo withEmptyRuleAction() { EmptyRuleAction action = new EmptyRuleAction(); @@ -200,8 +200,8 @@ public RuleInfo withEmptyRuleAction() { * With sql rule action. * * @param sqlExpression - * the sql expression - * @return the rule info + * A String instance of the sql expression. + * @return A RuleInfo object that represents the updated rule. */ public RuleInfo withSqlRuleAction(String sqlExpression) { SqlRuleAction action = new SqlRuleAction(); @@ -214,8 +214,8 @@ public RuleInfo withSqlRuleAction(String sqlExpression) { * Sets the tag. * * @param tag - * the tag - * @return the rule info + * A String instance representing the tag. + * @return A RuleInfo object that represents the updated rule. */ public RuleInfo setTag(String tag) { getModel().setTag(tag); @@ -225,7 +225,7 @@ public RuleInfo setTag(String tag) { /** * Gets the tag. * - * @return the tag + * @return A String instance representing the tag. */ public String getTag() { return getModel().getTag(); @@ -235,8 +235,8 @@ public String getTag() { * Sets the created at. * * @param createdAt - * the created at - * @return the rule info + * A Calendar> object which represents the time that the rule was created at. + * @return A RuleInfo object that represents the updated rule. */ public RuleInfo setCreatedAt(Calendar createdAt) { getModel().setCreatedAt(createdAt); @@ -246,7 +246,7 @@ public RuleInfo setCreatedAt(Calendar createdAt) { /** * Gets the created at. * - * @return the created at + * @return A Calendar> object which represents the time that the rule was created at. */ public Calendar getCreatedAt() { return getModel().getCreatedAt(); diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/SubscriptionInfo.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/SubscriptionInfo.java index 92b08247a1e9..d81ea274e44c 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/SubscriptionInfo.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/SubscriptionInfo.java @@ -34,7 +34,7 @@ public class SubscriptionInfo extends EntryModel { /** - * Creates an instance of the Subscription class. + * Creates an instance of the SubscriptionInfo class. */ public SubscriptionInfo() { super(new Entry(), new SubscriptionDescription()); @@ -44,7 +44,7 @@ public SubscriptionInfo() { } /** - * Creates an instance of the Subscription class using the specified entry. + * Creates an instance of the SubscriptionInfo class using the specified entry. * * @param entry * An Entry object. @@ -54,7 +54,7 @@ public SubscriptionInfo(Entry entry) { } /** - * Creates an instance of the Subscription class using the specified name. + * Creates an instance of the SubscriptionInfo class using the specified name. * * @param name * A String object that represents the name of the subscription. @@ -79,7 +79,7 @@ public String getName() { * @param value * A String that represents the name of the subscription. * - * @return A Subscription object that represents the updated subscription. + * @return A SubscriptionInfo object that represents the updated subscription. */ public SubscriptionInfo setName(String value) { getEntry().setTitle(value); @@ -101,7 +101,7 @@ public Duration getLockDuration() { * @param value * The duration, in seconds, of the lock. * - * @return A Subscription object that represents the updated subscription. + * @return A SubscriptionInfo object that represents the updated subscription. */ public SubscriptionInfo setLockDuration(Duration value) { getModel().setLockDuration(value); @@ -123,7 +123,7 @@ public Boolean isRequiresSession() { * @param value * true if the subscription is session aware; otherwise, false. * - * @return A Subscription object that represents the updated subscription. + * @return A SubscriptionInfo object that represents the updated subscription. */ public SubscriptionInfo setRequiresSession(Boolean value) { getModel().setRequiresSession(value); @@ -146,7 +146,7 @@ public Duration getDefaultMessageTimeToLive() { * @param value * A Duration object that represents the default message TTL. * - * @return A Subscription object that represents the updated subscription. + * @return A SubscriptionInfo object that represents the updated subscription. */ public SubscriptionInfo setDefaultMessageTimeToLive(Duration value) { getModel().setDefaultMessageTimeToLive(value); @@ -168,7 +168,7 @@ public Boolean isDeadLetteringOnMessageExpiration() { * @param value * true if dead lettering is in effect; otherwise, false. * - * @return A Subscription object that represents the updated subscription. + * @return A SubscriptionInfo object that represents the updated subscription. */ public SubscriptionInfo setDeadLetteringOnMessageExpiration(Boolean value) { getModel().setDeadLetteringOnMessageExpiration(value); @@ -190,7 +190,7 @@ public Boolean isDeadLetteringOnFilterEvaluationExceptions() { * @param value * true if dead lettering is in effect; otherwise, false. * - * @return A Subscription object that represents the updated subscription. + * @return A SubscriptionInfo object that represents the updated subscription. */ public SubscriptionInfo setDeadLetteringOnFilterEvaluationExceptions(Boolean value) { getModel().setDeadLetteringOnFilterEvaluationExceptions(value); @@ -212,7 +212,7 @@ public RuleDescription getDefaultRuleDescription() { * @param value * A RuleDescription object that represents the default rule description. * - * @return A Subscription object that represents the updated subscription. + * @return A SubscriptionInfo object that represents the updated subscription. */ public SubscriptionInfo setDefaultRuleDescription(RuleDescription value) { getModel().setDefaultRuleDescription(value); @@ -222,7 +222,7 @@ public SubscriptionInfo setDefaultRuleDescription(RuleDescription value) { /** * Returns the number of messages in the subscription. * - * @return The number of messages in the subscription. + * @return A Long object represents the count of the message. */ public Long getMessageCount() { return getModel().getMessageCount(); @@ -231,7 +231,7 @@ public Long getMessageCount() { /** * Returns the maximum delivery count for the subscription. * - * @return The maximum delivery count. + * @return A Integer represents the maximum delivery count. */ public Integer getMaxDeliveryCount() { return getModel().getMaxDeliveryCount(); @@ -241,9 +241,9 @@ public Integer getMaxDeliveryCount() { * Sets the maximum delivery count for the subscription. * * @param value - * The maximum delivery count for the subscription. + * A value represents the maximum delivery count for the subscription. * - * @return A Subscription object that represents the updated subscription. + * @return A SubscriptionInfo object that represents the updated subscription. */ public SubscriptionInfo setMaxDeliveryCount(Integer value) { getModel().setMaxDeliveryCount(value); @@ -265,7 +265,7 @@ public Boolean isEnableBatchedOperations() { * @param value * true if batch operations are enabled; otherwise, false. * - * @return A Subscription object that represents the updated subscription. + * @return A SubscriptionInfo object that represents the updated subscription. */ public SubscriptionInfo setEnableBatchedOperations(Boolean value) { getModel().setEnableBatchedOperations(value); @@ -276,8 +276,8 @@ public SubscriptionInfo setEnableBatchedOperations(Boolean value) { * Sets the message count. * * @param messageCount - * the message count - * @return the subscription info + * A Long object represents the message count. + * @return A SubscriptionInfo object that represents the updated subscription. */ public SubscriptionInfo setMessageCount(Long messageCount) { getModel().setMessageCount(messageCount); @@ -288,8 +288,8 @@ public SubscriptionInfo setMessageCount(Long messageCount) { * Sets the status. * * @param entityStatus - * the entity status - * @return the subscription info + * A EntityStatus object represents the status of the entity. + * @return A SubscriptionInfo object that represents the updated subscription. */ public SubscriptionInfo setStatus(EntityStatus entityStatus) { getModel().setStatus(entityStatus); @@ -299,7 +299,7 @@ public SubscriptionInfo setStatus(EntityStatus entityStatus) { /** * Gets the status. * - * @return the status + * @return A EntityStatus object represents the status of the entity. */ public EntityStatus getStatus() { return getModel().getStatus(); @@ -310,7 +310,7 @@ public EntityStatus getStatus() { * * @param forwardTo * the forward to - * @return the subscription info + * @return A SubscriptionInfo object that represents the updated subscription. */ public SubscriptionInfo setForwardTo(String forwardTo) { getModel().setForwardTo(forwardTo); @@ -331,7 +331,7 @@ public String getForwardTo() { * * @param createdAt * the created at - * @return the subscription info + * @return A SubscriptionInfo object that represents the updated subscription. */ public SubscriptionInfo setCreatedAt(Calendar createdAt) { getModel().setCreatedAt(createdAt); @@ -352,7 +352,7 @@ public Calendar getCreatedAt() { * * @param updatedAt * the updated at - * @return the subscription info + * @return A SubscriptionInfo object that represents the updated subscription. */ public SubscriptionInfo setUpdatedAt(Calendar updatedAt) { getModel().setUpdatedAt(updatedAt); @@ -373,7 +373,7 @@ public Calendar getUpdatedAt() { * * @param accessedAt * the accessed at - * @return the subscription info + * @return A SubscriptionInfo object that represents the updated subscription. */ public SubscriptionInfo setAccessedAt(Calendar accessedAt) { getModel().setAccessedAt(accessedAt); @@ -394,7 +394,7 @@ public Calendar getAccessedAt() { * * @param userMetadata * the user metadata - * @return the subscription info + * @return A SubscriptionInfo object that represents the updated subscription. */ public SubscriptionInfo setUserMetadata(String userMetadata) { getModel().setUserMetadata(userMetadata); @@ -414,8 +414,8 @@ public String getUserMetadata() { * Sets the count details. * * @param countDetails - * the count details - * @return the subscription info + * A MessageCountDetails represents the details of message count. + * @return A SubscriptionInfo object that represents the updated subscription. */ public SubscriptionInfo setCountDetails(MessageCountDetails countDetails) { getModel().setCountDetails(countDetails); @@ -425,7 +425,7 @@ public SubscriptionInfo setCountDetails(MessageCountDetails countDetails) { /** * Gets the count details. * - * @return the count details + * @return A MessageCountDetails represents the details of message count. */ public MessageCountDetails getCountDetails() { return getModel().getCountDetails(); @@ -435,8 +435,8 @@ public MessageCountDetails getCountDetails() { * Sets the auto delete on idle. * * @param autoDeleteOnIdle - * the auto delete on idle - * @return the subscription info + * A Duration object represents the auto delete on idle. + * @return A SubscriptionInfo object that represents the updated subscription. */ public SubscriptionInfo setAutoDeleteOnIdle(Duration autoDeleteOnIdle) { getModel().setAutoDeleteOnIdle(autoDeleteOnIdle); @@ -446,7 +446,7 @@ public SubscriptionInfo setAutoDeleteOnIdle(Duration autoDeleteOnIdle) { /** * Gets the auto delete on idle. * - * @return the auto delete on idle + * @return A Duration object represents the auto delete on idle. */ public Duration getAutoDeleteOnIdle() { return getModel().getAutoDeleteOnIdle(); @@ -456,8 +456,8 @@ public Duration getAutoDeleteOnIdle() { * Sets the entity availability status. * * @param entityAvailabilityStatus - * the entity availability status - * @return the subscription info + * An EntityAvailabilityStatus instance representing the entity availiability status. + * @return A SubscriptionInfo object that represents the updated subscription. */ public SubscriptionInfo setEntityAvailabilityStatus(EntityAvailabilityStatus entityAvailabilityStatus) { getModel().setEntityAvailabilityStatus(entityAvailabilityStatus); @@ -467,7 +467,7 @@ public SubscriptionInfo setEntityAvailabilityStatus(EntityAvailabilityStatus ent /** * Gets the entity availability status. * - * @return the entity availability status + * @return An EntityAvailabilityStatus instance representing the entity availiability status. */ public EntityAvailabilityStatus getEntityAvailabilityStatus() { return getModel().getEntityAvailabilityStatus(); diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/TopicInfo.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/TopicInfo.java index 26f33b1c4f40..8d95a2182c14 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/TopicInfo.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/TopicInfo.java @@ -34,7 +34,7 @@ */ public class TopicInfo extends EntryModel { /** - * Creates an instance of the Topic class. + * Creates an instance of the TopicInfo class. */ public TopicInfo() { super(new Entry(), new TopicDescription()); @@ -44,7 +44,7 @@ public TopicInfo() { } /** - * Creates an instance of the Topic class using the specified entry. + * Creates an instance of the TopicInfo class using the specified entry. * * @param entry * An Entry object that represents the entry for the topic. @@ -54,7 +54,7 @@ public TopicInfo(Entry entry) { } /** - * Creates an instance of the Topic class using the specified name. + * Creates an instance of the TopicInfo class using the specified name. * * @param path * A String object that represents the name for the topic. @@ -79,7 +79,7 @@ public String getPath() { * @param value * A String that represents the name of the topic. * - * @return A Topic object that represents the updated topic. + * @return A TopicInfo object that represents the updated topic. */ public TopicInfo setPath(String value) { getEntry().setTitle(value); @@ -101,7 +101,7 @@ public Duration getDefaultMessageTimeToLive() { * @param value * A Duration object that represents the default message TTL. * - * @return A Topic object that represents the updated topic. + * @return A TopicInfo object that represents the updated topic. */ public TopicInfo setDefaultMessageTimeToLive(Duration value) { getModel().setDefaultMessageTimeToLive(value); @@ -123,7 +123,7 @@ public Long getMaxSizeInMegabytes() { * @param value * The maximum size, in megabytes, of the topic. * - * @return A Topic object that represents the updated topic. + * @return A TopicInfo object that represents the updated topic. */ public TopicInfo setMaxSizeInMegabytes(Long value) { getModel().setMaxSizeInMegabytes(value); @@ -145,7 +145,7 @@ public Boolean isRequiresDuplicateDetection() { * @param value * true if duplicate message detection is required; otherwise, false. * - * @return A Topic object that represents the updated topic. + * @return A TopicInfo object that represents the updated topic. */ public TopicInfo setRequiresDuplicateDetection(Boolean value) { getModel().setRequiresDuplicateDetection(value); @@ -168,7 +168,7 @@ public Duration getDuplicateDetectionHistoryTimeWindow() { * @param value * A Duration object that represents the time span for detecting message duplication. * - * @return A Topic object that represents the updated topic. + * @return A TopicInfo object that represents the updated topic. */ public TopicInfo setDuplicateDetectionHistoryTimeWindow(Duration value) { getModel().setDuplicateDetectionHistoryTimeWindow(value); @@ -190,7 +190,7 @@ public Boolean isEnableBatchedOperations() { * @param value * true if batch operations are enabled; otherwise, false. * - * @return A Topic object that represents the updated topic. + * @return A TopicInfo object that represents the updated topic. */ public TopicInfo setEnableBatchedOperations(Boolean value) { getModel().setEnableBatchedOperations(value); @@ -210,8 +210,8 @@ public Long getSizeInBytes() { * Sets the size in bytes. * * @param sizeInBytes - * the size in bytes - * @return the topic info + * A Long instance of the size in bytes. + * @return A TopicInfo object that represents the updated topic. */ public TopicInfo setSizeInBytes(Long sizeInBytes) { getModel().setSizeInBytes(sizeInBytes); @@ -222,8 +222,8 @@ public TopicInfo setSizeInBytes(Long sizeInBytes) { * Sets the authorization. * * @param authorizationRules - * the authorization rules - * @return the topic info + * A AuthorizationRules + * @return A TopicInfo object that represents the updated topic. */ public TopicInfo setAuthorization(AuthorizationRules authorizationRules) { getModel().setAuthorizationRules(authorizationRules); @@ -233,7 +233,7 @@ public TopicInfo setAuthorization(AuthorizationRules authorizationRules) { /** * Gets the authorization. * - * @return the authorization + * @return A AuthorizationRules object that contains the authorization rules. */ public AuthorizationRules getAuthorization() { return getModel().getAuthorizationRules(); @@ -243,8 +243,8 @@ public AuthorizationRules getAuthorization() { * Sets the filtering message before publishing. * * @param filteringMessageBeforePublishing - * the filtering message before publishing - * @return the topic info + * true if filter message before publishing, otherwise false. + * @return A TopicInfo object that represents the updated topic. */ public TopicInfo setFilteringMessageBeforePublishing(Boolean filteringMessageBeforePublishing) { getModel().setFilteringMessagesBeforePublishing(filteringMessageBeforePublishing); @@ -254,7 +254,7 @@ public TopicInfo setFilteringMessageBeforePublishing(Boolean filteringMessageBef /** * Checks if is filtering message before publishing. * - * @return the boolean + * @return true if filter message before publishing, otherwise false. */ public Boolean isFilteringMessageBeforePublishing() { return getModel().isFilteringMessagesBeforePublishing(); @@ -264,8 +264,8 @@ public Boolean isFilteringMessageBeforePublishing() { * Sets the anonymous accessible. * * @param anonymousAccessible - * the anonymous accessible - * @return the topic info + * true if is anonymous accessible, otherwise false. + * @return A TopicInfo object that represents the updated topic. */ public TopicInfo setAnonymousAccessible(Boolean anonymousAccessible) { getModel().setIsAnonymousAcessible(anonymousAccessible); @@ -275,7 +275,7 @@ public TopicInfo setAnonymousAccessible(Boolean anonymousAccessible) { /** * Checks if is anonymous accessible. * - * @return the boolean + * @return true if is anonymous accessible, otherwise false. */ public Boolean isAnonymousAccessible() { return getModel().isIsAnonymousAcessible(); @@ -286,7 +286,7 @@ public Boolean isAnonymousAccessible() { * * @param status * the status - * @return the topic info + * @return A TopicInfo object that represents the updated topic. */ public TopicInfo setStatus(EntityStatus status) { getModel().setStatus(status); @@ -296,7 +296,7 @@ public TopicInfo setStatus(EntityStatus status) { /** * Gets the status. * - * @return the status + * @return An EntityStatus object that represents the status of the object. */ public EntityStatus getStatus() { return getModel().getStatus(); @@ -307,7 +307,7 @@ public EntityStatus getStatus() { * * @param forwardTo * the forward to - * @return the topic info + * @return A TopicInfo object that represents the updated topic. */ public TopicInfo setForwardTo(String forwardTo) { getModel().setForwardTo(forwardTo); @@ -317,7 +317,7 @@ public TopicInfo setForwardTo(String forwardTo) { /** * Gets the forward to. * - * @return the forward to + * @return A String object which represents the forward to. */ public String getForwardTo() { return getModel().getForwardTo(); @@ -328,7 +328,7 @@ public String getForwardTo() { * * @param createdAt * the created at - * @return the topic info + * @return A TopicInfo object that represents the updated topic. */ public TopicInfo setCreatedAt(Calendar createdAt) { getModel().setCreatedAt(createdAt); @@ -338,7 +338,7 @@ public TopicInfo setCreatedAt(Calendar createdAt) { /** * Gets the created at. * - * @return the created at + * @return A Calendar object which represents when the topic was created. */ public Calendar getCreatedAt() { return getModel().getCreatedAt(); @@ -348,8 +348,8 @@ public Calendar getCreatedAt() { * Sets the updated at. * * @param updatedAt - * the updated at - * @return the topic info + * A Calendar object which represents when the topic was updated. + * @return A TopicInfo object that represents the updated topic. */ public TopicInfo setUpdatedAt(Calendar updatedAt) { getModel().setUpdatedAt(updatedAt); @@ -359,7 +359,7 @@ public TopicInfo setUpdatedAt(Calendar updatedAt) { /** * Gets the updated at. * - * @return the updated at + * @return A Calendar object which represents when the topic was updated. */ public Calendar getUpdatedAt() { return getModel().getCreatedAt(); @@ -369,8 +369,8 @@ public Calendar getUpdatedAt() { * Sets the accessed at. * * @param accessedAt - * the accessed at - * @return the topic info + * A Calendar instance representing when topic was last accessed at. + * @return A TopicInfo object that represents the updated topic. */ public TopicInfo setAccessedAt(Calendar accessedAt) { getModel().setAccessedAt(accessedAt); @@ -380,7 +380,7 @@ public TopicInfo setAccessedAt(Calendar accessedAt) { /** * Gets the accessed at. * - * @return the accessed at + * @return A Calendar instance representing when topic was last accessed at. */ public Calendar getAccessedAt() { return getModel().getAccessedAt(); @@ -390,8 +390,8 @@ public Calendar getAccessedAt() { * Sets the user metadata. * * @param userMetadata - * the user metadata - * @return the topic info + * A String represents the user metadata. + * @return A TopicInfo object that represents the updated topic. */ public TopicInfo setUserMetadata(String userMetadata) { getModel().setUserMetadata(userMetadata); @@ -401,7 +401,7 @@ public TopicInfo setUserMetadata(String userMetadata) { /** * Gets the user metadata. * - * @return the user metadata + * @return A String represents the user metadata. */ public String getUserMetadata() { return getModel().getUserMetadata(); @@ -411,8 +411,8 @@ public String getUserMetadata() { * Sets the support ordering. * * @param supportOrdering - * the support ordering - * @return the topic info + * true if supports ordering, otherwise false. + * @return A TopicInfo object that represents the updated topic. */ public TopicInfo setSupportOrdering(Boolean supportOrdering) { getModel().setSupportOrdering(supportOrdering); @@ -422,7 +422,7 @@ public TopicInfo setSupportOrdering(Boolean supportOrdering) { /** * Checks if is support ordering. * - * @return the boolean + * @return true if supports ordering, otherwise false. */ public Boolean isSupportOrdering() { return getModel().isSupportOrdering(); @@ -432,8 +432,8 @@ public Boolean isSupportOrdering() { * Sets the subscription count. * * @param subscriptionCount - * the subscription count - * @return the topic info + * The count of the subscription. + * @return A TopicInfo object that represents the updated topic. */ public TopicInfo setSubscriptionCount(Integer subscriptionCount) { getModel().setSubscriptionCount(subscriptionCount); @@ -443,7 +443,7 @@ public TopicInfo setSubscriptionCount(Integer subscriptionCount) { /** * Gets the subscription count. * - * @return the subscription count + * @return the count of the subscription. */ public Integer getSubscriptionCount() { return getModel().getSubscriptionCount(); @@ -453,8 +453,8 @@ public Integer getSubscriptionCount() { * Sets the count details. * * @param countDetails - * the count details - * @return the topic info + * A MessageCountDetails object which represents the count details. + * @return A TopicInfo object that represents the updated topic. */ public TopicInfo setCountDetails(MessageCountDetails countDetails) { getModel().setCountDetail(countDetails); @@ -464,7 +464,7 @@ public TopicInfo setCountDetails(MessageCountDetails countDetails) { /** * Gets the count details. * - * @return the count details + * @return A MessageCountDetails which represents the count details. */ public MessageCountDetails getCountDetails() { return getModel().getCountDetail(); @@ -474,8 +474,8 @@ public MessageCountDetails getCountDetails() { * Sets the auto delete on idle. * * @param autoDeleteOnIdle - * the auto delete on idle - * @return the topic info + * A Duration object which represents the time span of auto delete on idle. + * @return A TopicInfo object that represents the updated topic. */ public TopicInfo setAutoDeleteOnIdle(Duration autoDeleteOnIdle) { getModel().setAutoDeleteOnIdle(autoDeleteOnIdle); @@ -485,7 +485,7 @@ public TopicInfo setAutoDeleteOnIdle(Duration autoDeleteOnIdle) { /** * Gets the auto delete on idle. * - * @return the auto delete on idle + * @return A Duration object which represents the time span of auto delete on idle. */ public Duration getAutoDeleteOnIdle() { return getModel().getAutoDeleteOnIdle(); @@ -495,8 +495,8 @@ public Duration getAutoDeleteOnIdle() { * Sets the partitioning policy. * * @param partitioningPolicy - * the partitioning policy - * @return the topic info + * A PartitioningPolicy object which represents the partitioning policy. + * @return A TopicInfo object that represents the updated topic. */ public TopicInfo setPartitioningPolicy(PartitioningPolicy partitioningPolicy) { getModel().setPartitioningPolicy(partitioningPolicy); @@ -506,7 +506,7 @@ public TopicInfo setPartitioningPolicy(PartitioningPolicy partitioningPolicy) { /** * Gets the partitioning policy. * - * @return the partitioning policy + * @return A PartitioningPolicy object which represents the partitioning policy. */ public PartitioningPolicy getPartitioningPolicy() { return getModel().getPartitioningPolicy(); @@ -516,8 +516,8 @@ public PartitioningPolicy getPartitioningPolicy() { * Sets the entity availability status. * * @param entityAvailabilityStatus - * the entity availability status - * @return the topic info + * An EntityAvailabilityStatus instance which represents the entity availability status. + * @return A TopicInfo object that represents the updated topic. */ public TopicInfo setEntityAvailabilityStatus(EntityAvailabilityStatus entityAvailabilityStatus) { getModel().setEntityAvailabilityStatus(entityAvailabilityStatus); @@ -527,7 +527,7 @@ public TopicInfo setEntityAvailabilityStatus(EntityAvailabilityStatus entityAvai /** * Gets the entity availability status. * - * @return the entity availability status + * @return An EntityAvailabilityStatus instance which represents the entity availability status. */ public EntityAvailabilityStatus getEntityAvailabilityStatus() { return getModel().getEntityAvailabilityStatus(); From d72553e8faecfc907f2826f2c9cbd514edb6a5e0 Mon Sep 17 00:00:00 2001 From: Albert Cheng Date: Tue, 30 Apr 2013 14:06:29 -0700 Subject: [PATCH 18/25] initial check in for renew lock. --- .../serviceBus/ServiceBusContract.java | 8 +++ .../ServiceBusExceptionProcessor.java | 40 ++++++++++++++ .../implementation/ServiceBusRestProxy.java | 20 +++++++ .../serviceBus/models/RenewLockResult.java | 53 +++++++++++++++++++ .../serviceBus/ServiceBusIntegrationTest.java | 21 ++++++++ 5 files changed, 142 insertions(+) create mode 100644 microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/RenewLockResult.java diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/ServiceBusContract.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/ServiceBusContract.java index edc879ea7b88..14c23c148256 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/ServiceBusContract.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/ServiceBusContract.java @@ -38,6 +38,7 @@ import com.microsoft.windowsazure.services.serviceBus.models.ReceiveMessageResult; import com.microsoft.windowsazure.services.serviceBus.models.ReceiveQueueMessageResult; import com.microsoft.windowsazure.services.serviceBus.models.ReceiveSubscriptionMessageResult; +import com.microsoft.windowsazure.services.serviceBus.models.RenewLockResult; import com.microsoft.windowsazure.services.serviceBus.models.RuleInfo; import com.microsoft.windowsazure.services.serviceBus.models.SubscriptionInfo; import com.microsoft.windowsazure.services.serviceBus.models.TopicInfo; @@ -482,4 +483,11 @@ ListSubscriptionsResult listSubscriptions(String topicPath, ListSubscriptionsOpt */ ListRulesResult listRules(String topicPath, String subscriptionName, ListRulesOptions options) throws ServiceException; + + RenewLockResult renewLock(String path, String messageId, String lockToken) throws ServiceException; + + RenewLockResult renewQueueLock(String queueName, String messageId, String lockToken) throws ServiceException; + + RenewLockResult renewSubscriptionLock(String subscriptionName, String messageId, String lockToken) + throws ServiceException; } diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/ServiceBusExceptionProcessor.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/ServiceBusExceptionProcessor.java index d0a9dc8e9610..beccdaf88e52 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/ServiceBusExceptionProcessor.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/ServiceBusExceptionProcessor.java @@ -46,6 +46,7 @@ import com.microsoft.windowsazure.services.serviceBus.models.ReceiveMessageResult; import com.microsoft.windowsazure.services.serviceBus.models.ReceiveQueueMessageResult; import com.microsoft.windowsazure.services.serviceBus.models.ReceiveSubscriptionMessageResult; +import com.microsoft.windowsazure.services.serviceBus.models.RenewLockResult; import com.microsoft.windowsazure.services.serviceBus.models.RuleInfo; import com.microsoft.windowsazure.services.serviceBus.models.SubscriptionInfo; import com.microsoft.windowsazure.services.serviceBus.models.TopicInfo; @@ -529,4 +530,43 @@ public ReceiveMessageResult receiveMessage(String path, ReceiveMessageOptions op } } + @Override + public RenewLockResult renewLock(String path, String messageId, String lockToken) throws ServiceException { + try { + return next.renewLock(path, messageId, lockToken); + } + catch (UniformInterfaceException e) { + throw processCatch(new ServiceException(e)); + } + catch (ClientHandlerException e) { + throw processCatch(new ServiceException(e)); + } + } + + @Override + public RenewLockResult renewQueueLock(String queueName, String messageId, String lockToken) throws ServiceException { + try { + return next.renewQueueLock(queueName, messageId, lockToken); + } + catch (UniformInterfaceException e) { + throw processCatch(new ServiceException(e)); + } + catch (ClientHandlerException e) { + throw processCatch(new ServiceException(e)); + } + } + + @Override + public RenewLockResult renewSubscriptionLock(String subscriptionName, String messageId, String lockToken) + throws ServiceException { + try { + return next.renewSubscriptionLock(subscriptionName, messageId, lockToken); + } + catch (UniformInterfaceException e) { + throw processCatch(new ServiceException(e)); + } + catch (ClientHandlerException e) { + throw processCatch(new ServiceException(e)); + } + } } diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/ServiceBusRestProxy.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/ServiceBusRestProxy.java index e9ee204c9dba..2a6277d68eb7 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/ServiceBusRestProxy.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/ServiceBusRestProxy.java @@ -54,6 +54,7 @@ import com.microsoft.windowsazure.services.serviceBus.models.ReceiveMessageResult; import com.microsoft.windowsazure.services.serviceBus.models.ReceiveQueueMessageResult; import com.microsoft.windowsazure.services.serviceBus.models.ReceiveSubscriptionMessageResult; +import com.microsoft.windowsazure.services.serviceBus.models.RenewLockResult; import com.microsoft.windowsazure.services.serviceBus.models.RuleInfo; import com.microsoft.windowsazure.services.serviceBus.models.SubscriptionInfo; import com.microsoft.windowsazure.services.serviceBus.models.TopicInfo; @@ -429,4 +430,23 @@ public ListRulesResult listRules(String topicName, String subscriptionName) thro return listRules(topicName, subscriptionName, ListRulesOptions.DEFAULT); } + @Override + public RenewLockResult renewLock(String entityName, String messageId, String lockToken) throws ServiceException { + ClientResponse clientResponse = getResource().path(entityName).path("messages").path(messageId).path(lockToken) + .post(ClientResponse.class); + RenewLockResult renewLockResult = new RenewLockResult(null); + return renewLockResult; + } + + @Override + public RenewLockResult renewQueueLock(String queueName, String messageId, String lockToken) throws ServiceException { + return renewLock(queueName, messageId, lockToken); + } + + @Override + public RenewLockResult renewSubscriptionLock(String subscriptionName, String messageId, String lockToken) + throws ServiceException { + return renewLock(subscriptionName, messageId, lockToken); + } + } diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/RenewLockResult.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/RenewLockResult.java new file mode 100644 index 000000000000..a4e24527af7f --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/RenewLockResult.java @@ -0,0 +1,53 @@ +/** + * 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. + */ +package com.microsoft.windowsazure.services.serviceBus.models; + +/** + * Represents the result of a renewLock operation. + */ +public class RenewLockResult { + + private BrokeredMessage value; + + /** + * Creates an instance of the RenewLockResult class. + * + * @param value + * A {@link BrokeredMessage} object assigned as the value of the result. + */ + public RenewLockResult(BrokeredMessage value) { + this.setValue(value); + } + + /** + * Specifies the value of the result. + * + * @param value + * A {@link BrokeredMessage} object assigned as the value of the result. + */ + public void setValue(BrokeredMessage value) { + this.value = value; + } + + /** + * Returns the value of the result. + * + * @return A {@link BrokeredMessage} object that represents the value of the result. + */ + public BrokeredMessage getValue() { + return value; + } + +} 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 ba47ddec891f..42cf5e594729 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 @@ -186,6 +186,27 @@ public void receiveMessageWorks() throws Exception { assertArrayEquals("Hello World".getBytes(), Arrays.copyOf(data, size)); } + @Test + public void renewLockMessageWorks() throws Exception { + // Arrange + String queueName = "TestRenewLockMessageWorks"; + service.createQueue(new QueueInfo(queueName)); + service.sendQueueMessage(queueName, new BrokeredMessage("Hello Again")); + + // Act + BrokeredMessage message = service.receiveQueueMessage(queueName, PEEK_LOCK_5_SECONDS).getValue(); + + BrokeredMessage renewedMessage = service.renewLock(queueName, message.getMessageId(), message.getLockToken()) + .getValue(); + + // Assert + byte[] data = new byte[100]; + int size = message.getBody().read(data); + assertEquals(11, size); + assertEquals("Hello Again", new String(data, 0, size)); + assertTrue(message.getLockedUntilUtc() != renewedMessage.getLockedUntilUtc()); + } + @Test public void peekLockMessageWorks() throws Exception { // Arrange From 015831da508b08676c2a881f5c5b9f1f514dc21a Mon Sep 17 00:00:00 2001 From: Albert Cheng Date: Tue, 30 Apr 2013 17:47:42 -0700 Subject: [PATCH 19/25] get renew lock working. --- .../services/serviceBus/ServiceBusContract.java | 8 +++----- .../ServiceBusExceptionProcessor.java | 13 ++++++------- .../implementation/ServiceBusRestProxy.java | 15 ++++++--------- .../serviceBus/ServiceBusIntegrationTest.java | 12 +++--------- 4 files changed, 18 insertions(+), 30 deletions(-) diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/ServiceBusContract.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/ServiceBusContract.java index 14c23c148256..b9b0c11d0030 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/ServiceBusContract.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/ServiceBusContract.java @@ -38,7 +38,6 @@ import com.microsoft.windowsazure.services.serviceBus.models.ReceiveMessageResult; import com.microsoft.windowsazure.services.serviceBus.models.ReceiveQueueMessageResult; import com.microsoft.windowsazure.services.serviceBus.models.ReceiveSubscriptionMessageResult; -import com.microsoft.windowsazure.services.serviceBus.models.RenewLockResult; import com.microsoft.windowsazure.services.serviceBus.models.RuleInfo; import com.microsoft.windowsazure.services.serviceBus.models.SubscriptionInfo; import com.microsoft.windowsazure.services.serviceBus.models.TopicInfo; @@ -484,10 +483,9 @@ ListSubscriptionsResult listSubscriptions(String topicPath, ListSubscriptionsOpt ListRulesResult listRules(String topicPath, String subscriptionName, ListRulesOptions options) throws ServiceException; - RenewLockResult renewLock(String path, String messageId, String lockToken) throws ServiceException; + void renewLock(String path, String messageId, String lockToken) throws ServiceException; - RenewLockResult renewQueueLock(String queueName, String messageId, String lockToken) throws ServiceException; + void renewQueueLock(String queueName, String messageId, String lockToken) throws ServiceException; - RenewLockResult renewSubscriptionLock(String subscriptionName, String messageId, String lockToken) - throws ServiceException; + void renewSubscriptionLock(String subscriptionName, String messageId, String lockToken) throws ServiceException; } diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/ServiceBusExceptionProcessor.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/ServiceBusExceptionProcessor.java index beccdaf88e52..0fc1ad7882db 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/ServiceBusExceptionProcessor.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/ServiceBusExceptionProcessor.java @@ -46,7 +46,6 @@ import com.microsoft.windowsazure.services.serviceBus.models.ReceiveMessageResult; import com.microsoft.windowsazure.services.serviceBus.models.ReceiveQueueMessageResult; import com.microsoft.windowsazure.services.serviceBus.models.ReceiveSubscriptionMessageResult; -import com.microsoft.windowsazure.services.serviceBus.models.RenewLockResult; import com.microsoft.windowsazure.services.serviceBus.models.RuleInfo; import com.microsoft.windowsazure.services.serviceBus.models.SubscriptionInfo; import com.microsoft.windowsazure.services.serviceBus.models.TopicInfo; @@ -531,9 +530,9 @@ public ReceiveMessageResult receiveMessage(String path, ReceiveMessageOptions op } @Override - public RenewLockResult renewLock(String path, String messageId, String lockToken) throws ServiceException { + public void renewLock(String path, String messageId, String lockToken) throws ServiceException { try { - return next.renewLock(path, messageId, lockToken); + next.renewLock(path, messageId, lockToken); } catch (UniformInterfaceException e) { throw processCatch(new ServiceException(e)); @@ -544,9 +543,9 @@ public RenewLockResult renewLock(String path, String messageId, String lockToken } @Override - public RenewLockResult renewQueueLock(String queueName, String messageId, String lockToken) throws ServiceException { + public void renewQueueLock(String queueName, String messageId, String lockToken) throws ServiceException { try { - return next.renewQueueLock(queueName, messageId, lockToken); + next.renewQueueLock(queueName, messageId, lockToken); } catch (UniformInterfaceException e) { throw processCatch(new ServiceException(e)); @@ -557,10 +556,10 @@ public RenewLockResult renewQueueLock(String queueName, String messageId, String } @Override - public RenewLockResult renewSubscriptionLock(String subscriptionName, String messageId, String lockToken) + public void renewSubscriptionLock(String subscriptionName, String messageId, String lockToken) throws ServiceException { try { - return next.renewSubscriptionLock(subscriptionName, messageId, lockToken); + next.renewSubscriptionLock(subscriptionName, messageId, lockToken); } catch (UniformInterfaceException e) { throw processCatch(new ServiceException(e)); diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/ServiceBusRestProxy.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/ServiceBusRestProxy.java index ee7871c8fd0a..bd4f5503fc85 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/ServiceBusRestProxy.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/ServiceBusRestProxy.java @@ -54,7 +54,6 @@ import com.microsoft.windowsazure.services.serviceBus.models.ReceiveMessageResult; import com.microsoft.windowsazure.services.serviceBus.models.ReceiveQueueMessageResult; import com.microsoft.windowsazure.services.serviceBus.models.ReceiveSubscriptionMessageResult; -import com.microsoft.windowsazure.services.serviceBus.models.RenewLockResult; import com.microsoft.windowsazure.services.serviceBus.models.RuleInfo; import com.microsoft.windowsazure.services.serviceBus.models.SubscriptionInfo; import com.microsoft.windowsazure.services.serviceBus.models.TopicInfo; @@ -436,22 +435,20 @@ public ListRulesResult listRules(String topicName, String subscriptionName) thro } @Override - public RenewLockResult renewLock(String entityName, String messageId, String lockToken) throws ServiceException { + public void renewLock(String entityName, String messageId, String lockToken) throws ServiceException { ClientResponse clientResponse = getResource().path(entityName).path("messages").path(messageId).path(lockToken) - .post(ClientResponse.class); - RenewLockResult renewLockResult = new RenewLockResult(null); - return renewLockResult; + .post(ClientResponse.class, ""); } @Override - public RenewLockResult renewQueueLock(String queueName, String messageId, String lockToken) throws ServiceException { - return renewLock(queueName, messageId, lockToken); + public void renewQueueLock(String queueName, String messageId, String lockToken) throws ServiceException { + renewLock(queueName, messageId, lockToken); } @Override - public RenewLockResult renewSubscriptionLock(String subscriptionName, String messageId, String lockToken) + public void renewSubscriptionLock(String subscriptionName, String messageId, String lockToken) throws ServiceException { - return renewLock(subscriptionName, messageId, lockToken); + renewLock(subscriptionName, messageId, lockToken); } } 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 4798d3c498c3..836d687c8e11 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 @@ -194,18 +194,12 @@ public void renewLockMessageWorks() throws Exception { service.createQueue(new QueueInfo(queueName)); service.sendQueueMessage(queueName, new BrokeredMessage("Hello Again")); - // Act + // Act BrokeredMessage message = service.receiveQueueMessage(queueName, PEEK_LOCK_5_SECONDS).getValue(); - - BrokeredMessage renewedMessage = service.renewLock(queueName, message.getMessageId(), message.getLockToken()) - .getValue(); + service.renewLock(queueName, message.getMessageId(), message.getLockToken()); // Assert - byte[] data = new byte[100]; - int size = message.getBody().read(data); - assertEquals(11, size); - assertEquals("Hello Again", new String(data, 0, size)); - assertTrue(message.getLockedUntilUtc() != renewedMessage.getLockedUntilUtc()); + assertNotNull(message); } @Test From 156a56e37122530a9eae473a0e75877a5ebf33a5 Mon Sep 17 00:00:00 2001 From: Albert Cheng Date: Wed, 1 May 2013 11:29:02 -0700 Subject: [PATCH 20/25] get unit test pass for renew message. --- .../serviceBus/ServiceBusContract.java | 41 +++++++++++++++---- .../ServiceBusExceptionProcessor.java | 18 ++------ .../implementation/ServiceBusRestProxy.java | 17 ++++---- .../serviceBus/ServiceBusIntegrationTest.java | 24 +++++++++-- 4 files changed, 64 insertions(+), 36 deletions(-) diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/ServiceBusContract.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/ServiceBusContract.java index b9b0c11d0030..e65a01ec6e85 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/ServiceBusContract.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/ServiceBusContract.java @@ -42,6 +42,7 @@ import com.microsoft.windowsazure.services.serviceBus.models.SubscriptionInfo; import com.microsoft.windowsazure.services.serviceBus.models.TopicInfo; +// TODO: Auto-generated Javadoc /** * * Defines the service bus contract. @@ -394,14 +395,11 @@ ListSubscriptionsResult listSubscriptions(String topicPath, ListSubscriptionsOpt * * @param topicName * A String option which represents the name of the topic. - * * @param subscriptionInfo * A SubscriptionInfo option which represents the information of the subscription. - * * @return A SubscriptionInfo object that represents the result. - * - * @exception ServiceException - * If a service exception is encountered. + * @throws ServiceException + * If a service exception is encountered. */ SubscriptionInfo updateSubscription(String topicName, SubscriptionInfo subscriptionInfo) throws ServiceException; @@ -476,16 +474,41 @@ ListSubscriptionsResult listSubscriptions(String topicPath, ListSubscriptionsOpt * retrieved. * @param options * A ListRulesOptions object that represents the options to retrieve rules. - * + * @return the list rules result * @throws ServiceException * If a service exception is encountered. */ ListRulesResult listRules(String topicPath, String subscriptionName, ListRulesOptions options) throws ServiceException; - void renewLock(String path, String messageId, String lockToken) throws ServiceException; - + /** + * Renew queue lock. + * + * @param queueName + * A String object that represents the name of the queue. + * @param messageId + * A String object that represents the ID of the message. + * @param lockToken + * A String object that represents the token of the lock. + * @throws ServiceException + * If a service exception is encountered. + */ void renewQueueLock(String queueName, String messageId, String lockToken) throws ServiceException; - void renewSubscriptionLock(String subscriptionName, String messageId, String lockToken) throws ServiceException; + /** + * Renew subscription lock. + * + * @param topicName + * A String object that represents the name of the topic. + * @param queueName + * A String object that represents the name of the queue. + * @param messageId + * A String object that represents the ID of the message. + * @param lockToken + * A String object that represents the token of the lock. + * @throws ServiceException + * If a service exception is encountered. + */ + void renewSubscriptionLock(String topicName, String subscriptionName, String messageId, String lockToken) + throws ServiceException; } diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/ServiceBusExceptionProcessor.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/ServiceBusExceptionProcessor.java index 0fc1ad7882db..70e3de447c40 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/ServiceBusExceptionProcessor.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/ServiceBusExceptionProcessor.java @@ -529,19 +529,6 @@ public ReceiveMessageResult receiveMessage(String path, ReceiveMessageOptions op } } - @Override - public void renewLock(String path, String messageId, String lockToken) throws ServiceException { - try { - next.renewLock(path, messageId, lockToken); - } - catch (UniformInterfaceException e) { - throw processCatch(new ServiceException(e)); - } - catch (ClientHandlerException e) { - throw processCatch(new ServiceException(e)); - } - } - @Override public void renewQueueLock(String queueName, String messageId, String lockToken) throws ServiceException { try { @@ -556,10 +543,10 @@ public void renewQueueLock(String queueName, String messageId, String lockToken) } @Override - public void renewSubscriptionLock(String subscriptionName, String messageId, String lockToken) + public void renewSubscriptionLock(String topicName, String subscriptionName, String messageId, String lockToken) throws ServiceException { try { - next.renewSubscriptionLock(subscriptionName, messageId, lockToken); + next.renewSubscriptionLock(topicName, subscriptionName, messageId, lockToken); } catch (UniformInterfaceException e) { throw processCatch(new ServiceException(e)); @@ -568,4 +555,5 @@ public void renewSubscriptionLock(String subscriptionName, String messageId, Str throw processCatch(new ServiceException(e)); } } + } diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/ServiceBusRestProxy.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/ServiceBusRestProxy.java index bd4f5503fc85..05e12f33bfac 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/ServiceBusRestProxy.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/ServiceBusRestProxy.java @@ -30,6 +30,7 @@ import com.microsoft.windowsazure.services.core.ServiceFilter; import com.microsoft.windowsazure.services.core.UserAgentFilter; import com.microsoft.windowsazure.services.core.utils.pipeline.ClientFilterAdapter; +import com.microsoft.windowsazure.services.core.utils.pipeline.PipelineHelpers; import com.microsoft.windowsazure.services.serviceBus.ServiceBusContract; import com.microsoft.windowsazure.services.serviceBus.models.AbstractListOptions; import com.microsoft.windowsazure.services.serviceBus.models.BrokeredMessage; @@ -434,21 +435,19 @@ public ListRulesResult listRules(String topicName, String subscriptionName) thro return listRules(topicName, subscriptionName, ListRulesOptions.DEFAULT); } - @Override - public void renewLock(String entityName, String messageId, String lockToken) throws ServiceException { - ClientResponse clientResponse = getResource().path(entityName).path("messages").path(messageId).path(lockToken) - .post(ClientResponse.class, ""); - } - @Override public void renewQueueLock(String queueName, String messageId, String lockToken) throws ServiceException { - renewLock(queueName, messageId, lockToken); + ClientResponse clientResponse = getResource().path(queueName).path("messages").path(messageId).path(lockToken) + .post(ClientResponse.class, ""); + PipelineHelpers.ThrowIfNotSuccess(clientResponse); } @Override - public void renewSubscriptionLock(String subscriptionName, String messageId, String lockToken) + public void renewSubscriptionLock(String topicName, String subscriptionName, String messageId, String lockToken) throws ServiceException { - renewLock(subscriptionName, messageId, lockToken); + ClientResponse clientResponse = getResource().path(topicName).path("Subscriptions").path(subscriptionName) + .path("messages").path(messageId).path(lockToken).post(ClientResponse.class, ""); + PipelineHelpers.ThrowIfNotSuccess(clientResponse); } } 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 836d687c8e11..a8c20cce470f 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 @@ -188,15 +188,33 @@ public void receiveMessageWorks() throws Exception { } @Test - public void renewLockMessageWorks() throws Exception { + public void renewSubscriptionMessageLockWorks() throws Exception { // Arrange - String queueName = "TestRenewLockMessageWorks"; + String topicName = "TestRenewSubscriptionLockMessageWorks"; + String subscriptionName = "renewSubscriptionMessageLockWorks"; + service.createTopic(new TopicInfo(topicName)); + service.createSubscription(topicName, new SubscriptionInfo(subscriptionName)); + service.sendTopicMessage(topicName, new BrokeredMessage("Hello Again")); + + // Act + BrokeredMessage message = service.receiveSubscriptionMessage(topicName, subscriptionName, PEEK_LOCK_5_SECONDS) + .getValue(); + service.renewSubscriptionLock(topicName, subscriptionName, message.getMessageId(), message.getLockToken()); + + // Assert + assertNotNull(message); + } + + @Test + public void renewQueueMessageLockWorks() throws Exception { + // Arrange + String queueName = "TestRenewSubscriptionLockMessageWorks"; service.createQueue(new QueueInfo(queueName)); service.sendQueueMessage(queueName, new BrokeredMessage("Hello Again")); // Act BrokeredMessage message = service.receiveQueueMessage(queueName, PEEK_LOCK_5_SECONDS).getValue(); - service.renewLock(queueName, message.getMessageId(), message.getLockToken()); + service.renewQueueLock(queueName, message.getMessageId(), message.getLockToken()); // Assert assertNotNull(message); From da52232c71322fb19d2c45bcd3182e191b706dad Mon Sep 17 00:00:00 2001 From: Albert Cheng Date: Wed, 1 May 2013 11:32:58 -0700 Subject: [PATCH 21/25] code clean up! --- .../serviceBus/ServiceBusContract.java | 1 - .../serviceBus/models/RenewLockResult.java | 53 ------------------- 2 files changed, 54 deletions(-) delete mode 100644 microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/RenewLockResult.java diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/ServiceBusContract.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/ServiceBusContract.java index e65a01ec6e85..075f3c748433 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/ServiceBusContract.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/ServiceBusContract.java @@ -42,7 +42,6 @@ import com.microsoft.windowsazure.services.serviceBus.models.SubscriptionInfo; import com.microsoft.windowsazure.services.serviceBus.models.TopicInfo; -// TODO: Auto-generated Javadoc /** * * Defines the service bus contract. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/RenewLockResult.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/RenewLockResult.java deleted file mode 100644 index a4e24527af7f..000000000000 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/RenewLockResult.java +++ /dev/null @@ -1,53 +0,0 @@ -/** - * 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. - */ -package com.microsoft.windowsazure.services.serviceBus.models; - -/** - * Represents the result of a renewLock operation. - */ -public class RenewLockResult { - - private BrokeredMessage value; - - /** - * Creates an instance of the RenewLockResult class. - * - * @param value - * A {@link BrokeredMessage} object assigned as the value of the result. - */ - public RenewLockResult(BrokeredMessage value) { - this.setValue(value); - } - - /** - * Specifies the value of the result. - * - * @param value - * A {@link BrokeredMessage} object assigned as the value of the result. - */ - public void setValue(BrokeredMessage value) { - this.value = value; - } - - /** - * Returns the value of the result. - * - * @return A {@link BrokeredMessage} object that represents the value of the result. - */ - public BrokeredMessage getValue() { - return value; - } - -} From bca8eae2af309c9ba7c884f50b19105e82aff2ee Mon Sep 17 00:00:00 2001 From: Albert Cheng Date: Wed, 1 May 2013 14:42:22 -0700 Subject: [PATCH 22/25] fix a unit test failure for topic info. --- .../windowsazure/services/serviceBus/models/TopicInfo.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/TopicInfo.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/TopicInfo.java index 8d95a2182c14..f58aaebf491a 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/TopicInfo.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/TopicInfo.java @@ -362,7 +362,7 @@ public TopicInfo setUpdatedAt(Calendar updatedAt) { * @return A Calendar object which represents when the topic was updated. */ public Calendar getUpdatedAt() { - return getModel().getCreatedAt(); + return getModel().getUpdatedAt(); } /** From 10f93e00cd688464ef021dcaf1c234df9f27face Mon Sep 17 00:00:00 2001 From: Albert Cheng Date: Fri, 3 May 2013 16:09:15 -0700 Subject: [PATCH 23/25] remove message count details and forward to for JSR review. --- .../services/serviceBus/models/QueueInfo.java | 43 ---------------- .../serviceBus/models/SubscriptionInfo.java | 43 ---------------- .../services/serviceBus/models/TopicInfo.java | 43 ---------------- ...netservices.2010.10.servicebus.connect.xsd | 51 ------------------- .../serviceBus/models/QueueInfoTest.java | 27 ---------- .../models/SubscriptionInfoTest.java | 28 ---------- .../serviceBus/models/TopicInfoTest.java | 27 ---------- 7 files changed, 262 deletions(-) diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/QueueInfo.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/QueueInfo.java index 13331714b40f..089f4a54fb1f 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/QueueInfo.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/QueueInfo.java @@ -25,7 +25,6 @@ import com.microsoft.windowsazure.services.serviceBus.implementation.EntityStatus; import com.microsoft.windowsazure.services.serviceBus.implementation.Entry; import com.microsoft.windowsazure.services.serviceBus.implementation.EntryModel; -import com.microsoft.windowsazure.services.serviceBus.implementation.MessageCountDetails; import com.microsoft.windowsazure.services.serviceBus.implementation.PartitioningPolicy; import com.microsoft.windowsazure.services.serviceBus.implementation.QueueDescription; @@ -352,27 +351,6 @@ public QueueInfo setMessageCount(Long messageCount) { return this; } - /** - * Sets the count details. - * - * @param countDetails - * A MessageCountDetails object that contains the details of the message count. - * @return A QueueInfo object that represents the updated queue. - */ - public QueueInfo setCountDetails(MessageCountDetails countDetails) { - getModel().setCountDetails(countDetails); - return this; - } - - /** - * Gets the count details. - * - * @return A MessageCountDetails object that contains the details of the message count. - */ - public MessageCountDetails getCountDetails() { - return getModel().getCountDetails(); - } - /** * Gets the authorization. * @@ -478,27 +456,6 @@ public QueueInfo setEntityAvailabilityStatus(EntityAvailabilityStatus entityAvai return this; } - /** - * Gets the forward to. - * - * @return A String object represents which queue the messages will be forwarded to. - */ - public String getForwardTo() { - return getModel().getForwardTo(); - } - - /** - * Sets the forward to. - * - * @param forwardTo - * A String object represents which queue the messages will be forwarded to. - * @return A QueueInfo object that represents the updated queue. - */ - public QueueInfo setForwardTo(String forwardTo) { - getModel().setForwardTo(forwardTo); - return this; - } - /** * Gets the created at. * diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/SubscriptionInfo.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/SubscriptionInfo.java index d81ea274e44c..04263c111503 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/SubscriptionInfo.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/SubscriptionInfo.java @@ -24,7 +24,6 @@ import com.microsoft.windowsazure.services.serviceBus.implementation.EntityStatus; import com.microsoft.windowsazure.services.serviceBus.implementation.Entry; import com.microsoft.windowsazure.services.serviceBus.implementation.EntryModel; -import com.microsoft.windowsazure.services.serviceBus.implementation.MessageCountDetails; import com.microsoft.windowsazure.services.serviceBus.implementation.RuleDescription; import com.microsoft.windowsazure.services.serviceBus.implementation.SubscriptionDescription; @@ -305,27 +304,6 @@ public EntityStatus getStatus() { return getModel().getStatus(); } - /** - * Sets the forward to. - * - * @param forwardTo - * the forward to - * @return A SubscriptionInfo object that represents the updated subscription. - */ - public SubscriptionInfo setForwardTo(String forwardTo) { - getModel().setForwardTo(forwardTo); - return this; - } - - /** - * Gets the forward to. - * - * @return the forward to - */ - public String getForwardTo() { - return getModel().getForwardTo(); - } - /** * Sets the created at. * @@ -410,27 +388,6 @@ public String getUserMetadata() { return getModel().getUserMetadata(); } - /** - * Sets the count details. - * - * @param countDetails - * A MessageCountDetails represents the details of message count. - * @return A SubscriptionInfo object that represents the updated subscription. - */ - public SubscriptionInfo setCountDetails(MessageCountDetails countDetails) { - getModel().setCountDetails(countDetails); - return this; - } - - /** - * Gets the count details. - * - * @return A MessageCountDetails represents the details of message count. - */ - public MessageCountDetails getCountDetails() { - return getModel().getCountDetails(); - } - /** * Sets the auto delete on idle. * diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/TopicInfo.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/TopicInfo.java index 8d95a2182c14..684007269f83 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/TopicInfo.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/TopicInfo.java @@ -25,7 +25,6 @@ import com.microsoft.windowsazure.services.serviceBus.implementation.EntityStatus; import com.microsoft.windowsazure.services.serviceBus.implementation.Entry; import com.microsoft.windowsazure.services.serviceBus.implementation.EntryModel; -import com.microsoft.windowsazure.services.serviceBus.implementation.MessageCountDetails; import com.microsoft.windowsazure.services.serviceBus.implementation.PartitioningPolicy; import com.microsoft.windowsazure.services.serviceBus.implementation.TopicDescription; @@ -302,27 +301,6 @@ public EntityStatus getStatus() { return getModel().getStatus(); } - /** - * Sets the forward to. - * - * @param forwardTo - * the forward to - * @return A TopicInfo object that represents the updated topic. - */ - public TopicInfo setForwardTo(String forwardTo) { - getModel().setForwardTo(forwardTo); - return this; - } - - /** - * Gets the forward to. - * - * @return A String object which represents the forward to. - */ - public String getForwardTo() { - return getModel().getForwardTo(); - } - /** * Sets the created at. * @@ -449,27 +427,6 @@ public Integer getSubscriptionCount() { return getModel().getSubscriptionCount(); } - /** - * Sets the count details. - * - * @param countDetails - * A MessageCountDetails object which represents the count details. - * @return A TopicInfo object that represents the updated topic. - */ - public TopicInfo setCountDetails(MessageCountDetails countDetails) { - getModel().setCountDetail(countDetails); - return this; - } - - /** - * Gets the count details. - * - * @return A MessageCountDetails which represents the count details. - */ - public MessageCountDetails getCountDetails() { - return getModel().getCountDetail(); - } - /** * Sets the auto delete on idle. * diff --git a/microsoft-azure-api/src/main/resources/schemas.microsoft.com.netservices.2010.10.servicebus.connect.xsd b/microsoft-azure-api/src/main/resources/schemas.microsoft.com.netservices.2010.10.servicebus.connect.xsd index a4c3eb255350..61fc4436d1ea 100644 --- a/microsoft-azure-api/src/main/resources/schemas.microsoft.com.netservices.2010.10.servicebus.connect.xsd +++ b/microsoft-azure-api/src/main/resources/schemas.microsoft.com.netservices.2010.10.servicebus.connect.xsd @@ -122,13 +122,6 @@ - - - - - - - @@ -164,13 +157,6 @@ - - - - - - - @@ -267,13 +253,6 @@ - - - - - - - @@ -302,13 +281,6 @@ - - - - - - - @@ -397,15 +369,6 @@ - - - - - - - - - @@ -557,13 +520,6 @@ - - - - - - - @@ -606,13 +562,6 @@ - - - - - - - diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/serviceBus/models/QueueInfoTest.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/serviceBus/models/QueueInfoTest.java index 80887432d940..c65abee52aee 100644 --- a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/serviceBus/models/QueueInfoTest.java +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/serviceBus/models/QueueInfoTest.java @@ -27,7 +27,6 @@ import com.microsoft.windowsazure.services.serviceBus.implementation.AuthorizationRules; import com.microsoft.windowsazure.services.serviceBus.implementation.EntityAvailabilityStatus; import com.microsoft.windowsazure.services.serviceBus.implementation.EntityStatus; -import com.microsoft.windowsazure.services.serviceBus.implementation.MessageCountDetails; import com.microsoft.windowsazure.services.serviceBus.implementation.PartitioningPolicy; public class QueueInfoTest { @@ -236,19 +235,6 @@ public void testGetSetStatus() { assertEquals(expectedEntityStatus, actualEntityStatus); } - @Test - public void testGetSetForwardTo() { - // Arrange - String expectedForwardTo = "forwardTo"; - QueueInfo queueInfo = new QueueInfo(); - - // Act - String actualForwardTo = queueInfo.setForwardTo(expectedForwardTo).getForwardTo(); - - // Assert - assertEquals(expectedForwardTo, actualForwardTo); - } - @Test public void testGetSetCreatedAt() { // Arrange @@ -314,19 +300,6 @@ public void testGetSetSupportOrdering() { assertEquals(expectedIsSupportOrdering, actualIsSupportOrdering); } - @Test - public void testGetSetCountDetails() { - // Arrange - MessageCountDetails expectedCountDetails = new MessageCountDetails(); - QueueInfo queueInfo = new QueueInfo(); - - // Act - MessageCountDetails actualCountDetails = queueInfo.setCountDetails(expectedCountDetails).getCountDetails(); - - // Assert - assertEquals(expectedCountDetails, actualCountDetails); - } - @Test public void testGetSetAutoDeleteOnIdle() { // Arrange diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/serviceBus/models/SubscriptionInfoTest.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/serviceBus/models/SubscriptionInfoTest.java index c1d440dba015..c981cfa1c271 100644 --- a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/serviceBus/models/SubscriptionInfoTest.java +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/serviceBus/models/SubscriptionInfoTest.java @@ -26,7 +26,6 @@ import com.microsoft.windowsazure.services.serviceBus.implementation.EntityAvailabilityStatus; import com.microsoft.windowsazure.services.serviceBus.implementation.EntityStatus; -import com.microsoft.windowsazure.services.serviceBus.implementation.MessageCountDetails; import com.microsoft.windowsazure.services.serviceBus.implementation.RuleDescription; public class SubscriptionInfoTest { @@ -181,19 +180,6 @@ public void testGetSetStatus() { assertEquals(expectedEntityStatus, actualEntityStatus); } - @Test - public void testGetSetForwardTo() { - // Arrange - String expectedForwardTo = "forwardTo"; - SubscriptionInfo SubscriptionInfo = new SubscriptionInfo(); - - // Act - String actualForwardTo = SubscriptionInfo.setForwardTo(expectedForwardTo).getForwardTo(); - - // Assert - assertEquals(expectedForwardTo, actualForwardTo); - } - @Test public void testGetSetCreatedAt() { // Arrange @@ -246,20 +232,6 @@ public void testGetSetUserMetadata() { assertEquals(expectedUserMetadata, actualUserMetadata); } - @Test - public void testGetSetCountDetails() { - // Arrange - MessageCountDetails expectedCountDetails = new MessageCountDetails(); - SubscriptionInfo SubscriptionInfo = new SubscriptionInfo(); - - // Act - MessageCountDetails actualCountDetails = SubscriptionInfo.setCountDetails(expectedCountDetails) - .getCountDetails(); - - // Assert - assertEquals(expectedCountDetails, actualCountDetails); - } - @Test public void testGetSetAutoDeleteOnIdle() { // Arrange diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/serviceBus/models/TopicInfoTest.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/serviceBus/models/TopicInfoTest.java index 605227a0e721..8f9988b9e055 100644 --- a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/serviceBus/models/TopicInfoTest.java +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/serviceBus/models/TopicInfoTest.java @@ -27,7 +27,6 @@ import com.microsoft.windowsazure.services.serviceBus.implementation.AuthorizationRules; import com.microsoft.windowsazure.services.serviceBus.implementation.EntityAvailabilityStatus; import com.microsoft.windowsazure.services.serviceBus.implementation.EntityStatus; -import com.microsoft.windowsazure.services.serviceBus.implementation.MessageCountDetails; import com.microsoft.windowsazure.services.serviceBus.implementation.PartitioningPolicy; public class TopicInfoTest { @@ -184,19 +183,6 @@ public void testGetSetStatus() { assertEquals(expectedEntityStatus, actualEntityStatus); } - @Test - public void testGetSetForwardTo() { - // Arrange - String expectedForwardTo = "forwardTo"; - TopicInfo topicInfo = new TopicInfo(); - - // Act - String actualForwardTo = topicInfo.setForwardTo(expectedForwardTo).getForwardTo(); - - // Assert - assertEquals(expectedForwardTo, actualForwardTo); - } - @Test public void testGetSetCreatedAt() { // Arrange @@ -276,19 +262,6 @@ public void testGetSetSubscriptionCount() { assertEquals(expectedSubscriptionCount, actualSubscriptionCount); } - @Test - public void testGetSetCountDetails() { - // Arrange - MessageCountDetails expectedCountDetails = new MessageCountDetails(); - TopicInfo topicInfo = new TopicInfo(); - - // Act - MessageCountDetails actualCountDetails = topicInfo.setCountDetails(expectedCountDetails).getCountDetails(); - - // Assert - assertEquals(expectedCountDetails, actualCountDetails); - } - @Test public void testGetSetAutoDeleteOnIdle() { // Arrange From ee6841f414ec43afe278291f90127859c0ba3933 Mon Sep 17 00:00:00 2001 From: Albert Cheng Date: Mon, 6 May 2013 10:51:18 -0700 Subject: [PATCH 24/25] remove authorization rule from this release. --- .../services/serviceBus/models/QueueInfo.java | 22 -------------- .../services/serviceBus/models/TopicInfo.java | 22 -------------- ...netservices.2010.10.servicebus.connect.xsd | 30 ------------------- .../serviceBus/models/QueueInfoTest.java | 15 ---------- .../serviceBus/models/TopicInfoTest.java | 15 ---------- 5 files changed, 104 deletions(-) diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/QueueInfo.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/QueueInfo.java index 089f4a54fb1f..8cc7a1efde54 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/QueueInfo.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/QueueInfo.java @@ -19,7 +19,6 @@ import javax.ws.rs.core.MediaType; import javax.xml.datatype.Duration; -import com.microsoft.windowsazure.services.serviceBus.implementation.AuthorizationRules; import com.microsoft.windowsazure.services.serviceBus.implementation.Content; import com.microsoft.windowsazure.services.serviceBus.implementation.EntityAvailabilityStatus; import com.microsoft.windowsazure.services.serviceBus.implementation.EntityStatus; @@ -351,27 +350,6 @@ public QueueInfo setMessageCount(Long messageCount) { return this; } - /** - * Gets the authorization. - * - * @return A AuthorizationRules instance which contains the rules of the authorization. - */ - public AuthorizationRules getAuthorization() { - return getModel().getAuthorizationRules(); - } - - /** - * Sets the authorization. - * - * @param authorizationRules - * the authorization rules - * @return A QueueInfo object that represents the updated queue. - */ - public QueueInfo setAuthorization(AuthorizationRules authorizationRules) { - getModel().setAuthorizationRules(authorizationRules); - return this; - } - /** * Checks if is anonymous accessible. * diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/TopicInfo.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/TopicInfo.java index 5ea136bfe008..41be6a80acd3 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/TopicInfo.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/TopicInfo.java @@ -19,7 +19,6 @@ import javax.ws.rs.core.MediaType; import javax.xml.datatype.Duration; -import com.microsoft.windowsazure.services.serviceBus.implementation.AuthorizationRules; import com.microsoft.windowsazure.services.serviceBus.implementation.Content; import com.microsoft.windowsazure.services.serviceBus.implementation.EntityAvailabilityStatus; import com.microsoft.windowsazure.services.serviceBus.implementation.EntityStatus; @@ -217,27 +216,6 @@ public TopicInfo setSizeInBytes(Long sizeInBytes) { return this; } - /** - * Sets the authorization. - * - * @param authorizationRules - * A AuthorizationRules - * @return A TopicInfo object that represents the updated topic. - */ - public TopicInfo setAuthorization(AuthorizationRules authorizationRules) { - getModel().setAuthorizationRules(authorizationRules); - return this; - } - - /** - * Gets the authorization. - * - * @return A AuthorizationRules object that contains the authorization rules. - */ - public AuthorizationRules getAuthorization() { - return getModel().getAuthorizationRules(); - } - /** * Sets the filtering message before publishing. * diff --git a/microsoft-azure-api/src/main/resources/schemas.microsoft.com.netservices.2010.10.servicebus.connect.xsd b/microsoft-azure-api/src/main/resources/schemas.microsoft.com.netservices.2010.10.servicebus.connect.xsd index 61fc4436d1ea..ff5f9bb9359a 100644 --- a/microsoft-azure-api/src/main/resources/schemas.microsoft.com.netservices.2010.10.servicebus.connect.xsd +++ b/microsoft-azure-api/src/main/resources/schemas.microsoft.com.netservices.2010.10.servicebus.connect.xsd @@ -108,13 +108,6 @@ - - - - - - - @@ -376,22 +369,6 @@ - - - - - - - - - - - - - - - - @@ -506,13 +483,6 @@ - - - - - - - diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/serviceBus/models/QueueInfoTest.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/serviceBus/models/QueueInfoTest.java index c65abee52aee..dff449d9a6d7 100644 --- a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/serviceBus/models/QueueInfoTest.java +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/serviceBus/models/QueueInfoTest.java @@ -24,7 +24,6 @@ import org.junit.Test; -import com.microsoft.windowsazure.services.serviceBus.implementation.AuthorizationRules; import com.microsoft.windowsazure.services.serviceBus.implementation.EntityAvailabilityStatus; import com.microsoft.windowsazure.services.serviceBus.implementation.EntityStatus; import com.microsoft.windowsazure.services.serviceBus.implementation.PartitioningPolicy; @@ -208,20 +207,6 @@ public void testGetSetIsAnonymousAccessible() { assertEquals(expectedIsAnonymousAccessible, actualIsAnonymousAccessible); } - @Test - public void testGetSetAuthorization() { - // Arrange - AuthorizationRules expectedAuthorizationRules = new AuthorizationRules(); - QueueInfo queueInfo = new QueueInfo(); - - // Act - AuthorizationRules actualAuthorizationRules = queueInfo.setAuthorization(expectedAuthorizationRules) - .getAuthorization(); - - // Assert - assertEquals(expectedAuthorizationRules, actualAuthorizationRules); - } - @Test public void testGetSetStatus() { // Arrange diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/serviceBus/models/TopicInfoTest.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/serviceBus/models/TopicInfoTest.java index 8f9988b9e055..9c7e8e4d8ed0 100644 --- a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/serviceBus/models/TopicInfoTest.java +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/serviceBus/models/TopicInfoTest.java @@ -24,7 +24,6 @@ import org.junit.Test; -import com.microsoft.windowsazure.services.serviceBus.implementation.AuthorizationRules; import com.microsoft.windowsazure.services.serviceBus.implementation.EntityAvailabilityStatus; import com.microsoft.windowsazure.services.serviceBus.implementation.EntityStatus; import com.microsoft.windowsazure.services.serviceBus.implementation.PartitioningPolicy; @@ -156,20 +155,6 @@ public void testGetSetAnonymousAccessible() { assertEquals(expectedAnonymousAccessible, actualAnonymousAccessible); } - @Test - public void testGetSetAuthorization() { - // Arrange - AuthorizationRules expectedAuthorizationRules = new AuthorizationRules(); - TopicInfo topicInfo = new TopicInfo(); - - // Act - AuthorizationRules actualAuthorizationRules = topicInfo.setAuthorization(expectedAuthorizationRules) - .getAuthorization(); - - // Assert - assertEquals(expectedAuthorizationRules, actualAuthorizationRules); - } - @Test public void testGetSetStatus() { // Arrange From 689ea78633c346669d15c7efc40197d691a3f3d4 Mon Sep 17 00:00:00 2001 From: Albert Cheng Date: Tue, 14 May 2013 17:41:37 -0700 Subject: [PATCH 25/25] integration testing of metadata. --- .../implementation/ServiceBusRestProxy.java | 2 +- .../services/serviceBus/models/TopicInfo.java | 4 +-- ...netservices.2010.10.servicebus.connect.xsd | 2 +- .../serviceBus/ServiceBusIntegrationTest.java | 30 +++++++++++++++++++ 4 files changed, 34 insertions(+), 4 deletions(-) diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/ServiceBusRestProxy.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/ServiceBusRestProxy.java index 05e12f33bfac..482d26a74199 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/ServiceBusRestProxy.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/ServiceBusRestProxy.java @@ -110,7 +110,7 @@ public void setChannel(Client channel) { } private WebResource getResource() { - WebResource resource = getChannel().resource(uri); + WebResource resource = getChannel().resource(uri).queryParam("api-version", "2012-08"); for (ServiceFilter filter : filters) { resource.addFilter(new ClientFilterAdapter(filter)); } diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/TopicInfo.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/TopicInfo.java index 41be6a80acd3..627af7f6d05e 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/TopicInfo.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/TopicInfo.java @@ -245,7 +245,7 @@ public Boolean isFilteringMessageBeforePublishing() { * @return A TopicInfo object that represents the updated topic. */ public TopicInfo setAnonymousAccessible(Boolean anonymousAccessible) { - getModel().setIsAnonymousAcessible(anonymousAccessible); + getModel().setIsAnonymousAccessible(anonymousAccessible); return this; } @@ -255,7 +255,7 @@ public TopicInfo setAnonymousAccessible(Boolean anonymousAccessible) { * @return true if is anonymous accessible, otherwise false. */ public Boolean isAnonymousAccessible() { - return getModel().isIsAnonymousAcessible(); + return getModel().isIsAnonymousAccessible(); } /** diff --git a/microsoft-azure-api/src/main/resources/schemas.microsoft.com.netservices.2010.10.servicebus.connect.xsd b/microsoft-azure-api/src/main/resources/schemas.microsoft.com.netservices.2010.10.servicebus.connect.xsd index ff5f9bb9359a..2c8d69df7be6 100644 --- a/microsoft-azure-api/src/main/resources/schemas.microsoft.com.netservices.2010.10.servicebus.connect.xsd +++ b/microsoft-azure-api/src/main/resources/schemas.microsoft.com.netservices.2010.10.servicebus.connect.xsd @@ -476,7 +476,7 @@ - + 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 a8c20cce470f..221a358acedc 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 @@ -35,6 +35,7 @@ import com.microsoft.windowsazure.services.core.ServiceFilter.Response; import com.microsoft.windowsazure.services.serviceBus.implementation.CorrelationFilter; import com.microsoft.windowsazure.services.serviceBus.implementation.EmptyRuleAction; +import com.microsoft.windowsazure.services.serviceBus.implementation.EntityStatus; import com.microsoft.windowsazure.services.serviceBus.implementation.FalseFilter; import com.microsoft.windowsazure.services.serviceBus.implementation.SqlFilter; import com.microsoft.windowsazure.services.serviceBus.implementation.SqlRuleAction; @@ -106,6 +107,10 @@ public void createQueueWorks() throws Exception { // Assert assertNotNull(saved); assertNotSame(queue, saved); + assertEquals(false, saved.isDeadLetteringOnMessageExpiration()); + assertEquals(false, saved.isAnonymousAccessible()); + assertNotNull(saved.getAutoDeleteOnIdle()); + assertEquals(true, saved.isSupportOrdering()); assertEquals("TestCreateQueueWorks", saved.getPath()); } @@ -382,6 +387,25 @@ public void topicCanBeCreatedListedFetchedAndDeleted() throws ServiceException { assertEquals(listed.getItems().size() - 1, listed2.getItems().size()); } + @Test + public void topicCreatedContainsMetadata() throws ServiceException { + // Arrange + String topicName = "TestTopicCreatedContainsMetadata"; + + // Act + TopicInfo createdTopicInfo = service.createTopic(new TopicInfo().setPath(topicName)).getValue(); + + // Assert + assertNotNull(createdTopicInfo); + assertNotNull(createdTopicInfo.getAutoDeleteOnIdle()); + assertEquals(false, createdTopicInfo.isRequiresDuplicateDetection()); + assertEquals(false, createdTopicInfo.isFilteringMessageBeforePublishing()); + assertEquals(EntityStatus.ACTIVE, createdTopicInfo.getStatus()); + assertEquals(true, createdTopicInfo.isSupportOrdering()); + assertEquals(false, createdTopicInfo.isAnonymousAccessible()); + + } + @Test public void topicCanBeUpdated() throws ServiceException { // Arrange @@ -437,6 +461,12 @@ public void subscriptionsCanBeCreatedOnTopics() throws Exception { // Assert assertNotNull(created); assertEquals("MySubscription", created.getName()); + assertEquals(false, created.isRequiresSession()); + assertEquals(true, created.isDeadLetteringOnFilterEvaluationExceptions()); + assertNotNull(created.getCreatedAt()); + assertNotNull(created.getUpdatedAt()); + assertNotNull(created.getAccessedAt()); + assertNotNull(created.getAutoDeleteOnIdle()); } @Test