MQSeriesHelper.cs

Aug 15, 2007 at 4:34 PM
Hi
I was writing a test case , in which there was a test step to put a message into mq queue.
as per the documentation
<TestStep assemblyPath="" typeName="Microsoft.Services.BizTalkApplicationFramework.BizUnit.MQSeriesPutStep, Microsoft.Services.BizTalkApplicationFramework.BizUnit.MQSeriesSteps">
<QueueManager>QM_server</QueueManager>
<Queue>QueueName</Queue>
<SourcePath>.\TestData\InDoc1.txt</SourcePath>
</TestStep>

now here my question starts ,
What should be the format of the QM_Server ..

to solve this i have modified the source code in the MQSeriesHelper.cs file
I have changed the write method like this

static public void WriteMessage(string queueManagerName, string queueName, string message, byte[] correlId, Context context)
{
MQQueueManager queueManager = null;
MQQueue sendQueue = null;
MQMessage mqMessage;
MQPutMessageOptions mqPutMsgOpts;
// Naushad Alam
char[] cSep = { '/' };
string[] channelInfo;
string sChannelName = string.Empty;
string sQueueManager = string.Empty;
string sConnName = string.Empty;
channelInfo = queueManagerName.Split (cSep);
sQueueManager = channelInfo0;
sChannelName = channelInfo1;
sConnName = channelInfo2;

// Naushad Alam


try
{

context.LogInfo("Opening queue manager: \"{0}\"", queueManagerName);
//queueManager = new MQQueueManager(queueManagerName); // Code commented by Naushad Alam
queueManager = new MQQueueManager(sQueueManager ,sChannelName ,sConnName ); // Code added by Naushad Alam

context.LogInfo("Opening queue: '{0}'.", queueName);
sendQueue = queueManager.AccessQueue(queueName, MQC.MQOOOUTPUT + MQC.MQOOFAILIFQUIESCING );

mqMessage = new MQMessage();
byte[] data = ConvertToBytes(message);
mqMessage.Write(data);
mqMessage.Format = MQC.MQFMT_STRING;
mqPutMsgOpts = new MQPutMessageOptions();

context.LogInfo("Writing {0} byte message to queue '{1}'.", data.Length, queueName);

if (correlId != null)
{
mqMessage.CorrelationId = correlId;
}

sendQueue.Put( mqMessage, mqPutMsgOpts );
}
finally
{
if (sendQueue != null)
{
sendQueue.Close();
}

if (queueManager != null)
{
queueManager.Close();
}
}
}


I wrote the test step like this
<TestStep assemblyPath="c:\Program Files\Microsoft Services\BizUnit 2.2\Src\TestStepLibraries\MQSeriesSteps\bin\Debug\Microsoft.Services.BizTalkApplicationFramework.BizUnit.MQSeriesSteps.dll" typeName="Microsoft.Services.BizTalkApplicationFramework.BizUnit.MQSeriesPutStep">
<QueueManager>VAATBK01/CLIENTS/10.20.4.198</QueueManager>
<Queue>TEST_OUT</Queue>
<SourcePath>..\..\..\..\TestCases\TestCase1\20070809-032251310.txt</SourcePath>
</TestStep>


and it worked for me...

Kevin , will it be fixed in the next release of BizUnit ?