repo
stringlengths
1
191
file
stringlengths
23
351
code
stringlengths
0
5.32M
file_length
int64
0
5.32M
avg_line_length
float64
0
2.9k
max_line_length
int64
0
288k
extension_type
stringclasses
1 value
null
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/interceptor/order/GreeterBean.java
/* * JBoss, Home of Professional Open Source. * Copyright 2008, 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.order; import jakarta.ejb.Stateless; import jakarta.interceptor.Interceptors; /** * @author <a href="mailto:[email protected]">Carlo de Wolf</a> */ @Stateless @Interceptors({ FirstCustomInterceptor.class, SecondCustomInterceptor.class }) public class GreeterBean implements GreeterRemote { public String sayHi(String name) { return "Hi " + name; } }
1,457
38.405405
78
java
null
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/interceptor/exception/BarBinding.java
/* * JBoss, Home of Professional Open Source * Copyright 2013, Red Hat Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt 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.exception; import static java.lang.annotation.ElementType.TYPE; import static java.lang.annotation.RetentionPolicy.RUNTIME; import java.lang.annotation.Documented; import java.lang.annotation.Inherited; import java.lang.annotation.Retention; import java.lang.annotation.Target; import jakarta.interceptor.InterceptorBinding; @Target({ TYPE }) @Retention(RUNTIME) @Documented @Inherited @InterceptorBinding public @interface BarBinding { }
1,513
35.926829
73
java
null
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/interceptor/exception/EjbInterceptorExceptionTestCase.java
/* * JBoss, Home of Professional Open Source * Copyright 2013, Red Hat Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt 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.exception; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import jakarta.enterprise.inject.Instance; import jakarta.inject.Inject; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.junit.Arquillian; import org.jboss.shrinkwrap.api.Archive; import org.jboss.shrinkwrap.api.ShrinkWrap; import org.jboss.shrinkwrap.api.asset.EmptyAsset; import org.jboss.shrinkwrap.api.spec.WebArchive; import org.junit.Test; import org.junit.runner.RunWith; /** * Tests that exception thrown in interceptor method intercepting a session bean does not get suppressed. * * @author Matus Abaffy * @author Jozef Hartinger */ @RunWith(Arquillian.class) public class EjbInterceptorExceptionTestCase { @Deployment public static Archive<?> deploy() { WebArchive war = ShrinkWrap.create(WebArchive.class, "test.war") .addPackage(EjbInterceptorExceptionTestCase.class.getPackage()) .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml"); return war; } @Inject Instance<Baf> bafInstance; @Inject Instance<Bar> barInstance; @Inject Instance<Foo> fooInstance; @Test public void testExceptionNotSuppressedInAroundConstructCallback() { assertNotNull(bafInstance); BarPostConstructInterceptor.reset(); boolean fail = false; try { bafInstance.get().doSomething(); fail = true; } catch (Throwable e) { // OK } if (fail) { fail("Assertion error in AroundConstruct interceptor method was suppressed."); } assertTrue(BafAroundConstructInterceptor.isAroundConstructCalled()); } @Test public void testExceptionNotSuppressedInPostConstructCallback() { assertNotNull(barInstance); BarPostConstructInterceptor.reset(); try { barInstance.get().doSomething(); fail("Exception in PostConstruct interceptor method was suppressed."); } catch (Exception e) { // OK } assertTrue(BarPostConstructInterceptor.isPostConstructCalled()); } @Test public void testExceptionNotSuppressedInAroundInvoke() { assertNotNull(fooInstance); FooAroundInvokeInterceptor.reset(); try { Foo foo = fooInstance.get(); foo.doSomething(); fail("Exception in AroundInvoke interceptor method was suppressed."); } catch (Exception e) { // OK } assertTrue(FooAroundInvokeInterceptor.isAroundInvokeCalled()); } }
3,756
32.846847
105
java
null
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/interceptor/exception/Baf.java
/* * JBoss, Home of Professional Open Source * Copyright 2013, Red Hat Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt 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.exception; import jakarta.ejb.Stateful; @BafBinding @Stateful public class Baf { public void doSomething() { } }
1,194
35.212121
73
java
null
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/interceptor/exception/FooBinding.java
/* * JBoss, Home of Professional Open Source * Copyright 2013, Red Hat Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt 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.exception; import static java.lang.annotation.ElementType.TYPE; import static java.lang.annotation.RetentionPolicy.RUNTIME; import java.lang.annotation.Documented; import java.lang.annotation.Inherited; import java.lang.annotation.Retention; import java.lang.annotation.Target; import jakarta.interceptor.InterceptorBinding; @Target({ TYPE }) @Retention(RUNTIME) @Documented @Inherited @InterceptorBinding public @interface FooBinding { }
1,513
35.926829
73
java
null
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/interceptor/exception/BafBinding.java
/* * JBoss, Home of Professional Open Source * Copyright 2013, Red Hat Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt 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.exception; import static java.lang.annotation.ElementType.TYPE; import static java.lang.annotation.RetentionPolicy.RUNTIME; import java.lang.annotation.Documented; import java.lang.annotation.Inherited; import java.lang.annotation.Retention; import java.lang.annotation.Target; import jakarta.interceptor.InterceptorBinding; @Target({ TYPE }) @Retention(RUNTIME) @Documented @Inherited @InterceptorBinding public @interface BafBinding { }
1,513
35.926829
73
java
null
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/interceptor/exception/Bar.java
/* * JBoss, Home of Professional Open Source * Copyright 2013, Red Hat Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt 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.exception; import jakarta.ejb.Stateful; @BarBinding @Stateful public class Bar { public void doSomething() { } }
1,194
35.212121
73
java
null
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/interceptor/exception/BarPostConstructInterceptor.java
/* * JBoss, Home of Professional Open Source * Copyright 2013, Red Hat Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt 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.exception; import jakarta.annotation.PostConstruct; import jakarta.annotation.Priority; import jakarta.interceptor.Interceptor; import jakarta.interceptor.InvocationContext; @BarBinding @Priority(1000) @Interceptor public class BarPostConstructInterceptor { private static boolean postConstructCalled = false; @PostConstruct public void intercept(InvocationContext ctx) { postConstructCalled = true; throw new IllegalStateException("Do not suppress me."); } public static void reset() { postConstructCalled = false; } public static boolean isPostConstructCalled() { return postConstructCalled; } }
1,737
34.469388
73
java
null
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/interceptor/exception/FooAroundInvokeInterceptor.java
/* * JBoss, Home of Professional Open Source * Copyright 2013, Red Hat Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt 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.exception; import jakarta.annotation.Priority; import jakarta.interceptor.AroundInvoke; import jakarta.interceptor.Interceptor; import jakarta.interceptor.InvocationContext; @FooBinding @Priority(1000) @Interceptor public class FooAroundInvokeInterceptor { private static boolean aroundInvokeCalled = false; @AroundInvoke public Object intercept(InvocationContext ctx) { aroundInvokeCalled = true; throw new RuntimeException("Do not suppress me."); } public static void reset() { aroundInvokeCalled = false; } public static boolean isAroundInvokeCalled() { return aroundInvokeCalled; } }
1,728
33.58
73
java
null
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/interceptor/exception/BafAroundConstructInterceptor.java
/* * JBoss, Home of Professional Open Source * Copyright 2013, Red Hat Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt 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.exception; import jakarta.annotation.Priority; import jakarta.interceptor.AroundConstruct; import jakarta.interceptor.Interceptor; import jakarta.interceptor.InvocationContext; @BafBinding @Priority(1000) @Interceptor public class BafAroundConstructInterceptor { private static boolean aroundConstructCalled = false; @AroundConstruct public void intercept(InvocationContext ctx) { aroundConstructCalled = true; throw new Error("Do not suppress me."); } public static void reset() { aroundConstructCalled = false; } public static boolean isAroundConstructCalled() { return aroundConstructCalled; } }
1,738
34.489796
73
java
null
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/interceptor/exception/Foo.java
/* * JBoss, Home of Professional Open Source * Copyright 2013, Red Hat Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt 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.exception; import jakarta.ejb.Stateless; @FooBinding @Stateless public class Foo { public void doSomething() { } }
1,196
35.272727
73
java
null
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/interceptor/aroundconstruct/simple/AroundConstructInterceptorWithObjectReturnTypeSLSB.java
/* * JBoss, Home of Professional Open Source * Copyright 2010, Red Hat Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt 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.aroundconstruct.simple; import jakarta.ejb.Stateless; import jakarta.interceptor.Interceptors; /** * @author Dmitrii Tikhomirov */ @Stateless @Interceptors(AroundConstructInterceptorWithObjectReturnType.class) public class AroundConstructInterceptorWithObjectReturnTypeSLSB { private String message = ""; public void append(String m) { message += m; } public String getMessage() { return message; } }
1,515
32.688889
77
java
null
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/interceptor/aroundconstruct/simple/AroundConstructSimpleTestCase.java
/* * JBoss, Home of Professional Open Source * Copyright 2010, Red Hat Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt 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.aroundconstruct.simple; import javax.naming.InitialContext; import javax.naming.NamingException; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.junit.Arquillian; import org.jboss.shrinkwrap.api.Archive; import org.jboss.shrinkwrap.api.ShrinkWrap; import org.jboss.shrinkwrap.api.spec.WebArchive; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; /** * Tests that lifecycle interceptors are handed correctly, * as per the interceptors specification. * * @author Stuart Douglas */ @RunWith(Arquillian.class) public class AroundConstructSimpleTestCase { @Deployment public static Archive<?> deploy() { WebArchive war = ShrinkWrap.create(WebArchive.class, "testlocal.war"); war.addPackage(AroundConstructSimpleTestCase.class.getPackage()); return war; } @Test public void testSimpleAroundConstruct() throws NamingException { InitialContext ctx = new InitialContext(); AroundConstructSLSB bean = (AroundConstructSLSB) ctx.lookup("java:module/" + AroundConstructSLSB.class.getSimpleName()); Assert.assertEquals("AroundConstructPostConstruct", bean.getMessage()); } @Test public void testSimpleAroundConstructWhichReturnsObject() throws NamingException { InitialContext ctx = new InitialContext(); AroundConstructInterceptorWithObjectReturnTypeSLSB bean = (AroundConstructInterceptorWithObjectReturnTypeSLSB) ctx.lookup("java:module/" + AroundConstructInterceptorWithObjectReturnTypeSLSB.class.getSimpleName()); Assert.assertEquals("AroundConstructPostConstruct", bean.getMessage()); } }
2,743
39.352941
221
java
null
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/interceptor/aroundconstruct/simple/AroundConstructInterceptor.java
/* * JBoss, Home of Professional Open Source * Copyright 2010, Red Hat Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt 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.aroundconstruct.simple; import jakarta.annotation.PostConstruct; import jakarta.interceptor.AroundConstruct; import jakarta.interceptor.InvocationContext; /** * @author Stuart Douglas */ public class AroundConstructInterceptor { @AroundConstruct private void aroundConstrct(InvocationContext ctx) throws Exception { if(ctx.getTarget() != null) { throw new RuntimeException("target is not null"); } ctx.proceed(); ((AroundConstructSLSB)ctx.getTarget()).append("AroundConstruct"); } @PostConstruct private void postConstruct(InvocationContext ctx) throws Exception { ((AroundConstructSLSB)ctx.getTarget()).append("PostConstruct"); ctx.proceed(); } }
1,809
35.938776
77
java
null
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/interceptor/aroundconstruct/simple/AroundConstructSLSB.java
/* * JBoss, Home of Professional Open Source * Copyright 2010, Red Hat Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt 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.aroundconstruct.simple; import jakarta.ejb.Stateless; import jakarta.interceptor.Interceptors; /** * @author Stuart Douglas */ @Stateless @Interceptors(AroundConstructInterceptor.class) public class AroundConstructSLSB { private String message = ""; public void append(String m) { message += m; } public String getMessage() { return message; } }
1,460
31.466667
77
java
null
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/interceptor/aroundconstruct/simple/AroundConstructInterceptorWithObjectReturnType.java
/* * JBoss, Home of Professional Open Source * Copyright 2010, Red Hat Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt 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.aroundconstruct.simple; import jakarta.annotation.PostConstruct; import jakarta.interceptor.AroundConstruct; import jakarta.interceptor.InvocationContext; /** * @author Dmitrii Tikhomirov */ public class AroundConstructInterceptorWithObjectReturnType { @AroundConstruct private Object aroundConstrct(InvocationContext ctx) throws Exception { if(ctx.getTarget() != null) { throw new RuntimeException("target is not null"); } Object result; result = ctx.proceed(); ((AroundConstructInterceptorWithObjectReturnTypeSLSB)ctx.getTarget()).append("AroundConstruct"); return result; } @PostConstruct private void postConstruct(InvocationContext ctx) throws Exception { ((AroundConstructInterceptorWithObjectReturnTypeSLSB)ctx.getTarget()).append("PostConstruct"); ctx.proceed(); } }
1,952
36.557692
104
java
null
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/interceptor/aroundconstruct/nocreate/AroundConstructNoCreateTestCase.java
/* * JBoss, Home of Professional Open Source * Copyright 2010, Red Hat Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt 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.aroundconstruct.nocreate; import javax.naming.InitialContext; import javax.naming.NamingException; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.junit.Arquillian; import org.jboss.shrinkwrap.api.Archive; import org.jboss.shrinkwrap.api.ShrinkWrap; import org.jboss.shrinkwrap.api.spec.WebArchive; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; /** * Tests that the EJB is not constructed if the chain does not complete * * @author Stuart Douglas */ @RunWith(Arquillian.class) public class AroundConstructNoCreateTestCase { @Deployment public static Archive<?> deploy() { WebArchive war = ShrinkWrap.create(WebArchive.class, "testlocal.war"); war.addPackage(AroundConstructNoCreateTestCase.class.getPackage()); return war; } @Test public void testAroundConstructNoCreate() throws NamingException { InitialContext ctx = new InitialContext(); AroundConstructSLSB bean = (AroundConstructSLSB) ctx.lookup("java:module/" + AroundConstructSLSB.class.getSimpleName()); Assert.assertEquals("Intercepted", bean.getMessage()); Assert.assertFalse(AroundConstructSLSB.constructed); } }
2,309
36.868852
128
java
null
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/interceptor/aroundconstruct/nocreate/AroundConstructInterceptor.java
/* * JBoss, Home of Professional Open Source * Copyright 2010, Red Hat Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt 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.aroundconstruct.nocreate; import jakarta.interceptor.AroundConstruct; import jakarta.interceptor.AroundInvoke; import jakarta.interceptor.InvocationContext; /** * @author Stuart Douglas */ public class AroundConstructInterceptor { @AroundConstruct private void aroundConstrct(InvocationContext ctx) throws Exception { } @AroundInvoke private Object aroundInvoke(InvocationContext ctx) throws Exception { return "Intercepted"; } }
1,540
34.022727
79
java
null
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/interceptor/aroundconstruct/nocreate/AroundConstructSLSB.java
/* * JBoss, Home of Professional Open Source * Copyright 2010, Red Hat Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt 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.aroundconstruct.nocreate; import jakarta.ejb.Stateless; import jakarta.interceptor.Interceptors; /** * @author Stuart Douglas */ @Stateless @Interceptors(AroundConstructInterceptor.class) public class AroundConstructSLSB { public static volatile boolean constructed = false; public AroundConstructSLSB() { if(getClass() == AroundConstructSLSB.class) { constructed = true; } } private String message = ""; public void append(String m) { message += m; } public String getMessage() { return message; } }
1,657
30.283019
79
java
null
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/interceptor/register/TestSingleton.java
/* * JBoss, Home of Professional Open Source. * Copyright 2018, 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 * 2110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.as.test.integration.ejb.interceptor.register; import jakarta.ejb.EJB; import jakarta.ejb.NoSuchEJBException; import jakarta.ejb.Singleton; import jakarta.ejb.Startup; @Startup @Singleton public class TestSingleton { @EJB private TestRemote slsbRemote; public String test(String echo) throws NoSuchEJBException { return slsbRemote.invoke(echo); } }
1,404
34.125
70
java
null
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/interceptor/register/ClientInterceptor.java
/* * JBoss, Home of Professional Open Source. * Copyright 2018, 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 * 2110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.as.test.integration.ejb.interceptor.register; import org.jboss.ejb.client.EJBClientInterceptor; import org.jboss.ejb.client.EJBClientInvocationContext; import org.jboss.logging.Logger; /** * Client side JBoss interceptor. */ public class ClientInterceptor implements EJBClientInterceptor { private Logger log = Logger.getLogger(ClientInterceptor.class.getName()); /** * Creates a new ClientInterceptor object. */ public ClientInterceptor() { } @Override public void handleInvocation(EJBClientInvocationContext context) throws Exception { log.debug("In the client interceptor handleInvocation : " + this.getClass().getName() + " " + context.getViewClass() + " " + context.getLocator()); // Must make this call context.sendRequest(); } @Override public Object handleInvocationResult(EJBClientInvocationContext context) throws Exception { log.debug("In the client interceptor handleInvocationResult : " + this.getClass().getName() + " " + context.getViewClass() + " " + context.getLocator()); // Append some string to start of result to indicate the ClientInterceptor was invoked String result = RegisterInterceptorViaMetaFileTest.clientInterceptorPrefix + context.getResult(); return result; } }
2,300
37.35
157
java
null
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/interceptor/register/RegisterInterceptorViaMetaFileTest.java
/* * JBoss, Home of Professional Open Source. * Copyright 2018, 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 * 2110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.as.test.integration.ejb.interceptor.register; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.junit.Arquillian; 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; import jakarta.ejb.EJB; /** * @author Jiri Bilek * [email protected] on 12/03/18. * Test for WFLY-9844 * * EJB invocation for Remote interface fails when Client Interceptor * registered via META-INF/services/org.jboss.ejb.client.EJBClientInterceptor */ @RunWith(Arquillian.class) public class RegisterInterceptorViaMetaFileTest { private static final String ARCHIVE_NAME = "test-register-interceptor"; public static final String clientInterceptorPrefix = "ClientInterceptor: "; @Deployment(name = "test-register-interceptor") public static Archive<?> deploy() { JavaArchive jar = ShrinkWrap.create(JavaArchive.class, ARCHIVE_NAME + ".jar"); jar.addPackage(TestRemote.class.getPackage()); jar.addPackage(TestSingleton.class.getPackage()); jar.addPackage(TestSLSB.class.getPackage()); jar.addAsManifestResource( RegisterInterceptorViaMetaFileTest.class.getPackage(), "org.jboss.ejb.client.EJBClientInterceptor", "services/org.jboss.ejb.client.EJBClientInterceptor"); return jar; } @EJB TestSingleton testSingleton; @Test public void testInvokeSLSBthoughSingleton() throws Exception { String echo = "this it testing string"; String result = testSingleton.test(echo); // ClientInterceptor append variable clientInterceptorPrefix on start of string so returned value is "clientInterceptorPrefix + echo" Assert.assertTrue("SLSB returned wrong value through singleton", result.equals(clientInterceptorPrefix + echo)); } }
2,961
40.138889
139
java
null
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/interceptor/register/TestSLSB.java
/* * JBoss, Home of Professional Open Source. * Copyright 2018, 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 * 2110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.as.test.integration.ejb.interceptor.register; import jakarta.ejb.Stateless; @Stateless public class TestSLSB implements TestRemote { public String invoke(String s) { return s; } }
1,232
35.264706
70
java
null
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/interceptor/register/TestRemote.java
/* * JBoss, Home of Professional Open Source. * Copyright 2018, 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 * 2110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.as.test.integration.ejb.interceptor.register; import jakarta.ejb.Remote; @Remote public interface TestRemote { String invoke(String s); }
1,184
36.03125
70
java
null
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/interceptor/regex/DefaultInterceptorRegexTestCase.java
/* * JBoss, Home of Professional Open Source. * Copyright 2016, 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 * 2110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.as.test.integration.ejb.interceptor.regex; import javax.naming.InitialContext; import javax.naming.NamingException; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.junit.Arquillian; import org.jboss.as.arquillian.api.ServerSetup; import org.jboss.shrinkwrap.api.Archive; import org.jboss.shrinkwrap.api.ShrinkWrap; import org.jboss.shrinkwrap.api.spec.WebArchive; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; /** * Checking if default interceptor binding works if ejb3 subsystem attribute * 'allow-ejb-name-regex' is set to true. * * @author Ondra Chaloupka <[email protected]> */ @RunWith(Arquillian.class) @ServerSetup(RegexServerSetup.class) public class DefaultInterceptorRegexTestCase { private static final String EJB_RETURN = TestEjb.MESSAGE; private static final String EJB_INTERCEPTED = TestEjb.MESSAGE + RegexInterceptor.MESSAGE; @Deployment public static Archive<?> deploy() { WebArchive war = ShrinkWrap.create(WebArchive.class, "testregex.war"); war.addPackage(DefaultInterceptorRegexTestCase.class.getPackage()); war.addAsWebInfResource(DefaultInterceptorRegexTestCase.class.getPackage(), "ejb-jar-default.xml", "ejb-jar.xml"); return war; } @Test public void defaultInterceptor() throws NamingException { final InitialContext ctx = new InitialContext(); TestEjb bean = (TestEjb) ctx.lookup("java:module/Test1"); Assert.assertEquals(EJB_INTERCEPTED, bean.test()); } @Test public void defaultInterceptorAnnotatedBean() throws NamingException { final InitialContext ctx = new InitialContext(); AnnotatedEjb bean = (AnnotatedEjb) ctx.lookup("java:module/" + AnnotatedEjb.class.getName()); Assert.assertEquals(EJB_INTERCEPTED, bean.test()); } @Test public void annotationExcludeInterceptor() throws NamingException { final InitialContext ctx = new InitialContext(); TestEjb bean = (TestEjb) ctx.lookup("java:module/Test1"); Assert.assertEquals(EJB_RETURN, bean.testIgnoreDefault()); } }
3,185
40.376623
122
java
null
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/interceptor/regex/AnnotatedEjb.java
/* * JBoss, Home of Professional Open Source. * Copyright 2016, 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 * 2110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.as.test.integration.ejb.interceptor.regex; import jakarta.ejb.Stateless; /** * @author Ondra Chaloupka <[email protected]> */ @Stateless(name = "org.jboss.as.test.integration.ejb.interceptor.regex.AnnotatedEjb") public class AnnotatedEjb { public String test() { return TestEjb.MESSAGE; } }
1,353
37.685714
85
java
null
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/interceptor/regex/MultiBeanMatchesRegexTestCase.java
/* * JBoss, Home of Professional Open Source. * Copyright 2016, 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 * 2110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.as.test.integration.ejb.interceptor.regex; import javax.naming.InitialContext; import javax.naming.NamingException; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.junit.Arquillian; import org.jboss.as.arquillian.api.ServerSetup; import org.jboss.shrinkwrap.api.Archive; import org.jboss.shrinkwrap.api.ShrinkWrap; import org.jboss.shrinkwrap.api.spec.WebArchive; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; /** * Test case where a bean name matches two regex of interceptor bindings. * * @author Ondra Chaloupka <[email protected]> */ @RunWith(Arquillian.class) @ServerSetup(RegexServerSetup.class) public class MultiBeanMatchesRegexTestCase { private static final String EJB_INTERCEPTED = TestEjb.MESSAGE + RegexInterceptor.MESSAGE; @Deployment public static Archive<?> deploy() { WebArchive war = ShrinkWrap.create(WebArchive.class, "testregex.war"); war.addPackage(MultiBeanMatchesRegexTestCase.class.getPackage()); war.addAsWebInfResource(MultiBeanMatchesRegexTestCase.class.getPackage(), "ejb-jar-multi.xml", "ejb-jar.xml"); return war; } @Test public void testInterceptors() throws NamingException { final InitialContext ctx = new InitialContext(); TestEjb bean = (TestEjb) ctx.lookup("java:module/Test1"); Assert.assertEquals(EJB_INTERCEPTED, bean.test()); bean = (TestEjb) ctx.lookup("java:module/Test2"); Assert.assertEquals(EJB_INTERCEPTED + "-regex", bean.test()); } }
2,607
40.396825
118
java
null
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/interceptor/regex/RegexServerSetup.java
/* * JBoss, Home of Professional Open Source. * Copyright 2016, 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 * 2110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.as.test.integration.ejb.interceptor.regex; import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.ADDRESS; import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.NAME; import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.OP; import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.UNDEFINE_ATTRIBUTE_OPERATION; import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.VALUE; import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.WRITE_ATTRIBUTE_OPERATION; import org.jboss.as.arquillian.api.ServerSetupTask; import org.jboss.as.arquillian.container.ManagementClient; import org.jboss.as.controller.PathAddress; import org.jboss.as.controller.client.helpers.Operations; import org.jboss.dmr.ModelNode; import org.junit.Assert; /** * Server setup task which set up ejb3 subsystem to allow regex * for ejb names in interceptor binding. * * @author Stuart Douglas */ public class RegexServerSetup implements ServerSetupTask { private static final String ALLOW_EJB_NAME_REGEX = "allow-ejb-name-regex"; @Override public void setup(ManagementClient managementClient, String containerId) throws Exception { ModelNode node = new ModelNode(); node.get(ADDRESS).set(PathAddress.parseCLIStyleAddress("/subsystem=ejb3").toModelNode()); node.get(OP).set(WRITE_ATTRIBUTE_OPERATION); node.get(NAME).set(ALLOW_EJB_NAME_REGEX); node.get(VALUE).set(true); final ModelNode result = managementClient.getControllerClient().execute(node); if (!Operations.isSuccessfulOutcome(result)) { Assert.fail(Operations.getFailureDescription(result).asString()); } } @Override public void tearDown(ManagementClient managementClient, String containerId) throws Exception { ModelNode node = new ModelNode(); node.get(ADDRESS).set(PathAddress.parseCLIStyleAddress("/subsystem=ejb3").toModelNode()); node.get(OP).set(UNDEFINE_ATTRIBUTE_OPERATION); node.get(NAME).set(ALLOW_EJB_NAME_REGEX); final ModelNode result = managementClient.getControllerClient().execute(node); if (!Operations.isSuccessfulOutcome(result)) { Assert.fail(Operations.getFailureDescription(result).asString()); } } }
3,404
46.291667
106
java
null
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/interceptor/regex/RegexOptionNotDefinedTestCase.java
/* * JBoss, Home of Professional Open Source. * Copyright 2016, 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 * 2110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.as.test.integration.ejb.interceptor.regex; import javax.naming.InitialContext; import javax.naming.NamingException; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.junit.Arquillian; import org.jboss.shrinkwrap.api.Archive; import org.jboss.shrinkwrap.api.ShrinkWrap; import org.jboss.shrinkwrap.api.spec.WebArchive; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; /** * Test case where ejb subsytem option 'allow-ejb-name-regex' is not defined to true * and regex definition on ejb name for interceptor binding does nto work. * * @author Ondra Chaloupka <[email protected]> */ @RunWith(Arquillian.class) public class RegexOptionNotDefinedTestCase { private static final String EJB_SIMPLE_RETURN = "test"; @Deployment public static Archive<?> deploy() { WebArchive war = ShrinkWrap.create(WebArchive.class, "testregex.war"); war.addPackage(RegexOptionNotDefinedTestCase.class.getPackage()); war.addAsWebInfResource(RegexOptionNotDefinedTestCase.class.getPackage(), "ejb-jar.xml", "ejb-jar.xml"); return war; } @Test public void testInterceptors() throws NamingException { final InitialContext ctx = new InitialContext(); TestEjb bean = (TestEjb) ctx.lookup("java:module/Test1"); Assert.assertEquals(EJB_SIMPLE_RETURN, bean.test()); bean = (TestEjb) ctx.lookup("java:module/Test2"); Assert.assertEquals(EJB_SIMPLE_RETURN, bean.test()); bean = (TestEjb) ctx.lookup("java:module/Production"); Assert.assertEquals(EJB_SIMPLE_RETURN, bean.test()); } }
2,685
40.96875
112
java
null
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/interceptor/regex/EjbMethodNameRegexTestCase.java
/* * JBoss, Home of Professional Open Source. * Copyright 2016, 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 * 2110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.as.test.integration.ejb.interceptor.regex; import javax.naming.InitialContext; import javax.naming.NamingException; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.junit.Arquillian; import org.jboss.as.arquillian.api.ServerSetup; import org.jboss.shrinkwrap.api.Archive; import org.jboss.shrinkwrap.api.ShrinkWrap; import org.jboss.shrinkwrap.api.spec.WebArchive; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; /** * Testing of interceptor binding which binds ejb name based on regex. * * @author Stuart Douglas */ @RunWith(Arquillian.class) @ServerSetup(RegexServerSetup.class) public class EjbMethodNameRegexTestCase { private static final String EJB_RETURN = TestEjb.MESSAGE; private static final String EJB_INTERCEPTED = TestEjb.MESSAGE + RegexInterceptor.MESSAGE; @Deployment public static Archive<?> deploy() { WebArchive war = ShrinkWrap.create(WebArchive.class, "testregex.war"); war.addPackage(EjbMethodNameRegexTestCase.class.getPackage()); war.addAsWebInfResource(EjbMethodNameRegexTestCase.class.getPackage(), "ejb-jar.xml", "ejb-jar.xml"); return war; } @Test public void testInterceptors() throws NamingException { final InitialContext ctx = new InitialContext(); TestEjb bean = (TestEjb) ctx.lookup("java:module/Test1"); Assert.assertEquals(EJB_INTERCEPTED, bean.test()); bean = (TestEjb) ctx.lookup("java:module/Test2"); Assert.assertEquals(EJB_INTERCEPTED, bean.test()); bean = (TestEjb) ctx.lookup("java:module/Production"); Assert.assertEquals(EJB_RETURN, bean.test()); } @Test public void annotatedBeanName() throws NamingException { final InitialContext ctx = new InitialContext(); AnnotatedEjb bean = (AnnotatedEjb) ctx.lookup("java:module/" + AnnotatedEjb.class.getName()); Assert.assertEquals(EJB_INTERCEPTED, bean.test()); } @Test public void classLevelExcludeInerceptor() throws NamingException { final InitialContext ctx = new InitialContext(); TestEjb bean = (TestEjb) ctx.lookup("java:module/Test1"); Assert.assertEquals(EJB_RETURN, bean.testIgnoreClass()); TestEjb beanProduction = (TestEjb) ctx.lookup("java:module/Production"); Assert.assertEquals(EJB_RETURN, beanProduction.testIgnoreClass()); TestEjb bean2 = (TestEjb) ctx.lookup("java:module/Test2"); Assert.assertEquals(EJB_INTERCEPTED, bean2.testIgnoreDefault()); Assert.assertEquals(EJB_RETURN, beanProduction.testIgnoreDefault()); } @Test public void methodLevelInterceptor() throws NamingException { final InitialContext ctx = new InitialContext(); TestEjb bean = (TestEjb) ctx.lookup("java:module/.AnotherTest"); Assert.assertEquals(EJB_RETURN, bean.test()); Assert.assertEquals(EJB_INTERCEPTED, bean.testIgnoreClass()); Assert.assertEquals(EJB_RETURN, bean.testIgnoreDefault()); TestEjb yetBean = (TestEjb) ctx.lookup("java:module/YetAnotherTest"); Assert.assertEquals(EJB_INTERCEPTED, yetBean.test()); } @Test public void interceptorOrder() throws NamingException { final InitialContext ctx = new InitialContext(); TestEjb bean = (TestEjb) ctx.lookup("java:module/OrderingTest"); Assert.assertEquals(EJB_INTERCEPTED + "-regex", bean.test()); } }
4,502
41.885714
109
java
null
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/interceptor/regex/TestEjb.java
/* * JBoss, Home of Professional Open Source. * Copyright 2016, 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 * 2110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.as.test.integration.ejb.interceptor.regex; import jakarta.interceptor.ExcludeClassInterceptors; import jakarta.interceptor.ExcludeDefaultInterceptors; /** * @author Stuart Douglas */ public class TestEjb { public static final String MESSAGE = "test"; public String test() { return MESSAGE; } @ExcludeDefaultInterceptors public String testIgnoreDefault() { return MESSAGE; } @ExcludeClassInterceptors public String testIgnoreClass() { return MESSAGE; } }
1,561
32.234043
70
java
null
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/interceptor/regex/RegexInterceptor.java
/* * JBoss, Home of Professional Open Source. * Copyright 2016, 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 * 2110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.as.test.integration.ejb.interceptor.regex; import jakarta.interceptor.AroundInvoke; import jakarta.interceptor.Interceptor; import jakarta.interceptor.InvocationContext; /** * @author Stuart Douglas */ @Interceptor public class RegexInterceptor { public static final String MESSAGE = "-regex"; @AroundInvoke public Object aroundInvoke(final InvocationContext invocationContext) throws Exception { return invocationContext.proceed() + MESSAGE; } }
1,517
36.02439
92
java
null
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/interceptor/classinherit/AbstractBaseClass.java
/* * JBoss, Home of Professional Open Source. * Copyright 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.integration.ejb.interceptor.classinherit; /** * @author <a href="[email protected]">Kabir Khan</a> */ public abstract class AbstractBaseClass { }
1,203
37.83871
70
java
null
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/interceptor/classinherit/B.java
/* * JBoss, Home of Professional Open Source. * Copyright 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.integration.ejb.interceptor.classinherit; /** * @author <a href="mailto:[email protected]">Andrew May</a> */ public interface B extends A { String getOtherMessage(); }
1,224
38.516129
70
java
null
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/interceptor/classinherit/SuperIntercepTestCase.java
/* * 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.classinherit; import javax.naming.InitialContext; import org.junit.Test; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.junit.Arquillian; import org.jboss.arquillian.test.api.ArquillianResource; 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.runner.RunWith; /** * Interceptor must also apply to super-methods. Migrated from EJB3 testsuite [JBQA-5451] from ejbthree471 * * @author Carlo de Wolf, Bill Burke, Ondrej Chaloupka */ @RunWith(Arquillian.class) public class SuperIntercepTestCase { @ArquillianResource InitialContext ctx; @Deployment public static Archive<?> deploy() { JavaArchive jar = ShrinkWrap.create(JavaArchive.class, "super-intercept-test.jar"); jar.addPackage(SuperIntercepTestCase.class.getPackage()); return jar; } @Test public void testHasBeenIntercepted() throws Exception { B b = (B) ctx.lookup("java:module/" + BBean.class.getSimpleName()); String result = b.getOtherMessage(); Assert.assertEquals("InterceptedA: InterceptedB: The Other Message", result); } @Test public void testHasSuperBeenIntercepted() throws Exception { B b = (B) ctx.lookup("java:module/" + BBean.class.getSimpleName()); String result = b.getMessage(); Assert.assertEquals("InterceptedA: InterceptedB: The Message", result); } @Test public void testInterceptionWithNoSuperClassAroundInvoke() throws Exception { StatelessRemote slWithInterceptor = (StatelessRemote) ctx.lookup("java:module/" + StatelessBean.class.getSimpleName()); // supposing this chain fo interceptions String supposedResult = TestInterceptor.class.getSimpleName() + ":" + StatelessBean.class.getSimpleName(); String result = slWithInterceptor.method(); Assert.assertEquals(supposedResult + ".method()", result); result = slWithInterceptor.superMethod(); Assert.assertEquals(supposedResult + ".superMethod()", result); } @Test public void testInterceptionWithSuperClassAroundInvoke() throws Exception { StatelessRemote slWithInterceptorAndBean = (StatelessRemote) ctx.lookup("java:module/" + StatelessWithBeanInterceptorBean.class.getSimpleName()); // supposing this chain fo interceptions String supposedResult = TestInterceptor.class.getSimpleName() + ":" + AbstractBaseClassWithInterceptor.class.getSimpleName() + ":" + StatelessWithBeanInterceptorBean.class.getSimpleName(); String result = slWithInterceptorAndBean.method(); Assert.assertEquals(supposedResult + ".method()", result); result = slWithInterceptorAndBean.superMethod(); Assert.assertEquals(supposedResult + ".superMethod()", result); } }
4,048
39.089109
127
java
null
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/interceptor/classinherit/ABean.java
/* * JBoss, Home of Professional Open Source. * Copyright 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.integration.ejb.interceptor.classinherit; import jakarta.interceptor.Interceptors; /** * @author <a href="mailto:[email protected]">Andrew May</a> */ @Interceptors({InterceptA.class}) public abstract class ABean implements A { public String getMessage() { return "The Message"; } }
1,351
36.555556
70
java
null
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/interceptor/classinherit/AbstractBaseClassWithInterceptor.java
/* * JBoss, Home of Professional Open Source. * Copyright 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.integration.ejb.interceptor.classinherit; import jakarta.interceptor.AroundInvoke; import jakarta.interceptor.InvocationContext; /** * @author <a href="[email protected]">Kabir Khan</a> */ public abstract class AbstractBaseClassWithInterceptor { @AroundInvoke public Object intercept(InvocationContext ctx) throws Exception { String message = (String) ctx.proceed(); return AbstractBaseClassWithInterceptor.class.getSimpleName() + ":" + message; } }
1,537
37.45
86
java
null
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/interceptor/classinherit/A.java
/* * JBoss, Home of Professional Open Source. * Copyright 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.integration.ejb.interceptor.classinherit; /** * @author <a href="mailto:[email protected]">Andrew May</a> */ public interface A { String getMessage(); }
1,209
38.032258
70
java
null
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/interceptor/classinherit/BBean.java
/* * JBoss, Home of Professional Open Source. * Copyright 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.integration.ejb.interceptor.classinherit; import jakarta.ejb.Remote; import jakarta.ejb.Stateless; import jakarta.interceptor.Interceptors; /** * @author <a href="mailto:[email protected]">Andrew May</a> */ @Stateless @Remote(B.class) @Interceptors({ InterceptB.class }) public class BBean extends ABean implements B { public String getOtherMessage() { return "The Other Message"; } }
1,454
35.375
70
java
null
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/interceptor/classinherit/StatelessWithBeanInterceptorBean.java
/* * JBoss, Home of Professional Open Source. * Copyright 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.integration.ejb.interceptor.classinherit; import jakarta.interceptor.Interceptors; import jakarta.ejb.Stateless; /** * * @author <a href="[email protected]">Kabir Khan</a> */ @Stateless @Interceptors({ TestInterceptor.class }) public class StatelessWithBeanInterceptorBean extends AbstractBaseClassWithInterceptor implements StatelessRemote { public String method() { return StatelessWithBeanInterceptorBean.class.getSimpleName() + ".method()"; } public String superMethod() { return StatelessWithBeanInterceptorBean.class.getSimpleName() + ".superMethod()"; } }
1,654
37.488372
115
java
null
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/interceptor/classinherit/StatelessRemote.java
/* * JBoss, Home of Professional Open Source. * Copyright 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.integration.ejb.interceptor.classinherit; import jakarta.ejb.Remote; /** * * @author <a href="[email protected]">Kabir Khan</a> * @version $Revision: 61136 $ */ @Remote public interface StatelessRemote extends SuperInterface { String method(); }
1,310
34.432432
70
java
null
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/interceptor/classinherit/InterceptA.java
/* * JBoss, Home of Professional Open Source. * Copyright 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.integration.ejb.interceptor.classinherit; import jakarta.interceptor.AroundInvoke; import jakarta.interceptor.InvocationContext; /** * @author <a href="mailto:[email protected]">Andrew May</a> */ public class InterceptA { @AroundInvoke Object audit(InvocationContext ctx) throws Exception { String message = (String) ctx.proceed(); return "InterceptedA: " + message; } }
1,452
37.236842
70
java
null
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/interceptor/classinherit/InterceptB.java
/* * JBoss, Home of Professional Open Source. * Copyright 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.integration.ejb.interceptor.classinherit; import jakarta.interceptor.AroundInvoke; import jakarta.interceptor.InvocationContext; /** * @author <a href="mailto:[email protected]">Andrew May</a> */ public class InterceptB { @AroundInvoke Object audit(InvocationContext ctx) throws Exception { String message = (String) ctx.proceed(); return "InterceptedB: " + message; } }
1,452
37.236842
70
java
null
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/interceptor/classinherit/SuperInterface.java
/* * JBoss, Home of Professional Open Source. * Copyright 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.integration.ejb.interceptor.classinherit; import jakarta.ejb.Remote; /** * @author <a href="[email protected]">Kabir Khan</a> */ @Remote public interface SuperInterface { String superMethod(); }
1,256
35.970588
70
java
null
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/interceptor/classinherit/StatelessBean.java
/* * JBoss, Home of Professional Open Source. * Copyright 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.integration.ejb.interceptor.classinherit; import jakarta.interceptor.Interceptors; import jakarta.ejb.Stateless; /** * @author <a href="[email protected]">Kabir Khan</a> */ @Stateless @Interceptors({ TestInterceptor.class }) public class StatelessBean extends AbstractBaseClass implements StatelessRemote { public String method() { return StatelessBean.class.getSimpleName() + ".method()"; } public String superMethod() { return StatelessBean.class.getSimpleName() + ".superMethod()"; } }
1,581
34.954545
81
java
null
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/interceptor/classinherit/TestInterceptor.java
/* * JBoss, Home of Professional Open Source. * Copyright 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.integration.ejb.interceptor.classinherit; import jakarta.interceptor.AroundInvoke; import jakarta.interceptor.InvocationContext; /** * * @author <a href="[email protected]">Kabir Khan</a> */ public class TestInterceptor { @AroundInvoke public Object intercept(InvocationContext ctx) throws Exception { String message = (String) ctx.proceed(); return TestInterceptor.class.getSimpleName() + ":" + message; } }
1,496
36.425
70
java
null
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/interceptor/method/SecretInterceptor.java
/* * JBoss, Home of Professional Open Source * Copyright 2010, Red Hat Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt 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.method; import jakarta.annotation.PostConstruct; import jakarta.interceptor.AroundInvoke; import jakarta.interceptor.InvocationContext; /** * @author Stuart Douglas */ public class SecretInterceptor { public static boolean called = false; public static boolean postConstructCalled = false; @PostConstruct public void postConstruct(final InvocationContext invocationContext) throws Exception { postConstructCalled = true; invocationContext.proceed(); } @AroundInvoke public Object aroundInvoke(final InvocationContext invocationContext) throws Exception { called = true; return invocationContext.proceed(); } }
1,751
35.5
92
java
null
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/interceptor/method/ClassifiedBean.java
/* * JBoss, Home of Professional Open Source * Copyright 2010, Red Hat Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt 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.method; import jakarta.ejb.Stateless; import jakarta.interceptor.Interceptors; /** * @author Stuart Douglas */ @Stateless @Interceptors(SecretInterceptor.class) public class ClassifiedBean { public String secretMethod() { return "Secret"; } @Interceptors(TopSecretInterceptor.class) public String topSecretMethod() { return "TopSecret"; } public String overloadedMethod(Integer i) { return "ArgInt:" + i.toString(); } public String overloadedMethod(String str) { return "ArgStr:" + str; } }
1,637
31.117647
73
java
null
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/interceptor/method/TopSecretInterceptor.java
/* * JBoss, Home of Professional Open Source * Copyright 2010, Red Hat Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt 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.method; import jakarta.annotation.PostConstruct; import jakarta.interceptor.AroundInvoke; import jakarta.interceptor.InvocationContext; /** * @author Stuart Douglas */ public class TopSecretInterceptor { public static boolean called = false; public static boolean postConstructCalled = false; // as this is a method level interceptor this should not be called // see the interceptors spec @PostConstruct public void postConstruct(final InvocationContext invocationContext) throws Exception { postConstructCalled = true; invocationContext.proceed(); } @AroundInvoke public Object aroundInvoke(final InvocationContext invocationContext) throws Exception { called = true; return invocationContext.proceed(); } }
1,858
36.18
92
java
null
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/interceptor/method/AroundInvokeInterceptor.java
/* * JBoss, Home of Professional Open Source * Copyright 2012, Red Hat Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt 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.method; import jakarta.interceptor.AroundInvoke; import jakarta.interceptor.InvocationContext; /** * @author OndrejChaloupka */ public class AroundInvokeInterceptor { Object interceptDD(InvocationContext ctx) throws Exception { return "InterceptedDD:" + ctx.proceed().toString(); } // this won't be called because of definition in ejb-jar.xml @AroundInvoke Object intercept(InvocationContext ctx) throws Exception { return "Intercepted:" + ctx.proceed().toString(); } }
1,587
35.930233
73
java
null
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/interceptor/method/EjbMethodInterceptorTestCase.java
/* * JBoss, Home of Professional Open Source * Copyright 2010, Red Hat Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt 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.method; import javax.naming.InitialContext; import javax.naming.NamingException; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.junit.Arquillian; import org.jboss.shrinkwrap.api.Archive; import org.jboss.shrinkwrap.api.ShrinkWrap; import org.jboss.shrinkwrap.api.spec.WebArchive; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; /** * @author Stuart Douglas */ @RunWith(Arquillian.class) public class EjbMethodInterceptorTestCase { @Deployment public static Archive<?> deploy() { WebArchive war = ShrinkWrap.create(WebArchive.class, "testmethodinterceptor.war"); war.addPackage(EjbMethodInterceptorTestCase.class.getPackage()); war.addAsWebInfResource(EjbMethodInterceptorTestCase.class.getPackage(), "ejb-jar.xml", "ejb-jar.xml"); return war; } @Test public void testMethodLevelInterceptors() throws NamingException { final InitialContext ctx = new InitialContext(); final ClassifiedBean bean = (ClassifiedBean) ctx.lookup("java:module/" + ClassifiedBean.class.getSimpleName()); TopSecretInterceptor.called = false; SecretInterceptor.called = false; final String secret = bean.secretMethod(); Assert.assertEquals("Secret", secret); Assert.assertTrue(SecretInterceptor.called); Assert.assertFalse(TopSecretInterceptor.called); Assert.assertTrue(SecretInterceptor.postConstructCalled); Assert.assertFalse(TopSecretInterceptor.postConstructCalled); String topSecret = bean.topSecretMethod(); Assert.assertEquals("TopSecret", topSecret); Assert.assertTrue(TopSecretInterceptor.called); Assert.assertFalse(TopSecretInterceptor.postConstructCalled); } @Test public void testMethodOverloaded() throws NamingException { final InitialContext ctx = new InitialContext(); final ClassifiedBean bean = (ClassifiedBean) ctx.lookup("java:module/" + ClassifiedBean.class.getSimpleName()); TopSecretInterceptor.called = false; SecretInterceptor.called = false; final String ret1 = bean.overloadedMethod(1); Assert.assertEquals("ArgInt:1", ret1); Assert.assertTrue(SecretInterceptor.called); Assert.assertFalse(TopSecretInterceptor.called); TopSecretInterceptor.called = false; SecretInterceptor.called = false; final String ret2 = bean.overloadedMethod("1"); Assert.assertEquals("ArgStr:1", ret2); Assert.assertTrue(SecretInterceptor.called); Assert.assertTrue(TopSecretInterceptor.called); } @Test public void testAroundInvokeOverridedByXmlDescriptor() throws NamingException { InitialContext ctx = new InitialContext(); AroundInvokeBean bean = (AroundInvokeBean) ctx.lookup("java:module/" + AroundInvokeBean.class.getSimpleName()); final String message = bean.call(); Assert.assertEquals("InterceptedDD:Hi", message); } }
4,100
40.424242
119
java
null
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/interceptor/method/AroundInvokeBean.java
/* * JBoss, Home of Professional Open Source * Copyright 2012, Red Hat Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt 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.method; import jakarta.ejb.Stateless; import jakarta.interceptor.Interceptors; /** * @author Ondrej Chaloupka */ @Stateless @Interceptors({AroundInvokeInterceptor.class}) public class AroundInvokeBean { public String call() { return "Hi"; } }
1,326
33.025641
73
java
null
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/interceptor/environment/MyTestRemoteB.java
package org.jboss.as.test.integration.ejb.interceptor.environment; import jakarta.ejb.Remote; @Remote public interface MyTestRemoteB { boolean doit(); }
159
16.777778
66
java
null
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/interceptor/environment/MyTestB.java
package org.jboss.as.test.integration.ejb.interceptor.environment; import jakarta.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.trace("Calling MyTest..."); session23.doitSession(); log.trace("Calling MyTest - after doit"); return true; } }
478
22.95
70
java
null
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/interceptor/environment/MySession2RemoteB.java
/* * 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.environment; import jakarta.ejb.Remote; /** * @author <a href="mailto:[email protected]">Bill Burke</a> */ @Remote public interface MySession2RemoteB { boolean doit(); boolean doitSession(); }
1,289
35.857143
70
java
null
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/interceptor/environment/InterceptorEnvironmentEntriesTestCase.java
/* * 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.environment; 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.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; /** * Test that interceptor environment entries defined in ejb-jar are processed * <p/> * AS7-2776 */ @RunWith(Arquillian.class) public class InterceptorEnvironmentEntriesTestCase { @ArquillianResource InitialContext ctx; @Deployment public static Archive<?> deployment() { final JavaArchive jar = ShrinkWrap.create(JavaArchive.class, "interceptor-complexb-test.jar") .addPackage(InterceptorEnvironmentEntriesTestCase.class.getPackage()) .addAsManifestResource(InterceptorEnvironmentEntriesTestCase.class.getPackage(), "ejb-jar.xml", "ejb-jar.xml"); return jar; } @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); } }
2,612
36.869565
127
java
null
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/interceptor/environment/MySession2BeanB.java
/* * 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.environment; import jakarta.ejb.Stateless; import org.jboss.logging.Logger; /** * @author <a href="mailto:[email protected]">Bill Burke</a> */ @Stateless public class MySession2BeanB implements MySession2RemoteB { private static final Logger log = Logger.getLogger(MySession2BeanB.class); public boolean doit() { log.trace("Calling MySession2BeanB doit..."); return true; } public boolean doitSession() { log.trace("Calling MySession2BeanB doitSession..."); return true; } }
1,617
34.955556
78
java
null
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/interceptor/environment/XMLInterceptorB.java
/* * 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.environment; import jakarta.interceptor.InvocationContext; import org.jboss.logging.Logger; /** * @author <a href="[email protected]">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.trace("Calling XMLInterceptorB..."); session2.doitSession(); log.trace("Calling XMLInterceptorB - after doit"); return false; } }
1,631
36.090909
78
java
null
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/interceptor/defaultinterceptor/ClassInterceptor.java
/* * JBoss, Home of Professional Open Source * Copyright 2010, Red Hat Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt 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.defaultinterceptor; import jakarta.interceptor.AroundInvoke; import jakarta.interceptor.InvocationContext; /** * @author Stuart Douglas */ public class ClassInterceptor { public static final String MESSAGE = "ClassInterceptor "; @AroundInvoke public Object aroundInvoke(final InvocationContext context) throws Exception { if (context.getMethod().getReturnType().equals(String.class)) { return MESSAGE + context.proceed().toString(); } return context.proceed(); } }
1,592
37.853659
82
java
null
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/interceptor/defaultinterceptor/SessionBean.java
/* * JBoss, Home of Professional Open Source * Copyright 2010, Red Hat Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt 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.defaultinterceptor; /** * @author Stuart Douglas */ public interface SessionBean { void setPostConstructCalled(); }
1,194
37.548387
73
java
null
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/interceptor/defaultinterceptor/DefaultInterceptor.java
/* * JBoss, Home of Professional Open Source * Copyright 2010, Red Hat Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt 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.defaultinterceptor; import jakarta.annotation.PostConstruct; import jakarta.interceptor.AroundInvoke; import jakarta.interceptor.InvocationContext; /** * @author Stuart Douglas */ public class DefaultInterceptor { public static final String MESSAGE = "DefaultInterceptor "; @PostConstruct public void postConstruct(final InvocationContext context) throws Exception { ((SessionBean) context.getTarget()).setPostConstructCalled(); } @AroundInvoke public Object aroundInvoke(final InvocationContext context) throws Exception { if (context.getMethod().getReturnType().equals(String.class)) { return MESSAGE + context.proceed().toString(); } return context.proceed(); } }
1,817
36.102041
82
java
null
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/interceptor/defaultinterceptor/DefaultInterceptorsTestCase.java
/* * JBoss, Home of Professional Open Source * Copyright 2010, Red Hat Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt 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.defaultinterceptor; import javax.naming.InitialContext; import javax.naming.NamingException; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.junit.Arquillian; 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; /** * Tests that default interceptors are correctly applied * * @author Stuart Douglas */ @RunWith(Arquillian.class) public class DefaultInterceptorsTestCase { @Deployment public static Archive<?> deploy() { JavaArchive archive = ShrinkWrap.create(JavaArchive.class, "testdefaultinterceptors.jar"); archive.addPackage(DefaultInterceptorsTestCase.class.getPackage()); archive.addAsManifestResource(DefaultInterceptorsTestCase.class.getPackage(), "ejb-jar.xml", "ejb-jar.xml"); return archive; } @Test public void testDefaultInterceptorApplied() throws NamingException { InitialContext ctx = new InitialContext(); DefaultInterceptedSLSB bean = (DefaultInterceptedSLSB) ctx.lookup("java:module/" + DefaultInterceptedSLSB.class.getSimpleName()); final String message = bean.message(); Assert.assertEquals(DefaultInterceptor.MESSAGE + "Hello", message); Assert.assertTrue(bean.isPostConstructCalled()); } /** * AS7-1436 Test interceptor is applied twice, if it is both class level and a default interceptor * * @throws NamingException */ @Test public void testDefaultInterceptorAppliedTwice() throws NamingException { InitialContext ctx = new InitialContext(); RepeatedDefaultInterceptedSLSB bean = (RepeatedDefaultInterceptedSLSB) ctx.lookup("java:module/" + RepeatedDefaultInterceptedSLSB.class.getSimpleName()); final String message = bean.message(); Assert.assertEquals(DefaultInterceptor.MESSAGE + DefaultInterceptor.MESSAGE + DefaultInterceptor.MESSAGE + "Hello", message); Assert.assertTrue(bean.isPostConstructCalled()); } @Test public void testClassLevelExcludeDefaultInterceptors() throws NamingException { InitialContext ctx = new InitialContext(); NoDefaultInterceptorsSLSB bean = (NoDefaultInterceptorsSLSB) ctx.lookup("java:module/" + NoDefaultInterceptorsSLSB.class.getSimpleName()); final String message = bean.message(); Assert.assertEquals(ClassInterceptor.MESSAGE + "Hello", message); Assert.assertTrue(!bean.isPostConstructCalled()); } @Test public void testClassLevelExcludeDefaultMethodLevelExcludeClassInterceptors() throws NamingException { InitialContext ctx = new InitialContext(); NoDefaultInterceptorsSLSB bean = (NoDefaultInterceptorsSLSB) ctx.lookup("java:module/" + NoDefaultInterceptorsSLSB.class.getSimpleName()); final String message = bean.noClassLevel(); Assert.assertEquals(MethodInterceptor.MESSAGE + "Hello", message); Assert.assertTrue(!bean.isPostConstructCalled()); } @Test public void testMethodLevelExcludeDefaultInterceptors() throws NamingException { InitialContext ctx = new InitialContext(); RepeatedDefaultInterceptedSLSB bean = (RepeatedDefaultInterceptedSLSB) ctx.lookup("java:module/" + RepeatedDefaultInterceptedSLSB.class.getSimpleName()); final String message = bean.noClassLevel(); Assert.assertEquals(DefaultInterceptor.MESSAGE + "Hello", message); Assert.assertTrue(bean.isPostConstructCalled()); } @Test public void testMethodLevelExcludeDefaultAndClassInterceptors() throws NamingException { InitialContext ctx = new InitialContext(); RepeatedDefaultInterceptedSLSB bean = (RepeatedDefaultInterceptedSLSB) ctx.lookup("java:module/" + RepeatedDefaultInterceptedSLSB.class.getSimpleName()); final String message = bean.noClassLevelOrDefault(); Assert.assertEquals("Hello", message); Assert.assertTrue(bean.isPostConstructCalled()); } @Test public void testMethodLevelExcludeDefaultAndClassInterceptorsDescriptorDef() throws NamingException { InitialContext ctx = new InitialContext(); DefaultAndClassInterceptedSLSB bean = (DefaultAndClassInterceptedSLSB) ctx.lookup("java:module/" + DefaultAndClassInterceptedSLSB.class.getSimpleName()); final String message1 = bean.defaultAndClassIntercepted(); Assert.assertEquals(DefaultInterceptor.MESSAGE + ClassInterceptor.MESSAGE + "Hello", message1); final String message2 = bean.noClassAndDefaultInDescriptor(); Assert.assertEquals(MethodInterceptor.MESSAGE + "Hi", message2); Assert.assertTrue(bean.isPostConstructCalled()); } }
6,002
45.176923
123
java
null
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/interceptor/defaultinterceptor/MethodInterceptor.java
/* * JBoss, Home of Professional Open Source * Copyright 2010, Red Hat Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt 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.defaultinterceptor; import jakarta.interceptor.AroundInvoke; import jakarta.interceptor.InvocationContext; /** * @author Stuart Douglas */ public class MethodInterceptor { public static final String MESSAGE = "MethodInterceptor "; @AroundInvoke public Object aroundInvoke(final InvocationContext context) throws Exception { if (context.getMethod().getReturnType().equals(String.class)) { return MESSAGE + context.proceed().toString(); } return context.proceed(); } }
1,595
37
82
java
null
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/interceptor/defaultinterceptor/RepeatedDefaultInterceptedSLSB.java
/* * JBoss, Home of Professional Open Source * Copyright 2010, Red Hat Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt 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.defaultinterceptor; import jakarta.ejb.LocalBean; import jakarta.ejb.Stateless; import jakarta.interceptor.ExcludeClassInterceptors; import jakarta.interceptor.ExcludeDefaultInterceptors; import jakarta.interceptor.Interceptors; /** * @author Stuart Douglas */ @Stateless @LocalBean @Interceptors({ DefaultInterceptor.class, DefaultInterceptor.class }) public class RepeatedDefaultInterceptedSLSB implements SessionBean { private boolean postConstructCalled; public String message() { return "Hello"; } @ExcludeClassInterceptors public String noClassLevel() { return "Hello"; } @ExcludeClassInterceptors @ExcludeDefaultInterceptors public String noClassLevelOrDefault() { return "Hello"; } @Override public void setPostConstructCalled() { postConstructCalled = true; } public boolean isPostConstructCalled() { return postConstructCalled; } }
2,022
30.609375
73
java
null
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/interceptor/defaultinterceptor/NoDefaultInterceptorsSLSB.java
/* * JBoss, Home of Professional Open Source * Copyright 2010, Red Hat Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt 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.defaultinterceptor; import jakarta.ejb.LocalBean; import jakarta.ejb.Stateless; import jakarta.interceptor.ExcludeClassInterceptors; import jakarta.interceptor.ExcludeDefaultInterceptors; /** * @author Stuart Douglas */ @Stateless @LocalBean @ExcludeDefaultInterceptors public class NoDefaultInterceptorsSLSB implements SessionBean { private boolean postConstructCalled; public String message() { return "Hello"; } @ExcludeClassInterceptors public String noClassLevel() { return "Hello"; } @Override public void setPostConstructCalled() { postConstructCalled = true; } public boolean isPostConstructCalled() { return postConstructCalled; } }
1,797
30.54386
73
java
null
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/interceptor/defaultinterceptor/DefaultInterceptedSLSB.java
/* * JBoss, Home of Professional Open Source * Copyright 2010, Red Hat Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt 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.defaultinterceptor; import jakarta.ejb.LocalBean; import jakarta.ejb.Stateless; /** * @author Stuart Douglas */ @Stateless @LocalBean public class DefaultInterceptedSLSB implements SessionBean { private boolean postConstructCalled; public String message() { return "Hello"; } @Override public void setPostConstructCalled() { postConstructCalled = true; } public boolean isPostConstructCalled() { return postConstructCalled; } }
1,562
30.897959
73
java
null
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/interceptor/defaultinterceptor/DefaultAndClassInterceptedSLSB.java
/* * JBoss, Home of Professional Open Source * Copyright 2010, Red Hat Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt 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.defaultinterceptor; import jakarta.ejb.LocalBean; import jakarta.ejb.Stateless; import jakarta.interceptor.Interceptors; /** * @author Stuart Douglas */ @Stateless @LocalBean @Interceptors({ ClassInterceptor.class }) public class DefaultAndClassInterceptedSLSB implements SessionBean { private boolean postConstructCalled; public String defaultAndClassIntercepted() { return "Hello"; } public String noClassAndDefaultInDescriptor() { return "Hi"; } @Override public void setPostConstructCalled() { postConstructCalled = true; } public boolean isPostConstructCalled() { return postConstructCalled; } }
1,752
30.872727
73
java
null
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/interceptor/invocationcontext/ClassInterceptor.java
/* * JBoss, Home of Professional Open Source * Copyright 2012, Red Hat Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt 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.invocationcontext; import jakarta.annotation.PostConstruct; import jakarta.interceptor.AroundInvoke; import jakarta.interceptor.AroundTimeout; import jakarta.interceptor.InvocationContext; import org.jboss.logging.Logger; /** * @author OndrejChaloupka */ public class ClassInterceptor { private static final Logger log = Logger.getLogger(ClassInterceptor.class); @AroundInvoke Object intercept(InvocationContext ctx) throws Exception { String ret = InvocationContextChecker.checkBeanInterceptorContext(ctx, "Default", "Class"); return ret + ctx.proceed(); } @AroundTimeout Object interceptTimeout(InvocationContext ctx) throws Exception { String ret = InvocationContextChecker.checkTimeoutInterceptorContext(ctx, "Default", "Class"); TimeoutBean.interceptorResults += ret; return ctx.proceed(); } @PostConstruct void postConstruct(InvocationContext ctx) { log.trace("PostConstruct on ClassInterceptor called"); if (ctx.getMethod() != null) { throw new RuntimeException("InvocationContext.getMethod() on lifecycle event has to be null"); } } }
2,238
36.949153
106
java
null
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/interceptor/invocationcontext/DefaultInterceptor.java
/* * JBoss, Home of Professional Open Source * Copyright 2012, Red Hat Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt 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.invocationcontext; import jakarta.annotation.PostConstruct; import jakarta.interceptor.AroundInvoke; import jakarta.interceptor.AroundTimeout; import jakarta.interceptor.InvocationContext; import org.jboss.logging.Logger; /** * @author OndrejChaloupka */ public class DefaultInterceptor { private static final Logger log = Logger.getLogger(DefaultInterceptor.class); @AroundInvoke Object intercept(InvocationContext ctx) throws Exception { String ret = InvocationContextChecker.checkBeanInterceptorContext(ctx, null, "Default"); return ret + ctx.proceed(); } @AroundTimeout Object interceptTimeout(InvocationContext ctx) throws Exception { String ret = InvocationContextChecker.checkTimeoutInterceptorContext(ctx, null, "Default"); TimeoutBean.interceptorResults += ret; return ctx.proceed(); } @PostConstruct void postConstruct(InvocationContext ctx) { log.trace("PostConstruct on DefaultInterceptor called" + ctx.getTarget().getClass().getName()); if (ctx.getMethod() != null) { throw new RuntimeException("InvocationContext.getMethod() on lifecycle event has to be null"); } } }
2,277
37.610169
106
java
null
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/interceptor/invocationcontext/InvocationContextTestCase.java
/* * JBoss, Home of Professional Open Source * Copyright 2010, Red Hat Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt 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.invocationcontext; import javax.naming.InitialContext; import javax.naming.NamingException; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.junit.Arquillian; import org.jboss.arquillian.test.api.ArquillianResource; 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; /** * Interceptor invocation context testing. * * @author Ondrej Chaloupka */ @RunWith(Arquillian.class) public class InvocationContextTestCase { @ArquillianResource InitialContext ctx; @Deployment public static Archive<?> deploy() { JavaArchive jar = ShrinkWrap.create(JavaArchive.class, "invocation-context.jar"); jar.addPackage(InvocationContextTestCase.class.getPackage()); jar.addAsManifestResource(InvocationContextTestCase.class.getPackage(), "ejb-jar.xml", "ejb-jar.xml"); return jar; } @Test public void testInvocationContext() throws NamingException { final InvocationBean bean = (InvocationBean) ctx.lookup("java:module/" + InvocationBean.class.getSimpleName()); final String result = bean.callMethod(1, "invoked"); Assert.assertEquals("DefaultOK:ClassOK:MethodOK:BeanOK:invokedDefaultClassMethodBean", result); } @Test public void tesTimerInvocationContext() throws NamingException { TimeoutBean bean = (TimeoutBean) ctx.lookup("java:module/" + TimeoutBean.class.getSimpleName()); bean.createTimer(); Assert.assertTrue(TimeoutBean.awaitTimerCall()); Assert.assertEquals("TimeoutDefaultOK:TimeoutClassOK:TimeoutMethodOK:TimeoutBeanOK:@Timeout", TimeoutBean.interceptorResults); } }
2,878
38.438356
134
java
null
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/interceptor/invocationcontext/MethodInterceptor.java
/* * JBoss, Home of Professional Open Source * Copyright 2012, Red Hat Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt 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.invocationcontext; import jakarta.annotation.PostConstruct; import jakarta.interceptor.AroundInvoke; import jakarta.interceptor.InvocationContext; import org.jboss.logging.Logger; /** * @author OndrejChaloupka */ public class MethodInterceptor { private static final Logger log = Logger.getLogger(MethodInterceptor.class); @AroundInvoke Object intercept(InvocationContext ctx) throws Exception { String ret = InvocationContextChecker.checkBeanInterceptorContext(ctx, "Class", "Method"); return ret + ctx.proceed(); } Object interceptTimeout(InvocationContext ctx) throws Exception { String ret = InvocationContextChecker.checkTimeoutInterceptorContext(ctx, "Class", "Method"); TimeoutBean.interceptorResults += ret; return ctx.proceed(); } @PostConstruct void postConstruct(InvocationContext ctx) { log.trace("PostConstruct on MethodInterceptor called"); if (ctx.getMethod() != null) { throw new RuntimeException("InvocationContext.getMethod() on lifecycle event has to be null"); } } }
2,178
37.22807
106
java
null
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/interceptor/invocationcontext/InvocationBean.java
/* * JBoss, Home of Professional Open Source * Copyright 2012, Red Hat Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt 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.invocationcontext; import jakarta.ejb.Stateless; import jakarta.interceptor.AroundInvoke; import jakarta.interceptor.Interceptors; import jakarta.interceptor.InvocationContext; /** * @author Ondrej Chaloupka */ @Stateless @Interceptors({ClassInterceptor.class}) public class InvocationBean { @Interceptors({MethodInterceptor.class}) public String callMethod(Integer i, String str2) { return str2; } @AroundInvoke Object intercept(InvocationContext ctx) throws Exception { String ret = InvocationContextChecker.checkBeanInterceptorContext(ctx, "Method", "Bean"); return ret + ctx.proceed(); } }
1,719
34.833333
97
java
null
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/interceptor/invocationcontext/InvocationContextChecker.java
package org.jboss.as.test.integration.ejb.interceptor.invocationcontext; import jakarta.ejb.Timer; import jakarta.interceptor.InvocationContext; import org.jboss.logging.Logger; /** * Checking values of InvocationContext during its flow amongst interceptors. * * @author Ondrej Chaloupka */ public class InvocationContextChecker { private static final Logger log = Logger.getLogger(InvocationContextChecker.class); public static String checkBeanInterceptorContext(InvocationContext ctx, String previousPhase, String currentPhase) { log.trace("Checking method call interceptor on: " + currentPhase); boolean okContext = false; if (previousPhase == null) { okContext = ctx.getContextData().get("interceptor") == null; } else { okContext = previousPhase.equals(ctx.getContextData().get("interceptor")); } ctx.getContextData().put("interceptor", currentPhase); final boolean okTimer = ctx.getTimer() == null; final boolean okTarget = ctx.getTarget() instanceof InvocationBean; final boolean okMethod = "callMethod".equals(ctx.getMethod().getName()); Object[] params = ctx.getParameters(); Integer param1 = (Integer) params[0]; String param2 = (String) params[1]; final boolean okParam = param1 == 1; Object[] newParams = {param1, param2 + currentPhase}; ctx.setParameters(newParams); String retStr = currentPhase; boolean isOk = okContext && okTimer && okTarget && okMethod && okParam; if (isOk) { retStr += "OK:"; } else { retStr += "FAIL:"; retStr += okContext ? "" : "(context expected: " + previousPhase + " but was " + ctx.getContextData().get("interceptor") + ")"; retStr += okTimer ? "" : "(timer was not null but " + ctx.getTimer() + " )"; retStr += okTarget ? "" : "(target was not instance of InvocationBean but was " + ctx.getTarget() + ")"; retStr += okMethod ? "" : "(method was not callMethod but was " + ctx.getMethod().getName() + ")"; retStr += okParam ? "" : "(first parameter was not 1 but was " + param1 + ")"; log.error(retStr); } return retStr; } public static String checkTimeoutInterceptorContext(InvocationContext ctx, String previousPhase, String currentPhase) { log.trace("Checking timeout interceptor on: " + currentPhase); boolean okContext = false; if (previousPhase == null) { okContext = ctx.getContextData().get("interceptor") == null; } else { okContext = previousPhase.equals(ctx.getContextData().get("interceptor")); } ctx.getContextData().put("interceptor", currentPhase); final boolean okTimer = ctx.getTimer() != null; final boolean okTarget = ctx.getTarget() instanceof TimeoutBean; final boolean okMethod = "timeout".equals(ctx.getMethod().getName()); Object[] params = ctx.getParameters(); final boolean okParams = params[0] instanceof Timer; String retStr = "Timeout" + currentPhase; boolean isOk = okContext && okTimer && okTarget && okMethod && okParams; if (isOk) { retStr += "OK:"; } else { retStr += "FAIL:"; retStr += okContext ? "" : "(context expected: " + previousPhase + " but was " + ctx.getContextData().get("interceptor") + ")"; retStr += okTimer ? "" : "(timer was null but it can't be)"; retStr += okTarget ? "" : "(target was not instance of InvocationBean but was " + ctx.getTarget() + ")"; retStr += okMethod ? "" : "(method was not callMethod but was " + ctx.getMethod().getName() + ")"; retStr += okParams ? "" : "(first param has to be type of Timer and not " + params[0] + " )"; log.error(retStr); } return retStr; } }
3,957
46.119048
139
java
null
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/interceptor/invocationcontext/TimeoutBean.java
/* * JBoss, Home of Professional Open Source * Copyright 2012, Red Hat Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt 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.invocationcontext; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; import jakarta.annotation.Resource; import jakarta.ejb.Stateless; import jakarta.ejb.Timeout; import jakarta.ejb.Timer; import jakarta.ejb.TimerService; import jakarta.interceptor.AroundTimeout; import jakarta.interceptor.ExcludeClassInterceptors; import jakarta.interceptor.ExcludeDefaultInterceptors; import jakarta.interceptor.Interceptors; import jakarta.interceptor.InvocationContext; /** * @author Ondrej Chaloupka */ @Stateless @Interceptors({ClassInterceptor.class}) public class TimeoutBean { private static final CountDownLatch latch = new CountDownLatch(1); private static boolean timerServiceCalled = false; public static String interceptorResults = ""; @Resource private TimerService timerService; @ExcludeDefaultInterceptors @ExcludeClassInterceptors public void createTimer() { timerService.createTimer(100, null); } @AroundTimeout public Object aroundTimeoutParent(final InvocationContext ctx) throws Exception { String ret = InvocationContextChecker.checkTimeoutInterceptorContext(ctx, "Method", "Bean"); TimeoutBean.interceptorResults += ret; return ctx.proceed(); } @Timeout @Interceptors(MethodInterceptor.class) private void timeout(Timer timer) { timerServiceCalled = true; interceptorResults += "@Timeout"; latch.countDown(); } @ExcludeDefaultInterceptors @ExcludeClassInterceptors public static boolean awaitTimerCall() { try { latch.await(10, TimeUnit.SECONDS); } catch (InterruptedException e) { throw new RuntimeException(e); } return timerServiceCalled; } }
2,859
33.457831
100
java
null
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/interceptor/lifecycle/order/LastInterceptor.java
/* * JBoss, Home of Professional Open Source * Copyright 2010, Red Hat Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt 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.lifecycle.order; import jakarta.annotation.PostConstruct; import jakarta.interceptor.InvocationContext; import org.junit.Assert; /** * @author Stuart Douglas */ public class LastInterceptor { public static boolean postConstructCalled; @PostConstruct public void child(InvocationContext ctx) throws Exception { postConstructCalled = true; Assert.assertTrue(InterceptorParent.parentPostConstructCalled); Assert.assertTrue(InterceptorChild.childPostConstructCalled); Assert.assertTrue(FirstInterceptor.postConstructCalled); Assert.assertFalse(SFSBParent.parentPostConstructCalled); Assert.assertFalse(SFSBChild.childPostConstructCalled); ctx.proceed(); } }
1,804
36.604167
73
java
null
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/interceptor/lifecycle/order/SFSBChild.java
/* * JBoss, Home of Professional Open Source * Copyright 2010, Red Hat Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt 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.lifecycle.order; import jakarta.annotation.PostConstruct; import jakarta.ejb.Stateful; import jakarta.interceptor.Interceptors; import org.junit.Assert; /** * @author Stuart Douglas */ @Stateful(passivationCapable = false) @Interceptors({ FirstInterceptor.class, InterceptorChild.class, LastInterceptor.class }) public class SFSBChild extends SFSBParent { public static boolean childPostConstructCalled = false; @PostConstruct public void child() { childPostConstructCalled = true; Assert.assertTrue(SFSBParent.parentPostConstructCalled); Assert.assertTrue(InterceptorParent.parentPostConstructCalled); Assert.assertTrue(InterceptorChild.childPostConstructCalled); } public void doStuff() { } }
1,830
34.901961
88
java
null
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/interceptor/lifecycle/order/SFSBParent.java
/* * JBoss, Home of Professional Open Source * Copyright 2010, Red Hat Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt 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.lifecycle.order; import jakarta.annotation.PostConstruct; import org.junit.Assert; /** * @author Stuart Douglas */ public class SFSBParent { public static boolean parentPostConstructCalled = false; @PostConstruct public void parent() { parentPostConstructCalled = true; Assert.assertTrue(InterceptorChild.childPostConstructCalled); Assert.assertTrue(InterceptorParent.parentPostConstructCalled); Assert.assertFalse(SFSBChild.childPostConstructCalled); } }
1,582
34.977273
73
java
null
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/interceptor/lifecycle/order/InterceptorChild.java
/* * JBoss, Home of Professional Open Source * Copyright 2010, Red Hat Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt 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.lifecycle.order; import jakarta.annotation.PostConstruct; import jakarta.interceptor.InvocationContext; import org.junit.Assert; /** * * @author Stuart Douglas */ public class InterceptorChild extends InterceptorParent { public static boolean childPostConstructCalled; @PostConstruct public void child(InvocationContext ctx) throws Exception { Assert.assertTrue(InterceptorParent.parentPostConstructCalled); Assert.assertTrue(FirstInterceptor.postConstructCalled); Assert.assertFalse(LastInterceptor.postConstructCalled); Assert.assertFalse(SFSBParent.parentPostConstructCalled); Assert.assertFalse(SFSBChild.childPostConstructCalled); childPostConstructCalled = true; ctx.proceed(); } }
1,839
36.55102
73
java
null
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/interceptor/lifecycle/order/InterceptorParent.java
/* * JBoss, Home of Professional Open Source * Copyright 2010, Red Hat Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt 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.lifecycle.order; import jakarta.annotation.PostConstruct; import jakarta.interceptor.InvocationContext; import org.junit.Assert; /** * @author Stuart Douglas */ public class InterceptorParent { public static boolean parentPostConstructCalled = false; @PostConstruct public void parent(InvocationContext ctx) throws Exception { parentPostConstructCalled = true; Assert.assertFalse(InterceptorChild.childPostConstructCalled); Assert.assertTrue(FirstInterceptor.postConstructCalled); Assert.assertFalse(LastInterceptor.postConstructCalled); Assert.assertFalse(SFSBParent.parentPostConstructCalled); Assert.assertFalse(SFSBChild.childPostConstructCalled); ctx.proceed(); } }
1,821
36.958333
73
java
null
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/interceptor/lifecycle/order/FirstInterceptor.java
/* * JBoss, Home of Professional Open Source * Copyright 2010, Red Hat Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt 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.lifecycle.order; import jakarta.annotation.PostConstruct; import jakarta.interceptor.InvocationContext; import org.junit.Assert; /** * @author Stuart Douglas */ public class FirstInterceptor { public static boolean postConstructCalled; @PostConstruct public void child(InvocationContext ctx) throws Exception { postConstructCalled = true; Assert.assertFalse(InterceptorParent.parentPostConstructCalled); Assert.assertFalse(InterceptorChild.childPostConstructCalled); Assert.assertFalse(LastInterceptor.postConstructCalled); Assert.assertFalse(SFSBParent.parentPostConstructCalled); Assert.assertFalse(SFSBChild.childPostConstructCalled); ctx.proceed(); } }
1,807
36.666667
73
java
null
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/interceptor/lifecycle/order/PostConstructOrderTestCase.java
/* * JBoss, Home of Professional Open Source * Copyright 2010, Red Hat Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt 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.lifecycle.order; import javax.naming.InitialContext; import javax.naming.NamingException; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.junit.Arquillian; import org.jboss.shrinkwrap.api.Archive; import org.jboss.shrinkwrap.api.ShrinkWrap; import org.jboss.shrinkwrap.api.spec.WebArchive; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; /** * @author Stuart Douglas */ @RunWith(Arquillian.class) public class PostConstructOrderTestCase { @Deployment public static Archive<?> deploy() { WebArchive war = ShrinkWrap.create(WebArchive.class, "testlocal.war"); war.addPackage(PostConstructOrderTestCase.class.getPackage()); return war; } @Test public void testPostConstructMethodOrder() throws NamingException { InitialContext ctx = new InitialContext(); SFSBChild bean = (SFSBChild) ctx.lookup("java:module/" + SFSBChild.class.getSimpleName()); bean.doStuff(); Assert.assertTrue(SFSBParent.parentPostConstructCalled); Assert.assertTrue(SFSBChild.childPostConstructCalled); Assert.assertTrue(InterceptorParent.parentPostConstructCalled); Assert.assertTrue(InterceptorChild.childPostConstructCalled); } }
2,355
37.622951
98
java
null
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/interceptor/lifecycle/chains/LifecycleInterceptorNoProceed.java
/* * JBoss, Home of Professional Open Source * Copyright 2010, Red Hat Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt 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.lifecycle.chains; import jakarta.annotation.PostConstruct; import jakarta.annotation.PreDestroy; import jakarta.interceptor.InvocationContext; /** * @author Stuart Douglas */ public class LifecycleInterceptorNoProceed { public static boolean postConstruct = false; public static boolean preDestroy = false; @PostConstruct private void postConstruct(InvocationContext ctx) throws Exception{ postConstruct = true; } @PreDestroy private void preDestroy(InvocationContext ctx) throws Exception { preDestroy = true; } }
1,642
33.229167
73
java
null
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/interceptor/lifecycle/chains/InterceptorLifecycleSFSBTestCase.java
/* * JBoss, Home of Professional Open Source * Copyright 2010, Red Hat Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt 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.lifecycle.chains; import javax.naming.InitialContext; import javax.naming.NamingException; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.junit.Arquillian; import org.jboss.shrinkwrap.api.Archive; import org.jboss.shrinkwrap.api.ShrinkWrap; import org.jboss.shrinkwrap.api.spec.WebArchive; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; /** * Tests that lifecycle interceptors are handed correctly, * as per the interceptors specification. * * @author Stuart Douglas */ @RunWith(Arquillian.class) public class InterceptorLifecycleSFSBTestCase { @Deployment public static Archive<?> deploy() { WebArchive war = ShrinkWrap.create(WebArchive.class,"testlocal.war"); war.addPackage(InterceptorLifecycleSFSBTestCase.class.getPackage()); return war; } @Test public void testInterceptorPostConstructWithoutProceed() throws NamingException { InitialContext ctx = new InitialContext(); InterceptedNoProceedSLSB bean = (InterceptedNoProceedSLSB)ctx.lookup("java:module/" + InterceptedNoProceedSLSB.class.getSimpleName()); bean.doStuff(); Assert.assertTrue(LifecycleInterceptorNoProceed.postConstruct); Assert.assertFalse(InterceptedNoProceedSLSB.isPostConstructCalled()); } @Test public void testInterceptorPostConstructWithProceed() throws NamingException { InitialContext ctx = new InitialContext(); InterceptedWithProceedSLSB bean = (InterceptedWithProceedSLSB)ctx.lookup("java:module/" + InterceptedWithProceedSLSB.class.getSimpleName()); bean.doStuff(); Assert.assertTrue(LifecycleInterceptorWithProceed.postConstruct); Assert.assertTrue(InterceptedWithProceedSLSB.isPostConstructCalled()); } }
2,888
38.575342
148
java
null
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/interceptor/lifecycle/chains/InterceptedNoProceedSLSB.java
/* * JBoss, Home of Professional Open Source * Copyright 2010, Red Hat Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt 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.lifecycle.chains; import jakarta.annotation.PostConstruct; import jakarta.ejb.Stateless; import jakarta.interceptor.Interceptors; /** * @author Stuart Douglas */ @Stateless @Interceptors(LifecycleInterceptorNoProceed.class) public class InterceptedNoProceedSLSB { private static boolean postConstructCalled = false; public void doStuff() { } /** * This method should not be called, as proceed() is not called from the interceptors * post construct method. */ @PostConstruct public void postContruct() { postConstructCalled = true; } public static boolean isPostConstructCalled() { return postConstructCalled; } }
1,759
31.592593
89
java
null
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/interceptor/lifecycle/chains/InterceptedWithProceedSLSB.java
/* * JBoss, Home of Professional Open Source * Copyright 2010, Red Hat Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt 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.lifecycle.chains; import org.junit.Assert; import jakarta.annotation.PostConstruct; import jakarta.ejb.Stateless; import jakarta.interceptor.Interceptors; /** * @author Stuart Douglas */ @Stateless @Interceptors(LifecycleInterceptorWithProceed.class) public class InterceptedWithProceedSLSB { private static boolean postConstructCalled = false; public void doStuff() { } /** * This method should be called, after proceed is called from the interceptor, in the same call stack * as the interceptors post construct method. (See 'Multiple Callback Interceptor Methods for a Life Cycle * Callback Event' in the interceptors specification. */ @PostConstruct public void postConstruct() { Assert.assertTrue(LifecycleInterceptorWithProceed.postConstruct); Assert.assertFalse(LifecycleInterceptorWithProceed.postConstructFinished); postConstructCalled = true; } public static boolean isPostConstructCalled() { return postConstructCalled; } }
2,102
34.644068
110
java
null
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/interceptor/lifecycle/chains/LifecycleInterceptorWithProceed.java
/* * JBoss, Home of Professional Open Source * Copyright 2010, Red Hat Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt 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.lifecycle.chains; import jakarta.annotation.PostConstruct; import jakarta.annotation.PreDestroy; import jakarta.interceptor.InvocationContext; /** * @author Stuart Douglas */ public class LifecycleInterceptorWithProceed { public static boolean postConstruct = false; public static boolean postConstructFinished = false; public static boolean preDestroy = false; @PostConstruct private void postConstruct(InvocationContext ctx) throws Exception { postConstruct = true; ctx.proceed(); postConstructFinished = true; } @PreDestroy private void preDestroy(InvocationContext ctx) throws Exception { preDestroy = true; ctx.proceed(); } }
1,786
33.365385
73
java
null
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/interceptor/lifecycle/destroy/PreDestroySFSB.java
/* * JBoss, Home of Professional Open Source * Copyright 2010, Red Hat Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt 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.lifecycle.destroy; import jakarta.annotation.PostConstruct; import jakarta.annotation.PreDestroy; import jakarta.ejb.Remove; import jakarta.ejb.Stateful; import jakarta.interceptor.Interceptors; /** * @author Stuart Douglas */ @Stateful @Interceptors(PreDestroyInterceptor.class) public class PreDestroySFSB { public static boolean preDestroyCalled = false; public static boolean postConstructCalled = false; public void doStuff() { } @Remove public void remove() { } @PostConstruct @SuppressWarnings("unused") private void postConstruct() { postConstructCalled = true; } @PreDestroy @SuppressWarnings("unused") private void preDestroy() { preDestroyCalled = true; } }
1,826
28.95082
73
java
null
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/interceptor/lifecycle/destroy/PreDestroyInterceptorDescriptor.java
/* * JBoss, Home of Professional Open Source * Copyright 2012, Red Hat Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt 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.lifecycle.destroy; import jakarta.interceptor.InvocationContext; /** * @author Ondrej Chaloupka */ public class PreDestroyInterceptorDescriptor { public static boolean preDestroy = false; public static boolean postConstruct = false; public static boolean preDestroyInvocationTargetNull = false; public static boolean postConstructInvocationTargetNull = false; @SuppressWarnings("unused") private void postConstruct(InvocationContext ctx) throws Exception { if(ctx.getTarget() == null) { postConstructInvocationTargetNull = true; } postConstruct = true; ctx.proceed(); } @SuppressWarnings("unused") private void preDestroy(InvocationContext ctx) throws Exception { if(ctx.getTarget() == null) { preDestroyInvocationTargetNull = true; } preDestroy = true; ctx.proceed(); } }
1,980
34.375
73
java
null
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/interceptor/lifecycle/destroy/PreDestroyInterceptorTestCase.java
/* * JBoss, Home of Professional Open Source * Copyright 2010, Red Hat Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt 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.lifecycle.destroy; import javax.naming.InitialContext; import javax.naming.NamingException; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.junit.Arquillian; 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; /** * Tests that lifecycle interceptors are handed correctly, * as per the interceptors specification. * * @author Stuart Douglas, Ondrej Chaloupka */ @RunWith(Arquillian.class) public class PreDestroyInterceptorTestCase { @Deployment public static Archive<?> deploy() { JavaArchive jar = ShrinkWrap.create(JavaArchive.class,"testpredestroy.jar"); jar.addPackage(PreDestroyInterceptorTestCase.class.getPackage()); jar.addAsManifestResource(PreDestroyInterceptorTestCase.class.getPackage(), "ejb-jar.xml", "ejb-jar.xml"); return jar; } @Test public void testPreDestroyInterceptor() throws NamingException { InitialContext ctx = new InitialContext(); PreDestroySFSB bean = (PreDestroySFSB)ctx.lookup("java:module/" + PreDestroySFSB.class.getSimpleName()); Assert.assertTrue(PreDestroySFSB.postConstructCalled); Assert.assertTrue(PreDestroyInterceptor.postConstruct); Assert.assertFalse("InvocationContext.getTarget() was null for post-construct interceptor", PreDestroyInterceptor.postConstructInvocationTargetNull); Assert.assertTrue(PreDestroyInterceptorDescriptor.postConstruct); Assert.assertFalse("InvocationContext.getTarget() was null for post-construct interceptor", PreDestroyInterceptorDescriptor.postConstructInvocationTargetNull); bean.remove(); Assert.assertTrue(PreDestroySFSB.preDestroyCalled); Assert.assertTrue(PreDestroyInterceptor.preDestroy); Assert.assertFalse("InvocationContext.getTarget() was null for pre-destroy interceptor", PreDestroyInterceptor.preDestroyInvocationTargetNull); Assert.assertTrue(PreDestroyInterceptorDescriptor.preDestroy); Assert.assertFalse("InvocationContext.getTarget() was null for pre-destroy interceptor", PreDestroyInterceptorDescriptor.preDestroyInvocationTargetNull); } }
3,381
45.972222
167
java
null
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/interceptor/lifecycle/destroy/PreDestroyInterceptor.java
/* * JBoss, Home of Professional Open Source * Copyright 2010, Red Hat Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt 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.lifecycle.destroy; import jakarta.annotation.PostConstruct; import jakarta.annotation.PreDestroy; import jakarta.interceptor.InvocationContext; /** * @author Stuart Douglas, Ondrej Chaloupka */ public class PreDestroyInterceptor { public static boolean preDestroy = false; public static boolean postConstruct = false; public static boolean preDestroyInvocationTargetNull = false; public static boolean postConstructInvocationTargetNull = false; @PostConstruct @SuppressWarnings("unused") private void postConstruct(InvocationContext ctx) throws Exception { if(ctx.getTarget() == null) { postConstructInvocationTargetNull = true; } postConstruct = true; ctx.proceed(); } @PreDestroy @SuppressWarnings("unused") private void preDestroy(InvocationContext ctx) throws Exception { if(ctx.getTarget() == null) { preDestroyInvocationTargetNull = true; } preDestroy = true; ctx.proceed(); } }
2,100
34.016667
73
java
null
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/interceptor/serverside/SampleBean.java
/* * JBoss, Home of Professional Open Source. * Copyright 2019, 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.integration.ejb.interceptor.serverside; import jakarta.ejb.Local; import jakarta.ejb.Stateless; /** * @author <a href="mailto:[email protected]">Sultan Zhantemirov</a> (c) 2019 Red Hat, inc. */ @Stateless @Local public class SampleBean { public String getSimpleName() { return SampleBean.class.getSimpleName(); } }
1,387
35.526316
93
java
null
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/interceptor/serverside/ServerInterceptor.java
/* * JBoss, Home of Professional Open Source. * Copyright 2019, 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.integration.ejb.interceptor.serverside; import java.util.concurrent.CountDownLatch; import jakarta.interceptor.AroundInvoke; import jakarta.interceptor.AroundTimeout; import jakarta.interceptor.InvocationContext; /** * Server side sample interceptor * @author <a href="mailto:[email protected]">Sultan Zhantemirov</a> (c) 2019 Red Hat, inc. */ public class ServerInterceptor { public static final CountDownLatch latch = new CountDownLatch(1); public static final CountDownLatch timeoutLatch = new CountDownLatch(1); public ServerInterceptor() { } @AroundInvoke public Object aroundInvoke(final InvocationContext invocationContext) throws Exception { try { return invocationContext.proceed(); } finally { latch.countDown(); } } @AroundTimeout public Object aroundTimeout(final InvocationContext invocationContext) throws Exception { try { return invocationContext.proceed(); } finally { timeoutLatch.countDown(); } } }
2,114
34.847458
93
java
null
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/interceptor/serverside/ScheduleBean.java
/* * JBoss, Home of Professional Open Source. * Copyright 2019, 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.integration.ejb.interceptor.serverside; import jakarta.ejb.Local; import jakarta.ejb.Schedule; import jakarta.ejb.Stateless; import jakarta.ejb.Timer; /** * @author <a href="mailto:[email protected]">Sultan Zhantemirov</a> (c) 2019 Red Hat, inc. */ @Stateless @Local public class ScheduleBean { private static String timerInfo; public String getTimerInfo() { return timerInfo; } @Schedule(second="0/2", minute = "*", hour = "*", info = "info") public void timeout(Timer timer) { timerInfo = (String) timer.getInfo(); } }
1,619
33.468085
93
java
null
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/interceptor/serverside/ServerInterceptorsTestCase.java
/* * JBoss, Home of Professional Open Source. * Copyright 2019, 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.integration.ejb.interceptor.serverside; import static org.jboss.as.controller.client.helpers.ClientConstants.NAME; import static org.jboss.as.controller.client.helpers.ClientConstants.OP; import static org.jboss.as.controller.client.helpers.ClientConstants.OP_ADDR; import static org.jboss.as.controller.client.helpers.ClientConstants.READ_ATTRIBUTE_OPERATION; import static org.jboss.as.controller.client.helpers.ClientConstants.RESULT; import static org.jboss.as.controller.client.helpers.ClientConstants.SUBSYSTEM; import static org.jboss.as.test.shared.integration.ejb.security.PermissionUtils.createPermissionsXmlAsset; import static org.junit.Assert.assertTrue; import java.io.FilePermission; import java.util.Collections; import java.util.List; import java.util.concurrent.TimeUnit; import javax.naming.InitialContext; import javax.naming.NamingException; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.junit.Arquillian; import org.jboss.arquillian.test.api.ArquillianResource; import org.jboss.as.arquillian.api.ServerSetup; import org.jboss.as.arquillian.container.ManagementClient; import org.jboss.as.test.shared.integration.ejb.interceptor.serverside.AbstractServerInterceptorsSetupTask; import org.jboss.as.test.shared.integration.ejb.interceptor.serverside.InterceptorModule; import org.jboss.dmr.ModelNode; import org.jboss.remoting3.security.RemotingPermission; import org.jboss.shrinkwrap.api.Archive; import org.jboss.shrinkwrap.api.ShrinkWrap; import org.jboss.shrinkwrap.api.asset.StringAsset; import org.jboss.shrinkwrap.api.spec.JavaArchive; import org.junit.Assert; import org.junit.FixMethodOrder; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.MethodSorters; /** * A test case verifying an ability of adding a server-side configured interceptor without changing deployments. * See https://issues.jboss.org/browse/WFLY-6143 for more details. * * @author <a href="mailto:[email protected]">Sultan Zhantemirov</a> (c) 2019 Red Hat, inc. */ @RunWith(Arquillian.class) @FixMethodOrder(MethodSorters.NAME_ASCENDING) @ServerSetup(ServerInterceptorsTestCase.SetupTask.class) public class ServerInterceptorsTestCase { @ArquillianResource private ManagementClient managementClient; private static final String moduleName = "interceptor-module"; private static final int TIMEOUT = 5; @Deployment public static Archive<?> deploy() { JavaArchive jar = ShrinkWrap.create(JavaArchive.class, "test-server-interceptor.jar"); jar.addPackage(ServerInterceptorsTestCase.class.getPackage()); jar.addPackage(AbstractServerInterceptorsSetupTask.class.getPackage()); jar.addAsManifestResource(new StringAsset("Dependencies: org.jboss.as.controller-client," + "org.jboss.dmr," + "org.jboss.remoting\n"), "MANIFEST.MF"); jar.addAsManifestResource(createPermissionsXmlAsset( new RemotingPermission("connect"), new RemotingPermission("createEndpoint"), new FilePermission(System.getProperty("jboss.inst") + "/standalone/tmp/auth/*", "read") ), "permissions.xml"); return jar; } @Test public void serverInterceptorAttributeReadCheck() throws Exception { // /subsystem=ejb3:read-attribute(name=server-interceptors) ModelNode op = new ModelNode(); op.get(OP).set(READ_ATTRIBUTE_OPERATION); op.get(OP_ADDR).set(SUBSYSTEM, "ejb3"); op.get(NAME).set("server-interceptors"); final ModelNode operationResult = managementClient.getControllerClient().execute(op); assertTrue(operationResult.get(RESULT).asString().contains(moduleName)); } @Test public void serverInterceptorExecutionCheck() throws NamingException { final InitialContext ctx = new InitialContext(); SampleBean bean = (SampleBean) ctx.lookup("java:module/" + SampleBean.class.getSimpleName()); // call bean method in order to execute interceptor's method bean.getSimpleName(); try { // waiting for the interceptor's aroundInvoke method execution ServerInterceptor.latch.await(TIMEOUT, TimeUnit.SECONDS); } catch (InterruptedException ie){ throw new RuntimeException("latch.await() has been interrupted", ie); } Assert.assertEquals(0, ServerInterceptor.latch.getCount()); } @Test public void serverInterceptorTimerExecutionCheck() throws NamingException { InitialContext ctx = new InitialContext(); ScheduleBean schedulesBean = (ScheduleBean) ctx.lookup("java:module/" + ScheduleBean.class.getSimpleName()); // call bean method in order to execute interceptor's method schedulesBean.getTimerInfo(); try { // waiting for the interceptor's aroundTimeout method execution ServerInterceptor.timeoutLatch.await(TIMEOUT, TimeUnit.SECONDS); } catch (InterruptedException ie){ throw new RuntimeException("timeoutLatch.await() has been interrupted", ie); } Assert.assertEquals(0, ServerInterceptor.timeoutLatch.getCount()); } static class SetupTask extends AbstractServerInterceptorsSetupTask.SetupTask { @Override public List<InterceptorModule> getModules() { return Collections.singletonList(new InterceptorModule( ServerInterceptor.class, moduleName, "module.xml", ServerInterceptorsTestCase.class.getResource("module.xml"), "server-side-interceptor.jar" ) ); } } }
6,788
43.664474
116
java
null
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/interceptor/serverside/multiple/ExceptionThrowingInterceptor.java
/* * JBoss, Home of Professional Open Source. * Copyright 2019, 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.integration.ejb.interceptor.serverside.multiple; import jakarta.interceptor.AroundInvoke; import jakarta.interceptor.InvocationContext; /** * Simple interceptor imitating forbidden EJB access */ public class ExceptionThrowingInterceptor { @AroundInvoke public Object throwException(InvocationContext invocationContext) throws Exception { throw new IllegalArgumentException("Intercepted: throwing an exception."); } }
1,491
39.324324
88
java
null
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/interceptor/serverside/multiple/MultipleInterceptorsTestCase.java
/* * JBoss, Home of Professional Open Source. * Copyright 2019, 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.integration.ejb.interceptor.serverside.multiple; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import java.util.Arrays; import java.util.List; import javax.naming.InitialContext; import javax.naming.NamingException; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.junit.Arquillian; import org.jboss.as.arquillian.api.ServerSetup; import org.jboss.as.test.shared.integration.ejb.interceptor.serverside.AbstractServerInterceptorsSetupTask; import org.jboss.as.test.shared.integration.ejb.interceptor.serverside.InterceptorModule; import org.jboss.as.test.integration.ejb.interceptor.serverside.SampleBean; import org.jboss.as.test.integration.ejb.interceptor.serverside.ServerInterceptor; 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; /** * A test case verifying: * 1. Multiple server-side interceptors execution * 2. An exception thrown in an interceptor is propagated. * See https://issues.jboss.org/browse/WFLY-6143 for more details. * * @author <a href="mailto:[email protected]">Sultan Zhantemirov</a> (c) 2019 Red Hat, inc. */ @RunWith(Arquillian.class) @ServerSetup(MultipleInterceptorsTestCase.SetupTask.class) public class MultipleInterceptorsTestCase { @Deployment public static Archive<?> deploy() { JavaArchive jar = ShrinkWrap.create(JavaArchive.class, "test-multiple-server-interceptor.jar"); jar.addClass(SampleBean.class); jar.addPackage(MultipleInterceptorsTestCase.class.getPackage()); jar.addPackage(AbstractServerInterceptorsSetupTask.class.getPackage()); return jar; } @Test public void multipleInterceptorsCheck() throws NamingException { final InitialContext ctx = new InitialContext(); SampleBean sampleBean = (SampleBean) ctx.lookup("java:module/" + SampleBean.class.getSimpleName()); try { sampleBean.getSimpleName(); fail("Should have thrown an IllegalArgumentException"); } catch (Exception iae) { assertTrue(iae instanceof IllegalArgumentException); } Assert.assertEquals(0, ServerInterceptor.latch.getCount()); } static class SetupTask extends AbstractServerInterceptorsSetupTask.SetupTask { @Override public List<InterceptorModule> getModules() { InterceptorModule firstModule = new InterceptorModule( ServerInterceptor.class, "interceptor-first-module", "first-module.xml", MultipleInterceptorsTestCase.class.getResource("first-module.xml"), "first-interceptor.jar" ); InterceptorModule secondModule = new InterceptorModule( ExceptionThrowingInterceptor.class, "interceptor-second-module", "second-module.xml", MultipleInterceptorsTestCase.class.getResource("second-module.xml"), "second-interceptor.jar" ); return Arrays.asList(firstModule, secondModule); } } }
4,353
40.865385
107
java
null
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/interceptor/serverside/remote/LoggingInterceptor.java
/* * JBoss, Home of Professional Open Source. * Copyright 2019, 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.integration.ejb.interceptor.serverside.remote; import jakarta.interceptor.AroundInvoke; import jakarta.interceptor.InvocationContext; import org.jboss.logging.Logger; /** * A simple interceptor that adds a prefix to the result based on the result data type. */ public class LoggingInterceptor { private static final Logger log = Logger.getLogger(LoggingInterceptor.class); static final String PREFIX = "Intercepted"; @AroundInvoke public Object logBeanAccess(final InvocationContext invocationContext) throws Exception { log.trace("Intercepted"); Object result = invocationContext.proceed(); return result instanceof String ? PREFIX + result : result; } }
1,754
40.785714
93
java
null
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/interceptor/serverside/remote/RemoteBeanTestCase.java
/* * JBoss, Home of Professional Open Source. * Copyright 2019, 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.integration.ejb.interceptor.serverside.remote; import java.util.Collections; import java.util.Hashtable; import java.util.List; import javax.naming.Context; import javax.naming.InitialContext; 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.as.arquillian.api.ServerSetup; import org.jboss.as.test.shared.integration.ejb.interceptor.serverside.AbstractServerInterceptorsSetupTask; import org.jboss.as.test.shared.integration.ejb.interceptor.serverside.InterceptorModule; 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.BeforeClass; import org.junit.Test; import org.junit.runner.RunWith; /** * A test case verifying server-side interceptor execution while accessing a stateful EJB implementing @Remote interface. * * @author Sultan Zhantemirov */ @RunWith(Arquillian.class) @ServerSetup(RemoteBeanTestCase.SetupTask.class) public class RemoteBeanTestCase { private static Context ctx; private static final String MODULE_NAME = "remote-stateful-ejb"; @BeforeClass public static void beforeClass() throws Exception { final Hashtable<String, String> props = new Hashtable<>(); props.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming"); ctx = new InitialContext(props); } @Deployment public static Archive createDeployment() { final JavaArchive jar = ShrinkWrap.create(JavaArchive.class, MODULE_NAME + ".jar"); jar.addPackage(RemoteBeanTestCase.class.getPackage()); jar.addPackage(AbstractServerInterceptorsSetupTask.class.getPackage()); return jar; } @Test @RunAsClient public void remoteBeanCheck() throws Exception { final SimpleCounter bean = (SimpleCounter) ctx.lookup("ejb:" + "" + "/" + MODULE_NAME + "/" + "" + "/" + StatefulCounterBean.class.getSimpleName() + "!" + SimpleCounter.class.getName() + "?stateful"); Assert.assertNotNull("Null bean proxy has been returned by context lookup", bean); for (int i = 0; i < 5; i++) { bean.increment(); } Assert.assertEquals(5, bean.getCount()); Assert.assertEquals(LoggingInterceptor.PREFIX + StatefulCounterBean.class.getSimpleName(), bean.getSimpleName()); } static class SetupTask extends AbstractServerInterceptorsSetupTask.SetupTask { @Override public List<InterceptorModule> getModules() { return Collections.singletonList(new InterceptorModule( LoggingInterceptor.class, "interceptor-module-remote", "module.xml", RemoteBeanTestCase.class.getResource("module.xml"), "server-side-interceptor-remote.jar" ) ); } } }
4,056
39.979798
121
java
null
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/interceptor/serverside/remote/StatefulCounterBean.java
/* * JBoss, Home of Professional Open Source. * Copyright 2019, 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.integration.ejb.interceptor.serverside.remote; import jakarta.ejb.Remote; import jakarta.ejb.Stateful; @Stateful @Remote(SimpleCounter.class) public class StatefulCounterBean implements SimpleCounter { private int count = 0; @Override public String getSimpleName() { return StatefulCounterBean.class.getSimpleName(); } @Override public int getCount() { return count; } @Override public void increment() { count++; } @Override public void decrement() { count--; } }
1,605
29.301887
72
java
null
wildfly-main/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/interceptor/serverside/remote/SimpleCounter.java
/* * JBoss, Home of Professional Open Source. * Copyright 2019, 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.integration.ejb.interceptor.serverside.remote; public interface SimpleCounter { String getSimpleName(); int getCount(); void increment(); void decrement(); }
1,228
35.147059
72
java