KickJava   Java API By Example, From Geeks To Geeks.

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


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;
24
25 import com.sun.enterprise.tools.verifier.tests.ejb.EjbTest;
26 import java.util.*;
27 import com.sun.enterprise.deployment.*;
28 import com.sun.enterprise.tools.verifier.*;
29 import com.sun.enterprise.tools.verifier.tests.ejb.EjbCheck;
30 import com.sun.enterprise.tools.verifier.tests.*;
31
32
33 /**
34  * The reentrant element must be one of the following:
35  * True
36  * False
37  */

38 public class ReEntrantElement extends EjbTest implements EjbCheck {
39
40
41     /**
42      * The reentrant element must be one of the following:
43      * True
44      * False
45      *
46      * @param descriptor the Enterprise Java Bean deployment descriptor
47      *
48      * @return <code>Result</code> the results for this assertion
49      */

50     public Result check(EjbDescriptor descriptor) {
51
52     Result result = getInitializedResult();
53     ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();
54
55     // The reentrant element must be one of the following:
56
// True
57
// False
58

59     if (descriptor instanceof EjbEntityDescriptor) {
60         boolean reentrant =
61         ((EjbEntityDescriptor)descriptor).isReentrant();
62         // this will never fail?
63
// need DOL to turn off checking and map XML elements to DOL 1-1
64
if ((reentrant == true) || (reentrant == false)) {
65         result.addGoodDetails(smh.getLocalString
66                       ("tests.componentNameConstructor",
67                        "For [ {0} ]",
68                        new Object JavaDoc[] {compName.toString()}));
69         result.passed
70             (smh.getLocalString
71              (getClass().getName() + ".passed",
72               "reEntrant [ {0} ] is valid within bean [ {1} ]",
73               new Object JavaDoc[] {new Boolean JavaDoc(reentrant),descriptor.getName()}));
74         } else {
75         result.addErrorDetails(smh.getLocalString
76                        ("tests.componentNameConstructor",
77                     "For [ {0} ]",
78                     new Object JavaDoc[] {compName.toString()}));
79         result.failed
80             (smh.getLocalString
81              (getClass().getName() + ".failed",
82               "Error: reEntrant [ {0} ] is not valid within bean [ {1} ]",
83               new Object JavaDoc[] {new Boolean JavaDoc(reentrant),descriptor.getName()}));
84         }
85     } else {
86         result.addNaDetails(smh.getLocalString
87                 ("tests.componentNameConstructor",
88                  "For [ {0} ]",
89                  new Object JavaDoc[] {compName.toString()}));
90         result.notApplicable(smh.getLocalString
91                  (getClass().getName() + ".notApplicable",
92                   "{0} expected \n {1} bean, but called with {2} bean",
93                   new Object JavaDoc[] {getClass(),"Entity","Session"}));
94     }
95     return result;
96     }
97 }
98
Popular Tags