KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > tools > verifier > tests > ejb > messagebean > EjbCreateExists


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23
24 package com.sun.enterprise.tools.verifier.tests.ejb.messagebean;
25
26 import java.lang.reflect.Method JavaDoc;
27 import com.sun.enterprise.deployment.EjbMessageBeanDescriptor;
28 import com.sun.enterprise.tools.verifier.Result;
29 import com.sun.enterprise.tools.verifier.tests.*;
30
31
32 /**
33  * Verify that message beans implement the ejbCreate method with a void return
34  * type
35  *
36  * @author Jerome Dochez
37  * @version
38  */

39 public class EjbCreateExists extends MessageBeanTest {
40
41     /**
42      * <p>
43      * @return the name of the method on the message bean this test applies to
44      * </p>
45      */

46     protected String JavaDoc getMethodName() {
47         return "ejbCreate";
48     }
49     
50     /**
51      * Run a verifier test against an individual declared message
52      * drive bean component
53      *
54      * @param descriptor the Enterprise Java Bean deployment descriptor
55      *
56      * @return <code>Result</code> the results for this assertion
57      */

58     public Result check(EjbMessageBeanDescriptor descriptor) {
59         
60         Result result = getInitializedResult();
61     ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();
62         Class JavaDoc mbc = loadMessageBeanClass(descriptor, result);
63         if (mbc!=null) {
64             Method JavaDoc m = getMethod(mbc, getMethodName(),null);
65             if (m!=null) {
66                 result.addGoodDetails(smh.getLocalString
67                        ("tests.componentNameConstructor",
68                     "For [ {0} ]",
69                     new Object JavaDoc[] {compName.toString()}));
70         result.passed(smh.getLocalString
71             ("com.sun.enterprise.tools.verifier.tests.ejb.messagebean.EjbCreateExists.passed",
72                     "Message-Drive bean [ {0} ] provide an {1} implementation with no argument",
73                 new Object JavaDoc[] {(descriptor).getEjbClassName(),getMethodName()}));
74             } else {
75                 result.addErrorDetails(smh.getLocalString
76                        ("tests.componentNameConstructor",
77                     "For [ {0} ]",
78                     new Object JavaDoc[] {compName.toString()}));
79         result.failed(smh.getLocalString
80             ("com.sun.enterprise.tools.verifier.tests.ejb.messagebean.EjbCreateExists.failed",
81                     "Error: Message-Drive bean [ {0} ] does not implement an {1} with no arguments",
82                 new Object JavaDoc[] {(descriptor).getEjbClassName(), getMethodName()}));
83             }
84         }
85         return result;
86     }
87 }
88
Popular Tags