use of com.haulmont.cuba.core.entity.Server in project cuba by cuba-platform.
the class DataManagerTest method testLoadListById.
@Test
public void testLoadListById() {
Server server = new Server();
UUID id = server.getId();
server.setName("localhost");
server.setRunning(true);
dataManager.commit(new CommitContext(Collections.<Entity>singleton(server)));
LoadContext<Server> loadContext = LoadContext.create(Server.class).setId(id);
List<Server> list = dataManager.loadList(loadContext);
assertTrue(list.size() == 1);
}
use of com.haulmont.cuba.core.entity.Server in project cuba by cuba-platform.
the class DataManagerTest method test.
@Test
public void test() {
Server server = new Server();
UUID id = server.getId();
server.setName("localhost");
server.setRunning(true);
dataManager.commit(new CommitContext(Collections.<Entity>singleton(server)));
LoadContext<Server> loadContext = LoadContext.create(Server.class).setId(id);
server = dataManager.load(loadContext);
assertEquals("localhost", server.getName());
server.setName("krivopustov");
dataManager.commit(new CommitContext(Collections.<Entity>singleton(server)));
}
use of com.haulmont.cuba.core.entity.Server in project cuba by cuba-platform.
the class DataManagerTest method testLoadListCaseInsensitiveLower.
@Test
public void testLoadListCaseInsensitiveLower() {
Server server = new Server();
server.setName("LocalHost");
server.setRunning(true);
DataManager dataManager = AppBeans.get(DataManager.NAME);
dataManager.commit(new CommitContext(Collections.<Entity>singleton(server)));
LoadContext<Server> loadContext = LoadContext.create(Server.class);
loadContext.setQueryString("select s from sys$Server s where s.name like :name").setParameter("name", "(?i)%localhost%");
List<Server> list = dataManager.loadList(loadContext);
assertTrue(list.size() > 0);
}
use of com.haulmont.cuba.core.entity.Server in project cuba by cuba-platform.
the class DataManagerTest method testLoad.
@Test
public void testLoad() {
Server server = new Server();
UUID id = server.getId();
server.setName("localhost");
server.setRunning(true);
dataManager.commit(new CommitContext(Collections.<Entity>singleton(server)));
LoadContext<Server> loadContext = LoadContext.create(Server.class).setId(id);
server = dataManager.load(loadContext);
assertEquals("localhost", server.getName());
}
use of com.haulmont.cuba.core.entity.Server in project cuba by cuba-platform.
the class DataManagerTest method testDataManagerLoadOneRecord.
@Test
public void testDataManagerLoadOneRecord() {
Server server1 = new Server();
server1.setName("app1");
server1.setRunning(false);
Server server2 = new Server();
server2.setName("app2");
server2.setRunning(false);
dataManager.commit(new CommitContext(server1, server2));
LoadContext<Server> lc = new LoadContext<>(Server.class);
lc.setQueryString("select s from sys$Server s order by s.name").setMaxResults(1);
Server latest = dataManager.load(lc);
assertEquals(server1, latest);
}
Aggregations