diff options
author | AlexRa | 2010-05-19 16:55:31 +0300 |
---|---|---|
committer | Melanie | 2010-05-20 11:01:51 +0100 |
commit | ce787a4c413cbfc70f4e31e49510e19127c9b01b (patch) | |
tree | 34aa9239eef140bc5a17de52d0fd2001caa7d28d /OpenSim/Data/Tests/BasicAssetTest.cs | |
parent | Scrambled asset type in BasicAssetTest.cs! (diff) | |
download | opensim-SC_OLD-ce787a4c413cbfc70f4e31e49510e19127c9b01b.zip opensim-SC_OLD-ce787a4c413cbfc70f4e31e49510e19127c9b01b.tar.gz opensim-SC_OLD-ce787a4c413cbfc70f4e31e49510e19127c9b01b.tar.bz2 opensim-SC_OLD-ce787a4c413cbfc70f4e31e49510e19127c9b01b.tar.xz |
Series of patches to include creator ID in assets.
Contains a migration.
SQLite: May contain nuts.
The SQLite migration copies the entire asset table. Be prepared for quite a wait. Don't interrupt it. Back up your assets db.
BasicAssetTest checks CreatorID storage, new test for weird CreatorID
(now also checks that non-GUID or empty CreatorID gets stored correctly)
Signed-off-by: Melanie <melanie@t-data.com>
Diffstat (limited to 'OpenSim/Data/Tests/BasicAssetTest.cs')
-rw-r--r-- | OpenSim/Data/Tests/BasicAssetTest.cs | 39 |
1 files changed, 35 insertions, 4 deletions
diff --git a/OpenSim/Data/Tests/BasicAssetTest.cs b/OpenSim/Data/Tests/BasicAssetTest.cs index cd6903b..71d6314 100644 --- a/OpenSim/Data/Tests/BasicAssetTest.cs +++ b/OpenSim/Data/Tests/BasicAssetTest.cs | |||
@@ -42,6 +42,9 @@ namespace OpenSim.Data.Tests | |||
42 | public UUID uuid1; | 42 | public UUID uuid1; |
43 | public UUID uuid2; | 43 | public UUID uuid2; |
44 | public UUID uuid3; | 44 | public UUID uuid3; |
45 | public string critter1 = UUID.Random().ToString(); | ||
46 | public string critter2 = UUID.Random().ToString(); | ||
47 | public string critter3 = UUID.Random().ToString(); | ||
45 | public byte[] asset1; | 48 | public byte[] asset1; |
46 | PropertyScrambler<AssetBase> scrambler; | 49 | PropertyScrambler<AssetBase> scrambler; |
47 | 50 | ||
@@ -54,6 +57,7 @@ namespace OpenSim.Data.Tests | |||
54 | uuid3 = UUID.Random(); | 57 | uuid3 = UUID.Random(); |
55 | asset1 = new byte[100]; | 58 | asset1 = new byte[100]; |
56 | asset1.Initialize(); | 59 | asset1.Initialize(); |
60 | |||
57 | 61 | ||
58 | scrambler = new PropertyScrambler<AssetBase>() | 62 | scrambler = new PropertyScrambler<AssetBase>() |
59 | .DontScramble(x => x.ID) | 63 | .DontScramble(x => x.ID) |
@@ -76,9 +80,9 @@ namespace OpenSim.Data.Tests | |||
76 | [Test] | 80 | [Test] |
77 | public void T010_StoreSimpleAsset() | 81 | public void T010_StoreSimpleAsset() |
78 | { | 82 | { |
79 | AssetBase a1 = new AssetBase(uuid1, "asset one", (sbyte)AssetType.Texture, UUID.Zero.ToString()); | 83 | AssetBase a1 = new AssetBase(uuid1, "asset one", (sbyte)AssetType.Texture, critter1); |
80 | AssetBase a2 = new AssetBase(uuid2, "asset two", (sbyte)AssetType.Texture, UUID.Zero.ToString()); | 84 | AssetBase a2 = new AssetBase(uuid2, "asset two", (sbyte)AssetType.Texture, critter2); |
81 | AssetBase a3 = new AssetBase(uuid3, "asset three", (sbyte)AssetType.Texture, UUID.Zero.ToString()); | 85 | AssetBase a3 = new AssetBase(uuid3, "asset three", (sbyte)AssetType.Texture, critter3); |
82 | a1.Data = asset1; | 86 | a1.Data = asset1; |
83 | a2.Data = asset1; | 87 | a2.Data = asset1; |
84 | a3.Data = asset1; | 88 | a3.Data = asset1; |
@@ -87,7 +91,6 @@ namespace OpenSim.Data.Tests | |||
87 | scrambler.Scramble(a2); | 91 | scrambler.Scramble(a2); |
88 | scrambler.Scramble(a3); | 92 | scrambler.Scramble(a3); |
89 | 93 | ||
90 | |||
91 | db.StoreAsset(a1); | 94 | db.StoreAsset(a1); |
92 | db.StoreAsset(a2); | 95 | db.StoreAsset(a2); |
93 | db.StoreAsset(a3); | 96 | db.StoreAsset(a3); |
@@ -131,5 +134,33 @@ namespace OpenSim.Data.Tests | |||
131 | Assert.That(metadata.Temporary, Is.EqualTo(a1b.Temporary)); | 134 | Assert.That(metadata.Temporary, Is.EqualTo(a1b.Temporary)); |
132 | Assert.That(metadata.FullID, Is.EqualTo(a1b.FullID)); | 135 | Assert.That(metadata.FullID, Is.EqualTo(a1b.FullID)); |
133 | } | 136 | } |
137 | |||
138 | |||
139 | [Test] | ||
140 | public void T020_CheckForWeirdCreatorID() | ||
141 | { | ||
142 | // It is expected that eventually the CreatorID might be an arbitrary string (an URI) | ||
143 | // rather than a valid UUID (?). This test is to make sure that the database layer does not | ||
144 | // attempt to convert CreatorID to GUID, but just passes it both ways as a string. | ||
145 | AssetBase a1 = new AssetBase(uuid1, "asset one", (sbyte)AssetType.Texture, critter1); | ||
146 | AssetBase a2 = new AssetBase(uuid2, "asset two", (sbyte)AssetType.Texture, "This is not a GUID!"); | ||
147 | AssetBase a3 = new AssetBase(uuid3, "asset three", (sbyte)AssetType.Texture, ""); | ||
148 | a1.Data = asset1; | ||
149 | a2.Data = asset1; | ||
150 | a3.Data = asset1; | ||
151 | |||
152 | db.StoreAsset(a1); | ||
153 | db.StoreAsset(a2); | ||
154 | db.StoreAsset(a3); | ||
155 | |||
156 | AssetBase a1a = db.GetAsset(uuid1); | ||
157 | Assert.That(a1a, Constraints.PropertyCompareConstraint(a1)); | ||
158 | |||
159 | AssetBase a2a = db.GetAsset(uuid2); | ||
160 | Assert.That(a2a, Constraints.PropertyCompareConstraint(a2)); | ||
161 | |||
162 | AssetBase a3a = db.GetAsset(uuid3); | ||
163 | Assert.That(a3a, Constraints.PropertyCompareConstraint(a3)); | ||
164 | } | ||
134 | } | 165 | } |
135 | } | 166 | } |