tests for j2ee checks.
This commit is contained in:
parent
192d09dfc0
commit
5cce308aec
|
|
@ -0,0 +1,20 @@
|
|||
package com.puppycrawl.tools.checkstyle.j2ee;
|
||||
|
||||
import javax.ejb.EntityBean;
|
||||
|
||||
/**
|
||||
* Test EntityBean
|
||||
*/
|
||||
public abstract class InputAbstractEntityBean
|
||||
implements EntityBean
|
||||
{
|
||||
|
||||
public InputAbstractEntityBean()
|
||||
{
|
||||
}
|
||||
|
||||
public Object ejbFindByPrimaryKey(Object aObject)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,83 @@
|
|||
package com.puppycrawl.tools.checkstyle.j2ee;
|
||||
|
||||
import java.rmi.RemoteException;
|
||||
|
||||
import javax.ejb.EJBException;
|
||||
import javax.ejb.EntityBean;
|
||||
import javax.ejb.EntityContext;
|
||||
import javax.ejb.RemoveException;
|
||||
|
||||
/**
|
||||
* Test EntityBean
|
||||
*/
|
||||
public class InputEntityBean
|
||||
implements EntityBean
|
||||
{
|
||||
|
||||
public InputEntityBean()
|
||||
{
|
||||
}
|
||||
|
||||
public Object thisMethod(Object aObject)
|
||||
{
|
||||
thisMethod(this);
|
||||
return this;
|
||||
}
|
||||
|
||||
static int sInt;
|
||||
/**
|
||||
* @see javax.ejb.EntityBean#setEntityContext(javax.ejb.EntityContext)
|
||||
*/
|
||||
public void setEntityContext(EntityContext arg0) throws EJBException, RemoteException {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @see javax.ejb.EntityBean#unsetEntityContext()
|
||||
*/
|
||||
public void unsetEntityContext() throws EJBException, RemoteException {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @see javax.ejb.EntityBean#ejbRemove()
|
||||
*/
|
||||
public void ejbRemove() throws RemoveException, EJBException, RemoteException {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @see javax.ejb.EntityBean#ejbActivate()
|
||||
*/
|
||||
public void ejbActivate() throws EJBException, RemoteException {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @see javax.ejb.EntityBean#ejbPassivate()
|
||||
*/
|
||||
public void ejbPassivate() throws EJBException, RemoteException {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @see javax.ejb.EntityBean#ejbLoad()
|
||||
*/
|
||||
public void ejbLoad() throws EJBException, RemoteException {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @see javax.ejb.EntityBean#ejbStore()
|
||||
*/
|
||||
public void ejbStore() throws EJBException, RemoteException {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,89 @@
|
|||
package com.puppycrawl.tools.checkstyle.j2ee;
|
||||
|
||||
import java.rmi.RemoteException;
|
||||
|
||||
import javax.ejb.EJBException;
|
||||
import javax.ejb.EntityBean;
|
||||
import javax.ejb.EntityContext;
|
||||
import javax.ejb.RemoveException;
|
||||
|
||||
/**
|
||||
* Test EntityBean
|
||||
*/
|
||||
public class InputEntityBeanCreate
|
||||
implements EntityBean
|
||||
{
|
||||
public InputEntityBeanCreate()
|
||||
{
|
||||
}
|
||||
|
||||
private final static void ejbCreateSomething()
|
||||
{
|
||||
}
|
||||
|
||||
public Object ejbFindByPrimaryKey(Object aObject)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public void ejbPostCreateSomething(int i)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @see javax.ejb.EntityBean#setEntityContext(javax.ejb.EntityContext)
|
||||
*/
|
||||
public void setEntityContext(EntityContext arg0) throws EJBException, RemoteException {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @see javax.ejb.EntityBean#unsetEntityContext()
|
||||
*/
|
||||
public void unsetEntityContext() throws EJBException, RemoteException {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @see javax.ejb.EntityBean#ejbRemove()
|
||||
*/
|
||||
public void ejbRemove() throws RemoveException, EJBException, RemoteException {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @see javax.ejb.EntityBean#ejbActivate()
|
||||
*/
|
||||
public void ejbActivate() throws EJBException, RemoteException {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @see javax.ejb.EntityBean#ejbPassivate()
|
||||
*/
|
||||
public void ejbPassivate() throws EJBException, RemoteException {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @see javax.ejb.EntityBean#ejbLoad()
|
||||
*/
|
||||
public void ejbLoad() throws EJBException, RemoteException {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @see javax.ejb.EntityBean#ejbStore()
|
||||
*/
|
||||
public void ejbStore() throws EJBException, RemoteException {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,85 @@
|
|||
package com.puppycrawl.tools.checkstyle.j2ee;
|
||||
|
||||
import java.rmi.RemoteException;
|
||||
|
||||
import javax.ejb.EJBException;
|
||||
import javax.ejb.EntityBean;
|
||||
import javax.ejb.EntityContext;
|
||||
import javax.ejb.RemoveException;
|
||||
|
||||
/**
|
||||
* Test EntityBean
|
||||
*/
|
||||
public class InputEntityBeanFind
|
||||
implements EntityBean
|
||||
{
|
||||
public InputEntityBeanFind()
|
||||
{
|
||||
}
|
||||
|
||||
private final static void ejbFindSomething()
|
||||
{
|
||||
}
|
||||
|
||||
public Object ejbFindByPrimaryKey(Object aObject)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see javax.ejb.EntityBean#setEntityContext(javax.ejb.EntityContext)
|
||||
*/
|
||||
public void setEntityContext(EntityContext arg0) throws EJBException, RemoteException {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @see javax.ejb.EntityBean#unsetEntityContext()
|
||||
*/
|
||||
public void unsetEntityContext() throws EJBException, RemoteException {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @see javax.ejb.EntityBean#ejbRemove()
|
||||
*/
|
||||
public void ejbRemove() throws RemoveException, EJBException, RemoteException {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @see javax.ejb.EntityBean#ejbActivate()
|
||||
*/
|
||||
public void ejbActivate() throws EJBException, RemoteException {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @see javax.ejb.EntityBean#ejbPassivate()
|
||||
*/
|
||||
public void ejbPassivate() throws EJBException, RemoteException {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @see javax.ejb.EntityBean#ejbLoad()
|
||||
*/
|
||||
public void ejbLoad() throws EJBException, RemoteException {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @see javax.ejb.EntityBean#ejbStore()
|
||||
*/
|
||||
public void ejbStore() throws EJBException, RemoteException {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,86 @@
|
|||
package com.puppycrawl.tools.checkstyle.j2ee;
|
||||
|
||||
import java.rmi.RemoteException;
|
||||
|
||||
import javax.ejb.EJBException;
|
||||
import javax.ejb.EntityBean;
|
||||
import javax.ejb.EntityContext;
|
||||
import javax.ejb.RemoveException;
|
||||
|
||||
/**
|
||||
* Test EntityBean
|
||||
*/
|
||||
public class InputEntityBeanHome
|
||||
implements EntityBean
|
||||
{
|
||||
public InputEntityBeanHome()
|
||||
{
|
||||
}
|
||||
|
||||
private final static void ejbHomeSomething()
|
||||
throws RemoteException
|
||||
{
|
||||
}
|
||||
|
||||
public Object ejbFindByPrimaryKey(Object aObject)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see javax.ejb.EntityBean#setEntityContext(javax.ejb.EntityContext)
|
||||
*/
|
||||
public void setEntityContext(EntityContext arg0) throws EJBException, RemoteException {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @see javax.ejb.EntityBean#unsetEntityContext()
|
||||
*/
|
||||
public void unsetEntityContext() throws EJBException, RemoteException {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @see javax.ejb.EntityBean#ejbRemove()
|
||||
*/
|
||||
public void ejbRemove() throws RemoveException, EJBException, RemoteException {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @see javax.ejb.EntityBean#ejbActivate()
|
||||
*/
|
||||
public void ejbActivate() throws EJBException, RemoteException {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @see javax.ejb.EntityBean#ejbPassivate()
|
||||
*/
|
||||
public void ejbPassivate() throws EJBException, RemoteException {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @see javax.ejb.EntityBean#ejbLoad()
|
||||
*/
|
||||
public void ejbLoad() throws EJBException, RemoteException {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @see javax.ejb.EntityBean#ejbStore()
|
||||
*/
|
||||
public void ejbStore() throws EJBException, RemoteException {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,116 @@
|
|||
package com.puppycrawl.tools.checkstyle.j2ee;
|
||||
|
||||
import java.rmi.RemoteException;
|
||||
|
||||
import javax.ejb.EJBException;
|
||||
import javax.ejb.EntityBean;
|
||||
import javax.ejb.EntityContext;
|
||||
import javax.ejb.RemoveException;
|
||||
|
||||
/**
|
||||
* Test EntityBean
|
||||
*/
|
||||
public class InputEntityBeanMatchEjbCreate
|
||||
implements EntityBean
|
||||
{
|
||||
|
||||
public InputEntityBeanMatchEjbCreate ejbCreate()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public InputEntityBeanMatchEjbCreate ejbCreate(int i)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public void ejbPostCreate(long i)
|
||||
{
|
||||
}
|
||||
|
||||
public InputEntityBeanMatchEjbCreate ejbCreateThing(int i)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public void ejbPostCreatething(int i)
|
||||
{
|
||||
}
|
||||
|
||||
public InputEntityBeanMatchEjbCreate ejbCreateInteger(java.lang.Integer i)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public void ejbPostCreateInteger(java.lang.Integer i)
|
||||
{
|
||||
}
|
||||
|
||||
public InputEntityBeanMatchEjbCreate ejbCreateInteger(java.lang.Integer i,
|
||||
long x)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public void ejbPostCreateInteger(java.lang.Integer i,
|
||||
double x)
|
||||
{
|
||||
}
|
||||
/**
|
||||
* @see javax.ejb.EntityBean#setEntityContext(javax.ejb.EntityContext)
|
||||
*/
|
||||
public void setEntityContext(EntityContext arg0) throws EJBException, RemoteException {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @see javax.ejb.EntityBean#unsetEntityContext()
|
||||
*/
|
||||
public void unsetEntityContext() throws EJBException, RemoteException {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @see javax.ejb.EntityBean#ejbRemove()
|
||||
*/
|
||||
public void ejbRemove() throws RemoveException, EJBException, RemoteException {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @see javax.ejb.EntityBean#ejbActivate()
|
||||
*/
|
||||
public void ejbActivate() throws EJBException, RemoteException {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @see javax.ejb.EntityBean#ejbPassivate()
|
||||
*/
|
||||
public void ejbPassivate() throws EJBException, RemoteException {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @see javax.ejb.EntityBean#ejbLoad()
|
||||
*/
|
||||
public void ejbLoad() throws EJBException, RemoteException {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @see javax.ejb.EntityBean#ejbStore()
|
||||
*/
|
||||
public void ejbStore() throws EJBException, RemoteException {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,86 @@
|
|||
package com.puppycrawl.tools.checkstyle.j2ee;
|
||||
|
||||
import java.rmi.RemoteException;
|
||||
|
||||
import javax.ejb.EJBException;
|
||||
import javax.ejb.EntityBean;
|
||||
import javax.ejb.EntityContext;
|
||||
import javax.ejb.RemoveException;
|
||||
|
||||
/**
|
||||
* Test EntityBean
|
||||
*/
|
||||
public class InputEntityBeanPostCreate
|
||||
implements EntityBean
|
||||
{
|
||||
public InputEntityBeanPostCreate()
|
||||
{
|
||||
}
|
||||
|
||||
private final static Object ejbPostCreateSomething()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public Object ejbFindByPrimaryKey(Object aObject)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see javax.ejb.EntityBean#setEntityContext(javax.ejb.EntityContext)
|
||||
*/
|
||||
public void setEntityContext(EntityContext arg0) throws EJBException, RemoteException {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @see javax.ejb.EntityBean#unsetEntityContext()
|
||||
*/
|
||||
public void unsetEntityContext() throws EJBException, RemoteException {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @see javax.ejb.EntityBean#ejbRemove()
|
||||
*/
|
||||
public void ejbRemove() throws RemoveException, EJBException, RemoteException {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @see javax.ejb.EntityBean#ejbActivate()
|
||||
*/
|
||||
public void ejbActivate() throws EJBException, RemoteException {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @see javax.ejb.EntityBean#ejbPassivate()
|
||||
*/
|
||||
public void ejbPassivate() throws EJBException, RemoteException {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @see javax.ejb.EntityBean#ejbLoad()
|
||||
*/
|
||||
public void ejbLoad() throws EJBException, RemoteException {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @see javax.ejb.EntityBean#ejbStore()
|
||||
*/
|
||||
public void ejbStore() throws EJBException, RemoteException {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
package com.puppycrawl.tools.checkstyle.j2ee;
|
||||
|
||||
import java.rmi.RemoteException;
|
||||
|
||||
import javax.ejb.CreateException;
|
||||
import javax.ejb.EJBHome;
|
||||
import javax.ejb.FinderException;
|
||||
|
||||
/**
|
||||
* test for LocalHomeInterfaceCheck
|
||||
* @author Rick Giles
|
||||
*
|
||||
*/
|
||||
public interface InputHomeInterface
|
||||
extends EJBHome
|
||||
{
|
||||
public Integer createInteger(int aParam)
|
||||
throws CreateException, RemoteException;
|
||||
|
||||
abstract void createSomething(int aParam);
|
||||
|
||||
abstract void findSomething(int aParam);
|
||||
|
||||
public Integer findInteger(int aParam)
|
||||
throws FinderException, RemoteException;
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
package com.puppycrawl.tools.checkstyle.j2ee;
|
||||
|
||||
import javax.ejb.CreateException;
|
||||
import javax.ejb.FinderException;
|
||||
|
||||
/**
|
||||
* test for LocalHomeInterfaceCheck
|
||||
* @author Rick Giles
|
||||
*
|
||||
*/
|
||||
public interface InputLocalHomeInterface
|
||||
extends javax.ejb.EJBLocalHome
|
||||
{
|
||||
public Integer createInteger(int aParam)
|
||||
throws CreateException;
|
||||
|
||||
abstract void createSomething(int aParam);
|
||||
|
||||
abstract void findSomething(int aParam);
|
||||
|
||||
public Integer findInteger(int aParam)
|
||||
throws FinderException;
|
||||
|
||||
public void method() throws java.rmi.RemoteException;
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
package com.puppycrawl.tools.checkstyle.j2ee;
|
||||
|
||||
import javax.ejb.EJBLocalHome;
|
||||
import javax.ejb.FinderException;
|
||||
|
||||
/**
|
||||
* test for RemoteHomeInterfaceCheck
|
||||
* @author Rick Giles
|
||||
*
|
||||
*/
|
||||
public interface InputLocalHomeInterfaceDuplicateFind
|
||||
extends EJBLocalHome
|
||||
{
|
||||
public Object findByPrimaryKey(Object aParam)
|
||||
throws FinderException;
|
||||
|
||||
public Object findByPrimaryKey()
|
||||
throws FinderException;
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
package com.puppycrawl.tools.checkstyle.j2ee;
|
||||
|
||||
import javax.ejb.EJBLocalHome;
|
||||
import javax.ejb.FinderException;
|
||||
|
||||
/**
|
||||
* test for RemoteHomeInterfaceCheck
|
||||
* @author Rick Giles
|
||||
*
|
||||
*/
|
||||
public interface InputLocalHomeInterfaceNoFind
|
||||
extends EJBLocalHome
|
||||
{
|
||||
public Object findByPrimaryKey(Object aParam, Object aParam2)
|
||||
throws FinderException;
|
||||
|
||||
public Object findByPrimaryKey()
|
||||
throws FinderException;
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
package com.puppycrawl.tools.checkstyle.j2ee;
|
||||
|
||||
import java.rmi.RemoteException;
|
||||
|
||||
import javax.ejb.EJBLocalObject;
|
||||
|
||||
/**
|
||||
* test for RemoteInterfaceCheck
|
||||
* @author Rick Giles
|
||||
*
|
||||
*/
|
||||
public interface InputLocalInterface
|
||||
extends EJBLocalObject
|
||||
{
|
||||
public void invalid1()
|
||||
throws RemoteException;
|
||||
|
||||
public void invalid2()
|
||||
throws java.rmi.RemoteException;
|
||||
|
||||
public void valid()
|
||||
throws Exception;
|
||||
}
|
||||
|
|
@ -0,0 +1,98 @@
|
|||
package com.puppycrawl.tools.checkstyle.j2ee;
|
||||
|
||||
import javax.ejb.EJBException;
|
||||
import javax.ejb.MessageDrivenBean;
|
||||
import javax.ejb.MessageDrivenContext;
|
||||
import javax.jms.Message;
|
||||
import javax.jms.MessageListener;
|
||||
|
||||
/**
|
||||
* Test MessageBeanCheck
|
||||
*/
|
||||
public class InputMessageBean
|
||||
implements MessageDrivenBean, MessageListener
|
||||
{
|
||||
|
||||
/**
|
||||
* @see javax.ejb.MessageDrivenBean#setMessageDrivenContext(javax.ejb.MessageDrivenContext)
|
||||
*/
|
||||
public void setMessageDrivenContext(MessageDrivenContext arg0) throws EJBException {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @see javax.ejb.MessageDrivenBean#ejbRemove()
|
||||
*/
|
||||
public void ejbRemove() throws EJBException {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @see javax.jms.MessageListener#onMessage(javax.jms.Message)
|
||||
*/
|
||||
public void onMessage(Message arg0) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
abstract class AbstractMessageBean
|
||||
implements MessageDrivenBean, MessageListener
|
||||
{
|
||||
public AbstractMessageBean()
|
||||
{
|
||||
}
|
||||
|
||||
public void ejbCreate()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
final class FinalMessageBean
|
||||
implements javax.ejb.MessageDrivenBean, javax.jms.MessageListener
|
||||
{
|
||||
public FinalMessageBean()
|
||||
{
|
||||
}
|
||||
|
||||
public Object method()
|
||||
{
|
||||
this.equals("");
|
||||
"".equals(this);
|
||||
return this;
|
||||
}
|
||||
|
||||
protected static final int ejbCreate(int i)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
/**
|
||||
* @see javax.ejb.MessageDrivenBean#setMessageDrivenContext(javax.ejb.MessageDrivenContext)
|
||||
*/
|
||||
public void setMessageDrivenContext(MessageDrivenContext arg0) throws EJBException {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @see javax.ejb.MessageDrivenBean#ejbRemove()
|
||||
*/
|
||||
public void ejbRemove() throws EJBException {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @see javax.jms.MessageListener#onMessage(javax.jms.Message)
|
||||
*/
|
||||
public void onMessage(Message arg0) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
public void ejbCreate()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
package com.puppycrawl.tools.checkstyle.j2ee;
|
||||
|
||||
import javax.ejb.EJBException;
|
||||
import javax.ejb.MessageDrivenBean;
|
||||
import javax.ejb.MessageDrivenContext;
|
||||
import javax.jms.Message;
|
||||
import javax.jms.MessageListener;
|
||||
|
||||
/**
|
||||
* Test MessageBeanCheck
|
||||
*/
|
||||
public class InputMessageBean2
|
||||
implements MessageDrivenBean, MessageListener
|
||||
{
|
||||
public InputMessageBean2()
|
||||
{
|
||||
}
|
||||
|
||||
public void ejbCreate()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @see javax.ejb.MessageDrivenBean#setMessageDrivenContext(javax.ejb.MessageDrivenContext)
|
||||
*/
|
||||
public void setMessageDrivenContext(MessageDrivenContext arg0) throws EJBException {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @see javax.ejb.MessageDrivenBean#ejbRemove()
|
||||
*/
|
||||
public void ejbRemove() throws EJBException {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @see javax.jms.MessageListener#onMessage(javax.jms.Message)
|
||||
*/
|
||||
public void onMessage(Message arg0) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
package com.puppycrawl.tools.checkstyle.j2ee;
|
||||
|
||||
import java.rmi.RemoteException;
|
||||
|
||||
import javax.ejb.CreateException;
|
||||
import javax.ejb.EJBHome;
|
||||
import javax.ejb.FinderException;
|
||||
|
||||
/**
|
||||
* test for RemoteHomeInterfaceCheck
|
||||
* @author Rick Giles
|
||||
*
|
||||
*/
|
||||
public interface InputRemoteHomeInterface
|
||||
extends EJBHome
|
||||
{
|
||||
public Integer createInteger(int aParam)
|
||||
throws CreateException, RemoteException;
|
||||
|
||||
abstract void createSomething(int aParam);
|
||||
|
||||
abstract void findSomething(int aParam);
|
||||
|
||||
public Integer findInteger(int aParam)
|
||||
throws FinderException, RemoteException;
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
package com.puppycrawl.tools.checkstyle.j2ee;
|
||||
|
||||
import java.rmi.RemoteException;
|
||||
|
||||
import javax.ejb.EJBHome;
|
||||
import javax.ejb.FinderException;
|
||||
|
||||
/**
|
||||
* test for RemoteHomeInterfaceCheck
|
||||
* @author Rick Giles
|
||||
*
|
||||
*/
|
||||
public interface InputRemoteHomeInterfaceDuplicateFind
|
||||
extends EJBHome
|
||||
{
|
||||
public Object findByPrimaryKey(Object aParam)
|
||||
throws FinderException, RemoteException;
|
||||
|
||||
public Object findByPrimaryKey()
|
||||
throws FinderException, RemoteException;
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
package com.puppycrawl.tools.checkstyle.j2ee;
|
||||
|
||||
import java.rmi.RemoteException;
|
||||
|
||||
import javax.ejb.EJBHome;
|
||||
import javax.ejb.FinderException;
|
||||
|
||||
/**
|
||||
* test for RemoteHomeInterfaceCheck
|
||||
* @author Rick Giles
|
||||
*
|
||||
*/
|
||||
public interface InputRemoteHomeInterfaceNoFind
|
||||
extends EJBHome
|
||||
{
|
||||
public Object findByPrimaryKey(Object aParam, Object aParam2)
|
||||
throws FinderException, RemoteException;
|
||||
|
||||
public Object findByPrimaryKey()
|
||||
throws FinderException, RemoteException;
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
package com.puppycrawl.tools.checkstyle.j2ee;
|
||||
|
||||
import java.rmi.RemoteException;
|
||||
|
||||
import javax.ejb.EJBObject;
|
||||
|
||||
/**
|
||||
* test for RemoteInterfaceCheck
|
||||
* @author Rick Giles
|
||||
*
|
||||
*/
|
||||
public interface InputRemoteInterface
|
||||
extends EJBObject
|
||||
{
|
||||
public void valid1()
|
||||
throws RemoteException;
|
||||
|
||||
public void valid2()
|
||||
throws java.rmi.RemoteException;
|
||||
|
||||
public void invalid()
|
||||
throws Exception;
|
||||
}
|
||||
|
|
@ -0,0 +1,115 @@
|
|||
package com.puppycrawl.tools.checkstyle.j2ee;
|
||||
|
||||
import java.rmi.RemoteException;
|
||||
|
||||
import javax.ejb.EJBException;
|
||||
import javax.ejb.SessionBean;
|
||||
import javax.ejb.SessionContext;
|
||||
|
||||
/**
|
||||
* SessionBean test
|
||||
*/
|
||||
public class InputSessionBean
|
||||
implements SessionBean
|
||||
{
|
||||
/**
|
||||
* @see javax.ejb.SessionBean#setSessionContext(javax.ejb.SessionContext)
|
||||
*/
|
||||
public void setSessionContext(SessionContext arg0) throws EJBException, RemoteException {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @see javax.ejb.SessionBean#ejbRemove()
|
||||
*/
|
||||
public void ejbRemove() throws EJBException, RemoteException {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @see javax.ejb.SessionBean#ejbActivate()
|
||||
*/
|
||||
public void ejbActivate() throws EJBException, RemoteException {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @see javax.ejb.SessionBean#ejbPassivate()
|
||||
*/
|
||||
public void ejbPassivate() throws EJBException, RemoteException {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
public void finalize(int i)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
abstract class AbstractSessionBean
|
||||
implements SessionBean
|
||||
{
|
||||
}
|
||||
|
||||
final class FinalSessionBean
|
||||
implements SessionBean
|
||||
{
|
||||
public FinalSessionBean()
|
||||
{
|
||||
}
|
||||
|
||||
public void ejbCreate(int aInt)
|
||||
{
|
||||
}
|
||||
|
||||
public void ejbPostCreate(int aInt)
|
||||
{
|
||||
}
|
||||
|
||||
public Object method()
|
||||
{
|
||||
this.equals("");
|
||||
"".equals(this);
|
||||
return this;
|
||||
}
|
||||
|
||||
public void finalize()
|
||||
{
|
||||
}
|
||||
/**
|
||||
* @see javax.ejb.SessionBean#setSessionContext(javax.ejb.SessionContext)
|
||||
*/
|
||||
public void setSessionContext(SessionContext arg0) throws EJBException, RemoteException {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @see javax.ejb.SessionBean#ejbRemove()
|
||||
*/
|
||||
public void ejbRemove() throws EJBException, RemoteException {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @see javax.ejb.SessionBean#ejbActivate()
|
||||
*/
|
||||
public void ejbActivate() throws EJBException, RemoteException {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @see javax.ejb.SessionBean#ejbPassivate()
|
||||
*/
|
||||
public void ejbPassivate() throws EJBException, RemoteException {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,171 @@
|
|||
package com.puppycrawl.tools.checkstyle.checks.j2ee;
|
||||
import com.puppycrawl.tools.checkstyle.BaseCheckTestCase;
|
||||
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
|
||||
import com.puppycrawl.tools.checkstyle.checks.j2ee.EntityBeanCheck;
|
||||
import com.puppycrawl.tools.checkstyle.checks.j2ee.PersistenceOption;
|
||||
|
||||
public class EntityBeanCheckTest extends BaseCheckTestCase
|
||||
{
|
||||
public void testDefaultBean()
|
||||
throws Exception
|
||||
{
|
||||
final DefaultConfiguration checkConfig =
|
||||
createCheckConfig(EntityBeanCheck.class);
|
||||
final String[] expected = {
|
||||
};
|
||||
verify(checkConfig, getPath("j2ee/InputEntityBean.java"), expected);
|
||||
}
|
||||
|
||||
public void testMixedBean()
|
||||
throws Exception
|
||||
{
|
||||
final DefaultConfiguration checkConfig =
|
||||
createCheckConfig(EntityBeanCheck.class);
|
||||
checkConfig.addAttribute("persistence",
|
||||
PersistenceOption.MIXED.toString());
|
||||
final String[] expected = {
|
||||
};
|
||||
verify(checkConfig, getPath("j2ee/InputEntityBean.java"), expected);
|
||||
}
|
||||
|
||||
public void testBeanBean()
|
||||
throws Exception
|
||||
{
|
||||
final DefaultConfiguration checkConfig =
|
||||
createCheckConfig(EntityBeanCheck.class);
|
||||
checkConfig.addAttribute("persistence",
|
||||
PersistenceOption.BEAN.toString());
|
||||
final String[] expected = {
|
||||
"13:14: Entity bean 'InputEntityBean' must have method 'ejbFindByPrimaryKey'.",
|
||||
};
|
||||
verify(checkConfig, getPath("j2ee/InputEntityBean.java"), expected);
|
||||
}
|
||||
|
||||
public void testAbstractBean()
|
||||
throws Exception
|
||||
{
|
||||
final DefaultConfiguration checkConfig =
|
||||
createCheckConfig(EntityBeanCheck.class);
|
||||
final String[] expected = {
|
||||
};
|
||||
verify(checkConfig, getPath("j2ee/InputAbstractEntityBean.java"), expected);
|
||||
checkConfig.addAttribute("persistence",
|
||||
PersistenceOption.CONTAINER.toString());
|
||||
verify(checkConfig, getPath("j2ee/InputAbstractEntityBean.java"), expected);
|
||||
}
|
||||
|
||||
public void testAbstractBeanBean()
|
||||
throws Exception
|
||||
{
|
||||
final DefaultConfiguration checkConfig =
|
||||
createCheckConfig(EntityBeanCheck.class);
|
||||
checkConfig.addAttribute("persistence",
|
||||
PersistenceOption.BEAN.toString());
|
||||
final String[] expected = {
|
||||
"8:23: Entity bean 'InputAbstractEntityBean' must not be abstract.",
|
||||
};
|
||||
verify(checkConfig, getPath("j2ee/InputAbstractEntityBean.java"), expected);
|
||||
}
|
||||
|
||||
public void testContainerBean()
|
||||
throws Exception
|
||||
{
|
||||
final DefaultConfiguration checkConfig =
|
||||
createCheckConfig(EntityBeanCheck.class);
|
||||
checkConfig.addAttribute("persistence",
|
||||
PersistenceOption.CONTAINER.toString());
|
||||
final String[] expected = {
|
||||
"13:14: Entity bean 'InputEntityBean' must be abstract.",
|
||||
};
|
||||
verify(checkConfig, getPath("j2ee/InputEntityBean.java"), expected);
|
||||
}
|
||||
|
||||
public void testCreate()
|
||||
throws Exception
|
||||
{
|
||||
final DefaultConfiguration checkConfig =
|
||||
createCheckConfig(EntityBeanCheck.class);
|
||||
final String[] expected = {
|
||||
"20:31: Method 'ejbCreateSomething' must be non-void.",
|
||||
"20:31: Method 'ejbCreateSomething' must be public.",
|
||||
"20:31: Method 'ejbCreateSomething' must have a matching 'ejbPostCreateSomething' method.",
|
||||
"20:31: Method 'ejbCreateSomething' must not have modifier 'final'.",
|
||||
"20:31: Method 'ejbCreateSomething' must not have modifier 'static'.",
|
||||
};
|
||||
// default (MIXED) persistence
|
||||
verify(checkConfig, getPath("j2ee/InputEntityBeanCreate.java"), expected);
|
||||
// bean-managed persistence
|
||||
checkConfig.addAttribute(
|
||||
"persistence",
|
||||
PersistenceOption.BEAN.toString());
|
||||
verify(checkConfig, getPath("j2ee/InputEntityBeanCreate.java"), expected);
|
||||
// // container-managed persistence
|
||||
// checkConfig.addAttribute(
|
||||
// "persistence",
|
||||
// PersistenceOption.CONTAINER.toString());
|
||||
// verify(checkConfig, getPath("InputEntityBeanCreate.java"), expected);
|
||||
}
|
||||
|
||||
public void testPostCreate()
|
||||
throws Exception
|
||||
{
|
||||
final DefaultConfiguration checkConfig =
|
||||
createCheckConfig(EntityBeanCheck.class);
|
||||
final String[] expected = {
|
||||
"20:33: Method 'ejbPostCreateSomething' must be public.",
|
||||
"20:33: Method 'ejbPostCreateSomething' must be void.",
|
||||
"20:33: Method 'ejbPostCreateSomething' must not have modifier 'final'.",
|
||||
"20:33: Method 'ejbPostCreateSomething' must not have modifier 'static'.",
|
||||
};
|
||||
verify(checkConfig, getPath("j2ee/InputEntityBeanPostCreate.java"), expected);
|
||||
// bean-managed persistence
|
||||
checkConfig.addAttribute(
|
||||
"persistence",
|
||||
PersistenceOption.BEAN.toString());
|
||||
verify(checkConfig, getPath("j2ee/InputEntityBeanPostCreate.java"), expected);
|
||||
// // container-managed persistence
|
||||
// checkConfig.addAttribute(
|
||||
// "persistence",
|
||||
// PersistenceOption.CONTAINER.toString());
|
||||
// verify(checkConfig, getPath("InputEntityBeanCreate.java"), expected);
|
||||
}
|
||||
|
||||
public void testHome()
|
||||
throws Exception
|
||||
{
|
||||
final DefaultConfiguration checkConfig =
|
||||
createCheckConfig(EntityBeanCheck.class);
|
||||
final String[] expected = {
|
||||
"20:31: Method 'ejbHomeSomething' must be public.",
|
||||
"20:31: Method 'ejbHomeSomething' must not have modifier 'static'.",
|
||||
"20:31: Method 'ejbHomeSomething' must not throw 'java.rmi.RemoteException'.",
|
||||
};
|
||||
// default (MIXED) persistence
|
||||
verify(checkConfig, getPath("j2ee/InputEntityBeanHome.java"), expected);
|
||||
// bean-managed persistence
|
||||
checkConfig.addAttribute(
|
||||
"persistence",
|
||||
PersistenceOption.BEAN.toString());
|
||||
verify(checkConfig, getPath("j2ee/InputEntityBeanHome.java"), expected);
|
||||
// // container-managed persistence
|
||||
// checkConfig.addAttribute(
|
||||
// "persistence",
|
||||
// PersistenceOption.CONTAINER.toString());
|
||||
// verify(checkConfig, getPath("InputEntityBeanHome.java"), expected);
|
||||
}
|
||||
public void testFind()
|
||||
throws Exception
|
||||
{
|
||||
final DefaultConfiguration checkConfig =
|
||||
createCheckConfig(EntityBeanCheck.class);
|
||||
checkConfig.addAttribute("persistence",
|
||||
PersistenceOption.BEAN.toString());
|
||||
final String[] expected = {
|
||||
"20:31: Method 'ejbFindSomething' must be non-void.",
|
||||
"20:31: Method 'ejbFindSomething' must be public.",
|
||||
"20:31: Method 'ejbFindSomething' must not have modifier 'final'.",
|
||||
"20:31: Method 'ejbFindSomething' must not have modifier 'static'.",
|
||||
};
|
||||
verify(checkConfig, getPath("j2ee/InputEntityBeanFind.java"), expected);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
package com.puppycrawl.tools.checkstyle.checks.j2ee;
|
||||
import com.puppycrawl.tools.checkstyle.BaseCheckTestCase;
|
||||
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
|
||||
import com.puppycrawl.tools.checkstyle.checks.j2ee.FinalStaticCheck;
|
||||
|
||||
public class FinalStaticCheckTest extends BaseCheckTestCase
|
||||
{
|
||||
public void testDefault()
|
||||
throws Exception
|
||||
{
|
||||
final DefaultConfiguration checkConfig =
|
||||
createCheckConfig(FinalStaticCheck.class);
|
||||
final String[] expected = {
|
||||
"27:16: Static field 'sInt' should be final.",
|
||||
};
|
||||
verify(checkConfig, getPath("j2ee/InputEntityBean.java"), expected);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
package com.puppycrawl.tools.checkstyle.checks.j2ee;
|
||||
import com.puppycrawl.tools.checkstyle.BaseCheckTestCase;
|
||||
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
|
||||
import com.puppycrawl.tools.checkstyle.checks.j2ee.RemoteHomeInterfaceCheck;
|
||||
|
||||
public class HomeInterfaceCheckTest extends BaseCheckTestCase
|
||||
{
|
||||
public void testDefault()
|
||||
throws Exception
|
||||
{
|
||||
final DefaultConfiguration checkConfig =
|
||||
createCheckConfig(RemoteHomeInterfaceCheck.class);
|
||||
final String[] expected = {
|
||||
"14:18: Home interface must have method findByPrimaryKey.",
|
||||
"20:19: Method createSomething must be non-void.",
|
||||
"20:19: Method createSomething must be public.",
|
||||
"20:19: Method createSomething must throw java.rmi.RemoteException.",
|
||||
"20:19: Method createSomething must throw javax.ejb.CreateException.",
|
||||
"22:19: Method findSomething must be non-void.",
|
||||
"22:19: Method findSomething must be public.",
|
||||
"22:19: Method findSomething must throw java.rmi.RemoteException.",
|
||||
"22:19: Method findSomething must throw javax.ejb.FinderException.",
|
||||
};
|
||||
verify(checkConfig, getPath("j2ee/InputHomeInterface.java"), expected);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
package com.puppycrawl.tools.checkstyle.checks.j2ee;
|
||||
import com.puppycrawl.tools.checkstyle.BaseCheckTestCase;
|
||||
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
|
||||
import com.puppycrawl.tools.checkstyle.checks.j2ee.LocalHomeInterfaceCheck;
|
||||
|
||||
public class LocalHomeInterfaceCheckTest extends BaseCheckTestCase
|
||||
{
|
||||
public void testDefault()
|
||||
throws Exception
|
||||
{
|
||||
final DefaultConfiguration checkConfig =
|
||||
createCheckConfig(LocalHomeInterfaceCheck.class);
|
||||
final String[] expected = {
|
||||
"11:18: Home interface 'InputLocalHomeInterface' must have method 'findByPrimaryKey()'.",
|
||||
"17:19: Method 'createSomething' must be non-void.",
|
||||
"17:19: Method 'createSomething' must throw 'javax.ejb.CreateException'.",
|
||||
"19:19: Method 'findSomething' must be non-void.",
|
||||
"19:19: Method 'findSomething' must throw 'javax.ejb.FinderException'.",
|
||||
"24:17: Method 'method' must not throw 'java.rmi.RemoteException'.",
|
||||
};
|
||||
verify(checkConfig, getPath("j2ee/InputLocalHomeInterface.java"), expected);
|
||||
}
|
||||
|
||||
public void testDuplicateFind() throws Exception
|
||||
{
|
||||
final DefaultConfiguration checkConfig =
|
||||
createCheckConfig(LocalHomeInterfaceCheck.class);
|
||||
final String[] expected =
|
||||
{
|
||||
"17:19: Home interface can have only one 'findByPrimaryKey()' method.",
|
||||
"17:19: Method 'findByPrimaryKey' must have 1 parameter(s).",
|
||||
};
|
||||
verify(
|
||||
checkConfig,
|
||||
getPath("j2ee/InputLocalHomeInterfaceDuplicateFind.java"),
|
||||
expected);
|
||||
}
|
||||
|
||||
public void testNoFind() throws Exception
|
||||
{
|
||||
final DefaultConfiguration checkConfig =
|
||||
createCheckConfig(LocalHomeInterfaceCheck.class);
|
||||
final String[] expected =
|
||||
{
|
||||
"14:19: Method 'findByPrimaryKey' must have 1 parameter(s).",
|
||||
"17:19: Home interface can have only one 'findByPrimaryKey()' method.",
|
||||
"17:19: Method 'findByPrimaryKey' must have 1 parameter(s).",
|
||||
};
|
||||
verify(
|
||||
checkConfig,
|
||||
getPath("j2ee/InputLocalHomeInterfaceNoFind.java"),
|
||||
expected);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
package com.puppycrawl.tools.checkstyle.checks.j2ee;
|
||||
import com.puppycrawl.tools.checkstyle.BaseCheckTestCase;
|
||||
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
|
||||
import com.puppycrawl.tools.checkstyle.checks.j2ee.LocalInterfaceCheck;
|
||||
|
||||
public class LocalInterfaceCheckTest extends BaseCheckTestCase
|
||||
{
|
||||
public void testDefault()
|
||||
throws Exception
|
||||
{
|
||||
final DefaultConfiguration checkConfig =
|
||||
createCheckConfig(LocalInterfaceCheck.class);
|
||||
final String[] expected = {
|
||||
"15:17: Method 'invalid1' must not throw 'java.rmi.RemoteException'.",
|
||||
"18:17: Method 'invalid2' must not throw 'java.rmi.RemoteException'.",
|
||||
};
|
||||
verify(checkConfig, getPath("j2ee/InputLocalInterface.java"), expected);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
package com.puppycrawl.tools.checkstyle.checks.j2ee;
|
||||
import com.puppycrawl.tools.checkstyle.BaseCheckTestCase;
|
||||
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
|
||||
import com.puppycrawl.tools.checkstyle.checks.j2ee.MessageBeanCheck;
|
||||
|
||||
public class MessageBeanCheckTest extends BaseCheckTestCase
|
||||
{
|
||||
public void testDefault()
|
||||
throws Exception
|
||||
{
|
||||
final DefaultConfiguration checkConfig =
|
||||
createCheckConfig(MessageBeanCheck.class);
|
||||
final String[] expected = {
|
||||
"12:14: Message bean 'InputMessageBean' must have a public constructor with no parameters.",
|
||||
"12:14: Message bean 'InputMessageBean' must have method 'ejbCreate()'.",
|
||||
"41:16: Message bean 'AbstractMessageBean' must be public.",
|
||||
"41:16: Message bean 'AbstractMessageBean' must not have modifier 'abstract'.",
|
||||
"53:13: Message bean 'FinalMessageBean' must be public.",
|
||||
"53:13: Message bean 'FinalMessageBean' must not have modifier 'final'.",
|
||||
"67:32: Method 'ejbCreate' must be public.",
|
||||
"67:32: Method 'ejbCreate' must be void.",
|
||||
"67:32: Method 'ejbCreate' must have 0 parameter(s).",
|
||||
"67:32: Method 'ejbCreate' must not have modifier 'final'.",
|
||||
"67:32: Method 'ejbCreate' must not have modifier 'static'.",
|
||||
};
|
||||
verify(checkConfig, getPath("j2ee/InputMessageBean.java"), expected);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
package com.puppycrawl.tools.checkstyle.checks.j2ee;
|
||||
import com.puppycrawl.tools.checkstyle.BaseCheckTestCase;
|
||||
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
|
||||
import com.puppycrawl.tools.checkstyle.checks.j2ee.RemoteHomeInterfaceCheck;
|
||||
|
||||
public class RemoteHomeInterfaceCheckTest extends BaseCheckTestCase
|
||||
{
|
||||
public void testDefault()
|
||||
throws Exception
|
||||
{
|
||||
final DefaultConfiguration checkConfig =
|
||||
createCheckConfig(RemoteHomeInterfaceCheck.class);
|
||||
final String[] expected = {
|
||||
"14:18: Home interface 'InputRemoteHomeInterface' must have method 'findByPrimaryKey()'.",
|
||||
"20:19: Method 'createSomething' must be non-void.",
|
||||
"20:19: Method 'createSomething' must throw 'java.rmi.RemoteException'.",
|
||||
"20:19: Method 'createSomething' must throw 'javax.ejb.CreateException'.",
|
||||
"22:19: Method 'findSomething' must be non-void.",
|
||||
"22:19: Method 'findSomething' must throw 'java.rmi.RemoteException'.",
|
||||
"22:19: Method 'findSomething' must throw 'javax.ejb.FinderException'.",
|
||||
};
|
||||
verify(checkConfig, getPath("j2ee/InputRemoteHomeInterface.java"), expected);
|
||||
}
|
||||
|
||||
public void testDuplicateFind() throws Exception
|
||||
{
|
||||
final DefaultConfiguration checkConfig =
|
||||
createCheckConfig(RemoteHomeInterfaceCheck.class);
|
||||
final String[] expected =
|
||||
{
|
||||
"19:19: Home interface can have only one 'findByPrimaryKey()' method.",
|
||||
"19:19: Method 'findByPrimaryKey' must have 1 parameter(s).",
|
||||
};
|
||||
verify(
|
||||
checkConfig,
|
||||
getPath("j2ee/InputRemoteHomeInterfaceDuplicateFind.java"),
|
||||
expected);
|
||||
}
|
||||
|
||||
public void testNoFind() throws Exception
|
||||
{
|
||||
final DefaultConfiguration checkConfig =
|
||||
createCheckConfig(RemoteHomeInterfaceCheck.class);
|
||||
final String[] expected =
|
||||
{
|
||||
"16:19: Method 'findByPrimaryKey' must have 1 parameter(s).",
|
||||
"19:19: Home interface can have only one 'findByPrimaryKey()' method.",
|
||||
"19:19: Method 'findByPrimaryKey' must have 1 parameter(s).",
|
||||
};
|
||||
verify(
|
||||
checkConfig,
|
||||
getPath("j2ee/InputRemoteHomeInterfaceNoFind.java"),
|
||||
expected);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
package com.puppycrawl.tools.checkstyle.checks.j2ee;
|
||||
import com.puppycrawl.tools.checkstyle.BaseCheckTestCase;
|
||||
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
|
||||
import com.puppycrawl.tools.checkstyle.checks.j2ee.RemoteInterfaceCheck;
|
||||
|
||||
public class RemoteInterfaceCheckTest extends BaseCheckTestCase
|
||||
{
|
||||
public void testDefault()
|
||||
throws Exception
|
||||
{
|
||||
final DefaultConfiguration checkConfig =
|
||||
createCheckConfig(RemoteInterfaceCheck.class);
|
||||
final String[] expected = {
|
||||
"21:17: Method 'invalid' must throw 'java.rmi.RemoteException'.",
|
||||
};
|
||||
verify(checkConfig, getPath("j2ee/InputRemoteInterface.java"), expected);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
package com.puppycrawl.tools.checkstyle.checks.j2ee;
|
||||
import com.puppycrawl.tools.checkstyle.BaseCheckTestCase;
|
||||
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
|
||||
import com.puppycrawl.tools.checkstyle.checks.j2ee.SessionBeanCheck;
|
||||
|
||||
public class SessionBeanCheckTest extends BaseCheckTestCase
|
||||
{
|
||||
public void testDefault()
|
||||
throws Exception
|
||||
{
|
||||
final DefaultConfiguration checkConfig =
|
||||
createCheckConfig(SessionBeanCheck.class);
|
||||
final String[] expected = {
|
||||
"12:14: Session bean 'InputSessionBean' must have a public constructor with no parameters.",
|
||||
"12:14: Session bean 'InputSessionBean' must have method 'ejbCreate<METHOD>(...)'.",
|
||||
"53:16: Session bean 'AbstractSessionBean' must be public.",
|
||||
"53:16: Session bean 'AbstractSessionBean' must have a public constructor with no parameters.",
|
||||
"53:16: Session bean 'AbstractSessionBean' must have method 'ejbCreate<METHOD>(...)'.",
|
||||
"53:16: Session bean 'AbstractSessionBean' must not have modifier 'abstract'.",
|
||||
"58:13: Session bean 'FinalSessionBean' must be public.",
|
||||
"58:13: Session bean 'FinalSessionBean' must not define the 'finalize()' method.",
|
||||
"58:13: Session bean 'FinalSessionBean' must not have modifier 'final'.",
|
||||
};
|
||||
verify(checkConfig, getPath("j2ee/InputSessionBean.java"), expected);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
package com.puppycrawl.tools.checkstyle.checks.j2ee;
|
||||
import com.puppycrawl.tools.checkstyle.BaseCheckTestCase;
|
||||
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
|
||||
import com.puppycrawl.tools.checkstyle.checks.j2ee.ThisParameterCheck;
|
||||
|
||||
public class ThisParameterCheckTest extends BaseCheckTestCase
|
||||
{
|
||||
public void testEntityBean()
|
||||
throws Exception
|
||||
{
|
||||
final DefaultConfiguration checkConfig =
|
||||
createCheckConfig(ThisParameterCheck.class);
|
||||
final String[] expected = {
|
||||
"23:20: Do not pass 'this' as a parameter.",
|
||||
};
|
||||
verify(checkConfig, getPath("j2ee/InputEntityBean.java"), expected);
|
||||
}
|
||||
|
||||
public void testMessageBean()
|
||||
throws Exception
|
||||
{
|
||||
final DefaultConfiguration checkConfig =
|
||||
createCheckConfig(ThisParameterCheck.class);
|
||||
final String[] expected = {
|
||||
"63:19: Do not pass 'this' as a parameter.",
|
||||
};
|
||||
verify(checkConfig, getPath("j2ee/InputMessageBean.java"), expected);
|
||||
}
|
||||
|
||||
public void testSessionBean()
|
||||
throws Exception
|
||||
{
|
||||
final DefaultConfiguration checkConfig =
|
||||
createCheckConfig(ThisParameterCheck.class);
|
||||
final String[] expected = {
|
||||
"76:19: Do not pass 'this' as a parameter.",
|
||||
};
|
||||
verify(checkConfig, getPath("j2ee/InputSessionBean.java"), expected);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
package com.puppycrawl.tools.checkstyle.checks.j2ee;
|
||||
import com.puppycrawl.tools.checkstyle.BaseCheckTestCase;
|
||||
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
|
||||
import com.puppycrawl.tools.checkstyle.checks.j2ee.ThisReturnCheck;
|
||||
|
||||
public class ThisReturnCheckTest extends BaseCheckTestCase
|
||||
{
|
||||
public void testEntityBean()
|
||||
throws Exception
|
||||
{
|
||||
final DefaultConfiguration checkConfig =
|
||||
createCheckConfig(ThisReturnCheck.class);
|
||||
final String[] expected = {
|
||||
"24:16: Do not return 'this'.",
|
||||
};
|
||||
verify(checkConfig, getPath("j2ee/InputEntityBean.java"), expected);
|
||||
}
|
||||
|
||||
public void testMessageBean()
|
||||
throws Exception
|
||||
{
|
||||
final DefaultConfiguration checkConfig =
|
||||
createCheckConfig(ThisReturnCheck.class);
|
||||
final String[] expected = {
|
||||
"64:16: Do not return 'this'.",
|
||||
};
|
||||
verify(checkConfig, getPath("j2ee/InputMessageBean.java"), expected);
|
||||
}
|
||||
|
||||
public void testSessionBean()
|
||||
throws Exception
|
||||
{
|
||||
final DefaultConfiguration checkConfig =
|
||||
createCheckConfig(ThisReturnCheck.class);
|
||||
final String[] expected = {
|
||||
"77:16: Do not return 'this'.",
|
||||
};
|
||||
verify(checkConfig, getPath("j2ee/InputSessionBean.java"), expected);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue