Esempio n. 1
0
 virtual
 DBClientConnection *newClientConnection() const {
     MockDBClientConnection * c = new MockDBClientConnection();
     c->connect( connect_ );
     c->one( one_ );
     return c;
 }
Esempio n. 2
0
            void run() {
                ReplPair rp( "a", "b" );
                MockDBClientConnection cc;

                cc.one( res( 0, 0 ) );
                rp.negotiate( &cc, "dummy" );
                ASSERT( rp.state == ReplPair::State_Confused );

                rp.state = ReplPair::State_Negotiating;
                cc.one( res( 1, 2 ) );
                rp.negotiate( &cc, "dummy" );
                ASSERT( rp.state == ReplPair::State_Negotiating );

                cc.one( res( 1, ReplPair::State_Slave ) );
                rp.negotiate( &cc, "dummy" );
                ASSERT( rp.state == ReplPair::State_Slave );

                cc.one( res( 1, ReplPair::State_Master ) );
                rp.negotiate( &cc, "dummy" );
                ASSERT( rp.state == ReplPair::State_Master );
            }