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.cmp2;
017:
018: import javax.ejb.EJBHome;
019:
020: import org.apache.openejb.test.entity.cmp.BasicCmpHome;
021: import org.apache.openejb.test.entity.cmp.BasicCmpObject;
022:
023: /**
024: * [8] Should be run as the eigth test suite of the BasicCmpTestClients
025: */
026: public class Cmp2EjbMetaDataTests extends BasicCmp2TestClient {
027:
028: public Cmp2EjbMetaDataTests() {
029: super ("EJBMetaData.");
030: }
031:
032: protected void setUp() throws Exception {
033: super .setUp();
034: Object obj = initialContext
035: .lookup("client/tests/entity/cmp2/BasicCmpHome");
036: ejbHome = (BasicCmpHome) javax.rmi.PortableRemoteObject.narrow(
037: obj, BasicCmpHome.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, BasicCmpHome.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, BasicCmpObject.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: }
|