aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Tests
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
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')
-rw-r--r--OpenSim/Tests/Common/Mock/BaseAssetRepository.cs66
-rw-r--r--OpenSim/Tests/Common/Mock/TestAssetCache.cs184
-rw-r--r--OpenSim/Tests/Common/Mock/TestAssetService.cs154
-rw-r--r--OpenSim/Tests/Common/Mock/TestOSHttpResponse.cs48
-rw-r--r--OpenSim/Tests/Common/Setup/GetAssetStreamHandlerTestHelpers.cs128
5 files changed, 290 insertions, 290 deletions
diff --git a/OpenSim/Tests/Common/Mock/BaseAssetRepository.cs b/OpenSim/Tests/Common/Mock/BaseAssetRepository.cs
index acfe4fe..b284abc 100644
--- a/OpenSim/Tests/Common/Mock/BaseAssetRepository.cs
+++ b/OpenSim/Tests/Common/Mock/BaseAssetRepository.cs
@@ -1,34 +1,34 @@
1using System.Collections.Generic; 1using System.Collections.Generic;
2using OpenMetaverse; 2using OpenMetaverse;
3using OpenSim.Framework; 3using OpenSim.Framework;
4 4
5namespace OpenSim.Tests.Common.Mock 5namespace OpenSim.Tests.Common.Mock
6{ 6{
7 public class BaseAssetRepository 7 public class BaseAssetRepository
8 { 8 {
9 protected Dictionary<UUID, AssetBase> Assets = new Dictionary<UUID, AssetBase>(); 9 protected Dictionary<UUID, AssetBase> Assets = new Dictionary<UUID, AssetBase>();
10 10
11 public AssetBase FetchAsset(UUID uuid) 11 public AssetBase FetchAsset(UUID uuid)
12 { 12 {
13 if (ExistsAsset(uuid)) 13 if (ExistsAsset(uuid))
14 return Assets[uuid]; 14 return Assets[uuid];
15 else 15 else
16 return null; 16 return null;
17 } 17 }
18 18
19 public void CreateAsset(AssetBase asset) 19 public void CreateAsset(AssetBase asset)
20 { 20 {
21 Assets[asset.FullID] = asset; 21 Assets[asset.FullID] = asset;
22 } 22 }
23 23
24 public void UpdateAsset(AssetBase asset) 24 public void UpdateAsset(AssetBase asset)
25 { 25 {
26 CreateAsset(asset); 26 CreateAsset(asset);
27 } 27 }
28 28
29 public bool ExistsAsset(UUID uuid) 29 public bool ExistsAsset(UUID uuid)
30 { 30 {
31 return Assets.ContainsKey(uuid); 31 return Assets.ContainsKey(uuid);
32 } 32 }
33 } 33 }
34} \ No newline at end of file 34} \ No newline at end of file
diff --git a/OpenSim/Tests/Common/Mock/TestAssetCache.cs b/OpenSim/Tests/Common/Mock/TestAssetCache.cs
index d621763..a9949bb 100644
--- a/OpenSim/Tests/Common/Mock/TestAssetCache.cs
+++ b/OpenSim/Tests/Common/Mock/TestAssetCache.cs
@@ -1,92 +1,92 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.Text; 3using System.Text;
4using OpenMetaverse; 4using OpenMetaverse;
5using OpenMetaverse.Packets; 5using OpenMetaverse.Packets;
6using OpenSim.Framework; 6using OpenSim.Framework;
7 7
8namespace OpenSim.Tests.Common.Mock 8namespace OpenSim.Tests.Common.Mock
9{ 9{
10 public class TestAssetCache : BaseAssetRepository, IAssetCache 10 public class TestAssetCache : BaseAssetRepository, IAssetCache
11 { 11 {
12 public void AssetReceived(AssetBase asset, bool IsTexture) 12 public void AssetReceived(AssetBase asset, bool IsTexture)
13 { 13 {
14 throw new NotImplementedException(); 14 throw new NotImplementedException();
15 } 15 }
16 16
17 public void AssetNotFound(UUID assetID, bool IsTexture) 17 public void AssetNotFound(UUID assetID, bool IsTexture)
18 { 18 {
19 throw new NotImplementedException(); 19 throw new NotImplementedException();
20 } 20 }
21 21
22 public void Dispose() 22 public void Dispose()
23 { 23 {
24 throw new NotImplementedException(); 24 throw new NotImplementedException();
25 } 25 }
26 26
27 public string Version 27 public string Version
28 { 28 {
29 get { throw new NotImplementedException(); } 29 get { throw new NotImplementedException(); }
30 } 30 }
31 31
32 public string Name 32 public string Name
33 { 33 {
34 get { throw new NotImplementedException(); } 34 get { throw new NotImplementedException(); }
35 } 35 }
36 36
37 public void Initialise() 37 public void Initialise()
38 { 38 {
39 throw new NotImplementedException(); 39 throw new NotImplementedException();
40 } 40 }
41 41
42 public IAssetServer AssetServer 42 public IAssetServer AssetServer
43 { 43 {
44 get { throw new NotImplementedException(); } 44 get { throw new NotImplementedException(); }
45 } 45 }
46 46
47 public void Initialise(ConfigSettings cs, IAssetServer server) 47 public void Initialise(ConfigSettings cs, IAssetServer server)
48 { 48 {
49 throw new NotImplementedException(); 49 throw new NotImplementedException();
50 } 50 }
51 51
52 public void ShowState() 52 public void ShowState()
53 { 53 {
54 throw new NotImplementedException(); 54 throw new NotImplementedException();
55 } 55 }
56 56
57 public void Clear() 57 public void Clear()
58 { 58 {
59 throw new NotImplementedException(); 59 throw new NotImplementedException();
60 } 60 }
61 61
62 public bool TryGetCachedAsset(UUID assetID, out AssetBase asset) 62 public bool TryGetCachedAsset(UUID assetID, out AssetBase asset)
63 { 63 {
64 throw new NotImplementedException(); 64 throw new NotImplementedException();
65 } 65 }
66 66
67 public void GetAsset(UUID assetID, AssetRequestCallback callback, bool isTexture) 67 public void GetAsset(UUID assetID, AssetRequestCallback callback, bool isTexture)
68 { 68 {
69 throw new NotImplementedException(); 69 throw new NotImplementedException();
70 } 70 }
71 71
72 public AssetBase GetAsset(UUID assetID, bool isTexture) 72 public AssetBase GetAsset(UUID assetID, bool isTexture)
73 { 73 {
74 return FetchAsset(assetID); 74 return FetchAsset(assetID);
75 } 75 }
76 76
77 public void AddAsset(AssetBase asset) 77 public void AddAsset(AssetBase asset)
78 { 78 {
79 CreateAsset( asset ); 79 CreateAsset( asset );
80 } 80 }
81 81
82 public void ExpireAsset(UUID assetID) 82 public void ExpireAsset(UUID assetID)
83 { 83 {
84 throw new NotImplementedException(); 84 throw new NotImplementedException();
85 } 85 }
86 86
87 public void AddAssetRequest(IClientAPI userInfo, TransferRequestPacket transferRequest) 87 public void AddAssetRequest(IClientAPI userInfo, TransferRequestPacket transferRequest)
88 { 88 {
89 throw new NotImplementedException(); 89 throw new NotImplementedException();
90 } 90 }
91 } 91 }
92} 92}
diff --git a/OpenSim/Tests/Common/Mock/TestAssetService.cs b/OpenSim/Tests/Common/Mock/TestAssetService.cs
index 23a1137..91ea921 100644
--- a/OpenSim/Tests/Common/Mock/TestAssetService.cs
+++ b/OpenSim/Tests/Common/Mock/TestAssetService.cs
@@ -1,78 +1,78 @@
1/* 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright 7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright 9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution. 11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the 12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products 13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission. 14 * derived from this software without specific prior written permission.
15 * 15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY 16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using OpenMetaverse; 30using OpenMetaverse;
31using OpenSim.Framework; 31using OpenSim.Framework;
32using OpenSim.Data; 32using OpenSim.Data;
33using OpenSim.Services.Interfaces; 33using OpenSim.Services.Interfaces;
34 34
35namespace OpenSim.Tests.Common.Mock 35namespace OpenSim.Tests.Common.Mock
36{ 36{
37 public class TestAssetService : IAssetService 37 public class TestAssetService : IAssetService
38 { 38 {
39 private readonly Dictionary<string, AssetBase> Assets = new Dictionary<string, AssetBase>(); 39 private readonly Dictionary<string, AssetBase> Assets = new Dictionary<string, AssetBase>();
40 40
41 public AssetBase Get(string id) 41 public AssetBase Get(string id)
42 { 42 {
43 return Assets[ id ]; 43 return Assets[ id ];
44 } 44 }
45 45
46 public AssetMetadata GetMetadata(string id) 46 public AssetMetadata GetMetadata(string id)
47 { 47 {
48 throw new System.NotImplementedException(); 48 throw new System.NotImplementedException();
49 } 49 }
50 50
51 public byte[] GetData(string id) 51 public byte[] GetData(string id)
52 { 52 {
53 throw new System.NotImplementedException(); 53 throw new System.NotImplementedException();
54 } 54 }
55 55
56 public bool Get(string id, object sender, AssetRetrieved handler) 56 public bool Get(string id, object sender, AssetRetrieved handler)
57 { 57 {
58 throw new NotImplementedException(); 58 throw new NotImplementedException();
59 } 59 }
60 60
61 public string Store(AssetBase asset) 61 public string Store(AssetBase asset)
62 { 62 {
63 Assets[asset.ID] = asset; 63 Assets[asset.ID] = asset;
64 64
65 return asset.ID; 65 return asset.ID;
66 } 66 }
67 67
68 public bool UpdateContent(string id, byte[] data) 68 public bool UpdateContent(string id, byte[] data)
69 { 69 {
70 throw new System.NotImplementedException(); 70 throw new System.NotImplementedException();
71 } 71 }
72 72
73 public bool Delete(string id) 73 public bool Delete(string id)
74 { 74 {
75 throw new System.NotImplementedException(); 75 throw new System.NotImplementedException();
76 } 76 }
77 } 77 }
78} \ No newline at end of file 78} \ No newline at end of file
diff --git a/OpenSim/Tests/Common/Mock/TestOSHttpResponse.cs b/OpenSim/Tests/Common/Mock/TestOSHttpResponse.cs
index 9e097b8..59d4000 100644
--- a/OpenSim/Tests/Common/Mock/TestOSHttpResponse.cs
+++ b/OpenSim/Tests/Common/Mock/TestOSHttpResponse.cs
@@ -1,24 +1,24 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.Text; 3using System.Text;
4using OpenSim.Framework.Servers.HttpServer; 4using OpenSim.Framework.Servers.HttpServer;
5 5
6namespace OpenSim.Tests.Common.Mock 6namespace OpenSim.Tests.Common.Mock
7{ 7{
8 public class TestOSHttpResponse : OSHttpResponse 8 public class TestOSHttpResponse : OSHttpResponse
9 { 9 {
10 private int m_statusCode; 10 private int m_statusCode;
11 public override int StatusCode 11 public override int StatusCode
12 { 12 {
13 get { return m_statusCode; } 13 get { return m_statusCode; }
14 set { m_statusCode = value; } 14 set { m_statusCode = value; }
15 } 15 }
16 16
17 private string m_contentType; 17 private string m_contentType;
18 public override string ContentType 18 public override string ContentType
19 { 19 {
20 get { return m_contentType; } 20 get { return m_contentType; }
21 set { m_contentType = value; } 21 set { m_contentType = value; }
22 } 22 }
23 } 23 }
24} 24}
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}