KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > tools > verifier > tests > web > runtime > ASJSPConfig


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.web.runtime;
25
26 import com.sun.enterprise.deployment.*;
27 import com.sun.enterprise.tools.verifier.*;
28 import com.sun.enterprise.tools.verifier.tests.*;
29 import com.sun.enterprise.deployment.WebBundleDescriptor;
30 import com.sun.enterprise.tools.verifier.tests.web.*;
31 import com.sun.enterprise.deployment.runtime.web.*;
32
33 //<addition author="irfan@sun.com" [bug/rfe]-id="4711198" >
34
/* Changed the result messages to reflect consistency between the result messages generated
35  * for the EJB test cases for SunONE specific deployment descriptors*/

36 //</addition>
37

38 public class ASJSPConfig extends WebTest implements WebCheck{
39
40 public Result check(WebBundleDescriptor descriptor) {
41
42
43     Result result = getInitializedResult();
44     ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();
45         boolean oneFailed = false;
46         boolean notApp = false;
47  
48         try{
49             JspConfig jspConfig = (descriptor.getSunDescriptor()).getJspConfig();
50             WebProperty[] webProps=null;
51             if(jspConfig !=null)
52                 webProps = jspConfig.getWebProperty();
53             if (jspConfig!=null && webProps!=null && webProps.length > 0){
54                 if(ASWebProperty.checkWebProperties(webProps,result ,descriptor, this )){
55                     oneFailed=true;
56                     addErrorDetails(result, compName);
57                     result.failed(smh.getLocalString
58                                 (getClass().getName() + ".failed",
59                                 "FAILED [AS-WEB sun-web-app] jsp-config - Atleast one name/value pair is not valid in [ {0} ].",
60                                 new Object JavaDoc[] {descriptor.getName()}));
61                 }
62             }else{
63                 notApp=true;
64                 addNaDetails(result, compName);
65                 result.notApplicable(smh.getLocalString
66                  (getClass().getName() + ".notApplicable",
67                   "NOT APPLICABLE [AS-WEB sun-web-app] jsp-config element not defined in the web archive [ {0} ].",
68                   new Object JavaDoc[] {descriptor.getName()}));
69             }
70             if (oneFailed){
71                 result.setStatus(Result.FAILED);
72             }else if(notApp){
73                 result.setStatus(Result.NOT_APPLICABLE);
74             }else{
75                 result.setStatus(Result.PASSED);
76                 addGoodDetails(result, compName);
77                 result.passed
78             (smh.getLocalString
79                     (getClass().getName() + ".passed",
80                     "PASSED [AS-WEB sun-web-app] jsp-config elements are valid within the web archive [ {0} ].",
81                     new Object JavaDoc[] {descriptor.getName()} ));
82             }
83         }catch(Exception JavaDoc ex){
84             oneFailed = true;
85             addErrorDetails(result, compName);
86             result.failed(smh.getLocalString
87                 (getClass().getName() + ".failed1",
88                     "FAILED [AS-WEB csun-web-app] could not create the jsp-config object"));
89         
90         }
91         return result;
92     }
93
94 }
95
96
Popular Tags