Replace transaction.setComplete() by database.commitTransaction()

This commit is contained in:
Torsten Grote
2016-10-31 08:47:11 -02:00
parent 36f087c512
commit b34b4623ed
39 changed files with 259 additions and 241 deletions

View File

@@ -199,8 +199,7 @@ public class IntroduceeManagerTest extends BriarTestCase {
introduceeManager.incomingMessage(txn, state, msg);
context.assertIsSatisfied();
assertFalse(txn.isComplete());
assertFalse(txn.isCommitted());
}
@Test
@@ -234,8 +233,7 @@ public class IntroduceeManagerTest extends BriarTestCase {
introduceeManager.incomingMessage(txn, state, msg);
context.assertIsSatisfied();
assertFalse(txn.isComplete());
assertFalse(txn.isCommitted());
}
@Test
@@ -297,7 +295,7 @@ public class IntroduceeManagerTest extends BriarTestCase {
assertTrue(e.getCause() instanceof GeneralSecurityException);
}
context.assertIsSatisfied();
assertFalse(txn.isComplete());
assertFalse(txn.isCommitted());
}
@Test
@@ -448,6 +446,7 @@ public class IntroduceeManagerTest extends BriarTestCase {
BdfDictionary result = introduceeManager.initialize(txn, groupId, msg);
context.assertIsSatisfied();
assertFalse(txn.isCommitted());
return result;
}

View File

@@ -179,8 +179,7 @@ public class IntroducerManagerTest extends BriarTestCase {
.makeIntroduction(txn, introducee1, introducee2, null, time);
context.assertIsSatisfied();
assertFalse(txn.isComplete());
assertFalse(txn.isCommitted());
}
private ClientId getClientId() {

View File

@@ -31,7 +31,6 @@ import java.util.Collection;
import java.util.Collections;
import java.util.Map;
import static junit.framework.TestCase.assertTrue;
import static org.briarproject.api.identity.AuthorConstants.MAX_PUBLIC_KEY_LENGTH;
import static org.briarproject.api.introduction.IntroductionConstants.GROUP_ID_1;
import static org.briarproject.api.introduction.IntroductionConstants.GROUP_ID_2;
@@ -153,6 +152,7 @@ public class IntroductionManagerImplTest extends BriarTestCase {
oneOf(clientHelper)
.mergeGroupMetadata(txn, introductionGroup2.getId(),
metadataAfter);
oneOf(db).commitTransaction(txn);
oneOf(db).endTransaction(txn);
}});
@@ -160,7 +160,6 @@ public class IntroductionManagerImplTest extends BriarTestCase {
.makeIntroduction(introducee1, introducee2, null, time);
context.assertIsSatisfied();
assertTrue(txn.isComplete());
}
@Test
@@ -188,6 +187,7 @@ public class IntroductionManagerImplTest extends BriarTestCase {
oneOf(clientHelper)
.mergeGroupMetadata(txn, introductionGroup1.getId(),
metadataAfter);
oneOf(db).commitTransaction(txn);
oneOf(db).endTransaction(txn);
}});
@@ -195,7 +195,6 @@ public class IntroductionManagerImplTest extends BriarTestCase {
.acceptIntroduction(introducee1.getId(), sessionId, time);
context.assertIsSatisfied();
assertTrue(txn.isComplete());
}
@Test
@@ -223,6 +222,7 @@ public class IntroductionManagerImplTest extends BriarTestCase {
oneOf(clientHelper)
.mergeGroupMetadata(txn, introductionGroup1.getId(),
metadataAfter);
oneOf(db).commitTransaction(txn);
oneOf(db).endTransaction(txn);
}});
@@ -230,7 +230,6 @@ public class IntroductionManagerImplTest extends BriarTestCase {
.declineIntroduction(introducee1.getId(), sessionId, time);
context.assertIsSatisfied();
assertTrue(txn.isComplete());
}
@Test
@@ -254,13 +253,13 @@ public class IntroductionManagerImplTest extends BriarTestCase {
oneOf(db).getMessageStatus(txn, introducee1.getId(),
introductionGroup1.getId());
will(returnValue(statuses));
oneOf(db).commitTransaction(txn);
oneOf(db).endTransaction(txn);
}});
introductionManager.getIntroductionMessages(introducee1.getId());
context.assertIsSatisfied();
assertTrue(txn.isComplete());
}
@Test
@@ -295,7 +294,7 @@ public class IntroductionManagerImplTest extends BriarTestCase {
.incomingMessage(txn, message1, new BdfList(), msg);
context.assertIsSatisfied();
assertFalse(txn.isComplete());
assertFalse(txn.isCommitted());
}
@Test
@@ -334,7 +333,7 @@ public class IntroductionManagerImplTest extends BriarTestCase {
.incomingMessage(txn, message1, new BdfList(), msg);
context.assertIsSatisfied();
assertFalse(txn.isComplete());
assertFalse(txn.isCommitted());
}

View File

@@ -22,7 +22,6 @@ import org.jmock.Expectations;
import org.jmock.Mockery;
import org.junit.Test;
import static junit.framework.Assert.assertFalse;
import static org.briarproject.api.identity.AuthorConstants.MAX_SIGNATURE_LENGTH;
import static org.briarproject.api.introduction.IntroductionConstants.GROUP_ID;
import static org.briarproject.api.introduction.IntroductionConstants.MAC;
@@ -30,6 +29,7 @@ import static org.briarproject.api.introduction.IntroductionConstants.SESSION_ID
import static org.briarproject.api.introduction.IntroductionConstants.SIGNATURE;
import static org.briarproject.api.introduction.IntroductionConstants.TYPE;
import static org.briarproject.api.introduction.IntroductionConstants.TYPE_ACK;
import static org.junit.Assert.assertFalse;
public class MessageSenderTest extends BriarTestCase {
@@ -94,7 +94,7 @@ public class MessageSenderTest extends BriarTestCase {
messageSender.sendMessage(txn, msg);
context.assertIsSatisfied();
assertFalse(txn.isComplete());
assertFalse(txn.isCommitted());
}
}