/** * Tests reconnection where the server does not provide a matching * signature. Expect failure. */ public void testReconnectionFailure() throws ChannelException { final int initialVersion = 42; final byte[] initialSignature = SIG1; connectChannel(initialVersion, initialSignature); // Simulate failure operationChannel.reset(); // Server presents unknown reconnect version final HashedVersion reconnectVersion = HashedVersion.of(66, SIG2); try { operationChannel.onConnection(reconnectVersion, reconnectVersion); fail("Should have thrown ChannelException"); } catch (ChannelException expected) { } }
/** * Tests reconnection where the server does not provide a matching * signature. Expect failure. */ public void testReconnectionFailure() throws ChannelException { final int initialVersion = 42; final byte[] initialSignature = SIG1; connectChannel(initialVersion, initialSignature); // Simulate failure operationChannel.reset(); // Server presents unknown reconnect version final HashedVersion reconnectVersion = HashedVersion.of(66, SIG2); try { operationChannel.onConnection(reconnectVersion, reconnectVersion); fail("Should have thrown ChannelException"); } catch (ChannelException expected) { } }
/** * Test simple NACK and onDelta. * Nack is not supposed to happen, so it should be death. */ public void testSimpleNackAndReceive() throws Exception { final int initialVersion = 42; connectChannel(initialVersion, SIG1); sendAndCheckRandomOp(operationChannel, initialVersion, SIG1); listener.clear(); try { operationChannel.onNack(ResponseCode.OK, null, 43); fail("Should have thrown ChannelException"); } catch (ChannelException expected) { } checkExpectationsSatisfied(); }
/** * Test simple NACK and onDelta. * Nack is not supposed to happen, so it should be death. */ public void testSimpleNackAndReceive() throws Exception { final int initialVersion = 42; connectChannel(initialVersion, SIG1); sendAndCheckRandomOp(operationChannel, initialVersion, SIG1); listener.clear(); try { operationChannel.onNack(ResponseCode.OK, null, 43); fail("Should have thrown ChannelException"); } catch (ChannelException expected) { } checkExpectationsSatisfied(); }
public void testSendToInaccessibleChanneFails() throws ChannelException { final HashedVersion connectSig = HashedVersion.unsigned(0); deltaChannel = new MockWaveletDeltaChannel(); cc = new ConcurrencyControl(ccLogger, connectSig); operationChannel = new OperationChannelImpl(opLogger, deltaChannel, cc, Accessibility.READ_ONLY); operationChannel.setListener(listener); operationChannel.onConnection(connectSig, connectSig); try { sendAndCheckRandomOp(operationChannel, connectSig.getVersion(), connectSig.getHistoryHash()); fail("Expected a channel exception"); } catch (ChannelException expected) { } }
public void testSendToInaccessibleChanneFails() throws ChannelException { final HashedVersion connectSig = HashedVersion.unsigned(0); deltaChannel = new MockWaveletDeltaChannel(); cc = new ConcurrencyControl(ccLogger, connectSig); operationChannel = new OperationChannelImpl(opLogger, deltaChannel, cc, Accessibility.READ_ONLY); operationChannel.setListener(listener); operationChannel.onConnection(connectSig, connectSig); try { sendAndCheckRandomOp(operationChannel, connectSig.getVersion(), connectSig.getHistoryHash()); fail("Expected a channel exception"); } catch (ChannelException expected) { } }
fail("Should have thrown ChannelException"); } catch (ChannelException expected) {
fail("Should have thrown ChannelException"); } catch (ChannelException expected) {