当前位置: 首页>>代码示例>>Python>>正文


Python connection.ConnectMessage类代码示例

本文整理汇总了Python中pyorient.messages.connection.ConnectMessage的典型用法代码示例。如果您正苦于以下问题:Python ConnectMessage类的具体用法?Python ConnectMessage怎么用?Python ConnectMessage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了ConnectMessage类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_db_open_connected

    def test_db_open_connected(self):

        connection = OrientSocket( "localhost", 2424 )
        conn_msg = ConnectMessage( connection )

        print("%r" % conn_msg.get_protocol())
        assert conn_msg.get_protocol() != -1

        session_id = conn_msg.prepare( ("admin", "admin") )\
            .send().fetch_response()

        print("Sid: %s" % session_id)
        assert session_id == connection.session_id
        assert session_id != -1
        # ##################

        msg = DbOpenMessage( connection )

        db_name = "GratefulDeadConcerts"
        cluster_info = msg.prepare(
            (db_name, "admin", "admin", DB_TYPE_DOCUMENT, "")
        ).send().fetch_response()

        print("Cluster: %s" % cluster_info)
        assert len(cluster_info) != 0
开发者ID:vget,项目名称:pyorient,代码行数:25,代码来源:test_raw_messages_1.py

示例2: test_shutdown

    def test_shutdown(self):

        import inspect
        print("# WARNING comment return below this line " \
              "to test this message. Line %u" % \
              inspect.currentframe().f_back.f_lineno)
        return

        connection = OrientSocket( "localhost", 2424 )
        msg = ConnectMessage( connection )
        print("%r" % msg.get_protocol())
        assert msg.get_protocol() != -1

        sid = msg.prepare( ("admin", "admin") )\
            .send().fetch_response()
        """
        alternative use
            session_id = msg.set_user("admin").set_pass("admin").prepare()\
            .send().fetch_response()
        """
        print("%r" % sid)
        assert sid != -1

        shut_msg = ShutdownMessage(connection)
        res = shut_msg.prepare(("root", "16ABC88EB0CAEE3774E00BABB6D19E69FD3495D6BFA32CAF8AD95A64DA7415CE")).\
            send().send().fetch_response()

        assert res[:] == []
开发者ID:vget,项目名称:pyorient,代码行数:28,代码来源:test_raw_messages_1.py

示例3: test_db_exists

    def test_db_exists(self):

        connection = OrientSocket( "localhost", 2424 )
        msg = ConnectMessage( connection )
        print("%r" % msg.get_protocol())
        assert msg.get_protocol() != -1

        session_id = msg.prepare( ("admin", "admin") )\
            .send().fetch_response()

        print("Sid: %s" % session_id)
        assert session_id == connection.session_id
        assert session_id != -1

        db_name = "GratefulDeadConcerts"
        # params = ( db_name, STORAGE_TYPE_MEMORY )
        params = ( db_name, STORAGE_TYPE_PLOCAL )

        msg = DbExistsMessage( connection )

        exists = msg.prepare( params ).send().fetch_response()
        assert exists is True

        msg.close()
        print("%r" % exists)
开发者ID:vget,项目名称:pyorient,代码行数:25,代码来源:test_raw_messages_1.py

示例4: test_db_create_with_drop

    def test_db_create_with_drop(self):

        connection = OrientSocket( "localhost", 2424 )
        conn_msg = ConnectMessage( connection )
        print("Protocol: %r" % conn_msg.get_protocol())
        assert connection.protocol != -1

        session_id = conn_msg.prepare( ("admin", "admin") ) \
            .send().fetch_response()

        print("Sid: %s" % session_id)
        assert session_id == connection.session_id
        assert session_id != -1

        # ##################

        db_name = "my_little_test"

        msg = DbExistsMessage( connection )
        exists = msg.prepare( [db_name] ).send().fetch_response()

        print("Before %r" % exists)

        assert exists is True  # should happen every time because of latest test
        if exists is True:
            ( DbDropMessage( connection ) ).prepare([db_name]) \
                .send().fetch_response()

        print("Creation again")
        try:
            ( DbCreateMessage( connection ) ).prepare(
                (db_name, DB_TYPE_DOCUMENT, STORAGE_TYPE_PLOCAL)
            ).send().fetch_response()
            assert True
        except PyOrientCommandException as e:
            print(e.message)
            assert False  # No expected Exception

        msg = DbExistsMessage( connection )
        exists = msg.prepare( [db_name] ).send().fetch_response()
        assert  exists is True

        # at the end drop the test database
        ( DbDropMessage( connection ) ).prepare([db_name]) \
            .send().fetch_response()

        msg.close()
        print("After %r" % exists)
开发者ID:vget,项目名称:pyorient,代码行数:48,代码来源:test_raw_messages_1.py

示例5: test_db_list

    def test_db_list(self):

        connection = OrientSocket( "localhost", 2424 )
        conn_msg = ConnectMessage( connection )

        print("%r" % conn_msg.get_protocol())
        assert conn_msg.get_protocol() != -1

        session_id = conn_msg.prepare( ("root", "root") )\
            .send().fetch_response()


        reload_msg = DbListMessage( connection )
        _list = reload_msg.prepare().send().fetch_response()

        print("Database List: %s" % _list.oRecordData['databases'] )
        assert len(_list.oRecordData['databases']) != 0
开发者ID:brennv,项目名称:pyorient,代码行数:17,代码来源:test_raw_messages_1.py

示例6: test_db_close

    def test_db_close(self):
        connection = OrientSocket( "localhost", 2424 )
        conn_msg = ConnectMessage( connection )
        print("Protocol: %r" % conn_msg.get_protocol())
        assert connection.protocol != -1

        session_id = conn_msg.prepare( ("admin", "admin") ) \
            .send().fetch_response()

        print("Sid: %s" % session_id)
        assert session_id == connection.session_id
        assert session_id != -1

        c_msg = DbCloseMessage( connection )

        closing = c_msg.prepare(None)\
            .send().fetch_response()
        assert closing is 0
开发者ID:vget,项目名称:pyorient,代码行数:18,代码来源:test_raw_messages_1.py

示例7: test_db_create_with_connect

    def test_db_create_with_connect(self):

        connection = OrientSocket( "localhost", 2424 )
        conn_msg = ConnectMessage( connection )
        print("Protocol: %r" % conn_msg.get_protocol())

        session_id = conn_msg.prepare( ("root", "root") )\
            .send().fetch_response()

        print("Sid: %s" % session_id)
        assert session_id == connection.session_id
        assert session_id != -1

        # ##################

        db_name = "my_little_test"
        response = ''
        try:
            ( DbCreateMessage( connection ) ).prepare(
                (db_name, DB_TYPE_DOCUMENT, STORAGE_TYPE_PLOCAL)
            ).send().fetch_response()
        except PyOrientDatabaseException as e:
            assert True
            print(str(e))
        except Exception as e:
            print(str(e))
            assert False

        print("Creation: %r" % response)
        assert len(response) is 0

        msg = DbExistsMessage( connection )

        msg.prepare( (db_name, STORAGE_TYPE_PLOCAL) )
        # msg.prepare( [db_name] )
        exists = msg.send().fetch_response()
        assert exists is True

        msg.close()
        print("%r" % exists)
开发者ID:gaoxuesong,项目名称:pyorient,代码行数:40,代码来源:test_raw_messages_1.py

示例8: test_connection

    def test_connection(self):
        connection = OrientSocket( "localhost", 2424 )
        msg = ConnectMessage( connection )
        print("%r" % msg.get_protocol())
        assert msg.get_protocol() != -1

        session_id = msg.prepare( ("admin", "admin") )\
            .send().fetch_response()
        """
        alternative use
            session_id = msg.set_user("admin").set_pass("admin").prepare()\
            .send().fetch_response()
        """

        assert session_id == connection.session_id
        assert session_id != -1

        msg.close()
        print("%r" % msg._header)
        print("%r" % session_id)
开发者ID:vget,项目名称:pyorient,代码行数:20,代码来源:test_raw_messages_1.py


注:本文中的pyorient.messages.connection.ConnectMessage类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。