KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > easybeans > tests > inheritance > TestInheritance


1 /**
2  * EasyBeans
3  * Copyright (C) 2006 Bull S.A.S.
4  * Contact: easybeans@objectweb.org
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19  * USA
20  *
21  * --------------------------------------------------------------------------
22  * $Id: TestInheritance.java 978 2006-07-28 13:19:14Z studzine $
23  * --------------------------------------------------------------------------
24  */

25 package org.objectweb.easybeans.tests.inheritance;
26
27 import org.objectweb.easybeans.tests.common.ejbs.base.ItfSimplePrintMessage;
28 import org.objectweb.easybeans.tests.common.ejbs.stateful.containermanaged.inheritance.SFSBInheritanceTest00;
29 import org.objectweb.easybeans.tests.common.helper.EJBHelper;
30 import org.testng.annotations.BeforeClass;
31 import org.testng.annotations.Test;
32
33 /**
34  * Verifies if the bean inheritance is following the JSR 220 spec.And verifies
35  * also if the container accepts two methods with the same signature.
36  * @reference JSR 220-PROPOSED FINAL
37  * @requirement Application Server must be running; the bean that implements the
38  * interface
39  * org.objectweb.jonas.ejb3.tests.common.ejbs.stateful.ItfSimplePrintMessage
40  * must be deployed.
41  * @setup gets the reference of bean that implements ItfSimplePrintMessage.
42  * @author Gisele Pinheiro Souza
43  * @author Eduardo Studzinski Estima de Castro
44  */

45 public class TestInheritance {
46
47     /**
48      * The bean used during the tests.
49      */

50     private ItfSimplePrintMessage sfsbMessage;
51
52     /**
53      * The message used to compare with the bean value.
54      */

55     private static final String JavaDoc MESSAGE_1 = "Test says Hello World";
56
57     /**
58      * The message used to compare with the bean value.
59      */

60     private static final String JavaDoc MESSAGE_2 = "The bean works well";
61
62     /**
63      * Creates a bean to be used in the tests.
64      * @throws Exception if there is a problem with the bean initialization.
65      */

66     @BeforeClass
67     public void setup() throws Exception JavaDoc {
68         // gets a bean
69
ItfSimplePrintMessage sfsbPrint = EJBHelper.getBeanRemoteInstance(SFSBInheritanceTest00.class,
70                 ItfSimplePrintMessage.class);
71         sfsbMessage = sfsbPrint;
72     }
73
74     /**
75      * Verifies if the bean returned call correctly the startup method.
76      * @input the message to be stored.
77      * @output -
78      */

79     @Test(groups = {"startup"})
80     public void callStartupWithOneParameterTest() {
81         sfsbMessage.startup(MESSAGE_1);
82     }
83
84     /**
85      * Verifies if the bean returned call correctly the startup method.
86      * @input the message to be stored.
87      * @output -
88      */

89     @Test(groups = {"startup"})
90     public void callStartupWithTwoParametersTest() {
91         sfsbMessage.startup(MESSAGE_1, MESSAGE_2);
92     }
93
94     /**
95      * Verifies if the startup was made correctly.
96      * @input -
97      * @output the same message value inserted in the
98      * callStartupWithOneParameterTest.
99      */

100     @Test(groups = {"callMesssage"}, dependsOnMethods = "callStartupWithOneParameterTest")
101     public void callMessageWithOneParameterTest() {
102         assert sfsbMessage.getMessage().equals(MESSAGE_1);
103     }
104
105     /**
106      * Verifies if the startup was made correctly.
107      * @input -
108      * @output the same message value inserted in the
109      * callStartupWithTwoParametersTest.
110      */

111     @Test(groups = {"callMesssage"}, dependsOnMethods = "callStartupWithTwoParametersTest")
112     public void callMessageWithTwoParametersTest() {
113         assert sfsbMessage.getMessage().equals(MESSAGE_1 + MESSAGE_2);
114     }
115
116 }
117
Popular Tags