[jboss-cvs] JBossAS SVN: r87931 - in branches/JBPAPP_4_2_0_GA_CP/ejb3: src/test/org/jboss/ejb3/test and 2 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Apr 28 04:44:10 EDT 2009
Author: wolfc
Date: 2009-04-28 04:44:09 -0400 (Tue, 28 Apr 2009)
New Revision: 87931
Added:
branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/ejbthree1358/
branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/ejbthree1358/Lektorat.java
branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/ejbthree1358/LektoratImpl.java
branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/ejbthree1358/unit/
branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/ejbthree1358/unit/PoolUsageTestCase.java
Modified:
branches/JBPAPP_4_2_0_GA_CP/ejb3/build-test.xml
Log:
JBPAPP-1938 EJBTHREE-1358: unit test
Modified: branches/JBPAPP_4_2_0_GA_CP/ejb3/build-test.xml
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/ejb3/build-test.xml 2009-04-28 08:12:42 UTC (rev 87930)
+++ branches/JBPAPP_4_2_0_GA_CP/ejb3/build-test.xml 2009-04-28 08:44:09 UTC (rev 87931)
@@ -2077,6 +2077,10 @@
<build-simple-jar name="ejbthree1239"/>
</target>
+ <target name="ejbthree1358" depends="compile-classes">
+ <build-simple-jar name="ejbthree1358"/>
+ </target>
+
<target name="ejbthree1504"
description="Builds all jar files."
depends="compile-classes">
@@ -3855,6 +3859,7 @@
ejbthree1062,
ejbthree1109,
ejbthree1239,
+ ejbthree1358,
ejbthree1504,
jbpapp584,
jbpapp999,
Added: branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/ejbthree1358/Lektorat.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/ejbthree1358/Lektorat.java (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/ejbthree1358/Lektorat.java 2009-04-28 08:44:09 UTC (rev 87931)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This 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 software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.test.ejbthree1358;
+
+import javax.ejb.Remote;
+
+/**
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+ at Remote
+public interface Lektorat
+{
+ void delete();
+
+ void setName(String s);
+}
Added: branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/ejbthree1358/LektoratImpl.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/ejbthree1358/LektoratImpl.java (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/ejbthree1358/LektoratImpl.java 2009-04-28 08:44:09 UTC (rev 87931)
@@ -0,0 +1,65 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This 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 software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.test.ejbthree1358;
+
+import javax.annotation.PostConstruct;
+import javax.ejb.Remove;
+import javax.ejb.Stateful;
+
+import org.jboss.annotation.ejb.PoolClass;
+import org.jboss.annotation.ejb.cache.Cache;
+import org.jboss.logging.Logger;
+
+/**
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+ at Stateful(name="Lektorat")
+ at PoolClass(value=org.jboss.ejb3.StrictMaxPool.class, maxSize=10, timeout=100)
+ at Cache(org.jboss.ejb3.cache.NoPassivationCache.class)
+public class LektoratImpl implements Lektorat
+{
+ private static final Logger log = Logger.getLogger(LektoratImpl.class);
+
+ private static int counter = 0;
+ private int num = counter++;
+
+ @SuppressWarnings("unused")
+ private String name;
+
+ @Remove
+ public void delete()
+ {
+
+ }
+
+ @PostConstruct
+ public void postConstruct()
+ {
+ log.info("postConstruct " + num);
+ }
+
+ public void setName(String s)
+ {
+ this.name = s;
+ }
+}
Added: branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/ejbthree1358/unit/PoolUsageTestCase.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/ejbthree1358/unit/PoolUsageTestCase.java (rev 0)
+++ branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/ejbthree1358/unit/PoolUsageTestCase.java 2009-04-28 08:44:09 UTC (rev 87931)
@@ -0,0 +1,98 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This 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 software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.test.ejbthree1358.unit;
+
+import javax.ejb.EJBException;
+
+import junit.framework.Test;
+
+import org.jboss.ejb3.test.common.EJB3TestCase;
+import org.jboss.ejb3.test.ejbthree1358.Lektorat;
+
+/**
+ * @author <a href="mailto:cdewolf at redhat.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class PoolUsageTestCase extends EJB3TestCase
+{
+ public PoolUsageTestCase(String name)
+ {
+ super(name);
+ }
+
+ public void test1() throws Exception
+ {
+ Lektorat beans[] = new Lektorat[10];
+ for(int i = 0; i < beans.length; i++)
+ {
+ beans[i] = lookup("Lektorat/remote", Lektorat.class);
+ // 4.x constructs at first call
+ beans[i].setName("Bean " + i);
+ }
+
+ try
+ {
+ Lektorat bean = lookup("Lektorat/remote", Lektorat.class);
+ bean.setName("Fails");
+ fail("Expected EJBException");
+ }
+ catch(EJBException e)
+ {
+ // good
+ }
+ }
+
+ public void test2() throws Exception
+ {
+ Lektorat beans[] = new Lektorat[10];
+ for(int i = 0; i < beans.length; i++)
+ {
+ beans[i] = lookup("Lektorat/remote", Lektorat.class);
+ // 4.x constructs at first call
+ beans[i].setName("Bean " + i);
+ }
+
+ beans[0].delete();
+
+ try
+ {
+ Lektorat bean = lookup("Lektorat/remote", Lektorat.class);
+ bean.setName("Replace Bean 0");
+ }
+ catch(EJBException e)
+ {
+ fail(e.getMessage());
+ }
+ }
+
+ @Override
+ protected void tearDown() throws Exception
+ {
+ // TODO: remove, but as long as the bug is in there we can't reuse the pool
+ redeploy("ejbthree1358.jar");
+ }
+
+ public static Test suite() throws Exception
+ {
+ return getDeploySetup(PoolUsageTestCase.class, "ejbthree1358.jar");
+ }
+}
More information about the jboss-cvs-commits
mailing list