KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > tools > verifier > tests > app > AppName


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

34 public class AppName extends ApplicationTest implements AppCheck {
35
36
37     /**
38      * Application's name test.
39      * The Application provider must assign a display name to each Application
40      *
41      * @param descriptor the Application deployment descriptor
42      *
43      * @return <code>Result</code> the results for this assertion
44      */

45     public Result check(Application descriptor) {
46
47     Result result = getInitializedResult();
48
49     
50     String JavaDoc appName = descriptor.getName();
51
52     if (appName != null && appName.length() > 0 ) {
53         // as long as it's not blank, test should pass
54
result.passed
55         (smh.getLocalString
56          (getClass().getName() + ".passed",
57           "Application display name is : [ {0} ]",
58           new Object JavaDoc [] {appName}));
59     } else {
60         // it's blank, test should not pass
61

62         result.failed
63         (smh.getLocalString
64          (getClass().getName() + ".failed",
65           "Error: Application display name cannot be blank."));
66     }
67     return result;
68     }
69 }
70
Popular Tags