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..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 @@ -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; @@ -56,9 +56,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 +66,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 +77,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 +93,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 +106,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 +123,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 +135,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 +187,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 +197,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 +208,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 +218,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,24 +228,43 @@ 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; + /** + * 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. + * @throws 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. * * @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; @@ -274,9 +273,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; @@ -285,11 +283,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; @@ -297,14 +293,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. * @@ -312,11 +328,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; @@ -326,12 +340,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; @@ -342,12 +354,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; @@ -356,17 +366,42 @@ 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; + /** + * 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. + * + * @throws ServiceException + * the service exception + */ 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. + * @throws ServiceException + * If a service exception is encountered. + */ + SubscriptionInfo updateSubscription(String topicName, SubscriptionInfo subscriptionInfo) throws ServiceException; + /** * Creates a rule. * @@ -377,11 +412,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; @@ -395,9 +428,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; @@ -411,11 +443,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; @@ -427,14 +457,57 @@ 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; + /** + * 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 the list rules result + * @throws ServiceException + * If a service exception is encountered. + */ ListRulesResult listRules(String topicPath, String subscriptionName, ListRulesOptions options) 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; + + /** + * 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 567ae5cedd0b..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 @@ -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 { @@ -290,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 { @@ -343,6 +369,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 { @@ -489,4 +529,31 @@ public ReceiveMessageResult receiveMessage(String path, ReceiveMessageOptions op } } + @Override + public void renewQueueLock(String queueName, String messageId, String lockToken) throws ServiceException { + try { + next.renewQueueLock(queueName, messageId, lockToken); + } + catch (UniformInterfaceException e) { + throw processCatch(new ServiceException(e)); + } + catch (ClientHandlerException e) { + throw processCatch(new ServiceException(e)); + } + } + + @Override + public void renewSubscriptionLock(String topicName, String subscriptionName, String messageId, String lockToken) + throws ServiceException { + try { + next.renewSubscriptionLock(topicName, 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 633c98336292..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 @@ -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; @@ -109,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)); } @@ -293,6 +294,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()); @@ -331,6 +338,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") @@ -361,6 +374,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) @@ -414,4 +435,19 @@ public ListRulesResult listRules(String topicName, String subscriptionName) thro return listRules(topicName, subscriptionName, ListRulesOptions.DEFAULT); } + @Override + public void renewQueueLock(String queueName, String messageId, String lockToken) throws ServiceException { + ClientResponse clientResponse = getResource().path(queueName).path("messages").path(messageId).path(lockToken) + .post(ClientResponse.class, ""); + PipelineHelpers.ThrowIfNotSuccess(clientResponse); + } + + @Override + public void renewSubscriptionLock(String topicName, String subscriptionName, String messageId, String lockToken) + throws ServiceException { + 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/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..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 @@ -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.PartitioningPolicy; import com.microsoft.windowsazure.services.serviceBus.implementation.QueueDescription; /** @@ -28,7 +33,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()); @@ -38,7 +43,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. @@ -48,7 +53,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. @@ -73,7 +78,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); @@ -95,7 +100,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); @@ -117,7 +122,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); @@ -139,7 +144,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); @@ -161,7 +166,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); @@ -184,13 +189,34 @@ 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(); + } + + /** + * 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; + } + /** * Indicates whether dead lettering is in effect upon message expiration. * @@ -206,7 +232,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); @@ -231,7 +257,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); @@ -241,7 +267,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(); @@ -253,7 +279,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); @@ -275,7 +301,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); @@ -285,19 +311,231 @@ 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(); } + /** + * Sets the size in bytes. + * + * @param sizeInBytes + * the size in bytes + * @return A QueueInfo object that represents the updated queue. + */ + public QueueInfo setSizeInBytes(Long sizeInBytes) { + getModel().setSizeInBytes(sizeInBytes); + return this; + } + /** * 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(); } + /** + * Sets the message count. + * + * @param messageCount + * the message count + * @return A QueueInfo object that represents the updated queue. + */ + public QueueInfo setMessageCount(Long messageCount) { + getModel().setMessageCount(messageCount); + return this; + } + + /** + * Checks if is anonymous accessible. + * + * @return true if the queue can be accessed anonymously. Otherwise, false. + */ + public Boolean isAnonymousAccessible() { + return getModel().isIsAnonymousAccessible(); + } + + /** + * Sets the is anonymous accessible. + * + * @param isAnonymousAccessible + * the is anonymous accessible + * @return A QueueInfo object that represents the updated queue. + */ + public QueueInfo setIsAnonymousAccessible(Boolean isAnonymousAccessible) { + getModel().setIsAnonymousAccessible(isAnonymousAccessible); + return this; + } + + /** + * Checks if is support ordering. + * + * @return true if ordering is supported, otherwise, false. + */ + public Boolean isSupportOrdering() { + return getModel().isSupportOrdering(); + } + + /** + * Sets the support ordering. + * + * @param supportOrdering + * 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); + return this; + } + + /** + * Gets the status. + * + * @return A EntityStatus object. + */ + public EntityStatus getStatus() { + return getModel().getStatus(); + } + + /** + * Sets the status. + * + * @param entityStatus + * the entity status + * @return A QueueInfo object that represents the updated queue. + */ + public QueueInfo setStatus(EntityStatus entityStatus) { + getModel().setStatus(entityStatus); + return this; + } + + /** + * Gets the entity availability status. + * + * @return A EntityAvailabilityStatus object which represents the availability status of the entity. + */ + public EntityAvailabilityStatus getEntityAvailabilityStatus() { + return getModel().getEntityAvailabilityStatus(); + } + + /** + * Sets the entity availability status. + * + * @param entityAvailabilityStatus + * A EntityAvailabilityStatus object. + * @return A QueueInfo object that represents the updated queue. + */ + public QueueInfo setEntityAvailabilityStatus(EntityAvailabilityStatus entityAvailabilityStatus) { + getModel().setEntityAvailabilityStatus(entityAvailabilityStatus); + return this; + } + + /** + * Gets the created at. + * + * @return A Calendar object which represents the time of the queue created at. + */ + public Calendar getCreatedAt() { + return getModel().getCreatedAt(); + } + + /** + * Sets the created at. + * + * @param createdAt + * 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); + return this; + } + + /** + * Gets the updated at. + * + * @return A Calendar object which represents the time that the queue was updated at. + */ + public Calendar getUpdatedAt() { + return getModel().getUpdatedAt(); + } + + /** + * Sets the updated at. + * + * @param updatedAt + * 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); + return this; + } + + /** + * Gets the accessed at. + * + * @return A Calendar object which represents the time that the queue was accessed at. + */ + public Calendar getAccessedAt() { + return getModel().getAccessedAt(); + } + + /** + * Sets the accessed at. + * + * @param accessedAt + * 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); + return this; + } + + /** + * Gets the partitioning policy. + * + * @return A PartitioningPolicy represents the partitioning policy. + */ + public PartitioningPolicy getPartitioningPolicy() { + return getModel().getPartitioningPolicy(); + } + + /** + * Sets the partitioning policy. + * + * @param partitioningPolicy + * A PartitioningPolicy represents the partitioning policy. + * @return A QueueInfo object that represents the updated queue. + */ + public QueueInfo setPartitioningPolicy(PartitioningPolicy partitioningPolicy) { + getModel().setPartitioningPolicy(partitioningPolicy); + return this; + } + + /** + * Gets the user metadata. + * + * @return A String objects which contains the user metadata. + */ + public String getUserMetadata() { + return getModel().getUserMetadata(); + } + + /** + * Sets the user metadata. + * + * @param userMetadata + * 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); + return this; + } } 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..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 @@ -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; @@ -35,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()); @@ -45,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. @@ -56,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. @@ -82,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); @@ -104,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); @@ -126,19 +128,33 @@ 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); return this; } + /** + * With correlation id filter. + * + * @param correlationId + * the correlation id + * @return A RuleInfo object that represents the updated rule. + */ 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 A RuleInfo object that represents the updated rule. + */ public RuleInfo withSqlExpressionFilter(String sqlExpression) { SqlFilter filter = new SqlFilter(); filter.setSqlExpression(sqlExpression); @@ -146,6 +162,11 @@ public RuleInfo withSqlExpressionFilter(String sqlExpression) { return setFilter(filter); } + /** + * With true filter. + * + * @return A RuleInfo object that represents the updated rule. + */ public RuleInfo withTrueFilter() { TrueFilter filter = new TrueFilter(); filter.setCompatibilityLevel(20); @@ -153,6 +174,11 @@ public RuleInfo withTrueFilter() { return setFilter(filter); } + /** + * With false filter. + * + * @return A RuleInfo object that represents the updated rule. + */ public RuleInfo withFalseFilter() { FalseFilter filter = new FalseFilter(); filter.setCompatibilityLevel(20); @@ -160,15 +186,69 @@ public RuleInfo withFalseFilter() { return setFilter(filter); } + /** + * With empty rule action. + * + * @return A RuleInfo object that represents the updated rule. + */ public RuleInfo withEmptyRuleAction() { EmptyRuleAction action = new EmptyRuleAction(); return setAction(action); } + /** + * With sql rule action. + * + * @param sqlExpression + * 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(); action.setSqlExpression(sqlExpression); action.setCompatibilityLevel(20); return setAction(action); } + + /** + * Sets the tag. + * + * @param tag + * A String instance representing the tag. + * @return A RuleInfo object that represents the updated rule. + */ + public RuleInfo setTag(String tag) { + getModel().setTag(tag); + return this; + } + + /** + * Gets the tag. + * + * @return A String instance representing the tag. + */ + public String getTag() { + return getModel().getTag(); + } + + /** + * Sets the created at. + * + * @param createdAt + * 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); + return this; + } + + /** + * Gets 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 fd65bedd66b7..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 @@ -2,22 +2,26 @@ * Copyright Microsoft Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * http://www.apache.org/licenses/LICENSE-2.0 + * 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.RuleDescription; @@ -29,7 +33,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()); @@ -39,7 +43,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. @@ -49,7 +53,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. @@ -74,7 +78,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); @@ -96,7 +100,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); @@ -118,7 +122,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); @@ -141,7 +145,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); @@ -163,7 +167,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); @@ -185,7 +189,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); @@ -207,7 +211,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); @@ -217,7 +221,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(); @@ -226,7 +230,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(); @@ -236,9 +240,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); @@ -260,10 +264,170 @@ 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); return this; } + + /** + * Sets the message count. + * + * @param messageCount + * A Long object represents the message count. + * @return A SubscriptionInfo object that represents the updated subscription. + */ + public SubscriptionInfo setMessageCount(Long messageCount) { + getModel().setMessageCount(messageCount); + return this; + } + + /** + * Sets the status. + * + * @param entityStatus + * 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); + return this; + } + + /** + * Gets the status. + * + * @return A EntityStatus object represents the status of the entity. + */ + public EntityStatus getStatus() { + return getModel().getStatus(); + } + + /** + * Sets the created at. + * + * @param createdAt + * the created at + * @return A SubscriptionInfo object that represents the updated subscription. + */ + 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 A SubscriptionInfo object that represents the updated subscription. + */ + 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 A SubscriptionInfo object that represents the updated subscription. + */ + 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 A SubscriptionInfo object that represents the updated subscription. + */ + 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 auto delete on idle. + * + * @param autoDeleteOnIdle + * 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); + return this; + } + + /** + * Gets the auto delete on idle. + * + * @return A Duration object represents the auto delete on idle. + */ + public Duration getAutoDeleteOnIdle() { + return getModel().getAutoDeleteOnIdle(); + } + + /** + * Sets the entity availability status. + * + * @param entityAvailabilityStatus + * 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); + return this; + } + + /** + * Gets 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 d53474146682..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 @@ -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.PartitioningPolicy; import com.microsoft.windowsazure.services.serviceBus.implementation.TopicDescription; /** @@ -27,7 +32,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()); @@ -37,7 +42,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. @@ -47,7 +52,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. @@ -72,7 +77,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); @@ -94,7 +99,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); @@ -116,7 +121,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); @@ -138,7 +143,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); @@ -161,7 +166,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); @@ -183,7 +188,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); @@ -199,4 +204,267 @@ public Long getSizeInBytes() { return getModel().getSizeInBytes(); } + /** + * Sets the size in bytes. + * + * @param sizeInBytes + * 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); + return this; + } + + /** + * Sets the filtering message before publishing. + * + * @param filteringMessageBeforePublishing + * 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); + return this; + } + + /** + * Checks if is filtering message before publishing. + * + * @return true if filter message before publishing, otherwise false. + */ + public Boolean isFilteringMessageBeforePublishing() { + return getModel().isFilteringMessagesBeforePublishing(); + } + + /** + * Sets the anonymous accessible. + * + * @param anonymousAccessible + * true if is anonymous accessible, otherwise false. + * @return A TopicInfo object that represents the updated topic. + */ + public TopicInfo setAnonymousAccessible(Boolean anonymousAccessible) { + getModel().setIsAnonymousAccessible(anonymousAccessible); + return this; + } + + /** + * Checks if is anonymous accessible. + * + * @return true if is anonymous accessible, otherwise false. + */ + public Boolean isAnonymousAccessible() { + return getModel().isIsAnonymousAccessible(); + } + + /** + * Sets the status. + * + * @param status + * the status + * @return A TopicInfo object that represents the updated topic. + */ + public TopicInfo setStatus(EntityStatus status) { + getModel().setStatus(status); + return this; + } + + /** + * Gets the status. + * + * @return An EntityStatus object that represents the status of the object. + */ + public EntityStatus getStatus() { + return getModel().getStatus(); + } + + /** + * Sets the created at. + * + * @param createdAt + * the created at + * @return A TopicInfo object that represents the updated topic. + */ + public TopicInfo setCreatedAt(Calendar createdAt) { + getModel().setCreatedAt(createdAt); + return this; + } + + /** + * Gets the created at. + * + * @return A Calendar object which represents when the topic was created. + */ + public Calendar getCreatedAt() { + return getModel().getCreatedAt(); + } + + /** + * Sets the updated at. + * + * @param updatedAt + * 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); + return this; + } + + /** + * Gets the updated at. + * + * @return A Calendar object which represents when the topic was updated. + */ + public Calendar getUpdatedAt() { + return getModel().getUpdatedAt(); + } + + /** + * Sets the accessed at. + * + * @param accessedAt + * 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); + return this; + } + + /** + * Gets the accessed at. + * + * @return A Calendar instance representing when topic was last accessed at. + */ + public Calendar getAccessedAt() { + return getModel().getAccessedAt(); + } + + /** + * Sets the user metadata. + * + * @param userMetadata + * A String represents the user metadata. + * @return A TopicInfo object that represents the updated topic. + */ + public TopicInfo setUserMetadata(String userMetadata) { + getModel().setUserMetadata(userMetadata); + return this; + } + + /** + * Gets the user metadata. + * + * @return A String represents the user metadata. + */ + public String getUserMetadata() { + return getModel().getUserMetadata(); + } + + /** + * Sets the support ordering. + * + * @param supportOrdering + * true if supports ordering, otherwise false. + * @return A TopicInfo object that represents the updated topic. + */ + public TopicInfo setSupportOrdering(Boolean supportOrdering) { + getModel().setSupportOrdering(supportOrdering); + return this; + } + + /** + * Checks if is support ordering. + * + * @return true if supports ordering, otherwise false. + */ + public Boolean isSupportOrdering() { + return getModel().isSupportOrdering(); + } + + /** + * Sets the subscription count. + * + * @param subscriptionCount + * The count of the subscription. + * @return A TopicInfo object that represents the updated topic. + */ + public TopicInfo setSubscriptionCount(Integer subscriptionCount) { + getModel().setSubscriptionCount(subscriptionCount); + return this; + } + + /** + * Gets the subscription count. + * + * @return the count of the subscription. + */ + public Integer getSubscriptionCount() { + return getModel().getSubscriptionCount(); + } + + /** + * Sets the auto delete on idle. + * + * @param autoDeleteOnIdle + * 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); + return this; + } + + /** + * Gets 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(); + } + + /** + * Sets the partitioning policy. + * + * @param partitioningPolicy + * 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); + return this; + } + + /** + * Gets the partitioning policy. + * + * @return A PartitioningPolicy object which represents the partitioning policy. + */ + public PartitioningPolicy getPartitioningPolicy() { + return getModel().getPartitioningPolicy(); + } + + /** + * Sets the entity availability status. + * + * @param entityAvailabilityStatus + * 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); + return this; + } + + /** + * Gets the entity availability status. + * + * @return An EntityAvailabilityStatus instance which represents the entity availability status. + */ + 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 31d324b76fbe..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 @@ -3,17 +3,19 @@ xmlns:ser="http://schemas.microsoft.com/2003/10/Serialization/" xmlns:tns="http://schemas.microsoft.com/netservices/2010/10/servicebus/connect" elementFormDefault="qualified" + attributeFormDefault="qualified" targetNamespace="http://schemas.microsoft.com/netservices/2010/10/servicebus/connect" - xmlns:xs="http://www.w3.org/2001/XMLSchema" - + xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" - jaxb:version="1.0" + version="0.2" + jaxb:version="2.0" xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc" jaxb:extensionBindingPrefixes="xjc"> + @@ -99,6 +101,76 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -167,6 +239,55 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -186,6 +307,27 @@ + + + + + + + + + + + + + + + + + + + + + @@ -220,6 +362,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -297,7 +469,91 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - \ No newline at end of file + 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 a4b414600ab8..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,9 +107,27 @@ 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()); } + @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 @@ -173,6 +192,39 @@ public void receiveMessageWorks() throws Exception { assertArrayEquals("Hello World".getBytes(), Arrays.copyOf(data, size)); } + @Test + public void renewSubscriptionMessageLockWorks() throws Exception { + // Arrange + 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.renewQueueLock(queueName, message.getMessageId(), message.getLockToken()); + + // Assert + assertNotNull(message); + } + @Test public void receiveMessageEmptyQueueWorks() throws Exception { // Arrange @@ -335,6 +387,41 @@ 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 + 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 @@ -374,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 @@ -447,6 +540,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 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 new file mode 100644 index 000000000000..dff449d9a6d7 --- /dev/null +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/serviceBus/models/QueueInfoTest.java @@ -0,0 +1,330 @@ +/** + * 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.EntityAvailabilityStatus; +import com.microsoft.windowsazure.services.serviceBus.implementation.EntityStatus; +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 = createDuration(100); + QueueInfo queueInfo = new QueueInfo(); + + // Act + Duration actualLockDuration = queueInfo.setLockDuration(expectedLockDuration).getLockDuration(); + + // Assert + 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 = createDuration(100); + 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 = createDuration(100); + 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.setMessageCount(expectedMessageCount).getMessageCount(); + + // Assert + assertEquals(expectedMessageCount, actualMessageCount); + } + + @Test + public void testGetSetIsAnonymousAccessible() { + // Arrange + Boolean expectedIsAnonymousAccessible = true; + QueueInfo queueInfo = new QueueInfo(); + + // Act + Boolean actualIsAnonymousAccessible = queueInfo.setIsAnonymousAccessible(expectedIsAnonymousAccessible) + .isAnonymousAccessible(); + + // Assert + assertEquals(expectedIsAnonymousAccessible, actualIsAnonymousAccessible); + } + + @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 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 + String expectedUserMetadata = "expectedUserMetaData"; + QueueInfo queueInfo = new QueueInfo(); + + // Act + String actualUserMetadata = queueInfo.setUserMetadata(expectedUserMetadata).getUserMetadata(); + + // Assert + assertEquals(expectedUserMetadata, actualUserMetadata); + } + + @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 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); + } + +} 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..c981cfa1c271 --- /dev/null +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/serviceBus/models/SubscriptionInfoTest.java @@ -0,0 +1,263 @@ +/** + * 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.EntityAvailabilityStatus; +import com.microsoft.windowsazure.services.serviceBus.implementation.EntityStatus; +import com.microsoft.windowsazure.services.serviceBus.implementation.RuleDescription; + +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 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 testGetSetDeadLetteringOnFilterEvaluationExceptions() { + // Arrange + Boolean expectedDeadLetteringOnFilterEvaluationExceptions = true; + SubscriptionInfo SubscriptionInfo = new SubscriptionInfo(); + + // Act + Boolean actualDeadLetteringOnFilterEvaluationExceptions = SubscriptionInfo + .setDeadLetteringOnFilterEvaluationExceptions(expectedDeadLetteringOnFilterEvaluationExceptions) + .isDeadLetteringOnFilterEvaluationExceptions(); + + // Assert + assertEquals(expectedDeadLetteringOnFilterEvaluationExceptions, actualDeadLetteringOnFilterEvaluationExceptions); + } + + @Test + public void testGetSetDefaultRuleDescription() { + // Arrange + RuleDescription expectedDefaultRuleDescription = new RuleDescription(); + SubscriptionInfo SubscriptionInfo = new SubscriptionInfo(); + + // Act + RuleDescription actualDefaultRuleDescription = SubscriptionInfo.setDefaultRuleDescription( + expectedDefaultRuleDescription).getDefaultRuleDescription(); + + // Assert + assertEquals(expectedDefaultRuleDescription, actualDefaultRuleDescription); + } + + @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 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 testGetSetStatus() { + // Arrange + EntityStatus expectedEntityStatus = EntityStatus.ACTIVE; + SubscriptionInfo SubscriptionInfo = new SubscriptionInfo(); + + // Act + EntityStatus actualEntityStatus = SubscriptionInfo.setStatus(expectedEntityStatus).getStatus(); + + // Assert + assertEquals(expectedEntityStatus, actualEntityStatus); + } + + @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 testGetSetAutoDeleteOnIdle() { + // Arrange + Duration expectedIsAutoDeleteOnIdle = createDuration(100); + SubscriptionInfo SubscriptionInfo = new SubscriptionInfo(); + + // Act + Duration actualIsAutoDeleteOnIdle = SubscriptionInfo.setAutoDeleteOnIdle(expectedIsAutoDeleteOnIdle) + .getAutoDeleteOnIdle(); + + // Assert + assertEquals(expectedIsAutoDeleteOnIdle, actualIsAutoDeleteOnIdle); + } + + @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..9c7e8e4d8ed0 --- /dev/null +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/serviceBus/models/TopicInfoTest.java @@ -0,0 +1,292 @@ +/** + * 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.EntityAvailabilityStatus; +import com.microsoft.windowsazure.services.serviceBus.implementation.EntityStatus; +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 testGetSetDefaultMessageTimeToLive() { + // Arrange + Duration expectedDefaultMessageTimeToLive = createDuration(1024); + TopicInfo topicInfo = new TopicInfo(); + + // Act + Duration actualDefaultMessageTimeToLive = topicInfo.setDefaultMessageTimeToLive( + expectedDefaultMessageTimeToLive).getDefaultMessageTimeToLive(); + + // Assert + assertEquals(expectedDefaultMessageTimeToLive, actualDefaultMessageTimeToLive); + + } + + @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 testGetSetDuplicateDetectionHistoryTimeWindow() { + // Arrange + Duration expectedDefaultMessageTimeToLive = createDuration(100); + TopicInfo topicInfo = new TopicInfo(); + + // Act + Duration actualDefaultMessageTimeToLive = topicInfo.setDefaultMessageTimeToLive( + expectedDefaultMessageTimeToLive).getDefaultMessageTimeToLive(); + + // Assert + assertEquals(expectedDefaultMessageTimeToLive, actualDefaultMessageTimeToLive); + } + + @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 testGetSetFilteringMessageBeforePublishing() { + // Arrange + Boolean expectedFilteringMessageBeforePublishing = true; + TopicInfo topicInfo = new TopicInfo(); + + // Act + Boolean actualFilteringMessageBeforePublishing = topicInfo.setFilteringMessageBeforePublishing( + expectedFilteringMessageBeforePublishing).isFilteringMessageBeforePublishing(); + + // Assert + assertEquals(expectedFilteringMessageBeforePublishing, actualFilteringMessageBeforePublishing); + } + + @Test + public void testGetSetAnonymousAccessible() { + // Arrange + Boolean expectedAnonymousAccessible = true; + TopicInfo topicInfo = new TopicInfo(); + + // Act + Boolean actualAnonymousAccessible = topicInfo.setAnonymousAccessible(expectedAnonymousAccessible) + .isAnonymousAccessible(); + + // Assert + assertEquals(expectedAnonymousAccessible, actualAnonymousAccessible); + } + + @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 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 testGetSetSubscriptionCount() { + // Arrange + Integer expectedSubscriptionCount = 1024; + TopicInfo topicInfo = new TopicInfo(); + + // Act + Integer actualSubscriptionCount = topicInfo.setSubscriptionCount(expectedSubscriptionCount) + .getSubscriptionCount(); + + // Assert + assertEquals(expectedSubscriptionCount, actualSubscriptionCount); + } + + @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); + } + +}