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