"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "common/src/test/java/com/tc/net/protocol/transport/TCConnectionTransportTest.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.

TCConnectionTransportTest.java  (terracotta-core-5.7.0):TCConnectionTransportTest.java  (terracotta-core-5.7.1)
skipping to change at line 51 skipping to change at line 51
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Random; import java.util.Random;
import java.util.concurrent.BrokenBarrierException; import java.util.concurrent.BrokenBarrierException;
import java.util.concurrent.CyclicBarrier; import java.util.concurrent.CyclicBarrier;
import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.atomic.AtomicLong;
import junit.framework.TestCase; import junit.framework.TestCase;
import com.tc.net.protocol.TCProtocolAdaptor; import com.tc.net.protocol.TCProtocolAdaptor;
import com.tc.util.PortChooser;
import org.terracotta.utilities.test.net.PortManager;
/** /**
* To Test Message Packup happening at the comms writer. * To Test Message Packup happening at the comms writer.
*/ */
public class TCConnectionTransportTest extends TestCase { public class TCConnectionTransportTest extends TestCase {
private TCConnectionManager connMgr; private TCConnectionManager connMgr;
private PortManager.PortRef portRef;
private TCListener server; private TCListener server;
private final AtomicLong sentMessagesTotalLength = new AtomicLong(0); private final AtomicLong sentMessagesTotalLength = new AtomicLong(0);
private final AtomicLong rcvdMessagesTotalLength = new AtomicLong(0); private final AtomicLong rcvdMessagesTotalLength = new AtomicLong(0);
// private final AtomicLong sentMessages2 = new AtomicLong(0); // private final AtomicLong sentMessages2 = new AtomicLong(0);
private final AtomicLong rcvdMessages2TotalLength = new AtomicLong(0); private final AtomicLong rcvdMessages2TotalLength = new AtomicLong(0);
private final AtomicBoolean fullySent = new AtomicBoolean(false ); private final AtomicBoolean fullySent = new AtomicBoolean(false );
@Override @Override
protected void setUp() throws Exception { protected void setUp() throws Exception {
connMgr = new TCConnectionManagerImpl(); connMgr = new TCConnectionManagerImpl();
ProtocolAdaptorFactory factory = new ProtocolAdaptorFactory() { ProtocolAdaptorFactory factory = new ProtocolAdaptorFactory() {
@Override @Override
public TCProtocolAdaptor getInstance() { public TCProtocolAdaptor getInstance() {
return new WireProtocolAdaptorImpl(new ServerWPMGSink()); return new WireProtocolAdaptorImpl(new ServerWPMGSink());
} }
}; };
server = connMgr.createListener(new TCSocketAddress(new PortChooser().choose portRef = PortManager.getInstance().reservePort();
RandomPort()), factory); server = connMgr.createListener(new TCSocketAddress(portRef.port()), factory
);
} }
@Override @Override
protected void tearDown() throws Exception { protected void tearDown() throws Exception {
connMgr.shutdown(); connMgr.shutdown();
server.stop(); server.stop();
portRef.close();
} }
Random r = new Random(); Random r = new Random();
public void testBasic() throws TCTimeoutException, IOException, InterruptedExc eption, BrokenBarrierException { public void testBasic() throws TCTimeoutException, IOException, InterruptedExc eption, BrokenBarrierException {
final TCConnection clientConn = connMgr.createConnection(new WireProtocolAda ptorImpl(new ClientWPMGSink())); final TCConnection clientConn = connMgr.createConnection(new WireProtocolAda ptorImpl(new ClientWPMGSink()));
clientConn.connect(new TCSocketAddress(server.getBindPort()), 3000); clientConn.connect(new TCSocketAddress(server.getBindPort()), 3000);
final CyclicBarrier startBarrier = new CyclicBarrier(2); final CyclicBarrier startBarrier = new CyclicBarrier(2);
final CyclicBarrier endBarrier = new CyclicBarrier(2); final CyclicBarrier endBarrier = new CyclicBarrier(2);
 End of changes. 4 change blocks. 
3 lines changed or deleted 7 lines changed or added

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