From f7d09b898ad6df32b3f07cb64657623980178c2f Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Thu, 27 Jun 2013 23:14:28 +0100
Subject: Make the concept of namespaces explicit in dynamic attributes
This is in order to reduce the likelihood of naming clashes, make it easier to filter in/out attributes, ensure uniformity, etc.
All dynattrs in the opensim distro itself or likely future ones should be in the "OpenSim" namespace.
This does alter the underlying dynattrs data structure. All data in previous structures may not be available, though old structures should not cause errors.
This is done without notice since this feature has been explicitly labelled as experimental, subject to change and has not been in a release.
However, existing materials data is being preserved by moving it to the "Materials" store in the "OpenSim" namespace.
---
.../World/Serialiser/Tests/SerialiserTests.cs | 44 ++++++++++++++++++----
1 file changed, 36 insertions(+), 8 deletions(-)
(limited to 'OpenSim/Region/CoreModules/World/Serialiser')
diff --git a/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs b/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs
index b4348c9..66059fb 100644
--- a/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs
+++ b/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs
@@ -144,7 +144,20 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests
None
00000000-0000-0000-0000-000000000000
0
-
+
+
+
+ MyNamespace
+
+ MyStore
+
+ the answer
+ 42
+
+
+
+
+
@@ -333,7 +346,20 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests
0
2147483647
None
- MyStorelast wordsRosebud
+
+
+
+ MyNamespace
+
+ MyStore
+
+ last words
+ Rosebud
+
+
+
+
+
00000000-0000-0000-0000-000000000000
@@ -362,7 +388,7 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests
Assert.That(rootPart.UUID, Is.EqualTo(new UUID("e6a5a05e-e8cc-4816-8701-04165e335790")));
Assert.That(rootPart.CreatorID, Is.EqualTo(new UUID("a6dacf01-4636-4bb9-8a97-30609438af9d")));
Assert.That(rootPart.Name, Is.EqualTo("PrimMyRide"));
- OSDMap store = rootPart.DynAttrs["MyStore"];
+ OSDMap store = rootPart.DynAttrs.GetStore("MyNamespace", "MyStore");
Assert.AreEqual(42, store["the answer"].AsInteger());
// TODO: Check other properties
@@ -414,13 +440,14 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests
rp.CreatorID = rpCreatorId;
rp.Shape = shape;
+ string daNamespace = "MyNamespace";
string daStoreName = "MyStore";
string daKey = "foo";
string daValue = "bar";
OSDMap myStore = new OSDMap();
myStore.Add(daKey, daValue);
rp.DynAttrs = new DAMap();
- rp.DynAttrs[daStoreName] = myStore;
+ rp.DynAttrs.SetStore(daNamespace, daStoreName, myStore);
SceneObjectGroup so = new SceneObjectGroup(rp);
@@ -481,7 +508,7 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests
Assert.That(name, Is.EqualTo(rpName));
Assert.That(creatorId, Is.EqualTo(rpCreatorId));
Assert.NotNull(daMap);
- Assert.AreEqual(daValue, daMap[daStoreName][daKey].AsString());
+ Assert.AreEqual(daValue, daMap.GetStore(daNamespace, daStoreName)[daKey].AsString());
}
[Test]
@@ -496,7 +523,7 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests
Assert.That(rootPart.UUID, Is.EqualTo(new UUID("9be68fdd-f740-4a0f-9675-dfbbb536b946")));
Assert.That(rootPart.CreatorID, Is.EqualTo(new UUID("b46ef588-411e-4a8b-a284-d7dcfe8e74ef")));
Assert.That(rootPart.Name, Is.EqualTo("PrimFun"));
- OSDMap store = rootPart.DynAttrs["MyStore"];
+ OSDMap store = rootPart.DynAttrs.GetStore("MyNamespace", "MyStore");
Assert.AreEqual("Rosebud", store["last words"].AsString());
// TODO: Check other properties
@@ -522,13 +549,14 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests
rp.CreatorID = rpCreatorId;
rp.Shape = shape;
+ string daNamespace = "MyNamespace";
string daStoreName = "MyStore";
string daKey = "foo";
string daValue = "bar";
OSDMap myStore = new OSDMap();
myStore.Add(daKey, daValue);
rp.DynAttrs = new DAMap();
- rp.DynAttrs[daStoreName] = myStore;
+ rp.DynAttrs.SetStore(daNamespace, daStoreName, myStore);
SceneObjectGroup so = new SceneObjectGroup(rp);
@@ -585,7 +613,7 @@ namespace OpenSim.Region.CoreModules.World.Serialiser.Tests
Assert.That(name, Is.EqualTo(rpName));
Assert.That(creatorId, Is.EqualTo(rpCreatorId));
Assert.NotNull(daMap);
- Assert.AreEqual(daValue, daMap[daStoreName][daKey].AsString());
+ Assert.AreEqual(daValue, daMap.GetStore(daNamespace, daStoreName)[daKey].AsString());
}
}
}
\ No newline at end of file
--
cgit v1.1