KickJava   Java API By Example, From Geeks To Geeks.

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


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 java.util.*;
27 import com.sun.enterprise.deployment.*;
28 import com.sun.enterprise.tools.verifier.*;
29 import com.sun.enterprise.tools.verifier.tests.ComponentNameConstructor;
30
31 /**
32  * The java element specifies the URI of a java application
33  * client module, relative to the top level of the application package.
34  *
35  */

36
37 public class AppClientURI extends ApplicationTest implements AppCheck {
38     
39     
40     /**
41      * The java element specifies the URI of a java application
42      * client module, relative to the top level of the application package.
43      *
44      * @param descriptor the Application deployment descriptor
45      *
46      * @return <code>Result</code> the results for this assertion
47      */

48     public Result check(Application descriptor) {
49         
50         ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();
51         Result result = getInitializedResult();
52         
53         // java element specifies the URI of a java application
54
// client module, relative to the top level of the application package
55
for (Iterator itr = descriptor.getApplicationClientDescriptors().iterator(); itr.hasNext();) {
56             ApplicationClientDescriptor acd = (ApplicationClientDescriptor) itr.next();
57             
58             // not sure what we can do to test this string?
59
// as long as it's not blank, pass...
60
if (!acd.getModuleDescriptor().getArchiveUri().endsWith(".jar")) {
61                 addErrorDetails(result, compName);
62                 result.failed
63                         (smh.getLocalString
64                         (getClass().getName() + ".failed",
65                         "Error: [ {0} ] does not specify the URI [ {1} ] of an ejb-jar, relative to the top level of the application package [ {2} ], or does not end with \".jar\"",
66                         new Object JavaDoc[] {acd.getName(), acd.getModuleDescriptor().getArchiveUri(), descriptor.getName()}));
67                         
68             }
69         }
70         if(result.getStatus() != Result.FAILED) {
71             addGoodDetails(result, compName);
72             result.passed
73                     (smh.getLocalString
74                     (getClass().getName() + ".passed",
75                     "All the Application URIs are valid."));
76         }
77         
78         return result;
79     }
80 }
81
Popular Tags