Exemplo n.º 1
0
# See the License for the specific language governing permissions and
# limitations under the License.
#
# For those usages not covered by the Apache version 2.0 License please
# contact with [email protected]

__author__ = 'jfernandez'

from lettuce import before, after, world
from commons.terrain_utils import set_up, tear_down
from commons.ngsi_adapter_api_utils.ngsi_adapter_client import NgsiAdapterClient
from commons.logger_utils import get_logger
from commons.constants import MONITORING_CONFIG_SERVICE_ADAPTER, MONITORING_CONFIG_SERVICE_HOST, \
    MONITORING_CONFIG_SERVICE_PORT, MONITORING_CONFIG_SERVICE_PROTOCOL

logger = get_logger("terrain_utils")


@before.all
def before_all():
    set_up()


@before.each_feature
def before_each_feature(feature):
    world.ngsi_adapter_client = NgsiAdapterClient(
        world.config[MONITORING_CONFIG_SERVICE_ADAPTER]
        [MONITORING_CONFIG_SERVICE_PROTOCOL],
        world.config[MONITORING_CONFIG_SERVICE_ADAPTER]
        [MONITORING_CONFIG_SERVICE_HOST],
        world.config[MONITORING_CONFIG_SERVICE_ADAPTER]
Exemplo n.º 2
0
# limitations under the License.
#
# For those usages not covered by the Apache version 2.0 License please
# contact with [email protected]

__author__ = 'jfernandez'


from lettuce import before, after, world
from commons.terrain_utils import set_up, tear_down
from commons.ngsi_adapter_api_utils.ngsi_adapter_client import NgsiAdapterClient
from commons.logger_utils import get_logger
from commons.constants import MONITORING_CONFIG_SERVICE_ADAPTER, MONITORING_CONFIG_SERVICE_HOST, \
    MONITORING_CONFIG_SERVICE_PORT, MONITORING_CONFIG_SERVICE_PROTOCOL

logger = get_logger("terrain_utils")


@before.all
def before_all():
    set_up()


@before.each_feature
def before_each_feature(feature):
    world.ngsi_adapter_client = NgsiAdapterClient(world.config[MONITORING_CONFIG_SERVICE_ADAPTER]
                                                  [MONITORING_CONFIG_SERVICE_PROTOCOL],
                                                  world.config[MONITORING_CONFIG_SERVICE_ADAPTER]
                                                  [MONITORING_CONFIG_SERVICE_HOST],
                                                  world.config[MONITORING_CONFIG_SERVICE_ADAPTER]
                                                  [MONITORING_CONFIG_SERVICE_PORT])
__author__ = 'jfernandez'


from commons.rest_client_utils import RestClient, API_ROOT_URL_ARG_NAME
from commons.constants import HEADER_REPRESENTATION_TEXTPLAIN, HEADER_CONTENT_TYPE, HEADER_TRANSACTION_ID, \
    HTTP_VERB_POST
from commons.utils import generate_transaction_id
from commons.logger_utils import get_logger

NGSI_ADAPTER_URI_BASE = "{" + API_ROOT_URL_ARG_NAME + "}"
NGSI_ADAPTER_URI_PARSER = NGSI_ADAPTER_URI_BASE + "/{probe_name}"
NGSI_ADAPTER_PARAMETER_ID = "id"
NGSI_ADAPTER_PARAMETER_TYPE = "type"

logger = get_logger("rest_client_utils")


class NgsiAdapterClient:

    headers = dict()

    def __init__(self, protocol, host, port, base_resource=None):
        """
        Class constructor. Init default headers
        :param protocol: API Protocol
        :param host: API Host
        :param port: API Port
        :param base_resource: base uri resource (if exists)
        :return: None
        """
# contact with [email protected]

__author__ = 'jfernandez'

from commons.rest_client_utils import RestClient, API_ROOT_URL_ARG_NAME
from commons.constants import HEADER_REPRESENTATION_TEXTPLAIN, HEADER_CONTENT_TYPE, HEADER_TRANSACTION_ID, \
    HTTP_VERB_POST
from commons.utils import generate_transaction_id
from commons.logger_utils import get_logger

NGSI_ADAPTER_URI_BASE = "{" + API_ROOT_URL_ARG_NAME + "}"
NGSI_ADAPTER_URI_PARSER = NGSI_ADAPTER_URI_BASE + "/{probe_name}"
NGSI_ADAPTER_PARAMETER_ID = "id"
NGSI_ADAPTER_PARAMETER_TYPE = "type"

logger = get_logger("rest_client_utils")


class NgsiAdapterClient:

    headers = dict()

    def __init__(self, protocol, host, port, base_resource=None):
        """
        Class constructor. Init default headers
        :param protocol: API Protocol
        :param host: API Host
        :param port: API Port
        :param base_resource: base uri resource (if exists)
        :return: None
        """
Exemplo n.º 5
0
# See the License for the specific language governing permissions and
# limitations under the License.
#
# For those usages not covered by the Apache version 2.0 License please
# contact with [email protected]


from fiwareskuld.expired_users import ExpiredUsers
from commons.configuration import TENANT_NAME, USERNAME, PASSWORD
from commons.logger_utils import get_logger

__author__ = 'fla'
__copyright__ = "Copyright 2015"
__license__ = " Apache License, Version 2.0"

__logger__ = get_logger("qautils")


def before_scenario(context, scenario):
    """
    HOOK: To be executed before each Scenario:
        - Init test variables
    """

    __logger__.info("Starting execution of scenario")
    __logger__.info("##############################")
    __logger__.info("##############################")

    context.expiredusers = ExpiredUsers(TENANT_NAME, USERNAME, PASSWORD)
    context.expiredusers.finalList = []
    context.expiredusers.listUsers = []