Package core.apiCore.interfaces
Class ServiceBus_depricated
- java.lang.Object
-
- core.apiCore.interfaces.ServiceBus_depricated
-
public class ServiceBus_depricated extends Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classServiceBus_depricated.SBEnv
-
Field Summary
Fields Modifier and Type Field Description static StringMESSAGE_ID_PREFIXstatic Map<com.microsoft.azure.servicebus.IMessage,Boolean>outboundMessagesstatic Map<String,core.apiCore.interfaces.ServiceBus_depricated.serviceBus>sbInstance
-
Constructor Summary
Constructors Constructor Description ServiceBus_depricated()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidaddMessages(String hostSelector, Collection<com.microsoft.azure.servicebus.IMessage> msgFromOutboundQueue)add message from outbound to message list, including the time of adding the message boolean value added indicating the message is available to be verifiedstatic booleancompareExpected(String outboundQueueMsg, String expStr)compares outbound queue message to expected messagestatic booleancompareNotExpected(String outboundQueueMsg, String notExpStr)static StringcomparePartialExpected(String outboundQueueMsg, com.microsoft.azure.servicebus.IMessage msgFromOutboundQueue, com.microsoft.azure.servicebus.IMessageReceiver receiver, String partialExpStr)compares outbound queue message to partially expected messagestatic CopyOnWriteArrayList<com.microsoft.azure.servicebus.IMessage>FilterBasedOnIdentifierInExpectedMessages(String hostSelector, String key, String partialExpStr)find the identifier value in the expected messages eg.static Collection<com.microsoft.azure.servicebus.IMessage>filterOUtboundMessage(String hostSelector, String requestBody, String partialExpStr, Collection<com.microsoft.azure.servicebus.IMessage> msgFromOutboundQueue, String msgId)filter outbound messages based on messageId, order number or useId/bu if message comes from service bus And has request body, Then match message id if not from service bus, try to match either order number or login id/bustatic CopyOnWriteArrayList<com.microsoft.azure.servicebus.IMessage>findMessages(String hostSelector, String requestIdentifier)static CopyOnWriteArrayList<com.microsoft.azure.servicebus.IMessage>findMessagesNotContaining(String hostSelector, String requestIdentifier)finds message in outbound that do not contain the specified identifier matching is done with lower casestatic StringgenerateMessageId(String requestBody)generate message id if the request body is setstatic intgetExpectedMessageCount(String partialExpStr)static core.apiCore.interfaces.ServiceBus_depricated.serviceBusgetInstance(String host)getting an instance of service bus retrying And catching interrupt exceptions from other threadsstatic Collection<com.microsoft.azure.servicebus.IMessage>getOutboundMessages(com.microsoft.azure.servicebus.IMessageReceiver receiver)gets message from outbound queuestatic com.microsoft.azure.servicebus.IMessageReceivergetReceiver(core.apiCore.interfaces.ServiceBus_depricated.serviceBus serviceBus, String hostSelector)format: host: Host1 gets the receiver based on the host from hashmapstatic StringgetRequestBodyFromTemplate(String requestBody, String templateFile, String contentType)gets the request body from the template filestatic booleanisEmptyResultsExpectedAndVerified(Collection<com.microsoft.azure.servicebus.IMessage> filteredMessages, String partialExpStr)returns true ifstatic booleanisFromCurrentTest(String outboundQueueMsg)static booleanisNoResponseExpected(String outputParams, String partialExpStr)static booleanisNoResponseExpected(String outboundQueueMsg, String outputParams, String partialExpStr)static booleanisNumeric(String str)returns true if string is an intstatic booleanisPartialExpect(String partialExpStr, boolean isPartialExpStr)static longlogPerInterval(int interval, StopWatchHelper watch, long lastLogged)static booleannoCheckNeeded(String expStrContent)Returns true if content is empty or contains the noCheckNeeded tokenstatic voidpurgeOutboundQueues()Purge by type.static voidpurgeQueues()Disabled, due to parallelization optimization.static booleanreceiveAndVerifyOutboundMessage(core.apiCore.interfaces.ServiceBus_depricated.serviceBus serviceBus, String msgId, String options, String requestBody, String outputParams, String partialExpStr)static voidsendMessage(core.apiCore.interfaces.ServiceBus_depricated.serviceBus serviceBus, com.microsoft.azure.servicebus.IMessage msgToInboundQueue)sends message to inbound queuestatic voidsendMessage(String requestBody, core.apiCore.interfaces.ServiceBus_depricated.serviceBus serviceBus, String msgID)sends message through service busstatic voidtestServiceBus(ServiceObject apiObject)Inject message to inbound queue And dequeues from outbound queue And do comparisons
-
-
-
Field Detail
-
MESSAGE_ID_PREFIX
public static final String MESSAGE_ID_PREFIX
- See Also:
- Constant Field Values
-
sbInstance
public static Map<String,core.apiCore.interfaces.ServiceBus_depricated.serviceBus> sbInstance
-
-
Method Detail
-
getInstance
public static core.apiCore.interfaces.ServiceBus_depricated.serviceBus getInstance(String host)
getting an instance of service bus retrying And catching interrupt exceptions from other threads- Parameters:
DriverTypes-- Returns:
-
testServiceBus
public static void testServiceBus(ServiceObject apiObject)
Inject message to inbound queue And dequeues from outbound queue And do comparisons- Parameters:
DriverTypes-contentType-attachmentReady-hostSelector-templateFile-requestBody-expStr-outputParams-partialExpStr-notExpStr-
-
generateMessageId
public static String generateMessageId(String requestBody)
generate message id if the request body is set- Parameters:
requestBody-- Returns:
-
sendMessage
public static void sendMessage(String requestBody, core.apiCore.interfaces.ServiceBus_depricated.serviceBus serviceBus, String msgID)
sends message through service bus- Parameters:
requestBody-serviceBus-
-
getRequestBodyFromTemplate
public static String getRequestBodyFromTemplate(String requestBody, String templateFile, String contentType)
gets the request body from the template file- Parameters:
requestBody-templateFile-contentType-- Returns:
-
getReceiver
public static com.microsoft.azure.servicebus.IMessageReceiver getReceiver(core.apiCore.interfaces.ServiceBus_depricated.serviceBus serviceBus, String hostSelector)format: host: Host1 gets the receiver based on the host from hashmap- Parameters:
serviceBus-options-
-
receiveAndVerifyOutboundMessage
public static boolean receiveAndVerifyOutboundMessage(core.apiCore.interfaces.ServiceBus_depricated.serviceBus serviceBus, String msgId, String options, String requestBody, String outputParams, String partialExpStr)
-
getExpectedMessageCount
public static int getExpectedMessageCount(String partialExpStr)
-
logPerInterval
public static long logPerInterval(int interval, StopWatchHelper watch, long lastLogged)
-
isEmptyResultsExpectedAndVerified
public static boolean isEmptyResultsExpectedAndVerified(Collection<com.microsoft.azure.servicebus.IMessage> filteredMessages, String partialExpStr)
returns true if- Parameters:
filteredMessages-expStr-partialExpStr-notExpStr-- Returns:
-
isNoResponseExpected
public static boolean isNoResponseExpected(String outboundQueueMsg, String outputParams, String partialExpStr)
-
isNoResponseExpected
public static boolean isNoResponseExpected(String outputParams, String partialExpStr)
-
noCheckNeeded
public static boolean noCheckNeeded(String expStrContent)
Returns true if content is empty or contains the noCheckNeeded token- Parameters:
expStrContent-- Returns:
- boolean
-
filterOUtboundMessage
public static Collection<com.microsoft.azure.servicebus.IMessage> filterOUtboundMessage(String hostSelector, String requestBody, String partialExpStr, Collection<com.microsoft.azure.servicebus.IMessage> msgFromOutboundQueue, String msgId)
filter outbound messages based on messageId, order number or useId/bu if message comes from service bus And has request body, Then match message id if not from service bus, try to match either order number or login id/bu- Parameters:
requestBody-expStr-partialExpStr-notExpStr-msgFromOutboundQueue-msgId-- Returns:
-
addMessages
public static void addMessages(String hostSelector, Collection<com.microsoft.azure.servicebus.IMessage> msgFromOutboundQueue)
add message from outbound to message list, including the time of adding the message boolean value added indicating the message is available to be verified- Parameters:
msgFromOutboundQueue-
-
FilterBasedOnIdentifierInExpectedMessages
public static CopyOnWriteArrayList<com.microsoft.azure.servicebus.IMessage> FilterBasedOnIdentifierInExpectedMessages(String hostSelector, String key, String partialExpStr)
find the identifier value in the expected messages eg. key = OrderNumber, will return the order number value if exists in the expected messages the key value is used to identify the outbound message- Parameters:
key-expStr-partialExpStr-notExpStr-- Returns:
-
findMessages
public static CopyOnWriteArrayList<com.microsoft.azure.servicebus.IMessage> findMessages(String hostSelector, String requestIdentifier)
-
findMessagesNotContaining
public static CopyOnWriteArrayList<com.microsoft.azure.servicebus.IMessage> findMessagesNotContaining(String hostSelector, String requestIdentifier)
finds message in outbound that do not contain the specified identifier matching is done with lower case- Parameters:
requestIdentifier-- Returns:
-
isNumeric
public static boolean isNumeric(String str)
returns true if string is an int- Parameters:
str-- Returns:
-
isFromCurrentTest
public static boolean isFromCurrentTest(String outboundQueueMsg)
-
sendMessage
public static void sendMessage(core.apiCore.interfaces.ServiceBus_depricated.serviceBus serviceBus, com.microsoft.azure.servicebus.IMessage msgToInboundQueue)sends message to inbound queue- Parameters:
serviceBus-msgToInboundQueue-
-
getOutboundMessages
public static Collection<com.microsoft.azure.servicebus.IMessage> getOutboundMessages(com.microsoft.azure.servicebus.IMessageReceiver receiver)
gets message from outbound queue- Parameters:
receiver-- Returns:
-
compareExpected
public static boolean compareExpected(String outboundQueueMsg, String expStr)
compares outbound queue message to expected message- Parameters:
outboundQueueMsg-expStr-- Returns:
-
isPartialExpect
public static boolean isPartialExpect(String partialExpStr, boolean isPartialExpStr)
-
comparePartialExpected
public static String comparePartialExpected(String outboundQueueMsg, com.microsoft.azure.servicebus.IMessage msgFromOutboundQueue, com.microsoft.azure.servicebus.IMessageReceiver receiver, String partialExpStr)
compares outbound queue message to partially expected message- Parameters:
outboundQueueMsg-msgFromOutboundQueue-receiver-outputParams-partialExpStr-- Returns:
-
compareNotExpected
public static boolean compareNotExpected(String outboundQueueMsg, String notExpStr)
-
purgeQueues
public static void purgeQueues()
Disabled, due to parallelization optimization. we cannot have purges in middle of test runs
-
purgeOutboundQueues
public static void purgeOutboundQueues()
Purge by type. eg. DEFAULT
-
-