001: /**
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */package org.apache.openejb.test.entity.bmp;
017:
018: import javax.ejb.EJBHome;
019:
020: /**
021: * [8] Should be run as the eigth test suite of the BasicBmpTestClients
022: *
023: * @author <a href="mailto:david.blevins@visi.com">David Blevins</a>
024: * @author <a href="mailto:Richard@Monson-Haefel.com">Richard Monson-Haefel</a>
025: */
026: public class BmpEjbMetaDataTests extends BasicBmpTestClient {
027:
028: public BmpEjbMetaDataTests() {
029: super ("EJBMetaData.");
030: }
031:
032: protected void setUp() throws Exception {
033: super .setUp();
034: Object obj = initialContext
035: .lookup("client/tests/entity/bmp/BasicBmpHome");
036: ejbHome = (BasicBmpHome) javax.rmi.PortableRemoteObject.narrow(
037: obj, BasicBmpHome.class);
038: ejbMetaData = ejbHome.getEJBMetaData();
039: }
040:
041: //=================================
042: // Test meta data methods
043: //
044: public void test01_getEJBHome() {
045: try {
046: EJBHome home = ejbMetaData.getEJBHome();
047: assertNotNull("The EJBHome is null", home);
048: } catch (Exception e) {
049: fail("Received Exception " + e.getClass() + " : "
050: + e.getMessage());
051: }
052: }
053:
054: public void test02_getHomeInterfaceClass() {
055: try {
056: Class clazz = ejbMetaData.getHomeInterfaceClass();
057: assertNotNull("The Home Interface class is null", clazz);
058: assertEquals(clazz, BasicBmpHome.class);
059: } catch (Exception e) {
060: fail("Received Exception " + e.getClass() + " : "
061: + e.getMessage());
062: }
063: }
064:
065: public void test03_getPrimaryKeyClass() {
066: try {
067: Class clazz = ejbMetaData.getPrimaryKeyClass();
068: assertNotNull("The EJBMetaData is null", clazz);
069: assertEquals(clazz, Integer.class);
070: } catch (Exception e) {
071: fail("Received Exception " + e.getClass() + " : "
072: + e.getMessage());
073: }
074: }
075:
076: public void test04_getRemoteInterfaceClass() {
077: try {
078: Class clazz = ejbMetaData.getRemoteInterfaceClass();
079: assertNotNull("The Remote Interface class is null", clazz);
080: assertEquals(clazz, BasicBmpObject.class);
081: } catch (Exception e) {
082: fail("Received Exception " + e.getClass() + " : "
083: + e.getMessage());
084: }
085: }
086:
087: public void test05_isSession() {
088: try {
089: assertTrue("EJBMetaData says this is a session bean",
090: !ejbMetaData.isSession());
091: } catch (Exception e) {
092: fail("Received Exception " + e.getClass() + " : "
093: + e.getMessage());
094: }
095: }
096:
097: public void test06_isStatelessSession() {
098: try {
099: assertTrue(
100: "EJBMetaData says this is a stateless session bean",
101: !ejbMetaData.isStatelessSession());
102: } catch (Exception e) {
103: fail("Received Exception " + e.getClass() + " : "
104: + e.getMessage());
105: }
106: }
107: //
108: // Test meta data methods
109: //=================================
110: }
|