KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > tools > verifier > tests > ejb > runtime > ASEntBeanUniqueID


1 package com.sun.enterprise.tools.verifier.tests.ejb.runtime;
2
3 /*
4  * The contents of this file are subject to the terms
5  * of the Common Development and Distribution License
6  * (the License). You may not use this file except in
7  * compliance with the License.
8  *
9  * You can obtain a copy of the license at
10  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
11  * glassfish/bootstrap/legal/CDDLv1.0.txt.
12  * See the License for the specific language governing
13  * permissions and limitations under the License.
14  *
15  * When distributing Covered Code, include this CDDL
16  * Header Notice in each file and include the License file
17  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
18  * If applicable, add the following below the CDDL Header,
19  * with the fields enclosed by brackets [] replaced by
20  * you own identifying information:
21  * "Portions Copyrighted [year] [name of copyright owner]"
22  *
23  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
24  */

25
26 import com.sun.enterprise.tools.verifier.tests.ejb.EjbTest;
27 import java.util.*;
28 import com.sun.enterprise.deployment.EjbDescriptor;
29 import com.sun.enterprise.deployment.EjbSessionDescriptor;
30 import com.sun.enterprise.tools.verifier.*;
31 import com.sun.enterprise.tools.verifier.tests.*;
32
33 import com.sun.enterprise.tools.verifier.tests.ejb.EjbCheck;
34
35 /** enterprise-beans
36  * unique-id ? [String]
37  *
38  * The unique-id is automatically generated and updated at deployment/redeployment
39  * The test is crude and only checks if the value promoted is not null.
40  * @author Irfan Ahmed
41  */

42 public class ASEntBeanUniqueID extends EjbTest implements EjbCheck {
43
44     public Result check(EjbDescriptor descriptor) {
45
46     Result result = getInitializedResult();
47     ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();
48         try{
49             String JavaDoc s1 = ("/sun-ejb-jar/enterprise-beans/unique-id");
50             String JavaDoc entBeanUniqueID = getXPathValue(s1);
51             if(entBeanUniqueID == null)
52             {
53                 result.addGoodDetails(smh.getLocalString
54                     ("tests.componentNameConstructor",
55                     "For [ {0} ]",
56                     new Object JavaDoc[] {compName.toString()}));
57                 result.passed(smh.getLocalString(getClass().getName()+".passed",
58                     "PASSED [AS-EJB enterprise-beans] The unique-id key should not be defined. It will be " +
59                       "automatically generated at deployment time."));
60             }
61             else
62             {
63                 result.addWarningDetails(smh.getLocalString
64                                        ("tests.componentNameConstructor",
65                                         "For [ {0} ]",
66                                         new Object JavaDoc[] {compName.toString()}));
67                 result.warning(smh.getLocalString
68                      (getClass().getName() + ".warning",
69                       "WARNING [AS-EJB enterprise-beans] : unique-id Element should not be defined. It is " +
70                       "automatically generated at deployment time."));
71             }
72
73         }catch(Exception JavaDoc ex){
74             result.addErrorDetails(smh.getLocalString
75                 (getClass().getName() + ".notRun",
76                 "NOT RUN [AS-EJB] : Could not create a descriptor object"));
77         }
78         return result;
79     }
80 }
81
Popular Tags