Remove unused ServerConfig debugSql options, Update Tests to use agentloader

This commit is contained in:
Robin Bygrave
2013-04-29 22:42:27 +12:00
parent bb2479c9e7
commit 2f97c5c36e
217 changed files with 6351 additions and 6740 deletions
@@ -34,7 +34,7 @@ import com.avaje.ebean.annotation.Where;
public class Order implements Serializable {
private static final long serialVersionUID = 1L;
@XmlType(name="status")
public enum Status {
NEW,
@@ -1,17 +1,18 @@
package com.avaje.tests.model.basic.mapsuper;
import junit.framework.TestCase;
import org.junit.Assert;
import org.junit.Test;
import com.avaje.ebean.BaseTestCase;
import com.avaje.ebean.bean.EntityBean;
public class TestMapSuperEquals extends TestCase {
public class TestMapSuperEquals extends BaseTestCase {
@Test
public void testEquals() {
MapSuperActual a = new MapSuperActual();
if (a instanceof EntityBean) {
// test on enhanced beans only
@@ -20,18 +21,18 @@ public class TestMapSuperEquals extends TestCase {
MapSuperActual c = new MapSuperActual();
c.setId(2l);
a.setId(456l);
Assert.assertTrue("equals By Id value on enhanced mapped super",a.equals(b));
Assert.assertTrue("equals By Id value on enhanced mapped super", a.equals(b));
Assert.assertTrue(b.equals(a));
Assert.assertTrue(!a.equals(c));
Assert.assertTrue(!b.equals(c));
} else {
System.out.println("--- ok, not running TestMapSuperEquals test");
}
}
}
@@ -1,96 +1,92 @@
package com.avaje.tests.model.basic.xtra;
import java.util.ArrayList;
import junit.framework.TestCase;
import org.junit.Test;
import com.avaje.ebean.BaseTestCase;
import com.avaje.ebean.Ebean;
import com.avaje.ebean.SqlUpdate;
public class TestDeleteUnloadedChildren extends BaseTestCase {
public class TestDeleteUnloadedChildren extends TestCase {
private void init() {
Ebean.beginTransaction();
try {
String sql;
SqlUpdate delete;
private void init() {
sql = "delete from td_child";
delete = Ebean.createSqlUpdate(sql);
delete.execute();
Ebean.beginTransaction();
try {
String sql;
SqlUpdate delete;
sql = "delete from td_parent";
delete = Ebean.createSqlUpdate(sql);
delete.execute();
sql = "delete from td_child";
delete = Ebean.createSqlUpdate(sql);
delete.execute();
EdParent parent = new EdParent();
parent.setName("MyComputer");
sql = "delete from td_parent";
delete = Ebean.createSqlUpdate(sql);
delete.execute();
EdChild child = new EdChild();
child.setName("Harddisk 123");
child.setParent(parent);
ArrayList<EdChild> children = new ArrayList<EdChild>();
children.add(child);
parent.setChildren(children);
EdParent parent = new EdParent();
parent.setName("MyComputer");
Ebean.save(parent);
EdExtendedParent extendedParent = new EdExtendedParent();
extendedParent.setName("My second computer");
extendedParent.setExtendedName("Multimedia");
EdChild child = new EdChild();
child.setName("Harddisk 123");
child.setParent(parent);
ArrayList<EdChild> children = new ArrayList<EdChild>();
children.add(child);
parent.setChildren(children);
child = new EdChild();
child.setName("DVBS Card");
children = new ArrayList<EdChild>();
children.add(child);
extendedParent.setChildren(children);
Ebean.save(parent);
Ebean.save(extendedParent);
EdExtendedParent extendedParent = new EdExtendedParent();
extendedParent.setName("My second computer");
extendedParent.setExtendedName("Multimedia");
child = new EdChild();
child.setName("DVBS Card");
children = new ArrayList<EdChild>();
children.add(child);
extendedParent.setChildren(children);
Ebean.save(extendedParent);
Ebean.commitTransaction();
} finally {
Ebean.endTransaction();
}
Ebean.commitTransaction();
} finally {
Ebean.endTransaction();
}
}
@Test
public void testCascadeDelete2() {
public void testCascadeDelete2() {
init();
Ebean.beginTransaction();
try {
EdParent parent = Ebean.find(EdParent.class).where().eq("name","MyComputer").findUnique();
// // Works only if the following statement is included
// int x = parent.getChildren().size();
Ebean.delete(parent);
Ebean.commitTransaction();
} finally {
Ebean.endTransaction();
}
init();
Ebean.beginTransaction();
try {
EdParent parent = Ebean.find(EdParent.class).where().eq("name", "MyComputer").findUnique();
// // Works only if the following statement is included
// int x = parent.getChildren().size();
Ebean.delete(parent);
Ebean.commitTransaction();
} finally {
Ebean.endTransaction();
}
}
public void testCascadeDelete3() {
init();
Ebean.beginTransaction();
try {
EdExtendedParent extendedParent = Ebean.find(EdExtendedParent.class).where().eq("name","My second computer").findUnique();
extendedParent.getChildren().size();
Ebean.delete(extendedParent);
Ebean.commitTransaction();
} finally {
Ebean.endTransaction();
}
@Test
public void testCascadeDelete3() {
init();
Ebean.beginTransaction();
try {
EdExtendedParent extendedParent = Ebean.find(EdExtendedParent.class).where()
.eq("name", "My second computer").findUnique();
extendedParent.getChildren().size();
Ebean.delete(extendedParent);
Ebean.commitTransaction();
} finally {
Ebean.endTransaction();
}
}
}