public void testReplicationConnectionNoSlavesRemainOnMaster() throws Exception {
  Properties props=getPropertiesFromTestsuiteUrl();
  String masterHost=props.getProperty(NonRegisteringDriver.HOST_PROPERTY_KEY) + ":" + props.getProperty(NonRegisteringDriver.PORT_PROPERTY_KEY);
  ReplicationConnection replConn=getTestReplicationConnectionNoSlaves(masterHost);
  Statement s=replConn.createStatement();
  ResultSet rs1=s.executeQuery("select CONNECTION_ID()");
  assertTrue(rs1.next());
  int masterConnectionId=rs1.getInt(1);
  rs1.close();
  s.close();
  replConn.addSlaveHost(masterHost);
  s=replConn.createStatement();
  rs1=s.executeQuery("select CONNECTION_ID()");
  assertTrue(rs1.next());
  assertEquals(masterConnectionId,rs1.getInt(1));
  assertFalse(replConn.isReadOnly());
  rs1.close();
  s.close();
}

public void testReplicationConnectionNoSlavesRemainOnMaster ( ) throws Exception { Properties props = getPropertiesFromTestsuiteUrl ( ) ; String masterHost = props . getProperty ( NonRegisteringDriver . HOST_PROPERTY_KEY ) + ":" + props . getProperty ( NonRegisteringDriver . PORT_PROPERTY_KEY ) ; ReplicationConnection replConn = getTestReplicationConnectionNoSlaves ( masterHost ) ; Statement s = replConn . createStatement ( ) ; ResultSet rs1 = s . executeQuery ( "select CONNECTION_ID()" ) ; assertTrue ( rs1 . next ( ) ) ; int masterConnectionId = rs1 . getInt ( 1 ) ; rs1 . close ( ) ; s . close ( ) ; replConn . addSlaveHost ( masterHost ) ; s = replConn . createStatement ( ) ; rs1 = s . executeQuery ( "select CONNECTION_ID()" ) ; assertTrue ( rs1 . next ( ) ) ; assertEquals ( masterConnectionId , rs1 . getInt ( 1 ) ) ; assertFalse ( replConn . isReadOnly ( ) ) ; rs1 . close ( ) ; s . close ( ) ; }
test that we remain on the master when : - the connection is not in read - only mode - no slaves are configured - a new slave is added
