KickJava   Java API By Example, From Geeks To Geeks.

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


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.web;
24
25 import com.sun.enterprise.tools.verifier.tests.web.WebTest;
26 import com.sun.enterprise.deployment.*;
27 import com.sun.enterprise.tools.verifier.*;
28 import com.sun.enterprise.tools.verifier.tests.*;
29
30 /**
31  * Web name test.
32  * The Web provider must assign a display-name to each web application
33  *
34  */

35 public class WebName extends WebTest implements WebCheck {
36
37       
38     /**
39      * Web name test.
40      * The Web provider must assign a display-name to each web application
41      *
42      *
43      * @param descriptor the Web deployment descriptor
44      *
45      * @return <code>Result</code> the results for this assertion
46      */

47     public Result check(WebBundleDescriptor descriptor) {
48
49     Result result = getInitializedResult();
50     ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();
51     String JavaDoc webName = descriptor.getName();
52
53     if (webName.length() > 0) {
54         // as long as it's not blank, test should pass
55
result.addGoodDetails(smh.getLocalString
56                   ("tests.componentNameConstructor",
57                    "For [ {0} ]",
58                    new Object JavaDoc[] {compName.toString()}));
59         result.passed
60             (smh.getLocalString
61              (getClass().getName() + ".passed",
62               "Web-App display name is : [ {0} ]",
63               new Object JavaDoc [] {webName}));
64     } else {
65         // it's blank, test should be N/A since <display-name> is optional
66
result.addNaDetails(smh.getLocalString
67                        ("tests.componentNameConstructor",
68                     "For [ {0} ]",
69                     new Object JavaDoc[] {compName.toString()}));
70         result.notApplicable
71             (smh.getLocalString
72              (getClass().getName() + ".failed",
73               "Not Applicable: Web-App display name is not defined."));
74     }
75     return result;
76     }
77 }
78
Popular Tags