Example #1
0
def new_secondaty_consumer_looking_for_messages(context):

    # Init RabbitMQ consumer
    context.secondaty_rabbitmq_consumer = RabbitMQConsumer(
        amqp_host=configuration_utils.config[PROPERTIES_CONFIG_RABBITMQ_SERVICE][PROPERTIES_CONFIG_SERVICE_HOST],
        amqp_port=configuration_utils.config[PROPERTIES_CONFIG_RABBITMQ_SERVICE][PROPERTIES_CONFIG_SERVICE_PORT],
        amqp_user=configuration_utils.config[PROPERTIES_CONFIG_RABBITMQ_SERVICE][PROPERTIES_CONFIG_SERVICE_USER],
        amqp_password=configuration_utils.config[PROPERTIES_CONFIG_RABBITMQ_SERVICE][PROPERTIES_CONFIG_SERVICE_PASSWORD])

    facts_message_config = \
        configuration_utils.config[PROPERTIES_CONFIG_RABBITMQ_SERVICE][PROPERTIES_CONFIG_RABBITMQ_SERVICE_FACTS_MESSAGES]

    context.secondaty_rabbitmq_consumer.exchange = \
        facts_message_config[PROPERTIES_CONFIG_RABBITMQ_SERVICE_EXCHANGE_NAME]

    context.secondaty_rabbitmq_consumer.exchange_type = \
        facts_message_config[PROPERTIES_CONFIG_RABBITMQ_SERVICE_EXCHANGE_TYPE]

    # Append consumer to the 'context' consumer list
    context.rabbitmq_consumer_list.append(context.secondaty_rabbitmq_consumer)

    # Set default window size to 2 (FACTS) - Secondary Tenant
    message = get_window_size_rabbitmq_message(context.secondary_tenant_id, FACTS_DEFAULT_WINDOW_SIZE)
    context.rabbitmq_publisher.send_message(message)

    # Run secondary consumer
    context.secondaty_rabbitmq_consumer.routing_key = context.secondary_tenant_id
    context.secondaty_rabbitmq_consumer.run_as_thread()
Example #2
0
def before_scenario(context, scenario):

    __logger__.info("********** START SCENARIO **********")
    __logger__.info("Scenario name: %s", scenario.name)

    # Clean scenario variables
    context.context_elements = dict()
    context.response = None

    # List of RabbitMQ Consumers for testing purposes. This list is necessary to be used as Multi-Tenancy test cases.
    # By default, this list only will have information for the main tenant used in test cases. Additional RabbitMQ
    # consumers should be added by each test case if they are needed.
    context.rabbitmq_consumer_list = list()

    # Init RabbitMQ consumer and append it on the list - Main tenantId
    context.rabbitmq_consumer = RabbitMQConsumer(
        amqp_host=configuration_utils.config[PROPERTIES_CONFIG_RABBITMQ_SERVICE][PROPERTIES_CONFIG_SERVICE_HOST],
        amqp_port=configuration_utils.config[PROPERTIES_CONFIG_RABBITMQ_SERVICE][PROPERTIES_CONFIG_SERVICE_PORT],
        amqp_user=configuration_utils.config[PROPERTIES_CONFIG_RABBITMQ_SERVICE][PROPERTIES_CONFIG_SERVICE_USER],
        amqp_password=configuration_utils.config[PROPERTIES_CONFIG_RABBITMQ_SERVICE][PROPERTIES_CONFIG_SERVICE_PASSWORD])

    facts_message_config = \
        configuration_utils.config[PROPERTIES_CONFIG_RABBITMQ_SERVICE][PROPERTIES_CONFIG_RABBITMQ_SERVICE_FACTS_MESSAGES]

    context.rabbitmq_consumer.exchange = \
        facts_message_config[PROPERTIES_CONFIG_RABBITMQ_SERVICE_EXCHANGE_NAME]

    context.rabbitmq_consumer.exchange_type = \
        facts_message_config[PROPERTIES_CONFIG_RABBITMQ_SERVICE_EXCHANGE_TYPE]

    context.rabbitmq_consumer_list.append(context.rabbitmq_consumer)

    # Init RabbitMQ publisher
    context.rabbitmq_publisher = RabbitMQPublisher(
        amqp_host=configuration_utils.config[PROPERTIES_CONFIG_RABBITMQ_SERVICE][PROPERTIES_CONFIG_SERVICE_HOST],
        amqp_port=configuration_utils.config[PROPERTIES_CONFIG_RABBITMQ_SERVICE][PROPERTIES_CONFIG_SERVICE_PORT],
        amqp_user=configuration_utils.config[PROPERTIES_CONFIG_RABBITMQ_SERVICE][PROPERTIES_CONFIG_SERVICE_USER],
        amqp_password=configuration_utils.config[PROPERTIES_CONFIG_RABBITMQ_SERVICE][PROPERTIES_CONFIG_SERVICE_PASSWORD])

    facts_window_size_config = \
        configuration_utils.config[PROPERTIES_CONFIG_RABBITMQ_SERVICE][PROPERTIES_CONFIG_RABBITMQ_SERVICE_WINDOW_SIZE]

    context.rabbitmq_publisher.exchange = \
        facts_window_size_config[PROPERTIES_CONFIG_RABBITMQ_SERVICE_EXCHANGE_NAME]

    context.rabbitmq_publisher.routing_key = \
        facts_window_size_config[PROPERTIES_CONFIG_RABBITMQ_SERVICE_ROUTING_KEY]

    # Set default window size to 2 (FACTS), for the main tenantId configured
    message = get_window_size_rabbitmq_message(context.tenant_id, FACTS_DEFAULT_WINDOW_SIZE)
    context.rabbitmq_publisher.send_message(message)
def new_secondaty_consumer_looking_for_messages(context):

    # Init RabbitMQ consumer
    context.secondaty_rabbitmq_consumer = RabbitMQConsumer(
        amqp_host=configuration_utils.
        config[PROPERTIES_CONFIG_RABBITMQ_SERVICE]
        [PROPERTIES_CONFIG_SERVICE_HOST],
        amqp_port=configuration_utils.
        config[PROPERTIES_CONFIG_RABBITMQ_SERVICE]
        [PROPERTIES_CONFIG_SERVICE_PORT],
        amqp_user=configuration_utils.
        config[PROPERTIES_CONFIG_RABBITMQ_SERVICE]
        [PROPERTIES_CONFIG_SERVICE_USER],
        amqp_password=configuration_utils.
        config[PROPERTIES_CONFIG_RABBITMQ_SERVICE]
        [PROPERTIES_CONFIG_SERVICE_PASSWORD])

    facts_message_config = \
        configuration_utils.config[PROPERTIES_CONFIG_RABBITMQ_SERVICE][PROPERTIES_CONFIG_RABBITMQ_SERVICE_FACTS_MESSAGES]

    context.secondaty_rabbitmq_consumer.exchange = \
        facts_message_config[PROPERTIES_CONFIG_RABBITMQ_SERVICE_EXCHANGE_NAME]

    context.secondaty_rabbitmq_consumer.exchange_type = \
        facts_message_config[PROPERTIES_CONFIG_RABBITMQ_SERVICE_EXCHANGE_TYPE]

    # Append consumer to the 'context' consumer list
    context.rabbitmq_consumer_list.append(context.secondaty_rabbitmq_consumer)

    # Set default window size to 2 (FACTS) - Secondary Tenant
    message = get_window_size_rabbitmq_message(context.secondary_tenant_id,
                                               FACTS_DEFAULT_WINDOW_SIZE)
    context.rabbitmq_publisher.send_message(message)

    # Run secondary consumer
    context.secondaty_rabbitmq_consumer.routing_key = context.secondary_tenant_id
    context.secondaty_rabbitmq_consumer.run_as_thread()
Example #4
0
def window_size_is_set(context, window_size):

    message = get_window_size_rabbitmq_message(context.tenant_id, window_size)
    context.rabbitmq_publisher.send_message(message)
def window_size_is_set(context, window_size):

    message = get_window_size_rabbitmq_message(context.secondary_tenant_id,
                                               window_size)
    context.rabbitmq_publisher.send_message(message)
Example #6
0
def before_scenario(context, scenario):

    __logger__.info("********** START SCENARIO **********")
    __logger__.info("Scenario name: %s", scenario.name)

    # Clean scenario variables
    context.context_elements = dict()
    context.response = None

    # List of RabbitMQ Consumers for testing purposes. This list is necessary to be used as Multi-Tenancy test cases.
    # By default, this list only will have information for the main tenant used in test cases. Additional RabbitMQ
    # consumers should be added by each test case if they are needed.
    context.rabbitmq_consumer_list = list()

    # Init RabbitMQ consumer and append it on the list - Main tenantId
    context.rabbitmq_consumer = RabbitMQConsumer(
        amqp_host=configuration_utils.
        config[PROPERTIES_CONFIG_RABBITMQ_SERVICE]
        [PROPERTIES_CONFIG_SERVICE_HOST],
        amqp_port=configuration_utils.
        config[PROPERTIES_CONFIG_RABBITMQ_SERVICE]
        [PROPERTIES_CONFIG_SERVICE_PORT],
        amqp_user=configuration_utils.
        config[PROPERTIES_CONFIG_RABBITMQ_SERVICE]
        [PROPERTIES_CONFIG_SERVICE_USER],
        amqp_password=configuration_utils.
        config[PROPERTIES_CONFIG_RABBITMQ_SERVICE]
        [PROPERTIES_CONFIG_SERVICE_PASSWORD])

    facts_message_config = \
        configuration_utils.config[PROPERTIES_CONFIG_RABBITMQ_SERVICE][PROPERTIES_CONFIG_RABBITMQ_SERVICE_FACTS_MESSAGES]

    context.rabbitmq_consumer.exchange = \
        facts_message_config[PROPERTIES_CONFIG_RABBITMQ_SERVICE_EXCHANGE_NAME]

    context.rabbitmq_consumer.exchange_type = \
        facts_message_config[PROPERTIES_CONFIG_RABBITMQ_SERVICE_EXCHANGE_TYPE]

    context.rabbitmq_consumer_list.append(context.rabbitmq_consumer)

    # Init RabbitMQ publisher
    context.rabbitmq_publisher = RabbitMQPublisher(
        amqp_host=configuration_utils.
        config[PROPERTIES_CONFIG_RABBITMQ_SERVICE]
        [PROPERTIES_CONFIG_SERVICE_HOST],
        amqp_port=configuration_utils.
        config[PROPERTIES_CONFIG_RABBITMQ_SERVICE]
        [PROPERTIES_CONFIG_SERVICE_PORT],
        amqp_user=configuration_utils.
        config[PROPERTIES_CONFIG_RABBITMQ_SERVICE]
        [PROPERTIES_CONFIG_SERVICE_USER],
        amqp_password=configuration_utils.
        config[PROPERTIES_CONFIG_RABBITMQ_SERVICE]
        [PROPERTIES_CONFIG_SERVICE_PASSWORD])

    facts_window_size_config = \
        configuration_utils.config[PROPERTIES_CONFIG_RABBITMQ_SERVICE][PROPERTIES_CONFIG_RABBITMQ_SERVICE_WINDOW_SIZE]

    context.rabbitmq_publisher.exchange = \
        facts_window_size_config[PROPERTIES_CONFIG_RABBITMQ_SERVICE_EXCHANGE_NAME]

    context.rabbitmq_publisher.routing_key = \
        facts_window_size_config[PROPERTIES_CONFIG_RABBITMQ_SERVICE_ROUTING_KEY]

    # Set default window size to 2 (FACTS), for the main tenantId configured
    message = get_window_size_rabbitmq_message(context.tenant_id,
                                               FACTS_DEFAULT_WINDOW_SIZE)
    context.rabbitmq_publisher.send_message(message)