From 7868a8c4d511b960a1b7817b17078cf90c95a349 Mon Sep 17 00:00:00 2001 From: kubamarchwicki Date: Sun, 2 Feb 2014 16:32:41 +0100 Subject: [PATCH 1/3] JPA Extended persistence context test --- .../jpa/extended/pc/BigBangTheoryService.java | 30 ++++ .../pc/{Employee.java => Character.java} | 18 ++- ...{EmployeeBean.java => CharactersBean.java} | 20 +-- .../javaee7/jpa/extended/pc/TestServlet.java | 134 ------------------ .../src/main/resources/META-INF/create.sql | 2 +- .../src/main/resources/META-INF/drop.sql | 2 +- .../src/main/resources/META-INF/load.sql | 14 +- .../main/resources/META-INF/persistence.xml | 2 +- jpa/extended-pc/src/main/webapp/index.jsp | 56 -------- ...ndedPersistenceContextSpecification.groovy | 56 ++++++++ 10 files changed, 118 insertions(+), 216 deletions(-) create mode 100644 jpa/extended-pc/src/main/java/org/javaee7/jpa/extended/pc/BigBangTheoryService.java rename jpa/extended-pc/src/main/java/org/javaee7/jpa/extended/pc/{Employee.java => Character.java} (89%) rename jpa/extended-pc/src/main/java/org/javaee7/jpa/extended/pc/{EmployeeBean.java => CharactersBean.java} (87%) delete mode 100644 jpa/extended-pc/src/main/java/org/javaee7/jpa/extended/pc/TestServlet.java delete mode 100644 jpa/extended-pc/src/main/webapp/index.jsp create mode 100644 jpa/extended-pc/src/test/java/org/javaee7/jpa/extended/pc/ExtendedPersistenceContextSpecification.groovy diff --git a/jpa/extended-pc/src/main/java/org/javaee7/jpa/extended/pc/BigBangTheoryService.java b/jpa/extended-pc/src/main/java/org/javaee7/jpa/extended/pc/BigBangTheoryService.java new file mode 100644 index 000000000..07c5d74e4 --- /dev/null +++ b/jpa/extended-pc/src/main/java/org/javaee7/jpa/extended/pc/BigBangTheoryService.java @@ -0,0 +1,30 @@ +package org.javaee7.jpa.extended.pc; + +import javax.enterprise.context.SessionScoped; +import javax.inject.Inject; +import java.io.Serializable; + +@SessionScoped +public class BigBangTheoryService implements Serializable { + + @Inject + CharactersBean characters; + + public void addWilWheaton() { + Character wil = new Character(8, "Wil Wheaton"); + characters.save(wil); + } + + public void updateRaj() { + for (Character characterzz : characters.get()) { + if ("Raj".equals(characterzz.getName())) { + characterzz.setName("Rajesh Ramayan"); + characters.save(characterzz); + } + } + } + + public void proceed() { + characters.commitChanges(); + } +} diff --git a/jpa/extended-pc/src/main/java/org/javaee7/jpa/extended/pc/Employee.java b/jpa/extended-pc/src/main/java/org/javaee7/jpa/extended/pc/Character.java similarity index 89% rename from jpa/extended-pc/src/main/java/org/javaee7/jpa/extended/pc/Employee.java rename to jpa/extended-pc/src/main/java/org/javaee7/jpa/extended/pc/Character.java index c1c4d4977..9fc404dcf 100644 --- a/jpa/extended-pc/src/main/java/org/javaee7/jpa/extended/pc/Employee.java +++ b/jpa/extended-pc/src/main/java/org/javaee7/jpa/extended/pc/Character.java @@ -39,38 +39,42 @@ */ package org.javaee7.jpa.extended.pc; -import java.io.Serializable; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.NamedQueries; import javax.persistence.NamedQuery; import javax.persistence.Table; +import java.io.Serializable; /** * @author Arun Gupta */ @Entity -@Table(name="EMPLOYEE_SCHEMA_EXTENDED_PC") +@Table(name="CHARACTERS") @NamedQueries({ - @NamedQuery(name = "Employee.findAll", query = "SELECT e FROM Employee e") + @NamedQuery(name = Character.FIND_ALL, query = "SELECT c FROM Character c") }) -public class Employee implements Serializable { +public class Character implements Serializable { + + public static final String FIND_ALL = "Character.findAll"; + private static final long serialVersionUID = 1L; + @Id private int id; @Column(length=50) private String name; - public Employee() { } + public Character() { } - public Employee(int id, String name) { + public Character(int id, String name) { this.id = id; this.name = name; } - public Employee(String name) { + public Character(String name) { this.name = name; } diff --git a/jpa/extended-pc/src/main/java/org/javaee7/jpa/extended/pc/EmployeeBean.java b/jpa/extended-pc/src/main/java/org/javaee7/jpa/extended/pc/CharactersBean.java similarity index 87% rename from jpa/extended-pc/src/main/java/org/javaee7/jpa/extended/pc/EmployeeBean.java rename to jpa/extended-pc/src/main/java/org/javaee7/jpa/extended/pc/CharactersBean.java index 70082c99e..eaaa26d3e 100644 --- a/jpa/extended-pc/src/main/java/org/javaee7/jpa/extended/pc/EmployeeBean.java +++ b/jpa/extended-pc/src/main/java/org/javaee7/jpa/extended/pc/CharactersBean.java @@ -39,34 +39,36 @@ */ package org.javaee7.jpa.extended.pc; -import java.util.List; import javax.ejb.Stateful; import javax.ejb.TransactionAttribute; import javax.ejb.TransactionAttributeType; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; import javax.persistence.PersistenceContextType; +import java.io.Serializable; +import java.util.List; /** - * @author Arun Gupta + * @author Kuba Marchwicki */ @Stateful -public class EmployeeBean { +@TransactionAttribute(TransactionAttributeType.NEVER) +public class CharactersBean implements Serializable { @PersistenceContext(type = PersistenceContextType.EXTENDED) EntityManager em; - @TransactionAttribute(TransactionAttributeType.NEVER) - public void persistWithoutTransaction(Employee e) { + public void save(Character e) { em.persist(e); } @TransactionAttribute(TransactionAttributeType.REQUIRED) - public void persistWithTransaction(Employee e) { - em.persist(e); + public void commitChanges() { + } - public List get() { - return em.createNamedQuery("Employee.findAll", Employee.class).getResultList(); + public List get() { + return em.createNamedQuery(Character.FIND_ALL, Character.class).getResultList(); } + } diff --git a/jpa/extended-pc/src/main/java/org/javaee7/jpa/extended/pc/TestServlet.java b/jpa/extended-pc/src/main/java/org/javaee7/jpa/extended/pc/TestServlet.java deleted file mode 100644 index a559cc1e2..000000000 --- a/jpa/extended-pc/src/main/java/org/javaee7/jpa/extended/pc/TestServlet.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * http://glassfish.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - */ -package org.javaee7.jpa.extended.pc; - -import java.io.IOException; -import java.io.PrintWriter; -import javax.inject.Inject; -import javax.servlet.ServletException; -import javax.servlet.annotation.WebServlet; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -/** - * @author Arun Gupta - */ -@WebServlet(urlPatterns = {"/TestServlet"}) -public class TestServlet extends HttpServlet { - - @Inject - EmployeeBean bean; - - /** - * Processes requests for both HTTP GET and POST - * methods. - * - * @param request servlet request - * @param response servlet response - * @throws ServletException if a servlet-specific error occurs - * @throws IOException if an I/O error occurs - */ - protected void processRequest(HttpServletRequest request, HttpServletResponse response) - throws ServletException, IOException { - response.setContentType("text/html;charset=UTF-8"); - PrintWriter out = response.getWriter(); - out.println(""); - out.println(""); - out.println("Extended Persistence Context"); - out.println(""); - out.println(""); - out.println("

Extended Persistence Context

"); - listEmployees(out, "Initial list", "Total == 7?"); - Employee e = new Employee(8, "Priya"); - bean.persistWithoutTransaction(e); - listEmployees(out, "PC without a transaction", "Total == 7?"); - bean.persistWithTransaction(e); - listEmployees(out, "PC with a transaction", "Total == 8?"); - out.println(""); - out.println(""); - } - - private void listEmployees(PrintWriter out, String title, String result) { - out.println("

" + title + " (" + bean.get().size() + ") " + result + "

"); - for (Employee e : bean.get()) { - out.println(e.getName() + "
"); - } - } - - // - /** - * Handles the HTTP GET method. - * - * @param request servlet request - * @param response servlet response - * @throws ServletException if a servlet-specific error occurs - * @throws IOException if an I/O error occurs - */ - @Override - protected void doGet(HttpServletRequest request, HttpServletResponse response) - throws ServletException, IOException { - processRequest(request, response); - } - - /** - * Handles the HTTP POST method. - * - * @param request servlet request - * @param response servlet response - * @throws ServletException if a servlet-specific error occurs - * @throws IOException if an I/O error occurs - */ - @Override - protected void doPost(HttpServletRequest request, HttpServletResponse response) - throws ServletException, IOException { - processRequest(request, response); - } - - /** - * Returns a short description of the servlet. - * - * @return a String containing servlet description - */ - @Override - public String getServletInfo() { - return "Short description"; - }// -} diff --git a/jpa/extended-pc/src/main/resources/META-INF/create.sql b/jpa/extended-pc/src/main/resources/META-INF/create.sql index 2b9dc3a28..fd3a09ffd 100644 --- a/jpa/extended-pc/src/main/resources/META-INF/create.sql +++ b/jpa/extended-pc/src/main/resources/META-INF/create.sql @@ -1 +1 @@ -CREATE TABLE EMPLOYEE_SCHEMA_EXTENDED_PC ("ID" INTEGER not null primary key, "NAME" VARCHAR(50) not null) \ No newline at end of file +CREATE TABLE CHARACTERS ("ID" INTEGER not null primary key, "NAME" VARCHAR(50) not null) \ No newline at end of file diff --git a/jpa/extended-pc/src/main/resources/META-INF/drop.sql b/jpa/extended-pc/src/main/resources/META-INF/drop.sql index a75c07a18..19438f4a2 100644 --- a/jpa/extended-pc/src/main/resources/META-INF/drop.sql +++ b/jpa/extended-pc/src/main/resources/META-INF/drop.sql @@ -1 +1 @@ -DROP TABLE EMPLOYEE_SCHEMA_EXTENDED_PC \ No newline at end of file +DROP TABLE CHARACTERS \ No newline at end of file diff --git a/jpa/extended-pc/src/main/resources/META-INF/load.sql b/jpa/extended-pc/src/main/resources/META-INF/load.sql index 44c6793d5..2488ad5cf 100644 --- a/jpa/extended-pc/src/main/resources/META-INF/load.sql +++ b/jpa/extended-pc/src/main/resources/META-INF/load.sql @@ -1,7 +1,7 @@ -INSERT INTO EMPLOYEE_SCHEMA_EXTENDED_PC("ID", "NAME") VALUES (1, 'Penny') -INSERT INTO EMPLOYEE_SCHEMA_EXTENDED_PC("ID", "NAME") VALUES (2, 'Sheldon') -INSERT INTO EMPLOYEE_SCHEMA_EXTENDED_PC("ID", "NAME") VALUES (3, 'Amy') -INSERT INTO EMPLOYEE_SCHEMA_EXTENDED_PC("ID", "NAME") VALUES (4, 'Leonard') -INSERT INTO EMPLOYEE_SCHEMA_EXTENDED_PC("ID", "NAME") VALUES (5, 'Bernadette') -INSERT INTO EMPLOYEE_SCHEMA_EXTENDED_PC("ID", "NAME") VALUES (6, 'Raj') -INSERT INTO EMPLOYEE_SCHEMA_EXTENDED_PC("ID", "NAME") VALUES (7, 'Howard') \ No newline at end of file +INSERT INTO CHARACTERS("ID", "NAME") VALUES (1, 'Penny') +INSERT INTO CHARACTERS("ID", "NAME") VALUES (2, 'Sheldon') +INSERT INTO CHARACTERS("ID", "NAME") VALUES (3, 'Amy') +INSERT INTO CHARACTERS("ID", "NAME") VALUES (4, 'Leonard') +INSERT INTO CHARACTERS("ID", "NAME") VALUES (5, 'Bernadette') +INSERT INTO CHARACTERS("ID", "NAME") VALUES (6, 'Raj') +INSERT INTO CHARACTERS("ID", "NAME") VALUES (7, 'Howard') \ No newline at end of file diff --git a/jpa/extended-pc/src/main/resources/META-INF/persistence.xml b/jpa/extended-pc/src/main/resources/META-INF/persistence.xml index 010072bfd..34ed09061 100644 --- a/jpa/extended-pc/src/main/resources/META-INF/persistence.xml +++ b/jpa/extended-pc/src/main/resources/META-INF/persistence.xml @@ -12,7 +12,7 @@ - + diff --git a/jpa/extended-pc/src/main/webapp/index.jsp b/jpa/extended-pc/src/main/webapp/index.jsp deleted file mode 100644 index c5fab84e0..000000000 --- a/jpa/extended-pc/src/main/webapp/index.jsp +++ /dev/null @@ -1,56 +0,0 @@ - -<%@page contentType="text/html" pageEncoding="UTF-8"%> - - - - - - JPA 2.1 Extended Persistence Context - - -

JPA 2.1 Extended Persistence Context

- - Add & List employees. - - diff --git a/jpa/extended-pc/src/test/java/org/javaee7/jpa/extended/pc/ExtendedPersistenceContextSpecification.groovy b/jpa/extended-pc/src/test/java/org/javaee7/jpa/extended/pc/ExtendedPersistenceContextSpecification.groovy new file mode 100644 index 000000000..4f35e6381 --- /dev/null +++ b/jpa/extended-pc/src/test/java/org/javaee7/jpa/extended/pc/ExtendedPersistenceContextSpecification.groovy @@ -0,0 +1,56 @@ +package org.javaee7.jpa.extended.pc + +import org.jboss.arquillian.container.test.api.Deployment +import org.jboss.arquillian.spock.ArquillianSputnik +import org.jboss.shrinkwrap.api.ShrinkWrap +import org.jboss.shrinkwrap.api.spec.WebArchive +import org.junit.runner.RunWith +import spock.lang.Specification + +import javax.inject.Inject +import javax.persistence.EntityManager +import javax.persistence.PersistenceContext + +/** + * @author Kuba Marchwicki + */ +@RunWith(ArquillianSputnik) +class ExtendedPersistenceContextSpecification extends Specification { + + @PersistenceContext + EntityManager em; + + @Inject + BigBangTheoryService service; + + @Deployment + def static WebArchive deploy() { + ShrinkWrap.create(WebArchive.class) + .addPackage("org.javaee7.jpa.extended.pc") + .addAsResource("META-INF/persistence.xml") + .addAsResource("META-INF/create.sql") + .addAsResource("META-INF/drop.sql") + .addAsResource("META-INF/load.sql"); + } + + def setup() { + service.addWilWheaton(); + service.updateRaj(); + } + + def "should not persist changes without transaction flush"() { + expect: + 7 == em.createNamedQuery(Character.FIND_ALL, Character.class).getResultList().size(); + "Raj" == em.find(Character.class, 6).name + } + + def "should update characters after transaction flush"() { + when: + service.proceed(); + + then: + 8 == em.createNamedQuery(Character.FIND_ALL, Character.class).getResultList().size(); + "Rajesh Ramayan" == em.find(Character.class, 6).name + "Wil Wheaton" == em.find(Character.class, 8).name + } +} From a8bd79924b5eaf2717e5948af7f399cb27e3136d Mon Sep 17 00:00:00 2001 From: kubamarchwicki Date: Sun, 2 Feb 2014 16:50:30 +0100 Subject: [PATCH 2/3] Simplification. No need for @SesssionScope bean. Inject @Stateful to arq test --- .../jpa/extended/pc/BigBangTheoryService.java | 30 ------------------- ...ndedPersistenceContextSpecification.groovy | 23 ++++++++------ 2 files changed, 14 insertions(+), 39 deletions(-) delete mode 100644 jpa/extended-pc/src/main/java/org/javaee7/jpa/extended/pc/BigBangTheoryService.java diff --git a/jpa/extended-pc/src/main/java/org/javaee7/jpa/extended/pc/BigBangTheoryService.java b/jpa/extended-pc/src/main/java/org/javaee7/jpa/extended/pc/BigBangTheoryService.java deleted file mode 100644 index 07c5d74e4..000000000 --- a/jpa/extended-pc/src/main/java/org/javaee7/jpa/extended/pc/BigBangTheoryService.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.javaee7.jpa.extended.pc; - -import javax.enterprise.context.SessionScoped; -import javax.inject.Inject; -import java.io.Serializable; - -@SessionScoped -public class BigBangTheoryService implements Serializable { - - @Inject - CharactersBean characters; - - public void addWilWheaton() { - Character wil = new Character(8, "Wil Wheaton"); - characters.save(wil); - } - - public void updateRaj() { - for (Character characterzz : characters.get()) { - if ("Raj".equals(characterzz.getName())) { - characterzz.setName("Rajesh Ramayan"); - characters.save(characterzz); - } - } - } - - public void proceed() { - characters.commitChanges(); - } -} diff --git a/jpa/extended-pc/src/test/java/org/javaee7/jpa/extended/pc/ExtendedPersistenceContextSpecification.groovy b/jpa/extended-pc/src/test/java/org/javaee7/jpa/extended/pc/ExtendedPersistenceContextSpecification.groovy index 4f35e6381..d7ba5512f 100644 --- a/jpa/extended-pc/src/test/java/org/javaee7/jpa/extended/pc/ExtendedPersistenceContextSpecification.groovy +++ b/jpa/extended-pc/src/test/java/org/javaee7/jpa/extended/pc/ExtendedPersistenceContextSpecification.groovy @@ -1,5 +1,4 @@ package org.javaee7.jpa.extended.pc - import org.jboss.arquillian.container.test.api.Deployment import org.jboss.arquillian.spock.ArquillianSputnik import org.jboss.shrinkwrap.api.ShrinkWrap @@ -7,10 +6,9 @@ import org.jboss.shrinkwrap.api.spec.WebArchive import org.junit.runner.RunWith import spock.lang.Specification -import javax.inject.Inject +import javax.ejb.EJB import javax.persistence.EntityManager import javax.persistence.PersistenceContext - /** * @author Kuba Marchwicki */ @@ -20,8 +18,8 @@ class ExtendedPersistenceContextSpecification extends Specification { @PersistenceContext EntityManager em; - @Inject - BigBangTheoryService service; + @EJB + CharactersBean bean; @Deployment def static WebArchive deploy() { @@ -30,12 +28,19 @@ class ExtendedPersistenceContextSpecification extends Specification { .addAsResource("META-INF/persistence.xml") .addAsResource("META-INF/create.sql") .addAsResource("META-INF/drop.sql") - .addAsResource("META-INF/load.sql"); + .addAsResource("META-INF/load.sql") } def setup() { - service.addWilWheaton(); - service.updateRaj(); + Character wil = new Character(8, "Wil Wheaton") + bean.save(wil) + + for (Character c : bean.get()) { + if ("Raj".equals(c.getName())) { + c.setName("Rajesh Ramayan") + bean.save(c) + } + } } def "should not persist changes without transaction flush"() { @@ -46,7 +51,7 @@ class ExtendedPersistenceContextSpecification extends Specification { def "should update characters after transaction flush"() { when: - service.proceed(); + bean.commitChanges() then: 8 == em.createNamedQuery(Character.FIND_ALL, Character.class).getResultList().size(); From 87654aadddaed94ed13ab1b0c56a21f54c7b9fdb Mon Sep 17 00:00:00 2001 From: kubamarchwicki Date: Mon, 3 Feb 2014 21:47:02 +0100 Subject: [PATCH 3/3] Removing licence information --- .../javaee7/jpa/extended/pc/Character.java | 39 ------------------- .../jpa/extended/pc/CharactersBean.java | 39 ------------------- ...ndedPersistenceContextSpecification.groovy | 2 + 3 files changed, 2 insertions(+), 78 deletions(-) diff --git a/jpa/extended-pc/src/main/java/org/javaee7/jpa/extended/pc/Character.java b/jpa/extended-pc/src/main/java/org/javaee7/jpa/extended/pc/Character.java index 9fc404dcf..9e7b6287d 100644 --- a/jpa/extended-pc/src/main/java/org/javaee7/jpa/extended/pc/Character.java +++ b/jpa/extended-pc/src/main/java/org/javaee7/jpa/extended/pc/Character.java @@ -1,42 +1,3 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * http://glassfish.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - */ package org.javaee7.jpa.extended.pc; import javax.persistence.Column; diff --git a/jpa/extended-pc/src/main/java/org/javaee7/jpa/extended/pc/CharactersBean.java b/jpa/extended-pc/src/main/java/org/javaee7/jpa/extended/pc/CharactersBean.java index eaaa26d3e..7a3141874 100644 --- a/jpa/extended-pc/src/main/java/org/javaee7/jpa/extended/pc/CharactersBean.java +++ b/jpa/extended-pc/src/main/java/org/javaee7/jpa/extended/pc/CharactersBean.java @@ -1,42 +1,3 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * http://glassfish.java.net/public/CDDL+GPL_1_1.html - * or packager/legal/LICENSE.txt. See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at packager/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * Oracle designates this particular file as subject to the "Classpath" - * exception as provided by Oracle in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - */ package org.javaee7.jpa.extended.pc; import javax.ejb.Stateful; diff --git a/jpa/extended-pc/src/test/java/org/javaee7/jpa/extended/pc/ExtendedPersistenceContextSpecification.groovy b/jpa/extended-pc/src/test/java/org/javaee7/jpa/extended/pc/ExtendedPersistenceContextSpecification.groovy index d7ba5512f..dd6f5a727 100644 --- a/jpa/extended-pc/src/test/java/org/javaee7/jpa/extended/pc/ExtendedPersistenceContextSpecification.groovy +++ b/jpa/extended-pc/src/test/java/org/javaee7/jpa/extended/pc/ExtendedPersistenceContextSpecification.groovy @@ -1,4 +1,5 @@ package org.javaee7.jpa.extended.pc + import org.jboss.arquillian.container.test.api.Deployment import org.jboss.arquillian.spock.ArquillianSputnik import org.jboss.shrinkwrap.api.ShrinkWrap @@ -9,6 +10,7 @@ import spock.lang.Specification import javax.ejb.EJB import javax.persistence.EntityManager import javax.persistence.PersistenceContext + /** * @author Kuba Marchwicki */