diff --git a/contrib/j2ee/docs/J2eeConfig.xml b/contrib/j2ee/docs/J2eeConfig.xml index 4da6875f2..d8d0cf12e 100644 --- a/contrib/j2ee/docs/J2eeConfig.xml +++ b/contrib/j2ee/docs/J2eeConfig.xml @@ -9,6 +9,9 @@ + + + diff --git a/contrib/j2ee/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/j2ee/EntityBeanEjbCreateCheck.java b/contrib/j2ee/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/j2ee/EntityBeanEjbCreateCheck.java index 4b4586ed1..a97fdf187 100644 --- a/contrib/j2ee/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/j2ee/EntityBeanEjbCreateCheck.java +++ b/contrib/j2ee/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/j2ee/EntityBeanEjbCreateCheck.java @@ -38,13 +38,14 @@ public class EntityBeanEjbCreateCheck public void visitToken(DetailAST aAST) { final DetailAST nameAST = aAST.findFirstToken(TokenTypes.IDENT); - if (nameAST.getText().equals("ejbCreate") + final String name = nameAST.getText(); + if (name.startsWith("ejbCreate") && Utils.implementsEntityBean(aAST)) { checkMethod(aAST); if (Utils.isVoid(aAST)) { log(nameAST.getLineNo(), nameAST.getColumnNo(), - "voidmethod.bean", "ejbCreate"); + "voidmethod.bean", name); } } } diff --git a/contrib/j2ee/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/j2ee/EntityBeanEjbHomeCheck.java b/contrib/j2ee/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/j2ee/EntityBeanEjbHomeCheck.java new file mode 100644 index 000000000..1cd9b5247 --- /dev/null +++ b/contrib/j2ee/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/j2ee/EntityBeanEjbHomeCheck.java @@ -0,0 +1,52 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2003 Oliver Burn +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +//////////////////////////////////////////////////////////////////////////////// +package com.puppycrawl.tools.checkstyle.checks.j2ee; + +import com.puppycrawl.tools.checkstyle.api.DetailAST; +import com.puppycrawl.tools.checkstyle.api.TokenTypes; + +/** + * Checks that a EntityBean ejbHome method satisfies these requirements: + *
    + *
  • The access control modifier must be public.
  • + *
  • The method modifier cannot be final + * or static.
  • + *
+ * @author Rick Giles + */ +public class EntityBeanEjbHomeCheck + extends AbstractMethodCheck +{ + /** @see com.puppycrawl.tools.checkstyle.api.Check */ + public void visitToken(DetailAST aAST) + { + final DetailAST nameAST = aAST.findFirstToken(TokenTypes.IDENT); + final String name = nameAST.getText(); + if (name.startsWith("ejbHome") + && Utils.implementsEntityBean(aAST)) + { + checkMethod(aAST); + if (Utils.hasThrows(aAST, "java.rmi.RemoteException")) { + log(nameAST.getLineNo(), nameAST.getColumnNo(), + "illegalthrows.bean", + new Object[] {name, "java.rmi.RemoteException"}); + } + } + } +} diff --git a/contrib/j2ee/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/j2ee/EntityBeanEjbPostCreateCheck.java b/contrib/j2ee/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/j2ee/EntityBeanEjbPostCreateCheck.java new file mode 100644 index 000000000..b613b7650 --- /dev/null +++ b/contrib/j2ee/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/j2ee/EntityBeanEjbPostCreateCheck.java @@ -0,0 +1,52 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2003 Oliver Burn +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +//////////////////////////////////////////////////////////////////////////////// +package com.puppycrawl.tools.checkstyle.checks.j2ee; + +import com.puppycrawl.tools.checkstyle.api.DetailAST; +import com.puppycrawl.tools.checkstyle.api.TokenTypes; + +/** + * Checks that a EntityBean ejbPostCreate method satisfies these requirements: + *
    + *
  • The access control modifier must be public.
  • + *
  • The return type must be void.
  • + *
  • The method modifier cannot be final + * or static.
  • + *
+ * @author Rick Giles + */ +public class EntityBeanEjbPostCreateCheck + extends AbstractMethodCheck +{ + /** @see com.puppycrawl.tools.checkstyle.api.Check */ + public void visitToken(DetailAST aAST) + { + final DetailAST nameAST = aAST.findFirstToken(TokenTypes.IDENT); + final String name = nameAST.getText(); + if (name.startsWith("ejbPostCreate") + && Utils.implementsEntityBean(aAST)) + { + checkMethod(aAST); + if (!Utils.isVoid(aAST)) { + log(nameAST.getLineNo(), nameAST.getColumnNo(), + "nonvoidmethod.bean", name); + } + } + } +} diff --git a/contrib/j2ee/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/j2ee/EntityBeanEjbSelectCheck.java b/contrib/j2ee/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/j2ee/EntityBeanEjbSelectCheck.java new file mode 100644 index 000000000..ad83550e3 --- /dev/null +++ b/contrib/j2ee/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/j2ee/EntityBeanEjbSelectCheck.java @@ -0,0 +1,57 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2003 Oliver Burn +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +//////////////////////////////////////////////////////////////////////////////// +package com.puppycrawl.tools.checkstyle.checks.j2ee; + +import com.puppycrawl.tools.checkstyle.api.DetailAST; +import com.puppycrawl.tools.checkstyle.api.TokenTypes; + +/** + * Checks that a EntityBean ejbSelect method satisfies these requirements: + *
    + *
  • The access control modifier must be public.
  • + *
  • The method must be abstract.
  • + *
  • The return type must not be void.
  • + *
  • The method modifier cannot be final + * or static.
  • + *
+ * @author Rick Giles + */ +public class EntityBeanEjbSelectCheck + extends AbstractMethodCheck +{ + /** @see com.puppycrawl.tools.checkstyle.api.Check */ + public void visitToken(DetailAST aAST) + { + final DetailAST nameAST = aAST.findFirstToken(TokenTypes.IDENT); + final String name = nameAST.getText(); + if (name.startsWith("ejbSelect") + && Utils.implementsEntityBean(aAST)) + { + checkMethod(aAST); + if (Utils.isVoid(aAST)) { + log(nameAST.getLineNo(), nameAST.getColumnNo(), + "voidmethod.bean", name); + } + if (!Utils.isAbstract(aAST)) { + log(nameAST.getLineNo(), nameAST.getColumnNo(), + "nonabstract.bean", "Method " + name); + } + } + } +} diff --git a/contrib/j2ee/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/j2ee/messages.properties b/contrib/j2ee/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/j2ee/messages.properties index 18527b0fc..42a0eaf62 100644 --- a/contrib/j2ee/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/j2ee/messages.properties +++ b/contrib/j2ee/src/checkstyle/com/puppycrawl/tools/checkstyle/checks/j2ee/messages.properties @@ -1,9 +1,10 @@ -hasfinalize.bean={0} defines the finalize method. -illegalmodifier.bean={0} has illegal modifier {1}. +hasfinalize.bean={0} must not define the finalize method. +illegalmodifier.bean={0} must not have modifier {1}. illegalthrows.bean=Method {0} must not throw {1}. -missingmethod.bean={0} has no {1} method. -missingthrows.bean=Method {0} does not throw {1}. -nonpublicconstructor.bean={0} does not have a public constructor with no parameters. -nonpublic.bean={0} is not public. -nonvoidmethod.bean=Non-void {0} method. -voidmethod.bean=Void {0} method. +missingmethod.bean={0} must have method {1}. +missingthrows.bean=Method {0} must throw {1}. +nonabstract.bean={0} must be abstract. +nonpublicconstructor.bean={0} must have a public constructor with no parameters. +nonpublic.bean={0} must be public. +nonvoidmethod.bean=Method {0} must be void. +voidmethod.bean=Method {0} must be non-void. diff --git a/contrib/j2ee/src/testinputs/com/puppycrawl/tools/checkstyle/InputEntityBean.java b/contrib/j2ee/src/testinputs/com/puppycrawl/tools/checkstyle/InputEntityBean.java index 07baa543a..1c6aa15f3 100644 --- a/contrib/j2ee/src/testinputs/com/puppycrawl/tools/checkstyle/InputEntityBean.java +++ b/contrib/j2ee/src/testinputs/com/puppycrawl/tools/checkstyle/InputEntityBean.java @@ -96,6 +96,21 @@ final class FinalEntityBean { } + protected static final int ejbPostCreate(int i) + { + return 0; + } + + protected static final int ejbHomeMethod(int i) + throws java.rmi.RemoteException + { + return 0; + } + + protected static final void ejbSelectSomething(int i) + { + } + /** * @see javax.ejb.EntityBean#setEntityContext(javax.ejb.EntityContext) */ diff --git a/contrib/j2ee/src/tests/AllTests.java b/contrib/j2ee/src/tests/AllTests.java index e4e9e3447..7ce0cb18e 100644 --- a/contrib/j2ee/src/tests/AllTests.java +++ b/contrib/j2ee/src/tests/AllTests.java @@ -18,6 +18,9 @@ public class AllTests { //$JUnit-BEGIN$ suite.addTest(new TestSuite(EntityBeanCheckTest.class)); suite.addTest(new TestSuite(EntityBeanEjbCreateCheckTest.class)); + suite.addTest(new TestSuite(EntityBeanEjbHomeCheckTest.class)); + suite.addTest(new TestSuite(EntityBeanEjbPostCreateCheckTest.class)); + suite.addTest(new TestSuite(EntityBeanEjbSelectCheckTest.class)); suite.addTest(new TestSuite(EntityBeanFindByPrimaryKeyCheckTest.class)); suite.addTest(new TestSuite(EntityBeanFinderCheckTest.class)); suite.addTest(new TestSuite(HomeInterfaceCheckTest.class)); diff --git a/contrib/j2ee/src/tests/EntityBeanCheckTest.java b/contrib/j2ee/src/tests/EntityBeanCheckTest.java index 8b579c0e9..17a267e43 100644 --- a/contrib/j2ee/src/tests/EntityBeanCheckTest.java +++ b/contrib/j2ee/src/tests/EntityBeanCheckTest.java @@ -10,9 +10,9 @@ public class EntityBeanCheckTest extends BaseCheckTestCase final DefaultConfiguration checkConfig = createCheckConfig(EntityBeanCheck.class); final String[] expected = { - "13:14: Entity bean does not have a public constructor with no parameters.", - "83:13: Entity bean has illegal modifier final.", - "83:13: Entity bean is not public.", + "13:14: Entity bean must have a public constructor with no parameters.", + "83:13: Entity bean must be public.", + "83:13: Entity bean must not have modifier final.", }; verify(checkConfig, getPath("InputEntityBean.java"), expected); } diff --git a/contrib/j2ee/src/tests/EntityBeanEjbCreateCheckTest.java b/contrib/j2ee/src/tests/EntityBeanEjbCreateCheckTest.java index 78da8d226..529917687 100644 --- a/contrib/j2ee/src/tests/EntityBeanEjbCreateCheckTest.java +++ b/contrib/j2ee/src/tests/EntityBeanEjbCreateCheckTest.java @@ -10,10 +10,10 @@ public class EntityBeanEjbCreateCheckTest extends BaseCheckTestCase final DefaultConfiguration checkConfig = createCheckConfig(EntityBeanEjbCreateCheck.class); final String[] expected = { - "91:33: Method ejbCreate has illegal modifier final.", - "91:33: Method ejbCreate has illegal modifier static.", - "91:33: Method ejbCreate is not public.", - "91:33: Void ejbCreate method.", + "91:33: Method ejbCreate must be non-void.", + "91:33: Method ejbCreate must be public.", + "91:33: Method ejbCreate must not have modifier final.", + "91:33: Method ejbCreate must not have modifier static.", }; verify(checkConfig, getPath("InputEntityBean.java"), expected); } diff --git a/contrib/j2ee/src/tests/EntityBeanEjbHomeCheckTest.java b/contrib/j2ee/src/tests/EntityBeanEjbHomeCheckTest.java new file mode 100644 index 000000000..543ce361b --- /dev/null +++ b/contrib/j2ee/src/tests/EntityBeanEjbHomeCheckTest.java @@ -0,0 +1,20 @@ +import com.puppycrawl.tools.checkstyle.BaseCheckTestCase; +import com.puppycrawl.tools.checkstyle.DefaultConfiguration; +import com.puppycrawl.tools.checkstyle.checks.j2ee.EntityBeanEjbHomeCheck; + +public class EntityBeanEjbHomeCheckTest extends BaseCheckTestCase +{ + public void testDefault() + throws Exception + { + final DefaultConfiguration checkConfig = + createCheckConfig(EntityBeanEjbHomeCheck.class); + final String[] expected = { + "104:32: Method ejbHomeMethod must be public.", + "104:32: Method ejbHomeMethod must not have modifier final.", + "104:32: Method ejbHomeMethod must not have modifier static.", + "104:32: Method ejbHomeMethod must not throw java.rmi.RemoteException.", + }; + verify(checkConfig, getPath("InputEntityBean.java"), expected); + } +} diff --git a/contrib/j2ee/src/tests/EntityBeanEjbPostCreateCheckTest.java b/contrib/j2ee/src/tests/EntityBeanEjbPostCreateCheckTest.java new file mode 100644 index 000000000..9eed07b6b --- /dev/null +++ b/contrib/j2ee/src/tests/EntityBeanEjbPostCreateCheckTest.java @@ -0,0 +1,20 @@ +import com.puppycrawl.tools.checkstyle.BaseCheckTestCase; +import com.puppycrawl.tools.checkstyle.DefaultConfiguration; +import com.puppycrawl.tools.checkstyle.checks.j2ee.EntityBeanEjbPostCreateCheck; + +public class EntityBeanEjbPostCreateCheckTest extends BaseCheckTestCase +{ + public void testDefault() + throws Exception + { + final DefaultConfiguration checkConfig = + createCheckConfig(EntityBeanEjbPostCreateCheck.class); + final String[] expected = { + "99:32: Method ejbPostCreate must be public.", + "99:32: Method ejbPostCreate must be void.", + "99:32: Method ejbPostCreate must not have modifier final.", + "99:32: Method ejbPostCreate must not have modifier static.", + }; + verify(checkConfig, getPath("InputEntityBean.java"), expected); + } +} diff --git a/contrib/j2ee/src/tests/EntityBeanEjbSelectCheckTest.java b/contrib/j2ee/src/tests/EntityBeanEjbSelectCheckTest.java new file mode 100644 index 000000000..3f7b48391 --- /dev/null +++ b/contrib/j2ee/src/tests/EntityBeanEjbSelectCheckTest.java @@ -0,0 +1,21 @@ +import com.puppycrawl.tools.checkstyle.BaseCheckTestCase; +import com.puppycrawl.tools.checkstyle.DefaultConfiguration; +import com.puppycrawl.tools.checkstyle.checks.j2ee.EntityBeanEjbSelectCheck; + +public class EntityBeanEjbSelectCheckTest extends BaseCheckTestCase +{ + public void testDefault() + throws Exception + { + final DefaultConfiguration checkConfig = + createCheckConfig(EntityBeanEjbSelectCheck.class); + final String[] expected = { + "110:33: Method ejbSelectSomething must be abstract.", + "110:33: Method ejbSelectSomething must be non-void.", + "110:33: Method ejbSelectSomething must be public.", + "110:33: Method ejbSelectSomething must not have modifier final.", + "110:33: Method ejbSelectSomething must not have modifier static.", + }; + verify(checkConfig, getPath("InputEntityBean.java"), expected); + } +} diff --git a/contrib/j2ee/src/tests/EntityBeanFindByPrimaryKeyCheckTest.java b/contrib/j2ee/src/tests/EntityBeanFindByPrimaryKeyCheckTest.java index b40741540..d0cc7fce4 100644 --- a/contrib/j2ee/src/tests/EntityBeanFindByPrimaryKeyCheckTest.java +++ b/contrib/j2ee/src/tests/EntityBeanFindByPrimaryKeyCheckTest.java @@ -11,8 +11,8 @@ public class EntityBeanFindByPrimaryKeyCheckTest final DefaultConfiguration checkConfig = createCheckConfig(EntityBeanFindByPrimaryKeyCheck.class); final String[] expected = { - "13:14: Entity bean has no ejbFindByPrimaryKey method.", - "83:13: Entity bean has no ejbFindByPrimaryKey method.", + "13:14: Entity bean must have method ejbFindByPrimaryKey.", + "83:13: Entity bean must have method ejbFindByPrimaryKey.", }; verify(checkConfig, getPath("InputEntityBean.java"), expected); } diff --git a/contrib/j2ee/src/tests/EntityBeanFinderCheckTest.java b/contrib/j2ee/src/tests/EntityBeanFinderCheckTest.java index 5f92ec0da..adf3b58b3 100644 --- a/contrib/j2ee/src/tests/EntityBeanFinderCheckTest.java +++ b/contrib/j2ee/src/tests/EntityBeanFinderCheckTest.java @@ -10,10 +10,10 @@ public class EntityBeanFinderCheckTest extends BaseCheckTestCase final DefaultConfiguration checkConfig = createCheckConfig(EntityBeanFinderCheck.class); final String[] expected = { - "95:33: Method ejbFindSomething has illegal modifier final.", - "95:33: Method ejbFindSomething has illegal modifier static.", - "95:33: Method ejbFindSomething is not public.", - "95:33: Void ejbFindSomething method.", + "95:33: Method ejbFindSomething must be non-void.", + "95:33: Method ejbFindSomething must be public.", + "95:33: Method ejbFindSomething must not have modifier final.", + "95:33: Method ejbFindSomething must not have modifier static.", }; verify(checkConfig, getPath("InputEntityBean.java"), expected); } diff --git a/contrib/j2ee/src/tests/HomeInterfaceCheckTest.java b/contrib/j2ee/src/tests/HomeInterfaceCheckTest.java index 9daa6857a..7bdcf7808 100644 --- a/contrib/j2ee/src/tests/HomeInterfaceCheckTest.java +++ b/contrib/j2ee/src/tests/HomeInterfaceCheckTest.java @@ -10,15 +10,15 @@ public class HomeInterfaceCheckTest extends BaseCheckTestCase final DefaultConfiguration checkConfig = createCheckConfig(HomeInterfaceCheck.class); final String[] expected = { - "14:18: Home interface has no findByPrimaryKey method.", - "20:19: Method createSomething does not throw java.rmi.RemoteException.", - "20:19: Method createSomething does not throw javax.ejb.CreateException.", - "20:19: Method createSomething is not public.", - "20:19: Void createSomething method.", - "22:19: Method findSomething does not throw java.rmi.RemoteException.", - "22:19: Method findSomething does not throw javax.ejb.FinderException.", - "22:19: Method findSomething is not public.", - "22:19: Void findSomething method.", + "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("InputHomeInterface.java"), expected); } diff --git a/contrib/j2ee/src/tests/LocalHomeInterfaceCheckTest.java b/contrib/j2ee/src/tests/LocalHomeInterfaceCheckTest.java index 4d81b4657..4edaff8bc 100644 --- a/contrib/j2ee/src/tests/LocalHomeInterfaceCheckTest.java +++ b/contrib/j2ee/src/tests/LocalHomeInterfaceCheckTest.java @@ -10,13 +10,13 @@ public class LocalHomeInterfaceCheckTest extends BaseCheckTestCase final DefaultConfiguration checkConfig = createCheckConfig(LocalHomeInterfaceCheck.class); final String[] expected = { - "12:18: Home interface has no findByPrimaryKey method.", - "18:19: Method createSomething does not throw javax.ejb.CreateException.", - "18:19: Method createSomething is not public.", - "18:19: Void createSomething method.", - "20:19: Method findSomething does not throw javax.ejb.FinderException.", - "20:19: Method findSomething is not public.", - "20:19: Void findSomething method.", + "12:18: Home interface must have method findByPrimaryKey.", + "18:19: Method createSomething must be non-void.", + "18:19: Method createSomething must be public.", + "18:19: Method createSomething must throw javax.ejb.CreateException.", + "20:19: Method findSomething must be non-void.", + "20:19: Method findSomething must be public.", + "20:19: Method findSomething must throw javax.ejb.FinderException.", "25:17: Method method must not throw java.rmi.RemoteException.", }; verify(checkConfig, getPath("InputLocalHomeInterface.java"), expected); diff --git a/contrib/j2ee/src/tests/MessageBeanCheckTest.java b/contrib/j2ee/src/tests/MessageBeanCheckTest.java index d55253382..37a885341 100644 --- a/contrib/j2ee/src/tests/MessageBeanCheckTest.java +++ b/contrib/j2ee/src/tests/MessageBeanCheckTest.java @@ -10,10 +10,10 @@ public class MessageBeanCheckTest extends BaseCheckTestCase final DefaultConfiguration checkConfig = createCheckConfig(MessageBeanCheck.class); final String[] expected = { - "12:14: Message bean does not have a public constructor with no parameters.", - "12:14: Message bean has no ejbCreate method.", - "46:13: Message bean has illegal modifier final.", - "46:13: Message bean is not public.", + "12:14: Message bean must have a public constructor with no parameters.", + "12:14: Message bean must have method ejbCreate.", + "46:13: Message bean must be public.", + "46:13: Message bean must not have modifier final.", }; verify(checkConfig, getPath("InputMessageBean.java"), expected); } diff --git a/contrib/j2ee/src/tests/RemoteInterfaceCheckTest.java b/contrib/j2ee/src/tests/RemoteInterfaceCheckTest.java index 60f762789..b2aa22adb 100644 --- a/contrib/j2ee/src/tests/RemoteInterfaceCheckTest.java +++ b/contrib/j2ee/src/tests/RemoteInterfaceCheckTest.java @@ -10,14 +10,14 @@ public class RemoteInterfaceCheckTest extends BaseCheckTestCase final DefaultConfiguration checkConfig = createCheckConfig(RemoteInterfaceCheck.class); final String[] expected = { - "20:19: Method createSomething does not throw java.rmi.RemoteException.", - "20:19: Method createSomething does not throw javax.ejb.CreateException.", - "20:19: Method createSomething is not public.", - "20:19: Void createSomething method.", - "22:19: Method findSomething does not throw java.rmi.RemoteException.", - "22:19: Method findSomething does not throw javax.ejb.FinderException.", - "22:19: Method findSomething is not public.", - "22:19: Void findSomething method.", + "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("InputRemoteInterface.java"), expected); } diff --git a/contrib/j2ee/src/tests/SessionBeanCheckTest.java b/contrib/j2ee/src/tests/SessionBeanCheckTest.java index 082bcf32f..3b645c5c9 100644 --- a/contrib/j2ee/src/tests/SessionBeanCheckTest.java +++ b/contrib/j2ee/src/tests/SessionBeanCheckTest.java @@ -10,10 +10,10 @@ public class SessionBeanCheckTest extends BaseCheckTestCase final DefaultConfiguration checkConfig = createCheckConfig(SessionBeanCheck.class); final String[] expected = { - "12:14: Session bean does not have a public constructor with no parameters.", - "12:14: Session bean has no ejbCreate method.", - "58:13: Session bean has illegal modifier final.", - "58:13: Session bean is not public.", + "12:14: Session bean must have a public constructor with no parameters.", + "12:14: Session bean must have method ejbCreate.", + "58:13: Session bean must be public.", + "58:13: Session bean must not have modifier final.", }; verify(checkConfig, getPath("InputSessionBean.java"), expected); } diff --git a/contrib/j2ee/src/tests/SessionBeanEjbCreateCheckTest.java b/contrib/j2ee/src/tests/SessionBeanEjbCreateCheckTest.java index 5c6bf88e0..71b37c8b6 100644 --- a/contrib/j2ee/src/tests/SessionBeanEjbCreateCheckTest.java +++ b/contrib/j2ee/src/tests/SessionBeanEjbCreateCheckTest.java @@ -10,10 +10,10 @@ public class SessionBeanEjbCreateCheckTest extends BaseCheckTestCase final DefaultConfiguration checkConfig = createCheckConfig(SessionBeanEjbCreateCheck.class); final String[] expected = { - "69:32: Method ejbCreate has illegal modifier final.", - "69:32: Method ejbCreate has illegal modifier static.", - "69:32: Method ejbCreate is not public.", - "69:32: Non-void ejbCreate method.", + "69:32: Method ejbCreate must be public.", + "69:32: Method ejbCreate must be void.", + "69:32: Method ejbCreate must not have modifier final.", + "69:32: Method ejbCreate must not have modifier static.", }; verify(checkConfig, getPath("InputSessionBean.java"), expected); }