From 5fa2b74de94757a3202b79c8b31fefd17e1185d2 Mon Sep 17 00:00:00 2001 From: Jonathan Gallimore Date: Tue, 11 Dec 2018 14:49:24 +0000 Subject: [PATCH 1/3] TOMEE-2234 add remote test --- .../arquillian/tests/bmp/local/BigFinder.java | 22 +++++ .../tests/bmp/local/BigFinderBean.java | 57 +++++++++++ .../tests/bmp/local/BigFinderHome.java | 25 +++++ .../tests/bmp/local/BigFinderPK.java | 24 +++++ .../tests/bmp/local/BmpLocalEntityTest.java | 62 ++++++++++++ .../tests/bmp/local/FinderServlet.java | 33 +++++++ .../tests/bmp/local/FinderTest.java | 25 +++++ .../tests/bmp/local/FinderTestBean.java | 86 ++++++++++++++++ .../tests/bmp/local/FinderTestHome.java | 25 +++++ .../arquillian/tests/bmp/local/IntegerPK.java | 99 +++++++++++++++++++ .../tests/bmp/local/LittleFinder.java | 22 +++++ .../tests/bmp/local/LittleFinderBean.java | 55 +++++++++++ .../tests/bmp/local/LittleFinderHome.java | 25 +++++ .../tests/bmp/local/LittleFinderPK.java | 25 +++++ .../arquillian/tests/bmp/local/StringPK.java | 71 +++++++++++++ .../tests/bmp/remote/BigFinder.java | 22 +++++ .../tests/bmp/remote/BigFinderBean.java | 57 +++++++++++ .../tests/bmp/remote/BigFinderHome.java | 25 +++++ .../tests/bmp/remote/BigFinderPK.java | 24 +++++ .../tests/bmp/remote/BmpRemoteEntityTest.java | 62 ++++++++++++ .../tests/bmp/remote/FinderServlet.java | 33 +++++++ .../tests/bmp/remote/FinderTest.java | 24 +++++ .../tests/bmp/remote/FinderTestBean.java | 82 +++++++++++++++ .../tests/bmp/remote/FinderTestHome.java | 25 +++++ .../tests/bmp/remote/IntegerPK.java | 99 +++++++++++++++++++ .../tests/bmp/remote/LittleFinder.java | 22 +++++ .../tests/bmp/remote/LittleFinderBean.java | 55 +++++++++++ .../tests/bmp/remote/LittleFinderHome.java | 25 +++++ .../tests/bmp/remote/LittleFinderPK.java | 25 +++++ .../arquillian/tests/bmp/remote/StringPK.java | 71 +++++++++++++ .../arquillian/tests/bmp/local/ejb-jar.xml | 65 ++++++++++++ .../arquillian/tests/bmp/local/web.xml | 42 ++++++++ .../arquillian/tests/bmp/remote/ejb-jar.xml | 65 ++++++++++++ .../arquillian/tests/bmp/remote/web.xml | 42 ++++++++ 34 files changed, 1521 insertions(+) create mode 100644 arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/local/BigFinder.java create mode 100644 arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/local/BigFinderBean.java create mode 100644 arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/local/BigFinderHome.java create mode 100644 arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/local/BigFinderPK.java create mode 100644 arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/local/BmpLocalEntityTest.java create mode 100644 arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/local/FinderServlet.java create mode 100644 arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/local/FinderTest.java create mode 100644 arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/local/FinderTestBean.java create mode 100644 arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/local/FinderTestHome.java create mode 100644 arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/local/IntegerPK.java create mode 100644 arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/local/LittleFinder.java create mode 100644 arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/local/LittleFinderBean.java create mode 100644 arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/local/LittleFinderHome.java create mode 100644 arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/local/LittleFinderPK.java create mode 100644 arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/local/StringPK.java create mode 100644 arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/remote/BigFinder.java create mode 100644 arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/remote/BigFinderBean.java create mode 100644 arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/remote/BigFinderHome.java create mode 100644 arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/remote/BigFinderPK.java create mode 100644 arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/remote/BmpRemoteEntityTest.java create mode 100644 arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/remote/FinderServlet.java create mode 100644 arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/remote/FinderTest.java create mode 100644 arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/remote/FinderTestBean.java create mode 100644 arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/remote/FinderTestHome.java create mode 100644 arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/remote/IntegerPK.java create mode 100644 arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/remote/LittleFinder.java create mode 100644 arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/remote/LittleFinderBean.java create mode 100644 arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/remote/LittleFinderHome.java create mode 100644 arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/remote/LittleFinderPK.java create mode 100644 arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/remote/StringPK.java create mode 100644 arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/resources/org/apache/openejb/arquillian/tests/bmp/local/ejb-jar.xml create mode 100644 arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/resources/org/apache/openejb/arquillian/tests/bmp/local/web.xml create mode 100644 arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/resources/org/apache/openejb/arquillian/tests/bmp/remote/ejb-jar.xml create mode 100644 arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/resources/org/apache/openejb/arquillian/tests/bmp/remote/web.xml diff --git a/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/local/BigFinder.java b/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/local/BigFinder.java new file mode 100644 index 00000000000..207749fe8eb --- /dev/null +++ b/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/local/BigFinder.java @@ -0,0 +1,22 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.openejb.arquillian.tests.bmp.local; + +import javax.ejb.EJBLocalObject; + +public interface BigFinder extends EJBLocalObject { +} diff --git a/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/local/BigFinderBean.java b/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/local/BigFinderBean.java new file mode 100644 index 00000000000..53a667003ac --- /dev/null +++ b/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/local/BigFinderBean.java @@ -0,0 +1,57 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.openejb.arquillian.tests.bmp.local; + +import javax.ejb.EntityBean; +import javax.ejb.EntityContext; +import javax.ejb.RemoveException; +import java.rmi.RemoteException; +import java.util.ArrayList; +import java.util.Collection; + +public class BigFinderBean implements EntityBean { + + public void ejbActivate() throws RemoteException { + } + + public void ejbPassivate() throws RemoteException { + } + + public void setEntityContext(final EntityContext context) throws RemoteException { + } + + public void unsetEntityContext() throws RemoteException { + } + + public void ejbLoad() throws RemoteException { + } + + public void ejbRemove() throws RemoveException, RemoteException { + } + + public void ejbStore() throws RemoteException { + } + + public Collection ejbFindN(final int count) { + final ArrayList pks = new ArrayList(); + for (int i = 0; i < count; ++i) { + pks.add(new BigFinderPK(i)); + } + return pks; + } + +} diff --git a/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/local/BigFinderHome.java b/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/local/BigFinderHome.java new file mode 100644 index 00000000000..dc75c88c358 --- /dev/null +++ b/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/local/BigFinderHome.java @@ -0,0 +1,25 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.openejb.arquillian.tests.bmp.local; + +import javax.ejb.EJBLocalHome; +import java.rmi.RemoteException; +import java.util.Collection; + +public interface BigFinderHome extends EJBLocalHome { + Collection findN(int count) throws RemoteException; +} diff --git a/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/local/BigFinderPK.java b/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/local/BigFinderPK.java new file mode 100644 index 00000000000..3e2b7cdf6bd --- /dev/null +++ b/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/local/BigFinderPK.java @@ -0,0 +1,24 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.openejb.arquillian.tests.bmp.local; + +public class BigFinderPK extends IntegerPK { + + public BigFinderPK(final int iKey) { + super(iKey); + } +} diff --git a/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/local/BmpLocalEntityTest.java b/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/local/BmpLocalEntityTest.java new file mode 100644 index 00000000000..2812aea3c99 --- /dev/null +++ b/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/local/BmpLocalEntityTest.java @@ -0,0 +1,62 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.openejb.arquillian.tests.bmp.local; + +import org.apache.ziplock.IO; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.container.test.api.RunAsClient; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.arquillian.test.api.ArquillianResource; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.asset.ClassLoaderAsset; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.net.URL; + +/** + * @version $Rev$ $Date$ + */ +@RunWith(Arquillian.class) +public class BmpLocalEntityTest { + + @ArquillianResource + private URL url; + + @Deployment(testable = false) + public static WebArchive createDeployment() { + WebArchive archive = ShrinkWrap.create(WebArchive.class, BmpLocalEntityTest.class.getSimpleName() + ".war") + .addClasses(BigFinder.class, BigFinderBean.class, BigFinderHome.class, BigFinderPK.class, + FinderServlet.class, FinderTest.class, FinderTestBean.class, FinderTestHome.class, IntegerPK.class, + LittleFinder.class, LittleFinderBean.class, LittleFinderHome.class, LittleFinderPK.class, StringPK.class) + .addAsWebInfResource(new ClassLoaderAsset("org/apache/openejb/arquillian/tests/bmp/local/ejb-jar.xml"), "ejb-jar.xml") + .addAsWebInfResource(new ClassLoaderAsset("org/apache/openejb/arquillian/tests/bmp/local/web.xml"), "web.xml"); + + System.out.println(archive.toString(true)); + return archive; + } + + @Test + @RunAsClient + public void checkBmp() throws Exception { + final String output = IO.slurp(new URL(url.toExternalForm())); + System.out.println(output); + Assert.assertTrue(output.contains("Test succeeded")); + } +} diff --git a/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/local/FinderServlet.java b/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/local/FinderServlet.java new file mode 100644 index 00000000000..f6540e54927 --- /dev/null +++ b/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/local/FinderServlet.java @@ -0,0 +1,33 @@ +package org.apache.openejb.arquillian.tests.bmp.local; + +import javax.naming.InitialContext; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + +public class FinderServlet extends HttpServlet { + + @Override + protected void doGet(final HttpServletRequest req, final HttpServletResponse resp) throws ServletException, IOException { + final FinderTestHome testHome; + InitialContext ctx = null; + try { + ctx = new InitialContext(); + testHome = (FinderTestHome) ctx.lookup("java:comp/env/ejb/FinderTest"); + resp.getWriter().println(testHome.create().runTest()); + resp.getWriter().flush(); + } catch (final Exception e) { + throw new ServletException(e); + } finally { + try { + if (ctx != null) { + ctx.close(); + } + } catch (final Exception e) { + throw new ServletException(e); + } + } + } +} diff --git a/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/local/FinderTest.java b/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/local/FinderTest.java new file mode 100644 index 00000000000..e47d86bbf8c --- /dev/null +++ b/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/local/FinderTest.java @@ -0,0 +1,25 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.openejb.arquillian.tests.bmp.local; + +import java.rmi.RemoteException; + +import javax.ejb.EJBLocalObject; + +public interface FinderTest extends EJBLocalObject { + String runTest() throws Exception, RemoteException; +} diff --git a/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/local/FinderTestBean.java b/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/local/FinderTestBean.java new file mode 100644 index 00000000000..8e78fac19bd --- /dev/null +++ b/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/local/FinderTestBean.java @@ -0,0 +1,86 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.openejb.arquillian.tests.bmp.local; + +import javax.ejb.CreateException; +import javax.ejb.EJBException; +import javax.ejb.EJBObject; +import javax.ejb.SessionBean; +import javax.ejb.SessionContext; +import javax.naming.Context; +import javax.naming.InitialContext; +import javax.naming.NamingException; +import java.rmi.RemoteException; +import java.util.Arrays; +import java.util.Collection; +import java.util.Properties; + +public class FinderTestBean implements SessionBean { + + public void setSessionContext(final SessionContext context) throws RemoteException { + } + + public void ejbRemove() throws RemoteException { + } + + public void ejbActivate() throws RemoteException { + } + + public void ejbPassivate() throws RemoteException { + } + + public void ejbCreate() throws CreateException { + } + + public String runTest() + throws Exception { + final BigFinderHome bigFinderHome = (BigFinderHome) lookup("BigFinderHome"); + final LittleFinderHome littleFinderHome = (LittleFinderHome) lookup("LittleFinderHome"); + for (int i = 1; i < 300; ++i) { + bigFinderHome.findN(i); + + final Collection littleList = littleFinderHome.findAll(); + for (final Object obj : littleList) { + final StringBuilder msg = new StringBuilder(); + if (!(obj instanceof LittleFinder)) { + msg.append("Failed with " + i + " records. LittleFinder Remote is actually " + obj.getClass().getName() + " Implemented interfaces " + Arrays.toString(obj.getClass().getInterfaces())); + if (obj instanceof EJBObject) { + final Object pk = ((EJBObject) obj).getPrimaryKey(); + msg.append(" Primary key value is " + pk); + } + + throw new EJBException(msg.toString()); + } + } + } + + return "Test succeeded"; + } + + public static Object lookup(final String s) throws NamingException { + final Properties p = new Properties(); + p.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.core.LocalInitialContextFactory"); + final InitialContext ctx = new InitialContext(p); + try { + return ctx.lookup("java:comp/env/ejb/" + s); + } finally { + ctx.close(); + } + } + + +} diff --git a/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/local/FinderTestHome.java b/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/local/FinderTestHome.java new file mode 100644 index 00000000000..36712b248d5 --- /dev/null +++ b/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/local/FinderTestHome.java @@ -0,0 +1,25 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.openejb.arquillian.tests.bmp.local; + +import java.rmi.RemoteException; +import javax.ejb.CreateException; +import javax.ejb.EJBLocalHome; + +public interface FinderTestHome extends EJBLocalHome { + FinderTest create() throws CreateException, RemoteException; +} diff --git a/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/local/IntegerPK.java b/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/local/IntegerPK.java new file mode 100644 index 00000000000..1a7b9e4759d --- /dev/null +++ b/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/local/IntegerPK.java @@ -0,0 +1,99 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.openejb.arquillian.tests.bmp.local; + +import java.sql.PreparedStatement; +import java.sql.SQLException; +import java.sql.Types; + +/** + * The base class for a primary key for an integer type. + */ +public class IntegerPK extends Number { + private static final long serialVersionUID = 351946466791640696L; + private int m_value; + + public IntegerPK(final int value) { + m_value = value; + } + + public int getValue() { + return m_value; + } + + public Object clone() { + try { + return super.clone(); + } catch (final CloneNotSupportedException exc) { + throw new RuntimeException("Cannot clone", exc); + } + } + + public boolean equals(final Object o) { + if (o == null) + return false; + return m_value == ((IntegerPK) o).m_value; + } + + public int compareTo(final Object o) { + return (int) (m_value - ((IntegerPK) o).m_value); + } + + public int hashCode() { + return m_value; + } + + public String toString() { + return String.valueOf(m_value); + } + + // Number interface + public byte byteValue() { + return (byte) m_value; + } + + public short shortValue() { + return (short) m_value; + } + + public int intValue() { + return m_value; + } + + public long longValue() { + return m_value; + } + + public float floatValue() { + return m_value; + } + + public double doubleValue() { + return m_value; + } + + /** + * For ParmType interface + */ + public void add(final int i, final PreparedStatement stat) throws SQLException { + stat.setInt(i, m_value); + } + + public int getType() { + return Types.INTEGER; + } +} diff --git a/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/local/LittleFinder.java b/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/local/LittleFinder.java new file mode 100644 index 00000000000..7a62e627837 --- /dev/null +++ b/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/local/LittleFinder.java @@ -0,0 +1,22 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.openejb.arquillian.tests.bmp.local; + +import javax.ejb.EJBLocalObject; + +public interface LittleFinder extends EJBLocalObject { +} diff --git a/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/local/LittleFinderBean.java b/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/local/LittleFinderBean.java new file mode 100644 index 00000000000..7e46e286461 --- /dev/null +++ b/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/local/LittleFinderBean.java @@ -0,0 +1,55 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.openejb.arquillian.tests.bmp.local; + +import java.rmi.RemoteException; +import java.util.ArrayList; +import java.util.Collection; +import javax.ejb.EntityBean; +import javax.ejb.EntityContext; + +public class LittleFinderBean implements EntityBean { + private static final long serialVersionUID = -1719910497840449494L; + + public void ejbActivate() throws RemoteException { + } + + public void ejbPassivate() throws RemoteException { + } + + public void setEntityContext(final EntityContext context) throws RemoteException { + } + + public void unsetEntityContext() throws RemoteException { + } + + public void ejbLoad() throws RemoteException { + } + + public void ejbStore() throws RemoteException { + } + + public void ejbRemove() throws RemoteException { + } + + public Collection ejbFindAll() throws Exception { + final ArrayList pks = new ArrayList(); + pks.add(new LittleFinderPK("1A")); + return pks; + } + +} diff --git a/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/local/LittleFinderHome.java b/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/local/LittleFinderHome.java new file mode 100644 index 00000000000..c5d980a1247 --- /dev/null +++ b/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/local/LittleFinderHome.java @@ -0,0 +1,25 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.openejb.arquillian.tests.bmp.local; + +import javax.ejb.EJBLocalHome; +import java.rmi.RemoteException; +import java.util.Collection; + +public interface LittleFinderHome extends EJBLocalHome { + Collection findAll() throws Exception, RemoteException; +} diff --git a/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/local/LittleFinderPK.java b/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/local/LittleFinderPK.java new file mode 100644 index 00000000000..b334d292d68 --- /dev/null +++ b/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/local/LittleFinderPK.java @@ -0,0 +1,25 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.openejb.arquillian.tests.bmp.local; + +public class LittleFinderPK extends StringPK { + private static final long serialVersionUID = 5782590322327281948L; + + public LittleFinderPK(final String s) { + super(s); + } +} diff --git a/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/local/StringPK.java b/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/local/StringPK.java new file mode 100644 index 00000000000..44ed80164f9 --- /dev/null +++ b/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/local/StringPK.java @@ -0,0 +1,71 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.openejb.arquillian.tests.bmp.local; + +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; +import java.sql.Types; + +/** + * A primary key in a Database table with a String representation (varchar). + */ +public class StringPK implements Serializable { + private static final long serialVersionUID = -6429314795121119701L; + private String m_value; + + public StringPK(final String s) { + m_value = s; + } + + public String getValue() { + return m_value; + } + + public boolean equals(final Object o) { + if (o instanceof StringPK) { + final StringPK s = (StringPK) o; + if (m_value == null) + return s.m_value == null; + return m_value.equals(s.m_value); + } else { + return false; + } + } + + public int compareTo(final Object o) { + return ("" + m_value).compareTo(((StringPK) o).m_value); + } + + public int hashCode() { + return ("" + m_value).hashCode(); + } + + public String toString() { + if (m_value == null) + return "NULL"; + return '\'' + m_value + '\''; + } + + public void add(final int i, final PreparedStatement stat) throws SQLException { + stat.setString(i, m_value); + } + + public int getType() { + return Types.VARCHAR; + } +} diff --git a/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/remote/BigFinder.java b/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/remote/BigFinder.java new file mode 100644 index 00000000000..5d1283749b1 --- /dev/null +++ b/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/remote/BigFinder.java @@ -0,0 +1,22 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.openejb.arquillian.tests.bmp.remote; + +import javax.ejb.EJBObject; + +public interface BigFinder extends EJBObject { +} diff --git a/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/remote/BigFinderBean.java b/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/remote/BigFinderBean.java new file mode 100644 index 00000000000..44de739c822 --- /dev/null +++ b/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/remote/BigFinderBean.java @@ -0,0 +1,57 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.openejb.arquillian.tests.bmp.remote; + +import javax.ejb.EntityBean; +import javax.ejb.EntityContext; +import javax.ejb.RemoveException; +import java.rmi.RemoteException; +import java.util.ArrayList; +import java.util.Collection; + +public class BigFinderBean implements EntityBean { + + public void ejbActivate() throws RemoteException { + } + + public void ejbPassivate() throws RemoteException { + } + + public void setEntityContext(final EntityContext context) throws RemoteException { + } + + public void unsetEntityContext() throws RemoteException { + } + + public void ejbLoad() throws RemoteException { + } + + public void ejbRemove() throws RemoveException, RemoteException { + } + + public void ejbStore() throws RemoteException { + } + + public Collection ejbFindN(final int count) { + final ArrayList pks = new ArrayList(); + for (int i = 0; i < count; ++i) { + pks.add(new BigFinderPK(i)); + } + return pks; + } + +} diff --git a/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/remote/BigFinderHome.java b/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/remote/BigFinderHome.java new file mode 100644 index 00000000000..65bd691e225 --- /dev/null +++ b/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/remote/BigFinderHome.java @@ -0,0 +1,25 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.openejb.arquillian.tests.bmp.remote; + +import javax.ejb.EJBHome; +import java.rmi.RemoteException; +import java.util.Collection; + +public interface BigFinderHome extends EJBHome { + Collection findN(int count) throws RemoteException; +} diff --git a/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/remote/BigFinderPK.java b/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/remote/BigFinderPK.java new file mode 100644 index 00000000000..b8b0cd967ea --- /dev/null +++ b/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/remote/BigFinderPK.java @@ -0,0 +1,24 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.openejb.arquillian.tests.bmp.remote; + +public class BigFinderPK extends IntegerPK { + + public BigFinderPK(final int iKey) { + super(iKey); + } +} diff --git a/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/remote/BmpRemoteEntityTest.java b/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/remote/BmpRemoteEntityTest.java new file mode 100644 index 00000000000..3580a2b153e --- /dev/null +++ b/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/remote/BmpRemoteEntityTest.java @@ -0,0 +1,62 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.openejb.arquillian.tests.bmp.remote; + +import org.apache.ziplock.IO; +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.container.test.api.RunAsClient; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.arquillian.test.api.ArquillianResource; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.asset.ClassLoaderAsset; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.net.URL; + +/** + * @version $Rev$ $Date$ + */ +@RunWith(Arquillian.class) +public class BmpRemoteEntityTest { + + @ArquillianResource + private URL url; + + @Deployment(testable = false) + public static WebArchive createDeployment() { + WebArchive archive = ShrinkWrap.create(WebArchive.class, BmpRemoteEntityTest.class.getSimpleName() + ".war") + .addClasses(BigFinder.class, BigFinderBean.class, BigFinderHome.class, BigFinderPK.class, + FinderServlet.class, FinderTest.class, FinderTestBean.class, FinderTestHome.class, IntegerPK.class, + LittleFinder.class, LittleFinderBean.class, LittleFinderHome.class, LittleFinderPK.class, StringPK.class) + .addAsWebInfResource(new ClassLoaderAsset("org/apache/openejb/arquillian/tests/bmp/remote/ejb-jar.xml"), "ejb-jar.xml") + .addAsWebInfResource(new ClassLoaderAsset("org/apache/openejb/arquillian/tests/bmp/remote/web.xml"), "web.xml"); + + System.out.println(archive.toString(true)); + return archive; + } + + @Test + @RunAsClient + public void checkBmp() throws Exception { + final String output = IO.slurp(new URL(url.toExternalForm())); + System.out.println(output); + Assert.assertTrue(output.contains("Test succeeded")); + } +} diff --git a/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/remote/FinderServlet.java b/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/remote/FinderServlet.java new file mode 100644 index 00000000000..159a18f234a --- /dev/null +++ b/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/remote/FinderServlet.java @@ -0,0 +1,33 @@ +package org.apache.openejb.arquillian.tests.bmp.remote; + +import javax.naming.InitialContext; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + +public class FinderServlet extends HttpServlet { + + @Override + protected void doGet(final HttpServletRequest req, final HttpServletResponse resp) throws ServletException, IOException { + final FinderTestHome testHome; + InitialContext ctx = null; + try { + ctx = new InitialContext(); + testHome = (FinderTestHome) ctx.lookup("java:comp/env/ejb/FinderTest"); + resp.getWriter().println(testHome.create().runTest()); + resp.getWriter().flush(); + } catch (final Exception e) { + throw new ServletException(e); + } finally { + try { + if (ctx != null) { + ctx.close(); + } + } catch (final Exception e) { + throw new ServletException(e); + } + } + } +} diff --git a/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/remote/FinderTest.java b/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/remote/FinderTest.java new file mode 100644 index 00000000000..d1579e84b7d --- /dev/null +++ b/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/remote/FinderTest.java @@ -0,0 +1,24 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.openejb.arquillian.tests.bmp.remote; + +import javax.ejb.EJBObject; +import java.rmi.RemoteException; + +public interface FinderTest extends EJBObject { + String runTest() throws Exception, RemoteException; +} diff --git a/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/remote/FinderTestBean.java b/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/remote/FinderTestBean.java new file mode 100644 index 00000000000..b8ea232fe81 --- /dev/null +++ b/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/remote/FinderTestBean.java @@ -0,0 +1,82 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.openejb.arquillian.tests.bmp.remote; + +import javax.ejb.*; +import javax.naming.Context; +import javax.naming.InitialContext; +import javax.naming.NamingException; +import java.rmi.RemoteException; +import java.util.Arrays; +import java.util.Collection; +import java.util.Properties; + +public class FinderTestBean implements SessionBean { + + public void setSessionContext(final SessionContext context) throws RemoteException { + } + + public void ejbRemove() throws RemoteException { + } + + public void ejbActivate() throws RemoteException { + } + + public void ejbPassivate() throws RemoteException { + } + + public void ejbCreate() throws CreateException { + } + + public String runTest() + throws Exception { + final BigFinderHome bigFinderHome = (BigFinderHome) lookup("BigFinderHome"); + final LittleFinderHome littleFinderHome = (LittleFinderHome) lookup("LittleFinderHome"); + for (int i = 1; i < 300; ++i) { + bigFinderHome.findN(i); + + final Collection littleList = littleFinderHome.findAll(); + for (final Object obj : littleList) { + final StringBuilder msg = new StringBuilder(); + if (!(obj instanceof LittleFinder)) { + msg.append("Failed with " + i + " records. LittleFinder Remote is actually " + obj.getClass().getName() + " Implemented interfaces " + Arrays.toString(obj.getClass().getInterfaces())); + if (obj instanceof EJBObject) { + final Object pk = ((EJBObject) obj).getPrimaryKey(); + msg.append(" Primary key value is " + pk); + } + + throw new EJBException(msg.toString()); + } + } + } + + return "Test succeeded"; + } + + public static Object lookup(final String s) throws NamingException { + final Properties p = new Properties(); + p.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.core.LocalInitialContextFactory"); + final InitialContext ctx = new InitialContext(p); + try { + return ctx.lookup("java:comp/env/ejb/" + s); + } finally { + ctx.close(); + } + } + + +} diff --git a/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/remote/FinderTestHome.java b/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/remote/FinderTestHome.java new file mode 100644 index 00000000000..91bb982b2f8 --- /dev/null +++ b/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/remote/FinderTestHome.java @@ -0,0 +1,25 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.openejb.arquillian.tests.bmp.remote; + +import javax.ejb.CreateException; +import javax.ejb.EJBHome; +import java.rmi.RemoteException; + +public interface FinderTestHome extends EJBHome { + FinderTest create() throws CreateException, RemoteException; +} diff --git a/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/remote/IntegerPK.java b/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/remote/IntegerPK.java new file mode 100644 index 00000000000..99523cab3a6 --- /dev/null +++ b/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/remote/IntegerPK.java @@ -0,0 +1,99 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.openejb.arquillian.tests.bmp.remote; + +import java.sql.PreparedStatement; +import java.sql.SQLException; +import java.sql.Types; + +/** + * The base class for a primary key for an integer type. + */ +public class IntegerPK extends Number { + private static final long serialVersionUID = 351946466791640696L; + private int m_value; + + public IntegerPK(final int value) { + m_value = value; + } + + public int getValue() { + return m_value; + } + + public Object clone() { + try { + return super.clone(); + } catch (final CloneNotSupportedException exc) { + throw new RuntimeException("Cannot clone", exc); + } + } + + public boolean equals(final Object o) { + if (o == null) + return false; + return m_value == ((IntegerPK) o).m_value; + } + + public int compareTo(final Object o) { + return (int) (m_value - ((IntegerPK) o).m_value); + } + + public int hashCode() { + return m_value; + } + + public String toString() { + return String.valueOf(m_value); + } + + // Number interface + public byte byteValue() { + return (byte) m_value; + } + + public short shortValue() { + return (short) m_value; + } + + public int intValue() { + return m_value; + } + + public long longValue() { + return m_value; + } + + public float floatValue() { + return m_value; + } + + public double doubleValue() { + return m_value; + } + + /** + * For ParmType interface + */ + public void add(final int i, final PreparedStatement stat) throws SQLException { + stat.setInt(i, m_value); + } + + public int getType() { + return Types.INTEGER; + } +} diff --git a/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/remote/LittleFinder.java b/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/remote/LittleFinder.java new file mode 100644 index 00000000000..37cb9fbd13f --- /dev/null +++ b/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/remote/LittleFinder.java @@ -0,0 +1,22 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.openejb.arquillian.tests.bmp.remote; + +import javax.ejb.EJBObject; + +public interface LittleFinder extends EJBObject { +} diff --git a/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/remote/LittleFinderBean.java b/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/remote/LittleFinderBean.java new file mode 100644 index 00000000000..0635f85984d --- /dev/null +++ b/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/remote/LittleFinderBean.java @@ -0,0 +1,55 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.openejb.arquillian.tests.bmp.remote; + +import javax.ejb.EntityBean; +import javax.ejb.EntityContext; +import java.rmi.RemoteException; +import java.util.ArrayList; +import java.util.Collection; + +public class LittleFinderBean implements EntityBean { + private static final long serialVersionUID = -1719910497840449494L; + + public void ejbActivate() throws RemoteException { + } + + public void ejbPassivate() throws RemoteException { + } + + public void setEntityContext(final EntityContext context) throws RemoteException { + } + + public void unsetEntityContext() throws RemoteException { + } + + public void ejbLoad() throws RemoteException { + } + + public void ejbStore() throws RemoteException { + } + + public void ejbRemove() throws RemoteException { + } + + public Collection ejbFindAll() throws Exception { + final ArrayList pks = new ArrayList(); + pks.add(new LittleFinderPK("1A")); + return pks; + } + +} diff --git a/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/remote/LittleFinderHome.java b/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/remote/LittleFinderHome.java new file mode 100644 index 00000000000..1f9b1a7dc04 --- /dev/null +++ b/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/remote/LittleFinderHome.java @@ -0,0 +1,25 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.openejb.arquillian.tests.bmp.remote; + +import javax.ejb.EJBHome; +import java.rmi.RemoteException; +import java.util.Collection; + +public interface LittleFinderHome extends EJBHome { + Collection findAll() throws Exception, RemoteException; +} diff --git a/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/remote/LittleFinderPK.java b/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/remote/LittleFinderPK.java new file mode 100644 index 00000000000..36185feffe9 --- /dev/null +++ b/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/remote/LittleFinderPK.java @@ -0,0 +1,25 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.openejb.arquillian.tests.bmp.remote; + +public class LittleFinderPK extends StringPK { + private static final long serialVersionUID = 5782590322327281948L; + + public LittleFinderPK(final String s) { + super(s); + } +} diff --git a/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/remote/StringPK.java b/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/remote/StringPK.java new file mode 100644 index 00000000000..2986f84e414 --- /dev/null +++ b/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/java/org/apache/openejb/arquillian/tests/bmp/remote/StringPK.java @@ -0,0 +1,71 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.openejb.arquillian.tests.bmp.remote; + +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; +import java.sql.Types; + +/** + * A primary key in a Database table with a String representation (varchar). + */ +public class StringPK implements Serializable { + private static final long serialVersionUID = -6429314795121119701L; + private String m_value; + + public StringPK(final String s) { + m_value = s; + } + + public String getValue() { + return m_value; + } + + public boolean equals(final Object o) { + if (o instanceof StringPK) { + final StringPK s = (StringPK) o; + if (m_value == null) + return s.m_value == null; + return m_value.equals(s.m_value); + } else { + return false; + } + } + + public int compareTo(final Object o) { + return ("" + m_value).compareTo(((StringPK) o).m_value); + } + + public int hashCode() { + return ("" + m_value).hashCode(); + } + + public String toString() { + if (m_value == null) + return "NULL"; + return '\'' + m_value + '\''; + } + + public void add(final int i, final PreparedStatement stat) throws SQLException { + stat.setString(i, m_value); + } + + public int getType() { + return Types.VARCHAR; + } +} diff --git a/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/resources/org/apache/openejb/arquillian/tests/bmp/local/ejb-jar.xml b/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/resources/org/apache/openejb/arquillian/tests/bmp/local/ejb-jar.xml new file mode 100644 index 00000000000..3d62471a4a4 --- /dev/null +++ b/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/resources/org/apache/openejb/arquillian/tests/bmp/local/ejb-jar.xml @@ -0,0 +1,65 @@ + + + + + + FinderTestHome + org.apache.openejb.arquillian.tests.bmp.local.FinderTestHome + org.apache.openejb.arquillian.tests.bmp.local.FinderTest + org.apache.openejb.arquillian.tests.bmp.local.FinderTestBean + Stateless + Container + + ejb/LittleFinderHome + Entity + org.apache.openejb.arquillian.tests.bmp.local.LittleFinderHome + org.apache.openejb.arquillian.tests.bmp.local.LittleFinder + LittleFinderHome + + + ejb/BigFinderHome + Entity + org.apache.openejb.arquillian.tests.bmp.local.BigFinderHome + org.apache.openejb.arquillian.tests.bmp.local.BigFinder + BigFinderHome + + + + LittleFinder + LittleFinderHome + org.apache.openejb.arquillian.tests.bmp.local.LittleFinderHome + org.apache.openejb.arquillian.tests.bmp.local.LittleFinder + org.apache.openejb.arquillian.tests.bmp.local.LittleFinderBean + Bean + org.apache.openejb.arquillian.tests.bmp.local.LittleFinderPK + False + + + BigFinder + BigFinderHome + org.apache.openejb.arquillian.tests.bmp.local.BigFinderHome + org.apache.openejb.arquillian.tests.bmp.local.BigFinder + org.apache.openejb.arquillian.tests.bmp.local.BigFinderBean + Bean + org.apache.openejb.arquillian.tests.bmp.local.BigFinderPK + False + + + + diff --git a/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/resources/org/apache/openejb/arquillian/tests/bmp/local/web.xml b/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/resources/org/apache/openejb/arquillian/tests/bmp/local/web.xml new file mode 100644 index 00000000000..9a50cc7bd10 --- /dev/null +++ b/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/resources/org/apache/openejb/arquillian/tests/bmp/local/web.xml @@ -0,0 +1,42 @@ + + + + + + TestServlet + org.apache.openejb.arquillian.tests.bmp.local.FinderServlet + + + + TestServlet + / + + + + ejb/FinderTest + Session + org.apache.openejb.arquillian.tests.bmp.local.FinderTestHome + org.apache.openejb.arquillian.tests.bmp.local.FinderTest + + diff --git a/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/resources/org/apache/openejb/arquillian/tests/bmp/remote/ejb-jar.xml b/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/resources/org/apache/openejb/arquillian/tests/bmp/remote/ejb-jar.xml new file mode 100644 index 00000000000..5485dcb7d19 --- /dev/null +++ b/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/resources/org/apache/openejb/arquillian/tests/bmp/remote/ejb-jar.xml @@ -0,0 +1,65 @@ + + + + + + FinderTestHome + org.apache.openejb.arquillian.tests.bmp.remote.FinderTestHome + org.apache.openejb.arquillian.tests.bmp.remote.FinderTest + org.apache.openejb.arquillian.tests.bmp.remote.FinderTestBean + Stateless + Container + + ejb/LittleFinderHome + Entity + org.apache.openejb.arquillian.tests.bmp.remote.LittleFinderHome + org.apache.openejb.arquillian.tests.bmp.remote.LittleFinder + LittleFinderHome + + + ejb/BigFinderHome + Entity + org.apache.openejb.arquillian.tests.bmp.remote.BigFinderHome + org.apache.openejb.arquillian.tests.bmp.remote.BigFinder + BigFinderHome + + + + LittleFinder + LittleFinderHome + org.apache.openejb.arquillian.tests.bmp.remote.LittleFinderHome + org.apache.openejb.arquillian.tests.bmp.remote.LittleFinder + org.apache.openejb.arquillian.tests.bmp.remote.LittleFinderBean + Bean + org.apache.openejb.arquillian.tests.bmp.remote.LittleFinderPK + False + + + BigFinder + BigFinderHome + org.apache.openejb.arquillian.tests.bmp.remote.BigFinderHome + org.apache.openejb.arquillian.tests.bmp.remote.BigFinder + org.apache.openejb.arquillian.tests.bmp.remote.BigFinderBean + Bean + org.apache.openejb.arquillian.tests.bmp.remote.BigFinderPK + False + + + + diff --git a/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/resources/org/apache/openejb/arquillian/tests/bmp/remote/web.xml b/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/resources/org/apache/openejb/arquillian/tests/bmp/remote/web.xml new file mode 100644 index 00000000000..7d52703703c --- /dev/null +++ b/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/resources/org/apache/openejb/arquillian/tests/bmp/remote/web.xml @@ -0,0 +1,42 @@ + + + + + + TestServlet + org.apache.openejb.arquillian.tests.bmp.remote.FinderServlet + + + + TestServlet + / + + + + ejb/FinderTest + Session + org.apache.openejb.arquillian.tests.bmp.remote.FinderTestHome + org.apache.openejb.arquillian.tests.bmp.remote.FinderTest + + From 9a68c9cc91a211ab64e79378e15426f8d8f3c5cb Mon Sep 17 00:00:00 2001 From: Jonathan Gallimore Date: Wed, 12 Dec 2018 10:41:32 +0000 Subject: [PATCH 2/3] TOMEE-2234 serialize the handle as an int as opposed to a byte --- .../java/org/apache/openejb/core/ivm/IntraVmArtifact.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/IntraVmArtifact.java b/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/IntraVmArtifact.java index 1800f11ac97..8c31c33ea65 100644 --- a/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/IntraVmArtifact.java +++ b/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/IntraVmArtifact.java @@ -71,12 +71,12 @@ public IntraVmArtifact() { public void writeExternal(final ObjectOutput out) throws IOException { out.writeBoolean(staticArtifact); - out.write(instanceHandle); + out.writeInt(instanceHandle); } public void readExternal(final ObjectInput in) throws IOException { staticArtifact = in.readBoolean(); - instanceHandle = in.read(); + instanceHandle = in.readInt(); } protected Object readResolve() throws ObjectStreamException { From 35d5896d1defaea8de59acf3cfaca799a9a2e330 Mon Sep 17 00:00:00 2001 From: Jonathan Gallimore Date: Wed, 12 Dec 2018 11:58:08 +0000 Subject: [PATCH 3/3] TOMEE-2234 fix for webapp tests --- .../org/apache/openejb/arquillian/tests/bmp/local/web.xml | 2 +- .../org/apache/openejb/arquillian/tests/bmp/remote/web.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/resources/org/apache/openejb/arquillian/tests/bmp/local/web.xml b/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/resources/org/apache/openejb/arquillian/tests/bmp/local/web.xml index 9a50cc7bd10..68eb159822b 100644 --- a/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/resources/org/apache/openejb/arquillian/tests/bmp/local/web.xml +++ b/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/resources/org/apache/openejb/arquillian/tests/bmp/local/web.xml @@ -30,7 +30,7 @@ TestServlet - / + /* diff --git a/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/resources/org/apache/openejb/arquillian/tests/bmp/remote/web.xml b/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/resources/org/apache/openejb/arquillian/tests/bmp/remote/web.xml index 7d52703703c..ba52a00bf3c 100644 --- a/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/resources/org/apache/openejb/arquillian/tests/bmp/remote/web.xml +++ b/arquillian/arquillian-tomee-tests/arquillian-tomee-webprofile-tests/src/test/resources/org/apache/openejb/arquillian/tests/bmp/remote/web.xml @@ -30,7 +30,7 @@ TestServlet - / + /*