diff options
author | Justin Clark-Casey (justincc) | 2011-07-04 22:59:36 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2011-07-04 22:59:36 +0100 |
commit | f58de55c843843775886a6227acbecd249a59e96 (patch) | |
tree | 273d75ca3689bad7c271707052b8af911eed3ea6 | |
parent | Make it possible to disable the file part of the flotsam asset cache (diff) | |
download | opensim-SC_OLD-f58de55c843843775886a6227acbecd249a59e96.zip opensim-SC_OLD-f58de55c843843775886a6227acbecd249a59e96.tar.gz opensim-SC_OLD-f58de55c843843775886a6227acbecd249a59e96.tar.bz2 opensim-SC_OLD-f58de55c843843775886a6227acbecd249a59e96.tar.xz |
refactor: Move test setup code into setup method
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/CoreModules/Asset/Tests/FlotsamAssetCacheTests.cs | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/OpenSim/Region/CoreModules/Asset/Tests/FlotsamAssetCacheTests.cs b/OpenSim/Region/CoreModules/Asset/Tests/FlotsamAssetCacheTests.cs index a4aeeda..36cffd0 100644 --- a/OpenSim/Region/CoreModules/Asset/Tests/FlotsamAssetCacheTests.cs +++ b/OpenSim/Region/CoreModules/Asset/Tests/FlotsamAssetCacheTests.cs | |||
@@ -47,35 +47,42 @@ namespace OpenSim.Region.CoreModules.Asset.Tests | |||
47 | [TestFixture] | 47 | [TestFixture] |
48 | public class FlotsamAssetCacheTests | 48 | public class FlotsamAssetCacheTests |
49 | { | 49 | { |
50 | [Test] | 50 | protected TestScene m_scene; |
51 | public void TestCacheAsset() | 51 | protected FlotsamAssetCache m_cache; |
52 | { | ||
53 | TestHelper.InMethod(); | ||
54 | log4net.Config.XmlConfigurator.Configure(); | ||
55 | 52 | ||
53 | [SetUp] | ||
54 | public void SetUp() | ||
55 | { | ||
56 | IConfigSource config = new IniConfigSource(); | 56 | IConfigSource config = new IniConfigSource(); |
57 | 57 | ||
58 | config.AddConfig("Modules"); | 58 | config.AddConfig("Modules"); |
59 | config.Configs["Modules"].Set("AssetCaching", "FlotsamAssetCache"); | 59 | config.Configs["Modules"].Set("AssetCaching", "FlotsamAssetCache"); |
60 | config.AddConfig("AssetCache"); | 60 | config.AddConfig("AssetCache"); |
61 | config.Configs["AssetCache"].Set("FileCacheEnabled", "false"); | 61 | config.Configs["AssetCache"].Set("FileCacheEnabled", "false"); |
62 | config.Configs["AssetCache"].Set("MemoryCacheEnabled", "true"); | 62 | config.Configs["AssetCache"].Set("MemoryCacheEnabled", "true"); |
63 | 63 | ||
64 | FlotsamAssetCache cache = new FlotsamAssetCache(); | 64 | m_cache = new FlotsamAssetCache(); |
65 | TestScene scene = SceneSetupHelpers.SetupScene(); | 65 | m_scene = SceneSetupHelpers.SetupScene(); |
66 | SceneSetupHelpers.SetupSceneModules(scene, config, cache); | 66 | SceneSetupHelpers.SetupSceneModules(m_scene, config, m_cache); |
67 | } | ||
68 | |||
69 | [Test] | ||
70 | public void TestCacheAsset() | ||
71 | { | ||
72 | TestHelper.InMethod(); | ||
73 | // log4net.Config.XmlConfigurator.Configure(); | ||
67 | 74 | ||
68 | AssetBase asset = AssetHelpers.CreateAsset(); | 75 | AssetBase asset = AssetHelpers.CreateAsset(); |
69 | asset.ID = TestHelper.ParseTail(0x1).ToString(); | 76 | asset.ID = TestHelper.ParseTail(0x1).ToString(); |
70 | 77 | ||
71 | // Check we don't get anything before the asset is put in the cache | 78 | // Check we don't get anything before the asset is put in the cache |
72 | AssetBase retrievedAsset = cache.Get(asset.ID.ToString()); | 79 | AssetBase retrievedAsset = m_cache.Get(asset.ID.ToString()); |
73 | Assert.That(retrievedAsset, Is.Null); | 80 | Assert.That(retrievedAsset, Is.Null); |
74 | 81 | ||
75 | cache.Store(asset); | 82 | m_cache.Store(asset); |
76 | 83 | ||
77 | // Check that asset is now in cache | 84 | // Check that asset is now in cache |
78 | retrievedAsset = cache.Get(asset.ID.ToString()); | 85 | retrievedAsset = m_cache.Get(asset.ID.ToString()); |
79 | Assert.That(retrievedAsset, Is.Not.Null); | 86 | Assert.That(retrievedAsset, Is.Not.Null); |
80 | Assert.That(retrievedAsset.ID, Is.EqualTo(asset.ID)); | 87 | Assert.That(retrievedAsset.ID, Is.EqualTo(asset.ID)); |
81 | } | 88 | } |