rzo1 commented on PR #1327:
URL: https://github.com/apache/tomee/pull/1327#issuecomment-2251162411

   Thanks for the PR. 
   
   I think, that it would benefit from a test case because it won't work for 
more than one level of nested classes at the moment, i.e. something like
   
   ```java
   package org.apache.openejb.core.asynch;
   
   import jakarta.ejb.AsyncResult;
   import jakarta.ejb.Asynchronous;
   import jakarta.ejb.TransactionAttribute;
   import jakarta.ejb.TransactionAttributeType;
   import org.apache.openejb.OpenEJB;
   import org.apache.openejb.assembler.classic.AppInfo;
   import org.apache.openejb.assembler.classic.Assembler;
   import org.apache.openejb.assembler.classic.SecurityServiceInfo;
   import org.apache.openejb.assembler.classic.TransactionServiceInfo;
   import org.apache.openejb.config.AppModule;
   import org.apache.openejb.config.ConfigurationFactory;
   import org.apache.openejb.config.EjbModule;
   import org.apache.openejb.core.LocalInitialContextFactory;
   import org.apache.openejb.jee.EjbJar;
   import org.apache.openejb.jee.SingletonBean;
   import org.junit.After;
   import org.junit.AfterClass;
   import org.junit.Before;
   import org.junit.Test;
   
   import javax.naming.InitialContext;
   import java.util.concurrent.Future;
   
   import static org.junit.Assert.assertEquals;
   import static org.junit.Assert.assertNotNull;
   
   public class TomEE2934Test {
   
       private Assembler assembler;
   
       private ConfigurationFactory config;
   
       @Before
       public void beforeTest() throws Exception {
           System.setProperty(javax.naming.Context.INITIAL_CONTEXT_FACTORY, 
LocalInitialContextFactory.class.getName());
           config = new ConfigurationFactory();
           assembler = new Assembler();
           
assembler.createTransactionManager(config.configureService(TransactionServiceInfo.class));
           
assembler.createSecurityService(config.configureService(SecurityServiceInfo.class));
       }
   
       @After
       public void afterTest() throws Exception {
           assembler.destroy();
       }
   
       @AfterClass
       public static void afterClass() throws Exception {
           OpenEJB.destroy();
       }
   
       @Test
       public void test() throws Exception {
           final AppModule app = new 
AppModule(this.getClass().getClassLoader(), "test");
           final EjbJar ejbJar = new EjbJar();
           ejbJar.addEnterpriseBean(new SingletonBean(RepXYZ.class));
           app.getEjbModules().add(new EjbModule(ejbJar));
   
           final AppInfo appInfo = config.configureApplication(app);
           assembler.createApplication(appInfo);
   
           final InitialContext context = new InitialContext();
           final TomEE2934Test.RepXYZ test = (TomEE2934Test.RepXYZ) 
context.lookup("RepXYZLocal");
           assertNotNull(test);
   
           RepXYZ.RepTaskRequest r = new RepXYZ.RepTaskRequest();
           final Future<RepXYZ.RepTaskRequest> future = 
test.processAsynchronously(r);
           assertNotNull(future);
           assertEquals("test_success", future.get().test);
   
       }
   
       public static class RepXYZ {
           @Asynchronous
           @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
           public Future<RepTaskRequest> processAsynchronously(RepTaskRequest 
r) {
               r.test = "test_success";
               return new AsyncResult<>(r);
           }
   
           public static class RepTaskRequest{
               public String test;
           }
       }
   }
   ```
   
   Actually, this might reveal some other places with similar issues as well 
(looking at 
`rg.apache.openejb.assembler.classic.MethodInfoUtil.toMethod(MethodInfoUtil.java:64)`
 for example.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@tomee.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to