View Javadoc

1   /*
2    * Copyright (c) 2004, RV Test Team
3    * All rights reserved.
4    *
5    * Redistribution and use in source and binary forms, with or without
6    * modification, are permitted provided that the following conditions are met:
7    *
8    * Redistributions of source code must retain the above copyright notice, this
9    * list of conditions and the following disclaimer.
10   *
11   * Redistributions in binary form must reproduce the above copyright notice,
12   * this list of conditions and the following disclaimer in the documentation
13   * and/or other materials provided with the distribution.
14   *
15   * Neither the name of the "RV Test Team" nor the names of its contributors may
16   * be used to endorse or promote products derived from this software without
17   * specific prior written permission.
18   *
19   * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20   * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21   * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22   * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
23   * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24   * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25   * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26   * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27   * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28   * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
29   * THE POSSIBILITY OF SUCH DAMAGE.
30   *
31   */
32  /*
33   * Copyright (c) 2002, Reuters
34   * All rights reserved.
35   *
36   * Redistribution and use in source and binary forms, with or without
37   * modification, are permitted provided that the following conditions are met:
38   *
39   * Redistributions of source code must retain the above copyright notice, this
40   * list of conditions and the following disclaimer.
41   * Redistributions in binary form must reproduce the above copyright notice,
42   * this list of conditions and the following disclaimer in the documentation
43   * and/or other materials provided with the distribution.
44   * Neither the name of the Reuters nor the names of its contributors may be
45   * used to endorse or promote products derived from this software without
46   * specific prior written permission.
47   *
48   * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
49   * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
50   * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
51   * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
52   * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
53   * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
54   * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
55   * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
56   * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
57   * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
58   * THE POSSIBILITY OF SUCH DAMAGE.
59   *
60   */
61  package com.reuters.msgtest.fixture;
62  
63  import java.util.Properties;
64  
65  
66  /***
67   * "Tests need to run against the background of a known set of objects.
68   * This set of objects is called a test fixture. When you are writing
69   * tests you will often find that you spend more time writing the code
70   * to set up the fixture than you do in actually testing values."
71   * taken from <a href="http://junit.sourceforge.net/doc/cookbook/cookbook.htm">JUnit Cookbook</a>
72   *
73   * For testing of Message Oriented Middleware the fixtures are the
74   * messages that will be sent out to stimulate the system and also the
75   * expected response messages.  These two types of messages are
76   * represented by the classes Stimuli and Responses.
77   *
78   * By having all fixture classes implement this interface we can
79   * reuse the fixture code made at the server unit test level with the
80   * integration and load tests.  This requires having known method signatures
81   * to invoke on a Fixture class.
82   *
83   * Additional non message related properites, such as represented in
84   * a simple java.util.Properties file are a possible addition to this
85   * class.
86   *
87   * We allow for the propagation of TibrvExceptions out of the local
88   * block just to make writing the fixture easier, no try-catch blocks
89   * necessary.  These are handled by the JUnit framework so they will
90   * be handled elegantly.
91   *
92   * The separation into two methods, create and get is to force you
93   * to write a fixture that does not return a new instance on each
94   * invokation.  This is so the same fixture can be modified by multiple
95   * tests.
96   *
97   * @author <a href="mailto:mark.pollack@reuters.com">Mark Pollack</a>
98   * @version @VERSION@
99   */
100 public interface RvFixture {
101     /***
102      * Retrieve the stimulus messages created in makeStimului.
103      *
104      * @return a Map of stimulus messages, the values are of type TibrvMsg
105      */
106     Stimuli getStimuli();
107 
108     /***
109      * Retrieve the response messages created in createResponses
110      *
111      * @return an object with the expected messages, the values are of
112      * type TibrvMsg.
113      */
114     Responses getResponses();
115 
116     /***
117      * Other data that might be used during the test and know in advance.
118      * Data that is not of the type rv message can be placed here as key
119      * value pairs.  It is indended that you use string key values pairs
120      * for storage reasons but it is not required.
121      *
122      * @return a <code>Properties</code> value
123      */
124     Properties getAdditionalData();
125 
126     /***
127      * @return The name of this fixture
128      */
129     String getName();
130 }