Package com.sun.enterprise.tools.verifier.tests

Examples of com.sun.enterprise.tools.verifier.tests.ComponentNameConstructor


     * @return <code>Result</code> the results for this assertion
     */
    public Result check(EjbDescriptor descriptor) {

        Result result = getInitializedResult();
        ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();
        boolean isEjb30 = descriptor.getEjbBundleDescriptor()
                              .getSpecVersion().equalsIgnoreCase("3.0");

        if (descriptor instanceof EjbSessionDescriptor) {
            try {
                Class c = Class.forName(((EjbSessionDescriptor)descriptor).getEjbClassName(), false,
                                   getVerifierContext().getClassLoader());
                //  Bean Provider should not store in a transient field a reference to
                // any of the following objects: SessionContext object; environment
                // JNDI naming context and any its subcontexts; home and remote
                // interfaces; and the UserTransaction interface.
                Field [] fields = c.getDeclaredFields();
                for (int i = 0; i < fields.length; i++) {
                    int modifiers = fields[i].getModifiers();
                    if (!Modifier.isTransient(modifiers)) {
                        continue;
                    } else {
                        Class fc = fields[i].getType();
                        // can't do anything with environment JNDI naming context and
                        // any its subcontexts
                        //sg133765: do we need to do something for business interface
                        if ((fc.getName().equals("javax.ejb.SessionContext")) ||
                                (fc.getName().equals("javax.transaction.UserTransaction")) ||
                                (fc.getName().equals(descriptor.getRemoteClassName())) ||
                                (fc.getName().equals(descriptor.getHomeClassName()))||
                                (fc.getName().equals(descriptor.getLocalClassName())) ||
                                (fc.getName().equals(descriptor.getLocalHomeClassName())) ||
                                (isEjb30 && fc.getName().equals("javax.ejb.EntityManager")) ||
                                (isEjb30 && fc.getName().equals("javax.ejb.EntityManagerFactory"))) {

                            result.failed(smh.getLocalString
                                    ("tests.componentNameConstructor",
                                            "For [ {0} ]",
                                            new Object[] {compName.toString()}));
                            result.addErrorDetails(smh.getLocalString
                                    (getClass().getName() + ".failed",
                                    "Error: Field [ {0} ] defined within" +
                                    " session bean class [ {1} ] is defined as transient. " +
                                    "Session bean fields should not store in a " +
                                    "transient field a reference to any of the following objects: " +
                                    "SessionContext object; environment JNDI naming context and any " +
                                    "its subcontexts; home and remote interfaces;" +
                                    " and the UserTransaction interface.",
                                            new Object[] {fields[i].getName(),
                                            ((EjbSessionDescriptor)descriptor).getEjbClassName()}));
                        }
                    }
                }

            } catch (ClassNotFoundException e) {
                Verifier.debug(e);
                result.addErrorDetails(smh.getLocalString
                        ("tests.componentNameConstructor",
                                "For [ {0} ]",
                                new Object[] {compName.toString()}));
                result.failed(smh.getLocalString
                        (getClass().getName() + ".failedException",
                                "Error: [ {0} ] class not found.",
                                new Object[] {((EjbSessionDescriptor)descriptor).getEjbClassName()}));
            }
View Full Code Here


public class TagNameIsUnique extends WebTest implements WebCheck {
    boolean oneFailed=false;

    public Result check(WebBundleDescriptor descriptor) {
        ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();
        Context context = getVerifierContext();
        Result result = loadWarFile(descriptor);

        TagLibDescriptor tlds[] = context.getTagLibDescriptors();
        if (tlds == null) {
View Full Code Here

     * @return <code>Result</code> the results for this assertion
     */
    public Result check(EjbDescriptor descriptor) {

        Result result = getInitializedResult();
        ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();

        if (descriptor instanceof EjbSessionDescriptor) {
            try {
                Class c = Class.forName(((EjbSessionDescriptor)descriptor).getEjbClassName(), false, getVerifierContext().getClassLoader());
                // fields should not be defined in the session bean class as transient.
View Full Code Here

*
* @author Sudipto Ghosh
*/
public class TaglibFunctionSignatureIsValid extends TagLibTest implements WebCheck {
    public Result check(WebBundleDescriptor descriptor) {
        ComponentNameConstructor compName =
                getVerifierContext().getComponentNameConstructor();
        Result result = getInitializedResult();
        Context context = getVerifierContext();
        TagLibDescriptor tlds[] = context.getTagLibDescriptors();
        FunctionDescriptor[] fnDesc = null;
View Full Code Here

*/
public class CallbackMethodException extends EjbTest {

    public Result check(EjbDescriptor descriptor) {
        Result result = getInitializedResult();
        ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();
        ClassLoader cl = getVerifierContext().getClassLoader();

        Set<LifecycleCallbackDescriptor> callbackDescs =
                                        new HashSet<LifecycleCallbackDescriptor>();
       
View Full Code Here

     * @return <code>Result</code> the results for this assertion
     */
    public Result check(EjbDescriptor descriptor) {
       
        Result result = getInitializedResult();
        ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();
       
        if (!(descriptor instanceof EjbSessionDescriptor) &&
                !(descriptor instanceof EjbEntityDescriptor)) {
            addNaDetails(result, compName);
            result.notApplicable(smh.getLocalString
View Full Code Here

public class ASWebEjbRef extends WebTest implements WebCheck {

    public Result check(WebBundleDescriptor descriptor) {
        Result result = getInitializedResult();
        ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();
        boolean oneFailed = false;
        String refName;
        EjbRef[] ejbRefs = (descriptor.getSunDescriptor()).getEjbRef();
        if (ejbRefs!=null && ejbRefs.length > 0) {
            for (int rep=0; rep<ejbRefs.length; rep++ ) {
View Full Code Here

     * @return true if the test passes
     */
    protected boolean runIndividualMethodTest(EjbDescriptor descriptor, Method method, Result result) {
       
        Class[] methodExceptionTypes = method.getExceptionTypes();
        ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();   
        // The methods arguments types must be legal types for
        // RMI-IIOP.  This means that their exception values must
        // throw java.rmi.RemoteException
        // methods must also throw java.rmi.RemoteException
        if (RmiIIOPUtils.isValidRmiIIOPException(methodExceptionTypes)) {
View Full Code Here

*/
public class BusinessInterfaceException extends EjbTest {

    public Result check(EjbDescriptor descriptor) {
        Result result = getInitializedResult();
        ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();
       
        Set<String> localAndRemoteClassNames = descriptor.getLocalBusinessClassNames();
        localAndRemoteClassNames.addAll(descriptor.getRemoteBusinessClassNames());
       
        for (String localOrRemoteClass : localAndRemoteClassNames)
View Full Code Here

     * @param descriptor the Enterprise Java Bean deployment descriptor
     * @return <code>Result</code> the results for this assertion
     */
    public Result check(EjbDescriptor descriptor){
        Result result = getInitializedResult();
        ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();
        String abstractSchema = null;

        if(descriptor instanceof EjbEntityDescriptor) {
            if (((EjbEntityDescriptor)descriptor).getPersistenceType().equals(EjbEntityDescriptor.CONTAINER_PERSISTENCE)) {
                if (((EjbCMPEntityDescriptor) descriptor).getCMPVersion()==EjbCMPEntityDescriptor.CMP_2_x) {
                    abstractSchema = ((EjbCMPEntityDescriptor)descriptor).getAbstractSchemaName();
                    if(abstractSchema!=null) {
                        boolean isJavaIdentifier=true;
                        boolean startChar=Character.isJavaIdentifierStart(abstractSchema.charAt(0));
                        if (startChar) {
                            for(int i=1;i<abstractSchema.length();i++)
                                if(!Character.isJavaIdentifierPart(abstractSchema.charAt(i))) {
                                    isJavaIdentifier=false;
                                    break;
                                }
                        } else {
                            isJavaIdentifier=false;
                        }
                        if(isJavaIdentifier) {
                            result.addGoodDetails(smh.getLocalString
                                    ("tests.componentNameConstructor",
                                            "For [ {0} ]",
                                            new Object[] {compName.toString()}));
                            result.passed(smh.getLocalString
                                    (getClass().getName() + ".passed",
                                            "abstract-schema-name [ {0} ] within bean [ {1} ] is a valid java identifier",
                                            new Object[] {abstractSchema, descriptor.getName()}));
                        }else{
                            result.addErrorDetails(smh.getLocalString
                                    ("tests.componentNameConstructor",
                                            "For [ {0} ]",
                                            new Object[] {compName.toString()}));
                            result.failed(smh.getLocalString
                                    (getClass().getName() + ".failed",
                                            "abstract-schema-name [ {0} ] within bean [ {1} ] is not a valid java identifier",
                                            new Object[] {abstractSchema, descriptor.getName()}));
                        }
                    }
                }
            }
        }
        if(abstractSchema==null){
            result.addNaDetails(smh.getLocalString
                    ("tests.componentNameConstructor",
                            "For [ {0} ]",
                            new Object[] {compName.toString()}));
            result.notApplicable(smh.getLocalString
                    (getClass().getName() + ".notApplicable",
                            "abstract-schema-name is not defined or this is not applicable for this bean"));
        }
        return result;
View Full Code Here

TOP

Related Classes of com.sun.enterprise.tools.verifier.tests.ComponentNameConstructor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.