Skip to content

Commit 9dc1784

Browse files
BAEL-150 - deltaspike, minor changes
1 parent ca84ed7 commit 9dc1784

8 files changed

Lines changed: 19 additions & 82 deletions

File tree

‎deltaspike/pom.xml‎

Lines changed: 1 addition & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<!--
3-
JBoss, Home of Professional Open Source
4-
Copyright 2013, Red Hat, Inc. and/or its affiliates, and individual
5-
contributors by the @authors tag. See the copyright.txt in the
6-
distribution for a full listing of individual contributors.
7-
8-
Licensed under the Apache License, Version 2.0 (the "License");
9-
you may not use this file except in compliance with the License.
10-
You may obtain a copy of the License at
11-
http://www.apache.org/licenses/LICENSE-2.0
12-
Unless required by applicable law or agreed to in writing, software
13-
distributed under the License is distributed on an "AS IS" BASIS,
14-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15-
See the License for the specific language governing permissions and
16-
limitations under the License.
17-
-->
182
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
19-
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
204
<modelVersion>4.0.0</modelVersion>
215
<groupId>com.baeldung</groupId>
226
<artifactId>deltaspike</artifactId>
@@ -313,43 +297,5 @@
313297
</dependency>
314298
</dependencies>
315299
</profile>
316-
317-
<profile>
318-
<!-- An optional Arquillian testing profile that executes tests
319-
in a remote WildFly instance -->
320-
<!-- Run with: mvn clean test -Parq-wildfly-remote -->
321-
<id>arq-wildfly-remote</id>
322-
<dependencies>
323-
<dependency>
324-
<groupId>org.wildfly</groupId>
325-
<artifactId>wildfly-arquillian-container-remote</artifactId>
326-
<scope>test</scope>
327-
</dependency>
328-
</dependencies>
329-
</profile>
330-
331-
<profile>
332-
<!-- When built in OpenShift the 'openshift' profile will be used when
333-
invoking mvn. -->
334-
<!-- Use this profile for any OpenShift specific customization your app
335-
will need. -->
336-
<!-- By default that is to put the resulting archive into the 'deployments'
337-
folder. -->
338-
<!-- http://maven.apache.org/guides/mini/guide-building-for-different-environments.html -->
339-
<id>openshift</id>
340-
<build>
341-
<plugins>
342-
<plugin>
343-
<artifactId>maven-war-plugin</artifactId>
344-
<version>${version.war.plugin}</version>
345-
<configuration>
346-
<outputDirectory>deployments</outputDirectory>
347-
<warName>ROOT</warName>
348-
</configuration>
349-
</plugin>
350-
</plugins>
351-
</build>
352-
</profile>
353-
354300
</profiles>
355301
</project>

‎deltaspike/src/main/java/baeldung/data/EntityManagerProducer.java‎

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,19 @@
1010
import javax.persistence.PersistenceUnit;
1111

1212
@ApplicationScoped
13-
public class EntityManagerProducer
14-
{
13+
public class EntityManagerProducer {
1514
@PersistenceUnit(unitName = "primary")
1615
private EntityManagerFactory entityManagerFactory;
1716

1817
@Produces
1918
@Default
2019
@RequestScoped
21-
public EntityManager create()
22-
{
20+
public EntityManager create() {
2321
return this.entityManagerFactory.createEntityManager();
2422
}
2523

26-
public void dispose(@Disposes @Default EntityManager entityManager)
27-
{
28-
if (entityManager.isOpen())
29-
{
24+
public void dispose(@Disposes @Default EntityManager entityManager) {
25+
if (entityManager.isOpen()) {
3026
entityManager.close();
3127
}
3228
}

‎deltaspike/src/main/java/baeldung/data/SecondaryEntityManagerProducer.java‎

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,24 +10,20 @@
1010
import javax.persistence.PersistenceUnit;
1111

1212
@ApplicationScoped
13-
public class SecondaryEntityManagerProducer
14-
{
13+
public class SecondaryEntityManagerProducer {
1514
@PersistenceUnit(unitName = "secondary")
1615
private EntityManagerFactory entityManagerFactory;
1716

1817
@Produces
1918
@Default
2019
@RequestScoped
2120
@SecondaryPersistenceUnit
22-
public EntityManager create()
23-
{
21+
public EntityManager create() {
2422
return this.entityManagerFactory.createEntityManager();
2523
}
2624

27-
public void dispose(@Disposes @Default EntityManager entityManager)
28-
{
29-
if (entityManager.isOpen())
30-
{
25+
public void dispose(@Disposes @Default EntityManager entityManager) {
26+
if (entityManager.isOpen()) {
3127
entityManager.close();
3228
}
3329
}

‎deltaspike/src/main/java/baeldung/rest/JaxRsActivator.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
/**
2323
* A class extending {@link Application} and annotated with @ApplicationPath is the Java EE 7 "no XML" approach to activating
2424
* JAX-RS.
25-
*
25+
* <p>
2626
* <p>
2727
* Resources are served relative to the servlet path specified in the {@link ApplicationPath} annotation.
2828
* </p>

‎deltaspike/src/main/java/baeldung/rest/MemberResourceRESTService.java‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,10 @@ public Response createMember(Member member) {
128128
* If the error is caused because an existing member with the same email is registered it throws a regular validation
129129
* exception so that it can be interpreted separately.
130130
* </p>
131-
*
131+
*
132132
* @param member Member to be validated
133133
* @throws ConstraintViolationException If Bean Validation errors exist
134-
* @throws ValidationException If member with the same email already exists
134+
* @throws ValidationException If member with the same email already exists
135135
*/
136136
private void validateMember(Member member) throws ConstraintViolationException, ValidationException {
137137
// Create a bean validator and check for issues.
@@ -150,7 +150,7 @@ private void validateMember(Member member) throws ConstraintViolationException,
150150
/**
151151
* Creates a JAX-RS "Bad Request" response including a map of all violation fields, and their message. This can then be used
152152
* by clients to show violations.
153-
*
153+
*
154154
* @param violations A set of violations that needs to be reported
155155
* @return JAX-RS response containing all violations
156156
*/
@@ -169,7 +169,7 @@ private Response.ResponseBuilder createViolationResponse(Set<ConstraintViolation
169169
/**
170170
* Checks if a member with the same email address is already registered. This is the only way to easily capture the
171171
* "@UniqueConstraint(columnNames = "email")" constraint from the Member class.
172-
*
172+
*
173173
* @param email The email to check
174174
* @return True if the email already exists, and false otherwise
175175
*/

‎deltaspike/src/main/java/baeldung/util/Resources.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@
2727

2828
/**
2929
* This class uses CDI to alias Java EE resources, such as the persistence context, to CDI beans
30-
*
30+
* <p>
3131
* <p>
3232
* Example injection on a managed bean field:
3333
* </p>
34-
*
34+
* <p>
3535
* <pre>
3636
* &#064;Inject
3737
* private EntityManager em;

‎deltaspike/src/main/resources/META-INF/persistence.xml‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,4 @@
1818
<property name="hibernate.show_sql" value="false" />
1919
</properties>
2020
</persistence-unit>
21-
2221
</persistence>

‎deltaspike/src/test/resources/arquillian.xml‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@
3131
<!-- Example configuration for a remote WildFly instance -->
3232
<container qualifier="jboss" default="true">
3333
<!-- By default, arquillian will use the JBOSS_HOME environment variable. Alternatively, the configuration below can be uncommented. -->
34-
<!--<configuration> -->
35-
<!--<property name="jbossHome">/path/to/wildfly</property> -->
36-
<!--</configuration> -->
34+
<configuration>
35+
<property name="jbossHome">target\wildfly-run\wildfly-10.0.0.Final</property>
36+
</configuration>
3737
</container>
3838

3939
</arquillian>

0 commit comments

Comments
 (0)