Exemplo n.º 1
0
def setUpModule():
    logger.debug('setting up')

    # Set up folder hierarchy
    pathutil.create_folder('etc/repose')
    pathutil.create_folder('var/repose')
    pathutil.create_folder('var/log/repose')

    # Download Repose artifacts if needed
    snapshot = True
    if ('IS_RELEASE_BUILD' in os.environ and os.environ['IS_RELEASE_BUILD']):
        snapshot = False

    if not os.path.exists('usr/share/repose/repose-valve.jar'):
        rmc = ReposeMavenConnector()
        logger.debug('Downloading valve jar')
        rmc.get_repose(valve_dest='usr/share/repose/repose-valve.jar',
                       get_filter=False,
                       get_ext_filter=False,
                       snapshot=snapshot)
    if not glob.glob('usr/share/repose/filter-bundle*.ear'):
        rmc = ReposeMavenConnector()
        logger.debug('Downloading filter bundle')
        rmc.get_repose(filter_dest='usr/share/repose/filter-bundle.ear',
                       get_valve=False,
                       get_ext_filter=False,
                       snapshot=snapshot)

    # set up the deproxy, fake origin service and fake identity service, to be
    # re-used by all test cases
    globalvars.identity_port = get_next_open_port()
    globalvars.deproxy_port = get_next_open_port()

    logger.info('identity port: {0}'.format(globalvars.identity_port))
    logger.info('origin port: {0}'.format(globalvars.deproxy_port))

    globalvars.deproxy = deproxy.Deproxy()

    # our fake origin service always returns 606
    def fake_origin_handler(request):
        """
        Always returns a 606 status code. This is not a calid code, and so we
        can always know that if we receive it, it came from the fake origin
        service and not from Repose.
        """
        return make_response(606, 'Something')

    globalvars.origin_endpoint = (globalvars.deproxy.add_endpoint(
        globalvars.deproxy_port,
        'origin service',
        default_handler=fake_origin_handler))

    globalvars.identity = FakeIdentityService(
        port=globalvars.identity_port,
        origin_service_port=globalvars.deproxy_port)

    globalvars.identity_endpoint = (globalvars.deproxy.add_endpoint(
        port=globalvars.identity_port,
        name='identity service',
        default_handler=globalvars.identity.handler))
Exemplo n.º 2
0
def setUpModule():
    logger.debug('setting up')

    # Set up folder hierarchy
    pathutil.create_folder('etc/repose')
    pathutil.create_folder('var/repose')
    pathutil.create_folder('var/log/repose')

    # Download Repose artifacts if needed
    snapshot = True
    if ('IS_RELEASE_BUILD' in os.environ and os.environ['IS_RELEASE_BUILD']):
        snapshot = False

    if not os.path.exists('usr/share/repose/repose-valve.jar'):
        rmc = ReposeMavenConnector()
        logger.debug('Downloading valve jar')
        rmc.get_repose(valve_dest='usr/share/repose/repose-valve.jar',
                       get_filter=False,
                       get_ext_filter=False,
                       snapshot=snapshot)
    if not glob.glob('usr/share/repose/filter-bundle*.ear'):
        rmc = ReposeMavenConnector()
        logger.debug('Downloading filter bundle')
        rmc.get_repose(filter_dest='usr/share/repose/filter-bundle.ear',
                       get_valve=False,
                       get_ext_filter=False,
                       snapshot=snapshot)
Exemplo n.º 3
0
def setUpModule():
    logger.debug('setting up')

    # Set up folder hierarchy
    pathutil.create_folder('etc/repose')
    pathutil.create_folder('var/repose')
    pathutil.create_folder('var/log/repose')

    # Download Repose artifacts if needed
    snapshot = True
    if ('IS_RELEASE_BUILD' in os.environ and
            os.environ['IS_RELEASE_BUILD']):
        snapshot = False

    if not os.path.exists('usr/share/repose/repose-valve.jar'):
        rmc = ReposeMavenConnector()
        logger.debug('Downloading valve jar')
        rmc.get_repose(valve_dest='usr/share/repose/repose-valve.jar',
                       get_filter=False, get_ext_filter=False,
                       snapshot=snapshot)
    if not glob.glob('usr/share/repose/filter-bundle*.ear'):
        rmc = ReposeMavenConnector()
        logger.debug('Downloading filter bundle')
        rmc.get_repose(filter_dest='usr/share/repose/filter-bundle.ear',
                       get_valve=False, get_ext_filter=False,
                       snapshot=snapshot)
Exemplo n.º 4
0
def setUpModule():
    pathutil.create_folder('test/bin')
    pathutil.create_folder('test/conf')
    pathutil.create_folder('test/log')
    pathutil.create_folder('test/var')
    #pathutil.clear_folder('test/bin')
    pathutil.clear_folder('test/conf')
    pathutil.clear_folder('test/log')
    pathutil.clear_folder('test/var')
    if not os.path.exists('test/bin/repose-valve.jar'):
        rmc = ReposeMavenConnector()
        logger.debug('Downloading valve jar')
        rmc.get_repose(valve_dest='test/bin/repose-valve.jar',
                       get_filter=False, get_ext_filter=False)
    if not os.path.exists('test/bin/filter-bundle.ear'):
        rmc = ReposeMavenConnector()
        logger.debug('Downloading filter bundle')
        rmc.get_repose(filter_dest='test/bin/filter-bundle.ear',
                       get_valve=False, get_ext_filter=False)
    logger.debug('module setup complete')
Exemplo n.º 5
0
def setUpModule():
    pathutil.create_folder('test/bin')
    pathutil.create_folder('test/conf')
    pathutil.create_folder('test/log')
    pathutil.create_folder('test/var')
    #pathutil.clear_folder('test/bin')
    pathutil.clear_folder('test/conf')
    pathutil.clear_folder('test/log')
    pathutil.clear_folder('test/var')
    if not os.path.exists('test/bin/repose-valve.jar'):
        rmc = ReposeMavenConnector()
        logger.debug('Downloading valve jar')
        rmc.get_repose(valve_dest='test/bin/repose-valve.jar',
                       get_filter=False,
                       get_ext_filter=False)
    if not os.path.exists('test/bin/filter-bundle.ear'):
        rmc = ReposeMavenConnector()
        logger.debug('Downloading filter bundle')
        rmc.get_repose(filter_dest='test/bin/filter-bundle.ear',
                       get_valve=False,
                       get_ext_filter=False)
    logger.debug('module setup complete')
Exemplo n.º 6
0
def setUpModule():
    logger.debug('setting up')

    # Set up folder hierarchy
    pathutil.create_folder('etc/repose')
    pathutil.create_folder('var/repose')
    pathutil.create_folder('var/log/repose')

    # Download Repose artifacts if needed
    snapshot = True
    if ('IS_RELEASE_BUILD' in os.environ and
            os.environ['IS_RELEASE_BUILD']):
        snapshot = False

    if not os.path.exists('usr/share/repose/repose-valve.jar'):
        rmc = ReposeMavenConnector()
        logger.debug('Downloading valve jar')
        rmc.get_repose(valve_dest='usr/share/repose/repose-valve.jar',
                       get_filter=False, get_ext_filter=False,
                       snapshot=snapshot)
    if not glob.glob('usr/share/repose/filter-bundle*.ear'):
        rmc = ReposeMavenConnector()
        logger.debug('Downloading filter bundle')
        rmc.get_repose(filter_dest='usr/share/repose/filter-bundle.ear',
                       get_valve=False, get_ext_filter=False,
                       snapshot=snapshot)

    # set up the deproxy, fake origin service and fake identity service, to be
    # re-used by all test cases
    globalvars.identity_port = get_next_open_port()
    globalvars.deproxy_port = get_next_open_port()

    logger.info('identity port: {0}'.format(globalvars.identity_port))
    logger.info('origin port: {0}'.format(globalvars.deproxy_port))

    globalvars.deproxy = deproxy.Deproxy()

    # our fake origin service always returns 606
    def fake_origin_handler(request):
        """
        Always returns a 606 status code. This is not a calid code, and so we
        can always know that if we receive it, it came from the fake origin
        service and not from Repose.
        """
        return make_response(606, 'Something')
    globalvars.origin_endpoint = (
        globalvars.deproxy.add_endpoint(globalvars.deproxy_port,
                                        'origin service',
                                        default_handler=fake_origin_handler))

    globalvars.identity = FakeIdentityService(
        port=globalvars.identity_port,
        origin_service_port=globalvars.deproxy_port
    )

    globalvars.identity_endpoint = (
        globalvars.deproxy.add_endpoint(
            port=globalvars.identity_port,
            name='identity service',
            default_handler=globalvars.identity.handler
        )
    )