'Test to validate prepare_on_all_hosts flag is honored.
Use a special ForcedHostSwitchPolicy to ensure prepared queries are cycled over nodes that should not
have them prepared. Check the logs to insure they are being re-prepared on those nodes
@since 3.4.0
@jira_ticket PYTHON-556
@expected_result queries will have to re-prepared on hosts that aren\'t the control connection'

def test_prepare_on_all_hosts(self):

    white_list = ForcedHostSwitchPolicy()
    clus = Cluster(load_balancing_policy=white_list, protocol_version=PROTOCOL_VERSION, prepare_on_all_hosts=False, reprepare_on_up=False)
    self.addCleanup(clus.shutdown)
    session = clus.connect(wait_for_all_pools=True)
    mock_handler = MockLoggingHandler()
    logger = logging.getLogger(cluster.__name__)
    logger.addHandler(mock_handler)
    select_statement = session.prepare('SELECT    *    FROM    system.local')
    session.execute(select_statement)
    session.execute(select_statement)
    session.execute(select_statement)
    self.assertEqual(2, mock_handler.get_message_count('debug', 'Re-preparing'))
