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.cmp2;
018:
019: import org.apache.openejb.test.entity.cmp.UnknownCmpHome;
020: import org.apache.openejb.test.entity.cmp.UnknownCmpObject;
021:
022: import javax.ejb.EJBHome;
023:
024: /**
025: * [8] Should be run as the eigth test suite of the BasicCmpTestClients
026: */
027: public class Unknown2EjbMetaDataTests extends UnknownCmp2TestClient {
028:
029: public Unknown2EjbMetaDataTests() {
030: super ("EJBMetaData.");
031: }
032:
033: protected void setUp() throws Exception {
034: super .setUp();
035: Object obj = initialContext
036: .lookup("client/tests/entity/cmp2/UnknownCmpHome");
037: ejbHome = (UnknownCmpHome) javax.rmi.PortableRemoteObject
038: .narrow(obj, UnknownCmpHome.class);
039: ejbMetaData = ejbHome.getEJBMetaData();
040: }
041:
042: //=================================
043: // Test meta data methods
044: //
045: public void test01_getEJBHome() {
046: try {
047: EJBHome home = ejbMetaData.getEJBHome();
048: assertNotNull("The EJBHome is null", home);
049: } catch (Exception e) {
050: fail("Received Exception " + e.getClass() + " : "
051: + e.getMessage());
052: }
053: }
054:
055: public void test02_getHomeInterfaceClass() {
056: try {
057: Class clazz = ejbMetaData.getHomeInterfaceClass();
058: assertNotNull("The Home Interface class is null", clazz);
059: assertEquals(clazz, UnknownCmpHome.class);
060: } catch (Exception e) {
061: fail("Received Exception " + e.getClass() + " : "
062: + e.getMessage());
063: }
064: }
065:
066: public void test03_getPrimaryKeyClass() {
067: try {
068: Class clazz = ejbMetaData.getPrimaryKeyClass();
069: assertNotNull("The EJBMetaData is null", clazz);
070: assertEquals(clazz, Object.class);
071: } catch (Exception e) {
072: fail("Received Exception " + e.getClass() + " : "
073: + e.getMessage());
074: }
075: }
076:
077: public void test04_getRemoteInterfaceClass() {
078: try {
079: Class clazz = ejbMetaData.getRemoteInterfaceClass();
080: assertNotNull("The Remote Interface class is null", clazz);
081: assertEquals(clazz, UnknownCmpObject.class);
082: } catch (Exception e) {
083: fail("Received Exception " + e.getClass() + " : "
084: + e.getMessage());
085: }
086: }
087:
088: public void test05_isSession() {
089: try {
090: assertTrue("EJBMetaData says this is a session bean",
091: !ejbMetaData.isSession());
092: } catch (Exception e) {
093: fail("Received Exception " + e.getClass() + " : "
094: + e.getMessage());
095: }
096: }
097:
098: public void test06_isStatelessSession() {
099: try {
100: assertTrue(
101: "EJBMetaData says this is a stateless session bean",
102: !ejbMetaData.isStatelessSession());
103: } catch (Exception e) {
104: fail("Received Exception " + e.getClass() + " : "
105: + e.getMessage());
106: }
107: }
108: //
109: // Test meta data methods
110: //=================================
111: }
|