From afef1ac191d32e9c1514c294b17e404b1d4ae217 Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Thu, 5 Nov 2009 13:10:58 -0800 Subject: Changing the AssetBase constructors to avoid initializing assets with an unknown asset type, and log an error if it ever does happen --- OpenSim/Data/Tests/BasicAssetTest.cs | 6 +++--- OpenSim/Data/Tests/PropertyCompareConstraint.cs | 12 ++++++------ OpenSim/Data/Tests/PropertyScrambler.cs | 5 ++--- 3 files changed, 11 insertions(+), 12 deletions(-) (limited to 'OpenSim/Data/Tests') 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 [Test] public void T010_StoreSimpleAsset() { - AssetBase a1 = new AssetBase(uuid1, "asset one"); - AssetBase a2 = new AssetBase(uuid2, "asset two"); - AssetBase a3 = new AssetBase(uuid3, "asset three"); + AssetBase a1 = new AssetBase(uuid1, "asset one", (sbyte)AssetType.Texture); + AssetBase a2 = new AssetBase(uuid2, "asset two", (sbyte)AssetType.Texture); + AssetBase a3 = new AssetBase(uuid3, "asset three", (sbyte)AssetType.Texture); a1.Data = asset1; a2.Data = asset1; 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 public void AssetShouldMatch() { UUID uuid1 = UUID.Random(); - AssetBase actual = new AssetBase(uuid1, "asset one"); - AssetBase expected = new AssetBase(uuid1, "asset one"); + AssetBase actual = new AssetBase(uuid1, "asset one", (sbyte)AssetType.Texture); + AssetBase expected = new AssetBase(uuid1, "asset one", (sbyte)AssetType.Texture); var constraint = Constraints.PropertyCompareConstraint(expected); @@ -309,8 +309,8 @@ namespace OpenSim.Data.Tests public void AssetShouldNotMatch() { UUID uuid1 = UUID.Random(); - AssetBase actual = new AssetBase(uuid1, "asset one"); - AssetBase expected = new AssetBase(UUID.Random(), "asset one"); + AssetBase actual = new AssetBase(uuid1, "asset one", (sbyte)AssetType.Texture); + AssetBase expected = new AssetBase(UUID.Random(), "asset one", (sbyte)AssetType.Texture); var constraint = Constraints.PropertyCompareConstraint(expected); @@ -321,8 +321,8 @@ namespace OpenSim.Data.Tests public void AssetShouldNotMatch2() { UUID uuid1 = UUID.Random(); - AssetBase actual = new AssetBase(uuid1, "asset one"); - AssetBase expected = new AssetBase(uuid1, "asset two"); + AssetBase actual = new AssetBase(uuid1, "asset one", (sbyte)AssetType.Texture); + AssetBase expected = new AssetBase(uuid1, "asset two", (sbyte)AssetType.Texture); var constraint = Constraints.PropertyCompareConstraint(expected); 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 [Test] public void TestScramble() { - AssetBase actual = new AssetBase(UUID.Random(), "asset one"); + AssetBase actual = new AssetBase(UUID.Random(), "asset one", (sbyte)AssetType.Texture); new PropertyScrambler().Scramble(actual); } @@ -173,8 +173,7 @@ namespace OpenSim.Data.Tests public void DontScramble() { UUID uuid = UUID.Random(); - AssetBase asset = new AssetBase(); - asset.FullID = uuid; + AssetBase asset = new AssetBase(uuid, "asset", (sbyte)AssetType.Texture); new PropertyScrambler() .DontScramble(x => x.Metadata) .DontScramble(x => x.FullID) -- cgit v1.1