aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2013-06-11 23:55:45 +0100
committerJustin Clark-Casey (justincc)2013-06-11 23:55:45 +0100
commit135e10ba09a527d14a2fea0c6398757ce450c9fa (patch)
treee283e82ca9f995c74734967e26814f501d30e408
parentRemoved the lock entirely (diff)
downloadopensim-SC_OLD-135e10ba09a527d14a2fea0c6398757ce450c9fa.zip
opensim-SC_OLD-135e10ba09a527d14a2fea0c6398757ce450c9fa.tar.gz
opensim-SC_OLD-135e10ba09a527d14a2fea0c6398757ce450c9fa.tar.bz2
opensim-SC_OLD-135e10ba09a527d14a2fea0c6398757ce450c9fa.tar.xz
Uncomment Mic's code and split to create new regression TestAddTemporaryAsset() and TestAddTemporaryLocalAsset()
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/Tests/AssetConnectorTests.cs64
1 files changed, 41 insertions, 23 deletions
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/Tests/AssetConnectorTests.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/Tests/AssetConnectorTests.cs
index 7073433..4f75191 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/Tests/AssetConnectorTests.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/Tests/AssetConnectorTests.cs
@@ -42,7 +42,7 @@ using OpenSim.Tests.Common;
42namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset.Tests 42namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset.Tests
43{ 43{
44 [TestFixture] 44 [TestFixture]
45 public class AssetConnectorsTests : OpenSimTestCase 45 public class AssetConnectorTests : OpenSimTestCase
46 { 46 {
47 [Test] 47 [Test]
48 public void TestAddAsset() 48 public void TestAddAsset()
@@ -77,7 +77,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset.Tests
77 // TODO: Add cache and check that this does receive a copy of the asset 77 // TODO: Add cache and check that this does receive a copy of the asset
78 } 78 }
79 79
80 [Test]
81 public void TestAddTemporaryAsset() 80 public void TestAddTemporaryAsset()
82 { 81 {
83 TestHelpers.InMethod(); 82 TestHelpers.InMethod();
@@ -93,10 +92,45 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset.Tests
93 LocalAssetServicesConnector lasc = new LocalAssetServicesConnector(); 92 LocalAssetServicesConnector lasc = new LocalAssetServicesConnector();
94 lasc.Initialise(config); 93 lasc.Initialise(config);
95 94
96 // If it is local, it should not be stored 95 // If it is remote, it should be stored
96 AssetBase a2 = AssetHelpers.CreateNotecardAsset();
97 a2.Local = false;
98 a2.Temporary = true;
99
100 lasc.Store(a2);
101
102 AssetBase retreivedA2 = lasc.Get(a2.ID);
103 Assert.That(retreivedA2.ID, Is.EqualTo(a2.ID));
104 Assert.That(retreivedA2.Metadata.ID, Is.EqualTo(a2.Metadata.ID));
105 Assert.That(retreivedA2.Data.Length, Is.EqualTo(a2.Data.Length));
106
107 AssetMetadata retrievedA2Metadata = lasc.GetMetadata(a2.ID);
108 Assert.That(retrievedA2Metadata.ID, Is.EqualTo(a2.ID));
109
110 byte[] retrievedA2Data = lasc.GetData(a2.ID);
111 Assert.That(retrievedA2Data.Length, Is.EqualTo(a2.Data.Length));
112
113 // TODO: Add cache and check that this does receive a copy of the asset
114 }
115
116 [Test]
117 public void TestAddLocalAsset()
118 {
119 TestHelpers.InMethod();
120// TestHelpers.EnableLogging();
121
122 IConfigSource config = new IniConfigSource();
123 config.AddConfig("Modules");
124 config.Configs["Modules"].Set("AssetServices", "LocalAssetServicesConnector");
125 config.AddConfig("AssetService");
126 config.Configs["AssetService"].Set("LocalServiceModule", "OpenSim.Services.AssetService.dll:AssetService");
127 config.Configs["AssetService"].Set("StorageProvider", "OpenSim.Tests.Common.dll");
128
129 LocalAssetServicesConnector lasc = new LocalAssetServicesConnector();
130 lasc.Initialise(config);
131
97 AssetBase a1 = AssetHelpers.CreateNotecardAsset(); 132 AssetBase a1 = AssetHelpers.CreateNotecardAsset();
98 a1.Local = true; 133 a1.Local = true;
99 a1.Temporary = true;
100 134
101 lasc.Store(a1); 135 lasc.Store(a1);
102 136
@@ -104,29 +138,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset.Tests
104 Assert.That(lasc.GetData(a1.ID), Is.Null); 138 Assert.That(lasc.GetData(a1.ID), Is.Null);
105 Assert.That(lasc.GetMetadata(a1.ID), Is.Null); 139 Assert.That(lasc.GetMetadata(a1.ID), Is.Null);
106 140
107 // If it is remote, it should be stored
108 // AssetBase a2 = AssetHelpers.CreateNotecardAsset();
109 // a2.Local = false;
110 // a2.Temporary = true;
111
112 // lasc.Store(a2);
113
114 // AssetBase retreivedA2 = lasc.Get(a2.ID);
115 // Assert.That(retreivedA2.ID, Is.EqualTo(a2.ID));
116 // Assert.That(retreivedA2.Metadata.ID, Is.EqualTo(a2.Metadata.ID));
117 // Assert.That(retreivedA2.Data.Length, Is.EqualTo(a2.Data.Length));
118
119 // AssetMetadata retrievedA2Metadata = lasc.GetMetadata(a2.ID);
120 // Assert.That(retrievedA2Metadata.ID, Is.EqualTo(a2.ID));
121
122 // byte[] retrievedA2Data = lasc.GetData(a2.ID);
123 // Assert.That(retrievedA2Data.Length, Is.EqualTo(a2.Data.Length));
124
125 // TODO: Add cache and check that this does receive a copy of the asset 141 // TODO: Add cache and check that this does receive a copy of the asset
126 } 142 }
127 143
128 [Test] 144 [Test]
129 public void TestAddLocalAsset() 145 public void TestAddTemporaryLocalAsset()
130 { 146 {
131 TestHelpers.InMethod(); 147 TestHelpers.InMethod();
132// TestHelpers.EnableLogging(); 148// TestHelpers.EnableLogging();
@@ -141,8 +157,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset.Tests
141 LocalAssetServicesConnector lasc = new LocalAssetServicesConnector(); 157 LocalAssetServicesConnector lasc = new LocalAssetServicesConnector();
142 lasc.Initialise(config); 158 lasc.Initialise(config);
143 159
160 // If it is local, it should not be stored
144 AssetBase a1 = AssetHelpers.CreateNotecardAsset(); 161 AssetBase a1 = AssetHelpers.CreateNotecardAsset();
145 a1.Local = true; 162 a1.Local = true;
163 a1.Temporary = true;
146 164
147 lasc.Store(a1); 165 lasc.Store(a1);
148 166