aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Framework/Servers/Tests/VersionInfoTests.cs52
-rw-r--r--OpenSim/Region/CoreModules/Asset/GlynnTuckerAssetCache.cs252
-rw-r--r--OpenSim/Server/Handlers/Tests/Asset/AssetServerGetHandlerTests.cs204
-rw-r--r--OpenSim/SimulatorServices/SimulationService.cs170
4 files changed, 339 insertions, 339 deletions
diff --git a/OpenSim/Framework/Servers/Tests/VersionInfoTests.cs b/OpenSim/Framework/Servers/Tests/VersionInfoTests.cs
index 0c5832d..6745bac 100644
--- a/OpenSim/Framework/Servers/Tests/VersionInfoTests.cs
+++ b/OpenSim/Framework/Servers/Tests/VersionInfoTests.cs
@@ -1,26 +1,26 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.Text; 3using System.Text;
4using NUnit.Framework; 4using NUnit.Framework;
5 5
6namespace OpenSim.Framework.Servers.Tests 6namespace OpenSim.Framework.Servers.Tests
7{ 7{
8 [TestFixture] 8 [TestFixture]
9 public class VersionInfoTests 9 public class VersionInfoTests
10 { 10 {
11 [Test] 11 [Test]
12 public void TestVersionLength() 12 public void TestVersionLength()
13 { 13 {
14 Assert.AreEqual(VersionInfo.VERSIONINFO_VERSION_LENGTH, VersionInfo.Version.Length," VersionInfo.Version string not " + VersionInfo.VERSIONINFO_VERSION_LENGTH + " chars." ); 14 Assert.AreEqual(VersionInfo.VERSIONINFO_VERSION_LENGTH, VersionInfo.Version.Length," VersionInfo.Version string not " + VersionInfo.VERSIONINFO_VERSION_LENGTH + " chars." );
15 } 15 }
16 16
17 [Test] 17 [Test]
18 public void TestGetVersionStringLength() 18 public void TestGetVersionStringLength()
19 { 19 {
20 foreach (VersionInfo.Flavour flavour in Enum.GetValues(typeof(VersionInfo.Flavour))) 20 foreach (VersionInfo.Flavour flavour in Enum.GetValues(typeof(VersionInfo.Flavour)))
21 { 21 {
22 Assert.AreEqual(VersionInfo.VERSIONINFO_VERSION_LENGTH, VersionInfo.GetVersionString("0.0.0", flavour).Length, "0.0.0/" + flavour + " failed"); 22 Assert.AreEqual(VersionInfo.VERSIONINFO_VERSION_LENGTH, VersionInfo.GetVersionString("0.0.0", flavour).Length, "0.0.0/" + flavour + " failed");
23 } 23 }
24 } 24 }
25 } 25 }
26} 26}
diff --git a/OpenSim/Region/CoreModules/Asset/GlynnTuckerAssetCache.cs b/OpenSim/Region/CoreModules/Asset/GlynnTuckerAssetCache.cs
index f0a43b0..df65226 100644
--- a/OpenSim/Region/CoreModules/Asset/GlynnTuckerAssetCache.cs
+++ b/OpenSim/Region/CoreModules/Asset/GlynnTuckerAssetCache.cs
@@ -1,126 +1,126 @@
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 log4net; 28using log4net;
29using System; 29using System;
30using System.IO; 30using System.IO;
31using System.Collections.Generic; 31using System.Collections.Generic;
32using System.Reflection; 32using System.Reflection;
33using GlynnTucker.Cache; 33using GlynnTucker.Cache;
34using Nini.Config; 34using Nini.Config;
35using OpenSim.Framework; 35using OpenSim.Framework;
36using OpenSim.Region.Framework.Interfaces; 36using OpenSim.Region.Framework.Interfaces;
37using OpenSim.Region.Framework.Scenes; 37using OpenSim.Region.Framework.Scenes;
38using OpenSim.Services.Interfaces; 38using OpenSim.Services.Interfaces;
39 39
40namespace OpenSim.Region.CoreModules.Asset 40namespace OpenSim.Region.CoreModules.Asset
41{ 41{
42 public class GlynnTuckerAssetCache : ISharedRegionModule, IImprovedAssetCache 42 public class GlynnTuckerAssetCache : ISharedRegionModule, IImprovedAssetCache
43 { 43 {
44 private static readonly ILog m_log = 44 private static readonly ILog m_log =
45 LogManager.GetLogger( 45 LogManager.GetLogger(
46 MethodBase.GetCurrentMethod().DeclaringType); 46 MethodBase.GetCurrentMethod().DeclaringType);
47 47
48 private bool m_Enabled = false; 48 private bool m_Enabled = false;
49 private ICache m_Cache = new GlynnTucker.Cache.SimpleMemoryCache(); 49 private ICache m_Cache = new GlynnTucker.Cache.SimpleMemoryCache();
50 50
51 public string Name 51 public string Name
52 { 52 {
53 get { return "GlynnTuckerAssetCache"; } 53 get { return "GlynnTuckerAssetCache"; }
54 } 54 }
55 55
56 public void Initialise(IConfigSource source) 56 public void Initialise(IConfigSource source)
57 { 57 {
58 IConfig moduleConfig = source.Configs["Modules"]; 58 IConfig moduleConfig = source.Configs["Modules"];
59 59
60 if (moduleConfig != null) 60 if (moduleConfig != null)
61 { 61 {
62 string name = moduleConfig.GetString("AssetCaching", "GlynnTuckerAssetCache"); 62 string name = moduleConfig.GetString("AssetCaching", "GlynnTuckerAssetCache");
63 m_log.DebugFormat("[XXX] name = {0} (this module's name: {1}", name, Name); 63 m_log.DebugFormat("[XXX] name = {0} (this module's name: {1}", name, Name);
64 64
65 if (name == Name) 65 if (name == Name)
66 { 66 {
67 m_Enabled = true; 67 m_Enabled = true;
68 68
69 m_log.Info("[ASSET CACHE]: GlynnTucker asset cache enabled"); 69 m_log.Info("[ASSET CACHE]: GlynnTucker asset cache enabled");
70 70
71 } 71 }
72 } 72 }
73 } 73 }
74 74
75 public void PostInitialise() 75 public void PostInitialise()
76 { 76 {
77 } 77 }
78 78
79 public void Close() 79 public void Close()
80 { 80 {
81 } 81 }
82 82
83 public void AddRegion(Scene scene) 83 public void AddRegion(Scene scene)
84 { 84 {
85 if (m_Enabled) 85 if (m_Enabled)
86 scene.RegisterModuleInterface<IImprovedAssetCache>(this); 86 scene.RegisterModuleInterface<IImprovedAssetCache>(this);
87 } 87 }
88 88
89 public void RemoveRegion(Scene scene) 89 public void RemoveRegion(Scene scene)
90 { 90 {
91 } 91 }
92 92
93 public void RegionLoaded(Scene scene) 93 public void RegionLoaded(Scene scene)
94 { 94 {
95 } 95 }
96 96
97 //////////////////////////////////////////////////////////// 97 ////////////////////////////////////////////////////////////
98 // IImprovedAssetCache 98 // IImprovedAssetCache
99 // 99 //
100 100
101 public void Cache(AssetBase asset) 101 public void Cache(AssetBase asset)
102 { 102 {
103 if (asset != null) 103 if (asset != null)
104 m_Cache.AddOrUpdate(asset.ID, asset); 104 m_Cache.AddOrUpdate(asset.ID, asset);
105 } 105 }
106 106
107 public AssetBase Get(string id) 107 public AssetBase Get(string id)
108 { 108 {
109 Object asset = null; 109 Object asset = null;
110 m_Cache.TryGet(id, out asset); 110 m_Cache.TryGet(id, out asset);
111 return (AssetBase)asset; 111 return (AssetBase)asset;
112 } 112 }
113 113
114 public void Expire(string id) 114 public void Expire(string id)
115 { 115 {
116 Object asset = null; 116 Object asset = null;
117 if (m_Cache.TryGet(id, out asset)) 117 if (m_Cache.TryGet(id, out asset))
118 m_Cache.Remove(id); 118 m_Cache.Remove(id);
119 } 119 }
120 120
121 public void Clear() 121 public void Clear()
122 { 122 {
123 m_Cache.Clear(); 123 m_Cache.Clear();
124 } 124 }
125 } 125 }
126} 126}
diff --git a/OpenSim/Server/Handlers/Tests/Asset/AssetServerGetHandlerTests.cs b/OpenSim/Server/Handlers/Tests/Asset/AssetServerGetHandlerTests.cs
index 3636972..d79192e 100644
--- a/OpenSim/Server/Handlers/Tests/Asset/AssetServerGetHandlerTests.cs
+++ b/OpenSim/Server/Handlers/Tests/Asset/AssetServerGetHandlerTests.cs
@@ -1,103 +1,103 @@
1using NUnit.Framework; 1using NUnit.Framework;
2using OpenSim.Framework; 2using OpenSim.Framework;
3using OpenSim.Framework.Servers.HttpServer; 3using OpenSim.Framework.Servers.HttpServer;
4using OpenSim.Server.Handlers.Asset; 4using OpenSim.Server.Handlers.Asset;
5using OpenSim.Services.Interfaces; 5using OpenSim.Services.Interfaces;
6using OpenSim.Tests.Common; 6using OpenSim.Tests.Common;
7using OpenSim.Tests.Common.Mock; 7using OpenSim.Tests.Common.Mock;
8using OpenSim.Tests.Common.Setup; 8using OpenSim.Tests.Common.Setup;
9 9
10namespace OpenSim.Server.Handlers.Tests.Asset 10namespace OpenSim.Server.Handlers.Tests.Asset
11{ 11{
12 [TestFixture] 12 [TestFixture]
13 public class AssetServerGetHandlerTests 13 public class AssetServerGetHandlerTests
14 { 14 {
15 private const string ASSETS_PATH = "/assets"; 15 private const string ASSETS_PATH = "/assets";
16 16
17 [Test] 17 [Test]
18 public void TestConstructor() 18 public void TestConstructor()
19 { 19 {
20 TestHelper.InMethod(); 20 TestHelper.InMethod();
21 21
22 AssetServerGetHandler handler = new AssetServerGetHandler( null ); 22 AssetServerGetHandler handler = new AssetServerGetHandler( null );
23 } 23 }
24 24
25 [Test] 25 [Test]
26 public void TestGetParams() 26 public void TestGetParams()
27 { 27 {
28 TestHelper.InMethod(); 28 TestHelper.InMethod();
29 29
30 AssetServerGetHandler handler = new AssetServerGetHandler(null); 30 AssetServerGetHandler handler = new AssetServerGetHandler(null);
31 BaseRequestHandlerTestHelper.BaseTestGetParams(handler, ASSETS_PATH); 31 BaseRequestHandlerTestHelper.BaseTestGetParams(handler, ASSETS_PATH);
32 } 32 }
33 33
34 [Test] 34 [Test]
35 public void TestSplitParams() 35 public void TestSplitParams()
36 { 36 {
37 TestHelper.InMethod(); 37 TestHelper.InMethod();
38 38
39 AssetServerGetHandler handler = new AssetServerGetHandler(null); 39 AssetServerGetHandler handler = new AssetServerGetHandler(null);
40 BaseRequestHandlerTestHelper.BaseTestSplitParams(handler, ASSETS_PATH); 40 BaseRequestHandlerTestHelper.BaseTestSplitParams(handler, ASSETS_PATH);
41 } 41 }
42 42
43 //[Test] 43 //[Test]
44 //public void TestHandleNoParams() 44 //public void TestHandleNoParams()
45 //{ 45 //{
46 // TestHelper.InMethod(); 46 // TestHelper.InMethod();
47 47
48 // AssetServerGetHandler handler = new AssetServerGetHandler(null); 48 // AssetServerGetHandler handler = new AssetServerGetHandler(null);
49 49
50 // BaseRequestHandlerTestHelper.BaseTestHandleNoParams(handler, ASSETS_PATH); 50 // BaseRequestHandlerTestHelper.BaseTestHandleNoParams(handler, ASSETS_PATH);
51 //} 51 //}
52 52
53 //[Test] 53 //[Test]
54 //public void TestHandleMalformedGuid() 54 //public void TestHandleMalformedGuid()
55 //{ 55 //{
56 // TestHelper.InMethod(); 56 // TestHelper.InMethod();
57 57
58 // AssetServerGetHandler handler = new AssetServerGetHandler(null); 58 // AssetServerGetHandler handler = new AssetServerGetHandler(null);
59 59
60 // BaseRequestHandlerTestHelper.BaseTestHandleMalformedGuid(handler, ASSETS_PATH); 60 // BaseRequestHandlerTestHelper.BaseTestHandleMalformedGuid(handler, ASSETS_PATH);
61 //} 61 //}
62 62
63 //[Test] 63 //[Test]
64 //public void TestHandleFetchMissingAsset() 64 //public void TestHandleFetchMissingAsset()
65 //{ 65 //{
66 // IAssetService assetDataPlugin = new TestAssetDataPlugin(); 66 // IAssetService assetDataPlugin = new TestAssetDataPlugin();
67 // AssetServerGetHandler handler = new AssetServerGetHandler(assetDataPlugin); 67 // AssetServerGetHandler handler = new AssetServerGetHandler(assetDataPlugin);
68 68
69 // GetAssetStreamHandlerTestHelpers.BaseFetchMissingAsset(handler); 69 // GetAssetStreamHandlerTestHelpers.BaseFetchMissingAsset(handler);
70 //} 70 //}
71 71
72 //[Test] 72 //[Test]
73 //public void TestHandleFetchExistingAssetData() 73 //public void TestHandleFetchExistingAssetData()
74 //{ 74 //{
75 // AssetServerGetHandler handler; 75 // AssetServerGetHandler handler;
76 // OSHttpResponse response; 76 // OSHttpResponse response;
77 // AssetBase asset = CreateTestEnvironment(out handler, out response); 77 // AssetBase asset = CreateTestEnvironment(out handler, out response);
78 78
79 // GetAssetStreamHandlerTestHelpers.BaseFetchExistingAssetDataTest(asset, handler, response); 79 // GetAssetStreamHandlerTestHelpers.BaseFetchExistingAssetDataTest(asset, handler, response);
80 //} 80 //}
81 81
82 //[Test] 82 //[Test]
83 //public void TestHandleFetchExistingAssetXml() 83 //public void TestHandleFetchExistingAssetXml()
84 //{ 84 //{
85 // AssetServerGetHandler handler; 85 // AssetServerGetHandler handler;
86 // OSHttpResponse response; 86 // OSHttpResponse response;
87 // AssetBase asset = CreateTestEnvironment(out handler, out response); 87 // AssetBase asset = CreateTestEnvironment(out handler, out response);
88 88
89 // GetAssetStreamHandlerTestHelpers.BaseFetchExistingAssetXmlTest(asset, handler, response); 89 // GetAssetStreamHandlerTestHelpers.BaseFetchExistingAssetXmlTest(asset, handler, response);
90 //} 90 //}
91 91
92 private static AssetBase CreateTestEnvironment(out AssetServerGetHandler handler, out OSHttpResponse response) 92 private static AssetBase CreateTestEnvironment(out AssetServerGetHandler handler, out OSHttpResponse response)
93 { 93 {
94 AssetBase asset = GetAssetStreamHandlerTestHelpers.CreateCommonTestResources(out response); 94 AssetBase asset = GetAssetStreamHandlerTestHelpers.CreateCommonTestResources(out response);
95 95
96 IAssetService assetDataPlugin = new TestAssetService(); 96 IAssetService assetDataPlugin = new TestAssetService();
97 handler = new AssetServerGetHandler(assetDataPlugin); 97 handler = new AssetServerGetHandler(assetDataPlugin);
98 98
99 assetDataPlugin.Store(asset); 99 assetDataPlugin.Store(asset);
100 return asset; 100 return asset;
101 } 101 }
102 } 102 }
103} \ No newline at end of file 103} \ No newline at end of file
diff --git a/OpenSim/SimulatorServices/SimulationService.cs b/OpenSim/SimulatorServices/SimulationService.cs
index bca51b3..a28e72f 100644
--- a/OpenSim/SimulatorServices/SimulationService.cs
+++ b/OpenSim/SimulatorServices/SimulationService.cs
@@ -1,85 +1,85 @@
1using System; 1using System;
2using System.Reflection; 2using System.Reflection;
3using System.Collections.Generic; 3using System.Collections.Generic;
4using log4net; 4using log4net;
5using Nini.Config; 5using Nini.Config;
6using OpenSim.Framework; 6using OpenSim.Framework;
7using OpenSim.Framework.Servers.HttpServer; 7using OpenSim.Framework.Servers.HttpServer;
8using OpenSim.Region.Framework.Scenes; 8using OpenSim.Region.Framework.Scenes;
9using OpenSim.Region.Framework.Interfaces; 9using OpenSim.Region.Framework.Interfaces;
10using OpenSim.Server.Base; 10using OpenSim.Server.Base;
11using OpenSim.Server.Handlers.Base; 11using OpenSim.Server.Handlers.Base;
12 12
13 13
14namespace OpenSim.SimulatorServices 14namespace OpenSim.SimulatorServices
15{ 15{
16 public class SimulationService : ISharedRegionModule 16 public class SimulationService : ISharedRegionModule
17 { 17 {
18 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 18 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
19 private static bool m_Enabled = false; 19 private static bool m_Enabled = false;
20 20
21 private IConfigSource m_Config; 21 private IConfigSource m_Config;
22 bool m_Registered = false; 22 bool m_Registered = false;
23 23
24 #region IRegionModule interface 24 #region IRegionModule interface
25 25
26 public void Initialise(IConfigSource config) 26 public void Initialise(IConfigSource config)
27 { 27 {
28 m_Config = config; 28 m_Config = config;
29 29
30 IConfig moduleConfig = config.Configs["Modules"]; 30 IConfig moduleConfig = config.Configs["Modules"];
31 if (moduleConfig != null) 31 if (moduleConfig != null)
32 { 32 {
33 string name = moduleConfig.GetString("SimulationService", ""); 33 string name = moduleConfig.GetString("SimulationService", "");
34 if (name == Name) 34 if (name == Name)
35 { 35 {
36 m_Enabled = true; 36 m_Enabled = true;
37 m_log.Info("[SIM SERVICE]: SimulationService enabled"); 37 m_log.Info("[SIM SERVICE]: SimulationService enabled");
38 38
39 } 39 }
40 } 40 }
41 41
42 } 42 }
43 43
44 public void PostInitialise() 44 public void PostInitialise()
45 { 45 {
46 } 46 }
47 47
48 public void Close() 48 public void Close()
49 { 49 {
50 } 50 }
51 51
52 public string Name 52 public string Name
53 { 53 {
54 get { return "SimulationService"; } 54 get { return "SimulationService"; }
55 } 55 }
56 56
57 public void AddRegion(Scene scene) 57 public void AddRegion(Scene scene)
58 { 58 {
59 if (!m_Enabled) 59 if (!m_Enabled)
60 return; 60 return;
61 61
62 if (!m_Registered) 62 if (!m_Registered)
63 { 63 {
64 m_Registered = true; 64 m_Registered = true;
65 65
66 m_log.Info("[SIM SERVICE]: Starting..."); 66 m_log.Info("[SIM SERVICE]: Starting...");
67 67
68 Object[] args = new Object[] { m_Config, scene.CommsManager.HttpServer, scene }; 68 Object[] args = new Object[] { m_Config, scene.CommsManager.HttpServer, scene };
69 69
70 ServerUtils.LoadPlugin<IServiceConnector>("OpenSim.Server.Handlers.dll:SimulationServiceInConnector", args); 70 ServerUtils.LoadPlugin<IServiceConnector>("OpenSim.Server.Handlers.dll:SimulationServiceInConnector", args);
71 } 71 }
72 } 72 }
73 73
74 public void RemoveRegion(Scene scene) 74 public void RemoveRegion(Scene scene)
75 { 75 {
76 } 76 }
77 77
78 public void RegionLoaded(Scene scene) 78 public void RegionLoaded(Scene scene)
79 { 79 {
80 } 80 }
81 81
82 #endregion 82 #endregion
83 83
84 } 84 }
85} 85}