| | |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | import java.io.OutputStream; |
| | | import java.math.BigInteger; |
| | | import java.net.InetSocketAddress; |
| | | import java.net.ServerSocket; |
| | | import java.net.Socket; |
| | |
| | | |
| | | private int scenario = -1; |
| | | private long generationId = -1; |
| | | private ProtocolSession session = null; |
| | | |
| | | private ChangeNumberGenerator gen = null; |
| | | |
| | |
| | | // Number of received updates |
| | | private int nReceivedUpdates = 0; |
| | | |
| | | private boolean sameGidAsRs = true; |
| | | |
| | | private int nWrongReceivedUpdates = 0; |
| | | |
| | | /** |
| | |
| | | ProtocolSession session) |
| | | { |
| | | super.sessionInitiated(initStatus, replicationServerState, generationId, session); |
| | | this.session = session; |
| | | } |
| | | |
| | | @Override |
| | |
| | | * All possible combinations tested thanks to the provider |
| | | */ |
| | | @Test(dataProvider = "testSafeDataLevelOneProvider", groups = "slow", enabled = true) |
| | | public void testSafeDataLevelOne(int mainDsGid, boolean otherFakeDS, boolean fakeRS, int otherFakeDsGid, int fakeRsGid) throws Exception |
| | | public void testSafeDataLevelOne( |
| | | int mainDsGid, boolean otherFakeDS, boolean fakeRS, |
| | | int otherFakeDsGid, int fakeRsGid) throws Exception |
| | | { |
| | | String testCase = "testSafeDataLevelOne"; |
| | | |
| | |
| | | // Timeout scenario used so that no reply is made if however the real RS |
| | | // by mistake sends an assured error and expects an ack from this DS: |
| | | // this would timeout. If main DS group id is not the same as the real RS one, |
| | | // the update will even not come to real RS as asured |
| | | // the update will even not come to real RS as assured |
| | | fakeRd2 = createFakeReplicationDomain(FDS2_ID, otherFakeDsGid, RS1_ID, |
| | | DEFAULT_GENID, false, AssuredMode.SAFE_DATA_MODE, 1, LONG_TIMEOUT, |
| | | TIMEOUT_DS_SCENARIO); |
| | |
| | | // Timeout scenario used so that no reply is made if however the real RS |
| | | // by mistake sends an assured error and expects an ack from this fake RS: |
| | | // this would timeout. If main DS group id is not the same as the real RS one, |
| | | // the update will even not come to real RS as asured |
| | | // the update will even not come to real RS as assured |
| | | fakeRs1 = createFakeReplicationServer(FRS1_ID, fakeRsGid, RS1_ID, |
| | | DEFAULT_GENID, false, AssuredMode.SAFE_DATA_MODE, 1, new ServerState(), TIMEOUT_RS_SCENARIO); |
| | | assertNotNull(fakeRs1); |
| | |
| | | } |
| | | |
| | | // Sanity check |
| | | sleep(500); // Let time to update to reach other servers |
| | | assertEquals(fakeRd1.getReceivedUpdates(), 0); |
| | | assertTrue(fakeRd1.receivedUpdatesOk()); |
| | | if (otherFakeDS) |