Uncomment Mic's code and split to create new regression TestAddTemporaryAsset() and TestAddTemporaryLocalAsset()

cpu-performance
Justin Clark-Casey (justincc) 2013-06-11 23:55:45 +01:00
parent d8da83b4ff
commit 135e10ba09
1 changed files with 43 additions and 25 deletions

View File

@ -42,7 +42,7 @@ using OpenSim.Tests.Common;
namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset.Tests namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset.Tests
{ {
[TestFixture] [TestFixture]
public class AssetConnectorsTests : OpenSimTestCase public class AssetConnectorTests : OpenSimTestCase
{ {
[Test] [Test]
public void TestAddAsset() public void TestAddAsset()
@ -77,7 +77,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset.Tests
// TODO: Add cache and check that this does receive a copy of the asset // TODO: Add cache and check that this does receive a copy of the asset
} }
[Test]
public void TestAddTemporaryAsset() public void TestAddTemporaryAsset()
{ {
TestHelpers.InMethod(); TestHelpers.InMethod();
@ -93,34 +92,23 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset.Tests
LocalAssetServicesConnector lasc = new LocalAssetServicesConnector(); LocalAssetServicesConnector lasc = new LocalAssetServicesConnector();
lasc.Initialise(config); lasc.Initialise(config);
// If it is local, it should not be stored
AssetBase a1 = AssetHelpers.CreateNotecardAsset();
a1.Local = true;
a1.Temporary = true;
lasc.Store(a1);
Assert.That(lasc.Get(a1.ID), Is.Null);
Assert.That(lasc.GetData(a1.ID), Is.Null);
Assert.That(lasc.GetMetadata(a1.ID), Is.Null);
// If it is remote, it should be stored // If it is remote, it should be stored
// AssetBase a2 = AssetHelpers.CreateNotecardAsset(); AssetBase a2 = AssetHelpers.CreateNotecardAsset();
// a2.Local = false; a2.Local = false;
// a2.Temporary = true; a2.Temporary = true;
// lasc.Store(a2); lasc.Store(a2);
// AssetBase retreivedA2 = lasc.Get(a2.ID); AssetBase retreivedA2 = lasc.Get(a2.ID);
// Assert.That(retreivedA2.ID, Is.EqualTo(a2.ID)); Assert.That(retreivedA2.ID, Is.EqualTo(a2.ID));
// Assert.That(retreivedA2.Metadata.ID, Is.EqualTo(a2.Metadata.ID)); Assert.That(retreivedA2.Metadata.ID, Is.EqualTo(a2.Metadata.ID));
// Assert.That(retreivedA2.Data.Length, Is.EqualTo(a2.Data.Length)); Assert.That(retreivedA2.Data.Length, Is.EqualTo(a2.Data.Length));
// AssetMetadata retrievedA2Metadata = lasc.GetMetadata(a2.ID); AssetMetadata retrievedA2Metadata = lasc.GetMetadata(a2.ID);
// Assert.That(retrievedA2Metadata.ID, Is.EqualTo(a2.ID)); Assert.That(retrievedA2Metadata.ID, Is.EqualTo(a2.ID));
// byte[] retrievedA2Data = lasc.GetData(a2.ID); byte[] retrievedA2Data = lasc.GetData(a2.ID);
// Assert.That(retrievedA2Data.Length, Is.EqualTo(a2.Data.Length)); Assert.That(retrievedA2Data.Length, Is.EqualTo(a2.Data.Length));
// TODO: Add cache and check that this does receive a copy of the asset // TODO: Add cache and check that this does receive a copy of the asset
} }
@ -152,5 +140,35 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset.Tests
// TODO: Add cache and check that this does receive a copy of the asset // TODO: Add cache and check that this does receive a copy of the asset
} }
[Test]
public void TestAddTemporaryLocalAsset()
{
TestHelpers.InMethod();
// TestHelpers.EnableLogging();
IConfigSource config = new IniConfigSource();
config.AddConfig("Modules");
config.Configs["Modules"].Set("AssetServices", "LocalAssetServicesConnector");
config.AddConfig("AssetService");
config.Configs["AssetService"].Set("LocalServiceModule", "OpenSim.Services.AssetService.dll:AssetService");
config.Configs["AssetService"].Set("StorageProvider", "OpenSim.Tests.Common.dll");
LocalAssetServicesConnector lasc = new LocalAssetServicesConnector();
lasc.Initialise(config);
// If it is local, it should not be stored
AssetBase a1 = AssetHelpers.CreateNotecardAsset();
a1.Local = true;
a1.Temporary = true;
lasc.Store(a1);
Assert.That(lasc.Get(a1.ID), Is.Null);
Assert.That(lasc.GetData(a1.ID), Is.Null);
Assert.That(lasc.GetMetadata(a1.ID), Is.Null);
// TODO: Add cache and check that this does receive a copy of the asset
}
} }
} }