* Added OpenSim.Server.Handlers.Tests project

* Added AssetServerGetHandlerTests - not really wired up yet; more to come.
* Ignored some gens
0.6.6-post-fixes
lbsa71 2009-05-27 11:54:17 +00:00
parent 7ab1986bf0
commit 892406248a
3 changed files with 144 additions and 5 deletions

View File

@ -32,6 +32,7 @@ using System.Xml;
using System.Xml.Serialization;
using System.Text;
using log4net;
using OpenSim.Framework;
namespace OpenSim.Server.Base
{
@ -92,7 +93,7 @@ namespace OpenSim.Server.Base
ms.Seek(0, SeekOrigin.Begin);
byte[] ret = ms.GetBuffer();
Array.Resize<byte>(ref ret, (int)ms.Length);
Array.Resize(ref ret, (int)ms.Length);
return ret;
}
@ -117,9 +118,6 @@ namespace OpenSim.Server.Base
try
{
//m_log.DebugFormat("[PLUGINS]: Loading plugins from {0}", System.IO.Directory.GetCurrentDirectory());
//m_log.DebugFormat("[PLUGINS]: Trying to load {0}", dllName);
Assembly pluginAssembly = Assembly.LoadFrom(dllName);
foreach (Type pluginType in pluginAssembly.GetTypes())

View File

@ -0,0 +1,103 @@
using NUnit.Framework;
using OpenSim.Framework;
using OpenSim.Framework.Servers.HttpServer;
using OpenSim.Server.Handlers.Asset;
using OpenSim.Services.Interfaces;
using OpenSim.Tests.Common;
using OpenSim.Tests.Common.Mock;
using OpenSim.Tests.Common.Setup;
namespace OpenSim.Server.Handlers.Tests.Asset
{
[TestFixture]
public class AssetServerGetHandlerTests
{
private const string ASSETS_PATH = "/assets";
[Test]
public void TestConstructor()
{
TestHelper.InMethod();
AssetServerGetHandler handler = new AssetServerGetHandler( null );
}
[Test]
public void TestGetParams()
{
TestHelper.InMethod();
AssetServerGetHandler handler = new AssetServerGetHandler(null);
BaseRequestHandlerTestHelper.BaseTestGetParams(handler, ASSETS_PATH);
}
[Test]
public void TestSplitParams()
{
TestHelper.InMethod();
AssetServerGetHandler handler = new AssetServerGetHandler(null);
BaseRequestHandlerTestHelper.BaseTestSplitParams(handler, ASSETS_PATH);
}
//[Test]
//public void TestHandleNoParams()
//{
// TestHelper.InMethod();
// AssetServerGetHandler handler = new AssetServerGetHandler(null);
// BaseRequestHandlerTestHelper.BaseTestHandleNoParams(handler, ASSETS_PATH);
//}
//[Test]
//public void TestHandleMalformedGuid()
//{
// TestHelper.InMethod();
// AssetServerGetHandler handler = new AssetServerGetHandler(null);
// BaseRequestHandlerTestHelper.BaseTestHandleMalformedGuid(handler, ASSETS_PATH);
//}
//[Test]
//public void TestHandleFetchMissingAsset()
//{
// IAssetService assetDataPlugin = new TestAssetDataPlugin();
// AssetServerGetHandler handler = new AssetServerGetHandler(assetDataPlugin);
// GetAssetStreamHandlerTestHelpers.BaseFetchMissingAsset(handler);
//}
//[Test]
//public void TestHandleFetchExistingAssetData()
//{
// AssetServerGetHandler handler;
// OSHttpResponse response;
// AssetBase asset = CreateTestEnvironment(out handler, out response);
// GetAssetStreamHandlerTestHelpers.BaseFetchExistingAssetDataTest(asset, handler, response);
//}
//[Test]
//public void TestHandleFetchExistingAssetXml()
//{
// AssetServerGetHandler handler;
// OSHttpResponse response;
// AssetBase asset = CreateTestEnvironment(out handler, out response);
// GetAssetStreamHandlerTestHelpers.BaseFetchExistingAssetXmlTest(asset, handler, response);
//}
private static AssetBase CreateTestEnvironment(out AssetServerGetHandler handler, out OSHttpResponse response)
{
AssetBase asset = GetAssetStreamHandlerTestHelpers.CreateCommonTestResources(out response);
IAssetService assetDataPlugin = new TestAssetService();
handler = new AssetServerGetHandler(assetDataPlugin);
assetDataPlugin.Store(asset);
return asset;
}
}
}

View File

@ -365,6 +365,7 @@
<Reference name="System"/>
<Reference name="System.Xml"/>
<Reference name="OpenSim.Data"/>
<Reference name="OpenSim.Servers.Base"/>
<Reference name="OpenSim.Framework"/>
<Reference name="OpenSim.Framework.Servers.HttpServer"/>
<Reference name="OpenSim.Framework.Console"/>
@ -1413,6 +1414,42 @@
<Reference name="Nini.dll" />
<Reference name="log4net.dll"/>
<Files>
<Match pattern="*.cs" recurse="true">
<Exclude pattern="Tests" />
</Match>
</Files>
</Project>
<Project name="OpenSim.Server.Handlers.Tests" path="OpenSim/Server/Handlers/Tests" type="Library">
<Configuration name="Debug">
<Options>
<OutputPath>../../../../bin/</OutputPath>
</Options>
</Configuration>
<Configuration name="Release">
<Options>
<OutputPath>../../../../bin/</OutputPath>
</Options>
</Configuration>
<ReferencePath>../../../../bin/</ReferencePath>
<Reference name="System"/>
<Reference name="System.Xml"/>
<Reference name="OpenMetaverseTypes.dll"/>
<Reference name="OpenMetaverse.dll"/>
<Reference name="nunit.framework.dll" />
<Reference name="OpenSim.Framework"/>
<Reference name="OpenSim.Framework.Console"/>
<Reference name="OpenSim.Framework.Servers.HttpServer"/>
<Reference name="OpenSim.Server.Handlers"/>
<Reference name="OpenSim.Server.Base"/>
<Reference name="OpenSim.Services.Base" />
<Reference name="OpenSim.Services.Interfaces"/>
<Reference name="OpenSim.Tests.Common"/>
<Reference name="Nini.dll" />
<Reference name="log4net.dll"/>
<Files>
<Match pattern="*.cs" recurse="true"/>
</Files>
@ -3220,6 +3257,7 @@
<Reference name="OpenSim.Framework.Servers.HttpServer"/>
<Reference name="OpenSim.Data"/>
<Reference name="OpenSim.Services.Interfaces"/>
<Reference name="OpenSim.Servers.Base"/>
<Reference name="OpenSim.Region.Communications.Local"/>
<Reference name="OpenSim.Region.Framework"/>
<Reference name="OpenSim.Region.CoreModules"/>