Esempio n. 1
0
    def test(self):
        messaging_system = QueueMessagingSystem()
        messager = Messager()
        numbers_endpoint = messager.get_endpoint(messaging_system, "numbers",
                                                 StringMessage)
        parameters = {'name': 'number_service', 'endpoint': numbers_endpoint}

        configuration_endpoint = messager.get_endpoint(messaging_system,
                                                       "configuration",
                                                       ConfigurationMessage)
        configuration_adapter = ConfigurationAdapter(NumberGeneratorService,
                                                     parameters,
                                                     configuration_endpoint)

        number_generator_service_runner = ServiceRunner(
            configuration_adapter, messager)

        number_generator_service_runner.start()
        time.sleep(10)

        configuration_message = ConfigurationMessage({})
        messager.publish(configuration_endpoint, configuration_message)

        time.sleep(10)

        number_generator_service_runner.terminate()
        number_generator_service_runner.wait()
Esempio n. 2
0
    def test(self):
        messaging_system = QueueMessagingSystem()
        messager = Messager()

        visibility_endpoint = messager.get_endpoint(messaging_system, "visibility", VisibilityDatagram)
        visibility_control_endpoint = messager.get_endpoint(messaging_system, "visibilitycontrol", StringMessage)

        visibility_string_endpoint = messager.get_endpoint(messaging_system, "visibilitystring", StringMessage)
        tostring_control_endpoint = messager.get_endpoint(messaging_system, "tostringcontrol", StringMessage)
        string_writer_control_endpoint = messager.get_endpoint(messaging_system, "stringwritercontrol", StringMessage)

        # set up the visibility datagram source service
        visibility_datagram_source_service = VisibilityDatagramSourceService("localhost", 3000, visibility_endpoint, visibility_control_endpoint)
        visibility_datagram_source_service_container = ServiceContainer(visibility_datagram_source_service, messager)

        tostring_service = ToStringService(visibility_endpoint, visibility_string_endpoint, tostring_control_endpoint)
        tostring_service_container = ServiceContainer(tostring_service, messager)

        string_writer_service = StringWriterService(visibility_string_endpoint, string_writer_control_endpoint, "output.txt")
        string_writer_service_container = ServiceContainer(string_writer_service, messager)

        # start Ice
        logging.info("Starting Ice")
        ice_runner = IceRunner("testbed_data")
        ice_runner.start()

        logging.info("Starting services")
        string_writer_service_container.start()
        tostring_service_container.start()
        visibility_datagram_source_service_container.start()
    
        logging.info("Starting processing")
        messager.publish(string_writer_control_endpoint, StringMessage("Start"))
        messager.publish(tostring_control_endpoint, StringMessage("Start"))
        messager.publish(visibility_control_endpoint, StringMessage("Start"))

        # start playback
        logging.info("Starting playback")
        playback = Playback("testbed_data")
        playback.playback("data/ade1card.ms")
        playback.wait()

        time.sleep(10)
        messager.publish(visibility_control_endpoint, StringMessage("Stop"))

        time.sleep(10)
        messager.publish(tostring_control_endpoint, StringMessage("Stop"))

        time.sleep(10)
        messager.publish(string_writer_control_endpoint, StringMessage("Stop"))

        time.sleep(10)

        visibility_datagram_source_service_container.terminate()
        tostring_service_container.terminate()
        string_writer_service_container.terminate()

        # stop Ice
        logging.info("stopping Ice")
        ice_runner.stop()
    def test(self):
        messaging_system = QueueMessagingSystem()
        messager = Messager()

        metadata_endpoint = messager.get_endpoint(messaging_system, "metadata", TOSMetadata)
        metadata_control_endpoint = messager.get_endpoint(messaging_system, " metadatacontrol", StringMessage)

        metadata_string_endpoint = messager.get_endpoint(messaging_system, "metadatastring", StringMessage)
        tostring_control_endpoint = messager.get_endpoint(messaging_system, "tostringcontrol", StringMessage)
        string_writer_control_endpoint = messager.get_endpoint(messaging_system, "stringwritercontrol", StringMessage)
        
        # start Ice
        logging.info("Starting Ice")
        ice_runner = IceRunner("testbed_data")
        ice_runner.start()

        # set up the ice metadata source service
        ice_metadata_source_service = IceMetadataSourceService("localhost", 4061, "IceStorm/[email protected]", "metadata", "IngestPipeline", metadata_endpoint, metadata_control_endpoint)
        ice_metadata_source_service_container = ServiceContainer(ice_metadata_source_service, messager)

        tostring_service = ToStringService(metadata_endpoint, metadata_string_endpoint, tostring_control_endpoint)
        tostring_service_container = ServiceContainer(tostring_service, messager)

        string_writer_service = StringWriterService(metadata_string_endpoint, string_writer_control_endpoint, "output.txt")
        string_writer_service_container = ServiceContainer(string_writer_service, messager)


        logging.info("Starting services")
        string_writer_service_container.start()
        tostring_service_container.start()
        ice_metadata_source_service_container.start()
    
        logging.info("Starting processing")
        messager.publish(string_writer_control_endpoint, StringMessage("Start"))
        messager.publish(tostring_control_endpoint, StringMessage("Start"))
        messager.publish(metadata_control_endpoint, StringMessage("Start"))
    
        # start playback
        logging.info("Starting playback")
        playback = Playback("testbed_data")
        playback.playback("data/ade1card.ms")
        playback.wait()

        time.sleep(10)
        messager.publish(metadata_control_endpoint, StringMessage("Stop"))

        time.sleep(10)
        messager.publish(tostring_control_endpoint, StringMessage("Stop"))

        time.sleep(10)
        messager.publish(string_writer_control_endpoint, StringMessage("Stop"))

        time.sleep(10)
        ice_metadata_source_service_container.terminate()
        tostring_service_container.terminate()
        string_writer_service_container.terminate()

        # stop Ice
        logging.info("stopping Ice")
        ice_runner.stop()
    def test(self):
        messaging_system = QueueMessagingSystem()
        messager = Messager()
        metrics_endpoint = messager.get_endpoint(messaging_system, "metrics",
                                                 Metrics)
        first_endpoint = messager.get_endpoint(messaging_system, "first",
                                               StringMessage)
        second_endpoint = messager.get_endpoint(messaging_system, "second",
                                                StringMessage)
        concatenation_endpoint = messager.get_endpoint(messaging_system,
                                                       "concatenation",
                                                       StringMessage)
        control_endpoint = messager.get_endpoint(messaging_system, "control",
                                                 StringMessage)

        string_concatenator_service = StringConcatenatorService(
            first_endpoint, second_endpoint, concatenation_endpoint,
            control_endpoint)
        monitor_adapter = MonitorAdapter(string_concatenator_service,
                                         metrics_endpoint)
        service_container = ServiceContainer(monitor_adapter, messager)

        service_container.start()
        time.sleep(5)
        logging.info("Publishing 'Start' control message")
        messager.publish(control_endpoint, StringMessage("Start"))
        time.sleep(10)
        logging.info("Publishing 'Stop' control message")
        messager.publish(control_endpoint, StringMessage("Stop"))
        time.sleep(5)
        service_container.terminate()
        service_container.wait()
Esempio n. 5
0
    def test(self):

        messaging_system = QueueMessagingSystem()
        messager = Messager()
        string_endpoint = messager.get_endpoint(messaging_system, "string",
                                                StringMessage)
        control_endpoint = messager.get_endpoint(messaging_system, "control",
                                                 StringMessage)

        parameters = {
            "name": "string_writer_service",
            "string_endpoint": string_endpoint,
            "control_endpoint": control_endpoint
        }
        configuration_endpoint = messager.get_endpoint(messaging_system,
                                                       "configuration",
                                                       ConfigurationMessage)
        configuration_adapter = ConfigurationAdapter(StringWriterService,
                                                     parameters,
                                                     configuration_endpoint)
        service_runner = ServiceRunner(configuration_adapter, messager)

        service_runner.start()

        time.sleep(5)

        logging.info("Publishing ConfigurationMessage")
        configuration_message = ConfigurationMessage(
            {"string_writer_service.output_path": "output.txt"})
        messager.publish(configuration_endpoint, configuration_message)

        time.sleep(5)

        logging.info("Publishing 'Start' control message")
        messager.publish(control_endpoint, StringMessage("Start"))

        time.sleep(10)

        logging.info("Publishing 'Stop' control message")
        messager.publish(control_endpoint, StringMessage("Stop"))

        time.sleep(5)

        service_runner.terminate()
        service_runner.wait()
Esempio n. 6
0
    def test(self):
        messaging_system = QueueMessagingSystem()
        messager = Messager()
        datagram_endpoint = messager.get_endpoint(messaging_system, "datagram",
                                                  VisibilityDatagram)
        string_endpoint = messager.get_endpoint(messaging_system, "string",
                                                StringMessage)
        control_endpoint = messager.get_endpoint(messaging_system, "control",
                                                 StringMessage)

        parameters = {
            "name": "to_string_service",
            "input_endpoint": datagram_endpoint,
            "output_endpoint": string_endpoint,
            "control_endpoint": control_endpoint
        }
        configuration_endpoint = messager.get_endpoint(messaging_system,
                                                       "configuration",
                                                       ConfigurationMessage)
        configuration_adapter = ConfigurationAdapter(ToStringService,
                                                     parameters,
                                                     configuration_endpoint)
        service_runner = ServiceRunner(configuration_adapter, messager)

        service_runner.start()
        time.sleep(5)

        logging.info("Publishing ConfigurationMessage")
        configuration_message = ConfigurationMessage({})
        messager.publish(configuration_endpoint, configuration_message)

        time.sleep(5)

        logging.info("Publishing 'Start' control message")
        messager.publish(control_endpoint, StringMessage("Start"))

        time.sleep(5)

        logging.info("Publishing 'Stop' control message")
        messager.publish(control_endpoint, StringMessage("Stop"))

        time.sleep(5)

        service_runner.terminate()
        service_runner.wait()
    def test(self):
        messaging_system = QueueMessagingSystem()
        messager = Messager()
        datagram_endpoint = messager.get_endpoint(messaging_system, "datagram", VisibilityDatagram)
        string_endpoint = messager.get_endpoint(messaging_system, "string", StringMessage)
        control_endpoint = messager.get_endpoint(messaging_system, "control", StringMessage)

        to_string_service = ToStringService(datagram_endpoint, string_endpoint, control_endpoint)
        to_string_service_container = ServiceContainer(to_string_service, messager)

        to_string_service_container.start()
        time.sleep(5)
        messager.publish(control_endpoint, StringMessage("Start"))
        time.sleep(10)
        messager.publish(control_endpoint, StringMessage("Stop"))
        time.sleep(5)
        to_string_service_container.terminate()
        to_string_service_container.wait()
    def test(self):
        messaging_system = QueueMessagingSystem()
        messager = Messager()
        numbers_endpoint = messager.get_endpoint(messaging_system, "numbers", StringMessage)

        number_generator_service = NumberGeneratorService(numbers_endpoint)
        number_generator_service_container = ServiceContainer(number_generator_service, messager)
      
        number_generator_service_container.start()
        time.sleep(10)
        number_generator_service_container.terminate()
        number_generator_service_container.wait()
Esempio n. 9
0
    def test(self):

        messaging_system = QueueMessagingSystem()
        messager = Messager()
        string_endpoint = messager.get_endpoint(messaging_system, "string",
                                                StringMessage)
        control_endpoint = messager.get_endpoint(messaging_system, "control",
                                                 StringMessage)

        string_writer_service = StringWriterService(string_endpoint,
                                                    control_endpoint,
                                                    "output.txt")
        string_writer_service_container = ServiceContainer(
            string_writer_service, messager)

        string_writer_service_container.start()
        time.sleep(5)
        messager.publish(control_endpoint, StringMessage("Start"))
        time.sleep(10)
        messager.publish(control_endpoint, StringMessage("Stop"))
        time.sleep(5)
        string_writer_service_container.terminate()
        string_writer_service_container.wait()
Esempio n. 10
0
    def test(self):
        messaging_system = QueueMessagingSystem()
        messager = Messager()
        metrics_endpoint = messager.get_endpoint(messaging_system, "metrics",
                                                 Metrics)
        first_endpoint = messager.get_endpoint(messaging_system, "first",
                                               StringMessage)
        second_endpoint = messager.get_endpoint(messaging_system, "second",
                                                StringMessage)
        concatenation_endpoint = messager.get_endpoint(messaging_system,
                                                       "concatenation",
                                                       StringMessage)
        control_endpoint = messager.get_endpoint(messaging_system, "control",
                                                 StringMessage)

        parameters = {
            "name": "string_concatenator_service",
            "first_endpoint": first_endpoint,
            "second_endpoint": second_endpoint,
            "concatenation_endpoint": concatenation_endpoint,
            "control_endpoint": control_endpoint
        }

        configuration_endpoint = messager.get_endpoint(messaging_system,
                                                       "configuration",
                                                       ConfigurationMessage)
        configuration_adapter = ConfigurationAdapter(StringConcatenatorService,
                                                     parameters,
                                                     configuration_endpoint)
        monitor_adapter = MonitorAdapter(configuration_adapter,
                                         metrics_endpoint)
        service_runner = ServiceRunner(monitor_adapter, messager)

        service_runner.start()
        time.sleep(5)

        logging.info("Publishing ConfigurationMessage")
        configuration_message = ConfigurationMessage({})
        messager.publish(configuration_endpoint, configuration_message)

        time.sleep(5)

        logging.info("Publishing 'Start' control message")
        messager.publish(control_endpoint, StringMessage("Start"))

        time.sleep(5)

        logging.info("Publishing 'Stop' control message")
        messager.publish(control_endpoint, StringMessage("Stop"))

        time.sleep(5)

        service_runner.terminate()
        service_runner.wait()
    def test(self):
        messaging_system = QueueMessagingSystem()
        messager = Messager()

        metadata_endpoint = messager.get_endpoint(messaging_system, "metadata",
                                                  TOSMetadata)
        metadata_control_endpoint = messager.get_endpoint(
            messaging_system, "metadatacontrol", StringMessage)
        metadata_metrics_endpoint = messager.get_endpoint(
            messaging_system, "metadatametrics", Metrics)

        datagram_endpoint = messager.get_endpoint(messaging_system, "datagram",
                                                  VisibilityDatagram)
        datagram_control_endpoint = messager.get_endpoint(
            messaging_system, "datagramcontrol", StringMessage)
        datagram_metrics_endpoint = messager.get_endpoint(
            messaging_system, "datagrammetrics", Metrics)

        chunk_endpoint = messager.get_endpoint(messaging_system, "chunk",
                                               VisibilityChunk)
        align_control_endpoint = messager.get_endpoint(messaging_system,
                                                       "aligncontrol",
                                                       StringMessage)
        align_metrics_endpoint = messager.get_endpoint(messaging_system,
                                                       "alignmetrics", Metrics)

        chunk_string_endpoint = messager.get_endpoint(messaging_system,
                                                      "chunkstring",
                                                      StringMessage)
        to_string_control_endpoint = messager.get_endpoint(
            messaging_system, "to_stringcontrol", StringMessage)
        to_string_metrics_endpoint = messager.get_endpoint(
            messaging_system, "to_stringmetrics", Metrics)
        string_writer_control_endpoint = messager.get_endpoint(
            messaging_system, "stringwritercontrol", StringMessage)
        string_writer_metrics_endpoint = messager.get_endpoint(
            messaging_system, "stringwritermetrics", Metrics)

        # start Ice
        logging.info("Starting Ice")
        ice_runner = IceRunner("testbed_data")
        ice_runner.start()

        # set up the ice metadata source service
        ice_metadata_source_service = IceMetadataSourceService(
            "localhost", 4061, "IceStorm/[email protected]",
            "metadata", "IngestPipeline", metadata_endpoint,
            metadata_control_endpoint)
        ice_metadata_source_monitor_adapter = MonitorAdapter(
            ice_metadata_source_service, "ice_metadata_source_service",
            metadata_metrics_endpoint)
        ice_metadata_source_service_container = ServiceContainer(
            ice_metadata_source_monitor_adapter, messager)

        # set up the visibility datagram source service
        visibility_datagram_source_service = VisibilityDatagramSourceService(
            "localhost", 3000, datagram_endpoint, datagram_control_endpoint)
        visibility_datagram_source_monitor_adapter = MonitorAdapter(
            visibility_datagram_source_service,
            "visibility_datagram_source_service", datagram_metrics_endpoint)
        visibility_datagram_source_service_container = ServiceContainer(
            visibility_datagram_source_monitor_adapter, messager)

        # set up the align service
        align_service = AlignService(metadata_endpoint, datagram_endpoint,
                                     chunk_endpoint, align_control_endpoint)
        align_monitor_adapter = MonitorAdapter(align_service, "align_service",
                                               align_metrics_endpoint)
        align_service_container = ServiceContainer(align_monitor_adapter,
                                                   messager)

        to_string_service = ToStringService(chunk_endpoint,
                                            chunk_string_endpoint,
                                            to_string_control_endpoint)
        to_string_monitor_adapter = MonitorAdapter(to_string_service,
                                                   "to_string_service",
                                                   to_string_metrics_endpoint)
        to_string_service_container = ServiceContainer(
            to_string_monitor_adapter, messager)

        string_writer_service = StringWriterService(
            chunk_string_endpoint, string_writer_control_endpoint,
            "output.txt")
        string_writer_monitor_adapter = MonitorAdapter(
            string_writer_service, "string_writer_service",
            string_writer_metrics_endpoint)
        string_writer_service_container = ServiceContainer(
            string_writer_monitor_adapter, messager)

        monitor_service = GenericMonitorService([
            datagram_metrics_endpoint, metadata_metrics_endpoint,
            align_metrics_endpoint, to_string_metrics_endpoint,
            string_writer_metrics_endpoint
        ])
        monitor_service_container = ServiceContainer(monitor_service, messager)

        logging.info("Starting services")
        monitor_service_container.start()
        visibility_datagram_source_service_container.start()
        ice_metadata_source_service_container.start()
        align_service_container.start()
        to_string_service_container.start()
        string_writer_service_container.start()

        logging.info("Starting processing")
        messager.publish(datagram_control_endpoint, StringMessage("Start"))
        messager.publish(metadata_control_endpoint, StringMessage("Start"))
        messager.publish(align_control_endpoint, StringMessage("Start"))
        messager.publish(to_string_control_endpoint, StringMessage("Start"))
        messager.publish(string_writer_control_endpoint,
                         StringMessage("Start"))

        # start playback
        logging.info("Starting playback")
        playback = Playback("testbed_data")
        playback.playback("data/ade1card.ms")
        playback.wait()

        time.sleep(10)
        messager.publish(datagram_control_endpoint, StringMessage("Stop"))

        time.sleep(5)
        messager.publish(metadata_control_endpoint, StringMessage("Stop"))

        time.sleep(5)
        messager.publish(align_control_endpoint, StringMessage("Stop"))

        time.sleep(5)
        messager.publish(to_string_control_endpoint, StringMessage("Stop"))

        time.sleep(5)
        messager.publish(string_writer_control_endpoint, StringMessage("Stop"))

        ice_metadata_source_service_container.terminate()
        visibility_datagram_source_service_container.terminate()
        align_service_container.terminate()
        to_string_service_container.terminate()
        string_writer_service_container.terminate()
        monitor_service_container.terminate()

        # stop Ice
        logging.info("stopping Ice")
        ice_runner.stop()
    def test(self):
        messaging_system = QueueMessagingSystem()
        messager = Messager()

        upper_endpoint = messager.get_endpoint(messaging_system, "upper", StringMessage)
        upper_metrics_endpoint = messager.get_endpoint(messaging_system, "upper_metrics", Metrics)

        lower_endpoint = messager.get_endpoint(messaging_system, "lower", StringMessage)
        lower_metrics_endpoint = messager.get_endpoint(messaging_system, "lower_metrics", Metrics)

        concatenation_endpoint = messager.get_endpoint(messaging_system, "concatenation", StringMessage)
        concatenator_control_endpoint = messager.get_endpoint(messaging_system, "concatenator_control", StringMessage)
        concatenator_metrics_endpoint = messager.get_endpoint(messaging_system, "concatenator_metrics", Metrics)

        writer_control_endpoint = messager.get_endpoint(messaging_system, "writer_control", StringMessage)
        writer_metrics_endpoint = messager.get_endpoint(messaging_system, "writer_metrics", Metrics)

        uppercase_letter_generator_service = LetterGeneratorService(upper_endpoint, upper=True)
        uppercase_letter_generator_monitor_adapter = MonitorAdapter(uppercase_letter_generator_service, "uppercase_letter_generator_service", upper_metrics_endpoint)
        uppercase_letter_generator_service_container = ServiceContainer(uppercase_letter_generator_monitor_adapter, messager)

        lowercase_letter_generator_service = LetterGeneratorService(lower_endpoint)
        lowercase_letter_generator_monitor_adapter = MonitorAdapter(lowercase_letter_generator_service, "lowercase_letter_generator_service", lower_metrics_endpoint)
        lowercase_letter_generator_service_container = ServiceContainer(lowercase_letter_generator_monitor_adapter, messager)

        string_concatenator_service = StringConcatenatorService(upper_endpoint, lower_endpoint, concatenation_endpoint, concatenator_control_endpoint)
        string_concatenator_monitor_adapter = MonitorAdapter(string_concatenator_service, "string_concatenator_service", concatenator_metrics_endpoint)
        string_concatenator_service_container = ServiceContainer(string_concatenator_monitor_adapter, messager)

        string_writer_service = StringWriterService(concatenation_endpoint, writer_control_endpoint, "output.txt")
        string_writer_monitor_adapter = MonitorAdapter(string_writer_service, "string_writer_service", writer_metrics_endpoint)
        string_writer_service_container = ServiceContainer(string_writer_monitor_adapter, messager)

        monitor_service = GenericMonitorService([upper_metrics_endpoint, lower_metrics_endpoint, concatenator_metrics_endpoint, writer_metrics_endpoint])
        monitor_service_container = ServiceContainer(monitor_service, messager)

        # start them, wait ten seconds, stop them
        logging.info("starting services")
        monitor_service_container.start()
        string_writer_service_container.start()
        string_concatenator_service_container.start()
        uppercase_letter_generator_service_container.start()
        lowercase_letter_generator_service_container.start()

        time.sleep(1)

        logging.info("starting processing")
        messager.publish(writer_control_endpoint, StringMessage("Start"))
        messager.publish(concatenator_control_endpoint, StringMessage("Start"))

        logging.info("sleeping")
        time.sleep(10)

        logging.info("stopping processing")
        messager.publish(writer_control_endpoint, StringMessage("Stop"))
        messager.publish(concatenator_control_endpoint, StringMessage("Stop"))

        time.sleep(1)

        logging.info("stopping services")
        uppercase_letter_generator_service_container.terminate()
        lowercase_letter_generator_service_container.terminate()
        string_concatenator_service_container.terminate()
        string_writer_service_container.terminate()
        monitor_service_container.terminate()