'Test udt exports'

def test_export_keyspace_schema_udts(self):

    if (CASS_SERVER_VERSION < (2, 1, 0)):
        raise unittest.SkipTest('UDTs    were    introduced    in    Cassandra    2.1')
    if (PROTOCOL_VERSION < 3):
        raise unittest.SkipTest(('Protocol    3.0+    is    required    for    UDT    change    events,    currently    testing    against    %r' % (PROTOCOL_VERSION,)))
    if (sys.version_info[0:2] != (2, 7)):
        raise unittest.SkipTest('This    test    compares    static    strings    generated    from    dict    items,    which    may    change    orders.    Test    with    2.7.')
    cluster = Cluster(protocol_version=PROTOCOL_VERSION)
    session = cluster.connect()
    session.execute("\n                                                CREATE    KEYSPACE    export_udts\n                                                WITH    replication    =    {'class':    'SimpleStrategy',    'replication_factor':    '1'}\n                                                AND    durable_writes    =    true;\n                                ")
    session.execute('\n                                                CREATE    TYPE    export_udts.street    (\n                                                                street_number    int,\n                                                                street_name    text)\n                                ')
    session.execute('\n                                                CREATE    TYPE    export_udts.zip    (\n                                                                zipcode    int,\n                                                                zip_plus_4    int)\n                                ')
    session.execute('\n                                                CREATE    TYPE    export_udts.address    (\n                                                                street_address    frozen<street>,\n                                                                zip_code    frozen<zip>)\n                                ')
    session.execute('\n                                                CREATE    TABLE    export_udts.users    (\n                                                user    text    PRIMARY    KEY,\n                                                addresses    map<text,    frozen<address>>)\n                                ')
    expected_prefix = "CREATE    KEYSPACE    export_udts    WITH    replication    =    {'class':    'SimpleStrategy',    'replication_factor':    '1'}        AND    durable_writes    =    true;\n\nCREATE    TYPE    export_udts.street    (\n                street_number    int,\n                street_name    text\n);\n\nCREATE    TYPE    export_udts.zip    (\n                zipcode    int,\n                zip_plus_4    int\n);\n\nCREATE    TYPE    export_udts.address    (\n                street_address    frozen<street>,\n                zip_code    frozen<zip>\n);\n\nCREATE    TABLE    export_udts.users    (\n                user    text    PRIMARY    KEY,\n                addresses    map<text,    frozen<address>>"
    self.assert_startswith_diff(cluster.metadata.keyspaces['export_udts'].export_as_string(), expected_prefix)
    table_meta = cluster.metadata.keyspaces['export_udts'].tables['users']
    expected_prefix = 'CREATE    TABLE    export_udts.users    (\n                user    text    PRIMARY    KEY,\n                addresses    map<text,    frozen<address>>'
    self.assert_startswith_diff(table_meta.export_as_string(), expected_prefix)
    cluster.shutdown()
