use of com.haulmont.cuba.core.model.common.Server in project jmix by jmix-framework.
the class TransactionTest method testSuspend.
@Test
public void testSuspend() {
Transaction tx = persistence.getTransaction();
try {
EntityManager em = persistence.getEntityManager();
Server server = new Server();
server.setName("localhost");
server.setRunning(true);
em.persist(server);
Transaction tx1 = persistence.createTransaction();
try {
EntityManager em1 = persistence.getEntityManager();
assertTrue(em != em1);
Query query = em1.createQuery("select s from test$Server s");
List list = query.getResultList();
assertNotNull(list);
tx1.commit();
} finally {
tx1.end();
}
tx.commit();
} finally {
tx.end();
}
}
use of com.haulmont.cuba.core.model.common.Server in project jmix by jmix-framework.
the class TransactionTest method __testCommitRetainingAndRollback.
private void __testCommitRetainingAndRollback() {
UUID id;
Transaction tx = persistence.createTransaction();
try {
EntityManager em = persistence.getEntityManager();
assertNotNull(em);
Server server = new Server();
id = server.getId();
server.setName("localhost");
server.setRunning(true);
em.persist(server);
tx.commitRetaining();
em = persistence.getEntityManager();
server = em.find(Server.class, id);
assertEquals(id, server.getId());
server.setRunning(false);
throwException();
tx.commit();
} finally {
tx.end();
}
}
use of com.haulmont.cuba.core.model.common.Server in project jmix by jmix-framework.
the class NamePatternTest method test.
@Test
public void test() {
Server server = new Server();
server.setName("orion");
server.setRunning(false);
assertEquals("orion", metadataTools.getInstanceName(server));
}
use of com.haulmont.cuba.core.model.common.Server in project jmix by jmix-framework.
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 test$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.model.common.Server in project jmix by jmix-framework.
the class DataManagerTest method testLoadList.
@Test
public void testLoadList() {
Server server = new Server();
server.setName("localhost");
server.setRunning(true);
dataManager.commit(new CommitContext(Collections.<Entity>singleton(server)));
LoadContext<Server> loadContext = LoadContext.create(Server.class);
loadContext.setQueryString("select s from " + metadata.getClass(Server.class).getName() + " s");
List<Server> list = dataManager.loadList(loadContext);
assertTrue(list.size() > 0);
}
Aggregations