Skip to content

Commit

Permalink
move native model to testapps
Browse files Browse the repository at this point in the history
Signed-off-by: Lukas Jungmann <lukas.jungmann@oracle.com>
  • Loading branch information
lukasj authored and rfelcman committed Jun 30, 2022
1 parent e8a8502 commit d7d5a77
Show file tree
Hide file tree
Showing 18 changed files with 186 additions and 116 deletions.
20 changes: 0 additions & 20 deletions jpa/eclipselink.jpa.test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -788,12 +788,6 @@
<puName>JPAADVProperties</puName>
</properties>
</itemWithProperty>
<itemWithProperty>
<name>server-test-jpa-nativeapitest</name>
<properties>
<puName>nativeapitest</puName>
</properties>
</itemWithProperty>
<itemWithProperty>
<name>server-test-jpa-sessionbean</name>
<properties>
Expand Down Expand Up @@ -1912,20 +1906,6 @@
<test-client-class>org.eclipse.persistence.testing.tests.jpa.metamodel.MetamodelMetamodelTest</test-client-class>
</properties>
</profile>
<profile>
<id>server-test-jpa-nativeapitest</id>
<properties>
<skip-test-jpa-srg>true</skip-test-jpa-srg>
<skip-server-test-jpa>false</skip-server-test-jpa>
<skip-jpa-jse-build>true</skip-jpa-jse-build>
<puName>nativeapitest</puName>
<!--modelname property name is used there due substitution string in application.xml-->
<modelname>eclipselink-nativeapitest-model</modelname>
<extra-model>common-server-generic</extra-model>
<packageName>nativeapitest</packageName>
<test-client-class>org.eclipse.persistence.testing.tests.nativeapitest.NativeAPITests</test-client-class>
</properties>
</profile>
<profile>
<id>server-test-jpa-orphanremoval</id>
<properties>
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,23 @@
<properties>
<persistence-unit.name>beanvalidation-dynamic</persistence-unit.name>
</properties>

<build>
<plugins>
<plugin>
<groupId>org.carlspring.maven</groupId>
<artifactId>derby-maven-plugin</artifactId>
<executions>
<execution>
<id>start-derby</id>
<phase>process-test-classes</phase>
</execution>
<execution>
<id>stop-derby</id>
<phase>prepare-package</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
14 changes: 14 additions & 0 deletions jpa/eclipselink.jpa.testapps/jpa.test.beanvalidation/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,20 @@

<build>
<plugins>
<plugin>
<groupId>org.carlspring.maven</groupId>
<artifactId>derby-maven-plugin</artifactId>
<executions>
<execution>
<id>start-derby</id>
<phase>process-test-classes</phase>
</execution>
<execution>
<id>stop-derby</id>
<phase>prepare-package</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
Expand Down
50 changes: 50 additions & 0 deletions jpa/eclipselink.jpa.testapps/nativeapi/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2022 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 xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>org.eclipse.persistence.jpa.testapps</artifactId>
<groupId>org.eclipse.persistence</groupId>
<version>4.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>org.eclipse.persistence.jpa.testapps.nativeapi</artifactId>

<name>Test - Persistence nativeapi</name>

<properties>
<el.fwk.exclusionFilter>%regex[.*TestRunner.*Bean.*]</el.fwk.exclusionFilter>
</properties>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<executions>
<execution>
<id>default-test</id>
<configuration>
<skip>true</skip>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2020 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2022 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
Expand Down Expand Up @@ -39,7 +39,7 @@ public Address() {
postalCode = "";
street = "";
country = "";
this.employees = new Vector<Employee>();
this.employees = new Vector<>();
}

public Address(String street, String city, String province, String country, String postalCode) {
Expand All @@ -48,7 +48,7 @@ public Address(String street, String city, String province, String country, Stri
this.province = province;
this.country = country;
this.postalCode = postalCode;
this.employees = new Vector<Employee>();
this.employees = new Vector<>();
}

public Address copy() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2020 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2022 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
Expand Down Expand Up @@ -35,7 +35,7 @@ public Department() {

public Department(String name) {
this.name = name;
this.managers = new Vector();
this.managers = new Vector<>();
}

public void addManager(Employee employee) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2021 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2022 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
Expand Down Expand Up @@ -42,9 +42,9 @@ public enum Weekdays { SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SAT
private Collection<Employee> managedEmployees;

public Employee () {
this.phoneNumbers = new Vector<PhoneNumber>();
this.managedEmployees = new Vector<Employee>();
this.responsibilities = new Vector<String>();
this.phoneNumbers = new Vector<>();
this.managedEmployees = new Vector<>();
this.responsibilities = new Vector<>();
}

public Employee(String firstName, String lastName){
Expand Down Expand Up @@ -127,7 +127,7 @@ public Collection<PhoneNumber> getPhoneNumbers() {
return phoneNumbers;
}

public Collection getResponsibilities() {
public Collection<String> getResponsibilities() {
return responsibilities;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2020 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2022 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
Expand All @@ -22,11 +22,11 @@
* EmployeeService session bean interface.
*/
public interface EmployeeService {
List findAll();
List<Employee> findAll();

Employee findById(int id);

List findByFirstName(String fname);
List<Employee> findByFirstName(String fname);
Employee fetchById(int id);

void update(Employee employee);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2021 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2022 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
Expand Down Expand Up @@ -28,8 +28,6 @@
import org.eclipse.persistence.queries.ReadAllQuery;
import org.eclipse.persistence.queries.ReadObjectQuery;

import org.eclipse.persistence.testing.models.nativeapitest.Employee;

/**
* EmployeeService session bean.
*/
Expand All @@ -38,9 +36,10 @@
public class EmployeeServiceBean implements EmployeeService {

@Override
public List findAll() {
public List<Employee> findAll() {
ClientSession clientSession = getSession().acquireClientSession();
List collection = clientSession.readAllObjects(Employee.class);
@SuppressWarnings("unchecked")
List<Employee> collection = (List<Employee>) clientSession.readAllObjects(Employee.class);
return collection;
}

Expand All @@ -66,12 +65,13 @@ public Employee fetchById(int id) {
}

@Override
public List findByFirstName(String fname) {
public List<Employee> findByFirstName(String fname) {
ReadAllQuery query = new ReadAllQuery(Employee.class);
ExpressionBuilder builder = query.getExpressionBuilder();
Expression expression = builder.get("firstName").equal(fname);
query.setSelectionCriteria(expression);
List result = (List)getSession().executeQuery(query);
@SuppressWarnings("unchecked")
List<Employee> result = (List<Employee>)getSession().executeQuery(query);
return result;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2020 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2022 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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2020 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2022 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
Expand Down Expand Up @@ -42,7 +42,7 @@ public PhoneNumber(String type, String theAreaCode, String theNumber) {
this.areaCode = theAreaCode;
this.number = theNumber;
this.owner = null;
this.status = new Vector<PhoneStatus>();
this.status = new Vector<>();
}

public void addStatus(PhoneStatus status) {
Expand Down Expand Up @@ -96,8 +96,8 @@ public void removeStatus(PhoneStatus status) {
/**
* Uses a Vector as its primary key.
*/
public List buildPK(){
List pk = new Vector();
public List<Object> buildPK(){
List<Object> pk = new Vector<>();
pk.add(getOwner().getId());
pk.add(getType());
return pk;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2022 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
-->

<jboss-deployment-structure>
<sub-deployment name="${project.build.finalName}_ejb.jar">
<dependencies>
<module name="org.eclipse.persistence" />
</dependencies>
</sub-deployment>
</jboss-deployment-structure>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2018, 2020 Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2018, 2022 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
Expand Down

0 comments on commit d7d5a77

Please sign in to comment.