KickJava   Java API By Example, From Geeks To Geeks.

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


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

30 /*
31  * @testName: check
32  * @assertion_ids:
33  * @test_Strategy:
34  * @class.testArgs: Additional arguments (if any) to be passed when execing the client
35  * @testDescription:
36  *
37  * from Web Services for J2EE, Version 1.0
38  * Section 7.1.2
39  * The developer is responsible for providing the following information in the webservices.xml deployment descriptor:
40  * " Port s name. A logical name for the port must be specified by the developer using the port-component-name element.
41  * This name bears no relationship to the WSDL port name.
42  * This name must be unique amongst all port component names in a module.
43  * - verify that port-component-name appears in the webservices.xml file
44  * - verify that the name is unique. Note: current dol issue with uniqueness test
45  * it does not return non unique endpoints.
46  */

47
48 public class WSWsdlPortComponentName extends WSTest implements WSCheck {
49
50     /**
51      * @param descriptor the WebServices descriptor
52      * @return <code>Result</code> the results for this assertion
53      */

54     public Result check (WebServiceEndpoint descriptor) {
55
56     Result result = getInitializedResult();
57         ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();
58         boolean pass = true;
59         String JavaDoc portcomponentname = null;
60         try {
61
62            portcomponentname = descriptor.getEndpointName();
63            if ( portcomponentname == null )
64               pass = false;
65            if ( portcomponentname.equals("") )
66               pass = false;
67
68            if (pass) {
69               result.addGoodDetails(smh.getLocalString ("tests.componentNameConstructor",
70                                    "For [ {0} ]", new Object JavaDoc[] {compName.toString()}));
71               result.passed(smh.getLocalString (getClass().getName() + ".passed",
72                           "The webservices.xml file for [ {0} ] has the port-component-name element specified.",
73                            new Object JavaDoc[] {compName.toString()}));
74             }
75             else {
76              result.addErrorDetails(smh.getLocalString ("tests.componentNameConstructor",
77                                    "For [ {0} ]", new Object JavaDoc[] {compName.toString()}));
78              result.failed(smh.getLocalString (getClass().getName() + ".failed",
79                "The webservices.xml file for [ {0} ] does not have the port-component-name element specified.",
80                 new Object JavaDoc[] {compName.toString()}));
81             }
82         }catch (Exception JavaDoc e) {
83             //result.fail
84
result.addErrorDetails(smh.getLocalString
85                ("com.sun.enterprise.tools.verifier.tests.webservices.Error",
86                 "Error: Unexpected error occurred [ {0} ]",
87                 new Object JavaDoc[] {e.getMessage()}));
88         }
89         return result;
90     }
91 }
92
93
Popular Tags