use of org.eclipse.scout.rt.platform.transaction.ITransaction in project scout.rt by eclipse.
the class ServerTestRunnerSameSessionTest method test2.
@Test
public void test2() {
ISession serverSession = IServerSession.CURRENT.get();
assertTrue(serverSession instanceof JUnitServerSession);
assertEquals("anna", serverSession.getUserId());
m_serverSessions.add(serverSession);
ITransaction transaction = ITransaction.CURRENT.get();
assertNotNull(transaction);
m_transactions.add(transaction);
}
use of org.eclipse.scout.rt.platform.transaction.ITransaction in project scout.rt by eclipse.
the class ServerTestRunnerSameSessionTest method afterClass.
@AfterClass
public static void afterClass() {
ISession serverSession = IServerSession.CURRENT.get();
assertTrue(serverSession instanceof JUnitServerSession);
assertEquals("anna", serverSession.getUserId());
m_serverSessions.add(serverSession);
ITransaction transaction = ITransaction.CURRENT.get();
assertNotNull(transaction);
m_transactions.add(transaction);
assertEquals(1, m_serverSessions.size());
// (beforeClass), (before,test1,after), (before,test2,after), (afterClass)
assertEquals(4, m_transactions.size());
}
use of org.eclipse.scout.rt.platform.transaction.ITransaction in project scout.rt by eclipse.
the class ServerTestRunnerSameSessionTest method test1.
@Test
public void test1() {
ISession serverSession = IServerSession.CURRENT.get();
assertTrue(serverSession instanceof JUnitServerSession);
assertEquals("anna", serverSession.getUserId());
m_serverSessions.add(serverSession);
ITransaction transaction = ITransaction.CURRENT.get();
assertNotNull(transaction);
m_transactions.add(transaction);
}
use of org.eclipse.scout.rt.platform.transaction.ITransaction in project scout.rt by eclipse.
the class AbstractTransactionalJmsService method getTransaction.
protected JmsTransactionMember<T> getTransaction() {
ITransaction tx = Assertions.assertNotNull(ITransaction.CURRENT.get(), "Transaction required");
@SuppressWarnings("unchecked") JmsTransactionMember<T> m = (JmsTransactionMember<T>) tx.getMember(getTransactionId());
if (m == null) {
Connection connection = getConnection();
m = new JmsTransactionMember<T>(getTransactionId(), connection, createSession(connection), getDestination(), createMessageSerializer());
tx.registerMember(m);
}
return m;
}
use of org.eclipse.scout.rt.platform.transaction.ITransaction in project scout.rt by eclipse.
the class AbstractTransactionalMapTest method testRemove.
@Test
public void testRemove() {
ITransaction tr1 = createNewTransaction();
ITransaction tr2 = createNewTransaction();
Map<Integer, String> initalMap = new HashMap<Integer, String>();
initalMap.put(1, "1");
initalMap.put(2, "2");
initalMap.put(3, "3");
Map<Integer, String> map = createTransactionalMap(TRANSACTION_MEMBER_ID, false, initalMap);
// shared
ITransaction.CURRENT.set(null);
assertMapStateSimple(map, 1, "1", 2, "2", 3, "3");
// tr1
ITransaction.CURRENT.set(tr1);
map.remove(1);
map.remove(2);
assertMapStateSimple(map, 3, "3");
// shared
ITransaction.CURRENT.set(null);
assertMapStateSimple(map, 1, "1", 2, "2", 3, "3");
// tr2
ITransaction.CURRENT.set(tr2);
map.remove(2);
map.remove(3);
assertMapStateSimple(map, 1, "1");
// shared
ITransaction.CURRENT.set(null);
assertMapStateSimple(map, 1, "1", 2, "2", 3, "3");
commitTransaction(tr1);
assertMapStateSimple(map, 3, "3");
commitTransaction(tr2);
assertMapState(map, Collections.<Integer, String>emptyMap());
}
Aggregations