Merge branch 'master' of melanie@opensimulator.org:/var/git/opensim
commit
2b8c99c2fb
|
@ -204,7 +204,7 @@ namespace OpenSim.Data
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
m_log.DebugFormat("[MIGRATIONS]: Cmd was {0}", e.Message.Replace("\n", " "));
|
m_log.DebugFormat("[MIGRATIONS]: Cmd was {0}", e.Message.Replace("\n", " "));
|
||||||
m_log.Debug("[MIGRATIONS]: An error has occurred in the migration. This may mean you could see errors trying to run OpenSim. If you see database related errors, you will need to fix the issue manually. Continuing.");
|
m_log.Debug("[MIGRATIONS]: An error has occurred in the migration. If you're running OpenSim for the first time then you can probably safely ignore this, since certain migration commands attempt to fetch data out of old tables. However, if you're using an existing database and you see database related errors while running OpenSim then you will need to fix these problems manually. Continuing.");
|
||||||
ExecuteScript("ROLLBACK;");
|
ExecuteScript("ROLLBACK;");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -150,10 +150,10 @@ namespace OpenSim.Framework
|
||||||
Vector3.TryParse(args["at_axis"].AsString(), out AtAxis);
|
Vector3.TryParse(args["at_axis"].AsString(), out AtAxis);
|
||||||
|
|
||||||
if (args["left_axis"] != null)
|
if (args["left_axis"] != null)
|
||||||
Vector3.TryParse(args["left_axis"].AsString(), out AtAxis);
|
Vector3.TryParse(args["left_axis"].AsString(), out LeftAxis);
|
||||||
|
|
||||||
if (args["up_axis"] != null)
|
if (args["up_axis"] != null)
|
||||||
Vector3.TryParse(args["up_axis"].AsString(), out AtAxis);
|
Vector3.TryParse(args["up_axis"].AsString(), out UpAxis);
|
||||||
|
|
||||||
if (args["changed_grid"] != null)
|
if (args["changed_grid"] != null)
|
||||||
ChangedGrid = args["changed_grid"].AsBoolean();
|
ChangedGrid = args["changed_grid"].AsBoolean();
|
||||||
|
|
|
@ -288,7 +288,7 @@ namespace OpenSim.Framework.Console
|
||||||
|
|
||||||
reply["str_response_string"] = xmldoc.InnerXml;
|
reply["str_response_string"] = xmldoc.InnerXml;
|
||||||
reply["int_response_code"] = 200;
|
reply["int_response_code"] = 200;
|
||||||
reply["content_type"] = "text/plain";
|
reply["content_type"] = "text/xml";
|
||||||
|
|
||||||
return reply;
|
return reply;
|
||||||
}
|
}
|
||||||
|
@ -343,7 +343,7 @@ namespace OpenSim.Framework.Console
|
||||||
|
|
||||||
reply["str_response_string"] = xmldoc.InnerXml;
|
reply["str_response_string"] = xmldoc.InnerXml;
|
||||||
reply["int_response_code"] = 200;
|
reply["int_response_code"] = 200;
|
||||||
reply["content_type"] = "text/plain";
|
reply["content_type"] = "text/xml";
|
||||||
|
|
||||||
return reply;
|
return reply;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) Contributors, http://opensimulator.org/
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
*
|
*
|
||||||
|
@ -131,6 +131,7 @@ namespace OpenSim.Framework
|
||||||
/// <returns>True if the key was found, otherwise false</returns>
|
/// <returns>True if the key was found, otherwise false</returns>
|
||||||
public bool ContainsKey(TKey key)
|
public bool ContainsKey(TKey key)
|
||||||
{
|
{
|
||||||
|
lock (m_syncRoot)
|
||||||
return m_dict.ContainsKey(key);
|
return m_dict.ContainsKey(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,6 +40,7 @@ namespace OpenSim.Framework.Tests
|
||||||
public void Build()
|
public void Build()
|
||||||
{
|
{
|
||||||
cache = new Cache();
|
cache = new Cache();
|
||||||
|
cache = new Cache(CacheMedium.Memory,CacheStrategy.Aggressive,CacheFlags.AllowUpdate);
|
||||||
cacheItemUUID = UUID.Random();
|
cacheItemUUID = UUID.Random();
|
||||||
MemoryCacheItem cachedItem = new MemoryCacheItem(cacheItemUUID.ToString(),DateTime.Now + TimeSpan.FromDays(1));
|
MemoryCacheItem cachedItem = new MemoryCacheItem(cacheItemUUID.ToString(),DateTime.Now + TimeSpan.FromDays(1));
|
||||||
byte[] foo = new byte[1];
|
byte[] foo = new byte[1];
|
||||||
|
@ -68,23 +69,7 @@ namespace OpenSim.Framework.Tests
|
||||||
Assert.That(citem == null, "Item should not be in Cache");
|
Assert.That(citem == null, "Item should not be in Cache");
|
||||||
}
|
}
|
||||||
|
|
||||||
//NOTE: Test Case disabled until Cache is fixed
|
|
||||||
[Test]
|
|
||||||
public void TestTTLExpiredEntry()
|
|
||||||
{
|
|
||||||
UUID ImmediateExpiryUUID = UUID.Random();
|
|
||||||
MemoryCacheItem cachedItem = new MemoryCacheItem(ImmediateExpiryUUID.ToString(), TimeSpan.FromDays(-1));
|
|
||||||
byte[] foo = new byte[1];
|
|
||||||
foo[0] = 1;
|
|
||||||
cachedItem.Store(foo);
|
|
||||||
cache.Store(cacheItemUUID.ToString(), cachedItem);
|
|
||||||
|
|
||||||
cache.Get(cacheItemUUID.ToString());
|
|
||||||
//object citem = cache.Get(cacheItemUUID.ToString());
|
|
||||||
//Assert.That(citem == null, "Item should not be in Cache because the expiry time was before now");
|
|
||||||
}
|
|
||||||
|
|
||||||
//NOTE: Test Case disabled until Cache is fixed
|
|
||||||
[Test]
|
[Test]
|
||||||
public void ExpireItemManually()
|
public void ExpireItemManually()
|
||||||
{
|
{
|
||||||
|
@ -94,10 +79,45 @@ namespace OpenSim.Framework.Tests
|
||||||
foo[0] = 1;
|
foo[0] = 1;
|
||||||
cachedItem.Store(foo);
|
cachedItem.Store(foo);
|
||||||
cache.Store(cacheItemUUID.ToString(), cachedItem);
|
cache.Store(cacheItemUUID.ToString(), cachedItem);
|
||||||
cache.Invalidate(ImmediateExpiryUUID.ToString());
|
cache.Invalidate(cacheItemUUID.ToString());
|
||||||
cache.Get(cacheItemUUID.ToString());
|
cache.Get(cacheItemUUID.ToString());
|
||||||
//object citem = cache.Get(cacheItemUUID.ToString());
|
object citem = cache.Get(cacheItemUUID.ToString());
|
||||||
//Assert.That(citem == null, "Item should not be in Cache because we manually invalidated it");
|
Assert.That(citem == null, "Item should not be in Cache because we manually invalidated it");
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void ClearCacheTest()
|
||||||
|
{
|
||||||
|
UUID ImmediateExpiryUUID = UUID.Random();
|
||||||
|
MemoryCacheItem cachedItem = new MemoryCacheItem(ImmediateExpiryUUID.ToString(), DateTime.Now - TimeSpan.FromDays(1));
|
||||||
|
byte[] foo = new byte[1];
|
||||||
|
foo[0] = 1;
|
||||||
|
cachedItem.Store(foo);
|
||||||
|
cache.Store(cacheItemUUID.ToString(), cachedItem);
|
||||||
|
cache.Clear();
|
||||||
|
|
||||||
|
object citem = cache.Get(cacheItemUUID.ToString());
|
||||||
|
Assert.That(citem == null, "Item should not be in Cache because we manually invalidated it");
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void CacheItemMundane()
|
||||||
|
{
|
||||||
|
UUID Random1 = UUID.Random();
|
||||||
|
UUID Random2 = UUID.Random();
|
||||||
|
byte[] data = new byte[0];
|
||||||
|
CacheItemBase cb1 = new CacheItemBase(Random1.ToString(), DateTime.Now + TimeSpan.FromDays(1));
|
||||||
|
CacheItemBase cb2 = new CacheItemBase(Random2.ToString(), DateTime.Now + TimeSpan.FromDays(1));
|
||||||
|
CacheItemBase cb3 = new CacheItemBase(Random1.ToString(), DateTime.Now + TimeSpan.FromDays(1));
|
||||||
|
|
||||||
|
cb1.Store(data);
|
||||||
|
|
||||||
|
Assert.That(cb1.Equals(cb3), "cb1 should equal cb3, their uuids are the same");
|
||||||
|
Assert.That(!cb2.Equals(cb1), "cb2 should not equal cb1, their uuids are NOT the same");
|
||||||
|
Assert.That(cb1.IsLocked() == false, "CacheItemBase default is false");
|
||||||
|
Assert.That(cb1.Retrieve() == null, "Virtual Retrieve method should return null");
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,9 +54,28 @@ namespace OpenSim.Framework.Tests
|
||||||
Location TestLocation2 = new Location(1099511628032000);
|
Location TestLocation2 = new Location(1099511628032000);
|
||||||
Assert.That(TestLocation1 == TestLocation2);
|
Assert.That(TestLocation1 == TestLocation2);
|
||||||
|
|
||||||
|
Assert.That(TestLocation2.X == 256000 && TestLocation2.Y == 256000, "Test xy location doesn't match regionhandle provided");
|
||||||
|
|
||||||
|
Assert.That(TestLocation2.RegionHandle == 1099511628032000,
|
||||||
|
"Location RegionHandle Property didn't match regionhandle provided in constructor");
|
||||||
|
|
||||||
|
|
||||||
TestLocation1 = new Location(256001, 256001);
|
TestLocation1 = new Location(256001, 256001);
|
||||||
TestLocation2 = new Location(1099511628032000);
|
TestLocation2 = new Location(1099511628032000);
|
||||||
Assert.That(TestLocation1 != TestLocation2);
|
Assert.That(TestLocation1 != TestLocation2);
|
||||||
|
|
||||||
|
Assert.That(TestLocation1.Equals(256001, 256001), "Equals(x,y) failed to match the position in the constructor");
|
||||||
|
|
||||||
|
Assert.That(TestLocation2.GetHashCode() == (TestLocation2.X.GetHashCode() ^ TestLocation2.Y.GetHashCode()), "GetHashCode failed to produce the expected hashcode");
|
||||||
|
|
||||||
|
Location TestLocation3;
|
||||||
|
object cln = TestLocation2.Clone();
|
||||||
|
TestLocation3 = (Location) cln;
|
||||||
|
Assert.That(TestLocation3.X == TestLocation2.X && TestLocation3.Y == TestLocation2.Y,
|
||||||
|
"Cloned Location values do not match");
|
||||||
|
|
||||||
|
Assert.That(TestLocation2.Equals(cln), "Cloned object failed .Equals(obj) Test");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,311 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* * Neither the name of the OpenSimulator Project nor the
|
||||||
|
* names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
using NUnit.Framework;
|
||||||
|
using OpenSim.Framework;
|
||||||
|
using OpenMetaverse;
|
||||||
|
using OpenMetaverse.StructuredData;
|
||||||
|
using System;
|
||||||
|
using System.Globalization;
|
||||||
|
using System.Threading;
|
||||||
|
|
||||||
|
namespace OpenSim.Framework.Tests
|
||||||
|
{
|
||||||
|
[TestFixture]
|
||||||
|
public class MundaneFrameworkTests
|
||||||
|
{
|
||||||
|
private bool m_RegionSettingsOnSaveEventFired;
|
||||||
|
private bool m_RegionLightShareDataOnSaveEventFired;
|
||||||
|
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void ChildAgentDataUpdate01()
|
||||||
|
{
|
||||||
|
// code coverage
|
||||||
|
ChildAgentDataUpdate cadu = new ChildAgentDataUpdate();
|
||||||
|
Assert.IsFalse(cadu.alwaysrun, "Default is false");
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void AgentPositionTest01()
|
||||||
|
{
|
||||||
|
UUID AgentId1 = UUID.Random();
|
||||||
|
UUID SessionId1 = UUID.Random();
|
||||||
|
uint CircuitCode1 = uint.MinValue;
|
||||||
|
Vector3 Size1 = Vector3.UnitZ;
|
||||||
|
Vector3 Position1 = Vector3.UnitX;
|
||||||
|
Vector3 LeftAxis1 = Vector3.UnitY;
|
||||||
|
Vector3 UpAxis1 = Vector3.UnitZ;
|
||||||
|
Vector3 AtAxis1 = Vector3.UnitX;
|
||||||
|
|
||||||
|
ulong RegionHandle1 = ulong.MinValue;
|
||||||
|
byte[] Throttles1 = new byte[] {0, 1, 0};
|
||||||
|
|
||||||
|
Vector3 Velocity1 = Vector3.Zero;
|
||||||
|
float Far1 = 256;
|
||||||
|
|
||||||
|
bool ChangedGrid1 = false;
|
||||||
|
Vector3 Center1 = Vector3.Zero;
|
||||||
|
|
||||||
|
AgentPosition position1 = new AgentPosition();
|
||||||
|
position1.AgentID = AgentId1;
|
||||||
|
position1.SessionID = SessionId1;
|
||||||
|
position1.CircuitCode = CircuitCode1;
|
||||||
|
position1.Size = Size1;
|
||||||
|
position1.Position = Position1;
|
||||||
|
position1.LeftAxis = LeftAxis1;
|
||||||
|
position1.UpAxis = UpAxis1;
|
||||||
|
position1.AtAxis = AtAxis1;
|
||||||
|
position1.RegionHandle = RegionHandle1;
|
||||||
|
position1.Throttles = Throttles1;
|
||||||
|
position1.Velocity = Velocity1;
|
||||||
|
position1.Far = Far1;
|
||||||
|
position1.ChangedGrid = ChangedGrid1;
|
||||||
|
position1.Center = Center1;
|
||||||
|
|
||||||
|
ChildAgentDataUpdate cadu = new ChildAgentDataUpdate();
|
||||||
|
cadu.AgentID = AgentId1.Guid;
|
||||||
|
cadu.ActiveGroupID = UUID.Zero.Guid;
|
||||||
|
cadu.throttles = Throttles1;
|
||||||
|
cadu.drawdistance = Far1;
|
||||||
|
cadu.Position = Position1;
|
||||||
|
cadu.Velocity = Velocity1;
|
||||||
|
cadu.regionHandle = RegionHandle1;
|
||||||
|
cadu.cameraPosition = Center1;
|
||||||
|
cadu.AVHeight = Size1.Z;
|
||||||
|
|
||||||
|
AgentPosition position2 = new AgentPosition();
|
||||||
|
position2.CopyFrom(cadu);
|
||||||
|
|
||||||
|
Assert.IsTrue(
|
||||||
|
position2.AgentID == position1.AgentID
|
||||||
|
&& position2.Size == position1.Size
|
||||||
|
&& position2.Position == position1.Position
|
||||||
|
&& position2.Velocity == position1.Velocity
|
||||||
|
&& position2.Center == position1.Center
|
||||||
|
&& position2.RegionHandle == position1.RegionHandle
|
||||||
|
&& position2.Far == position1.Far
|
||||||
|
|
||||||
|
,"Copy From ChildAgentDataUpdate failed");
|
||||||
|
|
||||||
|
position2 = new AgentPosition();
|
||||||
|
|
||||||
|
Assert.IsFalse(position2.AgentID == position1.AgentID, "Test Error, position2 should be a blank uninitialized AgentPosition");
|
||||||
|
position2.Unpack(position1.Pack());
|
||||||
|
|
||||||
|
Assert.IsTrue(position2.AgentID == position1.AgentID, "Agent ID didn't unpack the same way it packed");
|
||||||
|
Assert.IsTrue(position2.Position == position1.Position, "Position didn't unpack the same way it packed");
|
||||||
|
Assert.IsTrue(position2.Velocity == position1.Velocity, "Velocity didn't unpack the same way it packed");
|
||||||
|
Assert.IsTrue(position2.SessionID == position1.SessionID, "SessionID didn't unpack the same way it packed");
|
||||||
|
Assert.IsTrue(position2.CircuitCode == position1.CircuitCode, "CircuitCode didn't unpack the same way it packed");
|
||||||
|
Assert.IsTrue(position2.LeftAxis == position1.LeftAxis, "LeftAxis didn't unpack the same way it packed");
|
||||||
|
Assert.IsTrue(position2.UpAxis == position1.UpAxis, "UpAxis didn't unpack the same way it packed");
|
||||||
|
Assert.IsTrue(position2.AtAxis == position1.AtAxis, "AtAxis didn't unpack the same way it packed");
|
||||||
|
Assert.IsTrue(position2.RegionHandle == position1.RegionHandle, "RegionHandle didn't unpack the same way it packed");
|
||||||
|
Assert.IsTrue(position2.ChangedGrid == position1.ChangedGrid, "ChangedGrid didn't unpack the same way it packed");
|
||||||
|
Assert.IsTrue(position2.Center == position1.Center, "Center didn't unpack the same way it packed");
|
||||||
|
Assert.IsTrue(position2.Size == position1.Size, "Size didn't unpack the same way it packed");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void RegionSettingsTest01()
|
||||||
|
{
|
||||||
|
RegionSettings settings = new RegionSettings();
|
||||||
|
settings.OnSave += RegionSaveFired;
|
||||||
|
settings.Save();
|
||||||
|
settings.OnSave -= RegionSaveFired;
|
||||||
|
|
||||||
|
string str = settings.LoadedCreationDate;
|
||||||
|
int dt = settings.LoadedCreationDateTime;
|
||||||
|
string id = settings.LoadedCreationID;
|
||||||
|
string time = settings.LoadedCreationTime;
|
||||||
|
|
||||||
|
Assert.That(m_RegionSettingsOnSaveEventFired, "RegionSettings Save Event didn't Fire");
|
||||||
|
|
||||||
|
}
|
||||||
|
public void RegionSaveFired(RegionSettings settings)
|
||||||
|
{
|
||||||
|
m_RegionSettingsOnSaveEventFired = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void InventoryItemBaseConstructorTest01()
|
||||||
|
{
|
||||||
|
InventoryItemBase b1 = new InventoryItemBase();
|
||||||
|
Assert.That(b1.ID == UUID.Zero, "void constructor should create an inventory item with ID = UUID.Zero");
|
||||||
|
Assert.That(b1.Owner == UUID.Zero, "void constructor should create an inventory item with Owner = UUID.Zero");
|
||||||
|
|
||||||
|
UUID ItemID = UUID.Random();
|
||||||
|
UUID OwnerID = UUID.Random();
|
||||||
|
|
||||||
|
InventoryItemBase b2 = new InventoryItemBase(ItemID);
|
||||||
|
Assert.That(b2.ID == ItemID, "ID constructor should create an inventory item with ID = ItemID");
|
||||||
|
Assert.That(b2.Owner == UUID.Zero, "ID constructor should create an inventory item with Owner = UUID.Zero");
|
||||||
|
|
||||||
|
InventoryItemBase b3 = new InventoryItemBase(ItemID,OwnerID);
|
||||||
|
Assert.That(b3.ID == ItemID, "ID,OwnerID constructor should create an inventory item with ID = ItemID");
|
||||||
|
Assert.That(b3.Owner == OwnerID, "ID,OwnerID constructor should create an inventory item with Owner = OwnerID");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void AssetMetaDataNonNullContentTypeTest01()
|
||||||
|
{
|
||||||
|
AssetMetadata assetMetadata = new AssetMetadata();
|
||||||
|
assetMetadata.ContentType = "image/jp2";
|
||||||
|
Assert.That(assetMetadata.Type == (sbyte)AssetType.Texture, "Content type should be AssetType.Texture");
|
||||||
|
Assert.That(assetMetadata.ContentType == "image/jp2", "Text of content type should be image/jp2");
|
||||||
|
UUID rndID = UUID.Random();
|
||||||
|
assetMetadata.ID = rndID.ToString();
|
||||||
|
Assert.That(assetMetadata.ID.ToLower() == rndID.ToString().ToLower(), "assetMetadata.ID Setter/Getter not Consistent");
|
||||||
|
DateTime fixedTime = DateTime.Now;
|
||||||
|
assetMetadata.CreationDate = fixedTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void RegionLightShareDataCloneSaveTest01()
|
||||||
|
{
|
||||||
|
RegionLightShareData rlsd = new RegionLightShareData();
|
||||||
|
rlsd.OnSave += RegionLightShareDataSaveFired;
|
||||||
|
rlsd.Save();
|
||||||
|
rlsd.OnSave -= RegionLightShareDataSaveFired;
|
||||||
|
Assert.IsTrue(m_RegionLightShareDataOnSaveEventFired, "OnSave Event Never Fired");
|
||||||
|
|
||||||
|
object o = rlsd.Clone();
|
||||||
|
RegionLightShareData dupe = (RegionLightShareData) o;
|
||||||
|
Assert.IsTrue(rlsd.sceneGamma == dupe.sceneGamma, "Memberwise Clone of RegionLightShareData failed");
|
||||||
|
}
|
||||||
|
public void RegionLightShareDataSaveFired(RegionLightShareData settings)
|
||||||
|
{
|
||||||
|
m_RegionLightShareDataOnSaveEventFired = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void EstateSettingsMundateTests()
|
||||||
|
{
|
||||||
|
EstateSettings es = new EstateSettings();
|
||||||
|
es.AddBan(null);
|
||||||
|
UUID bannedUserId = UUID.Random();
|
||||||
|
es.AddBan(new EstateBan()
|
||||||
|
{ BannedHostAddress = string.Empty,
|
||||||
|
BannedHostIPMask = string.Empty,
|
||||||
|
BannedHostNameMask = string.Empty,
|
||||||
|
BannedUserID = bannedUserId}
|
||||||
|
);
|
||||||
|
Assert.IsTrue(es.IsBanned(bannedUserId), "User Should be banned but is not.");
|
||||||
|
Assert.IsFalse(es.IsBanned(UUID.Zero), "User Should not be banned but is.");
|
||||||
|
|
||||||
|
es.RemoveBan(bannedUserId);
|
||||||
|
|
||||||
|
Assert.IsFalse(es.IsBanned(bannedUserId), "User Should not be banned but is.");
|
||||||
|
|
||||||
|
es.AddEstateManager(UUID.Zero);
|
||||||
|
|
||||||
|
es.AddEstateManager(bannedUserId);
|
||||||
|
Assert.IsTrue(es.IsEstateManager(bannedUserId), "bannedUserId should be EstateManager but isn't.");
|
||||||
|
|
||||||
|
es.RemoveEstateManager(bannedUserId);
|
||||||
|
Assert.IsFalse(es.IsEstateManager(bannedUserId), "bannedUserID is estateManager but shouldn't be");
|
||||||
|
|
||||||
|
Assert.IsFalse(es.HasAccess(bannedUserId), "bannedUserID has access but shouldn't");
|
||||||
|
|
||||||
|
es.AddEstateUser(bannedUserId);
|
||||||
|
|
||||||
|
Assert.IsTrue(es.HasAccess(bannedUserId), "bannedUserID doesn't have access but should");
|
||||||
|
es.RemoveEstateUser(bannedUserId);
|
||||||
|
|
||||||
|
es.AddEstateManager(bannedUserId);
|
||||||
|
|
||||||
|
Assert.IsTrue(es.HasAccess(bannedUserId), "bannedUserID doesn't have access but should");
|
||||||
|
|
||||||
|
Assert.That(es.EstateGroups.Length == 0, "No Estate Groups Added.. so the array should be 0 length");
|
||||||
|
|
||||||
|
es.AddEstateGroup(bannedUserId);
|
||||||
|
|
||||||
|
Assert.That(es.EstateGroups.Length == 1, "1 Estate Groups Added.. so the array should be 1 length");
|
||||||
|
|
||||||
|
Assert.That(es.EstateGroups[0] == bannedUserId,"User ID should be in EstateGroups");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void InventoryFolderBaseConstructorTest01()
|
||||||
|
{
|
||||||
|
UUID uuid1 = UUID.Random();
|
||||||
|
UUID uuid2 = UUID.Random();
|
||||||
|
|
||||||
|
InventoryFolderBase fld = new InventoryFolderBase(uuid1);
|
||||||
|
Assert.That(fld.ID == uuid1, "ID constructor failed to save value in ID field.");
|
||||||
|
|
||||||
|
fld = new InventoryFolderBase(uuid1, uuid2);
|
||||||
|
Assert.That(fld.ID == uuid1, "ID,Owner constructor failed to save value in ID field.");
|
||||||
|
Assert.That(fld.Owner == uuid2, "ID,Owner constructor failed to save value in ID field.");
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void AsssetBaseConstructorTest01()
|
||||||
|
{
|
||||||
|
AssetBase abase = new AssetBase();
|
||||||
|
Assert.IsNotNull(abase.Metadata, "void constructor of AssetBase should have created a MetaData element but didn't.");
|
||||||
|
UUID itemID = UUID.Random();
|
||||||
|
UUID creatorID = UUID.Random();
|
||||||
|
abase = new AssetBase(itemID.ToString(), "test item", (sbyte) AssetType.Texture, creatorID.ToString());
|
||||||
|
|
||||||
|
Assert.IsNotNull(abase.Metadata, "string,string,sbyte,string constructor of AssetBase should have created a MetaData element but didn't.");
|
||||||
|
Assert.That(abase.ID == itemID.ToString(), "string,string,sbyte,string constructor failed to set ID property");
|
||||||
|
Assert.That(abase.Metadata.CreatorID == creatorID.ToString(), "string,string,sbyte,string constructor failed to set Creator ID");
|
||||||
|
|
||||||
|
|
||||||
|
abase = new AssetBase(itemID.ToString(), "test item", -1, creatorID.ToString());
|
||||||
|
Assert.IsNotNull(abase.Metadata, "string,string,sbyte,string constructor of AssetBase with unknown type should have created a MetaData element but didn't.");
|
||||||
|
Assert.That(abase.Metadata.Type == -1, "Unknown Type passed to string,string,sbyte,string constructor and was a known type when it came out again");
|
||||||
|
|
||||||
|
AssetMetadata metts = new AssetMetadata();
|
||||||
|
metts.FullID = itemID;
|
||||||
|
metts.ID = string.Empty;
|
||||||
|
metts.Name = "test item";
|
||||||
|
abase.Metadata = metts;
|
||||||
|
|
||||||
|
Assert.That(abase.ToString() == itemID.ToString(), "ToString is overriden to be fullID.ToString()");
|
||||||
|
Assert.That(abase.ID == itemID.ToString(),"ID should be MetaData.FullID.ToString() when string.empty or null is provided to the ID property");
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void CultureSetCultureTest01()
|
||||||
|
{
|
||||||
|
CultureInfo ci = new CultureInfo("en-US", false);
|
||||||
|
Culture.SetCurrentCulture();
|
||||||
|
Assert.That(Thread.CurrentThread.CurrentCulture.Name == ci.Name, "SetCurrentCulture failed to set thread culture to en-US");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -170,5 +170,119 @@ namespace OpenSim.Framework.Tests
|
||||||
// Varying secrets should not eqal the same
|
// Varying secrets should not eqal the same
|
||||||
Assert.AreNotEqual(Util.GetHashGuid(string1, "secret1"), Util.GetHashGuid(string1, "secret2"));
|
Assert.AreNotEqual(Util.GetHashGuid(string1, "secret1"), Util.GetHashGuid(string1, "secret2"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void SLUtilTypeConvertTests()
|
||||||
|
{
|
||||||
|
int[] assettypes = new int[]{-1,0,1,2,3,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22
|
||||||
|
,23,24,25,46,47,48};
|
||||||
|
string[] contenttypes = new string[]
|
||||||
|
{
|
||||||
|
"application/octet-stream",
|
||||||
|
"image/x-j2c",
|
||||||
|
"audio/ogg",
|
||||||
|
"application/vnd.ll.callingcard",
|
||||||
|
"application/vnd.ll.landmark",
|
||||||
|
"application/vnd.ll.clothing",
|
||||||
|
"application/vnd.ll.primitive",
|
||||||
|
"application/vnd.ll.notecard",
|
||||||
|
"application/vnd.ll.folder",
|
||||||
|
"application/vnd.ll.rootfolder",
|
||||||
|
"application/vnd.ll.lsltext",
|
||||||
|
"application/vnd.ll.lslbyte",
|
||||||
|
"image/tga",
|
||||||
|
"application/vnd.ll.bodypart",
|
||||||
|
"application/vnd.ll.trashfolder",
|
||||||
|
"application/vnd.ll.snapshotfolder",
|
||||||
|
"application/vnd.ll.lostandfoundfolder",
|
||||||
|
"audio/x-wav",
|
||||||
|
"image/tga",
|
||||||
|
"image/jpeg",
|
||||||
|
"application/vnd.ll.animation",
|
||||||
|
"application/vnd.ll.gesture",
|
||||||
|
"application/x-metaverse-simstate",
|
||||||
|
"application/vnd.ll.favoritefolder",
|
||||||
|
"application/vnd.ll.link",
|
||||||
|
"application/vnd.ll.linkfolder",
|
||||||
|
"application/vnd.ll.currentoutfitfolder",
|
||||||
|
"application/vnd.ll.outfitfolder",
|
||||||
|
"application/vnd.ll.myoutfitsfolder"
|
||||||
|
};
|
||||||
|
for (int i=0;i<assettypes.Length;i++)
|
||||||
|
{
|
||||||
|
Assert.That(SLUtil.SLAssetTypeToContentType(assettypes[i]) == contenttypes[i], "Expecting {0} but got {1}", contenttypes[i], SLUtil.SLAssetTypeToContentType(assettypes[i]));
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < contenttypes.Length; i++)
|
||||||
|
{
|
||||||
|
if (SLUtil.ContentTypeToSLAssetType(contenttypes[i]) == 18)
|
||||||
|
{
|
||||||
|
Assert.That(contenttypes[i] == "image/tga");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Assert.That(SLUtil.ContentTypeToSLAssetType(contenttypes[i]) == assettypes[i],
|
||||||
|
"Expecting {0} but got {1}", assettypes[i],
|
||||||
|
SLUtil.ContentTypeToSLAssetType(contenttypes[i]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int[] inventorytypes = new int[] {-1,0,1,2,3,6,7,8,9,10,15,17,18,20};
|
||||||
|
string[] invcontenttypes = new string[]
|
||||||
|
{
|
||||||
|
"application/octet-stream",
|
||||||
|
"image/x-j2c",
|
||||||
|
"audio/ogg",
|
||||||
|
"application/vnd.ll.callingcard",
|
||||||
|
"application/vnd.ll.landmark",
|
||||||
|
"application/vnd.ll.primitive",
|
||||||
|
"application/vnd.ll.notecard",
|
||||||
|
"application/vnd.ll.folder",
|
||||||
|
"application/octet-stream",
|
||||||
|
"application/vnd.ll.lsltext",
|
||||||
|
"image/x-j2c",
|
||||||
|
"application/vnd.ll.primitive",
|
||||||
|
"application/vnd.ll.clothing",
|
||||||
|
"application/vnd.ll.gesture"
|
||||||
|
};
|
||||||
|
|
||||||
|
for (int i=0;i<inventorytypes.Length;i++)
|
||||||
|
{
|
||||||
|
Assert.That(SLUtil.SLInvTypeToContentType(inventorytypes[i]) == invcontenttypes[i], "Expected {0}, Got {1}", invcontenttypes[i], SLUtil.SLInvTypeToContentType(inventorytypes[i]));
|
||||||
|
}
|
||||||
|
|
||||||
|
invcontenttypes = new string[]
|
||||||
|
{
|
||||||
|
"image/x-j2c","image/jp2","image/tga",
|
||||||
|
"image/jpeg","application/ogg","audio/ogg",
|
||||||
|
"audio/x-wav","application/vnd.ll.callingcard",
|
||||||
|
"application/x-metaverse-callingcard",
|
||||||
|
"application/vnd.ll.landmark",
|
||||||
|
"application/x-metaverse-landmark",
|
||||||
|
"application/vnd.ll.clothing",
|
||||||
|
"application/x-metaverse-clothing","application/vnd.ll.bodypart",
|
||||||
|
"application/x-metaverse-bodypart","application/vnd.ll.primitive",
|
||||||
|
"application/x-metaverse-primitive","application/vnd.ll.notecard",
|
||||||
|
"application/x-metaverse-notecard","application/vnd.ll.folder",
|
||||||
|
"application/vnd.ll.rootfolder","application/vnd.ll.lsltext",
|
||||||
|
"application/x-metaverse-lsl","application/vnd.ll.lslbyte",
|
||||||
|
"application/x-metaverse-lso","application/vnd.ll.trashfolder",
|
||||||
|
"application/vnd.ll.snapshotfolder",
|
||||||
|
"application/vnd.ll.lostandfoundfolder","application/vnd.ll.animation",
|
||||||
|
"application/x-metaverse-animation","application/vnd.ll.gesture",
|
||||||
|
"application/x-metaverse-gesture","application/x-metaverse-simstate",
|
||||||
|
"application/octet-stream"
|
||||||
|
};
|
||||||
|
sbyte[] invtypes = new sbyte[]
|
||||||
|
{
|
||||||
|
0, 0, 0, 0, 1, 1, 1, 2, 2, 3, 3, 18, 18, 18, 18, 6, 6, 7, 7, 8, 9, 10, 10, 10, 10
|
||||||
|
, 8, 8, 8, 19, 19, 20, 20, 15, -1
|
||||||
|
};
|
||||||
|
|
||||||
|
for (int i = 0; i < invtypes.Length; i++)
|
||||||
|
{
|
||||||
|
Assert.That(SLUtil.ContentTypeToSLInvType(invcontenttypes[i]) == invtypes[i], "Expected {0}, Got {1}", invtypes[i], SLUtil.ContentTypeToSLInvType(invcontenttypes[i]));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -316,7 +316,7 @@ namespace OpenSim
|
||||||
m_console.Commands.AddCommand("region", false, "create region",
|
m_console.Commands.AddCommand("region", false, "create region",
|
||||||
"create region [\"region name\"] <region_file.ini>",
|
"create region [\"region name\"] <region_file.ini>",
|
||||||
"Create a new region.",
|
"Create a new region.",
|
||||||
"The settings for \"region name\" are read from <region_file.ini> in your Regions directory."
|
"The settings for \"region name\" are read from <region_file.ini>. Paths specified with <region_file.ini> are relative to your Regions directory, unless an absolute path is given."
|
||||||
+ " If \"region name\" does not exist in <region_file.ini>, it will be added." + Environment.NewLine
|
+ " If \"region name\" does not exist in <region_file.ini>, it will be added." + Environment.NewLine
|
||||||
+ "Without \"region name\", the first region found in <region_file.ini> will be created." + Environment.NewLine
|
+ "Without \"region name\", the first region found in <region_file.ini> will be created." + Environment.NewLine
|
||||||
+ "If <region_file.ini> does not exist, it will be created.",
|
+ "If <region_file.ini> does not exist, it will be created.",
|
||||||
|
|
|
@ -237,9 +237,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat
|
||||||
|
|
||||||
public virtual void OnChatBroadcast(Object sender, OSChatMessage c)
|
public virtual void OnChatBroadcast(Object sender, OSChatMessage c)
|
||||||
{
|
{
|
||||||
// unless the chat to be broadcast is of type Region, we
|
if (c.Channel != 0 && c.Channel != DEBUG_CHANNEL) return;
|
||||||
// drop it if its channel is neither 0 nor DEBUG_CHANNEL
|
|
||||||
if (c.Channel != 0 && c.Channel != DEBUG_CHANNEL && c.Type != ChatTypeEnum.Region) return;
|
|
||||||
|
|
||||||
ChatTypeEnum cType = c.Type;
|
ChatTypeEnum cType = c.Type;
|
||||||
if (c.Channel == DEBUG_CHANNEL)
|
if (c.Channel == DEBUG_CHANNEL)
|
||||||
|
|
|
@ -330,8 +330,12 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
get { return m_rootPart.UUID; }
|
get { return m_rootPart.UUID; }
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
|
lock (m_parts.SyncRoot)
|
||||||
|
{
|
||||||
|
m_parts.Remove(m_rootPart.UUID);
|
||||||
m_rootPart.UUID = value;
|
m_rootPart.UUID = value;
|
||||||
m_parts.AddOrReplace(value, m_rootPart);
|
m_parts.Add(value, m_rootPart);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -189,5 +189,40 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||||
// SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId);
|
// SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId);
|
||||||
// Assert.That(retrievedPart, Is.Null);
|
// Assert.That(retrievedPart, Is.Null);
|
||||||
//}
|
//}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Changing a scene object uuid changes the root part uuid. This is a valid operation if the object is not
|
||||||
|
/// in a scene and is useful if one wants to supply a UUID directly rather than use the one generated by
|
||||||
|
/// OpenSim.
|
||||||
|
/// </summary>
|
||||||
|
[Test]
|
||||||
|
public void TestChangeSceneObjectUuid()
|
||||||
|
{
|
||||||
|
string rootPartName = "rootpart";
|
||||||
|
UUID rootPartUuid = new UUID("00000000-0000-0000-0000-000000000001");
|
||||||
|
string childPartName = "childPart";
|
||||||
|
UUID childPartUuid = new UUID("00000000-0000-0000-0001-000000000000");
|
||||||
|
|
||||||
|
SceneObjectPart rootPart
|
||||||
|
= new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero)
|
||||||
|
{ Name = rootPartName, UUID = rootPartUuid };
|
||||||
|
SceneObjectPart linkPart
|
||||||
|
= new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero)
|
||||||
|
{ Name = childPartName, UUID = childPartUuid };
|
||||||
|
|
||||||
|
SceneObjectGroup sog = new SceneObjectGroup(rootPart);
|
||||||
|
sog.AddPart(linkPart);
|
||||||
|
|
||||||
|
Assert.That(sog.UUID, Is.EqualTo(rootPartUuid));
|
||||||
|
Assert.That(sog.RootPart.UUID, Is.EqualTo(rootPartUuid));
|
||||||
|
Assert.That(sog.Parts.Length, Is.EqualTo(2));
|
||||||
|
|
||||||
|
UUID newRootPartUuid = new UUID("00000000-0000-0000-0000-000000000002");
|
||||||
|
sog.UUID = newRootPartUuid;
|
||||||
|
|
||||||
|
Assert.That(sog.UUID, Is.EqualTo(newRootPartUuid));
|
||||||
|
Assert.That(sog.RootPart.UUID, Is.EqualTo(newRootPartUuid));
|
||||||
|
Assert.That(sog.Parts.Length, Is.EqualTo(2));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -957,7 +957,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
CacheKey = sb.ToString();
|
CacheKey = sb.ToString();
|
||||||
m_memoryCache.TryGetValue(CacheKey, out resp);
|
m_memoryCache.TryGetValue(CacheKey, out resp);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (resp == null)
|
if (resp == null)
|
||||||
|
@ -965,22 +964,19 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
string UserService;
|
string UserService;
|
||||||
UUID SessionID;
|
UUID SessionID;
|
||||||
GetClientGroupRequestID(requestingAgentID, out UserService, out SessionID);
|
GetClientGroupRequestID(requestingAgentID, out UserService, out SessionID);
|
||||||
param.Add("requestingAgentID", requestingAgentID.ToString());
|
|
||||||
|
param.Add("RequestingAgentID", requestingAgentID.ToString());
|
||||||
param.Add("RequestingAgentUserService", UserService);
|
param.Add("RequestingAgentUserService", UserService);
|
||||||
param.Add("RequestingSessionID", SessionID.ToString());
|
param.Add("RequestingSessionID", SessionID.ToString());
|
||||||
|
|
||||||
|
|
||||||
param.Add("ReadKey", m_groupReadKey);
|
param.Add("ReadKey", m_groupReadKey);
|
||||||
param.Add("WriteKey", m_groupWriteKey);
|
param.Add("WriteKey", m_groupWriteKey);
|
||||||
|
|
||||||
|
|
||||||
IList parameters = new ArrayList();
|
IList parameters = new ArrayList();
|
||||||
parameters.Add(param);
|
parameters.Add(param);
|
||||||
|
|
||||||
ConfigurableKeepAliveXmlRpcRequest req;
|
ConfigurableKeepAliveXmlRpcRequest req;
|
||||||
req = new ConfigurableKeepAliveXmlRpcRequest(function, parameters, m_disableKeepAlive);
|
req = new ConfigurableKeepAliveXmlRpcRequest(function, parameters, m_disableKeepAlive);
|
||||||
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
resp = req.Send(m_groupsServerURI, 10000);
|
resp = req.Send(m_groupsServerURI, 10000);
|
||||||
|
@ -989,7 +985,6 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
{
|
{
|
||||||
m_memoryCache.AddOrUpdate(CacheKey, resp, TimeSpan.FromSeconds(m_cacheTimeout));
|
m_memoryCache.AddOrUpdate(CacheKey, resp, TimeSpan.FromSeconds(m_cacheTimeout));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
@ -1058,11 +1053,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
|
||||||
{
|
{
|
||||||
m_log.ErrorFormat("[XMLRPC-GROUPS-CONNECTOR]: {0}", line);
|
m_log.ErrorFormat("[XMLRPC-GROUPS-CONNECTOR]: {0}", line);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Group Request Tokens are an attempt to allow the groups service to authenticate
|
/// Group Request Tokens are an attempt to allow the groups service to authenticate
|
||||||
/// requests.
|
/// requests.
|
||||||
|
|
Loading…
Reference in New Issue