Not sure if you saw this, but org.apache.cassandra.net.sink has a
SinkManager class and an interface for implementing message sinks. Basically
it lets you catch messages as they are being sent or received by
MessagingService.

Could be useful, and is used in a couple other tests.

On Sun, Oct 23, 2011 at 11:54 AM, Zach Richardson <z...@raveldata.com>wrote:

> Thanks,
>
> Will give these a shot.
>
> On Sun, Oct 23, 2011 at 11:18 AM, Jonathan Ellis <jbel...@gmail.com>
> wrote:
>
> > I see a couple options.
> >
> > StorageProxy has this constant:
> >
> >    private static final boolean OPTIMIZE_LOCAL_REQUESTS = true; //
> > set to false to test messagingservice path on single node
> >
> > So, you could make it an instance variable and create a SP object with
> > it set to false for tests.
> >
> > Or, you could do a test using ccm for multinode control, as in the
> > long_read.sh test on
> > https://issues.apache.org/jira/browse/CASSANDRA-3303.
> >
> > On Fri, Oct 21, 2011 at 4:28 PM, Zach Richardson
> > <j.zach.richard...@gmail.com> wrote:
> > > Hi All,
> > >
> > > I have been working on an implementation for internode compression
> > > (CASSANDRA-3127.) https://issues.apache.org/jira/browse/CASSANDRA-3127
> > >
> > > I have written code that "works," but I'm looking for some advice on
> > > how to write unit tests for it.  At the moment it compresses where:
> > >
> > > interrnode_message_compression_threshold > 0 means it compress
> > > messages larger than it
> > > compresses all messags if it is == 0
> > > and compresses none if less than 0
> > >
> > > The code itself has been tested in an environment outside of cassandra
> > > (i.e. a few mock classes, and a heavily modified OutboundTcpConnection
> > > and IncomingTcpConnection.) and inside of Cassandra all of the current
> > > unit tests are passing.
> > >
> > > Since I can't inject a mocked MessagingService into
> > > IncomingTcpConnection, I'm guessing I have to do the testing from the
> > > outside of MessagingService, but the MessagingService itself checks to
> > > see if you are sending messages to yourself, and doesn't put them over
> > > the connection.  Are there any tricks to letting me mock different
> > > endpoints from within a unit test?
> > >
> > > Can this only be tested in a distributed fashion at the OS level?
> > >
> > > Also the internode_message_compression_threshold is set through the
> > > cassandra.yaml file--is it possible to set these properties at
> > > runtime?  Can I just change the public entry for it in the static
> > > Config class directly, or will that break other things?
> > >
> > > Thanks for you help and time,
> > >
> > > Zach
> > >
> >
> >
> >
> > --
> > Jonathan Ellis
> > Project Chair, Apache Cassandra
> > co-founder of DataStax, the source for professional Cassandra support
> > http://www.datastax.com
> >
>
>
>
> --
> Zach Richardson
> Ravel, Co-founder
> Austin, TX
> z...@raveldata.com
> 512.825.6031
>

Reply via email to