mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
Remove unused ServerConfig debugSql options, Update Tests to use agentloader
This commit is contained in:
@@ -1,37 +1,39 @@
|
||||
package com.avaje.tests.text.json;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.avaje.ebean.BaseTestCase;
|
||||
import com.avaje.ebean.Ebean;
|
||||
import com.avaje.ebean.text.json.JsonContext;
|
||||
import com.avaje.ebeaninternal.server.lib.util.StringHelper;
|
||||
import com.avaje.tests.model.basic.Customer;
|
||||
import com.avaje.tests.model.basic.ResetBasicData;
|
||||
|
||||
public class TestTextJsonInsertUpdate extends TestCase {
|
||||
public class TestTextJsonInsertUpdate extends BaseTestCase {
|
||||
|
||||
public void test() {
|
||||
@Test
|
||||
public void test() {
|
||||
|
||||
ResetBasicData.reset();
|
||||
|
||||
String json0 = "{\"name\":\"InsJson\",\"status\":\"NEW\"}";
|
||||
|
||||
JsonContext jsonContext = Ebean.createJsonContext();
|
||||
|
||||
// insert
|
||||
Customer c0 = jsonContext.toBean(Customer.class, json0);
|
||||
Ebean.save(c0);
|
||||
|
||||
// update with optimistic concurrency checking
|
||||
String j0 = jsonContext.toJsonString(c0);
|
||||
String j1 = StringHelper.replaceString(j0, "InsJson", "Mod1");
|
||||
Customer c1 = jsonContext.toBean(Customer.class, j1);
|
||||
Ebean.update(c1);
|
||||
ResetBasicData.reset();
|
||||
|
||||
// update with no optimistic concurrency checking
|
||||
String j2 = "{\"id\":"+c0.getId()+",\"name\":\"ModIns\",\"status\":\"ACTIVE\"}";
|
||||
Customer c2 = jsonContext.toBean(Customer.class, j2);
|
||||
Ebean.update(c2);
|
||||
|
||||
}
|
||||
String json0 = "{\"name\":\"InsJson\",\"status\":\"NEW\"}";
|
||||
|
||||
JsonContext jsonContext = Ebean.createJsonContext();
|
||||
|
||||
// insert
|
||||
Customer c0 = jsonContext.toBean(Customer.class, json0);
|
||||
Ebean.save(c0);
|
||||
|
||||
// update with optimistic concurrency checking
|
||||
String j0 = jsonContext.toJsonString(c0);
|
||||
String j1 = StringHelper.replaceString(j0, "InsJson", "Mod1");
|
||||
Customer c1 = jsonContext.toBean(Customer.class, j1);
|
||||
Ebean.update(c1);
|
||||
|
||||
// update with no optimistic concurrency checking
|
||||
String j2 = "{\"id\":" + c0.getId() + ",\"name\":\"ModIns\",\"status\":\"ACTIVE\"}";
|
||||
Customer c2 = jsonContext.toBean(Customer.class, j2);
|
||||
Ebean.update(c2);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user