Thank you for the Help, Jonathan.
I've finished this PR, thank you

On Mon, Jan 21, 2019 at 12:15 PM Otávio Gonçalves de Santana <
osant...@tomitribe.com> wrote:

> Here what I’ve tried:
>
>    - Use the @EBJ injection at the ActorBean
>    - Use the @Inject at the ActorBean
>    - Use the @Inject using bean.xml in each archive
>    - tried to use the CustomOrmXmlTest as the code below and it returns
>    java.io.FileNotFoundException: http://localhost:30001
>
> @RunWith(Arquillian.class)public class CustomOrmXmlEarTest {
>
>     @ArquillianResource
>     private URL url;
>
>     @Deployment
>     public static EnterpriseArchive createDeployment() {
>         final JavaArchive ejbJar = ShrinkWrap.create(JavaArchive.class, 
> CustomOrmXmlEarTest.class.getSimpleName() + ".jar")
>                 .addClasses(ActorBean.class, ActorDetails.class, 
> LocalActor.class, LocalActorHome.class,
>                         LocalMovie.class, LocalMovieHome.class, 
> MovieBean.class, MovieDetails.class,
>                         MoviesBusiness.class, MoviesBusinessBean.class, 
> MoviesBusinessHome.class,
>                         MoviesServlet.class)
>                 .addAsResource(new 
> ClassLoaderAsset("org/apache/openejb/arquillian/tests/cmp/sample/custom-orm.xml"),
>  "META-INF/custom-orm.xml")
>                 .addAsResource(new 
> ClassLoaderAsset("org/apache/openejb/arquillian/tests/cmp/sample/persistence.xml"),
>  "META-INF/persistence.xml")
>                 .addAsResource(new 
> ClassLoaderAsset("org/apache/openejb/arquillian/tests/cmp/sample/openejb-jar.xml"),
>  "META-INF/openejb-jar.xml")
>                 .addAsResource(new 
> ClassLoaderAsset("org/apache/openejb/arquillian/tests/cmp/sample/ejb-jar.xml"),
>  "META-INF/ejb-jar.xml")
>                 .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
>
>         final WebArchive war = ShrinkWrap.create(WebArchive.class, 
> CustomOrmXmlTest.class.getSimpleName() + ".war")
>
>                 .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml")
>                 .addAsWebInfResource(new 
> ClassLoaderAsset("org/apache/openejb/arquillian/tests/cmp/sample/web.xml"), 
> "web.xml");
>
>         final EnterpriseArchive archive = 
> ShrinkWrap.create(EnterpriseArchive.class, 
> CustomOrmXmlTest.class.getSimpleName() + ".ear")
>                 .addAsModule(ejbJar)
>                 .addAsModule(war)
>                 .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
>
>         System.out.println(ejbJar.toString(true));
>         System.out.println(war.toString(true));
>         System.out.println(archive.toString(true));
>         return archive;
>     }
>
>     @Test
>     public void checkCmpJpaEntityORMMappings() throws Exception {
>         final String output = IO.slurp(new URL(url.toExternalForm()));
>         System.out.println(output);
>
>         Assert.assertTrue(output.contains("TABLE_NAME: ACTOR, COLUMN_NAME: 
> ACTORID, DATA_TYPE: INTEGER, CHARACTER_MAXIMUM_LENGTH: null"));
>         Assert.assertTrue(output.contains("TABLE_NAME: ACTOR, COLUMN_NAME: 
> ACTOR_NAME, DATA_TYPE: CHARACTER VARYING, CHARACTER_MAXIMUM_LENGTH: 250"));
>         Assert.assertTrue(output.contains("TABLE_NAME: ACTOR_MOVIE, 
> COLUMN_NAME: ACTORS_ACTORID, DATA_TYPE: INTEGER, CHARACTER_MAXIMUM_LENGTH: 
> null"));
>         Assert.assertTrue(output.contains("TABLE_NAME: ACTOR_MOVIE, 
> COLUMN_NAME: MOVIES_MOVIEID, DATA_TYPE: INTEGER, CHARACTER_MAXIMUM_LENGTH: 
> null"));
>         Assert.assertTrue(output.contains("TABLE_NAME: MOVIE, COLUMN_NAME: 
> MOVIEID, DATA_TYPE: INTEGER, CHARACTER_MAXIMUM_LENGTH: null"));
>         Assert.assertTrue(output.contains("TABLE_NAME: MOVIE, COLUMN_NAME: 
> GENRE, DATA_TYPE: CHARACTER VARYING, CHARACTER_MAXIMUM_LENGTH: 255"));
>         Assert.assertTrue(output.contains("TABLE_NAME: MOVIE, COLUMN_NAME: 
> MOVIE_NAME, DATA_TYPE: CHARACTER VARYING, CHARACTER_MAXIMUM_LENGTH: 250"));
>
>         final String[] split = output.split("\r?\n");
>         Assert.assertEquals(7, split.length);
>
>     }
> }
>
> I appreciate any help with Arquillian
>
> On Fri, Jan 18, 2019 at 3:32 PM Otávio Gonçalves de Santana <
> osant...@tomitribe.com> wrote:
>
>> Hello, I have one question about this test.
>> Given this code, how can I inject a bean into Arquillian test?
>>
>>
>> package org.apache.openejb.arquillian.tests.cmp.sample;
>> import org.jboss.arquillian.container.test.api.Deployment;import 
>> org.jboss.arquillian.container.test.api.RunAsClient;import 
>> org.jboss.arquillian.junit.Arquillian;import 
>> org.jboss.arquillian.test.api.ArquillianResource;import 
>> org.jboss.shrinkwrap.api.ShrinkWrap;import 
>> org.jboss.shrinkwrap.api.asset.ClassLoaderAsset;import 
>> org.jboss.shrinkwrap.api.asset.EmptyAsset;import 
>> org.jboss.shrinkwrap.api.spec.EnterpriseArchive;import 
>> org.jboss.shrinkwrap.api.spec.JavaArchive;import 
>> org.jboss.shrinkwrap.api.spec.WebArchive;import org.junit.Assert;import 
>> org.junit.Test;import org.junit.runner.RunWith;
>> import javax.inject.Inject;import java.net.URL;
>> @RunWith(Arquillian.class)public class CustomOrmXmlEarTest {
>>
>>     @ArquillianResource
>>     private URL url;
>>
>>     @Inject
>>     private ActorBean actorBean;
>>
>>     @Deployment
>>     public static EnterpriseArchive createDeployment() {
>>         final JavaArchive ejbJar = ShrinkWrap.create(JavaArchive.class, 
>> CustomOrmXmlEarTest.class.getSimpleName() + ".jar")
>>                 .addClasses(ActorBean.class, ActorDetails.class, 
>> LocalActor.class, LocalActorHome.class,
>>                         LocalMovie.class, LocalMovieHome.class, 
>> MovieBean.class, MovieDetails.class,
>>                         MoviesBusiness.class, MoviesBusinessBean.class, 
>> MoviesBusinessHome.class,
>>                         MoviesServlet.class)
>>                 .addAsResource(new 
>> ClassLoaderAsset("org/apache/openejb/arquillian/tests/cmp/sample/custom-orm.xml"),
>>  "META-INF/custom-orm.xml")
>>                 .addAsResource(new 
>> ClassLoaderAsset("org/apache/openejb/arquillian/tests/cmp/sample/persistence.xml"),
>>  "META-INF/persistence.xml")
>>                 .addAsResource(new 
>> ClassLoaderAsset("org/apache/openejb/arquillian/tests/cmp/sample/openejb-jar.xml"),
>>  "META-INF/openejb-jar.xml")
>>                 .addAsResource(new 
>> ClassLoaderAsset("org/apache/openejb/arquillian/tests/cmp/sample/ejb-jar.xml"),
>>  "META-INF/ejb-jar.xml")
>>                 .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
>>
>>         final WebArchive war = ShrinkWrap.create(WebArchive.class, 
>> CustomOrmXmlEarTest.class.getSimpleName() + ".war")
>>
>>                 .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml")
>>                 .addAsWebInfResource(new 
>> ClassLoaderAsset("org/apache/openejb/arquillian/tests/cmp/sample/web.xml"), 
>> "web.xml");
>>
>>         final EnterpriseArchive archive = 
>> ShrinkWrap.create(EnterpriseArchive.class, 
>> CustomOrmXmlTest.class.getSimpleName() + ".ear")
>>                 .addAsModule(ejbJar)
>>                 .addAsModule(war)
>>                 .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
>>
>>         System.out.println(ejbJar.toString(true));
>>         System.out.println(war.toString(true));
>>         System.out.println(archive.toString(true));
>>         return archive;
>>     }
>>
>>     @Test
>>     public void checkCmpJpaEntityORMMappings() throws Exception {
>>         Assert.assertNotNull(actorBean);
>>
>>     }
>> }
>>
>>
>>
>> On Thu, Jan 17, 2019 at 5:02 PM Otávio Gonçalves de Santana <
>> osant...@tomitribe.com> wrote:
>>
>>> I created a solution, could you review it, please?
>>> I'm working on a test to it.
>>>
>>> On Thu, Jan 17, 2019 at 10:09 AM Otávio Gonçalves de Santana <
>>> osant...@tomitribe.com> wrote:
>>>
>>>>
>>>>
>>>> I put these codes at CmpJpaConversion:
>>>>
>>>>
>>>> URL resource = CmpJpaConversion.class.getResource(".");
>>>> Path path = Paths.get(resource.toURI());
>>>> Stream<Path> list = Files.list(path);
>>>> list.map(Path::getFileName).forEach(System.out::println);
>>>>
>>>>
>>>>
>>>> The output:
>>>>
>>>> SunConversion$SunColumnName.class
>>>> WsDeployer.class
>>>> EjbJarInfoBuilder.class
>>>> DeploymentModule$ID.class
>>>> ConfigurableClasspathArchive.class
>>>> DeploymentException.class
>>>> ReadDescriptors$UrlSource.class
>>>> DeploymentLoader$ExternalConfiguration.class
>>>> SunConversion$EntityData.class
>>>> RemoteServer$CleanUpThread.class
>>>> FinderFactory.class
>>>> GeneratedClientModules$Prune.class
>>>> WebappAggregatedArchive.class
>>>> ClearEmptyMappedName.class
>>>> OpenEjb2Conversion$EntityData.class
>>>> FinderFactory$ModuleLimitedFinder$FieldPredicate.class
>>>> DeploymentLoader$2.class
>>>> Deployment.class
>>>> AnnotationDeployer$ProcessAnnotatedBeans$AccessTimeoutHandler.class
>>>> AppInfoBuilder$1.class
>>>> EjbModule.class
>>>> OpenEJBDeploymentManager$DeploymentStatusImpl.class
>>>> ReportValidationResults$Level.class
>>>> ValidationRule.class
>>>> DebuggableVmHackery.class
>>>> DeploymentsResolver$DeploymentsConfigurationException.class
>>>> ConvertJMSConnectionFactoryDefinitions.class
>>>> AnnotationDeployer$1.class
>>>> TldScanner$2.class
>>>> OpenEJBDeploymentManager$TargetImpl.class
>>>> ServiceUtils.class
>>>> ValidationFailure.class
>>>> CompManagedBean$1.class
>>>> AnnotationDeployer$ProcessAnnotatedBeans$AnnotationHandler.class
>>>> AnnotationDeployer$3.class
>>>> FinderFactory$ModuleLimitedFinder$AnnotatedClassPredicate.class
>>>> AutoDeployer$1.class
>>>> AppValidator.class
>>>> AppInfoBuilder.class
>>>> ValidationWarning.class
>>>> ContainerUtils.class
>>>> Deploy.class
>>>> ConvertDataSourceDefinitions.class
>>>> OpenEJBDeploymentManager$ProgressObjectImpl.class
>>>> BeanProperties.class
>>>> FinderFactory$ModuleLimitedFinder.class
>>>> FinderFactory$OpenEJBAnnotationFinder.class
>>>> Cipher.class
>>>> VmDeploymentManager.class
>>>> WsModule.class
>>>> AnnotationDeployer$ProcessAnnotatedBeans$TransactionAttributeHandler.class
>>>> DeploymentsResolver$1.class
>>>> DeploymentLoader$1.class
>>>> AnnotationDeployer$ProvidedJAXRSApplication.class
>>>> Undeploy.class
>>>> OpenEJBDeploymentManager.class
>>>> PojoConfiguration.class
>>>> ScanConstants.class
>>>> PersistenceContextAnnFactory$PersistenceContextReader.class
>>>> NewLoaderLogic$3.class
>>>> DeploymentLoader.class
>>>> BuiltInEnvironmentEntries.class
>>>> MBeanDeployer.class
>>>> DeploymentModule.class
>>>> JndiEncInfoBuilder$1.class
>>>> ValidationException.class
>>>> CompManagedBean.class
>>>> Module.class
>>>> ConfigurationDeployer.class
>>>> OpenEJBDeploymentManager$TargetModuleIDImpl.class
>>>> VmDeploymentFactory.class
>>>> PersistenceContextAnnFactory$PersistenceContextVisitor$1.class
>>>> ConfigurationFactory$Chain.class
>>>> DeploymentsResolver$ClasspathSearcher.class
>>>> ConfigurableClasspathArchive$FakeModule.class
>>>> OutputGeneratedDescriptors.class
>>>> ContextRef.class
>>>> Undeploy$DeploymentTerminatedException.class
>>>> ActivationConfigPropertyOverride$MdbContainerDetails.class
>>>> RESTModule.class
>>>> QuickJarsTxtParser.class
>>>> Service.class
>>>> JPAPropertyConverter.class
>>>> MappedNameBuilder.class
>>>> PersistenceContextAnnFactory$PersistenceContextVisitor.class
>>>> AutoDeployer.class
>>>> NewLoaderLogic.class
>>>> FinderFactory$DebugArchive.class
>>>> AnnotationDeployer$2.class
>>>> SunConversion.class
>>>> Deploy$DeploymentTerminatedException.class
>>>> AnnotationDeployer.class
>>>> ConvertJMSDestinationDefinitions.class
>>>> NoSuchProviderException.class
>>>> LegacyProcessor.class
>>>> BeanTypes.class
>>>> ReadDescriptors$1.class
>>>> GeneratedClientModules.class
>>>> ConfigUtils.class
>>>> EmptyEjbJar.class
>>>> provider
>>>> ServiceUtils$ProviderInfo.class
>>>> AnnotationDeployer$FolderDDMapper.class
>>>> event
>>>> CompManagedBean$NoExtendedKeyedCollection$NoExtendedMap.class
>>>> FinderFactory$ModuleLimitedFinder$AnnotatedFieldPredicate.class
>>>> ValidationError.class
>>>> ScanUtil.class
>>>> NewLoaderLogic$OptimizedExclusionFilter.class
>>>> VmDeploymentManager$TargetModuleIDImpl.class
>>>> NameFiltering.class
>>>> PersistenceContextAnn.class
>>>> ApplicationComposerDeployer.class
>>>> SystemProperty.class
>>>> AnnotationDeployer$ProcessAnnotatedBeans$LockHandler.class
>>>> AnnotationDeployer$4.class
>>>> ReadDescriptors$2.class
>>>> NewLoaderLogic$1.class
>>>> SystemPropertiesOverride.class
>>>> AppModule.class
>>>> ModuleProperties.class
>>>> ConfigurationFactory.class
>>>> VmDeploymentManager$DeploymentStatusImpl.class
>>>> TldScanner.class
>>>> RequireDescriptors.class
>>>> AnnotationDeployer$ProcessAnnotatedBeans.class
>>>> FinderFactory$1.class
>>>> RemoteServer.class
>>>> EffectiveTomEEXml.class
>>>> AutoConfig$1.class
>>>> GeneratedClientModules$Add.class
>>>> LinkBuiltInTypes.class
>>>> SystemApps.class
>>>> AutoDeployer$DirectoryInfo.class
>>>> GeronimoMappedName.class
>>>> AppInfoBuilder$2.class
>>>> PersistenceContextAnnFactory$DirectPersistenceContext.class
>>>> ConfigurationFactory$1.class
>>>> typed
>>>> ActivationConfigPropertyOverride.class
>>>> AnnotationDeployer$FieldMember.class
>>>> ConfigurationFactory$ProxyBeanClassUpdate.class
>>>> AppInfoBuilder$PersistenceProviderProperties.class
>>>> PersistenceContextAnnFactory$1.class
>>>> ConnectorModule.class
>>>> RemoteServer$1.class
>>>> WebModule.class
>>>> ReadDescriptors$3.class
>>>> ServiceEndpoint.class
>>>> ApplicationProperties.class
>>>> MergeWebappJndiContext.class
>>>> FinderFactory$DoLoadClassesArchive.class
>>>> SunConversion$TokenType.class
>>>> AnnotationDeployer$ProcessAnnotatedBeans$ConcurrentMethodHandler.class
>>>> AutoDeployer$FileInfo.class
>>>> FinderFactory$ModuleLimitedFinder$MethodPredicate.class
>>>> PersistenceContextAnnFactory$AsmPersistenceContext.class
>>>> AnnotationDeployer$FilledMember.class
>>>> AnnotationDeployer$Member.class
>>>> UnsupportedModuleTypeException.class
>>>> DynamicDeployer.class
>>>> JndiEncInfoBuilder$SimpleRef.class
>>>> FinderFactory$ModuleLimitedFinder$ConstructorPredicate.class
>>>> PersistenceContextAnnFactory.class
>>>> AnnotationDeployer$MethodMember.class
>>>> WebappAggregatedArchive$ScanXmlSaverFilter.class
>>>> ResourcesModule.class
>>>> CompManagedBean$NoExtendedKeyedCollection.class
>>>> ConfigurationFactory$TopicOrQueueDefaults.class
>>>> CmpJpaConversion.class
>>>> AnnotationDeployer$DiscoverAnnotatedBeans.class
>>>> JndiEncInfoBuilder$Ref.class
>>>> NewLoaderLogic$2.class
>>>> TldScanner$1.class
>>>> Messages.properties
>>>> ReadDescriptors$Source.class
>>>> VmDeploymentManager$ProgressObjectImpl.class
>>>> InitEjbDeployments.class
>>>> PersistenceUnitLinkResolver.class
>>>> DeploymentsResolver.class
>>>> DeploymentFilterable.class
>>>> AppContextConfigDeployer.class
>>>> AnnotationDeployer$ProcessAnnotatedBeans$BusinessInterfaces.class
>>>> ReadDescriptors.class
>>>> rules
>>>> SystemAppInfo.class
>>>> AdditionalBeanDiscoverer.class
>>>> JPAPropertyConverter$Pair.class
>>>> BaseConvertDefinitions.class
>>>> ReadDescriptors$StringSource.class
>>>> OpenEjb2Conversion.class
>>>> FinderFactory$ModuleLimitedFinder$Predicate.class
>>>> CleanEnvEntries.class
>>>> ValidationFailedException.class
>>>> FinderFactory$ModuleLimitedFinder$AnnotatedMethodPredicate.class
>>>> ConfigurationFactory$DefaultService.class
>>>> RemoveWebServices.class
>>>> AutoConfig$AppResources.class
>>>> UnknownModuleTypeException.class
>>>> ScanUtil$ScanHandler.class
>>>> AutoConfig.class
>>>> JndiEncInfoBuilder.class
>>>> FinderFactory$ModuleLimitedFinder$ClassPredicate.class
>>>> ValidationContext.class
>>>> sys
>>>> QuickServerXmlParser.class
>>>> ValidateModules.class
>>>> ApplyOpenejbJar.class
>>>> ValidationResults.class
>>>> ClientModule.class
>>>> WlsConversion.class
>>>> VmDeploymentManager$TargetImpl.class
>>>> PersistenceModule.class
>>>> EnvEntriesPropertiesDeployer.class
>>>> ReportValidationResults.class
>>>>
>>>>
>>>>
>>>> On Thu, Jan 17, 2019 at 9:50 AM Jonathan Gallimore <
>>>> jonathan.gallim...@gmail.com> wrote:
>>>>
>>>>> I'd say we should try the same jar that persistence.xml is in. That
>>>>> said, I
>>>>> thought it was loaded via the classloader, so what's on the classpath
>>>>> when
>>>>> we try and read this file?
>>>>>
>>>>> Jon
>>>>>
>>>>> On Thu, Jan 17, 2019 at 11:44 AM Otávio Gonçalves de Santana <
>>>>> osant...@tomitribe.com> wrote:
>>>>>
>>>>> > Given an EAR package that has an EJB jar with a persistence.xml
>>>>> within a
>>>>> > mapping-file element.
>>>>> > The CmpJpaConversion
>>>>> > <
>>>>> >
>>>>> https://github.com/apache/tomee/blob/master/container/openejb-core/src/main/java/org/apache/openejb/config/CmpJpaConversion.java#L109L128
>>>>> > >
>>>>> > does not find this reference because when it reads, this file
>>>>> reference
>>>>> > isn’t in the jar anymore but in the EAR location.
>>>>> > It seems that the DeploymentLoader
>>>>> > <
>>>>> >
>>>>> https://github.com/apache/tomee/blob/master/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentLoader.java
>>>>> > >
>>>>> > goes to all jar files to find the persistence XML. However, it
>>>>> doesn’t load
>>>>> > the others resources files.
>>>>> >
>>>>> > IMHO: that does not look an easy solution, because it raises some
>>>>> > decisions:
>>>>> >
>>>>> >    - What happens if have one or more jar file with the same file
>>>>> name?
>>>>> >    - Should we have priorities?
>>>>> >    - Should we read the mapping-file just from the specific jar file?
>>>>> >
>>>>> > Ref: https://github.com/apache/tomee/pull/374
>>>>> >
>>>>>
>>>>

Reply via email to