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 * Implements test case 2, from the interop test specification. This test sets up the TC2_BasicP2P test for 50
31 * messages. It checks that the sender and receivers reports both indicate that all the test messages were transmitted
32 * successfully.
33 *
34 * <p><table id="crc"><caption>CRC Card</caption>
35 * <tr><th> Responsibilities <th> Collaborations
36 * <tr><td> Setup p2p test parameters and compare with test output. <td> {@link FrameworkBaseCase}
37 * </table>
38 */
39 public class InteropTestCase2BasicP2P extends FrameworkBaseCase
40 {
41 /** Used for debugging. */
42 private static final Logger log = Logger.getLogger(InteropTestCase2BasicP2P.class);
43
44 /**
45 * Creates a new coordinating test case with the specified name.
46 *
47 * @param name The test case name.
48 */
49 public InteropTestCase2BasicP2P(String name)
50 {
51 super(name);
52 }
53
54 /**
55 * Performs the basic P2P test case, "Test Case 2" in the specification.
56 *
57 * @throws Exception Any exceptions are allowed to fall through and fail the test.
58 */
59 public void testBasicP2P() throws Exception
60 {
61 log.debug("public void testBasicP2P(): called");
62
63 Properties testConfig = new Properties();
64 testConfig.setProperty("TEST_NAME", "TC2_BasicP2P");
65 testConfig.setProperty("P2P_QUEUE_AND_KEY_NAME", "tc2queue");
66 testConfig.put("P2P_NUM_MESSAGES", 50);
67
68 /*Message[] reports =*/ getCircuitFactory().sequenceTest(null, null, testConfig);
69
70 // Compare sender and receivers reports.
71 /*int messagesSent = reports[0].getIntProperty("MESSAGE_COUNT");
72 int messagesReceived = reports[1].getIntProperty("MESSAGE_COUNT");
73
74 Assert.assertEquals("The requested number of messages were not sent.", 50, messagesSent);
75 Assert.assertEquals("Sender and receivers messages sent did not match up.", messagesSent, messagesReceived);*/
76 }
77
78 /**
79 * Should provide a translation from the junit method name of a test to its test case name as defined in the
80 * interop testing specification. For example the method "testP2P" might map onto the interop test case name
81 * "TC2_BasicP2P".
82 *
83 * @param methodName The name of the JUnit test method.
84 * @return The name of the corresponding interop test case.
85 */
86 public String getTestCaseNameForTestMethod(String methodName)
87 {
88 return "TC2_BasicP2P";
89 }
90 }
|