Merge branch 'master' into careminster

Conflicts:
	OpenSim/Region/Framework/Scenes/SceneManager.cs
avinationmerge
Melanie 2013-02-28 21:20:07 +00:00
commit eb9458fd7e
36 changed files with 538 additions and 127 deletions

View File

@ -65,7 +65,8 @@ namespace OpenSim.Groups
m_log.DebugFormat("[Groups.RobustHGConnector]: Starting with config name {0}", m_ConfigName); m_log.DebugFormat("[Groups.RobustHGConnector]: Starting with config name {0}", m_ConfigName);
string homeURI = Util.GetConfigVarFromSections<string>(config, "HomeURI", new string[] { "Startup", m_ConfigName} ); //cnf.GetString("HomeURI", string.Empty); string homeURI = Util.GetConfigVarFromSections<string>(config, "HomeURI",
new string[] { "Startup", "Hypergrid", m_ConfigName}, string.Empty);
if (homeURI == string.Empty) if (homeURI == string.Empty)
throw new Exception(String.Format("[Groups.RobustHGConnector]: please provide the HomeURI [Startup] or in section {0}", m_ConfigName)); throw new Exception(String.Format("[Groups.RobustHGConnector]: please provide the HomeURI [Startup] or in section {0}", m_ConfigName));

View File

@ -163,14 +163,18 @@ namespace OpenSim.Data.MSSQL
if (asset.Name.Length > 64) if (asset.Name.Length > 64)
{ {
assetName = asset.Name.Substring(0, 64); assetName = asset.Name.Substring(0, 64);
m_log.Warn("[ASSET DB]: Name field truncated from " + asset.Name.Length + " to " + assetName.Length + " characters on add"); m_log.WarnFormat(
"[ASSET DB]: Name '{0}' for asset {1} truncated from {2} to {3} characters on add",
asset.Name, asset.ID, asset.Name.Length, assetName.Length);
} }
string assetDescription = asset.Description; string assetDescription = asset.Description;
if (asset.Description.Length > 64) if (asset.Description.Length > 64)
{ {
assetDescription = asset.Description.Substring(0, 64); assetDescription = asset.Description.Substring(0, 64);
m_log.Warn("[ASSET DB]: Description field truncated from " + asset.Description.Length + " to " + assetDescription.Length + " characters on add"); m_log.WarnFormat(
"[ASSET DB]: Description '{0}' for asset {1} truncated from {2} to {3} characters on add",
asset.Description, asset.ID, asset.Description.Length, assetDescription.Length);
} }
using (SqlConnection conn = new SqlConnection(m_connectionString)) using (SqlConnection conn = new SqlConnection(m_connectionString))

View File

@ -173,14 +173,18 @@ namespace OpenSim.Data.MySQL
if (asset.Name.Length > 64) if (asset.Name.Length > 64)
{ {
assetName = asset.Name.Substring(0, 64); assetName = asset.Name.Substring(0, 64);
m_log.Warn("[ASSET DB]: Name field truncated from " + asset.Name.Length + " to " + assetName.Length + " characters on add"); m_log.WarnFormat(
"[ASSET DB]: Name '{0}' for asset {1} truncated from {2} to {3} characters on add",
asset.Name, asset.ID, asset.Name.Length, assetName.Length);
} }
string assetDescription = asset.Description; string assetDescription = asset.Description;
if (asset.Description.Length > 64) if (asset.Description.Length > 64)
{ {
assetDescription = asset.Description.Substring(0, 64); assetDescription = asset.Description.Substring(0, 64);
m_log.Warn("[ASSET DB]: Description field truncated from " + asset.Description.Length + " to " + assetDescription.Length + " characters on add"); m_log.WarnFormat(
"[ASSET DB]: Description '{0}' for asset {1} truncated from {2} to {3} characters on add",
asset.Description, asset.ID, asset.Description.Length, assetDescription.Length);
} }
try try

View File

@ -204,14 +204,18 @@ namespace OpenSim.Data.MySQL
if (asset.Name.Length > 64) if (asset.Name.Length > 64)
{ {
assetName = asset.Name.Substring(0, 64); assetName = asset.Name.Substring(0, 64);
m_log.Warn("[XASSET DB]: Name field truncated from " + asset.Name.Length + " to " + assetName.Length + " characters on add"); m_log.WarnFormat(
"[XASSET DB]: Name '{0}' for asset {1} truncated from {2} to {3} characters on add",
asset.Name, asset.ID, asset.Name.Length, assetName.Length);
} }
string assetDescription = asset.Description; string assetDescription = asset.Description;
if (asset.Description.Length > 64) if (asset.Description.Length > 64)
{ {
assetDescription = asset.Description.Substring(0, 64); assetDescription = asset.Description.Substring(0, 64);
m_log.Warn("[XASSET DB]: Description field truncated from " + asset.Description.Length + " to " + assetDescription.Length + " characters on add"); m_log.WarnFormat(
"[XASSET DB]: Description '{0}' for asset {1} truncated from {2} to {3} characters on add",
asset.Description, asset.ID, asset.Description.Length, assetDescription.Length);
} }
if (m_enableCompression) if (m_enableCompression)

View File

@ -46,7 +46,7 @@ namespace OpenSim.Data.SQLite
/// </summary> /// </summary>
public class SQLiteAssetData : AssetDataBase public class SQLiteAssetData : AssetDataBase
{ {
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private const string SelectAssetSQL = "select * from assets where UUID=:UUID"; private const string SelectAssetSQL = "select * from assets where UUID=:UUID";
private const string SelectAssetMetadataSQL = "select Name, Description, Type, Temporary, asset_flags, UUID, CreatorID from assets limit :start, :count"; private const string SelectAssetMetadataSQL = "select Name, Description, Type, Temporary, asset_flags, UUID, CreatorID from assets limit :start, :count";
@ -133,6 +133,24 @@ namespace OpenSim.Data.SQLite
/// <param name="asset">Asset Base</param> /// <param name="asset">Asset Base</param>
override public bool StoreAsset(AssetBase asset) override public bool StoreAsset(AssetBase asset)
{ {
string assetName = asset.Name;
if (asset.Name.Length > 64)
{
assetName = asset.Name.Substring(0, 64);
m_log.WarnFormat(
"[ASSET DB]: Name '{0}' for asset {1} truncated from {2} to {3} characters on add",
asset.Name, asset.ID, asset.Name.Length, assetName.Length);
}
string assetDescription = asset.Description;
if (asset.Description.Length > 64)
{
assetDescription = asset.Description.Substring(0, 64);
m_log.WarnFormat(
"[ASSET DB]: Description '{0}' for asset {1} truncated from {2} to {3} characters on add",
asset.Description, asset.ID, asset.Description.Length, assetDescription.Length);
}
//m_log.Info("[ASSET DB]: Creating Asset " + asset.FullID.ToString()); //m_log.Info("[ASSET DB]: Creating Asset " + asset.FullID.ToString());
if (ExistsAsset(asset.FullID)) if (ExistsAsset(asset.FullID))
{ {
@ -143,8 +161,8 @@ namespace OpenSim.Data.SQLite
using (SqliteCommand cmd = new SqliteCommand(UpdateAssetSQL, m_conn)) using (SqliteCommand cmd = new SqliteCommand(UpdateAssetSQL, m_conn))
{ {
cmd.Parameters.Add(new SqliteParameter(":UUID", asset.FullID.ToString())); cmd.Parameters.Add(new SqliteParameter(":UUID", asset.FullID.ToString()));
cmd.Parameters.Add(new SqliteParameter(":Name", asset.Name)); cmd.Parameters.Add(new SqliteParameter(":Name", assetName));
cmd.Parameters.Add(new SqliteParameter(":Description", asset.Description)); cmd.Parameters.Add(new SqliteParameter(":Description", assetDescription));
cmd.Parameters.Add(new SqliteParameter(":Type", asset.Type)); cmd.Parameters.Add(new SqliteParameter(":Type", asset.Type));
cmd.Parameters.Add(new SqliteParameter(":Local", asset.Local)); cmd.Parameters.Add(new SqliteParameter(":Local", asset.Local));
cmd.Parameters.Add(new SqliteParameter(":Temporary", asset.Temporary)); cmd.Parameters.Add(new SqliteParameter(":Temporary", asset.Temporary));
@ -164,8 +182,8 @@ namespace OpenSim.Data.SQLite
using (SqliteCommand cmd = new SqliteCommand(InsertAssetSQL, m_conn)) using (SqliteCommand cmd = new SqliteCommand(InsertAssetSQL, m_conn))
{ {
cmd.Parameters.Add(new SqliteParameter(":UUID", asset.FullID.ToString())); cmd.Parameters.Add(new SqliteParameter(":UUID", asset.FullID.ToString()));
cmd.Parameters.Add(new SqliteParameter(":Name", asset.Name)); cmd.Parameters.Add(new SqliteParameter(":Name", assetName));
cmd.Parameters.Add(new SqliteParameter(":Description", asset.Description)); cmd.Parameters.Add(new SqliteParameter(":Description", assetDescription));
cmd.Parameters.Add(new SqliteParameter(":Type", asset.Type)); cmd.Parameters.Add(new SqliteParameter(":Type", asset.Type));
cmd.Parameters.Add(new SqliteParameter(":Local", asset.Local)); cmd.Parameters.Add(new SqliteParameter(":Local", asset.Local));
cmd.Parameters.Add(new SqliteParameter(":Temporary", asset.Temporary)); cmd.Parameters.Add(new SqliteParameter(":Temporary", asset.Temporary));

View File

@ -30,6 +30,7 @@ using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using System.IO; using System.IO;
using System.Linq;
using System.Reflection; using System.Reflection;
using System.Text; using System.Text;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
@ -808,15 +809,27 @@ namespace OpenSim
break; break;
case "modules": case "modules":
SceneManager.ForEachScene( SceneManager.ForEachSelectedScene(
delegate(Scene scene) { scene =>
MainConsole.Instance.Output("Loaded region modules in" + scene.RegionInfo.RegionName + " are:"); {
MainConsole.Instance.OutputFormat("Loaded region modules in {0} are:", scene.Name);
List<IRegionModuleBase> sharedModules = new List<IRegionModuleBase>();
List<IRegionModuleBase> nonSharedModules = new List<IRegionModuleBase>();
foreach (IRegionModuleBase module in scene.RegionModules.Values) foreach (IRegionModuleBase module in scene.RegionModules.Values)
{ {
Type type = module.GetType().GetInterface("ISharedRegionModule"); if (module.GetType().GetInterface("ISharedRegionModule") != null)
string module_type = type != null ? "Shared" : "Non-Shared"; nonSharedModules.Add(module);
MainConsole.Instance.OutputFormat("New Region Module ({0}): {1}", module_type, module.Name); else
sharedModules.Add(module);
} }
foreach (IRegionModuleBase module in sharedModules.OrderBy(m => m.Name))
MainConsole.Instance.OutputFormat("New Region Module (Shared): {0}", module.Name);
foreach (IRegionModuleBase module in sharedModules.OrderBy(m => m.Name))
MainConsole.Instance.OutputFormat("New Region Module (Non-Shared): {0}", module.Name);
} }
); );

View File

@ -752,7 +752,7 @@ namespace OpenSim
// listenIP = IPAddress.Parse("0.0.0.0"); // listenIP = IPAddress.Parse("0.0.0.0");
uint port = (uint) regionInfo.InternalEndPoint.Port; uint port = (uint) regionInfo.InternalEndPoint.Port;
IClientNetworkServer clientNetworkServer;
if (m_autoCreateClientStack) if (m_autoCreateClientStack)
{ {
clientNetworkServers = m_clientStackManager.CreateServers( clientNetworkServers = m_clientStackManager.CreateServers(

View File

@ -65,7 +65,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Lure
{ {
m_Enabled = true; m_Enabled = true;
m_ThisGridURL = Util.GetConfigVarFromSections<string>(config, "GatekeeperURI", new string[] {"Startup", "Messaging"}); m_ThisGridURL = Util.GetConfigVarFromSections<string>(config, "GatekeeperURI",
new string[] { "Startup", "Hypergrid", "Messaging" }, String.Empty);
// Legacy. Remove soon! // Legacy. Remove soon!
m_ThisGridURL = config.Configs["Messaging"].GetString("Gatekeeper", m_ThisGridURL); m_ThisGridURL = config.Configs["Messaging"].GetString("Gatekeeper", m_ThisGridURL);
m_log.DebugFormat("[LURE MODULE]: {0} enabled", Name); m_log.DebugFormat("[LURE MODULE]: {0} enabled", Name);

View File

@ -88,8 +88,10 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
IConfig thisModuleConfig = source.Configs["HGInventoryAccessModule"]; IConfig thisModuleConfig = source.Configs["HGInventoryAccessModule"];
if (thisModuleConfig != null) if (thisModuleConfig != null)
{ {
m_HomeURI = Util.GetConfigVarFromSections<string>(source, "HomeURI", new string[] {"Startup", "HGInventoryAccessModule"}); m_HomeURI = Util.GetConfigVarFromSections<string>(source, "HomeURI",
m_ThisGatekeeper = Util.GetConfigVarFromSections<string>(source, "GatekeeperURI", new string[] {"Startup", "HGInventoryAccessModule"}); new string[] { "Startup", "Hypergrid", "HGInventoryAccessModule" }, String.Empty);
m_ThisGatekeeper = Util.GetConfigVarFromSections<string>(source, "GatekeeperURI",
new string[] { "Startup", "Hypergrid", "HGInventoryAccessModule" }, String.Empty);
// Legacy. Renove soon! // Legacy. Renove soon!
m_ThisGatekeeper = thisModuleConfig.GetString("Gatekeeper", m_ThisGatekeeper); m_ThisGatekeeper = thisModuleConfig.GetString("Gatekeeper", m_ThisGatekeeper);

View File

@ -113,7 +113,8 @@ namespace OpenSim.Region.DataSnapshot
try try
{ {
m_enabled = config.Configs["DataSnapshot"].GetBoolean("index_sims", m_enabled); m_enabled = config.Configs["DataSnapshot"].GetBoolean("index_sims", m_enabled);
string gatekeeper = Util.GetConfigVarFromSections<string>(config, "GatekeeperURI", new string[] {"Startup", "GridService"}); string gatekeeper = Util.GetConfigVarFromSections<string>(config, "GatekeeperURI",
new string[] { "Startup", "Hypergrid", "GridService" }, String.Empty);
// Legacy. Remove soon! // Legacy. Remove soon!
if (string.IsNullOrEmpty(gatekeeper)) if (string.IsNullOrEmpty(gatekeeper))
{ {

View File

@ -313,35 +313,30 @@ namespace OpenSim.Region.Framework.Scenes
public void SendCommandToPluginModules(string[] cmdparams) public void SendCommandToPluginModules(string[] cmdparams)
{ {
ForEachCurrentScene(delegate(Scene scene) { scene.SendCommandToPlugins(cmdparams); }); ForEachSelectedScene(delegate(Scene scene) { scene.SendCommandToPlugins(cmdparams); });
} }
public void SetBypassPermissionsOnCurrentScene(bool bypassPermissions) public void SetBypassPermissionsOnCurrentScene(bool bypassPermissions)
{ {
ForEachCurrentScene(delegate(Scene scene) { scene.Permissions.SetBypassPermissions(bypassPermissions); }); ForEachSelectedScene(delegate(Scene scene) { scene.Permissions.SetBypassPermissions(bypassPermissions); });
} }
private void ForEachCurrentScene(Action<Scene> func) public void ForEachSelectedScene(Action<Scene> func)
{ {
if (CurrentScene == null) if (CurrentScene == null)
{ ForEachScene(func);
List<Scene> sceneList = Scenes;
sceneList.ForEach(func);
}
else else
{
func(CurrentScene); func(CurrentScene);
} }
}
public void RestartCurrentScene() public void RestartCurrentScene()
{ {
ForEachCurrentScene(delegate(Scene scene) { scene.RestartNow(); }); ForEachSelectedScene(delegate(Scene scene) { scene.RestartNow(); });
} }
public void BackupCurrentScene() public void BackupCurrentScene()
{ {
ForEachCurrentScene(delegate(Scene scene) { scene.Backup(true); }); ForEachSelectedScene(delegate(Scene scene) { scene.Backup(true); });
} }
public bool TrySetCurrentScene(string regionName) public bool TrySetCurrentScene(string regionName)
@ -434,7 +429,7 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="name">Name of avatar to debug</param> /// <param name="name">Name of avatar to debug</param>
public void SetDebugPacketLevelOnCurrentScene(int newDebug, string name) public void SetDebugPacketLevelOnCurrentScene(int newDebug, string name)
{ {
ForEachCurrentScene(scene => ForEachSelectedScene(scene =>
scene.ForEachScenePresence(sp => scene.ForEachScenePresence(sp =>
{ {
if (name == null || sp.Name == name) if (name == null || sp.Name == name)
@ -453,7 +448,7 @@ namespace OpenSim.Region.Framework.Scenes
{ {
List<ScenePresence> avatars = new List<ScenePresence>(); List<ScenePresence> avatars = new List<ScenePresence>();
ForEachCurrentScene( ForEachSelectedScene(
delegate(Scene scene) delegate(Scene scene)
{ {
scene.ForEachRootScenePresence(delegate(ScenePresence scenePresence) scene.ForEachRootScenePresence(delegate(ScenePresence scenePresence)
@ -470,7 +465,7 @@ namespace OpenSim.Region.Framework.Scenes
{ {
List<ScenePresence> presences = new List<ScenePresence>(); List<ScenePresence> presences = new List<ScenePresence>();
ForEachCurrentScene(delegate(Scene scene) ForEachSelectedScene(delegate(Scene scene)
{ {
scene.ForEachScenePresence(delegate(ScenePresence sp) scene.ForEachScenePresence(delegate(ScenePresence sp)
{ {
@ -494,12 +489,12 @@ namespace OpenSim.Region.Framework.Scenes
public void ForceCurrentSceneClientUpdate() public void ForceCurrentSceneClientUpdate()
{ {
ForEachCurrentScene(delegate(Scene scene) { scene.ForceClientUpdate(); }); ForEachSelectedScene(delegate(Scene scene) { scene.ForceClientUpdate(); });
} }
public void HandleEditCommandOnCurrentScene(string[] cmdparams) public void HandleEditCommandOnCurrentScene(string[] cmdparams)
{ {
ForEachCurrentScene(delegate(Scene scene) { scene.HandleEditCommand(cmdparams); }); ForEachSelectedScene(delegate(Scene scene) { scene.HandleEditCommand(cmdparams); });
} }
public bool TryGetScenePresence(UUID avatarId, out ScenePresence avatar) public bool TryGetScenePresence(UUID avatarId, out ScenePresence avatar)

View File

@ -130,7 +130,7 @@ namespace OpenSim.Region.Framework.Tests
SceneObjectPart sop1 = sog1.RootPart; SceneObjectPart sop1 = sog1.RootPart;
TaskInventoryItem sopItem1 TaskInventoryItem sopItem1
= TaskInventoryHelpers.AddNotecard( = TaskInventoryHelpers.AddNotecard(
scene, sop1, "ncItem", TestHelpers.ParseTail(0x800), TestHelpers.ParseTail(0x900)); scene, sop1, "ncItem", TestHelpers.ParseTail(0x800), TestHelpers.ParseTail(0x900), "Hello World!");
InventoryFolderBase folder InventoryFolderBase folder
= InventoryArchiveUtils.FindFoldersByPath(scene.InventoryService, user1.PrincipalID, "Objects")[0]; = InventoryArchiveUtils.FindFoldersByPath(scene.InventoryService, user1.PrincipalID, "Objects")[0];
@ -162,7 +162,7 @@ namespace OpenSim.Region.Framework.Tests
SceneObjectPart sop1 = sog1.RootPart; SceneObjectPart sop1 = sog1.RootPart;
TaskInventoryItem sopItem1 TaskInventoryItem sopItem1
= TaskInventoryHelpers.AddNotecard( = TaskInventoryHelpers.AddNotecard(
scene, sop1, "ncItem", TestHelpers.ParseTail(0x800), TestHelpers.ParseTail(0x900)); scene, sop1, "ncItem", TestHelpers.ParseTail(0x800), TestHelpers.ParseTail(0x900), "Hello World!");
// Perform test // Perform test
scene.MoveTaskInventoryItem(user1.PrincipalID, UUID.Zero, sop1, sopItem1.ItemID); scene.MoveTaskInventoryItem(user1.PrincipalID, UUID.Zero, sop1, sopItem1.ItemID);

View File

@ -33,6 +33,11 @@ using Nini.Config;
using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes;
// You will need to uncomment this line if you are adding a region module to some other assembly which does not already
// specify its assembly. Otherwise, the region modules in the assembly will not be picked up when OpenSimulator scans
// the available DLLs
//[assembly: Addin("MyModule", "1.0")]
namespace OpenSim.Region.OptionalModules.Example.BareBonesNonShared namespace OpenSim.Region.OptionalModules.Example.BareBonesNonShared
{ {
/// <summary> /// <summary>

View File

@ -33,6 +33,11 @@ using Nini.Config;
using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes;
// You will need to uncomment this line if you are adding a region module to some other assembly which does not already
// specify its assembly. Otherwise, the region modules in the assembly will not be picked up when OpenSimulator scans
// the available DLLs
//[assembly: Addin("MyModule", "1.0")]
namespace OpenSim.Region.OptionalModules.Example.BareBonesShared namespace OpenSim.Region.OptionalModules.Example.BareBonesShared
{ {
/// <summary> /// <summary>

View File

@ -11728,14 +11728,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return UUID.Zero.ToString(); return UUID.Zero.ToString();
} }
string reqIdentifier = UUID.Random().ToString();
// was: UUID tid = tid = AsyncCommands. // 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)) if (NotecardCache.IsCached(assetID))
{ {
AsyncCommands. AsyncCommands.DataserverPlugin.DataserverReply(reqIdentifier, NotecardCache.GetLines(assetID).ToString());
DataserverPlugin.DataserverReply(assetID.ToString(),
NotecardCache.GetLines(assetID).ToString());
ScriptSleep(100); ScriptSleep(100);
return tid.ToString(); return tid.ToString();
} }
@ -11751,9 +11752,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
string data = Encoding.UTF8.GetString(a.Data); string data = Encoding.UTF8.GetString(a.Data);
//m_log.Debug(data); //m_log.Debug(data);
NotecardCache.Cache(id, data); NotecardCache.Cache(id, data);
AsyncCommands. AsyncCommands.DataserverPlugin.DataserverReply(reqIdentifier, NotecardCache.GetLines(id).ToString());
DataserverPlugin.DataserverReply(id.ToString(),
NotecardCache.GetLines(id).ToString());
}); });
ScriptSleep(100); ScriptSleep(100);
@ -11782,13 +11781,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return UUID.Zero.ToString(); return UUID.Zero.ToString();
} }
string reqIdentifier = UUID.Random().ToString();
// was: UUID tid = tid = AsyncCommands. // 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)) if (NotecardCache.IsCached(assetID))
{ {
AsyncCommands.DataserverPlugin.DataserverReply(assetID.ToString(), AsyncCommands.DataserverPlugin.DataserverReply(
NotecardCache.GetLine(assetID, line, m_notecardLineReadCharsMax)); reqIdentifier, NotecardCache.GetLine(assetID, line, m_notecardLineReadCharsMax));
ScriptSleep(100); ScriptSleep(100);
return tid.ToString(); return tid.ToString();
} }
@ -11804,8 +11806,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
string data = Encoding.UTF8.GetString(a.Data); string data = Encoding.UTF8.GetString(a.Data);
//m_log.Debug(data); //m_log.Debug(data);
NotecardCache.Cache(id, data); NotecardCache.Cache(id, data);
AsyncCommands.DataserverPlugin.DataserverReply(id.ToString(), AsyncCommands.DataserverPlugin.DataserverReply(
NotecardCache.GetLine(id, line, m_notecardLineReadCharsMax)); reqIdentifier, NotecardCache.GetLine(assetID, line, m_notecardLineReadCharsMax));
}); });
ScriptSleep(100); ScriptSleep(100);
@ -13287,7 +13289,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public static void Cache(UUID assetID, string text) public static void Cache(UUID assetID, string text)
{ {
CacheCheck(); CheckCache();
lock (m_Notecards) lock (m_Notecards)
{ {
@ -13372,7 +13374,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return line; return line;
} }
public static void CacheCheck() public static void CheckCache()
{
lock (m_Notecards)
{ {
foreach (UUID key in new List<UUID>(m_Notecards.Keys)) foreach (UUID key in new List<UUID>(m_Notecards.Keys))
{ {
@ -13383,3 +13387,4 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
} }
} }
} }
}

View File

@ -29,7 +29,6 @@ using System;
using System.Reflection; using System.Reflection;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Reflection;
using System.Runtime.Remoting.Lifetime; using System.Runtime.Remoting.Lifetime;
using System.Threading; using System.Threading;
using log4net; using log4net;

View File

@ -2173,7 +2173,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
IConfigSource config = m_ScriptEngine.ConfigSource; IConfigSource config = m_ScriptEngine.ConfigSource;
string HomeURI = Util.GetConfigVarFromSections<string>(config, "HomeURI", new string[]{"Startup"}); string HomeURI = Util.GetConfigVarFromSections<string>(config, "HomeURI",
new string[] { "Startup", "Hypergrid" }, String.Empty);
if (!string.IsNullOrEmpty(HomeURI)) if (!string.IsNullOrEmpty(HomeURI))
return HomeURI; return HomeURI;
@ -2194,7 +2195,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
IConfigSource config = m_ScriptEngine.ConfigSource; IConfigSource config = m_ScriptEngine.ConfigSource;
string gatekeeperURI = Util.GetConfigVarFromSections<string>(config, "GatekeeperURI", new string[] {"Startup"}); string gatekeeperURI = Util.GetConfigVarFromSections<string>(config, "GatekeeperURI",
new string[] { "Startup", "Hypergrid" }, String.Empty);
if (!string.IsNullOrEmpty(gatekeeperURI)) if (!string.IsNullOrEmpty(gatekeeperURI))
return gatekeeperURI; return gatekeeperURI;

View File

@ -93,7 +93,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
// FIXME: This should really be a script item (with accompanying script) // FIXME: This should really be a script item (with accompanying script)
TaskInventoryItem grp1Item TaskInventoryItem grp1Item
= TaskInventoryHelpers.AddNotecard( = 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; grp1Item.PermsMask |= ScriptBaseClass.PERMISSION_CHANGE_LINKS;
SceneObjectGroup grp2 = SceneHelpers.CreateSceneObject(2, ownerId, "grp2-", 0x20); 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) // FIXME: This should really be a script item (with accompanying script)
TaskInventoryItem grp1Item TaskInventoryItem grp1Item
= TaskInventoryHelpers.AddNotecard( = 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; grp1Item.PermsMask |= ScriptBaseClass.PERMISSION_CHANGE_LINKS;

View File

@ -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));
// }
// }
// }
// }
}
}

View File

@ -151,7 +151,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
// Create an object embedded inside the first // Create an object embedded inside the first
TaskInventoryHelpers.AddNotecard( 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; bool exceptionCaught = false;

View File

@ -177,7 +177,8 @@ namespace OpenSim.Server.Handlers.Grid
map[k] = OSD.FromString(_info[k].ToString()); map[k] = OSD.FromString(_info[k].ToString());
} }
string HomeURI = Util.GetConfigVarFromSections<string>(m_Config, "HomeURI", new string[] {"Startup"}); string HomeURI = Util.GetConfigVarFromSections<string>(m_Config, "HomeURI",
new string[] { "Startup", "Hypergrid" }, String.Empty);
if (!String.IsNullOrEmpty(HomeURI)) if (!String.IsNullOrEmpty(HomeURI))
map["home"] = OSD.FromString(HomeURI); map["home"] = OSD.FromString(HomeURI);

View File

@ -128,7 +128,8 @@ namespace OpenSim.Services.GridService
m_MapTileDirectory = gridConfig.GetString("MapTileDirectory", "maptiles"); m_MapTileDirectory = gridConfig.GetString("MapTileDirectory", "maptiles");
m_ThisGatekeeper = Util.GetConfigVarFromSections<string>(config, "GatekeeperURI", new string[] {"Startup", "GridService"}); m_ThisGatekeeper = Util.GetConfigVarFromSections<string>(config, "GatekeeperURI",
new string[] { "Startup", "Hypergrid", "GridService" }, String.Empty);
// Legacy. Remove soon! // Legacy. Remove soon!
m_ThisGatekeeper = gridConfig.GetString("Gatekeeper", m_ThisGatekeeper); m_ThisGatekeeper = gridConfig.GetString("Gatekeeper", m_ThisGatekeeper);
try try

View File

@ -96,7 +96,8 @@ namespace OpenSim.Services.HypergridService
UUID.TryParse(scope, out m_ScopeID); UUID.TryParse(scope, out m_ScopeID);
//m_WelcomeMessage = serverConfig.GetString("WelcomeMessage", "Welcome to OpenSim!"); //m_WelcomeMessage = serverConfig.GetString("WelcomeMessage", "Welcome to OpenSim!");
m_AllowTeleportsToAnyRegion = serverConfig.GetBoolean("AllowTeleportsToAnyRegion", true); m_AllowTeleportsToAnyRegion = serverConfig.GetBoolean("AllowTeleportsToAnyRegion", true);
m_ExternalName = Util.GetConfigVarFromSections<string>(config, "GatekeeperURI", new string[] {"Startup", "GatekeeperService"}); m_ExternalName = Util.GetConfigVarFromSections<string>(config, "GatekeeperURI",
new string[] { "Startup", "Hypergrid", "GatekeeperService" }, String.Empty);
m_ExternalName = serverConfig.GetString("ExternalName", m_ExternalName); m_ExternalName = serverConfig.GetString("ExternalName", m_ExternalName);
if (m_ExternalName != string.Empty && !m_ExternalName.EndsWith("/")) if (m_ExternalName != string.Empty && !m_ExternalName.EndsWith("/"))
m_ExternalName = m_ExternalName + "/"; m_ExternalName = m_ExternalName + "/";

View File

@ -81,7 +81,8 @@ namespace OpenSim.Services.HypergridService
if (m_UserAccountService == null) if (m_UserAccountService == null)
throw new Exception(String.Format("Unable to create UserAccountService from {0}", userAccountsDll)); throw new Exception(String.Format("Unable to create UserAccountService from {0}", userAccountsDll));
m_HomeURL = Util.GetConfigVarFromSections<string>(config, "HomeURI", new string[] {"Startup", m_ConfigName}); m_HomeURL = Util.GetConfigVarFromSections<string>(config, "HomeURI",
new string[] { "Startup", "Hypergrid", m_ConfigName }, String.Empty);
m_Cache = UserAccountCache.CreateUserAccountCache(m_UserAccountService); m_Cache = UserAccountCache.CreateUserAccountCache(m_UserAccountService);
} }

View File

@ -96,7 +96,8 @@ namespace OpenSim.Services.HypergridService
if (m_AvatarService == null) if (m_AvatarService == null)
throw new Exception(String.Format("Unable to create m_AvatarService from {0}", avatarDll)); throw new Exception(String.Format("Unable to create m_AvatarService from {0}", avatarDll));
m_HomeURL = Util.GetConfigVarFromSections<string>(config, "HomeURI", new string[] {"Startup", m_ConfigName}); m_HomeURL = Util.GetConfigVarFromSections<string>(config, "HomeURI",
new string[] { "Startup", "Hypergrid", m_ConfigName }, String.Empty);
// m_Cache = UserAccountCache.CreateUserAccountCache(m_UserAccountService); // m_Cache = UserAccountCache.CreateUserAccountCache(m_UserAccountService);
} }

View File

@ -131,7 +131,8 @@ namespace OpenSim.Services.HypergridService
LoadDomainExceptionsFromConfig(serverConfig, "AllowExcept", m_TripsAllowedExceptions); LoadDomainExceptionsFromConfig(serverConfig, "AllowExcept", m_TripsAllowedExceptions);
LoadDomainExceptionsFromConfig(serverConfig, "DisallowExcept", m_TripsDisallowedExceptions); LoadDomainExceptionsFromConfig(serverConfig, "DisallowExcept", m_TripsDisallowedExceptions);
m_GridName = Util.GetConfigVarFromSections<string>(config, "GatekeeperURI", new string[] {"Startup", "UserAgentService"}); m_GridName = Util.GetConfigVarFromSections<string>(config, "GatekeeperURI",
new string[] { "Startup", "Hypergrid", "UserAgentService" }, String.Empty);
if (string.IsNullOrEmpty(m_GridName)) // Legacy. Remove soon. if (string.IsNullOrEmpty(m_GridName)) // Legacy. Remove soon.
{ {
m_GridName = serverConfig.GetString("ExternalName", string.Empty); m_GridName = serverConfig.GetString("ExternalName", string.Empty);

View File

@ -110,7 +110,8 @@ namespace OpenSim.Services.LLLoginService
m_RequireInventory = m_LoginServerConfig.GetBoolean("RequireInventory", true); m_RequireInventory = m_LoginServerConfig.GetBoolean("RequireInventory", true);
m_AllowRemoteSetLoginLevel = m_LoginServerConfig.GetBoolean("AllowRemoteSetLoginLevel", false); m_AllowRemoteSetLoginLevel = m_LoginServerConfig.GetBoolean("AllowRemoteSetLoginLevel", false);
m_MinLoginLevel = m_LoginServerConfig.GetInt("MinLoginLevel", 0); m_MinLoginLevel = m_LoginServerConfig.GetInt("MinLoginLevel", 0);
m_GatekeeperURL = Util.GetConfigVarFromSections<string>(config, "GatekeeperURI", new string[] {"Startup", "LoginService"}); m_GatekeeperURL = Util.GetConfigVarFromSections<string>(config, "GatekeeperURI",
new string[] { "Startup", "Hypergrid", "LoginService" }, String.Empty);
m_MapTileURL = m_LoginServerConfig.GetString("MapTileURL", string.Empty); m_MapTileURL = m_LoginServerConfig.GetString("MapTileURL", string.Empty);
m_ProfileURL = m_LoginServerConfig.GetString("ProfileServerURL", string.Empty); m_ProfileURL = m_LoginServerConfig.GetString("ProfileServerURL", string.Empty);
m_OpenIDURL = m_LoginServerConfig.GetString("OpenIDServerURL", String.Empty); m_OpenIDURL = m_LoginServerConfig.GetString("OpenIDServerURL", String.Empty);

View File

@ -40,6 +40,23 @@ namespace OpenSim.Tests.Common
/// ///
public static class TaskInventoryHelpers 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> /// <summary>
/// Add a notecard item to the given part. /// Add a notecard item to the given part.
/// </summary> /// </summary>
@ -48,11 +65,13 @@ namespace OpenSim.Tests.Common
/// <param name="itemName"></param> /// <param name="itemName"></param>
/// <param name="itemID"></param> /// <param name="itemID"></param>
/// <param name="assetID"></param> /// <param name="assetID"></param>
/// <param name="text">The tex to put in the notecard.</param>
/// <returns>The item that was added</returns> /// <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(); AssetNotecard nc = new AssetNotecard();
nc.BodyText = "Hello World!"; nc.BodyText = text;
nc.Encode(); nc.Encode();
AssetBase ncAsset AssetBase ncAsset
@ -87,8 +106,8 @@ namespace OpenSim.Tests.Common
/// Add a simple script to the given part. /// Add a simple script to the given part.
/// </summary> /// </summary>
/// <remarks> /// <remarks>
/// TODO: Accept input for item and asset IDs to avoid mysterious script failures that try to use any of these /// TODO: Accept input for item and asset IDs so that we have completely replicatable regression tests rather
/// functions more than once in a test. /// than a random component.
/// </remarks> /// </remarks>
/// <param name="scene"></param> /// <param name="scene"></param>
/// <param name="part"></param> /// <param name="part"></param>
@ -102,8 +121,9 @@ namespace OpenSim.Tests.Common
ast.Source = scriptSource; ast.Source = scriptSource;
ast.Encode(); ast.Encode();
UUID assetUuid = new UUID("00000000-0000-0000-1000-000000000000"); UUID assetUuid = UUID.Random();
UUID itemUuid = new UUID("00000000-0000-0000-1100-000000000000"); UUID itemUuid = UUID.Random();
AssetBase asset AssetBase asset
= AssetHelpers.CreateAsset(assetUuid, AssetType.LSLText, ast.AssetData, UUID.Zero); = AssetHelpers.CreateAsset(assetUuid, AssetType.LSLText, ast.AssetData, UUID.Zero);
scene.AssetService.Store(asset); scene.AssetService.Store(asset);

View File

@ -31,6 +31,7 @@ using System.Collections.Generic;
using System.Reflection; using System.Reflection;
using Nini.Config; using Nini.Config;
using OpenMetaverse; using OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes;
using OpenSim.Region.ScriptEngine.Interfaces; using OpenSim.Region.ScriptEngine.Interfaces;
@ -110,8 +111,11 @@ namespace OpenSim.Tests.Common
{ {
// Console.WriteLine("Posting event {0} for {1}", name, itemID); // 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; List<EventParams> eventsForItem;
if (!PostedEvents.ContainsKey(itemID)) if (!PostedEvents.ContainsKey(itemID))
@ -132,9 +136,22 @@ namespace OpenSim.Tests.Common
return true; 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) 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) public void SuspendScript(UUID itemID)
@ -187,16 +204,6 @@ namespace OpenSim.Tests.Common
throw new System.NotImplementedException (); 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) public DetectParams GetDetectParams(UUID item, int number)
{ {
throw new System.NotImplementedException (); throw new System.NotImplementedException ();

View File

@ -113,6 +113,27 @@ namespace OpenSim.Tests.Common
DisableLoggingConfigStream.Position = 0; 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> /// <summary>
/// Parse tail section into full UUID. /// Parse tail section into full UUID.
/// </summary> /// </summary>

View File

@ -45,7 +45,7 @@ namespace OpenSim.Tests
/// Set up a test directory. /// Set up a test directory.
/// </summary> /// </summary>
[SetUp] [SetUp]
public void SetUp() public override void SetUp()
{ {
base.SetUp(); base.SetUp();

View File

@ -316,23 +316,6 @@
;; - "Imprudence 1.3.1" has access ;; - "Imprudence 1.3.1" has access
; BannedViewerList = ; BannedViewerList =
;# {HomeURI} {Hypergrid} {The Home URL of this world} {}
;; If this is a standalone world, this is the address of this instance.
;; If this is a grided simulator, this is the address of the external robust server that
;; runs the UserAgentsService.
;; For example http://myworld.com:9000 or http://myworld.com:8002
;; This is a default that can be overwritten in some sections.
; HomeURI = "http://127.0.0.1:9000"
;# {GatekeeperURI} {Hypergrid} {The URL of the gatekeeper of this world} {}
;; If this is a standalone world, this is the address of this instance.
;; If this is a grided simulator, this is the address of the external robust server
;; that runs the Gatekeeper service.
;; For example http://myworld.com:9000 or http://myworld.com:8002
;; This is a default that can be overwritten in some sections.
; GatekeeperURI = "http://127.0.0.1:9000"
[Map] [Map]
;# {GenerateMaptiles} {} {Generate map tiles?} {true false} true ;# {GenerateMaptiles} {} {Generate map tiles?} {true false} true
;; Map tile options. ;; Map tile options.

View File

@ -34,25 +34,12 @@
; The Robust.exe process must hvae R/W access to the location ; The Robust.exe process must hvae R/W access to the location
ConfigDirectory = "/home/opensim/etc/Configs" ConfigDirectory = "/home/opensim/etc/Configs"
;# {HomeURI} {Hypergrid} {The Home URL of this world} {}
;; This is the address of the external robust server that
;; runs the UserAgentsService, possibly this server.
;; For example http://myworld.com:8002
;; This is a default that can be overwritten in some sections.
; HomeURI = "http://127.0.0.1:8002"
;# {GatekeeperURI} {Hypergrid} {The URL of the gatekeeper of this world} {}
;; This is the address of the external robust server
;; that runs the Gatekeeper service, possibly this server.
;; For example http://myworld.com:8002
;; This is a default that can be overwritten in some sections.
; GatekeeperURI = "http://127.0.0.1:8002"
[ServiceList] [ServiceList]
AssetServiceConnector = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector" AssetServiceConnector = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector"
InventoryInConnector = "8003/OpenSim.Server.Handlers.dll:XInventoryInConnector" InventoryInConnector = "8003/OpenSim.Server.Handlers.dll:XInventoryInConnector"
VoiceConnector = "8004/OpenSim.Server.Handlers.dll:FreeswitchServerConnector" ;; Uncomment if you have set up Freeswitch (see [FreeswitchService] below)
;VoiceConnector = "8004/OpenSim.Server.Handlers.dll:FreeswitchServerConnector"
GridServiceConnector = "8003/OpenSim.Server.Handlers.dll:GridServiceConnector" GridServiceConnector = "8003/OpenSim.Server.Handlers.dll:GridServiceConnector"
GridInfoServerInConnector = "8002/OpenSim.Server.Handlers.dll:GridInfoServerInConnector" GridInfoServerInConnector = "8002/OpenSim.Server.Handlers.dll:GridInfoServerInConnector"
AuthenticationServiceConnector = "8003/OpenSim.Server.Handlers.dll:AuthenticationServiceConnector" AuthenticationServiceConnector = "8003/OpenSim.Server.Handlers.dll:AuthenticationServiceConnector"
@ -118,6 +105,21 @@ HGAssetServiceConnector = "HGAssetService@8002/OpenSim.Server.Handlers.dll:Asset
;ConsolePass = secret ;ConsolePass = secret
;ConsolePort = 0 ;ConsolePort = 0
[Hypergrid]
;# {HomeURI} {Hypergrid} {The Home URL of this world} {}
;; This is the address of the external robust server that
;; runs the UserAgentsService, possibly this server.
;; For example http://myworld.com:8002
;; This is a default that can be overwritten in some sections.
; HomeURI = "http://127.0.0.1:8002"
;# {GatekeeperURI} {Hypergrid} {The URL of the gatekeeper of this world} {}
;; This is the address of the external robust server
;; that runs the Gatekeeper service, possibly this server.
;; For example http://myworld.com:8002
;; This is a default that can be overwritten in some sections.
; GatekeeperURI = "http://127.0.0.1:8002"
[DatabaseService] [DatabaseService]
StorageProvider = "OpenSim.Data.MySQL.dll" StorageProvider = "OpenSim.Data.MySQL.dll"
ConnectionString = "Data Source=localhost;Database=opensim;User ID=opensim;Password=*****;Old Guids=true;" ConnectionString = "Data Source=localhost;Database=opensim;User ID=opensim;Password=*****;Old Guids=true;"

View File

@ -30,7 +30,8 @@
[ServiceList] [ServiceList]
AssetServiceConnector = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector" AssetServiceConnector = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector"
InventoryInConnector = "8003/OpenSim.Server.Handlers.dll:XInventoryInConnector" InventoryInConnector = "8003/OpenSim.Server.Handlers.dll:XInventoryInConnector"
VoiceConnector = "8004/OpenSim.Server.Handlers.dll:FreeswitchServerConnector" ;; Uncomment if you have set up Freeswitch (see [FreeswitchService] below)
;VoiceConnector = "8004/OpenSim.Server.Handlers.dll:FreeswitchServerConnector"
GridServiceConnector = "8003/OpenSim.Server.Handlers.dll:GridServiceConnector" GridServiceConnector = "8003/OpenSim.Server.Handlers.dll:GridServiceConnector"
GridInfoServerInConnector = "8002/OpenSim.Server.Handlers.dll:GridInfoServerInConnector" GridInfoServerInConnector = "8002/OpenSim.Server.Handlers.dll:GridInfoServerInConnector"
AuthenticationServiceConnector = "8003/OpenSim.Server.Handlers.dll:AuthenticationServiceConnector" AuthenticationServiceConnector = "8003/OpenSim.Server.Handlers.dll:AuthenticationServiceConnector"

View File

@ -26,6 +26,26 @@
;StorageProvider = "OpenSim.Data.MSSQL.dll" ;StorageProvider = "OpenSim.Data.MSSQL.dll"
;ConnectionString = "Server=localhost\SQLEXPRESS;Database=opensim;User Id=opensim; password=***;" ;ConnectionString = "Server=localhost\SQLEXPRESS;Database=opensim;User Id=opensim; password=***;"
[Hypergrid]
; Uncomment the variables in this section only if you are in
; Hypergrid configuration. Otherwise, ignore.
;# {HomeURI} {Hypergrid} {The Home URL of this world} {}
;; If this is a standalone world, this is the address of this instance.
;; If this is a grided simulator, this is the address of the external robust server that
;; runs the UserAgentsService.
;; For example http://myworld.com:9000 or http://myworld.com:8002
;; This is a default that can be overwritten in some sections.
; HomeURI = "http://127.0.0.1:9000"
;# {GatekeeperURI} {Hypergrid} {The URL of the gatekeeper of this world} {}
;; If this is a standalone world, this is the address of this instance.
;; If this is a grided simulator, this is the address of the external robust server
;; that runs the Gatekeeper service.
;; For example http://myworld.com:9000 or http://myworld.com:8002
;; This is a default that can be overwritten in some sections.
; GatekeeperURI = "http://127.0.0.1:9000"
[Modules] [Modules]
;; Choose one cache module and the corresponding config file, if it exists. ;; Choose one cache module and the corresponding config file, if it exists.
;; Copy the config .example file into your own .ini file and adapt that. ;; Copy the config .example file into your own .ini file and adapt that.

View File

@ -27,6 +27,27 @@
;StorageProvider = "OpenSim.Data.MSSQL.dll" ;StorageProvider = "OpenSim.Data.MSSQL.dll"
;ConnectionString = "Server=localhost\SQLEXPRESS;Database=opensim;User Id=opensim; password=***;" ;ConnectionString = "Server=localhost\SQLEXPRESS;Database=opensim;User Id=opensim; password=***;"
[Hypergrid]
; Uncomment the variables in this section only if you are in
; Hypergrid configuration. Otherwise, ignore.
;# {HomeURI} {Hypergrid} {The Home URL of this world} {}
;; If this is a standalone world, this is the address of this instance.
;; If this is a grided simulator, this is the address of the external robust server that
;; runs the UserAgentsService.
;; For example http://myworld.com:9000 or http://myworld.com:8002
;; This is a default that can be overwritten in some sections.
; HomeURI = "http://127.0.0.1:9000"
;# {GatekeeperURI} {Hypergrid} {The URL of the gatekeeper of this world} {}
;; If this is a standalone world, this is the address of this instance.
;; If this is a grided simulator, this is the address of the external robust server
;; that runs the Gatekeeper service.
;; For example http://myworld.com:9000 or http://myworld.com:8002
;; This is a default that can be overwritten in some sections.
; GatekeeperURI = "http://127.0.0.1:9000"
[Modules] [Modules]
;; Choose one cache module and the corresponding config file, if it exists. ;; Choose one cache module and the corresponding config file, if it exists.
;; Copy the config .example file into your own .ini file and alter that ;; Copy the config .example file into your own .ini file and alter that