CUBA licensing (fix tests). #PL-2347

This commit is contained in:
Konstantin Krivopustov 2013-08-07 11:13:26 +00:00
parent d1796e321b
commit a7640ac50c
4 changed files with 21 additions and 5 deletions

View File

@ -57,14 +57,14 @@ import java.util.concurrent.ConcurrentHashMap;
@ManagedBean(UserSessionsAPI.NAME)
public final class UserSessions implements UserSessionsAPI {
private static class UserSessionInfo implements Serializable {
static class UserSessionInfo implements Serializable {
private static final long serialVersionUID = -4834267718111570841L;
private final UserSession session;
private final long since;
private volatile long lastUsedTs; // set to 0 when propagating removal to cluster
final UserSession session;
final long since;
volatile long lastUsedTs; // set to 0 when propagating removal to cluster
private UserSessionInfo(UserSession session, long now) {
UserSessionInfo(UserSession session, long now) {
this.session = session;
this.since = now;
this.lastUsedTs = now;

View File

@ -10,6 +10,7 @@
*/
package com.haulmont.cuba.core;
import com.haulmont.bali.db.QueryRunner;
import com.haulmont.cuba.core.app.DataService;
import com.haulmont.cuba.core.entity.Entity;
import com.haulmont.cuba.core.entity.Server;
@ -30,6 +31,9 @@ public class DataServiceTest extends CubaTestCase {
public void setUp() throws Exception {
super.setUp();
dataService = AppBeans.get(DataService.class);
QueryRunner runner = new QueryRunner(persistence.getDataSource());
runner.update("delete from SYS_SERVER");
}
public void test() {

View File

@ -9,6 +9,7 @@
*/
package com.haulmont.cuba.core;
import com.haulmont.bali.db.QueryRunner;
import com.haulmont.cuba.core.entity.Server;
import com.haulmont.cuba.core.global.View;
import com.haulmont.cuba.security.entity.Group;
@ -24,6 +25,9 @@ public class PersistenceTest extends CubaTestCase {
protected void setUp() throws Exception {
super.setUp();
QueryRunner runner = new QueryRunner(persistence.getDataSource());
runner.update("delete from SYS_SERVER");
Transaction tx = persistence.createTransaction();
try {
EntityManager em = persistence.getEntityManager();

View File

@ -5,6 +5,7 @@
*/
package com.haulmont.cuba.core;
import com.haulmont.bali.db.QueryRunner;
import com.haulmont.cuba.core.entity.Server;
import java.util.List;
@ -18,6 +19,13 @@ public class TransactionTest extends CubaTestCase {
private static final String TEST_EXCEPTION_MSG = "test exception";
@Override
public void setUp() throws Exception {
super.setUp();
QueryRunner runner = new QueryRunner(persistence.getDataSource());
runner.update("delete from SYS_SERVER");
}
public void testNoTransaction() {
try {
EntityManager em = persistence.getEntityManager();