aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Tests/Common/Setup/GetAssetStreamHandlerTestHelpers.cs
diff options
context:
space:
mode:
authorJeff Ames2009-05-17 10:26:00 +0000
committerJeff Ames2009-05-17 10:26:00 +0000
commit5cfd84c92427658d88c4b36e1470744babd3d54d (patch)
tree5a08dd22f5866dd4e0cf0bdbed9353561390fa70 /OpenSim/Tests/Common/Setup/GetAssetStreamHandlerTestHelpers.cs
parentRemoving a superfluous message, just to make bamboo run again. (diff)
downloadopensim-SC_OLD-5cfd84c92427658d88c4b36e1470744babd3d54d.zip
opensim-SC_OLD-5cfd84c92427658d88c4b36e1470744babd3d54d.tar.gz
opensim-SC_OLD-5cfd84c92427658d88c4b36e1470744babd3d54d.tar.bz2
opensim-SC_OLD-5cfd84c92427658d88c4b36e1470744babd3d54d.tar.xz
Update svn properties.
Diffstat (limited to 'OpenSim/Tests/Common/Setup/GetAssetStreamHandlerTestHelpers.cs')
-rw-r--r--OpenSim/Tests/Common/Setup/GetAssetStreamHandlerTestHelpers.cs128
1 files changed, 64 insertions, 64 deletions
diff --git a/OpenSim/Tests/Common/Setup/GetAssetStreamHandlerTestHelpers.cs b/OpenSim/Tests/Common/Setup/GetAssetStreamHandlerTestHelpers.cs
index 593beae..26851d6 100644
--- a/OpenSim/Tests/Common/Setup/GetAssetStreamHandlerTestHelpers.cs
+++ b/OpenSim/Tests/Common/Setup/GetAssetStreamHandlerTestHelpers.cs
@@ -1,64 +1,64 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.IO; 3using System.IO;
4using System.Net; 4using System.Net;
5using System.Text; 5using System.Text;
6using System.Xml; 6using System.Xml;
7using System.Xml.Serialization; 7using System.Xml.Serialization;
8using NUnit.Framework; 8using NUnit.Framework;
9using OpenSim.Framework; 9using OpenSim.Framework;
10using OpenSim.Framework.Servers; 10using OpenSim.Framework.Servers;
11using OpenSim.Framework.Servers.HttpServer; 11using OpenSim.Framework.Servers.HttpServer;
12using OpenSim.Tests.Common.Mock; 12using OpenSim.Tests.Common.Mock;
13 13
14namespace OpenSim.Tests.Common.Setup 14namespace OpenSim.Tests.Common.Setup
15{ 15{
16 public class GetAssetStreamHandlerTestHelpers 16 public class GetAssetStreamHandlerTestHelpers
17 { 17 {
18 public static void BaseFetchExistingAssetXmlTest(AssetBase asset, BaseGetAssetStreamHandler handler, OSHttpResponse response) 18 public static void BaseFetchExistingAssetXmlTest(AssetBase asset, BaseGetAssetStreamHandler handler, OSHttpResponse response)
19 { 19 {
20 byte[] expected = BaseGetAssetStreamHandler.GetXml(asset); 20 byte[] expected = BaseGetAssetStreamHandler.GetXml(asset);
21 21
22 byte[] actual = handler.Handle("/assets/" + asset.ID , null, null, response); 22 byte[] actual = handler.Handle("/assets/" + asset.ID , null, null, response);
23 23
24 Assert.Greater(actual.Length, 10, "Too short xml on fetching xml without trailing slash."); 24 Assert.Greater(actual.Length, 10, "Too short xml on fetching xml without trailing slash.");
25 Assert.AreEqual(expected, actual, "Failed on fetching xml without trailing slash."); 25 Assert.AreEqual(expected, actual, "Failed on fetching xml without trailing slash.");
26 // Assert.AreEqual((int)HttpStatusCode.OK, response.StatusCode, "Wrong http response code on first fetch."); 26 // Assert.AreEqual((int)HttpStatusCode.OK, response.StatusCode, "Wrong http response code on first fetch.");
27 27
28 byte[] actual1 = handler.Handle("/assets/" + asset.ID + "/", null, null, response); 28 byte[] actual1 = handler.Handle("/assets/" + asset.ID + "/", null, null, response);
29 Assert.Greater(actual1.Length, 10, "Too short xml on fetching xml with trailing slash."); 29 Assert.Greater(actual1.Length, 10, "Too short xml on fetching xml with trailing slash.");
30 Assert.AreEqual(expected, actual1, "Failed on fetching xml with trailing slash."); 30 Assert.AreEqual(expected, actual1, "Failed on fetching xml with trailing slash.");
31 // Assert.AreEqual((int)HttpStatusCode.OK, response.StatusCode, "Wrong http response code on second fetch."); 31 // Assert.AreEqual((int)HttpStatusCode.OK, response.StatusCode, "Wrong http response code on second fetch.");
32 } 32 }
33 33
34 public static void BaseFetchExistingAssetDataTest(AssetBase asset, BaseGetAssetStreamHandler handler, OSHttpResponse response) 34 public static void BaseFetchExistingAssetDataTest(AssetBase asset, BaseGetAssetStreamHandler handler, OSHttpResponse response)
35 { 35 {
36 Assert.AreEqual(asset.Data, handler.Handle("/assets/" + asset.ID + "/data", null, null, response), "Failed on fetching data without trailing slash."); 36 Assert.AreEqual(asset.Data, handler.Handle("/assets/" + asset.ID + "/data", null, null, response), "Failed on fetching data without trailing slash.");
37 Assert.AreEqual((int)HttpStatusCode.OK, response.StatusCode, "Wrong http response code on first fetch."); 37 Assert.AreEqual((int)HttpStatusCode.OK, response.StatusCode, "Wrong http response code on first fetch.");
38 38
39 Assert.AreEqual(asset.Data, handler.Handle("/assets/" + asset.ID + "/data/", null, null, response), "Failed on fetching data with trailing slash."); 39 Assert.AreEqual(asset.Data, handler.Handle("/assets/" + asset.ID + "/data/", null, null, response), "Failed on fetching data with trailing slash.");
40 Assert.AreEqual((int)HttpStatusCode.OK, response.StatusCode, "Wrong http response code on second fetch."); 40 Assert.AreEqual((int)HttpStatusCode.OK, response.StatusCode, "Wrong http response code on second fetch.");
41 } 41 }
42 42
43 public static AssetBase CreateCommonTestResources(out OSHttpResponse response) 43 public static AssetBase CreateCommonTestResources(out OSHttpResponse response)
44 { 44 {
45 AssetBase asset = CreateTestAsset(); 45 AssetBase asset = CreateTestAsset();
46 response = new TestOSHttpResponse(); 46 response = new TestOSHttpResponse();
47 return asset; 47 return asset;
48 } 48 }
49 49
50 public static AssetBase CreateTestAsset() 50 public static AssetBase CreateTestAsset()
51 { 51 {
52 byte[] expected = new byte[] { 1,2,3 }; 52 byte[] expected = new byte[] { 1,2,3 };
53 AssetBase asset = new AssetBase( ); 53 AssetBase asset = new AssetBase( );
54 asset.ID = Guid.NewGuid().ToString(); 54 asset.ID = Guid.NewGuid().ToString();
55 asset.Data = expected; 55 asset.Data = expected;
56 return asset; 56 return asset;
57 } 57 }
58 58
59 public static void BaseFetchMissingAsset(BaseGetAssetStreamHandler handler) 59 public static void BaseFetchMissingAsset(BaseGetAssetStreamHandler handler)
60 { 60 {
61 Assert.AreEqual(BaseRequestHandlerTestHelper.EmptyByteArray, handler.Handle("/assets/" + Guid.NewGuid(), null, null, null), "Failed on bad guid."); 61 Assert.AreEqual(BaseRequestHandlerTestHelper.EmptyByteArray, handler.Handle("/assets/" + Guid.NewGuid(), null, null, null), "Failed on bad guid.");
62 } 62 }
63 } 63 }
64} 64}