InteropTestCase3BasicPubSub.java
01 /*
02  *
03  * Licensed to the Apache Software Foundation (ASF) under one
04  * or more contributor license agreements.  See the NOTICE file
05  * distributed with this work for additional information
06  * regarding copyright ownership.  The ASF licenses this file
07  * to you under the Apache License, Version 2.0 (the
08  * "License"); you may not use this file except in compliance
09  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  */
21 package org.apache.qpid.interop.testcases;
22 
23 import org.apache.log4j.Logger;
24 
25 import org.apache.qpid.test.framework.FrameworkBaseCase;
26 
27 import java.util.Properties;
28 
29 /**
30  <p><table id="crc"><caption>CRC Card</caption>
31  <tr><th> Responsibilities <th> Collaborations
32  <tr><td> Setup pub/sub test parameters and compare with test output. <td> {@link FrameworkBaseCase}
33  </table>
34  */
35 public class InteropTestCase3BasicPubSub extends FrameworkBaseCase
36 {
37     /** Used for debugging. */
38     private static final Logger log = Logger.getLogger(InteropTestCase3BasicPubSub.class);
39 
40     /**
41      * Creates a new coordinating test case with the specified name.
42      *
43      @param name The test case name.
44      */
45     public InteropTestCase3BasicPubSub(String name)
46     {
47         super(name);
48     }
49 
50     /**
51      * Performs the basic P2P test case, "Test Case 2" in the specification.
52      *
53      @throws Exception Any exceptions are allowed to fall through and fail the test.
54      */
55     public void testBasicPubSub() throws Exception
56     {
57         log.debug("public void testBasicPubSub(): called");
58 
59         Properties testConfig = new Properties();
60         testConfig.put("TEST_NAME""TC3_BasicPubSub");
61         testConfig.put("PUBSUB_KEY""tc3route");
62         testConfig.put("PUBSUB_NUM_MESSAGES"10);
63         testConfig.put("PUBSUB_NUM_RECEIVERS"5);
64 
65         /*Message[] reports =*/ getCircuitFactory().sequenceTest(null, null, testConfig);
66 
67         // Compare sender and receivers reports.
68         /*int messagesSent = reports[0].getIntProperty("MESSAGE_COUNT");
69         int messagesReceived = reports[1].getIntProperty("MESSAGE_COUNT");
70 
71         Assert.assertEquals("The requested number of messages were not sent.", 10, messagesSent);
72         Assert.assertEquals("Received messages did not match up to num sent * num receivers.", messagesSent * 5,
73             messagesReceived);*/
74     }
75 
76     /**
77      * Should provide a translation from the junit method name of a test to its test case name as defined in the
78      * interop testing specification. For example the method "testP2P" might map onto the interop test case name
79      * "TC2_BasicP2P".
80      *
81      @param methodName The name of the JUnit test method.
82      @return The name of the corresponding interop test case.
83      */
84     public String getTestCaseNameForTestMethod(String methodName)
85     {
86         return "TC3_BasicPubSub";
87     }
88 }