From c971a372c82d467f62face827479950c243e4fe7 Mon Sep 17 00:00:00 2001
From: Carlo de Wolf <cdewolf@redhat.com>
Date: Fri, 26 Aug 2011 12:43:24 +0200
Subject: [PATCH] AS7-1658: test case

---
 .../jboss/as/test/spec/ejb3/as7_1658/a/ABean.java  |   35 +++++++++++
 .../as/test/spec/ejb3/as7_1658/a/ARemote.java      |   32 ++++++++++
 .../jboss/as/test/spec/ejb3/as7_1658/b/BBean.java  |   45 ++++++++++++++
 .../ejb3/as7_1658/InvokeRemoteViewTestCase.java    |   63 ++++++++++++++++++++
 4 files changed, 175 insertions(+), 0 deletions(-)
 create mode 100644 testsuite/spec/src/main/java/org/jboss/as/test/spec/ejb3/as7_1658/a/ABean.java
 create mode 100644 testsuite/spec/src/main/java/org/jboss/as/test/spec/ejb3/as7_1658/a/ARemote.java
 create mode 100644 testsuite/spec/src/main/java/org/jboss/as/test/spec/ejb3/as7_1658/b/BBean.java
 create mode 100644 testsuite/spec/src/test/java/org/jboss/as/test/spec/ejb3/as7_1658/InvokeRemoteViewTestCase.java

diff --git a/testsuite/spec/src/main/java/org/jboss/as/test/spec/ejb3/as7_1658/a/ABean.java b/testsuite/spec/src/main/java/org/jboss/as/test/spec/ejb3/as7_1658/a/ABean.java
new file mode 100644
index 0000000..798d996
--- /dev/null
+++ b/testsuite/spec/src/main/java/org/jboss/as/test/spec/ejb3/as7_1658/a/ABean.java
@@ -0,0 +1,35 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright (c) 2011, Red Hat, Inc., 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.as.test.spec.ejb3.as7_1658.a;
+
+import javax.ejb.Stateless;
+
+/**
+ * @author <a href="mailto:cdewolf@redhat.com">Carlo de Wolf</a>
+ */
+@Stateless
+public class ABean implements ARemote {
+    @Override
+    public void doNothing() {
+        // do nothing
+    }
+}
diff --git a/testsuite/spec/src/main/java/org/jboss/as/test/spec/ejb3/as7_1658/a/ARemote.java b/testsuite/spec/src/main/java/org/jboss/as/test/spec/ejb3/as7_1658/a/ARemote.java
new file mode 100644
index 0000000..c5bbc2a
--- /dev/null
+++ b/testsuite/spec/src/main/java/org/jboss/as/test/spec/ejb3/as7_1658/a/ARemote.java
@@ -0,0 +1,32 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright (c) 2011, Red Hat, Inc., 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.as.test.spec.ejb3.as7_1658.a;
+
+import javax.ejb.Remote;
+
+/**
+ * @author <a href="mailto:cdewolf@redhat.com">Carlo de Wolf</a>
+ */
+@Remote
+public interface ARemote {
+    void doNothing();
+}
diff --git a/testsuite/spec/src/main/java/org/jboss/as/test/spec/ejb3/as7_1658/b/BBean.java b/testsuite/spec/src/main/java/org/jboss/as/test/spec/ejb3/as7_1658/b/BBean.java
new file mode 100644
index 0000000..3e5b461
--- /dev/null
+++ b/testsuite/spec/src/main/java/org/jboss/as/test/spec/ejb3/as7_1658/b/BBean.java
@@ -0,0 +1,45 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright (c) 2011, Red Hat, Inc., 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.as.test.spec.ejb3.as7_1658.b;
+
+import org.jboss.as.test.spec.ejb3.as7_1658.a.ARemote;
+
+import javax.ejb.Stateless;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+/**
+ * @author <a href="mailto:cdewolf@redhat.com">Carlo de Wolf</a>
+ */
+@Stateless
+public class BBean {
+    public void doNothing() {
+        try {
+            final InitialContext ctx = new InitialContext();
+            final ARemote a = (ARemote) ctx.lookup("java:global/as7_1658-a/ABean!org.jboss.as.test.spec.ejb3.as7_1658.a.ARemote");
+            // delegate to ARemote
+            a.doNothing();
+        } catch (NamingException e) {
+            throw new RuntimeException(e);
+        }
+    }
+}
diff --git a/testsuite/spec/src/test/java/org/jboss/as/test/spec/ejb3/as7_1658/InvokeRemoteViewTestCase.java b/testsuite/spec/src/test/java/org/jboss/as/test/spec/ejb3/as7_1658/InvokeRemoteViewTestCase.java
new file mode 100644
index 0000000..c526ec7
--- /dev/null
+++ b/testsuite/spec/src/test/java/org/jboss/as/test/spec/ejb3/as7_1658/InvokeRemoteViewTestCase.java
@@ -0,0 +1,63 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright (c) 2011, Red Hat, Inc., 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.as.test.spec.ejb3.as7_1658;
+
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.OperateOnDeployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.as.test.spec.ejb3.as7_1658.a.ABean;
+import org.jboss.as.test.spec.ejb3.as7_1658.a.ARemote;
+import org.jboss.as.test.spec.ejb3.as7_1658.b.BBean;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import javax.naming.InitialContext;
+
+/**
+ * @author <a href="mailto:cdewolf@redhat.com">Carlo de Wolf</a>
+ */
+@RunWith(Arquillian.class)
+public class InvokeRemoteViewTestCase {
+    @Deployment
+    public static Archive<?> createA() {
+        return ShrinkWrap.create(JavaArchive.class, "as7_1658-a.jar")
+                .addPackage(ABean.class.getPackage());
+    }
+
+    @Deployment(name = "as7_1658-b")
+    public static Archive<?> createB() {
+        return ShrinkWrap.create(JavaArchive.class, "as7_1658-b.jar")
+                .addPackage(BBean.class.getPackage())
+                .addClass(ARemote.class);
+    }
+
+    @Test
+    @OperateOnDeployment("as7_1658-b")
+    public void testInvoke() throws Exception {
+        final InitialContext ctx = new InitialContext();
+        final BBean bean = (BBean) ctx.lookup("java:global/as7_1658-b/BBean");
+        bean.doNothing();
+    }
+}
-- 
1.7.4.1

