KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > tools > verifier > tests > appclient > AppClientTest


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.appclient;
25
26
27 import com.sun.enterprise.tools.verifier.tests.VerifierTest;
28 import com.sun.enterprise.tools.verifier.tests.VerifierCheck;
29 import com.sun.enterprise.tools.verifier.Result;
30 import com.sun.enterprise.deployment.Descriptor;
31 import com.sun.enterprise.deployment.ApplicationClientDescriptor;
32 import com.sun.enterprise.deployment.util.ModuleDescriptor;
33 import com.sun.enterprise.util.io.FileUtils;
34
35 import java.io.File JavaDoc;
36
37 /**
38  * Superclass for all appclient tests, contains common services.
39  *
40  * @author Jerome Dochez
41  * @version
42  */

43 public abstract class AppClientTest extends VerifierTest implements VerifierCheck, AppClientCheck
44 {
45         
46     /**
47      * <p>
48      * run an individual test against the deployment descriptor for the
49      * archive the verifier is performing compliance tests against.
50      * </p>
51      *
52      * @param descriptor deployment descriptor for the archive
53      * @return result object containing the result of the individual test
54      * performed
55      */

56     public Result check(Descriptor descriptor) {
57         return check((ApplicationClientDescriptor) descriptor);
58     }
59    
60     /**
61      * <p>
62      * all connector tests should implement this method. it run an individual
63      * test against the resource adapter deployment descriptor.
64      * </p>
65      *
66      * @param descriptor deployment descriptor for the archive file
67      * @return result object containing the result of the individual test
68      * performed
69      */

70     public abstract Result check(ApplicationClientDescriptor descriptor);
71
72     protected String JavaDoc getAbstractArchiveUri(ApplicationClientDescriptor desc) {
73         String JavaDoc archBase = getVerifierContext().getAbstractArchive().
74                 getArchiveUri();
75         final ModuleDescriptor moduleDescriptor = desc.getModuleDescriptor();
76         if (moduleDescriptor.isStandalone()) {
77             return archBase; // it must be a stand-alone module; no such physical dir exists
78
} else {
79             return archBase + File.separator +
80                     FileUtils.makeFriendlyFileName(moduleDescriptor.getArchiveUri());
81         }
82     }
83
84 }
85
Popular Tags