aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/Tests
diff options
context:
space:
mode:
authorMelanie2010-05-21 03:51:58 +0100
committerMelanie2010-05-21 03:51:58 +0100
commita92780fe5f31a38b2f00459ef00ca28127a60dcf (patch)
treef89850a27564abd01f1b3aaf72aa24001e165a26 /OpenSim/Data/Tests
parentRefactor scene presence list for lockless iteration. Lock contention will now... (diff)
parentCleaned up MySql migrations a bit more, got rid of all old-form migration fil... (diff)
downloadopensim-SC_OLD-a92780fe5f31a38b2f00459ef00ca28127a60dcf.zip
opensim-SC_OLD-a92780fe5f31a38b2f00459ef00ca28127a60dcf.tar.gz
opensim-SC_OLD-a92780fe5f31a38b2f00459ef00ca28127a60dcf.tar.bz2
opensim-SC_OLD-a92780fe5f31a38b2f00459ef00ca28127a60dcf.tar.xz
Merge branch 'master' into careminster-presence-refactor
Diffstat (limited to 'OpenSim/Data/Tests')
-rw-r--r--OpenSim/Data/Tests/BasicAssetTest.cs58
1 files changed, 45 insertions, 13 deletions
diff --git a/OpenSim/Data/Tests/BasicAssetTest.cs b/OpenSim/Data/Tests/BasicAssetTest.cs
index e80cff9..71d6314 100644
--- a/OpenSim/Data/Tests/BasicAssetTest.cs
+++ b/OpenSim/Data/Tests/BasicAssetTest.cs
@@ -42,7 +42,11 @@ 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;
49 PropertyScrambler<AssetBase> scrambler;
46 50
47 public void SuperInit() 51 public void SuperInit()
48 { 52 {
@@ -53,6 +57,16 @@ namespace OpenSim.Data.Tests
53 uuid3 = UUID.Random(); 57 uuid3 = UUID.Random();
54 asset1 = new byte[100]; 58 asset1 = new byte[100];
55 asset1.Initialize(); 59 asset1.Initialize();
60
61
62 scrambler = new PropertyScrambler<AssetBase>()
63 .DontScramble(x => x.ID)
64 .DontScramble(x => x.FullID)
65 .DontScramble(x => x.Metadata.ID)
66 .DontScramble(x => x.Metadata.Type)
67 .DontScramble(x => x.Metadata.CreatorID)
68 .DontScramble(x => x.Metadata.ContentType)
69 .DontScramble(x => x.Metadata.FullID);
56 } 70 }
57 71
58 [Test] 72 [Test]
@@ -66,27 +80,17 @@ namespace OpenSim.Data.Tests
66 [Test] 80 [Test]
67 public void T010_StoreSimpleAsset() 81 public void T010_StoreSimpleAsset()
68 { 82 {
69 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);
70 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);
71 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);
72 a1.Data = asset1; 86 a1.Data = asset1;
73 a2.Data = asset1; 87 a2.Data = asset1;
74 a3.Data = asset1; 88 a3.Data = asset1;
75 89
76 PropertyScrambler<AssetBase> scrambler = new PropertyScrambler<AssetBase>()
77 .DontScramble(x => x.Data)
78 .DontScramble(x => x.ID)
79 .DontScramble(x => x.FullID)
80 .DontScramble(x => x.Metadata.ID)
81 .DontScramble(x => x.Metadata.CreatorID)
82 .DontScramble(x => x.Metadata.ContentType)
83 .DontScramble(x => x.Metadata.FullID);
84
85 scrambler.Scramble(a1); 90 scrambler.Scramble(a1);
86 scrambler.Scramble(a2); 91 scrambler.Scramble(a2);
87 scrambler.Scramble(a3); 92 scrambler.Scramble(a3);
88 93
89
90 db.StoreAsset(a1); 94 db.StoreAsset(a1);
91 db.StoreAsset(a2); 95 db.StoreAsset(a2);
92 db.StoreAsset(a3); 96 db.StoreAsset(a3);
@@ -130,5 +134,33 @@ namespace OpenSim.Data.Tests
130 Assert.That(metadata.Temporary, Is.EqualTo(a1b.Temporary)); 134 Assert.That(metadata.Temporary, Is.EqualTo(a1b.Temporary));
131 Assert.That(metadata.FullID, Is.EqualTo(a1b.FullID)); 135 Assert.That(metadata.FullID, Is.EqualTo(a1b.FullID));
132 } 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 }
133 } 165 }
134} 166}