forked from wildfly/wildfly
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
284 additions
and
0 deletions.
There are no files selected for viewing
74 changes: 74 additions & 0 deletions
74
...ava/org/jboss/as/test/integration/ejb/interceptor/complex/a/InterceptorUnitTestCaseB.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
/* | ||
* JBoss, Home of Professional Open Source. | ||
* Copyright 2006, 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.as.test.integration.ejb.interceptor.complex.a; | ||
|
||
import javax.naming.InitialContext; | ||
|
||
import org.jboss.arquillian.container.test.api.Deployment; | ||
import org.jboss.arquillian.junit.Arquillian; | ||
import org.jboss.arquillian.test.api.ArquillianResource; | ||
import org.jboss.logging.Logger; | ||
import org.jboss.shrinkwrap.api.Archive; | ||
import org.jboss.shrinkwrap.api.ShrinkWrap; | ||
import org.jboss.shrinkwrap.api.spec.JavaArchive; | ||
import org.junit.Assert; | ||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
|
||
/** | ||
* Injection test. | ||
*/ | ||
@RunWith(Arquillian.class) | ||
public class InterceptorUnitTestCaseB | ||
{ | ||
private static final Logger log = Logger.getLogger(InterceptorUnitTestCaseB.class); | ||
|
||
@ArquillianResource | ||
InitialContext ctx; | ||
|
||
@Deployment | ||
public static Archive<?> deployment() { | ||
final JavaArchive jar = ShrinkWrap.create(JavaArchive.class, "interceptor-complexb-test.jar") | ||
.addPackage(InterceptorUnitTestCaseB.class.getPackage()) | ||
.addAsManifestResource(InterceptorUnitTestCaseB.class.getPackage(), "ejb-jar.xml", "ejb-jar.xml"); | ||
log.info(jar.toString(true)); | ||
return jar; | ||
} | ||
static boolean deployed = false; | ||
static int test = 0; | ||
|
||
@Test | ||
public void testInjection() throws Exception | ||
{ | ||
MySession2RemoteB test = (MySession2RemoteB) ctx.lookup("java:module/MySession2BeanB"); | ||
boolean a = test.doit(); | ||
Assert.assertEquals(false, a); | ||
} | ||
|
||
@Test | ||
public void testInjection2() throws Exception | ||
{ | ||
MyTestRemoteB test = (MyTestRemoteB) ctx.lookup("java:module/MyTestB"); | ||
boolean a = test.doit(); | ||
Assert.assertEquals(true, a); | ||
} | ||
} |
46 changes: 46 additions & 0 deletions
46
...rc/test/java/org/jboss/as/test/integration/ejb/interceptor/complex/a/MySession2BeanB.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
* JBoss, Home of Professional Open Source. | ||
* Copyright 2006, 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.as.test.integration.ejb.interceptor.complex.a; | ||
|
||
import javax.ejb.Stateless; | ||
|
||
import org.jboss.logging.Logger; | ||
|
||
/** | ||
* @author <a href="mailto:bill@jboss.org">Bill Burke</a> | ||
*/ | ||
@Stateless | ||
public class MySession2BeanB implements MySession2RemoteB | ||
{ | ||
private static final Logger log = Logger.getLogger(MySession2BeanB.class); | ||
|
||
public boolean doit() | ||
{ | ||
log.info("Calling MySession2BeanB doit..."); | ||
return true; | ||
} | ||
|
||
public boolean doitSession() { | ||
log.info("Calling MySession2BeanB doitSession..."); | ||
return true; | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
.../test/java/org/jboss/as/test/integration/ejb/interceptor/complex/a/MySession2RemoteB.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* JBoss, Home of Professional Open Source. | ||
* Copyright 2006, 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.as.test.integration.ejb.interceptor.complex.a; | ||
|
||
import javax.ejb.Remote; | ||
|
||
/** | ||
* @author <a href="mailto:bill@jboss.org">Bill Burke</a> | ||
*/ | ||
@Remote | ||
public interface MySession2RemoteB | ||
{ | ||
boolean doit(); | ||
|
||
boolean doitSession(); | ||
} |
19 changes: 19 additions & 0 deletions
19
...ration/src/test/java/org/jboss/as/test/integration/ejb/interceptor/complex/a/MyTestB.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package org.jboss.as.test.integration.ejb.interceptor.complex.a; | ||
|
||
import javax.ejb.Stateless; | ||
|
||
import org.jboss.logging.Logger; | ||
|
||
@Stateless | ||
public class MyTestB implements MyTestRemoteB { | ||
private static final Logger log = Logger.getLogger(MyTestB.class); | ||
|
||
MySession2RemoteB session23; | ||
|
||
public boolean doit() { | ||
log.info("Calling MyTest..."); | ||
session23.doitSession(); | ||
log.info("Calling MyTest - after doit"); | ||
return true; | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
.../src/test/java/org/jboss/as/test/integration/ejb/interceptor/complex/a/MyTestRemoteB.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package org.jboss.as.test.integration.ejb.interceptor.complex.a; | ||
|
||
import javax.ejb.Remote; | ||
|
||
@Remote | ||
public interface MyTestRemoteB { | ||
boolean doit(); | ||
} |
45 changes: 45 additions & 0 deletions
45
...rc/test/java/org/jboss/as/test/integration/ejb/interceptor/complex/a/XMLInterceptorB.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
* JBoss, Home of Professional Open Source. | ||
* Copyright 2006, 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.as.test.integration.ejb.interceptor.complex.a; | ||
|
||
import javax.interceptor.InvocationContext; | ||
|
||
import org.jboss.logging.Logger; | ||
|
||
/** | ||
* @author <a href="kabir.khan@jboss.com">Kabir Khan</a> | ||
*/ | ||
public class XMLInterceptorB | ||
{ | ||
private static final Logger log = Logger.getLogger(XMLInterceptorB.class); | ||
|
||
MySession2RemoteB session2; | ||
|
||
public Object intercept(InvocationContext ctx) throws Exception | ||
{ | ||
log.info("Calling XMLInterceptorB..."); | ||
session2.doit(); | ||
log.info("Calling XMLInterceptorB - after doit"); | ||
return false; | ||
} | ||
|
||
} |
57 changes: 57 additions & 0 deletions
57
...gration/src/test/java/org/jboss/as/test/integration/ejb/interceptor/complex/a/ejb-jar.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ejb-jar xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee | ||
http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd" | ||
version="3.0"> | ||
<display-name>InterceptorsTest</display-name> | ||
|
||
<enterprise-beans> | ||
<session> | ||
<ejb-name>MyTestB</ejb-name> | ||
<business-remote>org.jboss.as.test.integration.ejb.interceptor.complex.a.MyTestRemoteB</business-remote> | ||
<ejb-class>org.jboss.as.test.integration.ejb.interceptor.complex.a.MyTestB</ejb-class> | ||
<session-type>Stateless</session-type> | ||
<transaction-type>Container</transaction-type> | ||
<ejb-ref> | ||
<ejb-ref-name>ejb/Session23</ejb-ref-name> | ||
<ejb-ref-type>Session</ejb-ref-type> | ||
<remote>org.jboss.as.test.integration.ejb.interceptor.complex.a.MySession2RemoteB</remote> | ||
<ejb-link>MySession2BeanB</ejb-link> | ||
<injection-target> | ||
<injection-target-class>org.jboss.as.test.integration.ejb.interceptor.complex.a.MyTestB</injection-target-class> | ||
<injection-target-name>session23</injection-target-name> | ||
</injection-target> | ||
</ejb-ref> | ||
</session> | ||
</enterprise-beans> | ||
|
||
<interceptors> | ||
<interceptor> | ||
<interceptor-class>org.jboss.as.test.integration.ejb.interceptor.complex.a.XMLInterceptorB</interceptor-class> | ||
<around-invoke> | ||
<method-name>intercept</method-name> | ||
</around-invoke> | ||
<ejb-ref> | ||
<ejb-ref-name>ejb/Session2</ejb-ref-name> | ||
<ejb-ref-type>Session</ejb-ref-type> | ||
<remote>org.jboss.as.test.integration.ejb.interceptor.complex.a.MySession2RemoteB</remote> | ||
<ejb-link>MySession2BeanB</ejb-link> | ||
<injection-target> | ||
<injection-target-class>org.jboss.as.test.integration.ejb.interceptor.complex.a.XMLInterceptorB</injection-target-class> | ||
<injection-target-name>session2</injection-target-name> | ||
</injection-target> | ||
</ejb-ref> | ||
</interceptor> | ||
</interceptors> | ||
<assembly-descriptor> | ||
<interceptor-binding> | ||
<ejb-name>MySession2BeanB</ejb-name> | ||
<interceptor-class>org.jboss.as.test.integration.ejb.interceptor.complex.a.XMLInterceptorB</interceptor-class> | ||
<method> | ||
<method-name>doit</method-name> | ||
</method> | ||
</interceptor-binding> | ||
</assembly-descriptor> | ||
|
||
|
||
</ejb-jar> |