diff options
Diffstat (limited to 'OpenSim/Data')
-rw-r--r-- | OpenSim/Data/MSSQL/MSSQLAssetData.cs | 9 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/MySQLAssetData.cs | 5 | ||||
-rw-r--r-- | OpenSim/Data/SQLite/SQLiteAssetData.cs | 9 | ||||
-rw-r--r-- | OpenSim/Data/Tests/BasicAssetTest.cs | 6 | ||||
-rw-r--r-- | OpenSim/Data/Tests/PropertyCompareConstraint.cs | 12 | ||||
-rw-r--r-- | OpenSim/Data/Tests/PropertyScrambler.cs | 5 |
6 files changed, 22 insertions, 24 deletions
diff --git a/OpenSim/Data/MSSQL/MSSQLAssetData.cs b/OpenSim/Data/MSSQL/MSSQLAssetData.cs index 25f7cf0..1ce4abf 100644 --- a/OpenSim/Data/MSSQL/MSSQLAssetData.cs +++ b/OpenSim/Data/MSSQL/MSSQLAssetData.cs | |||
@@ -132,12 +132,13 @@ namespace OpenSim.Data.MSSQL | |||
132 | { | 132 | { |
133 | if (reader.Read()) | 133 | if (reader.Read()) |
134 | { | 134 | { |
135 | AssetBase asset = new AssetBase(); | 135 | AssetBase asset = new AssetBase( |
136 | new UUID((Guid)reader["id"]), | ||
137 | (string)reader["name"], | ||
138 | Convert.ToSByte(reader["assetType"]) | ||
139 | ); | ||
136 | // Region Main | 140 | // Region Main |
137 | asset.FullID = new UUID((Guid)reader["id"]); | ||
138 | asset.Name = (string)reader["name"]; | ||
139 | asset.Description = (string)reader["description"]; | 141 | asset.Description = (string)reader["description"]; |
140 | asset.Type = Convert.ToSByte(reader["assetType"]); | ||
141 | asset.Local = Convert.ToBoolean(reader["local"]); | 142 | asset.Local = Convert.ToBoolean(reader["local"]); |
142 | asset.Temporary = Convert.ToBoolean(reader["temporary"]); | 143 | asset.Temporary = Convert.ToBoolean(reader["temporary"]); |
143 | asset.Data = (byte[])reader["data"]; | 144 | asset.Data = (byte[])reader["data"]; |
diff --git a/OpenSim/Data/MySQL/MySQLAssetData.cs b/OpenSim/Data/MySQL/MySQLAssetData.cs index 1fe6d29..6a4ccd7 100644 --- a/OpenSim/Data/MySQL/MySQLAssetData.cs +++ b/OpenSim/Data/MySQL/MySQLAssetData.cs | |||
@@ -151,10 +151,9 @@ namespace OpenSim.Data.MySQL | |||
151 | { | 151 | { |
152 | if (dbReader.Read()) | 152 | if (dbReader.Read()) |
153 | { | 153 | { |
154 | asset = new AssetBase(); | 154 | asset = new AssetBase(assetID, (string)dbReader["name"], (sbyte)dbReader["assetType"]); |
155 | asset.Data = (byte[]) dbReader["data"]; | 155 | asset.Data = (byte[]) dbReader["data"]; |
156 | asset.Description = (string) dbReader["description"]; | 156 | asset.Description = (string) dbReader["description"]; |
157 | asset.FullID = assetID; | ||
158 | 157 | ||
159 | string local = dbReader["local"].ToString(); | 158 | string local = dbReader["local"].ToString(); |
160 | if (local.Equals("1") || local.Equals("true", StringComparison.InvariantCultureIgnoreCase)) | 159 | if (local.Equals("1") || local.Equals("true", StringComparison.InvariantCultureIgnoreCase)) |
@@ -162,8 +161,6 @@ namespace OpenSim.Data.MySQL | |||
162 | else | 161 | else |
163 | asset.Local = false; | 162 | asset.Local = false; |
164 | 163 | ||
165 | asset.Name = (string) dbReader["name"]; | ||
166 | asset.Type = (sbyte) dbReader["assetType"]; | ||
167 | asset.Temporary = Convert.ToBoolean(dbReader["temporary"]); | 164 | asset.Temporary = Convert.ToBoolean(dbReader["temporary"]); |
168 | } | 165 | } |
169 | dbReader.Close(); | 166 | dbReader.Close(); |
diff --git a/OpenSim/Data/SQLite/SQLiteAssetData.cs b/OpenSim/Data/SQLite/SQLiteAssetData.cs index 49275cb..11be28e 100644 --- a/OpenSim/Data/SQLite/SQLiteAssetData.cs +++ b/OpenSim/Data/SQLite/SQLiteAssetData.cs | |||
@@ -231,12 +231,13 @@ namespace OpenSim.Data.SQLite | |||
231 | // TODO: this doesn't work yet because something more | 231 | // TODO: this doesn't work yet because something more |
232 | // interesting has to be done to actually get these values | 232 | // interesting has to be done to actually get these values |
233 | // back out. Not enough time to figure it out yet. | 233 | // back out. Not enough time to figure it out yet. |
234 | AssetBase asset = new AssetBase(); | 234 | AssetBase asset = new AssetBase( |
235 | new UUID((String)row["UUID"]), | ||
236 | (String)row["Name"], | ||
237 | Convert.ToSByte(row["Type"]) | ||
238 | ); | ||
235 | 239 | ||
236 | asset.FullID = new UUID((String) row["UUID"]); | ||
237 | asset.Name = (String) row["Name"]; | ||
238 | asset.Description = (String) row["Description"]; | 240 | asset.Description = (String) row["Description"]; |
239 | asset.Type = Convert.ToSByte(row["Type"]); | ||
240 | asset.Local = Convert.ToBoolean(row["Local"]); | 241 | asset.Local = Convert.ToBoolean(row["Local"]); |
241 | asset.Temporary = Convert.ToBoolean(row["Temporary"]); | 242 | asset.Temporary = Convert.ToBoolean(row["Temporary"]); |
242 | asset.Data = (byte[]) row["Data"]; | 243 | asset.Data = (byte[]) row["Data"]; |
diff --git a/OpenSim/Data/Tests/BasicAssetTest.cs b/OpenSim/Data/Tests/BasicAssetTest.cs index 1969d76..25aed61 100644 --- a/OpenSim/Data/Tests/BasicAssetTest.cs +++ b/OpenSim/Data/Tests/BasicAssetTest.cs | |||
@@ -66,9 +66,9 @@ namespace OpenSim.Data.Tests | |||
66 | [Test] | 66 | [Test] |
67 | public void T010_StoreSimpleAsset() | 67 | public void T010_StoreSimpleAsset() |
68 | { | 68 | { |
69 | AssetBase a1 = new AssetBase(uuid1, "asset one"); | 69 | AssetBase a1 = new AssetBase(uuid1, "asset one", (sbyte)AssetType.Texture); |
70 | AssetBase a2 = new AssetBase(uuid2, "asset two"); | 70 | AssetBase a2 = new AssetBase(uuid2, "asset two", (sbyte)AssetType.Texture); |
71 | AssetBase a3 = new AssetBase(uuid3, "asset three"); | 71 | AssetBase a3 = new AssetBase(uuid3, "asset three", (sbyte)AssetType.Texture); |
72 | a1.Data = asset1; | 72 | a1.Data = asset1; |
73 | a2.Data = asset1; | 73 | a2.Data = asset1; |
74 | a3.Data = asset1; | 74 | a3.Data = asset1; |
diff --git a/OpenSim/Data/Tests/PropertyCompareConstraint.cs b/OpenSim/Data/Tests/PropertyCompareConstraint.cs index 06ca53e..5b1f935 100644 --- a/OpenSim/Data/Tests/PropertyCompareConstraint.cs +++ b/OpenSim/Data/Tests/PropertyCompareConstraint.cs | |||
@@ -297,8 +297,8 @@ namespace OpenSim.Data.Tests | |||
297 | public void AssetShouldMatch() | 297 | public void AssetShouldMatch() |
298 | { | 298 | { |
299 | UUID uuid1 = UUID.Random(); | 299 | UUID uuid1 = UUID.Random(); |
300 | AssetBase actual = new AssetBase(uuid1, "asset one"); | 300 | AssetBase actual = new AssetBase(uuid1, "asset one", (sbyte)AssetType.Texture); |
301 | AssetBase expected = new AssetBase(uuid1, "asset one"); | 301 | AssetBase expected = new AssetBase(uuid1, "asset one", (sbyte)AssetType.Texture); |
302 | 302 | ||
303 | var constraint = Constraints.PropertyCompareConstraint(expected); | 303 | var constraint = Constraints.PropertyCompareConstraint(expected); |
304 | 304 | ||
@@ -309,8 +309,8 @@ namespace OpenSim.Data.Tests | |||
309 | public void AssetShouldNotMatch() | 309 | public void AssetShouldNotMatch() |
310 | { | 310 | { |
311 | UUID uuid1 = UUID.Random(); | 311 | UUID uuid1 = UUID.Random(); |
312 | AssetBase actual = new AssetBase(uuid1, "asset one"); | 312 | AssetBase actual = new AssetBase(uuid1, "asset one", (sbyte)AssetType.Texture); |
313 | AssetBase expected = new AssetBase(UUID.Random(), "asset one"); | 313 | AssetBase expected = new AssetBase(UUID.Random(), "asset one", (sbyte)AssetType.Texture); |
314 | 314 | ||
315 | var constraint = Constraints.PropertyCompareConstraint(expected); | 315 | var constraint = Constraints.PropertyCompareConstraint(expected); |
316 | 316 | ||
@@ -321,8 +321,8 @@ namespace OpenSim.Data.Tests | |||
321 | public void AssetShouldNotMatch2() | 321 | public void AssetShouldNotMatch2() |
322 | { | 322 | { |
323 | UUID uuid1 = UUID.Random(); | 323 | UUID uuid1 = UUID.Random(); |
324 | AssetBase actual = new AssetBase(uuid1, "asset one"); | 324 | AssetBase actual = new AssetBase(uuid1, "asset one", (sbyte)AssetType.Texture); |
325 | AssetBase expected = new AssetBase(uuid1, "asset two"); | 325 | AssetBase expected = new AssetBase(uuid1, "asset two", (sbyte)AssetType.Texture); |
326 | 326 | ||
327 | var constraint = Constraints.PropertyCompareConstraint(expected); | 327 | var constraint = Constraints.PropertyCompareConstraint(expected); |
328 | 328 | ||
diff --git a/OpenSim/Data/Tests/PropertyScrambler.cs b/OpenSim/Data/Tests/PropertyScrambler.cs index 72aaff1..c968364 100644 --- a/OpenSim/Data/Tests/PropertyScrambler.cs +++ b/OpenSim/Data/Tests/PropertyScrambler.cs | |||
@@ -165,7 +165,7 @@ namespace OpenSim.Data.Tests | |||
165 | [Test] | 165 | [Test] |
166 | public void TestScramble() | 166 | public void TestScramble() |
167 | { | 167 | { |
168 | AssetBase actual = new AssetBase(UUID.Random(), "asset one"); | 168 | AssetBase actual = new AssetBase(UUID.Random(), "asset one", (sbyte)AssetType.Texture); |
169 | new PropertyScrambler<AssetBase>().Scramble(actual); | 169 | new PropertyScrambler<AssetBase>().Scramble(actual); |
170 | } | 170 | } |
171 | 171 | ||
@@ -173,8 +173,7 @@ namespace OpenSim.Data.Tests | |||
173 | public void DontScramble() | 173 | public void DontScramble() |
174 | { | 174 | { |
175 | UUID uuid = UUID.Random(); | 175 | UUID uuid = UUID.Random(); |
176 | AssetBase asset = new AssetBase(); | 176 | AssetBase asset = new AssetBase(uuid, "asset", (sbyte)AssetType.Texture); |
177 | asset.FullID = uuid; | ||
178 | new PropertyScrambler<AssetBase>() | 177 | new PropertyScrambler<AssetBase>() |
179 | .DontScramble(x => x.Metadata) | 178 | .DontScramble(x => x.Metadata) |
180 | .DontScramble(x => x.FullID) | 179 | .DontScramble(x => x.FullID) |