/** * Connects the channel at the provided version. */ private void connectChannel(long version, byte[] signature) throws ChannelException { final HashedVersion signatureInfo = HashedVersion.of(version, signature); deltaChannel = new MockWaveletDeltaChannel(); cc = new ConcurrencyControl(ccLogger, signatureInfo); operationChannel = new OperationChannelImpl(opLogger, deltaChannel, cc, Accessibility.READ_WRITE); operationChannel.setListener(listener); operationChannel.onConnection(signatureInfo, signatureInfo); }
/** * Connects the channel at the provided version. */ private void connectChannel(long version, byte[] signature) throws ChannelException { final HashedVersion signatureInfo = HashedVersion.of(version, signature); deltaChannel = new MockWaveletDeltaChannel(); cc = new ConcurrencyControl(ccLogger, signatureInfo); operationChannel = new OperationChannelImpl(opLogger, deltaChannel, cc, Accessibility.READ_WRITE); operationChannel.setListener(listener); operationChannel.onConnection(signatureInfo, signatureInfo); }
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) { } }