001: /**
002: * EasyBeans
003: * Copyright (C) 2006 Bull S.A.S.
004: * Contact: easybeans@ow2.org
005: *
006: * This library is free software; you can redistribute it and/or
007: * modify it under the terms of the GNU Lesser General Public
008: * License as published by the Free Software Foundation; either
009: * version 2.1 of the License, or any later version.
010: *
011: * This library is distributed in the hope that it will be useful,
012: * but WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014: * Lesser General Public License for more details.
015: *
016: * You should have received a copy of the GNU Lesser General Public
017: * License along with this library; if not, write to the Free Software
018: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
019: * USA
020: *
021: * --------------------------------------------------------------------------
022: * $Id: TestInheritance.java 1970 2007-10-16 11:49:25Z benoitf $
023: * --------------------------------------------------------------------------
024: */package org.ow2.easybeans.tests.inheritance;
025:
026: import org.ow2.easybeans.tests.common.ejbs.base.ItfSimplePrintMessage;
027: import org.ow2.easybeans.tests.common.ejbs.stateful.containermanaged.inheritance.SFSBInheritanceTest00;
028: import org.ow2.easybeans.tests.common.helper.EJBHelper;
029: import org.testng.annotations.BeforeClass;
030: import org.testng.annotations.Test;
031:
032: /**
033: * Verifies if the bean inheritance is following the JSR 220 spec.And verifies
034: * also if the container accepts two methods with the same signature.
035: * @reference JSR 220-PROPOSED FINAL
036: * @requirement Application Server must be running; the bean that implements the
037: * interface
038: * org.ow2.easybeans.tests.common.ejbs.stateful.ItfSimplePrintMessage
039: * must be deployed.
040: * @setup gets the reference of bean that implements ItfSimplePrintMessage.
041: * @author Gisele Pinheiro Souza
042: * @author Eduardo Studzinski Estima de Castro
043: */
044: public class TestInheritance {
045:
046: /**
047: * The bean used during the tests.
048: */
049: private ItfSimplePrintMessage sfsbMessage;
050:
051: /**
052: * The message used to compare with the bean value.
053: */
054: private static final String MESSAGE_1 = "Test says Hello World";
055:
056: /**
057: * The message used to compare with the bean value.
058: */
059: private static final String MESSAGE_2 = "The bean works well";
060:
061: /**
062: * Creates a bean to be used in the tests.
063: * @throws Exception if there is a problem with the bean initialization.
064: */
065: @BeforeClass
066: public void setup() throws Exception {
067: // gets a bean
068: ItfSimplePrintMessage sfsbPrint = EJBHelper
069: .getBeanRemoteInstance(SFSBInheritanceTest00.class,
070: ItfSimplePrintMessage.class);
071: sfsbMessage = sfsbPrint;
072: }
073:
074: /**
075: * Verifies if the bean returned call correctly the startup method.
076: * @input the message to be stored.
077: * @output -
078: */
079: @Test(groups={"startup"})
080: public void callStartupWithOneParameterTest() {
081: sfsbMessage.startup(MESSAGE_1);
082: }
083:
084: /**
085: * Verifies if the bean returned call correctly the startup method.
086: * @input the message to be stored.
087: * @output -
088: */
089: @Test(groups={"startup"})
090: public void callStartupWithTwoParametersTest() {
091: sfsbMessage.startup(MESSAGE_1, MESSAGE_2);
092: }
093:
094: /**
095: * Verifies if the startup was made correctly.
096: * @input -
097: * @output the same message value inserted in the
098: * callStartupWithOneParameterTest.
099: */
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: }
|