-
1. Re: Using separate persistence.xml for test and dev with JBoss Tools seam generated project
gjeudy Sep 29, 2008 11:01 PM (in response to barakka)If you use maven2 you have better control over test cycle versus regular compile/package cycle. However seam-gen is not integrated with maven2 so you would get none of seam-gens advantages if you decide to go this way.
I have found a workable solution with maven2 but I'm still not fully satisfied, in any case if you are interested I can give you more information on my solution.
-
2. Re: Using separate persistence.xml for test and dev with JBoss Tools seam generated project
ionixx Nov 8, 2008 9:08 PM (in response to barakka)Hello Riccardo,
do you have a solution for this situation in the meanwhile? I have the same problem and don´t know how to solve it. A maven2-based approach would be (in my eyes) a pain during development time. I want to use the eclipse-plugin for TestNG and not start mvn test each time.
Would be great to hear from you!
-
3. Re: Using separate persistence.xml for test and dev with JBoss Tools seam generated project
mcarrizo Jul 21, 2009 1:13 AM (in response to barakka)Riccardo:
I'm dealing with exactly the same problem. Did you find a good solution for this issue ?
Best regards !!
Maximiliano
-
4. Re: Using separate persistence.xml for test and dev with JBoss Tools seam generated project
barakka Jul 21, 2009 9:39 AM (in response to barakka)Hello everyone,
I'm sorry, but I have no solution for the problem. Since then, I've moved to maved, forgot completely about seam-gen, and resorted to writing a customized classloader for the jboss embedder in order to have it play nice with maven, eclipse and testNG.
Best,
Riccardo. -
5. Re: Using separate persistence.xml for test and dev with JBoss Tools seam generated project
john.genoese Jul 30, 2009 8:54 PM (in response to barakka)I'm using maven as well, and I just emulated what seam-gen did in order to solve the problem, because there wasn't any way I wanted to list each <class/> in persistence.xml.
My solution was
1. Copy ejb/target/classes to /tmp/classes, excluding META-INF (where the production persistence.xml lives).
`[EJB POM MAVEN CODE START]
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.3</version>
<executions>
<execution>
<id>process-ejb-classes</id>
<phase>process-test-classes</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>target/test-classes</outputDirectory>
<resources>
<resource>
<directory>target/classes</directory>
<filtering>false</filtering>
<excludes>
<exclude>META-INF/**</exclude>
</excludes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
[EJB POM MAVEN CODE END]`
2. Point maven-surefire-plugin <classesDirectory/> and <testClassesDirectory/> to 'target/test-classes'.
`[EJB POM MAVEN CODE START]
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<classesDirectory>target/test-classes</classesDirectory>
<testClassesDirectory>target/test-classes</testClassesDirectory>
<testSourceDirectory>src/test/java</testSourceDirectory>
<suiteXmlFiles>
<suiteXmlFile> src/test/testng.xml </suiteXmlFile>
</suiteXmlFiles>
<additionalClasspathElements>
<additionalClasspathElement>
src/test/bootstrap
</additionalClasspathElement>
</additionalClasspathElements>
<childDelegation>true</childDelegation>
<useSystemClassLoader>true</useSystemClassLoader>
<argLine>-Dsun.lang.ClassLoader.allowArraySyntax=true</argLine>
</configuration>
</plugin>
[EJB POM MAVEN CODE END]`
Additionally,I use seam-gen to generate proper bootstrap artifacts, then isolate said artifacts in a separate place.
In this way, Hibernate/JPA discovers my entities without my having to provide <class/> elements in persistence.xml, or write a classloader! However, anyone would admit that writing a classloader is much more interesting and fun than this stuff!
Grace and peace.
-- John -
6. Re: Using separate persistence.xml for test and dev with JBoss Tools seam generated project
hurzeler Jan 11, 2011 7:40 PM (in response to barakka)Can you ellaborate on your point:
"Additionally,I use seam-gen to generate proper bootstrap artifacts, then isolate said artifacts in a separate place."please?
What artifacts are required for Seam to recognize the entity classes?
Cheers
Bernie