KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > tools > verifier > tests > connector > CheckResourceAdapterClassSerializable


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  * CheckResourceAdapterClassSerializable.java
25  *
26  * Created on August 29, 2002
27  */

28
29 package com.sun.enterprise.tools.verifier.tests.connector;
30
31 import java.io.File JavaDoc;
32 import com.sun.enterprise.tools.verifier.tests.connector.ConnectorTest;
33 import com.sun.enterprise.tools.verifier.tests.connector.ConnectorCheck;
34 import com.sun.enterprise.tools.verifier.Result;
35 import com.sun.enterprise.tools.verifier.*;
36 import com.sun.enterprise.deployment.ConnectorDescriptor;
37 import com.sun.enterprise.tools.verifier.tests.*;
38 import java.util.Iterator JavaDoc;
39 import java.util.Set JavaDoc;
40
41 /**
42  * Test that "resourceadapter-class" implements java.io.Serializable
43  *
44  * @author Anisha Malhotra
45  * @version
46  */

47 public class CheckResourceAdapterClassSerializable
48     extends ConnectorTest
49     implements ConnectorCheck
50 {
51
52   /** <p>
53    * ResourceAdapter class must be available if the resource adapter provides
54    * inbound communication
55    * </p>
56    *
57    * @param descriptor deployment descriptor for the rar file
58    * @return result object containing the result of the individual test
59    * performed
60    */

61   public Result check(ConnectorDescriptor descriptor) {
62
63     Result result = getInitializedResult();
64     ComponentNameConstructor compName =
65       getVerifierContext().getComponentNameConstructor();
66
67     String JavaDoc resourceAdapterClass = descriptor.getResourceAdapterClass();
68     if(resourceAdapterClass.equals("") && descriptor.getInBoundDefined())
69     {
70         // resourceadapter-class cannot be null
71
addErrorDetails(result, compName);
72         result.failed(smh.getLocalString
73             (getClass().getName() + ".failed",
74              "ResourceAdapter class not found"));
75     }
76     else
77     {
78         addGoodDetails(result, compName);
79         result.notApplicable(smh.getLocalString
80             ("com.sun.enterprise.tools.verifier.tests.connector.resourceadapter.notApp",
81              "Valid ResourceAdapter class."));
82     }
83     return result;
84   }
85 }
86 /* CR: 6388236
87     }
88     Context context = getVerifierContext();
89     ClassLoader jcl = context.getRarClassLoader();
90     Class implClass = null;
91     try
92     {
93       implClass = Class.forName(resourceAdapterClass, false, getVerifierContext().getClassLoader());
94     }
95     catch(ClassNotFoundException e)
96     {
97       result.addErrorDetails(smh.getLocalString
98           ("tests.componentNameConstructor",
99            "For [ {0} ]",
100            new Object[] {compName.toString()}));
101       result.failed(smh.getLocalString
102           ("com.sun.enterprise.tools.verifier.tests.connector.CheckResourceAdapter.nonexist",
103            "Error: The class [ {0} ] as defined under resourceadapter-class in the deployment descriptor does not exist",
104            new Object[] {resourceAdapterClass}));
105       return result;
106     }
107     if(!isImplementorOf(implClass, "java.io.Serializable"))
108     {
109       result.addErrorDetails(smh.getLocalString
110           ("tests.componentNameConstructor",
111            "For [ {0} ]",
112            new Object[] {compName.toString()}));
113       result.failed(smh.getLocalString(getClass().getName() + ".failed",
114             "Error: resourceadapter-class [ {0} ] does not implement java.io.Serializable",
115             new Object[] {resourceAdapterClass}));
116     }
117     else
118     {
119       result.addGoodDetails(smh.getLocalString
120           ("tests.componentNameConstructor",
121            "For [ {0} ]",
122            new Object[] {compName.toString()}));
123       result.passed(smh.getLocalString(getClass().getName() + ".passed",
124             "Success: resourceadapter-class implements java.io.Serializable"));
125     }
126     return result;
127   }
128 }
129 */

130
Popular Tags