KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > tools > verifier > tests > ejb > entity > cmp2 > SelectMethodException


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 package com.sun.enterprise.tools.verifier.tests.ejb.entity.cmp2;
24
25 import java.lang.reflect.Method JavaDoc;
26 import java.lang.reflect.Modifier JavaDoc;
27 import com.sun.enterprise.deployment.*;
28 import com.sun.enterprise.tools.verifier.Result;
29 import com.sun.enterprise.tools.verifier.tests.*;
30
31 /**
32  * Select methods must throw the javax.ejb.FinderException
33  *
34  * @author Jerome Dochez
35  * @version
36  */

37 public class SelectMethodException extends SelectMethodTest {
38
39     /**
40      * <p>
41      * run an individual test against a declared ejbSelect method
42      * </p>
43      *
44      * @param m is the ejbSelect method
45      * @param descriptor is the entity declaring the ejbSelect
46      * @param result is where to put the result
47      *
48      * @return true if the test passes
49      */

50     protected boolean runIndividualSelectTest(Method JavaDoc m, EjbCMPEntityDescriptor descriptor, Result result) {
51         ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();
52         if (methodThrowException(m, "javax.ejb.FinderException")) {
53         result.addGoodDetails(smh.getLocalString
54                        ("tests.componentNameConstructor",
55                     "For [ {0} ]",
56                     new Object JavaDoc[] {compName.toString()}));
57             result.addGoodDetails(smh.getLocalString
58             ("com.sun.enterprise.tools.verifier.tests.ejb.entity.cmp2.SelectMethodException.passed",
59                 "[ {0} ] throws the javax.ejb.FinderException",
60         new Object JavaDoc[] {m.getName()}));
61             return true;
62         } else {
63         result.addErrorDetails(smh.getLocalString
64                        ("tests.componentNameConstructor",
65                     "For [ {0} ]",
66                     new Object JavaDoc[] {compName.toString()}));
67             result.addErrorDetails(smh.getLocalString
68             ("com.sun.enterprise.tools.verifier.tests.ejb.entity.cmp2.SelectMethodException.failed",
69                 "Error : [ {0} ] does not throw the javax.ejb.FinderException",
70         new Object JavaDoc[] {m.getName()}));
71             return false;
72         }
73     }
74 }
75
Popular Tags