KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > tools > verifier > tests > ejb > runtime > ASEjbCommitOption


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

25
26 import com.sun.enterprise.tools.verifier.tests.ejb.EjbTest;
27 import com.sun.enterprise.deployment.EjbDescriptor;
28 import com.sun.enterprise.tools.verifier.*;
29 import com.sun.enterprise.tools.verifier.tests.*;
30
31 import com.sun.enterprise.tools.verifier.tests.ejb.EjbCheck;
32
33 import com.sun.enterprise.deployment.runtime.IASEjbExtraDescriptors;
34
35 /**
36  * @author
37  */

38 public class ASEjbCommitOption extends EjbTest implements EjbCheck {
39
40     /**
41      * @param descriptor
42      * @return */

43     public Result check(EjbDescriptor descriptor)
44     {
45     Result result = getInitializedResult();
46     ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();
47         
48         boolean oneFailed = false;
49         try{
50             IASEjbExtraDescriptors iasEjbExtraDesc = descriptor.getIASEjbExtraDescriptors();
51             String JavaDoc commitOption = iasEjbExtraDesc.getCommitOption();
52             if(commitOption!=null)
53             {
54                 if(commitOption.length()==0){
55                     addErrorDetails(result, compName);
56                     result.failed(smh.getLocalString(getClass().getName()+".failed",
57                         "FAILED [AS-EJB ejb] : commit-option cannot be an empty String"));
58                 }else{
59                     if(!commitOption.equals("A") && !commitOption.equals("B") //4699329
60
&& !commitOption.equals("C"))
61                     {
62                         addErrorDetails(result, compName);
63                         result.failed(smh.getLocalString(getClass().getName()+".failed1",//4699329
64
"FAILED [AS-EJB ejb] : commit-option cannot be {0}. " +
65                             "It must be one of A, B and "+
66                             "C", new Object JavaDoc[]{commitOption}));
67                     }
68                 }
69             }else{
70                 addNaDetails(result, compName);
71                 result.notApplicable(smh.getLocalString(getClass().getName()+".notApplicable",
72                     "NOT APPLICABLE [AS-EJB ejb] commit-option Element is not defined"));
73             }
74         }catch(Exception JavaDoc ex){
75             addErrorDetails(result, compName);
76             result.addErrorDetails(smh.getLocalString
77                 (getClass().getName() + ".notRun",
78                 "NOT RUN [AS-EJB] : Could not create an descriptor object"));
79         }
80         return result;
81     }
82 }
83
Popular Tags