KickJava   Java API By Example, From Geeks To Geeks.

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


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 com.sun.enterprise.deployment.*;
27 import com.sun.enterprise.tools.verifier.Result;
28 import com.sun.enterprise.tools.verifier.tests.*;
29
30 /**
31  * All finder methods should throw the javax.ejb.FinderException
32  *
33  * @author Jerome Dochez
34  * @version
35  */

36 public class FindMethodException extends QueryMethodTest {
37
38  
39     /**
40      * <p>
41      * Run an individual test against a finder method (single or multi)
42      * </p>
43      *
44      * @param method is the finder method reference
45      * @param descriptor is the entity bean descriptor
46      * @param targetClass is the class to apply to tests to
47      * @param result is where to place the result
48      *
49      * @return true if the test passes
50      */

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