01: /*
02: * JBoss, Home of Professional Open Source.
03: * Copyright 2006, Red Hat Middleware LLC, and individual contributors
04: * as indicated by the @author tags. See the copyright.txt file in the
05: * distribution for a full listing of individual contributors.
06: *
07: * This is free software; you can redistribute it and/or modify it
08: * under the terms of the GNU Lesser General Public License as
09: * published by the Free Software Foundation; either version 2.1 of
10: * the License, or (at your option) any later version.
11: *
12: * This software is distributed in the hope that it will be useful,
13: * but WITHOUT ANY WARRANTY; without even the implied warranty of
14: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15: * Lesser General Public License for more details.
16: *
17: * You should have received a copy of the GNU Lesser General Public
18: * License along with this software; if not, write to the Free
19: * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20: * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21: */
22: package org.jboss.test.messagedriven.support;
23:
24: import java.util.Properties;
25:
26: import javax.management.ObjectName;
27:
28: /**
29: * A simple test
30: *
31: * @author <a href="mailto:adrian@jboss.com>Adrian Brock</a>
32: * @version <tt>$Revision: 1.4</tt>
33: */
34: public abstract class SimpleMessageDrivenUnitTest extends
35: BasicMessageDrivenUnitTest {
36: public SimpleMessageDrivenUnitTest(String name,
37: ObjectName jmxDestination, Properties defaultProps) {
38: super (name, jmxDestination, defaultProps);
39: }
40:
41: public void testSimpleRequired() throws Exception {
42: runTest(getOperations(), defaultProps);
43: }
44:
45: public void testSimpleNotSupported() throws Exception {
46: Properties props = (Properties) defaultProps.clone();
47: props.put("transactionAttribute", "NotSupported");
48: runTest(getOperations(), props);
49: }
50:
51: public void testSimpleBMT() throws Exception {
52: Properties props = (Properties) defaultProps.clone();
53: props.put("transactionType", "Bean");
54: runTest(getOperations(), props);
55: }
56:
57: public void testSimpleDLQ() throws Exception {
58: Properties props = (Properties) defaultProps.clone();
59: props.put("rollback", "DLQ");
60: runTest(getDLQOperations(), props);
61: }
62:
63: public Operation[] getOperations() throws Exception {
64: return new Operation[] {
65: new SendMessageOperation(this , "1"),
66: new CheckMessageSizeOperation(this , 1, 0),
67: new CheckJMSDestinationOperation(this , 0,
68: getDestination().toString()),
69: new CheckMessageIDOperation(this , 0, "1"), };
70: }
71:
72: public Operation[] getDLQOperations() throws Exception {
73: return new Operation[] {
74: new SendMessageOperation(this , "1"),
75: new CheckMessageSizeOperation(this , 7, 0),
76: new CheckJMSDestinationOperation(this , 0,
77: getDestination().toString()),
78: new CheckJMSDestinationOperation(this , 1,
79: getDestination().toString()),
80: new CheckJMSDestinationOperation(this , 2,
81: getDestination().toString()),
82: new CheckJMSDestinationOperation(this , 3,
83: getDestination().toString()),
84: new CheckJMSDestinationOperation(this , 4,
85: getDestination().toString()),
86: new CheckJMSDestinationOperation(this , 5,
87: getDestination().toString()),
88: new CheckJMSDestinationOperation(this , 6,
89: getDLQDestination().toString()),
90: new CheckMessageIDOperation(this , 0, "1"),
91: new CheckMessageIDOperation(this , 1, "1"),
92: new CheckMessageIDOperation(this , 2, "1"),
93: new CheckMessageIDOperation(this , 3, "1"),
94: new CheckMessageIDOperation(this , 4, "1"),
95: new CheckMessageIDOperation(this , 5, "1"),
96: new CheckMessageIDOperation(this , 6, "1") };
97: }
98: }
|