Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
commit
433102108b
|
@ -130,7 +130,7 @@ namespace OpenSim.Region.Framework.Tests
|
|||
SceneObjectPart sop1 = sog1.RootPart;
|
||||
TaskInventoryItem sopItem1
|
||||
= TaskInventoryHelpers.AddNotecard(
|
||||
scene, sop1, "ncItem", TestHelpers.ParseTail(0x800), TestHelpers.ParseTail(0x900));
|
||||
scene, sop1, "ncItem", TestHelpers.ParseTail(0x800), TestHelpers.ParseTail(0x900), "Hello World!");
|
||||
|
||||
InventoryFolderBase folder
|
||||
= InventoryArchiveUtils.FindFoldersByPath(scene.InventoryService, user1.PrincipalID, "Objects")[0];
|
||||
|
@ -162,7 +162,7 @@ namespace OpenSim.Region.Framework.Tests
|
|||
SceneObjectPart sop1 = sog1.RootPart;
|
||||
TaskInventoryItem sopItem1
|
||||
= TaskInventoryHelpers.AddNotecard(
|
||||
scene, sop1, "ncItem", TestHelpers.ParseTail(0x800), TestHelpers.ParseTail(0x900));
|
||||
scene, sop1, "ncItem", TestHelpers.ParseTail(0x800), TestHelpers.ParseTail(0x900), "Hello World!");
|
||||
|
||||
// Perform test
|
||||
scene.MoveTaskInventoryItem(user1.PrincipalID, UUID.Zero, sop1, sopItem1.ItemID);
|
||||
|
|
|
@ -10806,14 +10806,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
return UUID.Zero.ToString();
|
||||
}
|
||||
|
||||
string reqIdentifier = UUID.Random().ToString();
|
||||
|
||||
// was: UUID tid = tid = AsyncCommands.
|
||||
UUID tid = AsyncCommands.DataserverPlugin.RegisterRequest(m_host.LocalId, m_item.ItemID, assetID.ToString());
|
||||
UUID tid = AsyncCommands.DataserverPlugin.RegisterRequest(m_host.LocalId, m_item.ItemID, reqIdentifier);
|
||||
|
||||
if (NotecardCache.IsCached(assetID))
|
||||
{
|
||||
AsyncCommands.
|
||||
DataserverPlugin.DataserverReply(assetID.ToString(),
|
||||
NotecardCache.GetLines(assetID).ToString());
|
||||
AsyncCommands.DataserverPlugin.DataserverReply(reqIdentifier, NotecardCache.GetLines(assetID).ToString());
|
||||
|
||||
ScriptSleep(100);
|
||||
return tid.ToString();
|
||||
}
|
||||
|
@ -10829,9 +10830,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
string data = Encoding.UTF8.GetString(a.Data);
|
||||
//m_log.Debug(data);
|
||||
NotecardCache.Cache(id, data);
|
||||
AsyncCommands.
|
||||
DataserverPlugin.DataserverReply(id.ToString(),
|
||||
NotecardCache.GetLines(id).ToString());
|
||||
AsyncCommands.DataserverPlugin.DataserverReply(reqIdentifier, NotecardCache.GetLines(id).ToString());
|
||||
});
|
||||
|
||||
ScriptSleep(100);
|
||||
|
@ -10860,13 +10859,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
return UUID.Zero.ToString();
|
||||
}
|
||||
|
||||
string reqIdentifier = UUID.Random().ToString();
|
||||
|
||||
// was: UUID tid = tid = AsyncCommands.
|
||||
UUID tid = AsyncCommands.DataserverPlugin.RegisterRequest(m_host.LocalId, m_item.ItemID, assetID.ToString());
|
||||
UUID tid = AsyncCommands.DataserverPlugin.RegisterRequest(m_host.LocalId, m_item.ItemID, reqIdentifier);
|
||||
|
||||
if (NotecardCache.IsCached(assetID))
|
||||
{
|
||||
AsyncCommands.DataserverPlugin.DataserverReply(assetID.ToString(),
|
||||
NotecardCache.GetLine(assetID, line, m_notecardLineReadCharsMax));
|
||||
AsyncCommands.DataserverPlugin.DataserverReply(
|
||||
reqIdentifier, NotecardCache.GetLine(assetID, line, m_notecardLineReadCharsMax));
|
||||
|
||||
ScriptSleep(100);
|
||||
return tid.ToString();
|
||||
}
|
||||
|
@ -10882,8 +10884,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
string data = Encoding.UTF8.GetString(a.Data);
|
||||
//m_log.Debug(data);
|
||||
NotecardCache.Cache(id, data);
|
||||
AsyncCommands.DataserverPlugin.DataserverReply(id.ToString(),
|
||||
NotecardCache.GetLine(id, line, m_notecardLineReadCharsMax));
|
||||
AsyncCommands.DataserverPlugin.DataserverReply(
|
||||
reqIdentifier, NotecardCache.GetLine(assetID, line, m_notecardLineReadCharsMax));
|
||||
});
|
||||
|
||||
ScriptSleep(100);
|
||||
|
@ -11687,7 +11689,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
|
||||
public static void Cache(UUID assetID, string text)
|
||||
{
|
||||
CacheCheck();
|
||||
CheckCache();
|
||||
|
||||
lock (m_Notecards)
|
||||
{
|
||||
|
@ -11772,14 +11774,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
return line;
|
||||
}
|
||||
|
||||
public static void CacheCheck()
|
||||
public static void CheckCache()
|
||||
{
|
||||
foreach (UUID key in new List<UUID>(m_Notecards.Keys))
|
||||
lock (m_Notecards)
|
||||
{
|
||||
Notecard nc = m_Notecards[key];
|
||||
if (nc.lastRef.AddSeconds(30) < DateTime.Now)
|
||||
m_Notecards.Remove(key);
|
||||
foreach (UUID key in new List<UUID>(m_Notecards.Keys))
|
||||
{
|
||||
Notecard nc = m_Notecards[key];
|
||||
if (nc.lastRef.AddSeconds(30) < DateTime.Now)
|
||||
m_Notecards.Remove(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -93,7 +93,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
// FIXME: This should really be a script item (with accompanying script)
|
||||
TaskInventoryItem grp1Item
|
||||
= TaskInventoryHelpers.AddNotecard(
|
||||
m_scene, grp1.RootPart, "ncItem", TestHelpers.ParseTail(0x800), TestHelpers.ParseTail(0x900));
|
||||
m_scene, grp1.RootPart, "ncItem", TestHelpers.ParseTail(0x800), TestHelpers.ParseTail(0x900), "Hello World!");
|
||||
grp1Item.PermsMask |= ScriptBaseClass.PERMISSION_CHANGE_LINKS;
|
||||
|
||||
SceneObjectGroup grp2 = SceneHelpers.CreateSceneObject(2, ownerId, "grp2-", 0x20);
|
||||
|
@ -127,7 +127,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
// FIXME: This should really be a script item (with accompanying script)
|
||||
TaskInventoryItem grp1Item
|
||||
= TaskInventoryHelpers.AddNotecard(
|
||||
m_scene, grp1.RootPart, "ncItem", TestHelpers.ParseTail(0x800), TestHelpers.ParseTail(0x900));
|
||||
m_scene, grp1.RootPart, "ncItem", TestHelpers.ParseTail(0x800), TestHelpers.ParseTail(0x900), "Hello World!");
|
||||
|
||||
grp1Item.PermsMask |= ScriptBaseClass.PERMISSION_CHANGE_LINKS;
|
||||
|
||||
|
|
|
@ -0,0 +1,270 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using log4net;
|
||||
using Nini.Config;
|
||||
using NUnit.Framework;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Servers;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Region.CoreModules.Scripting.LSLHttp;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Region.ScriptEngine.Shared;
|
||||
using OpenSim.Region.ScriptEngine.Shared.Api;
|
||||
using OpenSim.Region.ScriptEngine.Shared.ScriptBase;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using OpenSim.Tests.Common;
|
||||
using OpenSim.Tests.Common.Mock;
|
||||
|
||||
namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
||||
{
|
||||
/// <summary>
|
||||
/// Tests for notecard related functions in LSL
|
||||
/// </summary>
|
||||
[TestFixture]
|
||||
public class LSL_ApiNotecardTests : OpenSimTestCase
|
||||
{
|
||||
private Scene m_scene;
|
||||
private MockScriptEngine m_engine;
|
||||
|
||||
private SceneObjectGroup m_so;
|
||||
private TaskInventoryItem m_scriptItem;
|
||||
private LSL_Api m_lslApi;
|
||||
|
||||
[TestFixtureSetUp]
|
||||
public void TestFixtureSetUp()
|
||||
{
|
||||
// Don't allow tests to be bamboozled by asynchronous events. Execute everything on the same thread.
|
||||
Util.FireAndForgetMethod = FireAndForgetMethod.RegressionTest;
|
||||
}
|
||||
|
||||
[TestFixtureTearDown]
|
||||
public void TestFixureTearDown()
|
||||
{
|
||||
// We must set this back afterwards, otherwise later tests will fail since they're expecting multiple
|
||||
// threads. Possibly, later tests should be rewritten so none of them require async stuff (which regression
|
||||
// tests really shouldn't).
|
||||
Util.FireAndForgetMethod = Util.DefaultFireAndForgetMethod;
|
||||
}
|
||||
|
||||
[SetUp]
|
||||
public override void SetUp()
|
||||
{
|
||||
base.SetUp();
|
||||
|
||||
m_engine = new MockScriptEngine();
|
||||
|
||||
m_scene = new SceneHelpers().SetupScene();
|
||||
SceneHelpers.SetupSceneModules(m_scene, new IniConfigSource(), m_engine);
|
||||
|
||||
m_so = SceneHelpers.AddSceneObject(m_scene);
|
||||
m_scriptItem = TaskInventoryHelpers.AddScript(m_scene, m_so.RootPart);
|
||||
|
||||
// This is disconnected from the actual script - the mock engine does not set up any LSL_Api atm.
|
||||
// Possibly this could be done and we could obtain it directly from the MockScriptEngine.
|
||||
m_lslApi = new LSL_Api();
|
||||
m_lslApi.Initialize(m_engine, m_so.RootPart, m_scriptItem, null);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestLlGetNotecardLine()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
string[] ncLines = { "One", "Two", "Three" };
|
||||
|
||||
TaskInventoryItem ncItem
|
||||
= TaskInventoryHelpers.AddNotecard(m_scene, m_so.RootPart, "nc", "1", "10", string.Join("\n", ncLines));
|
||||
|
||||
AssertValidNotecardLine(ncItem.Name, 0, ncLines[0]);
|
||||
AssertValidNotecardLine(ncItem.Name, 2, ncLines[2]);
|
||||
AssertValidNotecardLine(ncItem.Name, 3, ScriptBaseClass.EOF);
|
||||
AssertValidNotecardLine(ncItem.Name, 4, ScriptBaseClass.EOF);
|
||||
|
||||
// XXX: Is this correct or do we really expect no dataserver event to fire at all?
|
||||
AssertValidNotecardLine(ncItem.Name, -1, "");
|
||||
AssertValidNotecardLine(ncItem.Name, -2, "");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestLlGetNotecardLine_NoNotecard()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
AssertInValidNotecardLine("nc", 0);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestLlGetNotecardLine_NotANotecard()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
|
||||
TaskInventoryItem ncItem = TaskInventoryHelpers.AddScript(m_scene, m_so.RootPart, "nc1", "Not important");
|
||||
|
||||
AssertInValidNotecardLine(ncItem.Name, 0);
|
||||
}
|
||||
|
||||
private void AssertValidNotecardLine(string ncName, int lineNumber, string assertLine)
|
||||
{
|
||||
string key = m_lslApi.llGetNotecardLine(ncName, lineNumber);
|
||||
Assert.That(key, Is.Not.EqualTo(UUID.Zero.ToString()));
|
||||
|
||||
Assert.That(m_engine.PostedEvents.Count, Is.EqualTo(1));
|
||||
Assert.That(m_engine.PostedEvents.ContainsKey(m_scriptItem.ItemID));
|
||||
|
||||
List<EventParams> events = m_engine.PostedEvents[m_scriptItem.ItemID];
|
||||
Assert.That(events.Count, Is.EqualTo(1));
|
||||
EventParams eventParams = events[0];
|
||||
|
||||
Assert.That(eventParams.EventName, Is.EqualTo("dataserver"));
|
||||
Assert.That(eventParams.Params[0].ToString(), Is.EqualTo(key));
|
||||
Assert.That(eventParams.Params[1].ToString(), Is.EqualTo(assertLine));
|
||||
|
||||
m_engine.ClearPostedEvents();
|
||||
}
|
||||
|
||||
private void AssertInValidNotecardLine(string ncName, int lineNumber)
|
||||
{
|
||||
string key = m_lslApi.llGetNotecardLine(ncName, lineNumber);
|
||||
Assert.That(key, Is.EqualTo(UUID.Zero.ToString()));
|
||||
|
||||
Assert.That(m_engine.PostedEvents.Count, Is.EqualTo(0));
|
||||
}
|
||||
|
||||
// [Test]
|
||||
// public void TestLlReleaseUrl()
|
||||
// {
|
||||
// TestHelpers.InMethod();
|
||||
//
|
||||
// m_lslApi.llRequestURL();
|
||||
// string returnedUri = m_engine.PostedEvents[m_scriptItem.ItemID][0].Params[2].ToString();
|
||||
//
|
||||
// {
|
||||
// // Check that the initial number of URLs is correct
|
||||
// Assert.That(m_lslApi.llGetFreeURLs().value, Is.EqualTo(m_urlModule.TotalUrls - 1));
|
||||
// }
|
||||
//
|
||||
// {
|
||||
// // Check releasing a non-url
|
||||
// m_lslApi.llReleaseURL("GARBAGE");
|
||||
// Assert.That(m_lslApi.llGetFreeURLs().value, Is.EqualTo(m_urlModule.TotalUrls - 1));
|
||||
// }
|
||||
//
|
||||
// {
|
||||
// // Check releasing a non-existing url
|
||||
// m_lslApi.llReleaseURL("http://example.com");
|
||||
// Assert.That(m_lslApi.llGetFreeURLs().value, Is.EqualTo(m_urlModule.TotalUrls - 1));
|
||||
// }
|
||||
//
|
||||
// {
|
||||
// // Check URL release
|
||||
// m_lslApi.llReleaseURL(returnedUri);
|
||||
// Assert.That(m_lslApi.llGetFreeURLs().value, Is.EqualTo(m_urlModule.TotalUrls));
|
||||
//
|
||||
// HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(returnedUri);
|
||||
//
|
||||
// bool gotExpectedException = false;
|
||||
//
|
||||
// try
|
||||
// {
|
||||
// using (HttpWebResponse webResponse = (HttpWebResponse)webRequest.GetResponse())
|
||||
// {}
|
||||
// }
|
||||
// catch (WebException e)
|
||||
// {
|
||||
// using (HttpWebResponse response = (HttpWebResponse)e.Response)
|
||||
// gotExpectedException = response.StatusCode == HttpStatusCode.NotFound;
|
||||
// }
|
||||
//
|
||||
// Assert.That(gotExpectedException, Is.True);
|
||||
// }
|
||||
//
|
||||
// {
|
||||
// // Check releasing the same URL again
|
||||
// m_lslApi.llReleaseURL(returnedUri);
|
||||
// Assert.That(m_lslApi.llGetFreeURLs().value, Is.EqualTo(m_urlModule.TotalUrls));
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void TestLlRequestUrl()
|
||||
// {
|
||||
// TestHelpers.InMethod();
|
||||
//
|
||||
// string requestId = m_lslApi.llRequestURL();
|
||||
// Assert.That(requestId, Is.Not.EqualTo(UUID.Zero.ToString()));
|
||||
// string returnedUri;
|
||||
//
|
||||
// {
|
||||
// // Check that URL is correctly set up
|
||||
// Assert.That(m_lslApi.llGetFreeURLs().value, Is.EqualTo(m_urlModule.TotalUrls - 1));
|
||||
//
|
||||
// Assert.That(m_engine.PostedEvents.ContainsKey(m_scriptItem.ItemID));
|
||||
//
|
||||
// List<EventParams> events = m_engine.PostedEvents[m_scriptItem.ItemID];
|
||||
// Assert.That(events.Count, Is.EqualTo(1));
|
||||
// EventParams eventParams = events[0];
|
||||
// Assert.That(eventParams.EventName, Is.EqualTo("http_request"));
|
||||
//
|
||||
// UUID returnKey;
|
||||
// string rawReturnKey = eventParams.Params[0].ToString();
|
||||
// string method = eventParams.Params[1].ToString();
|
||||
// returnedUri = eventParams.Params[2].ToString();
|
||||
//
|
||||
// Assert.That(UUID.TryParse(rawReturnKey, out returnKey), Is.True);
|
||||
// Assert.That(method, Is.EqualTo(ScriptBaseClass.URL_REQUEST_GRANTED));
|
||||
// Assert.That(Uri.IsWellFormedUriString(returnedUri, UriKind.Absolute), Is.True);
|
||||
// }
|
||||
//
|
||||
// {
|
||||
// // Check that request to URL works.
|
||||
// string testResponse = "Hello World";
|
||||
//
|
||||
// m_engine.ClearPostedEvents();
|
||||
// m_engine.PostEventHook
|
||||
// += (itemId, evp) => m_lslApi.llHTTPResponse(evp.Params[0].ToString(), 200, testResponse);
|
||||
//
|
||||
//// Console.WriteLine("Trying {0}", returnedUri);
|
||||
// HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(returnedUri);
|
||||
//
|
||||
// AssertHttpResponse(returnedUri, testResponse);
|
||||
//
|
||||
// Assert.That(m_engine.PostedEvents.ContainsKey(m_scriptItem.ItemID));
|
||||
//
|
||||
// List<EventParams> events = m_engine.PostedEvents[m_scriptItem.ItemID];
|
||||
// Assert.That(events.Count, Is.EqualTo(1));
|
||||
// EventParams eventParams = events[0];
|
||||
// Assert.That(eventParams.EventName, Is.EqualTo("http_request"));
|
||||
//
|
||||
// UUID returnKey;
|
||||
// string rawReturnKey = eventParams.Params[0].ToString();
|
||||
// string method = eventParams.Params[1].ToString();
|
||||
// string body = eventParams.Params[2].ToString();
|
||||
//
|
||||
// Assert.That(UUID.TryParse(rawReturnKey, out returnKey), Is.True);
|
||||
// Assert.That(method, Is.EqualTo("GET"));
|
||||
// Assert.That(body, Is.EqualTo(""));
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// private void AssertHttpResponse(string uri, string expectedResponse)
|
||||
// {
|
||||
// HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(uri);
|
||||
//
|
||||
// using (HttpWebResponse webResponse = (HttpWebResponse)webRequest.GetResponse())
|
||||
// {
|
||||
// using (Stream stream = webResponse.GetResponseStream())
|
||||
// {
|
||||
// using (StreamReader reader = new StreamReader(stream))
|
||||
// {
|
||||
// Assert.That(reader.ReadToEnd(), Is.EqualTo(expectedResponse));
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
|
@ -151,7 +151,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
|
|||
|
||||
// Create an object embedded inside the first
|
||||
TaskInventoryHelpers.AddNotecard(
|
||||
m_scene, inWorldObj.RootPart, taskInvObjItemName, taskInvObjItemId, TestHelpers.ParseTail(0x900));
|
||||
m_scene, inWorldObj.RootPart, taskInvObjItemName, taskInvObjItemId, TestHelpers.ParseTail(0x900), "Hello World!");
|
||||
|
||||
bool exceptionCaught = false;
|
||||
|
||||
|
|
|
@ -40,6 +40,23 @@ namespace OpenSim.Tests.Common
|
|||
///
|
||||
public static class TaskInventoryHelpers
|
||||
{
|
||||
/// <summary>
|
||||
/// Add a notecard item to the given part.
|
||||
/// </summary>
|
||||
/// <param name="scene"></param>
|
||||
/// <param name="part"></param>
|
||||
/// <param name="itemName"></param>
|
||||
/// <param name="itemIDFrag">UUID or UUID stem</param>
|
||||
/// <param name="assetIDFrag">UUID or UUID stem</param>
|
||||
/// <param name="text">The tex to put in the notecard.</param>
|
||||
/// <returns>The item that was added</returns>
|
||||
public static TaskInventoryItem AddNotecard(
|
||||
Scene scene, SceneObjectPart part, string itemName, string itemIDStem, string assetIDStem, string text)
|
||||
{
|
||||
return AddNotecard(
|
||||
scene, part, itemName, TestHelpers.ParseStem(itemIDStem), TestHelpers.ParseStem(assetIDStem), text);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add a notecard item to the given part.
|
||||
/// </summary>
|
||||
|
@ -48,11 +65,13 @@ namespace OpenSim.Tests.Common
|
|||
/// <param name="itemName"></param>
|
||||
/// <param name="itemID"></param>
|
||||
/// <param name="assetID"></param>
|
||||
/// <param name="text">The tex to put in the notecard.</param>
|
||||
/// <returns>The item that was added</returns>
|
||||
public static TaskInventoryItem AddNotecard(Scene scene, SceneObjectPart part, string itemName, UUID itemID, UUID assetID)
|
||||
public static TaskInventoryItem AddNotecard(
|
||||
Scene scene, SceneObjectPart part, string itemName, UUID itemID, UUID assetID, string text)
|
||||
{
|
||||
AssetNotecard nc = new AssetNotecard();
|
||||
nc.BodyText = "Hello World!";
|
||||
nc.BodyText = text;
|
||||
nc.Encode();
|
||||
|
||||
AssetBase ncAsset
|
||||
|
@ -87,8 +106,8 @@ namespace OpenSim.Tests.Common
|
|||
/// Add a simple script to the given part.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// TODO: Accept input for item and asset IDs to avoid mysterious script failures that try to use any of these
|
||||
/// functions more than once in a test.
|
||||
/// TODO: Accept input for item and asset IDs so that we have completely replicatable regression tests rather
|
||||
/// than a random component.
|
||||
/// </remarks>
|
||||
/// <param name="scene"></param>
|
||||
/// <param name="part"></param>
|
||||
|
@ -102,8 +121,9 @@ namespace OpenSim.Tests.Common
|
|||
ast.Source = scriptSource;
|
||||
ast.Encode();
|
||||
|
||||
UUID assetUuid = new UUID("00000000-0000-0000-1000-000000000000");
|
||||
UUID itemUuid = new UUID("00000000-0000-0000-1100-000000000000");
|
||||
UUID assetUuid = UUID.Random();
|
||||
UUID itemUuid = UUID.Random();
|
||||
|
||||
AssetBase asset
|
||||
= AssetHelpers.CreateAsset(assetUuid, AssetType.LSLText, ast.AssetData, UUID.Zero);
|
||||
scene.AssetService.Store(asset);
|
||||
|
|
|
@ -31,6 +31,7 @@ using System.Collections.Generic;
|
|||
using System.Reflection;
|
||||
using Nini.Config;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Region.ScriptEngine.Interfaces;
|
||||
|
@ -110,8 +111,11 @@ namespace OpenSim.Tests.Common
|
|||
{
|
||||
// Console.WriteLine("Posting event {0} for {1}", name, itemID);
|
||||
|
||||
EventParams evParams = new EventParams(name, args, null);
|
||||
return PostScriptEvent(itemID, new EventParams(name, args, null));
|
||||
}
|
||||
|
||||
public bool PostScriptEvent(UUID itemID, EventParams evParams)
|
||||
{
|
||||
List<EventParams> eventsForItem;
|
||||
|
||||
if (!PostedEvents.ContainsKey(itemID))
|
||||
|
@ -132,9 +136,22 @@ namespace OpenSim.Tests.Common
|
|||
return true;
|
||||
}
|
||||
|
||||
public bool PostObjectEvent(uint localID, EventParams evParams)
|
||||
{
|
||||
return PostObjectEvent(m_scene.GetSceneObjectPart(localID), evParams);
|
||||
}
|
||||
|
||||
public bool PostObjectEvent(UUID itemID, string name, object[] args)
|
||||
{
|
||||
throw new System.NotImplementedException ();
|
||||
return PostObjectEvent(m_scene.GetSceneObjectPart(itemID), new EventParams(name, args, null));
|
||||
}
|
||||
|
||||
private bool PostObjectEvent(SceneObjectPart part, EventParams evParams)
|
||||
{
|
||||
foreach (TaskInventoryItem item in part.Inventory.GetInventoryItems(InventoryType.LSL))
|
||||
PostScriptEvent(item.ItemID, evParams);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void SuspendScript(UUID itemID)
|
||||
|
@ -187,16 +204,6 @@ namespace OpenSim.Tests.Common
|
|||
throw new System.NotImplementedException ();
|
||||
}
|
||||
|
||||
public bool PostScriptEvent(UUID itemID,EventParams parms)
|
||||
{
|
||||
throw new System.NotImplementedException ();
|
||||
}
|
||||
|
||||
public bool PostObjectEvent (uint localID, EventParams parms)
|
||||
{
|
||||
throw new System.NotImplementedException ();
|
||||
}
|
||||
|
||||
public DetectParams GetDetectParams(UUID item, int number)
|
||||
{
|
||||
throw new System.NotImplementedException ();
|
||||
|
|
|
@ -113,6 +113,27 @@ namespace OpenSim.Tests.Common
|
|||
DisableLoggingConfigStream.Position = 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Parse a UUID stem into a full UUID.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Yes, this is completely inconsistent with ParseTail but this is probably a better way to do it,
|
||||
/// UUIDs are conceptually not hexadecmial numbers.
|
||||
/// The fragment will come at the start of the UUID. The rest will be 0s
|
||||
/// </remarks>
|
||||
/// <returns></returns>
|
||||
/// <param name='frag'>
|
||||
/// A UUID fragment that will be parsed into a full UUID. Therefore, it can only contain
|
||||
/// cahracters which are valid in a UUID, except for "-" which is currently only allowed if a full UUID is
|
||||
/// given as the 'fragment'.
|
||||
/// </param>
|
||||
public static UUID ParseStem(string stem)
|
||||
{
|
||||
string rawUuid = stem.PadRight(32, '0');
|
||||
|
||||
return UUID.Parse(rawUuid);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Parse tail section into full UUID.
|
||||
/// </summary>
|
||||
|
|
|
@ -45,7 +45,7 @@ namespace OpenSim.Tests
|
|||
/// Set up a test directory.
|
||||
/// </summary>
|
||||
[SetUp]
|
||||
public void SetUp()
|
||||
public override void SetUp()
|
||||
{
|
||||
base.SetUp();
|
||||
|
||||
|
|
Loading…
Reference in New Issue