From 9dc17848a510a4d5ddcb2080463c754c0ead2a13 Mon Sep 17 00:00:00 2001
From: slavisa-baeldung
Date: Tue, 23 Aug 2016 23:46:27 +0200
Subject: [PATCH] BAEL-150 - deltaspike, minor changes
---
deltaspike/pom.xml | 56 +------------------
.../baeldung/data/EntityManagerProducer.java | 12 ++--
.../data/SecondaryEntityManagerProducer.java | 12 ++--
.../java/baeldung/rest/JaxRsActivator.java | 2 +-
.../rest/MemberResourceRESTService.java | 8 +--
.../main/java/baeldung/util/Resources.java | 4 +-
.../main/resources/META-INF/persistence.xml | 1 -
deltaspike/src/test/resources/arquillian.xml | 6 +-
8 files changed, 19 insertions(+), 82 deletions(-)
diff --git a/deltaspike/pom.xml b/deltaspike/pom.xml
index f1becef0da..22cf8f935c 100644
--- a/deltaspike/pom.xml
+++ b/deltaspike/pom.xml
@@ -1,22 +1,6 @@
-
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
4.0.0
com.baeldung
deltaspike
@@ -313,43 +297,5 @@
-
-
-
-
- arq-wildfly-remote
-
-
- org.wildfly
- wildfly-arquillian-container-remote
- test
-
-
-
-
-
-
-
-
-
- openshift
-
-
-
- maven-war-plugin
- ${version.war.plugin}
-
- deployments
- ROOT
-
-
-
-
-
-
diff --git a/deltaspike/src/main/java/baeldung/data/EntityManagerProducer.java b/deltaspike/src/main/java/baeldung/data/EntityManagerProducer.java
index 9390be7fd3..9189dbba74 100644
--- a/deltaspike/src/main/java/baeldung/data/EntityManagerProducer.java
+++ b/deltaspike/src/main/java/baeldung/data/EntityManagerProducer.java
@@ -10,23 +10,19 @@ import javax.persistence.EntityManagerFactory;
import javax.persistence.PersistenceUnit;
@ApplicationScoped
-public class EntityManagerProducer
-{
+public class EntityManagerProducer {
@PersistenceUnit(unitName = "primary")
private EntityManagerFactory entityManagerFactory;
@Produces
@Default
@RequestScoped
- public EntityManager create()
- {
+ public EntityManager create() {
return this.entityManagerFactory.createEntityManager();
}
- public void dispose(@Disposes @Default EntityManager entityManager)
- {
- if (entityManager.isOpen())
- {
+ public void dispose(@Disposes @Default EntityManager entityManager) {
+ if (entityManager.isOpen()) {
entityManager.close();
}
}
diff --git a/deltaspike/src/main/java/baeldung/data/SecondaryEntityManagerProducer.java b/deltaspike/src/main/java/baeldung/data/SecondaryEntityManagerProducer.java
index 28323a7725..41d30d9018 100644
--- a/deltaspike/src/main/java/baeldung/data/SecondaryEntityManagerProducer.java
+++ b/deltaspike/src/main/java/baeldung/data/SecondaryEntityManagerProducer.java
@@ -10,8 +10,7 @@ import javax.persistence.EntityManagerFactory;
import javax.persistence.PersistenceUnit;
@ApplicationScoped
-public class SecondaryEntityManagerProducer
-{
+public class SecondaryEntityManagerProducer {
@PersistenceUnit(unitName = "secondary")
private EntityManagerFactory entityManagerFactory;
@@ -19,15 +18,12 @@ public class SecondaryEntityManagerProducer
@Default
@RequestScoped
@SecondaryPersistenceUnit
- public EntityManager create()
- {
+ public EntityManager create() {
return this.entityManagerFactory.createEntityManager();
}
- public void dispose(@Disposes @Default EntityManager entityManager)
- {
- if (entityManager.isOpen())
- {
+ public void dispose(@Disposes @Default EntityManager entityManager) {
+ if (entityManager.isOpen()) {
entityManager.close();
}
}
diff --git a/deltaspike/src/main/java/baeldung/rest/JaxRsActivator.java b/deltaspike/src/main/java/baeldung/rest/JaxRsActivator.java
index d2fb4f7d88..9357ae0ea6 100644
--- a/deltaspike/src/main/java/baeldung/rest/JaxRsActivator.java
+++ b/deltaspike/src/main/java/baeldung/rest/JaxRsActivator.java
@@ -22,7 +22,7 @@ import javax.ws.rs.core.Application;
/**
* A class extending {@link Application} and annotated with @ApplicationPath is the Java EE 7 "no XML" approach to activating
* JAX-RS.
- *
+ *
*
* Resources are served relative to the servlet path specified in the {@link ApplicationPath} annotation.
*
diff --git a/deltaspike/src/main/java/baeldung/rest/MemberResourceRESTService.java b/deltaspike/src/main/java/baeldung/rest/MemberResourceRESTService.java
index 678fba549c..5a09e45591 100644
--- a/deltaspike/src/main/java/baeldung/rest/MemberResourceRESTService.java
+++ b/deltaspike/src/main/java/baeldung/rest/MemberResourceRESTService.java
@@ -128,10 +128,10 @@ public class MemberResourceRESTService {
* If the error is caused because an existing member with the same email is registered it throws a regular validation
* exception so that it can be interpreted separately.
*
- *
+ *
* @param member Member to be validated
* @throws ConstraintViolationException If Bean Validation errors exist
- * @throws ValidationException If member with the same email already exists
+ * @throws ValidationException If member with the same email already exists
*/
private void validateMember(Member member) throws ConstraintViolationException, ValidationException {
// Create a bean validator and check for issues.
@@ -150,7 +150,7 @@ public class MemberResourceRESTService {
/**
* Creates a JAX-RS "Bad Request" response including a map of all violation fields, and their message. This can then be used
* by clients to show violations.
- *
+ *
* @param violations A set of violations that needs to be reported
* @return JAX-RS response containing all violations
*/
@@ -169,7 +169,7 @@ public class MemberResourceRESTService {
/**
* Checks if a member with the same email address is already registered. This is the only way to easily capture the
* "@UniqueConstraint(columnNames = "email")" constraint from the Member class.
- *
+ *
* @param email The email to check
* @return True if the email already exists, and false otherwise
*/
diff --git a/deltaspike/src/main/java/baeldung/util/Resources.java b/deltaspike/src/main/java/baeldung/util/Resources.java
index 99ebdf37ad..2cc1f235d7 100644
--- a/deltaspike/src/main/java/baeldung/util/Resources.java
+++ b/deltaspike/src/main/java/baeldung/util/Resources.java
@@ -27,11 +27,11 @@ import javax.persistence.PersistenceContext;
/**
* This class uses CDI to alias Java EE resources, such as the persistence context, to CDI beans
- *
+ *
*
* Example injection on a managed bean field:
*
- *
+ *
*
* @Inject
* private EntityManager em;
diff --git a/deltaspike/src/main/resources/META-INF/persistence.xml b/deltaspike/src/main/resources/META-INF/persistence.xml
index 8909a633ab..b68c2c1bb1 100644
--- a/deltaspike/src/main/resources/META-INF/persistence.xml
+++ b/deltaspike/src/main/resources/META-INF/persistence.xml
@@ -18,5 +18,4 @@
-
diff --git a/deltaspike/src/test/resources/arquillian.xml b/deltaspike/src/test/resources/arquillian.xml
index 81c7b78aca..14f9e53bbd 100644
--- a/deltaspike/src/test/resources/arquillian.xml
+++ b/deltaspike/src/test/resources/arquillian.xml
@@ -31,9 +31,9 @@
-
-
-
+
+ target\wildfly-run\wildfly-10.0.0.Final
+