KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > tools > verifier > app > AppCheckMgrImpl


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.app;
24
25 import com.sun.enterprise.deployment.Application;
26 import com.sun.enterprise.deployment.Descriptor;
27 import com.sun.enterprise.deployment.RootDeploymentDescriptor;
28 import com.sun.enterprise.tools.verifier.CheckMgr;
29 import com.sun.enterprise.tools.verifier.FrameworkContext;
30 import com.sun.enterprise.tools.verifier.JarCheck;
31 import com.sun.enterprise.tools.verifier.Result;
32 import com.sun.enterprise.tools.verifier.tests.ComponentNameConstructor;
33
34 /**
35  * Application harness
36  */

37
38 public class AppCheckMgrImpl extends CheckMgr implements JarCheck {
39
40     /**
41      * name of the file containing the list of tests for the Application
42      * architecture
43      */

44     private static final String JavaDoc testsListFileName = "TestNamesApp.xml"; // NOI18N
45
private static final String JavaDoc sunONETestsListFileName = getSunPrefix()
46             .concat(testsListFileName);
47
48     public AppCheckMgrImpl(FrameworkContext frameworkContext) {
49         this.frameworkContext = frameworkContext;
50     }
51
52     /**
53      * Check application for spec. conformance
54      *
55      * @param descriptor Application descriptor
56      */

57     public void check(Descriptor descriptor) throws Exception JavaDoc {
58         // run persistence tests first.
59
checkPersistenceUnits(Application.class.cast(descriptor));
60
61         if (frameworkContext.isPartition() &&
62                 !frameworkContext.isApp())
63             return;
64         // all tests for embedding application
65
super.check(descriptor);
66     }
67
68     /**
69      * return the configuration file name for the list of tests pertinent to the
70      * web app space (jsp and servlet)
71      *
72      * @return <code>String</code> filename containing the list of tests
73      */

74     protected String JavaDoc getTestsListFileName() {
75         return testsListFileName;
76     }
77
78     /**
79      * return the configuration file name for the list of tests pertinent to the
80      * application scope (SunONE)
81      *
82      * @return <code>String</code> filename containing the list of tests
83      */

84     protected String JavaDoc getSunONETestsListFileName() {
85         return sunONETestsListFileName;
86     }
87
88     /**
89      *
90      * @param descriptor
91      * @return the name of the archive
92      */

93     protected String JavaDoc getArchiveUri(Descriptor descriptor) {
94         return ((Application) descriptor).getName();
95     }
96
97     /**
98      *
99      * @param descriptor
100      * @return version of spec the archive corresponds to.
101      */

102     protected String JavaDoc getSchemaVersion(Descriptor descriptor) {
103         return ((RootDeploymentDescriptor) descriptor).getSpecVersion();
104     }
105
106     /**
107      * Sets the module name in Result object.
108      *
109      * @param r result object
110      */

111     protected void setModuleName(Result r) {
112         r.setModuleName(Result.APP);
113     }
114
115     protected ComponentNameConstructor getComponentNameConstructor(
116             Descriptor descriptor) {
117         return new ComponentNameConstructor((Application)descriptor);
118     }
119
120 }
121
Popular Tags