#2355 - Rename methods in SpiServer with deprecation

This commit is contained in:
rbygrave
2021-09-03 20:17:12 +12:00
parent 25b9b37ac0
commit d072dd52cf
22 changed files with 86 additions and 38 deletions
@@ -28,7 +28,7 @@ public class BeanTypeTest {
private static Database db = DB.getDefault();
private <T> BeanType<T> beanType(Class<T> cls) {
return db.pluginApi().getBeanType(cls);
return db.pluginApi().beanType(cls);
}
@Test
@@ -15,7 +15,7 @@ public class ExpressionPathTest {
static EbeanServer server = Ebean.getDefaultServer();
<T> BeanType<T> beanType(Class<T> cls) {
return server.pluginApi().getBeanType(cls);
return server.pluginApi().beanType(cls);
}
@Test
@@ -15,7 +15,7 @@ public class PropertyTest {
static EbeanServer server = Ebean.getDefaultServer();
<T> BeanType<T> beanType(Class<T> cls) {
return server.pluginApi().getBeanType(cls);
return server.pluginApi().beanType(cls);
}
@Test
@@ -25,9 +25,9 @@ public class SpiServerTest extends BaseTestCase {
EbeanServer defaultServer = Ebean.getDefaultServer();
SpiServer pluginApi = defaultServer.pluginApi();
BeanType<Customer> beanType = pluginApi.getBeanType(Customer.class);
BeanType<Customer> beanType = pluginApi.beanType(Customer.class);
assertEquals("o_customer", beanType.getBaseTable());
assertNotNull(pluginApi.getDatabasePlatform());
assertNotNull(pluginApi.databasePlatform());
assertNull(beanType.getFindController());
assertNotNull(beanType.getPersistController());
assertNull(beanType.getPersistListener());
@@ -45,15 +45,15 @@ public class SpiServerTest extends BaseTestCase {
assertEquals(42, beanType.getBeanId(customer));
List<? extends BeanType<?>> beanTypes = pluginApi.getBeanTypes("o_customer");
List<? extends BeanType<?>> beanTypes = pluginApi.beanTypes("o_customer");
assertEquals(2, beanTypes.size());
BeanType<VwCustomer> vwBeanType = pluginApi.getBeanType(VwCustomer.class);
BeanType<VwCustomer> vwBeanType = pluginApi.beanType(VwCustomer.class);
assertThat(beanTypes.contains(beanType)).isTrue();
assertThat(beanTypes.contains(vwBeanType)).isTrue();
List<? extends BeanType<?>> allTypes = pluginApi.getBeanTypes();
List<? extends BeanType<?>> allTypes = pluginApi.beanTypes();
assertFalse(allTypes.isEmpty());
}
@@ -302,7 +302,7 @@ public class TestRawSqlBuilder extends BaseTestCase {
final String sql = "select description from ebasic_clob where id = ?";
List<SqlRow> rows = new ArrayList<>();
final DataSourceConfig config = ((DefaultServer) DB.getDefault()).getServerConfig().getDataSourceConfig();
final DataSourceConfig config = ((DefaultServer) DB.getDefault()).config().getDataSourceConfig();
try (Connection connection = DriverManager.getConnection(config.getUrl(), config.getUsername(), config.getPassword());
PreparedStatement stmt = connection.prepareStatement(sql)) {
@@ -327,7 +327,7 @@ public class TestRawSqlBuilder extends BaseTestCase {
DB.save(pfc);
List<SqlRow> rows = new ArrayList<>();
final DataSourceConfig config = ((DefaultServer) DB.getDefault()).getServerConfig().getDataSourceConfig();
final DataSourceConfig config = ((DefaultServer) DB.getDefault()).config().getDataSourceConfig();
final String sql = "select content from persistent_file_content where id = ?";
try (Connection connection = DriverManager.getConnection(config.getUrl(), config.getUsername(), config.getPassword());
@@ -22,7 +22,7 @@ public class DocStoreDeleteEventTest {
static EbeanServer server = Ebean.getDefaultServer();
<T> BeanType<T> beanType(Class<T> cls) {
return server.pluginApi().getBeanType(cls);
return server.pluginApi().beanType(cls);
}
BeanType<Order> orderType() {
@@ -20,7 +20,7 @@ public class DocStoreIndexEventTest {
static EbeanServer server = Ebean.getDefaultServer();
<T> BeanType<T> beanType(Class<T> cls) {
return server.pluginApi().getBeanType(cls);
return server.pluginApi().beanType(cls);
}
BeanType<Order> orderType() {
@@ -33,7 +33,7 @@ public class TestDPersonEl {
SpiServer server = Ebean.getDefaultServer().pluginApi();
BeanType<DPerson> descriptor = server.getBeanType(DPerson.class);
BeanType<DPerson> descriptor = server.beanType(DPerson.class);
JsonContext jsonContext = server.json();
@@ -21,7 +21,7 @@ public class TestPathExpression {
public TestPathExpression() {
SpiServer server = Ebean.getDefaultServer().pluginApi();
beanType = server.getBeanType(Customer.class);
beanType = server.beanType(Customer.class);
billingId = beanType.getExpressionPath("billingAddress.id");
line1 = beanType.getExpressionPath("billingAddress.line1");
city = beanType.getExpressionPath("billingAddress.city");
@@ -37,7 +37,7 @@ public class TestDbJson_Jackson extends BaseTestCase {
bean.getValueMap().put(1, "one");
bean.getValueMap().put(2, "two");
ObjectMapper mapper = (ObjectMapper) Ebean.getDefaultServer().pluginApi().getServerConfig().getObjectMapper();
ObjectMapper mapper = (ObjectMapper) Ebean.getDefaultServer().pluginApi().config().getObjectMapper();
String json = mapper.writeValueAsString(bean);
EBasicJsonJackson found = mapper.readValue(json, EBasicJsonJackson.class);
@@ -83,7 +83,7 @@ public class TestDbJson_Jackson extends BaseTestCase {
bean.getValueMap().put(1, new StringJacksonType("A"));
bean.getValueMap().put(2, new LongJacksonType(7l));
ObjectMapper mapper = (ObjectMapper) Ebean.getDefaultServer().pluginApi().getServerConfig().getObjectMapper();
ObjectMapper mapper = (ObjectMapper) Ebean.getDefaultServer().pluginApi().config().getObjectMapper();
String json = mapper.writeValueAsString(bean);
assertThat(json)
@@ -34,7 +34,7 @@ public class TestDbJson_Jackson2 extends BaseTestCase {
bean.getValueMap().put(1, new StringJacksonType("A"));
bean.getValueMap().put(2, new LongJacksonType(7l));
ObjectMapper mapper = (ObjectMapper) Ebean.getDefaultServer().pluginApi().getServerConfig().getObjectMapper();
ObjectMapper mapper = (ObjectMapper) Ebean.getDefaultServer().pluginApi().config().getObjectMapper();
String json = mapper.writeValueAsString(bean);
found = mapper.readValue(json, EBasicJsonJackson2.class);
@@ -20,7 +20,7 @@ public class TestEmbeddedManyToOne extends BaseTestCase {
ResetBasicData.reset();
BeanType<EAddr> embType = Ebean.getDefaultServer().pluginApi().getBeanType(EAddr.class);
BeanType<EAddr> embType = Ebean.getDefaultServer().pluginApi().beanType(EAddr.class);
Ebean.getDefaultServer().cacheManager().clearAll();
@@ -233,7 +233,7 @@ public class TestQueryFindIterate extends BaseTestCase {
ResetBasicData.reset();
SpiServer pluginApi = server().pluginApi();
DataSourcePool dsPool = (DataSourcePool) pluginApi.getServerConfig().getReadOnlyDataSource();
DataSourcePool dsPool = (DataSourcePool) pluginApi.config().getReadOnlyDataSource();
if (dsPool == null) {
dsPool = (DataSourcePool) server().dataSource();
}
@@ -37,7 +37,7 @@ public class TestNativeILikeExpression extends BaseTestCase {
private boolean isExpectNative() {
SpiServer pluginApi = server().pluginApi();
boolean expressionNativeIlike = pluginApi.getServerConfig().isExpressionNativeIlike();
boolean expressionNativeIlike = pluginApi.config().isExpressionNativeIlike();
Platform platform = pluginApi.platform().base();
return expressionNativeIlike && platform == Platform.POSTGRES;
@@ -16,7 +16,7 @@ public class TestTextJsonInvokeLazy extends BaseTestCase {
@Before
public void clearBeanCache() {
server().pluginApi().getBeanType(Customer.class).clearBeanCache();
server().pluginApi().beanType(Customer.class).clearBeanCache();
}
@Test
@@ -216,7 +216,7 @@ public class TestNewTypes extends BaseTestCase {
private void testSetGetPath(SomeNewTypesBean refBean) {
SomeNewTypesBean testBean = new SomeNewTypesBean();
BeanType<SomeNewTypesBean> beanType = DB.getDefault().pluginApi().getBeanType(SomeNewTypesBean.class);
BeanType<SomeNewTypesBean> beanType = DB.getDefault().pluginApi().beanType(SomeNewTypesBean.class);
ExpressionPath localDate = beanType.getExpressionPath("localDate");
ExpressionPath localDateTime = beanType.getExpressionPath("localDateTime");
ExpressionPath offsetDateTime = beanType.getExpressionPath("offsetDateTime");