Search in sources :

Example 76 with VerifierTestContext

use of com.sun.enterprise.tools.verifier.VerifierTestContext in project Payara by payara.

the class HomeInterfacePublic method check.

/**
 * All enterprise beans home interface's must be declared as public.
 *
 * @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();
    if (getHomeInterfaceName(descriptor) == null || "".equals(getHomeInterfaceName(descriptor))) {
        result.addNaDetails(smh.getLocalString("tests.componentNameConstructor", "For [ {0} ]", new Object[] { compName.toString() }));
        result.notApplicable(smh.getLocalString("com.sun.enterprise.tools.verifier.tests.ejb.localinterfaceonly.notapp", "Not Applicable because, EJB [ {0} ] has Local Interfaces only.", new Object[] { descriptor.getEjbClassName() }));
        return result;
    }
    if ((descriptor instanceof EjbSessionDescriptor) || (descriptor instanceof EjbEntityDescriptor)) {
        try {
            VerifierTestContext context = getVerifierContext();
            ClassLoader jcl = context.getClassLoader();
            Class c = Class.forName(getClassName(descriptor), false, jcl);
            // remote interface must be defined as public
            boolean isPublic = false;
            int modifiers = c.getModifiers();
            if (Modifier.isPublic(modifiers)) {
                isPublic = true;
            }
            // it extends the proper EJBHome, but is it's modifier public
            if (!isPublic) {
                result.addErrorDetails(smh.getLocalString("tests.componentNameConstructor", "For [ {0} ]", new Object[] { compName.toString() }));
                result.failed(smh.getLocalString(getClass().getName() + ".failed", "Error: [ {0} ] is not defined as public.  All enterprise beans home interfaces must be defined as public.  [ {1} ] is not a valid home interface.", new Object[] { getClassName(descriptor), getClassName(descriptor) }));
            } else {
                result.addGoodDetails(smh.getLocalString("tests.componentNameConstructor", "For [ {0} ]", new Object[] { compName.toString() }));
                result.passed(smh.getLocalString(getClass().getName() + ".passed", "[ {0} ] properly declares the home interface as public.", new Object[] { getClassName(descriptor) }));
            }
        } 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[] { getClassName(descriptor) }));
        }
        return result;
    } else {
        result.addNaDetails(smh.getLocalString("tests.componentNameConstructor", "For [ {0} ]", new Object[] { compName.toString() }));
        result.notApplicable(smh.getLocalString(getClass().getName() + ".notApplicable", "[ {0} ] expected {1} bean or {2} bean, but called with {3}.", new Object[] { getClass(), "Session", "Entity", descriptor.getName() }));
        return result;
    }
}
Also used : EjbEntityDescriptor(org.glassfish.ejb.deployment.descriptor.EjbEntityDescriptor) VerifierTestContext(com.sun.enterprise.tools.verifier.VerifierTestContext) EjbSessionDescriptor(com.sun.enterprise.deployment.EjbSessionDescriptor) ComponentNameConstructor(com.sun.enterprise.tools.verifier.tests.ComponentNameConstructor) Result(com.sun.enterprise.tools.verifier.Result)

Example 77 with VerifierTestContext

use of com.sun.enterprise.tools.verifier.VerifierTestContext in project Payara by payara.

the class SessionBeanInterface method check.

/**
 * Implements the SessionBean Interface test.
 * All session Beans must implement, directly or indirectly, the SessionBean
 * interface.
 *
 * @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();
    if (descriptor instanceof EjbSessionDescriptor) {
        try {
            VerifierTestContext context = getVerifierContext();
            ClassLoader jcl = context.getClassLoader();
            Class c = Class.forName(descriptor.getEjbClassName(), false, getVerifierContext().getClassLoader());
            boolean validBean = false;
            // walk up the class tree
            do {
                Class[] interfaces = c.getInterfaces();
                for (int i = 0; i < interfaces.length; i++) {
                    logger.log(Level.FINE, getClass().getName() + ".debug1", new Object[] { interfaces[i].getName() });
                    if (interfaces[i].getName().equals("javax.ejb.SessionBean") && descriptor instanceof EjbSessionDescriptor) {
                        validBean = true;
                        result.addGoodDetails(smh.getLocalString("tests.componentNameConstructor", "For [ {0} ]", new Object[] { compName.toString() }));
                        result.passed(smh.getLocalString(getClass().getName() + ".passed", "[ {0} ] properly implements the SessionBean interface.", new Object[] { descriptor.getEjbClassName() }));
                        break;
                    }
                }
            } while ((((c = c.getSuperclass()) != null) && (!validBean)));
            if (!validBean) {
                result.addErrorDetails(smh.getLocalString("tests.componentNameConstructor", "For [ {0} ]", new Object[] { compName.toString() }));
                result.failed(smh.getLocalString(getClass().getName() + ".failed", "Error: [ {0} ] does not properly implement the SessionBean interface.  All session Beans must implement the SessionBean interface.  [ {1} ] is not a valid bean.", new Object[] { descriptor.getEjbClassName(), 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[] { descriptor.getEjbClassName() }));
        }
        return result;
    } else {
        result.addNaDetails(smh.getLocalString("tests.componentNameConstructor", "For [ {0} ]", new Object[] { compName.toString() }));
        result.notApplicable(smh.getLocalString(getClass().getName() + ".notApplicable", "[ {0} ] expected {1} bean, but called with {2} bean.", new Object[] { getClass(), "Session", "Entity" }));
        return result;
    }
}
Also used : VerifierTestContext(com.sun.enterprise.tools.verifier.VerifierTestContext) EjbSessionDescriptor(org.glassfish.ejb.deployment.descriptor.EjbSessionDescriptor) ComponentNameConstructor(com.sun.enterprise.tools.verifier.tests.ComponentNameConstructor) Result(com.sun.enterprise.tools.verifier.Result)

Example 78 with VerifierTestContext

use of com.sun.enterprise.tools.verifier.VerifierTestContext in project Payara by payara.

the class TransactionDemarcationComponentInterface method commonToBothInterfaces.

/**
 * This method is responsible for the logic of the test. It is called for both local and component interfaces.
 * @param descriptor the Enterprise Java Bean deployment descriptor
 * @param component for the Remote/Local interface of the Ejb.
 * @return boolean the results for this assertion i.e if a test has failed or not
 */
private boolean commonToBothInterfaces(String component, EjbSessionDescriptor descriptor, String methodIntf) {
    boolean oneFailed = false;
    try {
        Arrays.sort(EJBObjectMethods);
        // retrieve the component interface methods
        VerifierTestContext context = getVerifierContext();
        ClassLoader jcl = context.getClassLoader();
        Class componentInterfaceClass = Class.forName(component, false, getVerifierContext().getClassLoader());
        Method[] componentInterfaceMethods = componentInterfaceClass.getMethods();
        boolean lookForIt = false;
        for (int i = 0; i < componentInterfaceMethods.length; i++) {
            if (Arrays.binarySearch(EJBObjectMethods, componentInterfaceMethods[i].getName()) < 0) {
                try {
                    ContainerTransaction containerTransaction = null;
                    boolean resolved = false;
                    if (!descriptor.getMethodContainerTransactions().isEmpty()) {
                        for (Enumeration ee = descriptor.getMethodContainerTransactions().keys(); ee.hasMoreElements(); ) {
                            lookForIt = false;
                            MethodDescriptor methodDescriptor = (MethodDescriptor) ee.nextElement();
                            // style 1)
                            if (methodDescriptor.getName().equals(MethodDescriptor.ALL_METHODS)) {
                                // if Remote - PASS
                                if (methodDescriptor.getEjbClassSymbol() == null) {
                                    lookForIt = true;
                                } else if (methodDescriptor.getEjbClassSymbol().equals(MethodDescriptor.EJB_REMOTE) || methodDescriptor.getEjbClassSymbol().equals(MethodDescriptor.EJB_LOCAL)) {
                                    lookForIt = true;
                                // if empty String PASS
                                } else if (methodDescriptor.getEjbClassSymbol().equals("")) {
                                    lookForIt = true;
                                } else if (methodDescriptor.getEjbClassSymbol().equals(MethodDescriptor.EJB_HOME) || methodDescriptor.getEjbClassSymbol().equals(MethodDescriptor.EJB_LOCALHOME)) {
                                    lookForIt = false;
                                // else (Bogus)
                                } else {
                                    // carry on & don't look for
                                    // container transaction
                                    lookForIt = false;
                                }
                            } else if (methodDescriptor.getParameterClassNames() == null) {
                                // if (getEjbClassSybol() is Remote or is the empty String AND if componentInterfaceMethods[i].getName().equals(methodDescriptor.getName())
                                if (((methodDescriptor.getEjbClassSymbol() == null) || methodDescriptor.getEjbClassSymbol().equals("") || methodDescriptor.getEjbClassSymbol().equals(MethodDescriptor.EJB_REMOTE) || methodDescriptor.getEjbClassSymbol().equals(MethodDescriptor.EJB_LOCAL)) && (componentInterfaceMethods[i].getName().equals(methodDescriptor.getName()))) {
                                    // PASS
                                    lookForIt = true;
                                } else {
                                    // carry on
                                    lookForIt = false;
                                }
                            } else {
                                if (((methodDescriptor.getEjbClassSymbol() == null) || methodDescriptor.getEjbClassSymbol().equals("") || methodDescriptor.getEjbClassSymbol().equals(MethodDescriptor.EJB_REMOTE) || methodDescriptor.getEjbClassSymbol().equals(MethodDescriptor.EJB_LOCAL)) && (componentInterfaceMethods[i].getName().equals(methodDescriptor.getName())) && (MethodUtils.stringArrayEquals(methodDescriptor.getParameterClassNames(), (new MethodDescriptor(componentInterfaceMethods[i], methodIntf)).getParameterClassNames()))) {
                                    // PASS
                                    lookForIt = true;
                                } else {
                                    // CARRY ON
                                    lookForIt = false;
                                }
                            }
                            if (lookForIt) {
                                containerTransaction = (ContainerTransaction) descriptor.getMethodContainerTransactions().get(methodDescriptor);
                                if (containerTransaction != null) {
                                    String transactionAttribute = containerTransaction.getTransactionAttribute();
                                    // don't need this check here
                                    if (ContainerTransaction.NOT_SUPPORTED.equals(transactionAttribute) || ContainerTransaction.SUPPORTS.equals(transactionAttribute) || ContainerTransaction.REQUIRED.equals(transactionAttribute) || ContainerTransaction.REQUIRES_NEW.equals(transactionAttribute) || ContainerTransaction.MANDATORY.equals(transactionAttribute) || ContainerTransaction.NEVER.equals(transactionAttribute) || (!transactionAttribute.equals(""))) {
                                        addGoodDetails(result, compName);
                                        result.addGoodDetails(smh.getLocalString(getClass().getName() + ".passed", "Valid: TransactionAttribute [ {0} ] for method [ {1} ] is defined for component interface [ {2} ]", new Object[] { transactionAttribute, componentInterfaceMethods[i].getName(), component }));
                                        resolved = true;
                                    } else {
                                        oneFailed = true;
                                        addErrorDetails(result, compName);
                                        result.addErrorDetails(smh.getLocalString(getClass().getName() + ".failed", "Error: TransactionAttribute [ {0} ] for method [ {1} ] is not valid.   Transaction attributes must be defined for all methods of component interface [ {2} ].", new Object[] { transactionAttribute, componentInterfaceMethods[i].getName(), component }));
                                    }
                                } else {
                                    oneFailed = true;
                                    addErrorDetails(result, compName);
                                    result.addErrorDetails(smh.getLocalString(getClass().getName() + ".failedException", "Error: TransactionAttribute is null for method [ {0} ]", new Object[] { methodDescriptor.getName() }));
                                }
                            }
                        }
                        // did you resolve the last one okay?
                        if (!resolved) {
                            /*
                                // This if-stmt code is a workaround introduced by Harminder
                                // because currently methodDescriptor.getEjbClassSymbol() is
                                // returning NULL
                                //if (allMethods){
                                if (!wildCardWasPresent) {
*/
                            oneFailed = true;
                            addErrorDetails(result, compName);
                            result.addErrorDetails(smh.getLocalString(getClass().getName() + ".failed1", "Error: Transaction attributes must be specified for the methods defined in the component interface [ {0} ].  Method [ {1} ] has no transaction attribute defined within this bean [ {2} ].", new Object[] { component, componentInterfaceMethods[i].getName(), descriptor.getName() }));
                        /*
                                }
                                else {
                                             result.addGoodDetails(smh.getLocalString
                                                                   ("tests.componentNameConstructor",
                                                                    "For [ {0} ]",
                                                                    new Object[] {compName.toString()}));
					    result.addGoodDetails(smh.getLocalString
								  (getClass().getName() + ".passed",
								   "Valid: TransactionAttribute [ {0} ] for method [ {1} ] is defined for component interface [ {2} ]", new Object[] {"*", "*",component}));
                              }
                              // End of workaround code. Note : this else also has to be removed once
                              // the original bug of methodDesc.getEjbClassSymbol() is fixed

*/
                        }
                    } else {
                        oneFailed = true;
                        addErrorDetails(result, compName);
                        result.addErrorDetails(smh.getLocalString(getClass().getName() + ".failed2", "Error: There are no transaction attributes within this bean [ {0} ].  Transaction attributes must be specified for the methods defined in the component interface [ {1} ].  Method [ {2} ] has no transaction attribute defined.", new Object[] { descriptor.getName(), component, componentInterfaceMethods[i].getName() }));
                    }
                    if (oneFailed == true)
                        return oneFailed;
                } catch (Exception e) {
                    addErrorDetails(result, compName);
                    result.failed(smh.getLocalString(getClass().getName() + ".failedException1", "Error: Component interface [ {0} ] does not contain class [ {1} ] within bean [ {2} ]", new Object[] { component, e.getMessage(), descriptor.getName() }));
                    return oneFailed;
                }
            } else // if you found a business method
            {
                // bug 6383704
                if (componentInterfaceMethods[i].getName().equals("remove")) {
                    for (Enumeration ee = descriptor.getMethodContainerTransactions().keys(); ee.hasMoreElements(); ) {
                        MethodDescriptor methodDescriptor = (MethodDescriptor) ee.nextElement();
                        if (methodDescriptor.getName().equals("remove")) {
                            oneFailed = true;
                            addErrorDetails(result, compName);
                            result.failed(smh.getLocalString(getClass().getName() + ".failedExcep", "Error: Method [ {0} ] should not be assigned a transaction attribute.", new Object[] { methodDescriptor.getName() }));
                            break;
                        }
                    }
                }
            }
        }
        // for all component interface methods
        return oneFailed;
    } catch (ClassNotFoundException e) {
        Verifier.debug(e);
        addErrorDetails(result, compName);
        result.failed(smh.getLocalString(getClass().getName() + ".failedException2", "Error: Component interface [ {0} ] does not exist or is not loadable within bean [ {1} ]", new Object[] { component, descriptor.getName() }));
        return oneFailed;
    }
}
Also used : Enumeration(java.util.Enumeration) VerifierTestContext(com.sun.enterprise.tools.verifier.VerifierTestContext) Method(java.lang.reflect.Method) MethodDescriptor(com.sun.enterprise.deployment.MethodDescriptor) ContainerTransaction(org.glassfish.ejb.deployment.descriptor.ContainerTransaction)

Example 79 with VerifierTestContext

use of com.sun.enterprise.tools.verifier.VerifierTestContext in project Payara by payara.

the class TransactionDemarcationSessionSynchronizationInterface method check.

/**
 * Optionally implemented SessionSynchronization interface transaction
 * demarcation test.
 * If an enterprise bean implements the javax.ejb.SessionSynchronization
 * interface, the Application Assembler can specify only the following values
 * for the transaction attributes of the bean's methods:
 *   Required
 *   RequiresNew
 *   Mandatory
 *
 * @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();
    boolean oneFound = false;
    if (descriptor instanceof EjbSessionDescriptor) {
        try {
            VerifierTestContext context = getVerifierContext();
            ClassLoader jcl = context.getClassLoader();
            Class c = Class.forName(descriptor.getEjbClassName(), false, getVerifierContext().getClassLoader());
            // walk up the class tree
            do {
                Class[] interfaces = c.getInterfaces();
                for (int i = 0; i < interfaces.length; i++) {
                    if (interfaces[i].getName().equals("javax.ejb.SessionSynchronization")) {
                        oneFound = true;
                        break;
                    }
                }
            } while ((c = c.getSuperclass()) != null);
        } catch (ClassNotFoundException e) {
            Verifier.debug(e);
            addErrorDetails(result, compName);
            result.failed(smh.getLocalString(getClass().getName() + ".failedException1", "Error: [ {0} ] class not found.", new Object[] { descriptor.getEjbClassName() }));
            return result;
        }
        // Required, RequiresNew, Mandatory
        if (oneFound) {
            String transactionAttribute = "";
            ContainerTransaction containerTransaction = null;
            boolean oneFailed = false;
            if (!descriptor.getMethodContainerTransactions().isEmpty()) {
                for (Enumeration ee = descriptor.getMethodContainerTransactions().keys(); ee.hasMoreElements(); ) {
                    MethodDescriptor methodDescriptor = (MethodDescriptor) ee.nextElement();
                    containerTransaction = (ContainerTransaction) descriptor.getMethodContainerTransactions().get(methodDescriptor);
                    if (!(containerTransaction != null && properAttribDefined(containerTransaction))) {
                        transactionAttribute = containerTransaction.getTransactionAttribute();
                        addErrorDetails(result, compName);
                        result.failed(smh.getLocalString(getClass().getName() + ".failed", "Error: TransactionAttribute [ {0} ] for method [ {1} ] is not valid.", new Object[] { transactionAttribute, methodDescriptor.getName() }));
                    }
                }
            }
        }
    }
    if (result.getStatus() != Result.FAILED) {
        addGoodDetails(result, compName);
        result.passed(smh.getLocalString(getClass().getName() + ".passed", "TransactionAttributes are defined properly for the bean"));
    }
    return result;
}
Also used : Enumeration(java.util.Enumeration) VerifierTestContext(com.sun.enterprise.tools.verifier.VerifierTestContext) MethodDescriptor(com.sun.enterprise.deployment.MethodDescriptor) Result(com.sun.enterprise.tools.verifier.Result) ContainerTransaction(org.glassfish.ejb.deployment.descriptor.ContainerTransaction) EjbSessionDescriptor(org.glassfish.ejb.deployment.descriptor.EjbSessionDescriptor) ComponentNameConstructor(com.sun.enterprise.tools.verifier.tests.ComponentNameConstructor)

Example 80 with VerifierTestContext

use of com.sun.enterprise.tools.verifier.VerifierTestContext in project Payara by payara.

the class FieldNameElementPublic method check.

/**
 * The field-name element name must be a public field of the enterprise bean
 * class or one of its superclasses.
 *
 * @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();
    if (descriptor instanceof EjbEntityDescriptor) {
        String persistentType = ((EjbEntityDescriptor) descriptor).getPersistenceType();
        if (EjbEntityDescriptor.CONTAINER_PERSISTENCE.equals(persistentType)) {
            // this test apply only to 1.x cmp beans, in 2.x fields are virtual fields only
            if (EjbCMPEntityDescriptor.CMP_1_1 != ((EjbCMPEntityDescriptor) descriptor).getCMPVersion()) {
                result.addNaDetails(smh.getLocalString("tests.componentNameConstructor", "For [ {0} ]", new Object[] { compName.toString() }));
                result.notApplicable(smh.getLocalString("com.sun.enterprise.tools.verifier.tests.ejb.entity.cmp2.CMPTest.notApplicable3", "Test do not apply to this cmp-version of container managed persistence EJBs"));
                return result;
            }
            // RULE: Entity w/Container managed persistence bean provider must
            // specify container managed fields in the persistent-fields
            // element. The field-name element name must be a public field
            // of the enterprise bean class or one of its superclasses.
            boolean resolved = false;
            boolean oneFailed = false;
            if (!((EjbCMPEntityDescriptor) descriptor).getPersistenceDescriptor().getCMPFields().isEmpty()) {
                // check class to get all fields that actually exist
                try {
                    VerifierTestContext context = getVerifierContext();
                    ClassLoader jcl = context.getClassLoader();
                    for (Iterator itr = ((EjbCMPEntityDescriptor) descriptor).getPersistenceDescriptor().getCMPFields().iterator(); itr.hasNext(); ) {
                        FieldDescriptor nextPersistentField = (FieldDescriptor) itr.next();
                        String fieldName = nextPersistentField.getName();
                        Class c = Class.forName(descriptor.getEjbClassName(), false, getVerifierContext().getClassLoader());
                        // start do while loop here....
                        do {
                            // Returns an array containing Field objects
                            // reflecting all the accessible public fields of the class
                            // or interface represented by this Class object.
                            Field[] fields = c.getFields();
                            // loop thru all field array elements and ensure fieldName exist
                            for (int i = 0; i < fields.length; i++) {
                                if (fieldName.equals(fields[i].getName())) {
                                    resolved = true;
                                    logger.log(Level.FINE, getClass().getName() + ".debug1", new Object[] { fieldName, fields[i].toString(), c.getName() });
                                    result.addGoodDetails(smh.getLocalString("tests.componentNameConstructor", "For [ {0} ]", new Object[] { compName.toString() }));
                                    result.addGoodDetails(smh.getLocalString(getClass().getName() + ".passed", "[ {0} ] found in public fields of bean [ {1} ]", new Object[] { fieldName, c.getName() }));
                                    break;
                                } else {
                                    logger.log(Level.FINE, getClass().getName() + ".debug", new Object[] { fieldName, fields[i].toString(), c.getName() });
                                }
                            }
                        } while (((c = c.getSuperclass()) != null) && (!resolved));
                        // resolved the last field name okay
                        if (!resolved) {
                            if (!oneFailed) {
                                oneFailed = true;
                            }
                            result.addErrorDetails(smh.getLocalString("tests.componentNameConstructor", "For [ {0} ]", new Object[] { compName.toString() }));
                            result.addErrorDetails(smh.getLocalString(getClass().getName() + ".failed1", "Error: [ {0} ] not found in public fields of bean [ {1} ]", new Object[] { fieldName, descriptor.getEjbClassName() }));
                        }
                        // clear the resolved flag for the next field name
                        if (resolved) {
                            resolved = false;
                        }
                    }
                    if (oneFailed) {
                        result.setStatus(Result.FAILED);
                    } else {
                        result.setStatus(Result.PASSED);
                    }
                } catch (Exception 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} ] within bean [ {1} ]", new Object[] { e.getMessage(), descriptor.getName() }));
                }
            } else {
                // persistent fields are empty
                result.addNaDetails(smh.getLocalString("tests.componentNameConstructor", "For [ {0} ]", new Object[] { compName.toString() }));
                result.notApplicable(smh.getLocalString(getClass().getName() + ".notApplicable1", "No persistent fields are defined for bean [ {0} ]", new Object[] { descriptor.getName() }));
            }
        } else {
            // BEAN_PERSISTENCE.equals(persistentType)
            result.addNaDetails(smh.getLocalString("tests.componentNameConstructor", "For [ {0} ]", new Object[] { compName.toString() }));
            result.notApplicable(smh.getLocalString(getClass().getName() + ".notApplicable2", "Expected [ {0} ] managed persistence, but [ {1} ] bean has [ {2} ] managed persistence.", new Object[] { EjbEntityDescriptor.CONTAINER_PERSISTENCE, descriptor.getName(), persistentType }));
        }
        return result;
    } else {
        result.addNaDetails(smh.getLocalString("tests.componentNameConstructor", "For [ {0} ]", new Object[] { compName.toString() }));
        result.notApplicable(smh.getLocalString(getClass().getName() + ".notApplicable", "{0} expected \n {1} bean, but called with {2} bean", new Object[] { getClass(), "Entity", "Session" }));
        return result;
    }
}
Also used : VerifierTestContext(com.sun.enterprise.tools.verifier.VerifierTestContext) Result(com.sun.enterprise.tools.verifier.Result) FieldDescriptor(org.glassfish.ejb.deployment.descriptor.FieldDescriptor) EjbEntityDescriptor(org.glassfish.ejb.deployment.descriptor.EjbEntityDescriptor) Field(java.lang.reflect.Field) Iterator(java.util.Iterator) EjbCMPEntityDescriptor(org.glassfish.ejb.deployment.descriptor.EjbCMPEntityDescriptor) ComponentNameConstructor(com.sun.enterprise.tools.verifier.tests.ComponentNameConstructor)

Aggregations

VerifierTestContext (com.sun.enterprise.tools.verifier.VerifierTestContext)91 Result (com.sun.enterprise.tools.verifier.Result)66 ComponentNameConstructor (com.sun.enterprise.tools.verifier.tests.ComponentNameConstructor)66 Method (java.lang.reflect.Method)66 EjbEntityDescriptor (org.glassfish.ejb.deployment.descriptor.EjbEntityDescriptor)49 EjbCMPEntityDescriptor (org.glassfish.ejb.deployment.descriptor.EjbCMPEntityDescriptor)12 EjbSessionDescriptor (org.glassfish.ejb.deployment.descriptor.EjbSessionDescriptor)11 Vector (java.util.Vector)9 TagLibDescriptor (com.sun.enterprise.tools.verifier.TagLibDescriptor)7 Field (java.lang.reflect.Field)7 FieldDescriptor (org.glassfish.ejb.deployment.descriptor.FieldDescriptor)6 EjbSessionDescriptor (com.sun.enterprise.deployment.EjbSessionDescriptor)4 MethodDescriptor (com.sun.enterprise.deployment.MethodDescriptor)4 TagDescriptor (com.sun.enterprise.tools.verifier.web.TagDescriptor)3 Enumeration (java.util.Enumeration)3 Iterator (java.util.Iterator)3 Set (java.util.Set)3 ContainerTransaction (org.glassfish.ejb.deployment.descriptor.ContainerTransaction)3 EjbDescriptor (org.glassfish.ejb.deployment.descriptor.EjbDescriptor)3 FunctionDescriptor (com.sun.enterprise.tools.verifier.web.FunctionDescriptor)2