aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--.nant/local.include11
-rw-r--r--OpenSim/Services/InventoryService/Tests/XInventoryServiceTests.cs87
-rw-r--r--prebuild.xml46
3 files changed, 143 insertions, 1 deletions
diff --git a/.nant/local.include b/.nant/local.include
index 35f0058..9c9aa28 100644
--- a/.nant/local.include
+++ b/.nant/local.include
@@ -132,6 +132,11 @@
132 </exec> 132 </exec>
133 <fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.capabilities.handlers.tests)==0}" /> 133 <fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.capabilities.handlers.tests)==0}" />
134 134
135 <exec program="${nunitcmd}" failonerror="true" resultproperty="testresult.opensim.services.inventoryservice.tests">
136 <arg value="./bin/OpenSim.Services.InventoryService.Tests.dll" />
137 </exec>
138 <fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.services.inventoryservice.tests)==0}" />
139
135 <delete dir="%temp%"/> 140 <delete dir="%temp%"/>
136</target> 141</target>
137 142
@@ -235,6 +240,11 @@
235 <arg value="-xml=test-results/OpenSim.Capabilities.Handlers.Tests.dll-Results.xml" /> 240 <arg value="-xml=test-results/OpenSim.Capabilities.Handlers.Tests.dll-Results.xml" />
236 </exec> 241 </exec>
237 242
243 <exec program="${nunitcmd}" failonerror="false" resultproperty="testresult.opensim.services.inventoryservice.tests">
244 <arg value="./bin/OpenSim.Services.InventoryService.Tests.dll" />
245 <arg value="-xml=test-results/OpenSim.Services.InventoryService.Tests.dll-Results.xml" />
246 </exec>
247
238 <fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.tests)==0}" /> 248 <fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.tests)==0}" />
239 <fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.framework.tests)==0}" /> 249 <fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.framework.tests)==0}" />
240 <fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.framework.servers.tests)==0}" /> 250 <fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.framework.servers.tests)==0}" />
@@ -245,6 +255,7 @@
245 <fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.region.framework.tests)==0}" /> 255 <fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.region.framework.tests)==0}" />
246 <fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.data.tests)==0}" /> 256 <fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.data.tests)==0}" />
247 <fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.capabilities.handlers.tests)==0}" /> 257 <fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.capabilities.handlers.tests)==0}" />
258 <fail message="Failures reported in unit tests." unless="${int::parse(testresult.opensim.services.inventoryservice.tests)==0}" />
248</target> 259</target>
249 260
250<target name="doxygen"> 261<target name="doxygen">
diff --git a/OpenSim/Services/InventoryService/Tests/XInventoryServiceTests.cs b/OpenSim/Services/InventoryService/Tests/XInventoryServiceTests.cs
new file mode 100644
index 0000000..d2356c5
--- /dev/null
+++ b/OpenSim/Services/InventoryService/Tests/XInventoryServiceTests.cs
@@ -0,0 +1,87 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using Nini.Config;
30using NUnit.Framework;
31using OpenMetaverse;
32using OpenSim.Framework;
33using OpenSim.Server.Base;
34using OpenSim.Services.Interfaces;
35using OpenSim.Tests.Common;
36
37namespace OpenSim.Services.InventoryService.Tests
38{
39 /// <summary>
40 /// Tests for the XInventoryService
41 /// </summary>
42 /// <remarks>
43 /// TODO: Fill out more tests.
44 /// </remarks>
45 [TestFixture]
46 public class XInventoryServiceTests
47 {
48 /// <summary>
49 /// Tests add item operation.
50 /// </summary>
51 /// <remarks>
52 /// TODO: Test all operations.
53 /// </remarks>
54 [Test]
55 public void TestAddItem()
56 {
57 string creatorId = TestHelpers.ParseTail(0x1).ToString();
58 UUID ownerId = TestHelpers.ParseTail(0x2);
59 UUID itemId = TestHelpers.ParseTail(0x10);
60 UUID assetId = TestHelpers.ParseTail(0x20);
61 string itemName = "item1";
62
63 IConfigSource config = new IniConfigSource();
64 config.AddConfig("InventoryService");
65 config.Configs["InventoryService"].Set("StorageProvider", "OpenSim.Tests.Common.dll");
66
67 IInventoryService xis
68 = ServerUtils.LoadPlugin<IInventoryService>(
69 "OpenSim.Services.InventoryService.dll:XInventoryService", new Object[] { config });
70
71 InventoryItemBase itemToStore
72 = new InventoryItemBase(itemId, ownerId)
73 { CreatorId = creatorId.ToString(), AssetID = assetId, Name = itemName };
74
75 xis.AddItem(itemToStore);
76
77 InventoryItemBase itemRetrieved = new InventoryItemBase(itemId);
78 itemRetrieved = xis.GetItem(itemRetrieved);
79
80 Assert.That(itemRetrieved, Is.Not.Null);
81 Assert.That(itemRetrieved.CreatorId, Is.EqualTo(creatorId));
82 Assert.That(itemRetrieved.Owner, Is.EqualTo(ownerId));
83 Assert.That(itemRetrieved.AssetID, Is.EqualTo(assetId));
84 Assert.That(itemRetrieved.Name, Is.EqualTo(itemName));
85 }
86 }
87} \ No newline at end of file
diff --git a/prebuild.xml b/prebuild.xml
index aca0c49..7694861 100644
--- a/prebuild.xml
+++ b/prebuild.xml
@@ -1124,7 +1124,9 @@
1124 <Reference name="log4net" path="../../../bin/"/> 1124 <Reference name="log4net" path="../../../bin/"/>
1125 1125
1126 <Files> 1126 <Files>
1127 <Match pattern="*.cs" recurse="true"/> 1127 <Match pattern="*.cs" recurse="true">
1128 <Exclude name="Tests" pattern="Tests"/>
1129 </Match>
1128 </Files> 1130 </Files>
1129 </Project> 1131 </Project>
1130 1132
@@ -2719,6 +2721,48 @@
2719 </Files> 2721 </Files>
2720 </Project> 2722 </Project>
2721 2723
2724 <Project frameworkVersion="v3_5" name="OpenSim.Services.InventoryService.Tests" path="OpenSim/Services/InventoryService/Tests" type="Library">
2725 <Configuration name="Debug">
2726 <Options>
2727 <OutputPath>../../../../bin/</OutputPath>
2728 </Options>
2729 </Configuration>
2730 <Configuration name="Release">
2731 <Options>
2732 <OutputPath>../../../../bin/</OutputPath>
2733 </Options>
2734 </Configuration>
2735
2736 <ReferencePath>../../../../bin/</ReferencePath>
2737 <Reference name="System"/>
2738 <Reference name="System.Core"/>
2739 <Reference name="System.Drawing"/>
2740 <Reference name="System.Xml"/>
2741 <Reference name="System.Web"/>
2742 <Reference name="nunit.framework" path="../../../../bin/"/>
2743 <Reference name="OpenMetaverse" path="../../../../bin/"/>
2744 <Reference name="OpenMetaverseTypes" path="../../../../bin/"/>
2745 <Reference name="OpenMetaverse.StructuredData" path="../../../../bin/"/>
2746 <Reference name="OpenSim.Capabilities"/>
2747 <Reference name="OpenSim.Capabilities.Handlers"/>
2748 <Reference name="OpenSim.Framework"/>
2749 <Reference name="OpenSim.Framework.Console"/>
2750 <Reference name="OpenSim.Framework.Servers.HttpServer"/>
2751 <Reference name="OpenSim.Region.Framework"/>
2752 <Reference name="OpenSim.Server.Base"/>
2753 <Reference name="OpenSim.Server.Handlers"/>
2754 <Reference name="OpenSim.Services.Base"/>
2755 <Reference name="OpenSim.Services.Interfaces"/>
2756 <Reference name="OpenSim.Tests.Common"/>
2757 <Reference name="Nini" path="../../../../bin/"/>
2758 <Reference name="log4net" path="../../../../bin/"/>
2759
2760 <Files>
2761 <Match pattern="*.cs" recurse="true">
2762 </Match>
2763 </Files>
2764 </Project>
2765
2722 2766
2723 <Project frameworkVersion="v3_5" name="OpenSim.Capabilities.Handlers.Tests" path="OpenSim/Capabilities/Handlers" type="Library"> 2767 <Project frameworkVersion="v3_5" name="OpenSim.Capabilities.Handlers.Tests" path="OpenSim/Capabilities/Handlers" type="Library">
2724 <Configuration name="Debug"> 2768 <Configuration name="Debug">