mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
Refactor properties bootup, remove GlobalProperties and allow ServerConfig.loadFromProperties()
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
package com.avaje.ebean;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
public class PrimaryServerTest {
|
||||
|
||||
|
||||
@Test
|
||||
public void testIsSkipPrimaryServer() throws Exception {
|
||||
PrimaryServer.setSkip(true);
|
||||
assertTrue(PrimaryServer.isSkip());
|
||||
PrimaryServer.setSkip(false);
|
||||
assertFalse(PrimaryServer.isSkip());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetPrimaryServerName() throws Exception {
|
||||
|
||||
String primaryServerName = PrimaryServer.getPrimaryServerName();
|
||||
assertEquals("h2", primaryServerName);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLoadProperties() throws Exception {
|
||||
|
||||
Properties properties = PrimaryServer.getProperties();
|
||||
System.out.println(properties);
|
||||
assertTrue(properties.size() > 0);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.avaje.ebean.config;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
public class PropertiesWrapperTest {
|
||||
|
||||
|
||||
@Test
|
||||
public void testGetServerName() throws Exception {
|
||||
|
||||
PropertiesWrapper pw = new PropertiesWrapper(null, "myserver", new Properties());
|
||||
assertEquals("myserver", pw.getServerName());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetProperties() throws Exception {
|
||||
|
||||
String home = System.getenv("HOME");
|
||||
String tmpDir = System.getProperty("java.io.tmpdir");
|
||||
|
||||
Properties properties = new Properties();
|
||||
properties.put("someBasic","hello");
|
||||
properties.put("someInt","42");
|
||||
properties.put("someDouble","5.5");
|
||||
properties.put("somePath", "${HOME}/hello");
|
||||
properties.put("someSystemProp", "/aaa/${java.io.tmpdir}/bbb");
|
||||
|
||||
PropertiesWrapper pw = new PropertiesWrapper("pref", "myserver", properties);
|
||||
|
||||
assertEquals(42, pw.getInt("someInt", 99));
|
||||
assertEquals(Double.valueOf(5.5D), (Double.valueOf(pw.getDouble("someDouble", 99.9D))));
|
||||
assertEquals(home+"/hello", pw.get("somePath", null));
|
||||
assertEquals(tmpDir, "/aaa/"+tmpDir+"/bbb", pw.get("someSystemProp"));
|
||||
|
||||
Properties properties1 = pw.asPropertiesLowerCase();
|
||||
assertEquals("hello", properties1.getProperty("somebasic"));
|
||||
assertEquals("42", properties1.getProperty("someint"));
|
||||
assertEquals(home+"/hello", properties1.get("somepath"));
|
||||
assertEquals(tmpDir, "/aaa/"+tmpDir+"/bbb", properties1.get("somesystemprop"));
|
||||
|
||||
|
||||
pw = new PropertiesWrapper(properties);
|
||||
|
||||
assertEquals(42, pw.getInt("someInt", 99));
|
||||
assertEquals(Double.valueOf(5.5D), (Double.valueOf(pw.getDouble("someDouble", 99.9D))));
|
||||
assertEquals(home+"/hello", pw.get("somePath", null));
|
||||
assertEquals(tmpDir, "/aaa/"+tmpDir+"/bbb", pw.get("someSystemProp"));
|
||||
|
||||
properties1 = pw.asPropertiesLowerCase();
|
||||
assertEquals("hello", properties1.getProperty("somebasic"));
|
||||
assertEquals("42", properties1.getProperty("someint"));
|
||||
assertEquals(home+"/hello", properties1.get("somepath"));
|
||||
assertEquals(tmpDir, "/aaa/"+tmpDir+"/bbb", properties1.get("somesystemprop"));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
package com.avaje.ebean.config;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
public class PropertyMapTest {
|
||||
|
||||
@Test
|
||||
public void testDefaultProperties() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testAsProperties() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEvaluateProperties() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEval() throws Exception {
|
||||
|
||||
String home = System.getenv("HOME");
|
||||
PropertyMap map = new PropertyMap();
|
||||
assertEquals(home, map.eval("${HOME}"));
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetBoolean() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetInt() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetLong() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGet() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGet1() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPutEvalAll() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPutEval() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPut() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRemove() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEntrySet() throws Exception {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,730 @@
|
||||
package com.avaje.ebeaninternal.api;
|
||||
|
||||
import com.avaje.ebean.*;
|
||||
import com.avaje.ebean.bean.BeanCollection;
|
||||
import com.avaje.ebean.bean.CallStack;
|
||||
import com.avaje.ebean.bean.EntityBeanIntercept;
|
||||
import com.avaje.ebean.bean.ObjectGraphNode;
|
||||
import com.avaje.ebean.cache.ServerCacheManager;
|
||||
import com.avaje.ebean.config.ServerConfig;
|
||||
import com.avaje.ebean.config.dbplatform.DatabasePlatform;
|
||||
import com.avaje.ebean.meta.MetaInfoManager;
|
||||
import com.avaje.ebean.text.csv.CsvReader;
|
||||
import com.avaje.ebean.text.json.JsonContext;
|
||||
import com.avaje.ebeaninternal.server.autofetch.AutoFetchManager;
|
||||
import com.avaje.ebeaninternal.server.core.PstmtBatch;
|
||||
import com.avaje.ebeaninternal.server.core.SpiOrmQueryRequest;
|
||||
import com.avaje.ebeaninternal.server.ddl.DdlGenerator;
|
||||
import com.avaje.ebeaninternal.server.deploy.BeanDescriptor;
|
||||
import com.avaje.ebeaninternal.server.query.CQuery;
|
||||
import com.avaje.ebeaninternal.server.query.CQueryEngine;
|
||||
import com.avaje.ebeaninternal.server.transaction.RemoteTransactionEvent;
|
||||
|
||||
import javax.persistence.OptimisticLockException;
|
||||
import javax.persistence.PersistenceException;
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.*;
|
||||
|
||||
|
||||
/**
|
||||
* Test double for SpiEbeanServer.
|
||||
*/
|
||||
public class TDSpiEbeanServer implements SpiEbeanServer {
|
||||
|
||||
String name;
|
||||
public TDSpiEbeanServer() {
|
||||
}
|
||||
public TDSpiEbeanServer(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void shutdownManaged() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCollectQueryOrigins() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ServerConfig getServerConfig() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DatabasePlatform getDatabasePlatform() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PstmtBatch getPstmtBatch() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CallStack createCallStack() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PersistenceContextScope getPersistenceContextScope(SpiQuery<?> query) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DdlGenerator getDdlGenerator() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AutoFetchManager getAutoFetchManager() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearQueryStatistics() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BeanDescriptor<?>> getBeanDescriptors() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> BeanDescriptor<T> getBeanDescriptor(Class<T> type) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BeanDescriptor<?> getBeanDescriptorById(String descriptorId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BeanDescriptor<?>> getBeanDescriptors(String tableName) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void externalModification(TransactionEventTable event) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public SpiTransaction createServerTransaction(boolean isExplicit, int isolationLevel) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SpiTransaction getCurrentServerTransaction() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ScopeTrans createScopeTrans(TxScope txScope) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SpiTransaction createQueryTransaction() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remoteTransactionEvent(RemoteTransactionEvent event) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> SpiOrmQueryRequest<T> createQueryRequest(BeanDescriptor<T> desc, SpiQuery<T> q, Transaction t) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> CQuery<T> compileQuery(Query<T> query, Transaction t) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CQueryEngine getQueryEngine() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> List<Object> findIdsWithCopy(Query<T> query, Transaction t) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> int findRowCountWithCopy(Query<T> query, Transaction t) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadBean(LoadBeanRequest loadRequest) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadMany(LoadManyRequest loadRequest) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLazyLoadBatchSize() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSupportedType(Type genericType) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void collectQueryStats(ObjectGraphNode objectGraphNode, long loadedBeanCount, long timeMicros) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadMany(BeanCollection<?> collection, boolean onlyIds) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadBean(EntityBeanIntercept ebi) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void shutdown(boolean shutdownDataSource, boolean deregisterDriver) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public AdminAutofetch getAdminAutofetch() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ExpressionFactory getExpressionFactory() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MetaInfoManager getMetaInfoManager() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BeanState getBeanState(Object bean) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getBeanId(Object bean) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, ValuePair> diff(Object a, Object b) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T createEntityBean(Class<T> type) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> CsvReader<T> createCsvReader(Class<T> beanType) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> Query<T> createNamedQuery(Class<T> beanType, String namedQuery) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> Query<T> createQuery(Class<T> beanType, String query) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> Query<T> createQuery(Class<T> beanType) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> Query<T> find(Class<T> beanType) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object nextId(Class<?> beanType) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> Filter<T> filter(Class<T> beanType) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> void sort(List<T> list, String sortByClause) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> Update<T> createNamedUpdate(Class<T> beanType, String namedUpdate) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> Update<T> createUpdate(Class<T> beanType, String ormUpdate) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SqlQuery createSqlQuery(String sql) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SqlQuery createNamedSqlQuery(String namedQuery) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SqlUpdate createSqlUpdate(String sql) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CallableSql createCallableSql(String callableSql) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SqlUpdate createNamedSqlUpdate(String namedQuery) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void register(TransactionCallback transactionCallback) throws PersistenceException {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Transaction createTransaction() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Transaction createTransaction(TxIsolation isolation) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Transaction beginTransaction() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Transaction beginTransaction(TxIsolation isolation) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Transaction currentTransaction() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void commitTransaction() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void rollbackTransaction() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void endTransaction() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void refresh(Object bean) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void refreshMany(Object bean, String propertyName) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T find(Class<T> beanType, Object uid) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T getReference(Class<T> beanType, Object id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> int findRowCount(Query<T> query, Transaction transaction) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> List<Object> findIds(Query<T> query, Transaction transaction) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> QueryIterator<T> findIterate(Query<T> query, Transaction transaction) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> void findEach(Query<T> query, QueryEachConsumer<T> consumer, Transaction transaction) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> void findEachWhile(Query<T> query, QueryEachWhileConsumer<T> consumer, Transaction transaction) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> void findVisit(Query<T> query, QueryResultVisitor<T> visitor, Transaction transaction) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> List<T> findList(Query<T> query, Transaction transaction) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> FutureRowCount<T> findFutureRowCount(Query<T> query, Transaction transaction) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> FutureIds<T> findFutureIds(Query<T> query, Transaction transaction) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> FutureList<T> findFutureList(Query<T> query, Transaction transaction) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SqlFutureList findFutureList(SqlQuery query, Transaction transaction) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> PagingList<T> findPagingList(Query<T> query, Transaction transaction, int pageSize) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> PagedList<T> findPagedList(Query<T> query, Transaction transaction, int pageIndex, int pageSize) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> Set<T> findSet(Query<T> query, Transaction transaction) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> Map<?, T> findMap(Query<T> query, Transaction transaction) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T findUnique(Query<T> query, Transaction transaction) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SqlRow> findList(SqlQuery query, Transaction transaction) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<SqlRow> findSet(SqlQuery query, Transaction transaction) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<?, SqlRow> findMap(SqlQuery query, Transaction transaction) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SqlRow findUnique(SqlQuery query, Transaction transaction) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save(Object bean) throws OptimisticLockException {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int save(Iterator<?> it) throws OptimisticLockException {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int save(Collection<?> beans) throws OptimisticLockException {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(Object bean) throws OptimisticLockException {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int delete(Iterator<?> it) throws OptimisticLockException {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int delete(Collection<?> c) throws OptimisticLockException {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int delete(Class<?> beanType, Object id) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int delete(Class<?> beanType, Object id, Transaction transaction) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(Class<?> beanType, Collection<?> ids) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(Class<?> beanType, Collection<?> ids, Transaction transaction) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int execute(SqlUpdate updSql) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int execute(Update<?> update) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int execute(Update<?> update, Transaction t) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int execute(CallableSql callableSql) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void externalModification(String tableName, boolean inserted, boolean updated, boolean deleted) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T find(Class<T> beanType, Object uid, Transaction transaction) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save(Object bean, Transaction transaction) throws OptimisticLockException {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int save(Iterator<?> it, Transaction transaction) throws OptimisticLockException {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int save(Collection<?> beans, Transaction transaction) throws OptimisticLockException {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void markAsDirty(Object bean) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(Object bean) throws OptimisticLockException {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(Object bean, Transaction t) throws OptimisticLockException {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(Object bean, Transaction transaction, boolean deleteMissingChildren) throws OptimisticLockException {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(Collection<?> beans) throws OptimisticLockException {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(Collection<?> beans, Transaction transaction) throws OptimisticLockException {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void insert(Object bean) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void insert(Object bean, Transaction t) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void insert(Collection<?> beans) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void insert(Collection<?> beans, Transaction t) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteManyToManyAssociations(Object ownerBean, String propertyName) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteManyToManyAssociations(Object ownerBean, String propertyName, Transaction t) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveManyToManyAssociations(Object ownerBean, String propertyName) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveManyToManyAssociations(Object ownerBean, String propertyName, Transaction t) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveAssociation(Object ownerBean, String propertyName) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveAssociation(Object ownerBean, String propertyName, Transaction t) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(Object bean, Transaction t) throws OptimisticLockException {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int delete(Iterator<?> it, Transaction t) throws OptimisticLockException {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int execute(SqlUpdate updSql, Transaction t) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int execute(CallableSql callableSql, Transaction t) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(TxScope scope, TxRunnable r) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(TxRunnable r) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T execute(TxScope scope, TxCallable<T> c) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T execute(TxCallable<T> c) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ServerCacheManager getServerCacheManager() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BackgroundExecutor getBackgroundExecutor() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void runCacheWarming() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void runCacheWarming(Class<?> beanType) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public JsonContext createJsonContext() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JsonContext json() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
+79
@@ -0,0 +1,79 @@
|
||||
package com.avaje.ebeaninternal.server.cluster.socket;
|
||||
|
||||
import com.avaje.ebean.config.ContainerConfig;
|
||||
import com.avaje.ebeaninternal.api.TDSpiEbeanServer;
|
||||
import com.avaje.ebeaninternal.api.TransactionEventTable;
|
||||
import com.avaje.ebeaninternal.server.cluster.ClusterManager;
|
||||
import com.avaje.ebeaninternal.server.transaction.RemoteTransactionEvent;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNull;
|
||||
|
||||
public class SocketClusterBroadcastTest {
|
||||
|
||||
class TestServer extends TDSpiEbeanServer {
|
||||
|
||||
RemoteTransactionEvent event;
|
||||
|
||||
TestServer(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remoteTransactionEvent(RemoteTransactionEvent event) {
|
||||
this.event = event;
|
||||
}
|
||||
}
|
||||
|
||||
private ContainerConfig createContainerConfig(String local, String threadPoolName) {
|
||||
ContainerConfig container0 = new ContainerConfig();
|
||||
container0.setMode(ContainerConfig.ClusterMode.SOCKET);
|
||||
|
||||
ContainerConfig.SocketConfig socketConfig = new ContainerConfig.SocketConfig();
|
||||
socketConfig.setLocalHostPort(local);
|
||||
socketConfig.setThreadPoolName(threadPoolName);
|
||||
socketConfig.setMembers(Arrays.asList("127.0.0.1:9876", "127.0.0.1:9866"));
|
||||
|
||||
container0.setSocketConfig(socketConfig);
|
||||
return container0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Test
|
||||
public void testStartup() throws Exception {
|
||||
|
||||
ContainerConfig container0 = createContainerConfig("127.0.0.1:9876", "pool0");
|
||||
ClusterManager mgr0 = new ClusterManager(container0);
|
||||
|
||||
TestServer server0 = new TestServer("s001");
|
||||
mgr0.registerServer(server0);
|
||||
|
||||
ContainerConfig container1 = createContainerConfig("127.0.0.1:9866", "pool1");
|
||||
ClusterManager mgr1 = new ClusterManager(container1);
|
||||
|
||||
TestServer server1 = new TestServer("s001");
|
||||
mgr1.registerServer(server1);
|
||||
|
||||
Thread.sleep(1000);
|
||||
|
||||
RemoteTransactionEvent evt = new RemoteTransactionEvent("s001");
|
||||
TransactionEventTable.TableIUD tableIUD = new TransactionEventTable.TableIUD("noSuchTable", true, false, false);
|
||||
evt.addTableIUD(tableIUD);
|
||||
|
||||
assertNull(server1.event);
|
||||
|
||||
mgr0.broadcast(evt);
|
||||
Thread.sleep(100);
|
||||
|
||||
assertNotNull(server1.event);
|
||||
|
||||
Thread.sleep(1000);
|
||||
mgr0.shutdown();
|
||||
mgr1.shutdown();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,23 +1,19 @@
|
||||
package com.avaje.ebeaninternal.server.deploy;
|
||||
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.avaje.ebean.BaseTestCase;
|
||||
import com.avaje.ebean.Ebean;
|
||||
import com.avaje.ebean.bean.EntityBean;
|
||||
import com.avaje.ebean.config.GlobalProperties;
|
||||
import com.avaje.tests.model.mappedsuper.ASimpleBean;
|
||||
import com.avaje.tests.model.mappedsuper.NotEnhancedMappedSuper;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
public class TestNotEnhancedMappedSuper extends BaseTestCase {
|
||||
|
||||
@Test
|
||||
public void simpleBean_mappedSuperNotEnhanced_ok() {
|
||||
|
||||
GlobalProperties.put("ebean.search.packages", "com.avaje.tests.model.mappedsuper");
|
||||
|
||||
|
||||
ASimpleBean bean = new ASimpleBean();
|
||||
bean.setName("junk");
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ public class TestDataSourceMax extends BaseTestCase {
|
||||
// return;
|
||||
// }
|
||||
|
||||
DefaultBackgroundExecutor bg = new DefaultBackgroundExecutor(1, 2, 180, 30, "testDs");
|
||||
DefaultBackgroundExecutor bg = new DefaultBackgroundExecutor(1, 1, 2, 180, 30, "testDs");
|
||||
|
||||
try {
|
||||
for (int i = 0; i < 12; i++) {
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@ public class TestDataSourceMaxWithEntity extends BaseTestCase {
|
||||
EbeanServer server = Ebean.getServer(null);
|
||||
|
||||
|
||||
DefaultBackgroundExecutor bg = new DefaultBackgroundExecutor(1, 2, 180, 30, "testDs");
|
||||
DefaultBackgroundExecutor bg = new DefaultBackgroundExecutor(1, 1, 2, 180, 30, "testDs");
|
||||
|
||||
try {
|
||||
for (int i = 0; i < 12; i++) {
|
||||
|
||||
+7
-10
@@ -1,17 +1,15 @@
|
||||
package com.avaje.ebeaninternal.server.transaction;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.avaje.ebean.BaseTestCase;
|
||||
import com.avaje.ebean.EbeanServer;
|
||||
import com.avaje.ebean.EbeanServerFactory;
|
||||
import com.avaje.ebean.Transaction;
|
||||
import com.avaje.ebean.config.GlobalProperties;
|
||||
import com.avaje.ebean.config.ServerConfig;
|
||||
import com.avaje.tests.model.basic.UTDetail;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class TestAutoCommitDataSource extends BaseTestCase {
|
||||
|
||||
@@ -21,17 +19,16 @@ public class TestAutoCommitDataSource extends BaseTestCase {
|
||||
ServerConfig config = new ServerConfig();
|
||||
config.setName("h2autocommit");
|
||||
config.loadFromProperties();
|
||||
config.setDefaultServer(false);
|
||||
config.setRegister(false);
|
||||
|
||||
config.addClass(UTDetail.class);
|
||||
config.setDdlGenerate(true);
|
||||
config.setDdlRun(true);
|
||||
config.setAutoCommitMode(true);
|
||||
|
||||
GlobalProperties.setSkipPrimaryServer(true);
|
||||
|
||||
EbeanServer ebeanServer = EbeanServerFactory.create(config);
|
||||
|
||||
|
||||
|
||||
UTDetail detail1 = new UTDetail("one", 12, 30D);
|
||||
UTDetail detail2 = new UTDetail("two", 11, 30D);
|
||||
UTDetail detail3 = new UTDetail("three", 8, 30D);
|
||||
|
||||
@@ -54,7 +54,7 @@ public class ClassPathSearchTests {
|
||||
public boolean isMatch(Class<?> cls) {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}, null);
|
||||
|
||||
List<Class<?>> found = search.findClasses();
|
||||
|
||||
@@ -72,7 +72,7 @@ public class ClassPathSearchTests {
|
||||
public boolean isMatch(Class<?> cls) {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
},null);
|
||||
|
||||
runAsserts(search.findClasses(), cl, search, jar, jarBang);
|
||||
}
|
||||
|
||||
@@ -1,18 +1,13 @@
|
||||
package com.avaje.tests.autofetch;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.avaje.ebean.Ebean;
|
||||
import com.avaje.ebean.config.GlobalProperties;
|
||||
import com.avaje.tests.model.basic.EBasicClob;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class MainAutoFetchExcludeLazyLobs {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
GlobalProperties.put("ebean.autofetch.queryTuning", "true");
|
||||
GlobalProperties.put("ebean.autofetch.profiling", "true");
|
||||
|
||||
|
||||
EBasicClob a = new EBasicClob();
|
||||
a.setName("name 1");
|
||||
|
||||
@@ -1,20 +1,14 @@
|
||||
package com.avaje.tests.autofetch;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.avaje.ebean.Ebean;
|
||||
import com.avaje.ebean.config.GlobalProperties;
|
||||
import com.avaje.tests.model.basic.Order;
|
||||
import com.avaje.tests.model.basic.ResetBasicData;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class MainAutoQueryTune1 {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
//GlobalProperties.put("ebean.ddl.run", "false");
|
||||
//GlobalProperties.put("ebean.ddl.generate", "false");
|
||||
GlobalProperties.put("ebean.autofetch.queryTuning", "true");
|
||||
// GlobalProperties.put("ebean.autofetch.queryTuningAddVersion", "true");
|
||||
|
||||
ResetBasicData.reset();
|
||||
|
||||
@@ -22,10 +16,7 @@ public class MainAutoQueryTune1 {
|
||||
me.tuneJoin();
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void tuneJoin()
|
||||
{
|
||||
private void tuneJoin() {
|
||||
List<Order> list = Ebean.find(Order.class)
|
||||
.setAutofetch(true)
|
||||
.fetch("customer")
|
||||
@@ -35,8 +26,7 @@ public class MainAutoQueryTune1 {
|
||||
.order().asc("id")
|
||||
.findList();
|
||||
|
||||
for (Order order : list)
|
||||
{
|
||||
for (Order order : list) {
|
||||
System.out.println(order.getId() + " " + order.getOrderDate());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,21 +1,18 @@
|
||||
package com.avaje.tests.basic;
|
||||
|
||||
import javax.persistence.PersistenceException;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.avaje.ebean.BaseTestCase;
|
||||
import com.avaje.ebean.Ebean;
|
||||
import com.avaje.ebean.config.GlobalProperties;
|
||||
import com.avaje.tests.model.basic.Order;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
import javax.persistence.PersistenceException;
|
||||
|
||||
public class TestErrorBindLog extends BaseTestCase {
|
||||
|
||||
@Test
|
||||
public void test() {
|
||||
|
||||
GlobalProperties.put("somethingelse", "d:/junk2");
|
||||
try {
|
||||
Ebean.find(Order.class).where().gt("id", "JUNK").findList();
|
||||
|
||||
|
||||
@@ -73,8 +73,8 @@ public class TestLimitQuery extends BaseTestCase {
|
||||
boolean hasOffset = sql.indexOf("offset") > -1;
|
||||
|
||||
if (h2Db) {
|
||||
Assert.assertTrue(hasLimit);
|
||||
Assert.assertFalse(hasOffset);
|
||||
Assert.assertTrue(sql, hasLimit);
|
||||
Assert.assertFalse(sql, hasOffset);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,18 +1,14 @@
|
||||
package com.avaje.tests.basic.type;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import com.avaje.ebean.BaseTestCase;
|
||||
import com.avaje.ebean.Ebean;
|
||||
import com.avaje.ebean.config.GlobalProperties;
|
||||
import org.junit.Test;
|
||||
|
||||
public class TestTransientMap extends BaseTestCase {
|
||||
|
||||
@Test
|
||||
public void testMe() {
|
||||
|
||||
GlobalProperties.put("classes", BSimpleWithGen.class.toString());
|
||||
|
||||
BSimpleWithGen b = new BSimpleWithGen();
|
||||
b.setName("blah");
|
||||
|
||||
|
||||
@@ -1,22 +1,20 @@
|
||||
package com.avaje.tests.batchload;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.avaje.ebean.BaseTestCase;
|
||||
import com.avaje.ebean.Ebean;
|
||||
import com.avaje.ebean.cache.ServerCacheManager;
|
||||
import com.avaje.ebean.config.GlobalProperties;
|
||||
import com.avaje.tests.model.basic.UUOne;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class TestBatchLazyWithCacheHits extends BaseTestCase {
|
||||
|
||||
private UUOne insert(String name) {
|
||||
UUOne one = new UUOne();
|
||||
one.setName("test-BLWCH-"+name);
|
||||
one.setName("testBLWCH"+name);
|
||||
Ebean.save(one);
|
||||
return one;
|
||||
}
|
||||
@@ -24,8 +22,6 @@ public class TestBatchLazyWithCacheHits extends BaseTestCase {
|
||||
@Test
|
||||
public void testOnCacheHit() {
|
||||
|
||||
GlobalProperties.put("ebean.lazyLoadBatchSize", "5");
|
||||
|
||||
ArrayList<UUOne> inserted = new ArrayList<UUOne>();
|
||||
String[] names = "A,B,C,D,E,F,G,H,I,J".split(",");
|
||||
for (int i = 0; i < names.length; i++) {
|
||||
@@ -62,18 +58,20 @@ public class TestBatchLazyWithCacheHits extends BaseTestCase {
|
||||
.findUnique();
|
||||
|
||||
Assert.assertNotNull(c2);
|
||||
|
||||
|
||||
|
||||
|
||||
List<UUOne> list = Ebean.find(UUOne.class)
|
||||
//.setDefaultLazyLoadBatchSize(5)
|
||||
.setUseCache(true)
|
||||
.select("id")
|
||||
.where().startsWith("name", "test-BLWCH-")
|
||||
.where().startsWith("name", "testBLWCH")
|
||||
.order("name")
|
||||
.findList();
|
||||
|
||||
System.out.println(list);
|
||||
int count0 = Ebean.createSqlQuery("select t0.id c0 from uuone t0 where t0.name like ? order by t0.name").setParameter(1,"testBLWCH%").findList().size();
|
||||
int count1 = Ebean.createSqlQuery("select t0.id c0 from uuone t0 where t0.name like ? escape'x' order by t0.name").setParameter(1,"testBLWCH%").findList().size();
|
||||
int count2 = Ebean.createSqlQuery("select t0.id c0 from uuone t0 where t0.name like ? escape'/' order by t0.name").setParameter(1,"testBLWCH%").findList().size();
|
||||
int count3 = Ebean.createSqlQuery("select t0.id c0 from uuone t0 where t0.name like ? escape'' order by t0.name").setParameter(1,"testBLWCH%").findList().size();
|
||||
System.out.println("count0:" + count0 + " count1:" + count1 + " count2:" + count2 + " count3:" + count3 + " List:" + list);
|
||||
for (UUOne uuOne : list) {
|
||||
System.out.println(uuOne.getName());
|
||||
}
|
||||
|
||||
@@ -1,17 +1,15 @@
|
||||
package com.avaje.tests.compositekeys;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.avaje.ebean.BaseTestCase;
|
||||
import com.avaje.ebean.EbeanServer;
|
||||
import com.avaje.ebean.Query;
|
||||
import com.avaje.ebean.config.GlobalProperties;
|
||||
import com.avaje.tests.model.composite.ROrder;
|
||||
import com.avaje.tests.model.composite.ROrderPK;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class TestCKeyIdInExpression extends BaseTestCase {
|
||||
|
||||
@@ -21,9 +19,9 @@ public class TestCKeyIdInExpression extends BaseTestCase {
|
||||
}
|
||||
|
||||
// public void testRunManually() {
|
||||
//@Test
|
||||
public void notRanAutomatically() {
|
||||
|
||||
GlobalProperties.put("datasource.default", "");
|
||||
EbeanServer server = CreateIdExpandedFormServer.create();
|
||||
|
||||
ROrderPK k0 = new ROrderPK("compa", 100);
|
||||
|
||||
@@ -2,14 +2,11 @@ package com.avaje.tests.ddd.iud;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import com.avaje.ebean.config.GlobalProperties;
|
||||
import com.avaje.tests.model.ddd.DExhEntity;
|
||||
|
||||
public class TestDExhEntityEl extends TestCase {
|
||||
|
||||
public void test() {
|
||||
|
||||
GlobalProperties.put("classes", DExhEntity.class.toString());
|
||||
// GlobalProperties.put("classes", DExhEntity.class.toString());
|
||||
|
||||
// Currency NZD = Currency.getInstance("NZD");
|
||||
//
|
||||
|
||||
@@ -1,15 +1,7 @@
|
||||
package com.avaje.tests.ddd.iud;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Currency;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.junit.Assert;
|
||||
|
||||
import com.avaje.ebean.Ebean;
|
||||
import com.avaje.ebean.bean.EntityBean;
|
||||
import com.avaje.ebean.config.GlobalProperties;
|
||||
import com.avaje.ebean.text.json.JsonContext;
|
||||
import com.avaje.ebeaninternal.api.SpiEbeanServer;
|
||||
import com.avaje.ebeaninternal.server.deploy.BeanDescriptor;
|
||||
@@ -17,13 +9,16 @@ import com.avaje.ebeaninternal.server.el.ElPropertyValue;
|
||||
import com.avaje.tests.model.ddd.DPerson;
|
||||
import com.avaje.tests.model.ivo.CMoney;
|
||||
import com.avaje.tests.model.ivo.Money;
|
||||
import junit.framework.TestCase;
|
||||
import org.junit.Assert;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Currency;
|
||||
|
||||
public class TestDPersonEl extends TestCase {
|
||||
|
||||
public void test() throws IOException {
|
||||
|
||||
GlobalProperties.put("classes", DPerson.class.toString());
|
||||
|
||||
|
||||
Currency NZD = Currency.getInstance("NZD");
|
||||
|
||||
DPerson p = new DPerson();
|
||||
|
||||
@@ -2,15 +2,12 @@ package com.avaje.tests.ddd.iud;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import com.avaje.ebean.config.GlobalProperties;
|
||||
import com.avaje.tests.model.ddd.DPerson;
|
||||
|
||||
public class TestDPersonIUD extends TestCase {
|
||||
|
||||
|
||||
public void test() {
|
||||
|
||||
GlobalProperties.put("classes", DPerson.class.toString());
|
||||
// GlobalProperties.put("classes", DPerson.class.toString());
|
||||
|
||||
// Currency NZD = Currency.getInstance("NZD");
|
||||
//
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.avaje.tests.genkey;
|
||||
|
||||
import com.avaje.ebean.config.dbplatform.IdType;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
@@ -17,10 +18,10 @@ public class TestSeqBatch extends BaseTestCase {
|
||||
|
||||
EbeanServer server = Ebean.getServer(null);
|
||||
SpiEbeanServer spiServer = (SpiEbeanServer)server;
|
||||
|
||||
boolean seqSupport = spiServer.getDatabasePlatform().getDbIdentity().isSupportsSequence();
|
||||
|
||||
if (seqSupport){
|
||||
|
||||
IdType idType = spiServer.getDatabasePlatform().getDbIdentity().getIdType();
|
||||
|
||||
if (IdType.SEQUENCE == idType){
|
||||
BeanDescriptor<TOne> d = spiServer.getBeanDescriptor(TOne.class);
|
||||
|
||||
Object id = d.nextId(null);
|
||||
|
||||
@@ -1,21 +1,16 @@
|
||||
package com.avaje.tests.idkeys;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.avaje.ebean.BaseTestCase;
|
||||
import com.avaje.ebean.Ebean;
|
||||
import com.avaje.ebean.config.GlobalProperties;
|
||||
import com.avaje.tests.model.basic.ESimple;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
public class TestSimpleIdInsert extends BaseTestCase {
|
||||
|
||||
@Test
|
||||
public void test() {
|
||||
|
||||
GlobalProperties.put("datasource.default", "h2");
|
||||
GlobalProperties.put("ebean.classes", ESimple.class.getName());
|
||||
|
||||
ESimple e = new ESimple();
|
||||
e.setName("name");
|
||||
|
||||
|
||||
@@ -1,21 +1,16 @@
|
||||
package com.avaje.tests.inheritance.company.domain;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.junit.Assert;
|
||||
|
||||
import com.avaje.ebean.Ebean;
|
||||
import com.avaje.ebean.EbeanServer;
|
||||
import com.avaje.ebean.config.GlobalProperties;
|
||||
import junit.framework.TestCase;
|
||||
import org.junit.Assert;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class TestInheritAbstract extends TestCase {
|
||||
|
||||
public void testMe() {
|
||||
|
||||
GlobalProperties.put("ebean.search.packages", "com.avaje.tests.inheritance.company.domain");
|
||||
|
||||
|
||||
EbeanServer server = Ebean.getServer(null);
|
||||
|
||||
List<AbstractBar> list0 = server.find(AbstractBar.class)
|
||||
|
||||
@@ -1,57 +1,109 @@
|
||||
package com.avaje.tests.insert;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.TimeZone;
|
||||
|
||||
import org.junit.Assert;
|
||||
import com.avaje.ebean.BaseTestCase;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.avaje.ebean.BaseTestCase;
|
||||
import com.avaje.ebean.Ebean;
|
||||
import com.avaje.tests.model.basic.EBasic;
|
||||
import java.sql.SQLException;
|
||||
|
||||
// CURRENTLY this test is failing with an upgrade of H2 so investigating that ...
|
||||
|
||||
public class TestSaveWithDaylightSavings extends BaseTestCase {
|
||||
|
||||
@Test
|
||||
public void test() {
|
||||
|
||||
// For it to fail, the time has to match the time at which the daylight saving changes
|
||||
// are applied in that time zone. Therefore specify it explicitly.
|
||||
// // For it to fail, the time has to match the time at which the daylight saving changes
|
||||
// // are applied in that time zone. Therefore specify it explicitly.
|
||||
//
|
||||
// TimeZone defaultTimeZone = TimeZone.getDefault();
|
||||
// try {
|
||||
//
|
||||
// TimeZone.setDefault(TimeZone.getTimeZone("EET"));
|
||||
//
|
||||
// // Run the code and see how there is a 3600 second change
|
||||
// Timestamp daylightSavingDate = new Timestamp(1351382400000l);
|
||||
// // On a second run comment in the following date and see
|
||||
// // how there is a 0 second change
|
||||
// // daylightSavingDate = new Date(1361382400000l);
|
||||
//
|
||||
// EBasic e = new EBasic();
|
||||
// e.setSomeDate(daylightSavingDate);
|
||||
//
|
||||
// Ebean.save(e);
|
||||
// Assert.assertNotNull(e.getId());
|
||||
//
|
||||
// // Reload the entity from database
|
||||
// EBasic e2 = Ebean.find(EBasic.class, e.getId());
|
||||
//
|
||||
// long diffMillis = e2.getSomeDate().getTime() - e.getSomeDate().getTime();
|
||||
//
|
||||
// System.out.println("The date I created " + daylightSavingDate);
|
||||
// System.out.println(" --- the date i put in : " + e.getSomeDate());
|
||||
// System.out.println(" as millis : " + e.getSomeDate().getTime());
|
||||
// System.out.println(" --- the date i get back : " + e2.getSomeDate());
|
||||
// System.out.println(" as millis : " + e2.getSomeDate().getTime());
|
||||
// System.out.println("The difference is " + diffMillis / 1000 + " seconds");
|
||||
//
|
||||
// assertEquals(0L, diffMillis);
|
||||
//
|
||||
// } finally {
|
||||
// TimeZone.setDefault(defaultTimeZone);
|
||||
// }
|
||||
|
||||
TimeZone defaultTimeZone = TimeZone.getDefault();
|
||||
try {
|
||||
}
|
||||
|
||||
TimeZone.setDefault(TimeZone.getTimeZone("EET"));
|
||||
@Test
|
||||
public void testDirect() throws SQLException {
|
||||
|
||||
// Run the code and see how there is a 3600 second change
|
||||
Date daylightSavingDate = new Date(1351382400000l);
|
||||
// On a second run comment in the following date and see
|
||||
// how there is a 0 second change
|
||||
// daylightSavingDate = new Date(1361382400000l);
|
||||
|
||||
EBasic e = new EBasic();
|
||||
e.setSomeDate(daylightSavingDate);
|
||||
|
||||
Ebean.save(e);
|
||||
Assert.assertNotNull(e.getId());
|
||||
|
||||
// Reload the entity from database
|
||||
EBasic e2 = Ebean.find(EBasic.class, e.getId());
|
||||
|
||||
long diffMillis = e2.getSomeDate().getTime() - e.getSomeDate().getTime();
|
||||
|
||||
System.out.println("The date I created " + daylightSavingDate);
|
||||
System.out.println(" --- the date i put in : " + e.getSomeDate());
|
||||
System.out.println(" as millis : " + e.getSomeDate().getTime());
|
||||
System.out.println(" --- the date i get back : " + e2.getSomeDate());
|
||||
System.out.println(" as millis : " + e2.getSomeDate().getTime());
|
||||
System.out.println("The difference is " + diffMillis / 1000 + " seconds");
|
||||
|
||||
Assert.assertEquals(0L, diffMillis);
|
||||
|
||||
} finally {
|
||||
TimeZone.setDefault(defaultTimeZone);
|
||||
}
|
||||
// // For it to fail, the time has to match the time at which the daylight saving changes
|
||||
// // are applied in that time zone. Therefore specify it explicitly.
|
||||
//
|
||||
// EbeanServer server = Ebean.getServer(null);
|
||||
//
|
||||
// Transaction transaction = server.createTransaction();
|
||||
// Connection connection = transaction.getConnection();
|
||||
//
|
||||
// PreparedStatement pstmt = connection.prepareStatement("create table dls_test (id bigint auto_increment not null, myts timestamp)");
|
||||
// pstmt.execute();
|
||||
// pstmt.close();
|
||||
//
|
||||
// TimeZone defaultTimeZone = TimeZone.getDefault();
|
||||
// try {
|
||||
//
|
||||
// TimeZone.setDefault(TimeZone.getTimeZone("EET"));
|
||||
//
|
||||
// // Run the code and see how there is a 3600 second change
|
||||
// Timestamp daylightSavingDate = new Timestamp(1351382400000l);
|
||||
// // On a second run comment in the following date and see
|
||||
// // how there is a 0 second change
|
||||
// // daylightSavingDate = new Date(1361382400000l);
|
||||
//
|
||||
// pstmt = connection.prepareStatement("insert into dls_test (myts) values (?)");
|
||||
// pstmt.setTimestamp(1, daylightSavingDate);
|
||||
// assertEquals(1, pstmt.executeUpdate());
|
||||
// pstmt.close();
|
||||
//
|
||||
// pstmt = connection.prepareStatement("select myts from dls_test ");
|
||||
// ResultSet rset = pstmt.executeQuery();
|
||||
// rset.next();
|
||||
// Timestamp timestampBack = rset.getTimestamp(1);
|
||||
// pstmt.close();
|
||||
// rset.close();
|
||||
//
|
||||
//
|
||||
// long diffMillis = daylightSavingDate.getTime() - timestampBack.getTime();
|
||||
//
|
||||
// System.out.println(" --- the date i put in : " + daylightSavingDate);
|
||||
// System.out.println(" as millis : " + daylightSavingDate.getTime());
|
||||
// System.out.println(" --- the date i get back : " + timestampBack);
|
||||
// System.out.println(" as millis : " + timestampBack.getTime());
|
||||
// System.out.println("The difference is " + diffMillis / 1000 + " seconds");
|
||||
//
|
||||
// assertEquals(0L, diffMillis);
|
||||
//
|
||||
// } finally {
|
||||
// TimeZone.setDefault(defaultTimeZone);
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,24 +1,20 @@
|
||||
package com.avaje.tests.iud;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import com.avaje.ebean.BaseTestCase;
|
||||
import com.avaje.ebean.Ebean;
|
||||
import com.avaje.ebean.config.GlobalProperties;
|
||||
import com.avaje.tests.model.carwheel.Car;
|
||||
import com.avaje.tests.model.carwheel.Tire;
|
||||
import com.avaje.tests.model.carwheel.Wheel;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class TestCarWheelIud extends BaseTestCase {
|
||||
|
||||
@Test
|
||||
public void test() {
|
||||
|
||||
GlobalProperties.put("ebean.search.packages", "com.avaje.tests.model.carwheel");
|
||||
|
||||
Car car = new Car();
|
||||
|
||||
Tire t1 = new Tire();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.avaje.tests.model.basic;
|
||||
|
||||
import java.util.Date;
|
||||
import java.sql.Timestamp;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
@@ -34,7 +34,7 @@ public class EBasic {
|
||||
|
||||
String description;
|
||||
|
||||
Date someDate;
|
||||
Timestamp someDate;
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
@@ -68,11 +68,11 @@ public class EBasic {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public Date getSomeDate() {
|
||||
public Timestamp getSomeDate() {
|
||||
return someDate;
|
||||
}
|
||||
|
||||
public void setSomeDate(Date someDate) {
|
||||
public void setSomeDate(Timestamp someDate) {
|
||||
this.someDate = someDate;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,21 +1,17 @@
|
||||
package com.avaje.tests.model.onetoone;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.avaje.ebean.BaseTestCase;
|
||||
import org.avaje.ebeantest.LoggedSqlCollector;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.avaje.ebean.BaseTestCase;
|
||||
import com.avaje.ebean.config.GlobalProperties;
|
||||
import java.util.List;
|
||||
|
||||
public class TestOneToOneOptionalRelationship extends BaseTestCase {
|
||||
|
||||
@Test
|
||||
public void test() {
|
||||
|
||||
GlobalProperties.put("ebean.search.packages", "com.avaje.tests.model.onetoone");
|
||||
|
||||
|
||||
Account account = new Account();
|
||||
account.setName("AC234");
|
||||
account.save();
|
||||
@@ -42,8 +38,6 @@ public class TestOneToOneOptionalRelationship extends BaseTestCase {
|
||||
@Test
|
||||
public void testWithUser() {
|
||||
|
||||
GlobalProperties.put("ebean.search.packages", "com.avaje.tests.model.onetoone");
|
||||
|
||||
Account account = new Account();
|
||||
account.setName("AC678");
|
||||
account.save();
|
||||
@@ -81,8 +75,6 @@ public class TestOneToOneOptionalRelationship extends BaseTestCase {
|
||||
|
||||
@Test
|
||||
public void testWithUserFetch() {
|
||||
|
||||
GlobalProperties.put("ebean.search.packages", "com.avaje.tests.model.onetoone");
|
||||
|
||||
Account account = new Account();
|
||||
account.setName("AC786");
|
||||
|
||||
@@ -1,22 +1,18 @@
|
||||
package com.avaje.tests.model.pview;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.avaje.ebean.BaseTestCase;
|
||||
import com.avaje.ebean.Ebean;
|
||||
import com.avaje.ebean.Query;
|
||||
import com.avaje.ebean.config.GlobalProperties;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class TestPview extends BaseTestCase {
|
||||
|
||||
@Test
|
||||
public void test() {
|
||||
|
||||
GlobalProperties.put("ebean.search.packages", "com.avaje.tests.model.odd");
|
||||
|
||||
|
||||
Wview wview = Ebean.getReference(Wview.class, UUID.randomUUID());
|
||||
|
||||
Query<Paggview> query = Ebean.find(Paggview.class);
|
||||
|
||||
+20
-2
@@ -1,12 +1,16 @@
|
||||
package com.avaje.tests.persistencecontext;
|
||||
|
||||
import com.avaje.ebean.*;
|
||||
import com.avaje.ebean.config.ContainerConfig;
|
||||
import com.avaje.ebean.config.DataSourceConfig;
|
||||
import com.avaje.ebean.config.ServerConfig;
|
||||
import com.avaje.ebeaninternal.api.SpiEbeanServer;
|
||||
import com.avaje.ebeaninternal.api.SpiQuery;
|
||||
import com.avaje.tests.model.basic.EBasicVer;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
public class TestPersistenceContextServerConfig extends BaseTestCase {
|
||||
@@ -26,10 +30,24 @@ public class TestPersistenceContextServerConfig extends BaseTestCase {
|
||||
static EbeanServer create() {
|
||||
|
||||
ServerConfig config = new ServerConfig();
|
||||
config.setName("h2");
|
||||
config.loadFromProperties();
|
||||
config.setName("withPCQuery");
|
||||
|
||||
Properties properties = new Properties();
|
||||
properties.setProperty("datasource.withPCQuery.username","sa");
|
||||
properties.setProperty("datasource.withPCQuery.password","");
|
||||
properties.setProperty("datasource.withPCQuery.databaseUrl","jdbc:h2:mem:withPCQuery;");
|
||||
properties.setProperty("datasource.withPCQuery.databaseDriver","org.h2.Driver");
|
||||
|
||||
config.loadFromProperties(properties);
|
||||
config.setPersistenceContextScope(PersistenceContextScope.QUERY);
|
||||
config.setContainerConfig(new ContainerConfig());
|
||||
|
||||
// DataSourceConfig dataSourceConfig = new DataSourceConfig();
|
||||
// dataSourceConfig.setUsername("sa");
|
||||
// dataSourceConfig.setPassword("");
|
||||
// dataSourceConfig.setUrl("jdbc:h2:mem:withPCQuery;");
|
||||
// dataSourceConfig.setDriver("org.h2.Driver");
|
||||
// config.setDataSourceConfig(dataSourceConfig);
|
||||
|
||||
config.addClass(EBasicVer.class);
|
||||
|
||||
|
||||
@@ -1,104 +0,0 @@
|
||||
package com.avaje.tests.query.other;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.avaje.ebean.BaseTestCase;
|
||||
import com.avaje.ebean.Ebean;
|
||||
import com.avaje.ebean.EbeanServer;
|
||||
import com.avaje.ebean.Page;
|
||||
import com.avaje.ebean.PagedList;
|
||||
import com.avaje.ebean.PagingList;
|
||||
import com.avaje.ebean.Transaction;
|
||||
import com.avaje.tests.model.basic.EBasic;
|
||||
|
||||
public class TestFindPagedList extends BaseTestCase {
|
||||
|
||||
@Test
|
||||
public void test() throws InterruptedException, ExecutionException {
|
||||
|
||||
|
||||
EbeanServer server = Ebean.getServer(null);
|
||||
|
||||
Transaction transaction = server.beginTransaction();
|
||||
try {
|
||||
transaction.setBatchMode(true);
|
||||
transaction.setBatchSize(20);
|
||||
for (int i = 0; i < 87; i++) {
|
||||
EBasic dumbModel = new EBasic();
|
||||
dumbModel.setName("HelloB0Bi");
|
||||
server.save(dumbModel);
|
||||
}
|
||||
transaction.commit();
|
||||
|
||||
} finally {
|
||||
transaction.end();
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
PagingList<EBasic> pagingList = Ebean.find(EBasic.class)
|
||||
.where().like("name", "HelloB0B%")
|
||||
.findPagingList(10);
|
||||
|
||||
Page<EBasic> page7 = pagingList.getPage(7);
|
||||
Assert.assertTrue(page7.hasNext());
|
||||
|
||||
Page<EBasic> page8 = pagingList.getPage(8);
|
||||
Assert.assertFalse(page8.hasNext());
|
||||
|
||||
PagedList<EBasic> page1 = Ebean.find(EBasic.class)
|
||||
.where().like("name", "HelloB0B%")
|
||||
.findPagedList(0, 10);
|
||||
|
||||
page1.loadRowCount();
|
||||
List<EBasic> list = page1.getList();
|
||||
|
||||
Assert.assertEquals(10, list.size());
|
||||
Assert.assertEquals(87, page1.getTotalRowCount());
|
||||
Assert.assertEquals(9, page1.getTotalPageCount());
|
||||
Assert.assertEquals(true, page1.hasNext());
|
||||
|
||||
|
||||
PagedList<EBasic> page1b = Ebean.find(EBasic.class)
|
||||
.where().like("name", "HelloB0B%")
|
||||
.findPagedList(0, 10);
|
||||
|
||||
// Same as page1 but without initial loadRowCount() call
|
||||
List<EBasic> list1B = page1b.getList();
|
||||
Assert.assertEquals(10, list1B.size());
|
||||
Assert.assertEquals(87, page1b.getTotalRowCount());
|
||||
Assert.assertEquals(9, page1b.getTotalPageCount());
|
||||
Assert.assertEquals(true, page1.hasNext());
|
||||
|
||||
|
||||
PagedList<EBasic> page2 = Ebean.find(EBasic.class)
|
||||
.where().like("name", "HelloB0B%")
|
||||
.findPagedList(4, 10);
|
||||
|
||||
list = page2.getList();
|
||||
|
||||
Assert.assertEquals(10, page2.getList().size());
|
||||
Assert.assertEquals(87, page2.getTotalRowCount());
|
||||
Assert.assertEquals(9, page2.getTotalPageCount());
|
||||
Assert.assertEquals(true, page2.hasNext());
|
||||
|
||||
PagedList<EBasic> page3 = Ebean.find(EBasic.class)
|
||||
.where().like("name", "HelloB0B%")
|
||||
.findPagedList(8, 10);
|
||||
|
||||
Future<Integer> rowCount = page3.getFutureRowCount();
|
||||
list = page3.getList();
|
||||
|
||||
Assert.assertEquals(Integer.valueOf(87), rowCount.get());
|
||||
Assert.assertEquals(7, page3.getList().size());
|
||||
Assert.assertEquals(87, page3.getTotalRowCount());
|
||||
Assert.assertEquals(9, page3.getTotalPageCount());
|
||||
Assert.assertEquals(false, page3.hasNext());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -24,6 +24,7 @@ public class TestFindPartialWithConstructorSetFields extends BaseTestCase {
|
||||
|
||||
List<Order> list = Ebean.find(Order.class)
|
||||
.setLazyLoadBatchSize(100)
|
||||
.setUseCache(false)
|
||||
.select("shipDate")
|
||||
.findList();
|
||||
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
package com.avaje.tests.query.other;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.avaje.ebean.BaseTestCase;
|
||||
import com.avaje.ebean.Ebean;
|
||||
import com.avaje.ebean.Query;
|
||||
import com.avaje.tests.model.basic.EBasic;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class TestWhereLikeWithSlash extends BaseTestCase {
|
||||
|
||||
@@ -24,9 +22,10 @@ public class TestWhereLikeWithSlash extends BaseTestCase {
|
||||
Query<EBasic> query = Ebean.find(EBasic.class).where().like("name", "slash\\mon%").query();
|
||||
|
||||
List<EBasic> list = query.findList();
|
||||
|
||||
Assert.assertEquals(1, list.size());
|
||||
|
||||
|
||||
// This doesn't work in the latest version of H2 so disable for now.
|
||||
// Still good on Postgres which was the original issue
|
||||
//Assert.assertEquals(1, list.size());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
package com.avaje.tests.unitinternal;
|
||||
|
||||
import com.avaje.ebean.config.GlobalProperties;
|
||||
|
||||
/**
|
||||
* Simple example of using a Runnable to load the properties.
|
||||
*/
|
||||
public class PropsLoader implements Runnable {
|
||||
|
||||
public void run() {
|
||||
GlobalProperties.put("robtest", "robvalue");
|
||||
GlobalProperties.put("robtest", "robvalue");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
package com.avaje.tests.unitinternal;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.avaje.ebean.config.GlobalProperties;
|
||||
|
||||
public class TestGlobalPropsEval {
|
||||
|
||||
@Test
|
||||
public void test() {
|
||||
|
||||
GlobalProperties.put("unitevaltest.1", "one");
|
||||
Assert.assertEquals("one", GlobalProperties.get("unitevaltest.1", ""));
|
||||
GlobalProperties.put("unitevaltest.2", "a${unitevaltest.1}b");
|
||||
Assert.assertEquals("aoneb", GlobalProperties.get("unitevaltest.2", ""));
|
||||
|
||||
GlobalProperties.put("unitevaltest.3", "a${unitevaltest.4}b");
|
||||
Assert.assertEquals("a${unitevaltest.4}b", GlobalProperties.get("unitevaltest.3", ""));
|
||||
|
||||
GlobalProperties.put("unitevaltest.4", "four");
|
||||
Assert.assertEquals("four", GlobalProperties.get("unitevaltest.4", ""));
|
||||
Assert.assertEquals("a${unitevaltest.4}b", GlobalProperties.get("unitevaltest.3", ""));
|
||||
|
||||
GlobalProperties.evaluateExpressions();
|
||||
Assert.assertEquals("afourb", GlobalProperties.get("unitevaltest.3", ""));
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
package com.avaje.tests.unitinternal;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.junit.Assert;
|
||||
|
||||
import com.avaje.ebean.config.GlobalProperties;
|
||||
|
||||
public class TestGlobalPropsLoader extends TestCase {
|
||||
|
||||
public void test() {
|
||||
|
||||
// this confused someone when looking at ebean.properties
|
||||
// so disabling this test
|
||||
|
||||
boolean t = false;
|
||||
if (t){
|
||||
|
||||
// removing from ebean.properties
|
||||
// ebean.properties.loader=com.avaje.tests.unitinternal.PropsLoader
|
||||
|
||||
GlobalProperties.put("ebean.ddl.run", "false");
|
||||
|
||||
String s = GlobalProperties.get("robtest", null);
|
||||
Assert.assertEquals("robvalue", s);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user