KickJava   Java API By Example, From Geeks To Geeks.

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


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
25 package com.sun.enterprise.tools.verifier.tests.web.runtime;
26
27 import com.sun.enterprise.tools.verifier.tests.web.WebTest;
28 import com.sun.enterprise.tools.verifier.tests.web.WebCheck;
29 import com.sun.enterprise.tools.verifier.tests.ComponentNameConstructor;
30 import com.sun.enterprise.tools.verifier.Result;
31 import com.sun.enterprise.deployment.WebBundleDescriptor;
32
33 /** message-destination
34  * message-destination-name
35  * jndi-name
36  */

37
38 public class ASMessageDestination extends WebTest implements WebCheck {
39
40     public Result check(WebBundleDescriptor descriptor) {
41
42     Result result = getInitializedResult();
43     ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();
44         
45         String JavaDoc messageDestinationName=null;
46         String JavaDoc jndiName=null;
47     int count = 0;
48         try{
49             count = getCountNodeSet("sun-web-app/message-destination");
50             if (count>0){
51                 for(int i=0;i<count;i++){
52                     messageDestinationName = getXPathValue("sun-web-app/message-destination/message-destination-name");
53                     jndiName = getXPathValue("sun-web-app/message-destination/jndi-name");
54                     
55                     if(messageDestinationName==null || messageDestinationName.length()==0){
56                         result.addErrorDetails(smh.getLocalString
57                             ("tests.componentNameConstructor",
58                             "For [ {0} ]",
59                             new Object JavaDoc[] {compName.toString()}));
60                         result.failed(smh.getLocalString
61                             (getClass().getName() + ".failed1",
62                             "FAILED [AS-WEB message-destination] : message-destination-name cannot be an empty string",
63                             new Object JavaDoc[] {descriptor.getName()}));
64                     }else{
65                         result.addGoodDetails(smh.getLocalString
66                             ("tests.componentNameConstructor",
67                             "For [ {0} ]",
68                             new Object JavaDoc[] {compName.toString()}));
69                         result.passed(smh.getLocalString(
70                                             getClass().getName() + ".passed1",
71                               "PASSED [AS-WEB message-destination] : message-destination-name is {1}",
72                               new Object JavaDoc[] {descriptor.getName(),messageDestinationName}));
73                     }
74                     
75                     if(jndiName==null || jndiName.length()==0){
76                         result.addErrorDetails(smh.getLocalString
77                             ("tests.componentNameConstructor",
78                             "For [ {0} ]",
79                             new Object JavaDoc[] {compName.toString()}));
80                         result.failed(smh.getLocalString
81                             (getClass().getName() + ".failed2",
82                             "FAILED [AS-WEB message-destination] : jndi-name cannot be an empty string",
83                             new Object JavaDoc[] {descriptor.getName()}));
84                     }else{
85                         result.addGoodDetails(smh.getLocalString
86                             ("tests.componentNameConstructor",
87                             "For [ {0} ]",
88                             new Object JavaDoc[] {compName.toString()}));
89                         result.passed(smh.getLocalString(
90                                             getClass().getName() + ".passed2",
91                               "PASSED [AS-WEB message-destination] : jndi-name is {1}",
92                               new Object JavaDoc[] {descriptor.getName(),jndiName}));
93                     }
94                 }
95             }else{
96                 result.addNaDetails(smh.getLocalString
97             ("tests.componentNameConstructor",
98             "For [ {0} ]",
99             new Object JavaDoc[] {compName.toString()}));
100                 result.notApplicable(smh.getLocalString(getClass().getName()+".notApplicable",
101                     "NOT APPLICABLE [AS-WEB sun-web-app] : message-destination Element not defined"));
102             }
103
104             
105         }catch(Exception JavaDoc ex){
106             result.failed(smh.getLocalString
107                 (getClass().getName() + ".failed",
108                     "FAILED [AS-WEB sun-web-app] could not create the servlet object"));
109         }
110     return result;
111     }
112
113 }
Popular Tags