"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "tc-messaging/src/test/java/com/tc/object/tx/ServerTransactionIDTest.java" between
terracotta-core-5.7.0.tar.gz and terracotta-core-5.7.1.tar.gz

About: Terracotta - Clustering technology for Java ("Network Attached Memory", "Distributed Cache"). Source code of the server (5.x) core components.

ServerTransactionIDTest.java  (terracotta-core-5.7.0):ServerTransactionIDTest.java  (terracotta-core-5.7.1)
skipping to change at line 27 skipping to change at line 27
* *
*/ */
package com.tc.object.tx; package com.tc.object.tx;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.Random; import java.util.Random;
import com.tc.net.ClientID; import com.tc.net.ClientID;
import com.tc.net.ServerID; import com.tc.net.ServerID;
import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertNotEquals;
public class ServerTransactionIDTest { public class ServerTransactionIDTest {
private ServerTransactionID get(int channel, int txn) { private ServerTransactionID get(int channel, int txn) {
return new ServerTransactionID(new ClientID(channel), new TransactionID(txn) ); return new ServerTransactionID(new ClientID(channel), new TransactionID(txn) );
skipping to change at line 104 skipping to change at line 105
serializeAndCompare(id1); serializeAndCompare(id1);
serializeAndCompare(id2); serializeAndCompare(id2);
Random e = new Random(); Random e = new Random();
for (int i = 1; i <= 10; i++) { for (int i = 1; i <= 10; i++) {
serializeAndCompare(getServerID(e.nextInt(1099), i)); serializeAndCompare(getServerID(e.nextInt(1099), i));
} }
} }
@Test
public void testValidTransactions() throws Exception {
Assert.assertTrue(new TransactionID(0L).isValid());
Assert.assertTrue(new TransactionID(1L).isValid());
Assert.assertTrue(new TransactionID(Long.MAX_VALUE).isValid());
Assert.assertFalse(new TransactionID(Long.MIN_VALUE).isValid());
Assert.assertFalse(TransactionID.NULL_ID.isValid());
Assert.assertTrue(TransactionID.NULL_ID.isNull());
}
private void serializeAndCompare(ServerTransactionID id) { private void serializeAndCompare(ServerTransactionID id) {
byte[] b2 = id.getBytes(); byte[] b2 = id.getBytes();
ServerTransactionID di2 = ServerTransactionID.createFrom(b2); ServerTransactionID di2 = ServerTransactionID.createFrom(b2);
assertEquals(id, di2); assertEquals(id, di2);
} }
} }
 End of changes. 2 change blocks. 
0 lines changed or deleted 11 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)