public void testBug19169() throws Exception {
  MysqlDataSource toSerialize=new MysqlDataSource();
  toSerialize.setZeroDateTimeBehavior("convertToNull");
  boolean testBooleanFlag=!toSerialize.getAllowLoadLocalInfile();
  toSerialize.setAllowLoadLocalInfile(testBooleanFlag);
  int testIntFlag=toSerialize.getBlobSendChunkSize() + 1;
  toSerialize.setBlobSendChunkSize(String.valueOf(testIntFlag));
  ByteArrayOutputStream bOut=new ByteArrayOutputStream();
  ObjectOutputStream objOut=new ObjectOutputStream(bOut);
  objOut.writeObject(toSerialize);
  objOut.flush();
  ObjectInputStream objIn=new ObjectInputStream(new ByteArrayInputStream(bOut.toByteArray()));
  MysqlDataSource thawedDs=(MysqlDataSource)objIn.readObject();
  assertEquals("convertToNull",thawedDs.getZeroDateTimeBehavior());
  assertEquals(testBooleanFlag,thawedDs.getAllowLoadLocalInfile());
  assertEquals(testIntFlag,thawedDs.getBlobSendChunkSize());
}

public void testBug19169 ( ) throws Exception { MysqlDataSource toSerialize = new MysqlDataSource ( ) ; toSerialize . setZeroDateTimeBehavior ( "convertToNull" ) ; boolean testBooleanFlag = ! toSerialize . getAllowLoadLocalInfile ( ) ; toSerialize . setAllowLoadLocalInfile ( testBooleanFlag ) ; int testIntFlag = toSerialize . getBlobSendChunkSize ( ) + 1 ; toSerialize . setBlobSendChunkSize ( String . valueOf ( testIntFlag ) ) ; ByteArrayOutputStream bOut = new ByteArrayOutputStream ( ) ; ObjectOutputStream objOut = new ObjectOutputStream ( bOut ) ; objOut . writeObject ( toSerialize ) ; objOut . flush ( ) ; ObjectInputStream objIn = new ObjectInputStream ( new ByteArrayInputStream ( bOut . toByteArray ( ) ) ) ; MysqlDataSource thawedDs = ( MysqlDataSource ) objIn . readObject ( ) ; assertEquals ( "convertToNull" , thawedDs . getZeroDateTimeBehavior ( ) ) ; assertEquals ( testBooleanFlag , thawedDs . getAllowLoadLocalInfile ( ) ) ; assertEquals ( testIntFlag , thawedDs . getBlobSendChunkSize ( ) ) ; }
tests fix for bug # 19169 - connectionproperties ( and thus some subclasses ) are not serializable , even though some j2ee containers expect them to be .
