ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » IBM MQ API Support » Unit Testing in .net

Post new topic  Reply to topic
 Unit Testing in .net « View previous topic :: View next topic » 
Author Message
ninjaprogrammer
PostPosted: Wed Mar 02, 2011 6:56 am    Post subject: Unit Testing in .net Reply with quote

Novice

Joined: 01 Mar 2011
Posts: 10

Im using the lateest version of XMS (2.0.0.4) and im trying to find some way of clearing the Queue each time i run a unit test. I want to make sure that there is no duff messags on the Queue before i start each test.

Is ther a simple way of doing it or do need to read all the messages off one at a time.

I want to do this using the XMS .net API's not using RfhUTIL or similiar as the test all needto be part of a automated build process.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Wed Mar 02, 2011 7:08 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

You could send a PCF message to clear the queue.
http://publib.boulder.ibm.com/infocenter/wmqv7/v7r0/index.jsp?topic=/com.ibm.mq.csqzac.doc/pc11350_.htm
Back to top
View user's profile Send private message
ninjaprogrammer
PostPosted: Wed Mar 02, 2011 7:27 am    Post subject: Reply with quote

Novice

Joined: 01 Mar 2011
Posts: 10

I had read about these on other pot but unsure how i shouild call them using .net and indeed which namespace i need to include.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Wed Mar 02, 2011 7:33 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

You could also just run a command shell and send CLEAR QLOCAL to runmqsc.

Also, remember, just because you want to run an automated task, doesn't mean you have to use a full programming language to do it. shell scripting can be very useful.
Back to top
View user's profile Send private message
ninjaprogrammer
PostPosted: Wed Mar 02, 2011 8:00 am    Post subject: Reply with quote

Novice

Joined: 01 Mar 2011
Posts: 10

runmqsc is not included as part of the client tools. Is there a similiar version for the client tools.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Wed Mar 02, 2011 8:13 am    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20696
Location: LI,NY

ninjaprogrammer wrote:
runmqsc is not included as part of the client tools. Is there a similiar version for the client tools.

Try support pack MO72 (mqsc).
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
mqjeff
PostPosted: Wed Mar 02, 2011 8:15 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

you didn't mention anything about client install before...

There is a supportPac that provides a client runmqsc.

Regardless, you can use basic MQ .NET methods to write PCF fields into a message, even if the .NET classes do not provide a helper method for the CLEAR command.
Back to top
View user's profile Send private message
ninjaprogrammer
PostPosted: Thu Mar 03, 2011 3:28 am    Post subject: Reply with quote

Novice

Joined: 01 Mar 2011
Posts: 10

mqjeff wrote:

Regardless, you can use basic MQ .NET methods to write PCF fields into a message, even if the .NET classes do not provide a helper method for the CLEAR command.


Cant find any examples on howthis might be done wtht eh wonderfull google have you got any sample code that i can look at. As my limit of MQextends to the Sample code thats provided with the client tools V7.014
Back to top
View user's profile Send private message
mqjeff
PostPosted: Thu Mar 03, 2011 4:53 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

I am confused. I thought you were a ninja programmer? Surely you don't need sample code?

I don't use .NET. I assume it has methods like the java classes do to Write Integers and Write Characters and etc. to the body of the message. You can use those to write the appropriate fields of the PCF message in the appropriate order.

There should be at least C language samples for constructing PCF messages that you can find. It should be a SMOP to turn those into .NET C# code.
Back to top
View user's profile Send private message
RogerLacroix
PostPosted: Fri Mar 04, 2011 12:18 pm    Post subject: Reply with quote

Jedi Knight

Joined: 15 May 2001
Posts: 3253
Location: London, ON Canada

Hi,

I have posted to 2 different sample (complete) programs for clearing / emptying a queue:

1. ClearQ is a sample C MQAI code that will issue the clear queue command.
http://www.capitalware.biz/mq_code_c.html

2. EmptyQ is a simple Java program to clear a queue of its messages.
http://www.capitalware.biz/mq_code_java.html

Why re-invent the wheel. Just download one of these programs and add it as the first item in your test script.


Regards,
Roger Lacroix
Capitalware Inc.
_________________
Capitalware: Transforming tomorrow into today.
Connected to MQ!
Twitter
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ API Support » Unit Testing in .net
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.