Exemplo n.º 1
0
 def setUp(self):
     super(TestTransportAuth, self).setUp()
     self.cfg = config.project('marconi')
Exemplo n.º 2
0
"""Marconi Transport Drivers"""

from marconi.common import config
from marconi.transport import base

OPTIONS = {'auth_strategy': ""}

CFG = config.project('marconi').from_options(**OPTIONS)

# Hoist into package namespace
DriverBase = base.DriverBase
Exemplo n.º 3
0
# You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from marconi.common import config
from marconi.tests import util as testing


PROJECT_CONFIG = config.project()
CFG = PROJECT_CONFIG.from_options(
    without_help=3,
    with_help=(None, 'nonsense'))


class TestConfig(testing.TestBase):

    def test_cli(self):
        args = ['--with_help', 'sense']
        PROJECT_CONFIG.load(self.conf_path('wsgi_sqlite.conf'), args)
        self.assertEquals(CFG.with_help, 'sense')

        PROJECT_CONFIG.load(args=[])
        self.assertEquals(CFG.with_help, None)
Exemplo n.º 4
0
"""Marconi Transport Drivers"""

from marconi.common import config
from marconi.queues.transport import base

OPTIONS = {
    'auth_strategy': ""
}

CFG = config.project('marconi').from_options(**OPTIONS)

# Hoist into package namespace
DriverBase = base.DriverBase
Exemplo n.º 5
0
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from marconi.common import config
from marconi.common import exceptions
from marconi.openstack.common import importutils


cfg_handle = config.project('marconi')
cfg = config.namespace('drivers').from_options(
    transport='marconi.transport.wsgi',
    storage='marconi.storage.sqlite')


class Bootstrap(object):
    """
    Defines the Marconi Bootstrap

    The bootstrap loads up drivers per a given configuration, and manages their
    lifetimes.
    """

    def __init__(self, config_file=None, cli_args=None):
        cfg_handle.load(filename=config_file, args=cli_args)
Exemplo n.º 6
0
# You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from marconi.common import config
from marconi.tests import util as testing


cfg_handle = config.project()
cfg = cfg_handle.from_options(
    without_help=3,
    with_help=(None, "nonsense"))


class TestConfig(testing.TestBase):

    def test_cli(self):
        args = ['--with_help', 'sense']
        cfg_handle.load(self.conf_path('wsgi_sqlite.conf'), args)
        self.assertEquals(cfg.with_help, 'sense')

        cfg_handle.load(args=[])
        self.assertEquals(cfg.with_help, None)
Exemplo n.º 7
0
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from stevedore import driver

from marconi.common import config
from marconi.common import decorators
from marconi.common import exceptions
from marconi.openstack.common import log
from marconi import transport  # NOQA


PROJECT_CFG = config.project('marconi')
CFG = config.namespace('drivers').from_options(
    transport='wsgi',
    storage='sqlite')

LOG = log.getLogger(__name__)


class Bootstrap(object):
    """Defines the Marconi bootstrapper.

    The bootstrap loads up drivers per a given configuration, and
    manages their lifetimes.
    """

    def __init__(self, config_file=None, cli_args=None):
Exemplo n.º 8
0
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import testtools

from marconi.common import config
from marconi.tests import util as testing

cfg = config.project().from_options(without_help=3,
                                    with_help=(None, "nonsense"))


class TestConfig(testing.TestBase):
    def test_cli(self):
        args = ['--with_help', 'sense']
        cfg.set_cli(args)
        cfg.load(self.conf_path('wsgi_reference.conf'))
        self.assertEquals(cfg.with_help, 'sense')
        cfg.set_cli([])
        cfg.load()
        self.assertEquals(cfg.with_help, None)

    def test_wrong_type(self):
        ns = config.namespace('local')
        with testtools.ExpectedException(config.cfg.Error):
Exemplo n.º 9
0
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import fixtures
import os
import testtools

from marconi.common import config

CFG = config.project()


class TestBase(testtools.TestCase):
    """Child class of testtools.TestCase for testing Marconi.

    Inherit from this and write your test methods. If the child class defines
    a prepare(self) method, this method will be called before executing each
    test method.
    """
    def setUp(self):
        super(TestBase, self).setUp()

        self.useFixture(fixtures.FakeLogger('marconi'))

        # NOTE(kgriffs): Don't monkey-patch stdout since it breaks
Exemplo n.º 10
0
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import os
import testtools

from marconi.common import config


cfg = config.project()


class TestBase(testtools.TestCase):
    """
    Child class of testtools.TestCase for testing Marconi

    Inherit from this and write your test methods. If the child class defines
    a prepare(self) method, this method will be called before executing each
    test method.
    """

    def conf_path(self, filename):
        """
        Returns the full path to the specified Marconi conf file
Exemplo n.º 11
0
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from marconi.common import config
from marconi.tests import util as testing

PROJECT_CONFIG = config.project()
CFG = PROJECT_CONFIG.from_options(without_help=3, with_help=(None, 'nonsense'))


class TestConfig(testing.TestBase):
    def test_cli(self):
        args = ['--with_help', 'sense']
        PROJECT_CONFIG.load(self.conf_path('wsgi_sqlite.conf'), args)
        self.assertEquals(CFG.with_help, 'sense')

        PROJECT_CONFIG.load(args=[])
        self.assertEquals(CFG.with_help, None)

    def test_wrong_type(self):
        ns = config.namespace('local')
        with testing.expect(config.cfg.Error):
Exemplo n.º 12
0
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import testtools

from marconi.common import config
from marconi.tests import util as testing


cfg = config.project().from_options(without_help=3,
                                    with_help=(None, "nonsense"))


class TestConfig(testing.TestBase):

    def test_cli(self):
        args = ['--with_help', 'sense']
        cfg.set_cli(args)
        cfg.load(self.conf_path('wsgi_reference.conf'))
        self.assertEquals(cfg.with_help, 'sense')
        cfg.set_cli([])
        cfg.load()
        self.assertEquals(cfg.with_help, None)

    def test_wrong_type(self):
        ns = config.namespace('local')
Exemplo n.º 13
0
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from marconi.common import config
from marconi.storage import reference as storage
from marconi.transport.wsgi import driver as wsgi


cfg = config.project('marconi').from_options()


class Bootstrap(object):
    """
    Defines the Marconi Bootstrap

    The bootstrap loads up drivers per a given configuration, and manages their
    lifetimes.
    """

    def __init__(self, config_file=None):
        #TODO(kgriffs): Error handling
        cfg.load(config_file)

        #TODO(kgriffs): Determine driver types from cfg
Exemplo n.º 14
0
 def setUp(self):
     super(TestTransportAuth, self).setUp()
     self.cfg = config.project('marconi')
Exemplo n.º 15
0
# You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from marconi.common import config
from marconi.storage import reference as storage
from marconi.transport.wsgi import driver as wsgi

cfg = config.project('marconi').from_options()


class Bootstrap(object):
    """
    Defines the Marconi Bootstrap

    The bootstrap loads up drivers per a given configuration, and manages their
    lifetimes.
    """
    def __init__(self, config_file=None):
        #TODO(kgriffs): Error handling
        cfg.load(config_file)

        #TODO(kgriffs): Determine driver types from cfg
        self.storage = storage.Driver()
Exemplo n.º 16
0
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import fixtures
import os
import testtools

from marconi.common import config

CFG = config.project()


class TestBase(testtools.TestCase):
    """Child class of testtools.TestCase for testing Marconi.

    Inherit from this and write your test methods. If the child class defines
    a prepare(self) method, this method will be called before executing each
    test method.
    """

    def setUp(self):
        super(TestBase, self).setUp()

        self.useFixture(fixtures.FakeLogger("marconi"))