aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/LocalUserAccountServiceConnector.cs18
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs13
-rw-r--r--OpenSim/Server/Base/ServerUtils.cs40
-rw-r--r--OpenSim/Services/Interfaces/IUserAccountService.cs20
-rw-r--r--OpenSim/Tests/Common/Mock/MockUserAccountService.cs45
-rw-r--r--OpenSim/Tests/Common/Mock/TestScene.cs4
-rw-r--r--OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs34
7 files changed, 120 insertions, 54 deletions
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/LocalUserAccountServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/LocalUserAccountServiceConnector.cs
index ce0ca40..30ebb21 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/LocalUserAccountServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/LocalUserAccountServiceConnector.cs
@@ -73,33 +73,31 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts
73 IConfig userConfig = source.Configs["UserAccountService"]; 73 IConfig userConfig = source.Configs["UserAccountService"];
74 if (userConfig == null) 74 if (userConfig == null)
75 { 75 {
76 m_log.Error("[USER CONNECTOR]: UserAccountService missing from OpenSim.ini"); 76 m_log.Error("[LOCAL USER ACCOUNT SERVICE CONNECTOR]: UserAccountService missing from OpenSim.ini");
77 return; 77 return;
78 } 78 }
79 79
80 string serviceDll = userConfig.GetString("LocalServiceModule", 80 string serviceDll = userConfig.GetString("LocalServiceModule", String.Empty);
81 String.Empty);
82 81
83 if (serviceDll == String.Empty) 82 if (serviceDll == String.Empty)
84 { 83 {
85 m_log.Error("[USER CONNECTOR]: No LocalServiceModule named in section UserService"); 84 m_log.Error("[LOCAL USER ACCOUNT SERVICE CONNECTOR]: No LocalServiceModule named in section UserService");
86 return; 85 return;
87 } 86 }
88 87
89 Object[] args = new Object[] { source }; 88 Object[] args = new Object[] { source };
90 m_UserService = 89 m_UserService = ServerUtils.LoadPlugin<IUserAccountService>(serviceDll, args);
91 ServerUtils.LoadPlugin<IUserAccountService>(serviceDll,
92 args);
93 90
94 if (m_UserService == null) 91 if (m_UserService == null)
95 { 92 {
96 m_log.Error("[USER CONNECTOR]: Can't load user account service"); 93 m_log.ErrorFormat(
94 "[LOCAL USER ACCOUNT SERVICE CONNECTOR]: Cannot load user account service specified as {0}", serviceDll);
97 return; 95 return;
98 } 96 }
99 m_Enabled = true; 97 m_Enabled = true;
100 m_Cache = new UserAccountCache(); 98 m_Cache = new UserAccountCache();
101 99
102 m_log.Info("[USER CONNECTOR]: Local user connector enabled"); 100 m_log.Info("[LOCAL USER ACCOUNT SERVICE CONNECTOR]: Local user connector enabled");
103 } 101 }
104 } 102 }
105 } 103 }
@@ -134,6 +132,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts
134 { 132 {
135 if (!m_Enabled) 133 if (!m_Enabled)
136 return; 134 return;
135
136 m_log.InfoFormat("[LOCAL USER ACCOUNT SERVICE CONNECTOR]: Enabled local user accounts for region {0}", scene.RegionInfo.RegionName);
137 } 137 }
138 138
139 #endregion 139 #endregion
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs
index b50d4ca..78f2ae3 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs
@@ -86,6 +86,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
86 public void TestDeleteSceneObjectAsync() 86 public void TestDeleteSceneObjectAsync()
87 { 87 {
88 TestHelper.InMethod(); 88 TestHelper.InMethod();
89 //log4net.Config.XmlConfigurator.Configure();
89 90
90 UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000001"); 91 UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000001");
91 92
@@ -97,15 +98,9 @@ namespace OpenSim.Region.Framework.Scenes.Tests
97 98
98 SceneObjectPart part = SceneSetupHelpers.AddSceneObject(scene); 99 SceneObjectPart part = SceneSetupHelpers.AddSceneObject(scene);
99 100
100 try 101 IClientAPI client = SceneSetupHelpers.AddRootAgent(scene, agentId);
101 { 102 scene.DeRezObject(client, part.LocalId, UUID.Zero, DeRezAction.Delete, UUID.Zero);
102 IClientAPI client = SceneSetupHelpers.AddRootAgent(scene, agentId); 103
103 scene.DeRezObject(client, part.LocalId, UUID.Zero, DeRezAction.Delete, UUID.Zero);
104 }
105 catch (Exception e)
106 {
107 Console.WriteLine("Exception: " + e.StackTrace);
108 }
109 SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId); 104 SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId);
110 105
111 Assert.That(retrievedPart, Is.Not.Null); 106 Assert.That(retrievedPart, Is.Not.Null);
diff --git a/OpenSim/Server/Base/ServerUtils.cs b/OpenSim/Server/Base/ServerUtils.cs
index 9c54410..a399672 100644
--- a/OpenSim/Server/Base/ServerUtils.cs
+++ b/OpenSim/Server/Base/ServerUtils.cs
@@ -57,6 +57,12 @@ namespace OpenSim.Server.Base
57 return ret; 57 return ret;
58 } 58 }
59 59
60 /// <summary>
61 /// Load a plugin from a dll with the given class or interface
62 /// </summary>
63 /// <param name="dllName"></param>
64 /// <param name="args">The arguments which control which constructor is invoked on the plugin</param>
65 /// <returns></returns>
60 public static T LoadPlugin<T>(string dllName, Object[] args) where T:class 66 public static T LoadPlugin<T>(string dllName, Object[] args) where T:class
61 { 67 {
62 string[] parts = dllName.Split(new char[] {':'}); 68 string[] parts = dllName.Split(new char[] {':'});
@@ -71,6 +77,13 @@ namespace OpenSim.Server.Base
71 return LoadPlugin<T>(dllName, className, args); 77 return LoadPlugin<T>(dllName, className, args);
72 } 78 }
73 79
80 /// <summary>
81 /// Load a plugin from a dll with the given class or interface
82 /// </summary>
83 /// <param name="dllName"></param>
84 /// <param name="className"></param>
85 /// <param name="args">The arguments which control which constructor is invoked on the plugin</param>
86 /// <returns></returns>
74 public static T LoadPlugin<T>(string dllName, string className, Object[] args) where T:class 87 public static T LoadPlugin<T>(string dllName, string className, Object[] args) where T:class
75 { 88 {
76 string interfaceName = typeof(T).ToString(); 89 string interfaceName = typeof(T).ToString();
@@ -83,28 +96,15 @@ namespace OpenSim.Server.Base
83 { 96 {
84 if (pluginType.IsPublic) 97 if (pluginType.IsPublic)
85 { 98 {
86 if (className != String.Empty && 99 if (className != String.Empty
87 pluginType.ToString() != 100 && pluginType.ToString() != pluginType.Namespace + "." + className)
88 pluginType.Namespace + "." + className)
89 continue; 101 continue;
90 Type typeInterface = 102
91 pluginType.GetInterface(interfaceName, true); 103 Type typeInterface = pluginType.GetInterface(interfaceName, true);
104
92 if (typeInterface != null) 105 if (typeInterface != null)
93 { 106 {
94 T plug = null; 107 return (T)Activator.CreateInstance(pluginType, args);
95 try
96 {
97 plug = (T)Activator.CreateInstance(pluginType,
98 args);
99 }
100 catch (Exception e)
101 {
102 if (!(e is System.MissingMethodException))
103 m_log.ErrorFormat("Error loading plugin from {0}, exception {1}", dllName, e.InnerException);
104 return null;
105 }
106
107 return plug;
108 } 108 }
109 } 109 }
110 } 110 }
@@ -113,7 +113,7 @@ namespace OpenSim.Server.Base
113 } 113 }
114 catch (Exception e) 114 catch (Exception e)
115 { 115 {
116 m_log.ErrorFormat("Error loading plugin from {0}, exception {1}", dllName, e); 116 m_log.Error(string.Format("Error loading plugin from {0}", dllName), e);
117 return null; 117 return null;
118 } 118 }
119 } 119 }
diff --git a/OpenSim/Services/Interfaces/IUserAccountService.cs b/OpenSim/Services/Interfaces/IUserAccountService.cs
index 3dacf53..a45bf8c 100644
--- a/OpenSim/Services/Interfaces/IUserAccountService.cs
+++ b/OpenSim/Services/Interfaces/IUserAccountService.cs
@@ -140,14 +140,20 @@ namespace OpenSim.Services.Interfaces
140 UserAccount GetUserAccount(UUID scopeID, UUID userID); 140 UserAccount GetUserAccount(UUID scopeID, UUID userID);
141 UserAccount GetUserAccount(UUID scopeID, string FirstName, string LastName); 141 UserAccount GetUserAccount(UUID scopeID, string FirstName, string LastName);
142 UserAccount GetUserAccount(UUID scopeID, string Email); 142 UserAccount GetUserAccount(UUID scopeID, string Email);
143 // Returns the list of avatars that matches both the search 143
144 // criterion and the scope ID passed 144 /// <summary>
145 // 145 /// Returns the list of avatars that matches both the search criterion and the scope ID passed
146 /// </summary>
147 /// <param name="scopeID"></param>
148 /// <param name="query"></param>
149 /// <returns></returns>
146 List<UserAccount> GetUserAccounts(UUID scopeID, string query); 150 List<UserAccount> GetUserAccounts(UUID scopeID, string query);
147 151
148 // Store the data given, wich replaces the sotred data, therefore 152 /// <summary>
149 // must be complete. 153 /// Store the data given, wich replaces the sotred data, therefore must be complete.
150 // 154 /// </summary>
155 /// <param name="data"></param>
156 /// <returns></returns>
151 bool StoreUserAccount(UserAccount data); 157 bool StoreUserAccount(UserAccount data);
152 } 158 }
153} 159} \ No newline at end of file
diff --git a/OpenSim/Tests/Common/Mock/MockUserAccountService.cs b/OpenSim/Tests/Common/Mock/MockUserAccountService.cs
new file mode 100644
index 0000000..f5d758a
--- /dev/null
+++ b/OpenSim/Tests/Common/Mock/MockUserAccountService.cs
@@ -0,0 +1,45 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
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
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
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System.Collections.Generic;
29using Nini.Config;
30using OpenMetaverse;
31using OpenSim.Services.Interfaces;
32
33namespace OpenSim.Tests.Common.Mock
34{
35 public class MockUserAccountService : IUserAccountService
36 {
37 public MockUserAccountService(IConfigSource config) {}
38
39 public UserAccount GetUserAccount(UUID scopeID, UUID userID) { return new UserAccount(); }
40 public UserAccount GetUserAccount(UUID scopeID, string FirstName, string LastName) { return new UserAccount(); }
41 public UserAccount GetUserAccount(UUID scopeID, string Email) { return new UserAccount(); }
42 public List<UserAccount> GetUserAccounts(UUID scopeID, string query) { return new List<UserAccount>(); }
43 public bool StoreUserAccount(UserAccount data) { return true; }
44 }
45} \ No newline at end of file
diff --git a/OpenSim/Tests/Common/Mock/TestScene.cs b/OpenSim/Tests/Common/Mock/TestScene.cs
index 076cb7a..01f2c14 100644
--- a/OpenSim/Tests/Common/Mock/TestScene.cs
+++ b/OpenSim/Tests/Common/Mock/TestScene.cs
@@ -65,6 +65,6 @@ namespace OpenSim.Tests.Common.Mock
65 public AsyncSceneObjectGroupDeleter SceneObjectGroupDeleter 65 public AsyncSceneObjectGroupDeleter SceneObjectGroupDeleter
66 { 66 {
67 get { return m_asyncSceneObjectDeleter; } 67 get { return m_asyncSceneObjectDeleter; }
68 } 68 }
69 } 69 }
70} 70} \ No newline at end of file
diff --git a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs
index 9e718f6..ab3e7cb 100644
--- a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs
+++ b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs
@@ -128,7 +128,7 @@ namespace OpenSim.Tests.Common.Setup
128 /// <param name="realServices">Starts real inventory and asset services, as opposed to mock ones, if true</param> 128 /// <param name="realServices">Starts real inventory and asset services, as opposed to mock ones, if true</param>
129 /// <returns></returns> 129 /// <returns></returns>
130 public static TestScene SetupScene( 130 public static TestScene SetupScene(
131 string name, UUID id, uint x, uint y, String realServices) 131 string name, UUID id, uint x, uint y, String realServices)
132 { 132 {
133 bool newScene = false; 133 bool newScene = false;
134 134
@@ -179,15 +179,16 @@ namespace OpenSim.Tests.Common.Setup
179 StartAssetService(testScene, true); 179 StartAssetService(testScene, true);
180 else 180 else
181 StartAssetService(testScene, false); 181 StartAssetService(testScene, false);
182
182 if (realServices.Contains("inventory")) 183 if (realServices.Contains("inventory"))
183 StartInventoryService(testScene, true); 184 StartInventoryService(testScene, true);
184 else 185 else
185 StartInventoryService(testScene, false); 186 StartInventoryService(testScene, false);
187
186 if (realServices.Contains("grid")) 188 if (realServices.Contains("grid"))
187 StartGridService(testScene, true); 189 StartGridService(testScene, true);
188 if (realServices.Contains("useraccounts")) 190
189 StartUserAccountService(testScene, true); 191 StartUserAccountService(testScene, realServices.Contains("useraccounts"));
190
191 } 192 }
192 // If not, make sure the shared module gets references to this new scene 193 // If not, make sure the shared module gets references to this new scene
193 else 194 else
@@ -196,9 +197,13 @@ namespace OpenSim.Tests.Common.Setup
196 m_assetService.RegionLoaded(testScene); 197 m_assetService.RegionLoaded(testScene);
197 m_inventoryService.AddRegion(testScene); 198 m_inventoryService.AddRegion(testScene);
198 m_inventoryService.RegionLoaded(testScene); 199 m_inventoryService.RegionLoaded(testScene);
200 m_userAccountService.AddRegion(testScene);
201 m_userAccountService.RegionLoaded(testScene);
199 } 202 }
203
200 m_inventoryService.PostInitialise(); 204 m_inventoryService.PostInitialise();
201 m_assetService.PostInitialise(); 205 m_assetService.PostInitialise();
206 m_userAccountService.PostInitialise();
202 207
203 testScene.SetModuleInterfaces(); 208 testScene.SetModuleInterfaces();
204 209
@@ -209,6 +214,11 @@ namespace OpenSim.Tests.Common.Setup
209 physicsPluginManager.LoadPluginsFromAssembly("Physics/OpenSim.Region.Physics.BasicPhysicsPlugin.dll"); 214 physicsPluginManager.LoadPluginsFromAssembly("Physics/OpenSim.Region.Physics.BasicPhysicsPlugin.dll");
210 testScene.PhysicsScene 215 testScene.PhysicsScene
211 = physicsPluginManager.GetPhysicsScene("basicphysics", "ZeroMesher", new IniConfigSource(), "test"); 216 = physicsPluginManager.GetPhysicsScene("basicphysics", "ZeroMesher", new IniConfigSource(), "test");
217
218 m_assetService = null;
219 m_inventoryService = null;
220 m_gridService = null;
221 m_userAccountService = null;
212 222
213 return testScene; 223 return testScene;
214 } 224 }
@@ -273,6 +283,11 @@ namespace OpenSim.Tests.Common.Setup
273 //testScene.AddRegionModule(m_gridService.Name, m_gridService); 283 //testScene.AddRegionModule(m_gridService.Name, m_gridService);
274 } 284 }
275 285
286 /// <summary>
287 /// Start a user account service, whether real or mock
288 /// </summary>
289 /// <param name="testScene"></param>
290 /// <param name="real">Starts a real service if true, a mock service if not</param>
276 private static void StartUserAccountService(Scene testScene, bool real) 291 private static void StartUserAccountService(Scene testScene, bool real)
277 { 292 {
278 IConfigSource config = new IniConfigSource(); 293 IConfigSource config = new IniConfigSource();
@@ -280,8 +295,14 @@ namespace OpenSim.Tests.Common.Setup
280 config.AddConfig("UserAccountService"); 295 config.AddConfig("UserAccountService");
281 config.Configs["Modules"].Set("UserAccountServices", "LocalUserAccountServicesConnector"); 296 config.Configs["Modules"].Set("UserAccountServices", "LocalUserAccountServicesConnector");
282 config.Configs["UserAccountService"].Set("StorageProvider", "OpenSim.Data.Null.dll"); 297 config.Configs["UserAccountService"].Set("StorageProvider", "OpenSim.Data.Null.dll");
298
283 if (real) 299 if (real)
284 config.Configs["UserAccountService"].Set("LocalServiceModule", "OpenSim.Services.UserAccountService.dll:UserAccountService"); 300 config.Configs["UserAccountService"].Set(
301 "LocalServiceModule", "OpenSim.Services.UserAccountService.dll:UserAccountService");
302 else
303 config.Configs["UserAccountService"].Set(
304 "LocalServiceModule", "OpenSim.Tests.Common.dll:MockUserAccountService");
305
285 if (m_userAccountService == null) 306 if (m_userAccountService == null)
286 { 307 {
287 ISharedRegionModule userAccountService = new LocalUserAccountServicesConnector(); 308 ISharedRegionModule userAccountService = new LocalUserAccountServicesConnector();
@@ -292,10 +313,9 @@ namespace OpenSim.Tests.Common.Setup
292 // config.Configs["GridService"].Set("LocalServiceModule", "OpenSim.Tests.Common.dll:TestGridService"); 313 // config.Configs["GridService"].Set("LocalServiceModule", "OpenSim.Tests.Common.dll:TestGridService");
293 m_userAccountService.AddRegion(testScene); 314 m_userAccountService.AddRegion(testScene);
294 m_userAccountService.RegionLoaded(testScene); 315 m_userAccountService.RegionLoaded(testScene);
295 //testScene.AddRegionModule(m_gridService.Name, m_gridService); 316 testScene.AddRegionModule(m_userAccountService.Name, m_userAccountService);
296 } 317 }
297 318
298
299 /// <summary> 319 /// <summary>
300 /// Setup modules for a scene using their default settings. 320 /// Setup modules for a scene using their default settings.
301 /// </summary> 321 /// </summary>