示例#1
0
文件: test_router.py 项目: 0004c/VTK
         def onJoin(self, details):
            def on_event(*arg, **kwargs):
               pass

            d2 = self.subscribe(on_event, u'com.example.topic1')

            def ok(_):
               FutureMixin._resolve_future(d, None)
            def error(err):
               FutureMixin._reject_future(d, err)

            FutureMixin._add_future_callbacks(d2, ok, error)
示例#2
0
            def onJoin(self, details):
                def on_event(*arg, **kwargs):
                    pass

                d2 = self.subscribe(on_event, u'com.example.topic1')

                def ok(_):
                    FutureMixin._resolve_future(d, None)

                def error(err):
                    FutureMixin._reject_future(d, err)

                FutureMixin._add_future_callbacks(d2, ok, error)
示例#3
0
    def test_add_and_subscribe(self):
        """
      Create an application session that subscribes to some
      topic and add it to a router to run embedded.
      """
        d = FutureMixin._create_future()

        class TestSession(ApplicationSession):
            def onJoin(self, details):
                def on_event(*arg, **kwargs):
                    pass

                d2 = self.subscribe(on_event, u'com.example.topic1')

                def ok(_):
                    FutureMixin._resolve_future(d, None)

                def error(err):
                    FutureMixin._reject_future(d, err)

                FutureMixin._add_future_callbacks(d2, ok, error)

        session = TestSession(types.ComponentConfig('realm1'))

        self.session_factory.add(session)

        if USE_ASYNCIO:
            self.loop.run_until_complete(d)
        elif USE_TWISTED:
            return d
        else:
            raise Exception("logic error")
示例#4
0
文件: test_router.py 项目: 0004c/VTK
   def test_add_and_subscribe(self):
      """
      Create an application session that subscribes to some
      topic and add it to a router to run embedded.
      """
      d = FutureMixin._create_future()

      class TestSession(ApplicationSession):

         def onJoin(self, details):
            def on_event(*arg, **kwargs):
               pass

            d2 = self.subscribe(on_event, u'com.example.topic1')

            def ok(_):
               FutureMixin._resolve_future(d, None)
            def error(err):
               FutureMixin._reject_future(d, err)

            FutureMixin._add_future_callbacks(d2, ok, error)

      session = TestSession(types.ComponentConfig('realm1'))

      self.session_factory.add(session)

      if USE_ASYNCIO:
         self.loop.run_until_complete(d)
      elif USE_TWISTED:
         return d
      else:
         raise Exception("logic error")
示例#5
0
    def test_add_and_subscribe(self):
        """
        Create an application session that subscribes to some
        topic and add it to a router to run embedded.
        """
        d = FutureMixin._create_future()

        class TestSession(ApplicationSession):
            def onJoin(self, details):
                # noinspection PyUnusedLocal
                def on_event(*arg, **kwargs):
                    pass

                d2 = self.subscribe(on_event, u"com.example.topic1")

                def ok(_):
                    FutureMixin._resolve_future(d, None)

                def error(err):
                    FutureMixin._reject_future(d, err)

                FutureMixin._add_future_callbacks(d2, ok, error)

        session = TestSession(types.ComponentConfig(u"realm1"))

        self.session_factory.add(session)

        return d
    def test_add_and_subscribe(self):
        """
        Create an application session that subscribes to some
        topic and add it to a router to run embedded.
        """
        d = FutureMixin._create_future()

        class TestSession(ApplicationSession):

            def onJoin(self, details):
                # noinspection PyUnusedLocal
                def on_event(*arg, **kwargs):
                    pass

                d2 = self.subscribe(on_event, u'com.example.topic1')

                def ok(_):
                    FutureMixin._resolve_future(d, None)

                def error(err):
                    FutureMixin._reject_future(d, err)

                FutureMixin._add_future_callbacks(d2, ok, error)

        session = TestSession(types.ComponentConfig(u'realm1'))

        self.session_factory.add(session)

        return d
示例#7
0
    def test_add(self):
        """
        Create an application session and add it to a router to
        run embedded.
        """
        d = FutureMixin._create_future()

        class TestSession(ApplicationSession):
            def onJoin(self, details):
                FutureMixin._resolve_future(d, None)

        session = TestSession(types.ComponentConfig(u"realm1"))

        self.session_factory.add(session)

        return d
    def test_add(self):
        """
        Create an application session and add it to a router to
        run embedded.
        """
        d = FutureMixin._create_future()

        class TestSession(ApplicationSession):

            def onJoin(self, details):
                FutureMixin._resolve_future(d, None)

        session = TestSession(types.ComponentConfig(u'realm1'))

        self.session_factory.add(session)

        return d
示例#9
0
    def test_add(self):
        """
      Create an application session and add it to a router to
      run embedded.
      """
        d = FutureMixin._create_future()

        class TestSession(ApplicationSession):
            def onJoin(self, details):
                FutureMixin._resolve_future(d, None)

        session = TestSession(types.ComponentConfig('realm1'))

        self.session_factory.add(session)

        if USE_ASYNCIO:
            self.loop.run_until_complete(d)
        elif USE_TWISTED:
            return d
        else:
            raise Exception("logic error")
示例#10
0
文件: test_router.py 项目: 0004c/VTK
   def test_add(self):
      """
      Create an application session and add it to a router to
      run embedded.
      """
      d = FutureMixin._create_future()

      class TestSession(ApplicationSession):

         def onJoin(self, details):
            FutureMixin._resolve_future(d, None)

      session = TestSession(types.ComponentConfig('realm1'))

      self.session_factory.add(session)

      if USE_ASYNCIO:
         self.loop.run_until_complete(d)
      elif USE_TWISTED:
         return d
      else:
         raise Exception("logic error")
示例#11
0
 def onJoin(self, details):
     FutureMixin._resolve_future(d, None)
示例#12
0
 def error(err):
     FutureMixin._reject_future(d, err)
示例#13
0
 def ok(_):
     FutureMixin._resolve_future(d, None)
示例#14
0
文件: test_router.py 项目: 0004c/VTK
 def error(err):
    FutureMixin._reject_future(d, err)
示例#15
0
文件: test_router.py 项目: 0004c/VTK
 def ok(_):
    FutureMixin._resolve_future(d, None)
示例#16
0
文件: test_router.py 项目: 0004c/VTK
 def onJoin(self, details):
    FutureMixin._resolve_future(d, None)