Skip to content

Commit

Permalink
Use BOMs for dependency versions and switch back to older Maven resol…
Browse files Browse the repository at this point in the history
…ver for Arquillian
  • Loading branch information
pmuir committed Dec 23, 2012
1 parent be0ce9b commit 5888330
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 31 deletions.
10 changes: 5 additions & 5 deletions kitchensink-deltaspike/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ The DeltaSpike project (http://incubator.apache.org/deltaspike) consists of a nu
Changes compared to the original `kitchensink` quickstart
---------------------------------------------------------

* The org.jboss.as.quickstarts.kitchensink.service.MemberRegistration class is annotated with the DeltaSpike @Transactional annotation rather than @javax.ejb.Stateless.
* The org.jboss.as.quickstarts.kitchensink.util.Resources class has been modified to handle an application managed entity manager.
* The transaction type in the persistence unit configuration file (src/main/resources/META-INF/persistence.xml) has been changed to "RESOURCE_LOCAL".
* The DeltaSpike TransactionalInterceptor has been added to the beans.xml CDI configuration file (src/main/webapp/WEB-INF/beans.xml).
* The `org.jboss.as.quickstarts.kitchensink.service.MemberRegistration` class is annotated with the DeltaSpike `@Transactional` annotation rather than `@javax.ejb.Stateless`.
* The `org.jboss.as.quickstarts.kitchensink.util.Resources` class has been modified to handle an application managed entity manager.
* The transaction type in the persistence unit configuration file (`src/main/resources/META-INF/persistence.xml`) has been changed to `RESOURCE_LOCAL`.
* The DeltaSpike `TransactionalInterceptor` has been added to the beans.xml CDI configuration file (`src/main/webapp/WEB-INF/beans.xml`).
* The DeltaSpike dependencies have been added to the project POM.
* The ShrinkWrap shrinkwrap-resolver-bom dependency has been added to the project POM, to be able to build the archive for the Arquillian test.
* The ShrinkWrap `shrinkwrap-resolver-bom` dependency has been added to the project POM, to be able to build the archive for the Arquillian test.

System requirements
-------------------
Expand Down
23 changes: 9 additions & 14 deletions kitchensink-deltaspike/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,13 @@
<version.org.jboss.as.plugins.maven.plugin>7.3.Final</version.org.jboss.as.plugins.maven.plugin>
<!-- Define the version of the JBoss BOMs we want to import. The
JBoss BOMs specify tested stacks. -->
<version.org.jboss.bom>1.0.1.Final</version.org.jboss.bom>
<version.org.jboss.bom>1.0.4.CR6</version.org.jboss.bom>
<!-- Alternatively, comment out the above line, and un-comment the
line below to use version 1.0.0.Final-redhat-1 which is a release certified
to work with JBoss EAP 6. It requires you have access to the JBoss EAP 6
maven repository. -->
<!-- <version.org.jboss.bom>1.0.0.Final-redhat-1</version.org.jboss.bom>> -->
<version.shrinkwrap.resolver>2.0.0-alpha-5</version.shrinkwrap.resolver>

<!-- DeltaSpike dependency version -->
<version.deltaspike>0.3-incubating</version.deltaspike>
<!-- other plugin versions -->
<version.compiler.plugin>2.3.1</version.compiler.plugin>
<version.surefire.plugin>2.4.3</version.surefire.plugin>
Expand All @@ -72,22 +69,22 @@
stack you can read this as the JBoss stack of the Java EE 6 APIs, with extras
from the Hibernate family of projects) -->
<dependency>
<groupId>org.jboss.shrinkwrap.resolver</groupId>
<artifactId>shrinkwrap-resolver-bom</artifactId>
<version>${version.shrinkwrap.resolver}</version>
<scope>import</scope>
<groupId>org.jboss.bom</groupId>
<artifactId>jboss-javaee-6.0-with-tools</artifactId>
<version>${version.org.jboss.bom}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.jboss.bom</groupId>
<artifactId>jboss-javaee-6.0-with-tools</artifactId>
<artifactId>jboss-javaee-6.0-with-hibernate</artifactId>
<version>${version.org.jboss.bom}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.jboss.bom</groupId>
<artifactId>jboss-javaee-6.0-with-hibernate</artifactId>
<artifactId>jboss-javaee-6.0-with-deltaspike</artifactId>
<version>${version.org.jboss.bom}</version>
<type>pom</type>
<scope>import</scope>
Expand Down Expand Up @@ -168,25 +165,23 @@
<dependency>
<groupId>org.apache.deltaspike.modules</groupId>
<artifactId>deltaspike-jpa-module-api</artifactId>
<version>${version.deltaspike}</version>
</dependency>

<dependency>
<groupId>org.apache.deltaspike.modules</groupId>
<artifactId>deltaspike-jpa-module-impl</artifactId>
<version>${version.deltaspike}</version>
<scope>runtime</scope>
</dependency>

<dependency>
<groupId>org.apache.deltaspike.core</groupId>
<artifactId>deltaspike-core-api</artifactId>
<version>${version.deltaspike}</version>
</dependency>

<dependency>
<groupId>org.apache.deltaspike.core</groupId>
<artifactId>deltaspike-core-impl</artifactId>
<version>${version.deltaspike}</version>
<scope>runtime</scope>
</dependency>


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@
import javax.persistence.criteria.Root;
import java.util.List;

import org.apache.deltaspike.jpa.api.transaction.Transactional;
import org.jboss.as.quickstarts.kitchensink.model.Member;

@ApplicationScoped
@Transactional
public class MemberRepository {

@Inject
Expand Down
9 changes: 5 additions & 4 deletions kitchensink-deltaspike/src/main/webapp/WEB-INF/beans.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@
We're declaring the schema to save you time if you do have to configure
this in the future -->
<beans xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/beans_1_0.xsd">
<interceptors>
<class>org.apache.deltaspike.jpa.impl.transaction.TransactionalInterceptor</class>
</interceptors>
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/beans_1_0.xsd">
<interceptors>
<class>org.apache.deltaspike.jpa.impl.transaction.TransactionalInterceptor</class>
</interceptors>
</beans>
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@

import static org.junit.Assert.assertNotNull;

import java.io.File;
import java.util.Arrays;
import java.util.logging.Logger;

import javax.inject.Inject;
Expand All @@ -33,7 +31,8 @@
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.asset.EmptyAsset;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.jboss.shrinkwrap.resolver.api.maven.Maven;
import org.jboss.shrinkwrap.resolver.api.DependencyResolvers;
import org.jboss.shrinkwrap.resolver.api.maven.MavenDependencyResolver;
import org.junit.Test;
import org.junit.runner.RunWith;

Expand All @@ -46,16 +45,20 @@ public static Archive<?> createTestArchive() {
"org.apache.deltaspike.modules:deltaspike-jpa-module-impl",
"org.apache.deltaspike.core:deltaspike-core-api",
"org.apache.deltaspike.core:deltaspike-core-impl" };
File[] libs = Maven.resolver().loadPomFromFile("pom.xml")
.resolve(Arrays.asList(deps)).withTransitivity().asFile();

MavenDependencyResolver resolver = DependencyResolvers
.use(MavenDependencyResolver.class)
.loadMetadataFromPom("pom.xml");

return ShrinkWrap
.create(WebArchive.class, "test.war")
.addClasses(Member.class, MemberRegistration.class,
Resources.class)
.addAsResource("META-INF/test-persistence.xml",
"META-INF/persistence.xml")
.addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml")
.addAsLibraries(libs)
.addAsLibraries(
resolver.artifacts(deps).resolveAsFiles())
// Deploy our test datasource
.addAsWebInfResource("test-ds.xml");
}
Expand All @@ -74,8 +77,7 @@ public void testRegister() throws Exception {
newMember.setPhoneNumber("2125551234");
memberRegistration.register(newMember);
assertNotNull(newMember.getId());
log.info(newMember.getName() + " was persisted with id "
+ newMember.getId());
log.info(newMember.getName() + " was persisted with id " + newMember.getId());
}

}

0 comments on commit 5888330

Please sign in to comment.