No effective change - imports of Assert in tests + formatting

This commit is contained in:
Rob Bygrave
2014-07-02 23:29:54 +12:00
parent 10f0ea9bae
commit b973cc3b86
79 changed files with 160 additions and 436 deletions
@@ -3,8 +3,7 @@ package com.avaje.ebean;
import java.util.Map;
import java.util.Set;
import junit.framework.Assert;
import org.junit.Assert;
import org.junit.Test;
import com.avaje.ebean.bean.EntityBean;
@@ -2,16 +2,18 @@ package com.avaje.ebeaninternal.server.querydefn;
import java.util.Set;
import junit.framework.Assert;
import junit.framework.TestCase;
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.ebeaninternal.server.expression.DefaultExpressionFactory;
import com.avaje.tests.model.basic.Order;
public class TestQueryLanguage extends TestCase {
public class TestQueryLanguage extends BaseTestCase {
@Test
public void test() {
DefaultOrmQuery<Order> q = check("find order join customer (id, name)");
@@ -1,9 +1,5 @@
package com.avaje.ebeaninternal.server.util;
import junit.framework.Assert;
import org.apache.commons.io.IOUtils;
import org.junit.Test;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
@@ -14,6 +10,10 @@ import java.util.List;
import java.util.jar.JarEntry;
import java.util.jar.JarOutputStream;
import org.apache.commons.io.IOUtils;
import org.junit.Assert;
import org.junit.Test;
/**
* This ensures that the ClassPathSearch supports normal file:file.jar files as well as jar/war files
* with bang paths. Bang paths typically look like this as a url:
@@ -2,7 +2,7 @@ package com.avaje.tests.basic;
import java.util.List;
import junit.framework.Assert;
import org.junit.Assert;
import com.avaje.ebean.EbeanServer;
import com.avaje.ebean.EbeanServerFactory;
@@ -1,176 +0,0 @@
package com.avaje.tests.basic;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.List;
import java.util.concurrent.Future;
import com.avaje.ebean.Ebean;
import com.avaje.ebean.EbeanServer;
import com.avaje.ebean.EbeanServerFactory;
import com.avaje.ebean.FutureList;
import com.avaje.ebean.Query;
import com.avaje.ebean.SqlFutureList;
import com.avaje.ebean.SqlQuery;
import com.avaje.ebean.SqlRow;
import com.avaje.ebean.Transaction;
import com.avaje.ebean.config.DataSourceConfig;
import com.avaje.ebean.config.ServerConfig;
import com.avaje.tests.model.basic.Order;
import com.avaje.tests.model.basic.ResetBasicData;
import com.avaje.tests.model.basic.TOne;
public class MainFutureList {
public static void main(String[] args) throws Exception {
checkFutureRowCount(true);
//testSqlQueryFuture();
//testOrmFuture();
}
public void executeDDL(EbeanServer server, String ddl) {
Transaction t = server.createTransaction();
try {
Connection connection = t.getConnection()
;
} finally {
t.end();
}
}
private void executeStmt(Connection c, String ddl) throws SQLException {
java.sql.PreparedStatement pstmt = null;
try {
pstmt = c.prepareStatement(ddl);
pstmt.execute();
} finally {
if (pstmt != null) {
pstmt.close();
}
}
}
private static EbeanServer createEbeanServer(boolean primary) {
if (primary){
return Ebean.getServer(null);
}
ServerConfig c = new ServerConfig();
c.setName("pgtest");
// // requires postgres driver in class path
// DataSourceConfig postgresDb = new DataSourceConfig();
// postgresDb.setDriver("org.postgresql.Driver");
// postgresDb.setUsername("test");
// postgresDb.setPassword("test");
// postgresDb.setUrl("jdbc:postgresql://127.0.0.1:5432/test");
// postgresDb.setHeartbeatSql("select count(*) from t_one");
// requires oracle driver in class path
DataSourceConfig oraDb = new DataSourceConfig();
oraDb.setDriver("oracle.jdbc.driver.OracleDriver");
oraDb.setUsername("junk");
oraDb.setPassword("junk");
oraDb.setUrl("jdbc:oracle:thin:junk/junk@localhost:1521:XE");
oraDb.setHeartbeatSql("select count(*) from dual");
c.loadFromProperties();
c.setDdlGenerate(true);
c.setDdlRun(true);
c.setDefaultServer(false);
c.setRegister(false);
// c.setDataSourceConfig(postgresDb);
c.setDataSourceConfig(oraDb);
//c.setDatabaseBooleanTrue("1");
//c.setDatabaseBooleanFalse("0");
//c.setDatabaseBooleanTrue("T");
//c.setDatabaseBooleanFalse("F");
//c.setDatabasePlatform(new Postgres83Platform());
c.addClass(TOne.class);
return EbeanServerFactory.create(c);
}
public static void checkFutureRowCount(boolean primay) throws Exception {
ResetBasicData.reset();
EbeanServer server = createEbeanServer(primay);
Query<Order> query = server.find(Order.class);
Future<Integer> futureRowCount = server.findFutureRowCount(query, null);
boolean done = futureRowCount.isDone();
System.out.println("done: "+done);
Integer rowCount = futureRowCount.get();
System.out.println("got rc:"+rowCount);
}
public static void checkSqlQueryFuture(boolean primay) throws Exception {
EbeanServer server = createEbeanServer(primay);
String sql = "select o.* from all_tables o";
SqlQuery sqlQuery = server.createSqlQuery(sql);
SqlFutureList list = server.findFutureList(sqlQuery, null);
System.out.println("start done:"+list.isDone());
Thread.sleep(200);
if (!list.isDone()){
list.cancel(true);
}
if (!list.isCancelled()){
List<SqlRow> list2 = list.get();
System.out.println("got "+list2.size());
}
Thread.sleep(3000);
System.out.println("done sleeping");
}
public static void checkOrmFuture() throws Exception {
ResetBasicData.reset();
//EbeanServer server = Ebean.getServer(null);
Query<Order> query = Ebean.find(Order.class);
FutureList<Order> futureList = query.findFutureList();
Thread.sleep(3000);
System.out.println("end of sleep");
if (!futureList.isDone()){
futureList.cancel(true);
}
System.out.println("and... done:"+futureList.isDone());
if (!futureList.isCancelled()){
//List<Order> l0 = futureList.get(30, TimeUnit.SECONDS);
List<Order> list = futureList.get();
System.out.println("list:"+list);
}
System.out.println("done");
}
}
@@ -1,7 +1,6 @@
package com.avaje.tests.basic;
import junit.framework.Assert;
import org.junit.Assert;
import org.junit.Test;
import com.avaje.ebean.BaseTestCase;
@@ -2,8 +2,7 @@ package com.avaje.tests.basic;
import java.sql.Date;
import junit.framework.Assert;
import org.junit.Assert;
import org.junit.Test;
import com.avaje.ebean.BaseTestCase;
@@ -3,8 +3,7 @@ package com.avaje.tests.basic;
import java.util.List;
import java.util.concurrent.ExecutionException;
import junit.framework.Assert;
import org.junit.Assert;
import org.junit.Test;
import com.avaje.ebean.BaseTestCase;
@@ -2,8 +2,7 @@ package com.avaje.tests.basic;
import java.sql.Timestamp;
import junit.framework.Assert;
import org.junit.Assert;
import org.junit.Test;
import com.avaje.ebean.BaseTestCase;
@@ -2,8 +2,7 @@ package com.avaje.tests.basic;
import java.util.List;
import junit.framework.Assert;
import org.junit.Assert;
import org.junit.Test;
import com.avaje.ebean.BaseTestCase;
@@ -2,8 +2,7 @@ package com.avaje.tests.basic;
import java.util.List;
import junit.framework.Assert;
import org.junit.Assert;
import org.junit.Test;
import com.avaje.ebean.BaseTestCase;
@@ -1,7 +1,6 @@
package com.avaje.tests.basic;
import junit.framework.Assert;
import org.junit.Assert;
import org.junit.Test;
import com.avaje.ebean.BaseTestCase;
@@ -4,8 +4,7 @@ import java.sql.Timestamp;
import java.util.Date;
import java.util.List;
import junit.framework.Assert;
import org.junit.Assert;
import org.junit.Test;
import com.avaje.ebean.BaseTestCase;
@@ -3,8 +3,7 @@ package com.avaje.tests.basic;
import java.util.Map;
import java.util.Set;
import junit.framework.Assert;
import org.junit.Assert;
import org.junit.Test;
import com.avaje.ebean.BaseTestCase;
@@ -2,8 +2,7 @@ package com.avaje.tests.basic;
import java.util.Map;
import junit.framework.Assert;
import org.junit.Assert;
import org.junit.Test;
import com.avaje.ebean.BaseTestCase;
@@ -7,7 +7,6 @@ import org.junit.Test;
import com.avaje.ebean.BaseTestCase;
import com.avaje.ebean.Ebean;
import com.avaje.ebean.Transaction;
import com.avaje.tests.model.basic.Customer;
import com.avaje.tests.model.basic.EBasicVer;
import com.avaje.tests.model.basic.Order;
@@ -20,9 +19,9 @@ public class TestLogTransLogOnError extends BaseTestCase {
ResetBasicData.reset();
Transaction t = Ebean.beginTransaction();
Ebean.beginTransaction();
try {
// t.log("--- hello");
Ebean.find(Customer.class).findList();
Ebean.find(Order.class).where().gt("id", 1).findList();
@@ -52,9 +51,8 @@ public class TestLogTransLogOnError extends BaseTestCase {
ResetBasicData.reset();
Transaction t = Ebean.beginTransaction();
Ebean.beginTransaction();
try {
// t.log("--- hello testPersistError");
Ebean.find(Customer.class).findList();
EBasicVer newBean = new EBasicVer();
@@ -3,8 +3,7 @@ package com.avaje.tests.basic;
import java.util.ArrayList;
import java.util.List;
import junit.framework.Assert;
import org.junit.Assert;
import org.junit.Test;
import com.avaje.ebean.BaseTestCase;
@@ -3,8 +3,7 @@ package com.avaje.tests.basic;
import java.sql.Date;
import java.util.List;
import junit.framework.Assert;
import org.junit.Assert;
import org.junit.Test;
import com.avaje.ebean.BaseTestCase;
@@ -2,8 +2,7 @@ package com.avaje.tests.basic;
import java.util.List;
import junit.framework.Assert;
import org.junit.Assert;
import org.junit.Test;
import com.avaje.ebean.BaseTestCase;
@@ -2,8 +2,7 @@ package com.avaje.tests.basic;
import java.util.List;
import junit.framework.Assert;
import org.junit.Assert;
import org.junit.Test;
import com.avaje.ebean.BaseTestCase;
@@ -2,8 +2,7 @@ package com.avaje.tests.basic;
import java.util.List;
import junit.framework.Assert;
import org.junit.Assert;
import org.junit.Test;
import com.avaje.ebean.BaseTestCase;
@@ -3,8 +3,7 @@ package com.avaje.tests.basic;
import java.util.List;
import java.util.Random;
import junit.framework.Assert;
import org.junit.Assert;
import org.junit.Test;
import com.avaje.ebean.BaseTestCase;
@@ -1,7 +1,6 @@
package com.avaje.tests.basic;
import junit.framework.Assert;
import org.junit.Assert;
import org.junit.Test;
import com.avaje.ebean.BaseTestCase;
@@ -1,7 +1,6 @@
package com.avaje.tests.basic;
import junit.framework.Assert;
import org.junit.Assert;
import org.junit.Test;
import com.avaje.ebean.BaseTestCase;
@@ -1,7 +1,6 @@
package com.avaje.tests.basic;
import junit.framework.Assert;
import org.junit.Assert;
import org.junit.Test;
import com.avaje.ebean.BaseTestCase;
@@ -2,8 +2,7 @@ package com.avaje.tests.basic;
import java.sql.Timestamp;
import junit.framework.Assert;
import org.junit.Assert;
import org.junit.Test;
import com.avaje.ebean.BaseTestCase;
@@ -1,7 +1,6 @@
package com.avaje.tests.basic;
import junit.framework.Assert;
import org.junit.Assert;
import org.junit.Test;
import com.avaje.ebean.BaseTestCase;
@@ -4,8 +4,7 @@ import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
import junit.framework.Assert;
import org.junit.Assert;
import org.junit.Test;
import com.avaje.ebean.BaseTestCase;
@@ -1,7 +1,6 @@
package com.avaje.tests.basic;
import junit.framework.Assert;
import org.junit.Assert;
import org.junit.Test;
import com.avaje.ebean.BaseTestCase;
@@ -1,7 +1,6 @@
package com.avaje.tests.basic;
import junit.framework.Assert;
import org.junit.Assert;
import org.junit.Test;
import com.avaje.ebean.BaseTestCase;
@@ -1,7 +1,6 @@
package com.avaje.tests.basic;
import junit.framework.Assert;
import org.junit.Assert;
import org.junit.Test;
import com.avaje.ebean.BaseTestCase;
@@ -2,8 +2,7 @@ package com.avaje.tests.basic;
import java.util.List;
import junit.framework.Assert;
import org.junit.Assert;
import org.junit.Test;
import com.avaje.ebean.BaseTestCase;
@@ -2,8 +2,7 @@ package com.avaje.tests.basic.encrypt;
import java.sql.Timestamp;
import junit.framework.Assert;
import org.junit.Assert;
import org.junit.Test;
import com.avaje.ebean.BaseTestCase;
@@ -1,7 +1,6 @@
package com.avaje.tests.basic.event;
import junit.framework.Assert;
import org.junit.Assert;
import org.junit.Test;
import com.avaje.ebean.BaseTestCase;
@@ -1,7 +1,6 @@
package com.avaje.tests.basic.one2one;
import junit.framework.Assert;
import org.junit.Assert;
import org.junit.Test;
import com.avaje.ebean.BaseTestCase;
@@ -3,8 +3,7 @@ package com.avaje.tests.batchload;
import java.util.ArrayList;
import java.util.List;
import junit.framework.Assert;
import org.junit.Assert;
import org.junit.Test;
import com.avaje.ebean.BaseTestCase;
@@ -1,12 +1,10 @@
package com.avaje.tests.batchload;
import java.util.List;
import java.util.UUID;
import javax.persistence.EntityNotFoundException;
import junit.framework.Assert;
import org.junit.Assert;
import org.junit.Test;
import com.avaje.ebean.BaseTestCase;
@@ -57,7 +55,7 @@ public class TestBatchLazyWithDeleted extends BaseTestCase {
Assert.assertEquals(1, deletedCount);
for (UUTwo u : list) {
UUOne master = u.getMaster();
u.getMaster();
//BeanState beanState = Ebean.getBeanState(master);
//Assert.assertTrue(beanState.isReference());
}
@@ -2,8 +2,7 @@ package com.avaje.tests.batchload;
import java.util.List;
import junit.framework.Assert;
import org.junit.Assert;
import org.junit.Test;
import com.avaje.ebean.BaseTestCase;
@@ -2,8 +2,7 @@ package com.avaje.tests.batchload;
import java.util.List;
import junit.framework.Assert;
import org.junit.Assert;
import org.junit.Test;
import com.avaje.ebean.BaseTestCase;
@@ -4,8 +4,7 @@ import java.util.UUID;
import javax.persistence.EntityNotFoundException;
import junit.framework.Assert;
import org.junit.Assert;
import org.junit.Test;
import com.avaje.ebean.BaseTestCase;
@@ -2,8 +2,7 @@ package com.avaje.tests.batchload;
import java.util.List;
import junit.framework.Assert;
import org.junit.Assert;
import org.junit.Test;
import com.avaje.ebean.BaseTestCase;
@@ -2,8 +2,7 @@ package com.avaje.tests.batchload;
import java.util.List;
import junit.framework.Assert;
import org.junit.Assert;
import org.junit.Test;
import com.avaje.ebean.BaseTestCase;
@@ -1,7 +1,6 @@
package com.avaje.tests.batchload;
import junit.framework.Assert;
import org.junit.Assert;
import org.junit.Test;
import com.avaje.ebean.BaseTestCase;
+2 -2
View File
@@ -1,7 +1,6 @@
package com.avaje.tests.cache;
import junit.framework.Assert;
import org.junit.Assert;
import org.junit.Test;
import com.avaje.ebean.BaseTestCase;
@@ -31,6 +30,7 @@ public class TestCacheBasic extends BaseTestCase {
ServerCacheStatistics statistics = countryCache.getStatistics(false);
int hc = statistics.getHitCount();
Assert.assertEquals(1, hc);
Assert.assertNotNull(c0);
// Country c1 = Ebean.getReference(Country.class, "NZ");
// Assert.assertEquals(2, countryCache.getStatistics(false).getHitCount());
@@ -2,8 +2,7 @@ package com.avaje.tests.cache;
import java.util.List;
import junit.framework.Assert;
import org.junit.Assert;
import org.junit.Test;
import com.avaje.ebean.BaseTestCase;
@@ -1,7 +1,6 @@
package com.avaje.tests.cache;
import junit.framework.Assert;
import org.junit.Assert;
import org.junit.Test;
import com.avaje.ebean.BaseTestCase;
@@ -2,8 +2,7 @@ package com.avaje.tests.cache;
import java.util.List;
import junit.framework.Assert;
import org.junit.Assert;
import org.junit.Test;
import com.avaje.ebean.BaseTestCase;
@@ -2,8 +2,7 @@ package com.avaje.tests.cache;
import java.util.List;
import junit.framework.Assert;
import org.junit.Assert;
import org.junit.Test;
import com.avaje.ebean.BaseTestCase;
@@ -1,7 +1,6 @@
package com.avaje.tests.compositekeys;
import junit.framework.Assert;
import org.junit.Assert;
import org.junit.Test;
import com.avaje.ebean.BaseTestCase;
@@ -3,8 +3,7 @@ package com.avaje.tests.compositekeys;
import java.util.ArrayList;
import java.util.List;
import junit.framework.Assert;
import org.junit.Assert;
import org.junit.Test;
import com.avaje.ebean.BaseTestCase;
@@ -1,12 +1,14 @@
package com.avaje.tests.config;
import junit.framework.Assert;
import junit.framework.TestCase;
import org.junit.Assert;
import org.junit.Test;
import com.avaje.ebean.BaseTestCase;
import com.avaje.ebean.config.TableName;
public class TestTableName extends TestCase {
public class TestTableName extends BaseTestCase {
@Test
public void test() {
TableName t = new TableName("a");
@@ -1,21 +1,9 @@
package com.avaje.tests.ddd.iud;
import java.util.Currency;
import junit.framework.Assert;
import junit.framework.TestCase;
import com.avaje.ebean.Ebean;
import com.avaje.ebean.bean.EntityBean;
import com.avaje.ebean.config.GlobalProperties;
import com.avaje.ebeaninternal.api.SpiEbeanServer;
import com.avaje.ebeaninternal.server.deploy.BeanDescriptor;
import com.avaje.ebeaninternal.server.el.ElPropertyValue;
import com.avaje.tests.model.ddd.DExhEntity;
import com.avaje.tests.model.ivo.CMoney;
import com.avaje.tests.model.ivo.ExhangeCMoneyRate;
import com.avaje.tests.model.ivo.Money;
import com.avaje.tests.model.ivo.Rate;
public class TestDExhEntityEl extends TestCase {
@@ -1,19 +1,9 @@
package com.avaje.tests.ddd.iud;
import java.util.Currency;
import junit.framework.Assert;
import junit.framework.TestCase;
import com.avaje.ebean.Ebean;
import com.avaje.ebean.bean.EntityBean;
import com.avaje.ebean.config.GlobalProperties;
import com.avaje.ebeaninternal.api.SpiEbeanServer;
import com.avaje.ebeaninternal.server.deploy.BeanDescriptor;
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;
public class TestDPersonEl extends TestCase {
@@ -1,20 +1,9 @@
package com.avaje.tests.ddd.iud;
import java.util.Currency;
import java.util.List;
import junit.framework.TestCase;
import org.joda.time.Interval;
import org.junit.Assert;
import com.avaje.ebean.Ebean;
import com.avaje.ebean.Query;
import com.avaje.ebean.config.GlobalProperties;
import com.avaje.tests.model.ddd.DPerson;
import com.avaje.tests.model.ivo.CMoney;
import com.avaje.tests.model.ivo.Money;
import com.avaje.tests.model.ivo.Oid;
public class TestDPersonIUD extends TestCase {
@@ -1,8 +1,9 @@
package com.avaje.tests.el;
import junit.framework.Assert;
import junit.framework.TestCase;
import org.junit.Assert;
import org.junit.Test;
import com.avaje.ebean.BaseTestCase;
import com.avaje.ebean.Ebean;
import com.avaje.ebeaninternal.api.SpiEbeanServer;
import com.avaje.ebeaninternal.server.deploy.BeanDescriptor;
@@ -14,8 +15,9 @@ import com.avaje.ebeaninternal.server.el.ElPropertyChain;
import com.avaje.ebeaninternal.server.el.ElPropertyDeploy;
import com.avaje.tests.model.basic.Customer;
public class TestELBasic extends TestCase {
public class TestELBasic extends BaseTestCase {
@Test
public void testEl() {
SpiEbeanServer server = (SpiEbeanServer)Ebean.getServer(null);
@@ -1,7 +1,6 @@
package com.avaje.tests.enhancement;
import junit.framework.Assert;
import org.junit.Assert;
import org.junit.Test;
import com.avaje.ebean.BaseTestCase;
@@ -1,6 +1,6 @@
package com.avaje.tests.genkey;
import junit.framework.Assert;
import org.junit.Assert;
import junit.framework.TestCase;
import com.avaje.ebean.Ebean;
@@ -1,16 +1,18 @@
package com.avaje.tests.genkey;
import junit.framework.Assert;
import junit.framework.TestCase;
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.ebeaninternal.api.SpiEbeanServer;
import com.avaje.ebeaninternal.server.deploy.BeanDescriptor;
import com.avaje.tests.model.basic.TOne;
public class TestSeqBatch extends TestCase {
public class TestSeqBatch extends BaseTestCase {
@Test
public void test() {
EbeanServer server = Ebean.getServer(null);
@@ -9,7 +9,6 @@ import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import com.avaje.ebean.Ebean;
import com.avaje.ebean.Transaction;
import com.avaje.ebean.bean.EntityBean;
import com.avaje.tests.idkeys.db.AuditLog;
@@ -1,14 +1,16 @@
package com.avaje.tests.idkeys;
import junit.framework.Assert;
import junit.framework.TestCase;
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;
public class TestSimpleIdInsert extends TestCase {
public class TestSimpleIdInsert extends BaseTestCase {
@Test
public void test() {
GlobalProperties.put("datasource.default", "h2");
@@ -2,8 +2,7 @@ package com.avaje.tests.iud;
import java.util.Set;
import junit.framework.Assert;
import org.junit.Assert;
import org.junit.Test;
import com.avaje.ebean.BaseTestCase;
@@ -1,7 +1,6 @@
package com.avaje.tests.iud;
import junit.framework.Assert;
import org.junit.Assert;
import org.junit.Test;
import com.avaje.ebean.BaseTestCase;
@@ -1,13 +0,0 @@
package com.avaje.tests.lib;
import junit.framework.Assert;
import junit.framework.TestCase;
public class SimpleTest extends TestCase {
public void test() {
Assert.assertTrue("Always Fail!", true);
}
}
@@ -1,14 +1,13 @@
package com.avaje.tests.lib;
import junit.framework.TestCase;
import org.junit.Assert;
import org.junit.Test;
import com.avaje.ebeaninternal.server.core.Message;
public class TestMessage extends TestCase {
public class TestMessage {
@Test
public void testMessage(){
String one = "one";
@@ -2,8 +2,7 @@ package com.avaje.tests.model.basic.xtra;
import javax.persistence.PersistenceException;
import junit.framework.Assert;
import org.junit.Assert;
import com.avaje.ebean.Ebean;
import com.avaje.ebean.EbeanServer;
import com.avaje.ebean.SqlUpdate;
@@ -2,16 +2,13 @@ package com.avaje.tests.model.selfref;
import java.util.List;
import junit.framework.Assert;
import org.junit.Assert;
import org.junit.Test;
import com.avaje.ebean.BaseTestCase;
import com.avaje.ebean.BeanState;
import com.avaje.ebean.Ebean;
import com.avaje.ebean.TxRunnable;
import com.avaje.ebean.text.json.JsonWriteOptions;
import com.avaje.tests.model.selfref.SelfRefCustomer;
public class TestTextJsonSelfRef extends BaseTestCase {
@@ -2,8 +2,7 @@ package com.avaje.tests.query;
import java.util.Set;
import junit.framework.Assert;
import org.junit.Assert;
import org.junit.Test;
import com.avaje.ebean.BaseTestCase;
@@ -2,8 +2,7 @@ package com.avaje.tests.singleTableInheritance;
import java.util.List;
import junit.framework.Assert;
import org.junit.Assert;
import org.junit.Test;
import com.avaje.ebean.BaseTestCase;
@@ -3,8 +3,7 @@ package com.avaje.tests.sp;
import java.util.LinkedList;
import java.util.List;
import junit.framework.Assert;
import org.junit.Assert;
import org.junit.Test;
import com.avaje.ebean.BaseTestCase;
@@ -4,8 +4,7 @@ import java.io.StringReader;
import java.util.List;
import java.util.Map;
import junit.framework.Assert;
import org.junit.Assert;
import org.junit.Test;
import com.avaje.ebean.BaseTestCase;
@@ -4,8 +4,7 @@ import java.io.StringReader;
import java.util.List;
import java.util.Map;
import junit.framework.Assert;
import org.junit.Assert;
import org.junit.Test;
import com.avaje.ebean.BaseTestCase;
@@ -1,7 +1,6 @@
package com.avaje.tests.transaction;
import junit.framework.Assert;
import org.junit.Assert;
import org.junit.Test;
import com.avaje.ebean.BaseTestCase;
@@ -1,7 +1,6 @@
package com.avaje.tests.transaction;
import junit.framework.Assert;
import org.junit.Assert;
import org.junit.Test;
import com.avaje.ebean.BaseTestCase;
@@ -1,11 +1,11 @@
package com.avaje.tests.unitinternal;
import junit.framework.Assert;
import junit.framework.TestCase;
import org.junit.Assert;
import org.junit.Test;
public class TestBasics extends TestCase {
public class TestBasics {
private String parentPath(String path) {
@@ -18,6 +18,7 @@ public class TestBasics extends TestCase {
}
}
@Test
public void testParentPath() {
Assert.assertTrue((parentPath("banana") == null));
@@ -1,28 +1,29 @@
package com.avaje.tests.unitinternal;
import junit.framework.Assert;
import junit.framework.TestCase;
import org.junit.Assert;
import org.junit.Test;
import com.avaje.ebean.config.GlobalProperties;
public class TestGlobalPropsEval extends TestCase {
public class TestGlobalPropsEval {
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",""));
@Test
public void test() {
GlobalProperties.put("unitevaltest.4", "four");
Assert.assertEquals("four", GlobalProperties.get("unitevaltest.4",""));
Assert.assertEquals("a${unitevaltest.4}b", GlobalProperties.get("unitevaltest.3",""));
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.evaluateExpressions();
Assert.assertEquals("afourb", GlobalProperties.get("unitevaltest.3",""));
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", ""));
}
}
@@ -2,49 +2,49 @@ package com.avaje.tests.unitinternal;
import java.util.Locale;
import junit.framework.Assert;
import junit.framework.TestCase;
import org.junit.Assert;
import org.junit.Test;
import com.avaje.ebeaninternal.server.type.ScalarTypeLocale;
public class TestLocaleParse extends TestCase {
public class TestLocaleParse {
public void test() {
//Examples: "en", "de_DE", "_GB", "en_US_WIN", "de__POSIX", "fr__MAC"
Locale l = parse("en");
Assert.assertEquals("en", l.getLanguage());
@Test
public void test() {
l = parse("de_DE");
Assert.assertEquals("de", l.getLanguage());
Assert.assertEquals("DE", l.getCountry());
// Examples: "en", "de_DE", "_GB", "en_US_WIN", "de__POSIX", "fr__MAC"
l = parse("en_US_WIN");
Assert.assertEquals("en", l.getLanguage());
Assert.assertEquals("US", l.getCountry());
Assert.assertEquals("WIN", l.getVariant());
l = parse("_GB");
Assert.assertEquals("", l.getLanguage());
Assert.assertEquals("GB", l.getCountry());
Assert.assertEquals("", l.getVariant());
Locale l = parse("en");
Assert.assertEquals("en", l.getLanguage());
l = parse("fr__MAC");
Assert.assertEquals("fr", l.getLanguage());
Assert.assertEquals("", l.getCountry());
Assert.assertEquals("MAC", l.getVariant());
l = parse("de__POSIX");
Assert.assertEquals("de", l.getLanguage());
Assert.assertEquals("", l.getCountry());
Assert.assertEquals("POSIX", l.getVariant());
}
private Locale parse(String value){
ScalarTypeLocale st = new ScalarTypeLocale();
return (Locale)st.parse(value);
}
l = parse("de_DE");
Assert.assertEquals("de", l.getLanguage());
Assert.assertEquals("DE", l.getCountry());
l = parse("en_US_WIN");
Assert.assertEquals("en", l.getLanguage());
Assert.assertEquals("US", l.getCountry());
Assert.assertEquals("WIN", l.getVariant());
l = parse("_GB");
Assert.assertEquals("", l.getLanguage());
Assert.assertEquals("GB", l.getCountry());
Assert.assertEquals("", l.getVariant());
l = parse("fr__MAC");
Assert.assertEquals("fr", l.getLanguage());
Assert.assertEquals("", l.getCountry());
Assert.assertEquals("MAC", l.getVariant());
l = parse("de__POSIX");
Assert.assertEquals("de", l.getLanguage());
Assert.assertEquals("", l.getCountry());
Assert.assertEquals("POSIX", l.getVariant());
}
private Locale parse(String value) {
ScalarTypeLocale st = new ScalarTypeLocale();
return (Locale) st.parse(value);
}
}
@@ -1,7 +1,6 @@
package com.avaje.tests.unitinternal;
import junit.framework.Assert;
import org.junit.Assert;
import org.junit.Test;
import com.avaje.ebean.BaseTestCase;
@@ -1,7 +1,6 @@
package com.avaje.tests.unitinternal;
import junit.framework.Assert;
import org.junit.Assert;
import org.junit.Test;
import com.avaje.ebean.BaseTestCase;
@@ -3,8 +3,7 @@ package com.avaje.tests.unitinternal;
import java.sql.Timestamp;
import java.util.Arrays;
import junit.framework.Assert;
import org.junit.Assert;
import org.junit.Test;
import com.avaje.ebean.BaseTestCase;