Merge remote-tracking branch 'upstream/master'

# Conflicts:
#	ebean-core/src/main/java/io/ebeaninternal/server/deploy/TablespaceMeta.java
#	ebean-core/src/main/java/io/ebeaninternal/server/type/RsetDataReader.java
#	ebean-ddl-generator/src/main/java/io/ebeaninternal/dbmigration/ddlgeneration/platform/BaseTableDdl.java
#	ebean-ddl-generator/src/main/java/io/ebeaninternal/dbmigration/ddlgeneration/platform/PlatformDdl.java
#	ebean-ddl-generator/src/test/java/io/ebeaninternal/dbmigration/model/ModelContainerApplyTest.java
#	ebean-test/src/test/java/misc/migration/v1_0/EBasic.java
#	ebean-test/src/test/java/misc/migration/v1_1/MtmChild.java
#	ebean-test/src/test/java/misc/migration/v1_1/MtmMaster.java
#	ebean-test/src/test/java/org/tests/json/TestDbJson_List.java
#	ebean-test/src/test/resources/extra-ddl.xml
#	ebean-test/src/test/resources/migrationtest/dbmigration/db2fori/idx_db2.migrations
#	ebean-test/src/test/resources/migrationtest/dbmigration/db2legacy/idx_db2.migrations
#	ebean-test/src/test/resources/migrationtest/dbmigration/db2luw/I__create_tablespaces.sql
#	ebean-test/src/test/resources/migrationtest/dbmigration/db2luw/idx_db2.migrations
#	ebean-test/src/test/resources/migrationtest/dbmigration/db2zos/idx_db2.migrations
#	ebean-test/src/test/resources/migrationtest/dbmigration/model/1.0__initial.model.xml
#	ebean-test/src/test/resources/migrationtest/dbmigration/model/1.1.model.xml
This commit is contained in:
Roland Praml
2022-03-24 09:20:28 +01:00
943 changed files with 2654 additions and 1723 deletions
@@ -300,7 +300,7 @@ public interface Database {
* Create a new instance of T that is an EntityBean.
* <p>
* Useful if you use BeanPostConstructListeners or &#64;PostConstruct Annotations.
* In this case you should not use "new Bean...()". Making all bean construtors protected
* In this case you should not use "new Bean...()". Making all bean constructors protected
* could be a good idea here.
* </p>
*/
+2 -1
View File
@@ -10,13 +10,13 @@ module io.ebean.api {
requires transitive java.sql;
requires transitive io.avaje.config;
requires transitive io.avaje.lang;
requires transitive persistence.api;
requires transitive io.ebean.annotation;
requires transitive io.ebean.datasource.api;
requires transitive org.slf4j;
requires static io.ebean.types;
requires static io.avaje.jsr305x;
requires static com.fasterxml.jackson.core;
requires static javax.servlet.api;
requires static com.h2database;
@@ -41,6 +41,7 @@ module io.ebean.api {
exports io.ebean.config.dbplatform.sqlanywhere;
exports io.ebean.config.dbplatform.sqlite;
exports io.ebean.config.dbplatform.sqlserver;
exports io.ebean.config.dbplatform.yugabyte;
exports io.ebean.event;
exports io.ebean.event.readaudit;
exports io.ebean.event.changelog;
@@ -0,0 +1,187 @@
package io.ebean.text;
import io.ebean.FetchPath;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.*;
public class PathPropertiesTests {
@Test
public void test_noParentheses() {
PathProperties s0 = PathProperties.parse("id,name");
assertEquals(1, s0.getPathProps().size());
assertTrue(s0.getProperties(null).contains("id"));
assertTrue(s0.getProperties(null).contains("name"));
assertFalse(s0.getProperties(null).contains("status"));
}
@Test
public void test_noParentheses_needTrim() {
PathProperties s0 = PathProperties.parse(" id, name ");
assertEquals(1, s0.getPathProps().size());
assertTrue(s0.getProperties(null).contains("id"));
assertTrue(s0.getProperties(null).contains("name"));
assertFalse(s0.getProperties(null).contains("status"));
}
@Test
public void test_withParentheses() {
PathProperties s0 = PathProperties.parse("(id,name)");
assertEquals(1, s0.getPathProps().size());
assertTrue(s0.getProperties(null).contains("id"));
assertTrue(s0.getProperties(null).contains("name"));
assertFalse(s0.getProperties(null).contains("status"));
}
@Test
public void test_withColon() {
PathProperties s0 = PathProperties.parse(":(id,name)");
assertEquals(1, s0.getPathProps().size());
assertTrue(s0.getProperties(null).contains("id"));
assertTrue(s0.getProperties(null).contains("name"));
assertFalse(s0.getProperties(null).contains("status"));
}
@Test
public void test_nested() {
PathProperties s1 = PathProperties.parse("id,name,shipAddr(*)");
assertEquals(2, s1.getPathProps().size());
assertEquals(3, s1.getProperties(null).size());
assertTrue(s1.getProperties(null).contains("id"));
assertTrue(s1.getProperties(null).contains("name"));
assertTrue(s1.getProperties(null).contains("shipAddr"));
assertTrue(s1.getProperties("shipAddr").contains("*"));
assertEquals(1, s1.getProperties("shipAddr").size());
}
@Test
public void test_withParenthesesColonNested() {
PathProperties s1 = PathProperties.parse(":(id,name,shipAddr(*))");
assertEquals(2, s1.getPathProps().size());
assertEquals(3, s1.getProperties(null).size());
assertTrue(s1.getProperties(null).contains("id"));
assertTrue(s1.getProperties(null).contains("name"));
assertTrue(s1.getProperties(null).contains("shipAddr"));
assertTrue(s1.getProperties("shipAddr").contains("*"));
assertEquals(1, s1.getProperties("shipAddr").size());
}
@Test
public void test_add() {
PathProperties root = PathProperties.parse("status,date");
root.addNested("customer", PathProperties.parse("id,name"));
FetchPath expect = PathProperties.parse("status,date,customer(id,name)");
assertThat(root.toString()).isEqualTo(expect.toString());
}
@Test
public void test_add_nested() {
PathProperties root = PathProperties.parse("status,date");
root.addNested("customer", PathProperties.parse("id,name,address(line1,city)"));
FetchPath expect = PathProperties.parse("status,date,customer(id,name,address(line1,city))");
assertThat(root.toString()).isEqualTo(expect.toString());
}
@Test
public void test_all_properties() {
FetchPath root = PathProperties.parse("*");
assertThat(root.getProperties(null)).containsExactly("*");
}
@Test
public void test_all_properties_multipleLevels() {
PathProperties root = PathProperties.parse("*,customer(*)");
//PathProperties.Props rootProps = root.getProps(null);
PathProperties.Props customerProps = root.getProps("customer");
assertThat(root.getProperties(null)).containsExactly("*", "customer");
assertThat(customerProps.getPropertiesAsString()).isEqualTo("*");
}
@Test
public void test_includesProperty_when_wildcardUsed() {
PathProperties root = PathProperties.parse("*,customer(*)");
assertTrue(root.includesProperty("id"));
assertTrue(root.includesProperty("name"));
assertTrue(root.includesProperty("customer.id"));
assertTrue(root.includesProperty("customer.name"));
assertFalse(root.includesProperty("details.id"));
assertTrue(root.includesProperty("details"));
assertFalse(root.includesPath("details"));
}
@Test
public void test_includesProperty_when_specificPropertiesUsed() {
PathProperties root = PathProperties.parse("id,name,customer(*,billingAddress(city))");
assertTrue(root.includesProperty("id"));
assertTrue(root.includesProperty("name"));
assertFalse(root.includesProperty("status"));
assertTrue(root.includesProperty("customer.id"));
assertTrue(root.includesProperty("customer.foo"));
assertTrue(root.includesProperty("customer.billingAddress"));
assertTrue(root.includesProperty("customer.billingAddress.city"));
assertFalse(root.includesPath("customer.shippingAddress"));
assertFalse(root.includesPath("customer", "shippingAddress"));
assertFalse(root.includesProperty("customer.shippingAddress.city"));
assertTrue(root.includesPath(null));
assertTrue(root.includesPath("customer"));
assertTrue(root.includesPath("customer.billingAddress"));
assertTrue(root.includesPath("customer", "billingAddress"));
assertFalse(root.includesPath("customer.shippingAddress"));
assertFalse(root.includesPath("details"));
}
@Test
public void test_includesPropertyWithPrefix() {
PathProperties root = PathProperties.parse("id,name,customer(*,billingAddress(city))");
assertTrue(root.includesProperty("customer", "id"));
assertTrue(root.includesProperty("customer", "billingAddress"));
assertTrue(root.includesProperty("customer.billingAddress", "city"));
assertFalse(root.includesPath("customer", "shippingAddress"));
assertFalse(root.includesProperty("customer.shippingAddress", "city"));
}
@Test
public void test_includesPathWithPrefix() {
PathProperties root = PathProperties.parse("id,name,customer(*,billingAddress(city))");
assertTrue(root.includesPath(null, "customer"));
assertTrue(root.includesPath("customer", "billingAddress"));
assertFalse(root.includesPath(null, "details"));
assertFalse(root.includesPath("customer", "shippingAddress"));
}
}