Merge "Remove token persistence proxy"

This commit is contained in:
Jenkins
2014-10-30 05:23:47 +00:00
committed by Gerrit Code Review
6 changed files with 1 additions and 177 deletions

View File

@@ -169,4 +169,4 @@ class KvsTokenCacheInvalidation(tests.TestCase,
super(KvsTokenCacheInvalidation, self).config_overrides()
self.config_fixture.config(
group='token',
driver='keystone.token.backends.kvs.Token')
driver='keystone.token.persistence.backends.kvs.Token')

View File

@@ -1,86 +0,0 @@
# Licensed under the Apache License, Version 2.0 (the "License"); 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 keystone.common.kvs import core as kvs_core
from keystone import tests
from keystone import token
from keystone.token.backends import kvs as proxy_kvs
from keystone.token.backends import memcache as proxy_memcache
from keystone.token.backends import sql as proxy_sql
from keystone.token.persistence.backends import kvs
from keystone.token.persistence.backends import memcache
from keystone.token.persistence.backends import sql
class TokenPersistenceProxyTest(tests.BaseTestCase):
def test_symbols(self):
"""Verify token persistence proxy symbols.
The Token manager has been moved from `keystone.token.core` to
`keystone.token.persistence`. This test verifies that the symbols
resolve as expected.
"""
self.assertTrue(issubclass(token.Manager, token.persistence.Manager))
self.assertTrue(issubclass(token.Driver, token.persistence.Driver))
class TokenPersistenceBackendSymbols(tests.TestCase):
def test_symbols(self):
"""Verify the token persistence backend proxy symbols.
Make sure that the modules that are (for compat reasons) located at
`keystone.token.backends` are the same as the new location
`keystone.token.persistence.backends`.
"""
self.assertTrue(issubclass(proxy_kvs.Token, kvs.Token))
self.assertTrue(issubclass(proxy_memcache.Token, memcache.Token))
self.assertTrue(issubclass(proxy_sql.Token, sql.Token))
self.assertIs(proxy_sql.TokenModel, sql.TokenModel)
def test_instantiation_kvs(self):
self.config_fixture.config(
group='token',
driver='keystone.token.backends.kvs.Token')
# Clear the KVS registry so we can re-instantiate the KVS backend. This
# is required because the KVS core tries to limit duplication of
# CacheRegion objects and CacheRegion objects cannot be reconfigured.
kvs_core.KEY_VALUE_STORE_REGISTRY.clear()
manager = token.persistence.PersistenceManager()
self.assertIsInstance(manager.driver, proxy_kvs.Token)
self.assertIsInstance(manager.driver, kvs.Token)
def test_instantiation_memcache(self):
self.config_fixture.config(
group='token',
driver='keystone.token.backends.memcache.Token')
# The memcache token backend is just a light wrapper around the KVS
# token backend. Clear the KVS registry so we can re-instantiate the
# KVS backend. This is required because the KVS core tries to limit
# duplication of CacheRegion objects and CacheRegion objects cannot be
# reconfigured.
kvs_core.KEY_VALUE_STORE_REGISTRY.clear()
manager = token.persistence.PersistenceManager()
self.assertIsInstance(manager.driver, proxy_memcache.Token)
self.assertIsInstance(manager.driver, memcache.Token)
def test_instantiation_sql(self):
self.config_fixture.config(
group='token',
driver='keystone.token.backends.sql.Token')
manager = token.persistence.PersistenceManager()
self.assertIsInstance(manager.driver, proxy_sql.Token)
self.assertIsInstance(manager.driver, sql.Token)

View File

@@ -1,15 +0,0 @@
# Licensed under the Apache License, Version 2.0 (the "License"); 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.
# NOTE(morganfainberg): This package is for transition from the old token
# backend package location to the new one. This package is slated for removal
# in the Kilo development cycle.

View File

@@ -1,24 +0,0 @@
# Licensed under the Apache License, Version 2.0 (the "License"); 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 keystone.openstack.common import versionutils
from keystone.token.persistence.backends import kvs
class Token(kvs.Token):
@versionutils.deprecated(
versionutils.deprecated.JUNO,
in_favor_of='keystone.token.persistence.backends.kvs.Token',
remove_in=+1,
what='keystone.token.backends.kvs.Token')
def __init__(self):
super(Token, self).__init__()

View File

@@ -1,24 +0,0 @@
# Licensed under the Apache License, Version 2.0 (the "License"); 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 keystone.openstack.common import versionutils
from keystone.token.persistence.backends import memcache
class Token(memcache.Token):
@versionutils.deprecated(
versionutils.deprecated.JUNO,
in_favor_of='keystone.token.persistence.backends.memcache.Token',
remove_in=+1,
what='keystone.token.backends.memcache.Token')
def __init__(self):
super(Token, self).__init__()

View File

@@ -1,27 +0,0 @@
# Licensed under the Apache License, Version 2.0 (the "License"); 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 keystone.openstack.common import versionutils
from keystone.token.persistence.backends import sql
class Token(sql.Token):
@versionutils.deprecated(
versionutils.deprecated.JUNO,
in_favor_of='keystone.token.persistence.backends.sql.Token',
remove_in=+1,
what='keystone.token.backends.sql.Token')
def __init__(self):
super(Token, self).__init__()
TokenModel = sql.TokenModel