aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJustin Clarke Casey2009-06-05 17:03:44 +0000
committerJustin Clarke Casey2009-06-05 17:03:44 +0000
commit87097f24848e9763ca7e3513b681a7b95fe5183f (patch)
tree75841e585cebfa670caa488496a1dfe28057024e
parent* Fix problem where known missing assets would stop save oar ever completing (diff)
downloadopensim-SC-87097f24848e9763ca7e3513b681a7b95fe5183f.zip
opensim-SC-87097f24848e9763ca7e3513b681a7b95fe5183f.tar.gz
opensim-SC-87097f24848e9763ca7e3513b681a7b95fe5183f.tar.bz2
opensim-SC-87097f24848e9763ca7e3513b681a7b95fe5183f.tar.xz
* Fix unit tests so that they correctly handle 404 missing asset response
* I didn't think there were tests in this area - my bad
-rw-r--r--OpenSim/Framework/Servers/Tests/CachedGetAssetStreamHandlerTests.cs6
-rw-r--r--OpenSim/Framework/Servers/Tests/GetAssetStreamHandlerTests.cs7
-rw-r--r--OpenSim/Tests/Common/Setup/GetAssetStreamHandlerTestHelpers.cs10
3 files changed, 14 insertions, 9 deletions
diff --git a/OpenSim/Framework/Servers/Tests/CachedGetAssetStreamHandlerTests.cs b/OpenSim/Framework/Servers/Tests/CachedGetAssetStreamHandlerTests.cs
index cf19468..fed4707 100644
--- a/OpenSim/Framework/Servers/Tests/CachedGetAssetStreamHandlerTests.cs
+++ b/OpenSim/Framework/Servers/Tests/CachedGetAssetStreamHandlerTests.cs
@@ -94,9 +94,11 @@ namespace OpenSim.Framework.Servers.Tests
94 public void TestHandleFetchMissingAsset() 94 public void TestHandleFetchMissingAsset()
95 { 95 {
96 IAssetCache assetCache = new TestAssetCache(); 96 IAssetCache assetCache = new TestAssetCache();
97 CachedGetAssetStreamHandler handler = new CachedGetAssetStreamHandler(assetCache); 97 CachedGetAssetStreamHandler handler;
98 OSHttpResponse response;
99 AssetBase asset = CreateTestEnvironment(out handler, out response);
98 100
99 GetAssetStreamHandlerTestHelpers.BaseFetchMissingAsset(handler); 101 GetAssetStreamHandlerTestHelpers.BaseFetchMissingAsset(handler, response);
100 } 102 }
101 103
102 [Test] 104 [Test]
diff --git a/OpenSim/Framework/Servers/Tests/GetAssetStreamHandlerTests.cs b/OpenSim/Framework/Servers/Tests/GetAssetStreamHandlerTests.cs
index 7a05f93..6a4918d 100644
--- a/OpenSim/Framework/Servers/Tests/GetAssetStreamHandlerTests.cs
+++ b/OpenSim/Framework/Servers/Tests/GetAssetStreamHandlerTests.cs
@@ -94,10 +94,11 @@ namespace OpenSim.Framework.Servers.Tests
94 [Test] 94 [Test]
95 public void TestHandleFetchMissingAsset() 95 public void TestHandleFetchMissingAsset()
96 { 96 {
97 IAssetDataPlugin assetDataPlugin = new TestAssetDataPlugin(); 97 GetAssetStreamHandler handler;
98 GetAssetStreamHandler handler = new GetAssetStreamHandler(assetDataPlugin); 98 OSHttpResponse response;
99 AssetBase asset = CreateTestEnvironment(out handler, out response);
99 100
100 GetAssetStreamHandlerTestHelpers.BaseFetchMissingAsset(handler); 101 GetAssetStreamHandlerTestHelpers.BaseFetchMissingAsset(handler, response);
101 } 102 }
102 103
103 [Test] 104 [Test]
diff --git a/OpenSim/Tests/Common/Setup/GetAssetStreamHandlerTestHelpers.cs b/OpenSim/Tests/Common/Setup/GetAssetStreamHandlerTestHelpers.cs
index 138b690..d338f00 100644
--- a/OpenSim/Tests/Common/Setup/GetAssetStreamHandlerTestHelpers.cs
+++ b/OpenSim/Tests/Common/Setup/GetAssetStreamHandlerTestHelpers.cs
@@ -80,8 +80,7 @@ namespace OpenSim.Tests.Common.Setup
80 80
81 public static void BaseFetchExistingAssetMetaDataTest(AssetBase asset, BaseGetAssetStreamHandler handler, OSHttpResponse response) 81 public static void BaseFetchExistingAssetMetaDataTest(AssetBase asset, BaseGetAssetStreamHandler handler, OSHttpResponse response)
82 { 82 {
83 XmlSerializer xs = 83 XmlSerializer xs = new XmlSerializer(typeof(AssetMetadata));
84 new XmlSerializer(typeof(AssetMetadata));
85 84
86 byte[] expected = ServerUtils.SerializeResult(xs, asset.Metadata); 85 byte[] expected = ServerUtils.SerializeResult(xs, asset.Metadata);
87 86
@@ -112,9 +111,12 @@ namespace OpenSim.Tests.Common.Setup
112 return asset; 111 return asset;
113 } 112 }
114 113
115 public static void BaseFetchMissingAsset(BaseGetAssetStreamHandler handler) 114 public static void BaseFetchMissingAsset(BaseGetAssetStreamHandler handler, OSHttpResponse response)
116 { 115 {
117 Assert.AreEqual(BaseRequestHandlerTestHelper.EmptyByteArray, handler.Handle("/assets/" + Guid.NewGuid(), null, null, null), "Failed on bad guid."); 116 Assert.AreEqual(
117 BaseRequestHandlerTestHelper.EmptyByteArray,
118 handler.Handle("/assets/" + Guid.NewGuid(), null, null, response), "Failed on bad guid.");
119 Assert.AreEqual((int)HttpStatusCode.NotFound, response.StatusCode, "Response code wrong in BaseFetchMissingAsset");
118 } 120 }
119 } 121 }
120} 122}