Package org.jboss.verifier

Examples of org.jboss.verifier.Section


      //
      // Spec 7.11.1
      //
      if (!localOrRemoteExists && !serviceEndpointExists)
      {
         fireSpecViolationEvent(session, new Section("7.11.1"));
         verified = false;
      }

      if (verified)
      {
View Full Code Here


         //
         // Spec 10.6.1 (CMP) / 12.2.1 (BMP)
         //
         if (entity.isCMP())
         {
            fireSpecViolationEvent(entity, new Section("10.6.1"));
            verified = false;
         }
         else
         {
            fireSpecViolationEvent(entity, new Section("12.2.1"));
            verified = false;
         }
      }

      if (verified)
View Full Code Here

         bean = classloader.loadClass(beanName);
         return true;
      }
      catch (ClassNotFoundException cnfe)
      {
         fireSpecViolationEvent(theBean, new Section("22.2.b",
                 "Class not found on '" + beanName + "': " + cnfe.getMessage()));
         return false;
      }
   }
View Full Code Here

      {
         home = classloader.loadClass(homeName);
      }
      catch (ClassNotFoundException cnfe)
      {
         fireSpecViolationEvent(bean, new Section("22.2.c",
                 "Class not found on '" + homeName + "': " + cnfe.getMessage()));
         status = false;
      }

      // Verify the <remote> class
      try
      {
         remote = classloader.loadClass(remoteName);
      }
      catch (ClassNotFoundException cnfe)
      {
         fireSpecViolationEvent(bean, new Section("22.2.d",
                 "Class not found on '" + remoteName + "': " + cnfe.getMessage()));
         status = false;
      }

      return status;
View Full Code Here

      {
         localHome = classloader.loadClass(localHomeName);
      }
      catch (ClassNotFoundException cnfe)
      {
         fireSpecViolationEvent(bean, new Section("22.2.e",
                 "Class not found on '" + localHomeName + "': " +
                 cnfe.getMessage()));
         status = false;
      }

      try
      {
         local = classloader.loadClass(localName);
      }
      catch (ClassNotFoundException cnfe)
      {
         fireSpecViolationEvent(bean, new Section("22.2.f",
                 "Class not found on '" + localName + "': " + cnfe.getMessage()));
         status = false;
      }

      return status;
View Full Code Here

      //
      if (session.isStateless())
      {
         if (!hasDefaultCreateMethod(home))
         {
            fireSpecViolationEvent(session, new Section("7.11.6.d2"));
            status = false;
         }
         else
         {
            Method create = getDefaultCreateMethod(home);

            if (hasMoreThanOneCreateMethods(home))
            {
               fireSpecViolationEvent(session, new Section("7.11.6.d2"));
               status = false;
            }
         }
      }

      // The session bean's home interface MUST extend the
      // javax.ejb.EJBHome interface.
      //
      // Spec 7.11.6
      //
      if (!hasEJBHomeInterface(home))
      {
         fireSpecViolationEvent(session, new Section("7.11.6.a"));
         status = false;
      }

      // Method arguments defined in the home interface MUST be
      // of valid types for RMI/IIOP.
      //
      // Method return values defined in the home interface MUST
      // be of valid types for RMI/IIOP.
      //
      // Methods defined in the home interface MUST include
      // java.rmi.RemoteException in their throws clause.
      //
      // Spec 7.11.6
      ///
      Iterator it = Arrays.asList(home.getMethods()).iterator();
      while (it.hasNext())
      {
         Method method = (Method)it.next();

         if (!hasLegalRMIIIOPArguments(method))
         {
            fireSpecViolationEvent(session, method, new Section("7.11.6.b1"));
            status = false;
         }

         if (!hasLegalRMIIIOPReturnType(method))
         {
            fireSpecViolationEvent(session, method, new Section("7.11.6.b2"));
            status = false;
         }

         if (!throwsRemoteException(method))
         {
            fireSpecViolationEvent(session, method, new Section("7.11.6.b3"));
            status = false;
         }
      }

      // A session bean's home interface MUST define one or more
      // create(...) methods.
      //
      // Spec 7.11.6
      //
      if (!hasCreateMethod(home))
      {
         fireSpecViolationEvent(session, new Section("7.11.6.d1"));
         status = false;
      }

      // Each create(...) method in the session bean's home interface
      // MUST have a matching ejbCreate(...) method in the session
      // bean's class.
      //
      // Each create(...) method in the session bean's home interface
      // MUST have the same number and types of arguments to its
      // matching ejbCreate(...) method.
      //
      // The return type for a create(...) method MUST be the session
      // bean's remote interface type.
      //
      // All the exceptions defined in the throws clause of the matching
      // ejbCreate(...) method of the enterprise bean class MUST be
      // included in the throws clause of a matching create(...) method.
      //
      // The throws clause of a create(...) method MUST include the
      // javax.ejb.CreateException.
      //
      // Spec 7.11.6
      //
      Iterator createMethods = getCreateMethods(home);
      while (createMethods.hasNext())
      {
         Method create = (Method)createMethods.next();

         if (!hasMatchingEJBCreate(bean, create))
         {
            fireSpecViolationEvent(session, create, new Section("7.11.6.e"));
            status = false;
         }

         if (!hasRemoteReturnType(session, create))
         {
            fireSpecViolationEvent(session, create, new Section("7.11.6.f"));
            status = false;
         }

         if (hasMatchingEJBCreate(bean, create))
         {
            Method ejbCreate = getMatchingEJBCreate(bean, create);
            if (!hasMatchingExceptions(ejbCreate, create))
            {
               fireSpecViolationEvent(session, create,
                       new Section("7.11.6.g"));
               status = false;
            }
         }

         if (!throwsCreateException(create))
         {
            fireSpecViolationEvent(session, create, new Section("7.11.6.h"));
            status = false;
         }
      }

      return status;
View Full Code Here

      //
      if (session.isStateless())
      {
         if (!hasDefaultCreateMethod(localHome))
         {
            fireSpecViolationEvent(session, new Section("7.11.8.d2"));
            status = false;
         }
         else
         {
            Method create = getDefaultCreateMethod(localHome);

            if (hasMoreThanOneCreateMethods(localHome))
            {
               fireSpecViolationEvent(session, new Section("7.11.8.d2"));
               status = false;
            }
         }
      }

      // The session bean's home interface MUST extend the
      // javax.ejb.EJBLocalHome interface.
      //
      // Spec 7.11.8
      //
      if (!hasEJBLocalHomeInterface(localHome))
      {
         fireSpecViolationEvent(session, new Section("7.11.8.a"));
         status = false;
      }

      // Methods defined in the local home interface MUST NOT include
      // java.rmi.RemoteException in their throws clause.
      //
      // Spec 7.11.8
      //
      Iterator it = Arrays.asList(localHome.getMethods()).iterator();
      while (it.hasNext())
      {
         Method method = (Method)it.next();

         if (throwsRemoteException(method))
         {
            fireSpecViolationEvent(session, method, new Section("7.11.8.b"));
            status = false;
         }
      }

      // A session bean's home interface MUST define one or more
      // create(...) methods.
      //
      // Spec 7.11.8
      //
      if (!hasCreateMethod(localHome))
      {
         fireSpecViolationEvent(session, new Section("7.11.8.d1"));
         status = false;
      }

      // Each create(...) method in the session bean's local home
      // interface MUST have a matching ejbCreate(...) method in the
      // session bean's class.
      //
      // Each create(...) method in the session bean's home interface
      // MUST have the same number and types of arguments to its
      // matching ejbCreate(...) method.
      //
      // The return type for a create(...) method MUST be the session
      // bean's local interface type.
      //
      // All the exceptions defined in the throws clause of the matching
      // ejbCreate(...) method of the enterprise bean class MUST be
      // included in the throws clause of a matching create(...) method.
      //
      // The throws clause of a create(...) method MUST include the
      // javax.ejb.CreateException.
      //
      // Spec 7.11.8
      //
      Iterator createMethods = getCreateMethods(localHome);
      while (createMethods.hasNext())
      {
         Method create = (Method)createMethods.next();

         if (!hasMatchingEJBCreate(bean, create))
         {
            fireSpecViolationEvent(session, create,
                    new Section("7.11.8.e"));
            status = false;
         }

         if (!hasLocalReturnType(session, create))
         {
            fireSpecViolationEvent(session, create,
                    new Section("7.11.8.f"));
            status = false;
         }

         if (hasMatchingEJBCreate(bean, create))
         {
            Method ejbCreate = getMatchingEJBCreate(bean, create);
            if (!hasMatchingExceptions(ejbCreate, create))
            {
               fireSpecViolationEvent(session, create,
                       new Section("7.11.8.g"));
            }
         }

         if (!throwsCreateException(create))
         {
            fireSpecViolationEvent(session, create,
                    new Section("7.11.8.h"));
            status = false;
         }
      }

      return status;
View Full Code Here

      //
      // Spec 7.11.5
      //
      if (!hasEJBObjectInterface(remote))
      {
         fireSpecViolationEvent(session, new Section("7.11.5.a"));
         status = false;
      }

      // Method arguments defined in the remote interface MUST be
      // of valid types for RMI/IIOP.
      //
      // Method return values defined in the remote interface MUST
      // be of valid types for RMI/IIOP.
      //
      // Methods defined in the remote interface MUST include
      // java.rmi.RemoteException in their throws clause.
      //
      // Spec 7.11.5
      //
      Iterator it = Arrays.asList(remote.getMethods()).iterator();
      while (it.hasNext())
      {
         Method method = (Method)it.next();

         if (!hasLegalRMIIIOPArguments(method))
         {
            fireSpecViolationEvent(session, method, new Section("7.11.5.b1"));
            status = false;
         }

         if (!hasLegalRMIIIOPReturnType(method))
         {
            fireSpecViolationEvent(session, method, new Section("7.11.5.b2"));
            status = false;
         }

         if (!throwsRemoteException(method))
         {
            fireSpecViolationEvent(session, method, new Section("7.11.5.b3"));
            status = false;
         }
      }

      // For each method defined in the remote interface, there MUST be
      // a matching method in the session bean's class. The matching
      // method MUST have:
      //
      //  - the same name
      //  - the same number and types of arguments, and the same
      //    return type
      //  - All the exceptions defined in the throws clause of the
      //    matching method of the session bean class must be defined
      //    in the throws clause of the method of the remote interface
      //
      // Spec 7.11.5
      //
      it = Arrays.asList(remote.getDeclaredMethods()).iterator();
      while (it.hasNext())
      {
         Method remoteMethod = (Method)it.next();

         if (!hasMatchingMethod(bean, remoteMethod))
         {
            fireSpecViolationEvent(session, remoteMethod,
                    new Section("7.11.5.d1"));

            status = false;
         }

         if (hasMatchingMethod(bean, remoteMethod))
         {
            try
            {
               Method beanMethod = bean.getMethod(remoteMethod.getName(),
                       remoteMethod.getParameterTypes());

               if (!hasMatchingReturnType(remoteMethod, beanMethod))
               {
                  fireSpecViolationEvent(session, remoteMethod,
                          new Section("7.11.5.d2"));
                  status = false;
               }

               if (!hasMatchingExceptions(beanMethod, remoteMethod))
               {
                  fireSpecViolationEvent(session, remoteMethod,
                          new Section("7.11.5.d3"));
                  status = false;
               }
            }
            catch (NoSuchMethodException ignored)
            {
View Full Code Here

      //
      // Spec 7.11.7
      //
      if (!hasEJBLocalObjectInterface(local))
      {
         fireSpecViolationEvent(session, new Section("7.11.7.a"));
         status = false;
      }

      // Methods defined in the local interface MUST NOT include
      // java.rmi.RemoteException in their throws clause.
      //
      // Spec 7.11.7
      //
      Iterator it = Arrays.asList(local.getMethods()).iterator();
      while (it.hasNext())
      {
         Method method = (Method)it.next();
         if (throwsRemoteException(method))
         {
            fireSpecViolationEvent(session, method, new Section("7.11.7.b"));
            status = false;
         }
      }

      // For each method defined in the local interface, there MUST be
      // a matching method in the session bean's class. The matching
      // method MUST have:
      //
      //  - the same name
      //  - the same number and types of arguments, and the same
      //    return type
      //  - All the exceptions defined in the throws clause of the
      //    matching method of the session bean class must be defined
      //    in the throws clause of the method of the remote interface
      //
      // Spec 7.11.7
      //
      it = Arrays.asList(local.getDeclaredMethods()).iterator();
      while (it.hasNext())
      {
         Method localMethod = (Method)it.next();

         if (!hasMatchingMethod(bean, localMethod))
         {
            fireSpecViolationEvent(session, localMethod,
                    new Section("7.11.7.d1"));
            status = false;
         }

         if (hasMatchingMethod(bean, localMethod))
         {
            try
            {
               Method beanMethod = bean.getMethod(localMethod.getName(),
                       localMethod.getParameterTypes());

               if (!hasMatchingReturnType(localMethod, beanMethod))
               {
                  fireSpecViolationEvent(session, localMethod,
                          new Section("7.11.7.d2"));
                  status = false;
               }

               if (!hasMatchingExceptions(beanMethod, localMethod))
               {
                  fireSpecViolationEvent(session, localMethod,
                          new Section("7.11.7.d3"));
                  status = false;
               }
            }
            catch (NoSuchMethodException ignored)
            {
View Full Code Here

      //
      // Spec 7.11.2
      //
      if (!hasSessionBeanInterface(bean))
      {
         fireSpecViolationEvent(session, new Section("7.11.2.a"));
         status = false;
      }

      // Only a stateful container-managed transaction demarcation
      // session bean MAY implement the SessionSynchronization
      // interface.
      //
      // A stateless Session bean MUST NOT implement the
      // SessionSynchronization interface.
      //
      // Spec 7.5.3
      //
      if (hasSessionSynchronizationInterface(bean))
      {
         if (session.isStateless())
         {
            fireSpecViolationEvent(session, new Section("7.5.3.a"));
            status = false;
         }

         if (session.isBeanManagedTx())
         {
            fireSpecViolationEvent(session, new Section("7.5.3.b"));
            status = false;
         }
      }

      //
      // A session bean MUST implement AT LEAST one ejbCreate method.
      //
      // Spec 7.11.3
      //
      if (!hasEJBCreateMethod(bean, true))
      {
         fireSpecViolationEvent(session, new Section("7.11.3"));
         status = false;
      }

      // A session with bean-managed transaction demarcation CANNOT
      // implement the SessionSynchronization interface.
      //
      // Spec 7.6.1 (table 2)
      //
      if (hasSessionSynchronizationInterface(bean)
              && session.isBeanManagedTx())
      {
         fireSpecViolationEvent(session, new Section("7.6.1"));
         status = false;
      }

      // The session bean class MUST be defined as public.
      //
      // Spec 7.11.2
      //
      if (!isPublic(bean))
      {
         fireSpecViolationEvent(session, new Section("7.11.2.b1"));
         status = false;
      }

      // The session bean class MUST NOT be final.
      //
      // Spec 7.11.2
      //
      if (isFinal(bean))
      {
         fireSpecViolationEvent(session, new Section("7.11.2.b2"));
         status = false;
      }

      // The session bean class MUST NOT be abstract.
      //
      // Spec 7.11.2
      //
      if (isAbstract(bean))
      {
         fireSpecViolationEvent(session, new Section("7.11.2.b3"));
         status = false;
      }

      // The session bean class MUST have a public constructor that
      // takes no arguments.
      //
      // Spec 7.11.2
      //
      if (!hasDefaultConstructor(bean))
      {
         fireSpecViolationEvent(session, new Section("7.11.2.c"));
         status = false;
      }

      // The session bean class MUST NOT define the finalize() method.
      //
      // Spec 7.11.2
      //
      if (hasFinalizer(bean))
      {
         fireSpecViolationEvent(session, new Section("7.11.2.d"));
         status = false;
      }

      // The ejbCreate(...) method signatures MUST follow these rules:
      //
      //      - The method name MUST have ejbCreate as its prefix
      //      - The method MUST be declared as public
      //      - The method MUST NOT be declared as final or static
      //      - The return type MUST be void
      //      - The method arguments MUST be legal types for RMI/IIOP
      //      - The method SHOULD not throw a java.rmi.RemoteException
      //        (NOTE we don't test for this as it's not a MUST)
      //
      // Spec 7.11.3
      //
      if (hasEJBCreateMethod(bean, true))
      {
         Iterator it = getEJBCreateMethods(bean);
         while (it.hasNext())
         {
            Method ejbCreate = (Method)it.next();

            if (!isPublic(ejbCreate))
            {
               fireSpecViolationEvent(session, ejbCreate,
                       new Section("7.11.3.b"));
               status = false;
            }

            if ((isFinal(ejbCreate)) || (isStatic(ejbCreate)))
            {
               fireSpecViolationEvent(session, ejbCreate,
                       new Section("7.11.3.c"));
               status = false;
            }

            if (!hasVoidReturnType(ejbCreate))
            {
               fireSpecViolationEvent(session, ejbCreate,
                       new Section("7.11.3.d"));
               status = false;
            }

            if (!hasLegalRMIIIOPArguments(ejbCreate))
            {
               fireSpecViolationEvent(session, ejbCreate,
                       new Section("7.11.3.e"));
               status = false;
            }
         }
      }
View Full Code Here

TOP

Related Classes of org.jboss.verifier.Section

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.