-
Notifications
You must be signed in to change notification settings - Fork 174
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DatasourceAccessor ReentrantLock fix plus new SpringBoot test (#2328)
Signed-off-by: Radek Felcman <[email protected]>
- Loading branch information
Showing
13 changed files
with
507 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,175 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
Copyright (c) 2024 Oracle and/or its affiliates. All rights reserved. | ||
This program and the accompanying materials are made available under the | ||
terms of the Eclipse Public License v. 2.0 which is available at | ||
http://www.eclipse.org/legal/epl-2.0, | ||
or the Eclipse Distribution License v. 1.0 which is available at | ||
http://www.eclipse.org/org/documents/edl-v10.php. | ||
SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause | ||
--> | ||
|
||
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" | ||
xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<name>EclipseLink JPA Spring Boot Test</name> | ||
<groupId>org.eclipse.persistence</groupId> | ||
<artifactId>org.eclipse.persistence.jpa.springboot.test</artifactId> | ||
<packaging>jar</packaging> | ||
|
||
<parent> | ||
<groupId>org.eclipse.persistence</groupId> | ||
<artifactId>org.eclipse.persistence.parent</artifactId> | ||
<version>4.0.5-SNAPSHOT</version> | ||
<relativePath>../../pom.xml</relativePath> | ||
</parent> | ||
|
||
<properties> | ||
<comp.xlint>-Xlint:all</comp.xlint> | ||
<comp.xdoclint>-Xdoclint:all,-missing</comp.xdoclint> | ||
<comp.test.xlint>-Xlint:all</comp.test.xlint> | ||
|
||
<!--Properties used for test resources filtering/replacement--> | ||
<!--DB connection properties--> | ||
<dbPlatform>${db.platform}</dbPlatform> | ||
<dbUser>${db.user}</dbUser> | ||
<dbPassword>${db.pwd}</dbPassword> | ||
<driverClass>${db.driver}</driverClass> | ||
<dbURL>${db.url}</dbURL> | ||
<!--Log level--> | ||
<loglevel>${logging.level}</loglevel> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>ch.qos.logback</groupId> | ||
<artifactId>logback-core</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<!--Other modules--> | ||
<!--EclipseLink JPA--> | ||
<dependency> | ||
<groupId>org.eclipse.persistence</groupId> | ||
<artifactId>org.eclipse.persistence.jpa</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<!--API dependencies--> | ||
<dependency> | ||
<groupId>jakarta.transaction</groupId> | ||
<artifactId>jakarta.transaction-api</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<!--Other libraries dependencies--> | ||
<!-- Spring Boot Data JPA --> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-data-jpa</artifactId> | ||
<scope>test</scope> | ||
<exclusions> | ||
<exclusion> | ||
<groupId>org.hibernate</groupId> | ||
<artifactId>hibernate-entitymanager</artifactId> | ||
</exclusion> | ||
<exclusion> | ||
<groupId>org.hibernate</groupId> | ||
<artifactId>hibernate-core</artifactId> | ||
</exclusion> | ||
</exclusions> | ||
</dependency> | ||
<!-- Spring Boot Test --> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-test</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<!-- Spring FW --> | ||
<dependency> | ||
<groupId>org.springframework</groupId> | ||
<artifactId>spring-test</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
<!--JDBC driver (test dependency)--> | ||
<dependency> | ||
<groupId>${db.driver.groupId}</groupId> | ||
<artifactId>${db.driver.artifactId}</artifactId> | ||
<version>${db.driver.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<!--Filtering enables generate/substitute test properties from Maven into *.xml files.--> | ||
<testResources> | ||
<testResource> | ||
<directory>${integration.test.resources.directory}</directory> | ||
<filtering>true</filtering> | ||
</testResource> | ||
</testResources> | ||
|
||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-surefire-plugin</artifactId> | ||
<configuration> | ||
<skip>true</skip> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-failsafe-plugin</artifactId> | ||
<configuration> | ||
<workingDirectory>${project.build.directory}/test-run</workingDirectory> | ||
<!--Set system properties required for tests--> | ||
<systemPropertiesFile>${test.properties.file}</systemPropertiesFile> | ||
</configuration> | ||
<executions> | ||
<execution> | ||
<id>test-jpa-springboot</id> | ||
<goals> | ||
<goal>integration-test</goal> | ||
</goals> | ||
<configuration> | ||
<reportNameSuffix>test-jpa-springboot</reportNameSuffix> | ||
<includes> | ||
<include>org.eclipse.persistence.testing.tests.jpa.springboot.TestPersonRepository</include> | ||
</includes> | ||
</configuration> | ||
</execution> | ||
<execution> | ||
<id>verify-integration-tests</id> | ||
<goals> | ||
<goal>verify</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.carlspring.maven</groupId> | ||
<artifactId>derby-maven-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<id>start-derby</id> | ||
<phase>pre-integration-test</phase> | ||
<goals> | ||
<goal>start</goal> | ||
</goals> | ||
</execution> | ||
<execution> | ||
<id>stop-derby</id> | ||
<phase>post-integration-test</phase> | ||
<goals> | ||
<goal>stop</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
77 changes: 77 additions & 0 deletions
77
...ngboot.test/src/it/java/org/eclipse/persistence/testing/models/jpa/springboot/Person.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
/* | ||
* Copyright (c) 2024 Oracle and/or its affiliates. All rights reserved. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License v. 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0, | ||
* or the Eclipse Distribution License v. 1.0 which is available at | ||
* http://www.eclipse.org/org/documents/edl-v10.php. | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause | ||
*/ | ||
|
||
// Contributors: | ||
// Oracle - initial API and implementation | ||
package org.eclipse.persistence.testing.models.jpa.springboot; | ||
|
||
import jakarta.persistence.Entity; | ||
import jakarta.persistence.Id; | ||
import jakarta.persistence.Table; | ||
|
||
import java.util.Objects; | ||
|
||
@Entity | ||
@Table(name="SPRINGBOOT_PERSON") | ||
public class Person { | ||
|
||
@Id | ||
private Integer id; | ||
private String firstName; | ||
private String lastName; | ||
|
||
public Person() { | ||
} | ||
|
||
public Person(Integer id, String firstName, String lastName) { | ||
this.id = id; | ||
this.firstName = firstName; | ||
this.lastName = lastName; | ||
} | ||
|
||
public Integer getId() { | ||
return id; | ||
} | ||
|
||
public void setId(Integer id) { | ||
this.id = id; | ||
} | ||
|
||
public String getFirstName() { | ||
return firstName; | ||
} | ||
|
||
public void setFirstName(String firstName) { | ||
this.firstName = firstName; | ||
} | ||
|
||
public String getLastName() { | ||
return lastName; | ||
} | ||
|
||
public void setLastName(String lastName) { | ||
this.lastName = lastName; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) return true; | ||
if (o == null || getClass() != o.getClass()) return false; | ||
Person person = (Person) o; | ||
return Objects.equals(id, person.id) && Objects.equals(firstName, person.firstName) && Objects.equals(lastName, person.lastName); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(id, firstName, lastName); | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
...t/src/it/java/org/eclipse/persistence/testing/models/jpa/springboot/PersonRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* | ||
* Copyright (c) 2024 Oracle and/or its affiliates. All rights reserved. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License v. 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0, | ||
* or the Eclipse Distribution License v. 1.0 which is available at | ||
* http://www.eclipse.org/org/documents/edl-v10.php. | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause | ||
*/ | ||
|
||
// Contributors: | ||
// Oracle - initial API and implementation | ||
package org.eclipse.persistence.testing.models.jpa.springboot; | ||
|
||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.stereotype.Repository; | ||
|
||
import java.util.List; | ||
|
||
@Repository | ||
public interface PersonRepository extends JpaRepository<Person, Integer> { | ||
|
||
Person findPersonById(Integer id); | ||
|
||
List<Person> queryAllByIdGreaterThan(Integer idIsGreaterThan); | ||
} |
Oops, something went wrong.