From 57141e34bf415861a8acfdaa0086e0e651c679d9 Mon Sep 17 00:00:00 2001 From: Mic Bowman Date: Mon, 10 Jun 2013 13:26:19 -0700 Subject: Remove Temporary from use to shortcut asset stores. The Local property differentiates between local & grid storage. The Temporary property just says that which service handles the it, the asset can be safely removed in the future. --- OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs | 2 +- .../ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/CoreModules/ServiceConnectorsOut') diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs index d221d68..9f58175 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs @@ -322,7 +322,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset // a copy of the local asset. m_Cache.Cache(asset); - if (asset.Temporary || asset.Local) + if (asset.Local) { if (m_Cache != null) m_Cache.Cache(asset); diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs index 480cd69..52b1039 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs @@ -258,7 +258,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset if (m_Cache != null) m_Cache.Cache(asset); - if (asset.Temporary || asset.Local) + if (asset.Local) { // m_log.DebugFormat( // "[LOCAL ASSET SERVICE CONNECTOR]: Returning asset {0} {1} without querying database since status Temporary = {2}, Local = {3}", -- cgit v1.1 From 82e3b9a6e0f0e1731df9080e4de63bc7c7079ec4 Mon Sep 17 00:00:00 2001 From: Mic Bowman Date: Mon, 10 Jun 2013 15:14:55 -0700 Subject: Fix test for adding temporary assets. Code for non-local temporary assets is there but commented out. --- .../Asset/Tests/AssetConnectorTests.cs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'OpenSim/Region/CoreModules/ServiceConnectorsOut') diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/Tests/AssetConnectorTests.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/Tests/AssetConnectorTests.cs index 1982473..7073433 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/Tests/AssetConnectorTests.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/Tests/AssetConnectorTests.cs @@ -93,7 +93,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset.Tests 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); @@ -102,6 +104,24 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset.Tests Assert.That(lasc.GetData(a1.ID), Is.Null); Assert.That(lasc.GetMetadata(a1.ID), Is.Null); + // If it is remote, it should be stored + // AssetBase a2 = AssetHelpers.CreateNotecardAsset(); + // a2.Local = false; + // a2.Temporary = true; + + // lasc.Store(a2); + + // AssetBase retreivedA2 = lasc.Get(a2.ID); + // Assert.That(retreivedA2.ID, Is.EqualTo(a2.ID)); + // Assert.That(retreivedA2.Metadata.ID, Is.EqualTo(a2.Metadata.ID)); + // Assert.That(retreivedA2.Data.Length, Is.EqualTo(a2.Data.Length)); + + // AssetMetadata retrievedA2Metadata = lasc.GetMetadata(a2.ID); + // Assert.That(retrievedA2Metadata.ID, Is.EqualTo(a2.ID)); + + // byte[] retrievedA2Data = lasc.GetData(a2.ID); + // Assert.That(retrievedA2Data.Length, Is.EqualTo(a2.Data.Length)); + // TODO: Add cache and check that this does receive a copy of the asset } -- cgit v1.1