KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > tools > verifier > tests > webservices > SEIExtendsRemoteCheck


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.webservices;
24
25 import com.sun.enterprise.deployment.*;
26 import com.sun.enterprise.tools.verifier.*;
27 import com.sun.enterprise.tools.verifier.tests.*;
28
29 /*
30  * @class.setup_props: ;
31  */

32
33 /*
34  * @testName: check
35  * @assertion_ids: JSR109_WS_46;
36  * @test_Strategy:
37  * @class.testArgs: Additional arguments (if any) to be passed when execing the client
38  * @testDescription: SEI must extend the java.rmi.Remote interface.
39  */

40
41 public class SEIExtendsRemoteCheck extends WSTest implements WSCheck {
42
43     /**
44      * @param descriptor the WebService deployment descriptor
45      * @return <code>Result</code> the results for this assertion
46      */

47     public Result check (WebServiceEndpoint descriptor) {
48         Result result = getInitializedResult();
49         ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();
50         // get hold of the SEI Class
51
String JavaDoc s = descriptor.getServiceEndpointInterface();
52         if (s == null) {
53             // internal error, should never happen
54
result.failed(smh.getLocalString
55                     ("com.sun.enterprise.tools.verifier.tests.webservices.Error",
56                             "Error: Unexpected error occurred [ {0} ]",
57                             new Object JavaDoc[] {"SEI Class Name Null"}));
58             return result;
59
60         }
61         Class JavaDoc sei = null;
62         try {
63             sei = Class.forName(s, false, getVerifierContext().getClassLoader());
64         } catch(ClassNotFoundException JavaDoc e) {
65             addErrorDetails(result, compName);
66             result.failed(smh.getLocalString
67                     ("com.sun.enterprise.tools.verifier.tests.webservices.Error",
68                             "Error: Unexpected error occurred [ {0} ]",
69                             new Object JavaDoc[] {e.toString()}));
70
71             return result;
72         }
73         if (!(getVerifierContext().getSchemaVersion().compareTo("1.1") > 0)) {
74             if(!java.rmi.Remote JavaDoc.class.isAssignableFrom(sei)) {
75                 result.addErrorDetails(smh.getLocalString ("tests.componentNameConstructor",
76                         "For [ {0} ]", new Object JavaDoc[] {compName.toString()}));
77                 result.failed(smh.getLocalString(getClass().getName() + ".failed",
78                         "SEI [{0}] does not extend the java.rmi.Remote interface.",
79                         new Object JavaDoc[] {s}));
80             }
81         } else if (java.rmi.Remote JavaDoc.class.isAssignableFrom(sei)) {
82             result.addWarningDetails(smh.getLocalString ("tests.componentNameConstructor",
83                     "For [ {0} ]", new Object JavaDoc[] {compName.toString()}));
84             result.warning(smh.getLocalString(getClass().getName() + ".warning",
85                     "SEI [{0}] is not required to extend the java.rmi.Remote interface.",
86                     new Object JavaDoc[] {s}));
87         }
88         if(result.getStatus() != Result.FAILED
89                 && result.getStatus() != Result.WARNING) {
90             addGoodDetails(result, compName);
91             result.passed(smh.getLocalString(getClass().getName() + ".passed",
92                     "Service Enpoint is defined properly"));
93         }
94         return result;
95     }
96 }
97
98
Popular Tags