remove pointless mock user account service since the real one can now be easily configured for test purposes

soprefactor
Justin Clark-Casey (justincc) 2010-06-04 20:56:24 +01:00
parent f319d2ef5e
commit df2bcf7b6b
4 changed files with 8 additions and 61 deletions

View File

@ -84,7 +84,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
InventoryArchiverModule archiverModule = new InventoryArchiverModule(true); InventoryArchiverModule archiverModule = new InventoryArchiverModule(true);
Scene scene = SceneSetupHelpers.SetupScene("Inventory, useraccounts"); Scene scene = SceneSetupHelpers.SetupScene("Inventory");
SceneSetupHelpers.SetupSceneModules(scene, archiverModule); SceneSetupHelpers.SetupSceneModules(scene, archiverModule);
// Create user // Create user

View File

@ -69,7 +69,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
SerialiserModule serialiserModule = new SerialiserModule(); SerialiserModule serialiserModule = new SerialiserModule();
TerrainModule terrainModule = new TerrainModule(); TerrainModule terrainModule = new TerrainModule();
m_scene = SceneSetupHelpers.SetupScene("useraccounts"); m_scene = SceneSetupHelpers.SetupScene();
SceneSetupHelpers.SetupSceneModules(m_scene, m_archiverModule, serialiserModule, terrainModule); SceneSetupHelpers.SetupSceneModules(m_scene, m_archiverModule, serialiserModule, terrainModule);
} }

View File

@ -1,46 +0,0 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System.Collections.Generic;
using Nini.Config;
using OpenMetaverse;
using OpenSim.Services.Interfaces;
namespace OpenSim.Tests.Common.Mock
{
public class MockUserAccountService : IUserAccountService
{
public MockUserAccountService(IConfigSource config) {}
public UserAccount GetUserAccount(UUID scopeID, UUID userID) { return new UserAccount(); }
public UserAccount GetUserAccount(UUID scopeID, string FirstName, string LastName) { return new UserAccount(); }
public UserAccount GetUserAccount(UUID scopeID, string Email) { return new UserAccount(); }
public List<UserAccount> GetUserAccounts(UUID scopeID, string query) { return new List<UserAccount>(); }
public bool StoreUserAccount(UserAccount data) { return true; }
}
}

View File

@ -191,7 +191,7 @@ namespace OpenSim.Tests.Common.Setup
if (realServices.Contains("grid")) if (realServices.Contains("grid"))
StartGridService(testScene, true); StartGridService(testScene, true);
StartUserAccountService(testScene, realServices.Contains("useraccounts")); StartUserAccountService(testScene);
} }
// If not, make sure the shared module gets references to this new scene // If not, make sure the shared module gets references to this new scene
else else
@ -311,24 +311,18 @@ namespace OpenSim.Tests.Common.Setup
} }
/// <summary> /// <summary>
/// Start a user account service, whether real or mock /// Start a user account service
/// </summary> /// </summary>
/// <param name="testScene"></param> /// <param name="testScene"></param>
/// <param name="real">Starts a real service if true, a mock service if not</param> private static void StartUserAccountService(Scene testScene)
private static void StartUserAccountService(Scene testScene, bool real)
{ {
IConfigSource config = new IniConfigSource(); IConfigSource config = new IniConfigSource();
config.AddConfig("Modules"); config.AddConfig("Modules");
config.AddConfig("UserAccountService"); config.AddConfig("UserAccountService");
config.Configs["Modules"].Set("UserAccountServices", "LocalUserAccountServicesConnector"); config.Configs["Modules"].Set("UserAccountServices", "LocalUserAccountServicesConnector");
config.Configs["UserAccountService"].Set("StorageProvider", "OpenSim.Data.Null.dll"); config.Configs["UserAccountService"].Set("StorageProvider", "OpenSim.Data.Null.dll");
if (real)
config.Configs["UserAccountService"].Set( config.Configs["UserAccountService"].Set(
"LocalServiceModule", "OpenSim.Services.UserAccountService.dll:UserAccountService"); "LocalServiceModule", "OpenSim.Services.UserAccountService.dll:UserAccountService");
else
config.Configs["UserAccountService"].Set(
"LocalServiceModule", "OpenSim.Tests.Common.dll:MockUserAccountService");
if (m_userAccountService == null) if (m_userAccountService == null)
{ {
@ -336,8 +330,7 @@ namespace OpenSim.Tests.Common.Setup
userAccountService.Initialise(config); userAccountService.Initialise(config);
m_userAccountService = userAccountService; m_userAccountService = userAccountService;
} }
//else
// config.Configs["GridService"].Set("LocalServiceModule", "OpenSim.Tests.Common.dll:TestGridService");
m_userAccountService.AddRegion(testScene); m_userAccountService.AddRegion(testScene);
m_userAccountService.RegionLoaded(testScene); m_userAccountService.RegionLoaded(testScene);
testScene.AddRegionModule(m_userAccountService.Name, m_userAccountService); testScene.AddRegionModule(m_userAccountService.Name, m_userAccountService);