fix svn properties
parent
6d36985bbc
commit
f532767c6a
|
@ -1,93 +1,93 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using OpenSim.Data;
|
using OpenSim.Data;
|
||||||
using OpenSim.Tests.Common;
|
using OpenSim.Tests.Common;
|
||||||
|
|
||||||
namespace OpenSim.Framework.Servers.Tests
|
namespace OpenSim.Framework.Servers.Tests
|
||||||
{
|
{
|
||||||
[TestFixture]
|
[TestFixture]
|
||||||
public class GetAssetStreamHandlerTests
|
public class GetAssetStreamHandlerTests
|
||||||
{
|
{
|
||||||
[Test]
|
[Test]
|
||||||
public void TestConstructor()
|
public void TestConstructor()
|
||||||
{
|
{
|
||||||
TestHelper.InMethod();
|
TestHelper.InMethod();
|
||||||
|
|
||||||
GetAssetStreamHandler handler = new GetAssetStreamHandler( null );
|
GetAssetStreamHandler handler = new GetAssetStreamHandler( null );
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestGetParams()
|
public void TestGetParams()
|
||||||
{
|
{
|
||||||
TestHelper.InMethod();
|
TestHelper.InMethod();
|
||||||
|
|
||||||
GetAssetStreamHandler handler = new GetAssetStreamHandler(null);
|
GetAssetStreamHandler handler = new GetAssetStreamHandler(null);
|
||||||
|
|
||||||
Assert.AreEqual("", handler.GetParam(null), "Failed on null path.");
|
Assert.AreEqual("", handler.GetParam(null), "Failed on null path.");
|
||||||
Assert.AreEqual("", handler.GetParam(""), "Failed on empty path.");
|
Assert.AreEqual("", handler.GetParam(""), "Failed on empty path.");
|
||||||
Assert.AreEqual("", handler.GetParam("s"), "Failed on short url.");
|
Assert.AreEqual("", handler.GetParam("s"), "Failed on short url.");
|
||||||
Assert.AreEqual("", handler.GetParam("corruptUrl"), "Failed on corruptUrl.");
|
Assert.AreEqual("", handler.GetParam("corruptUrl"), "Failed on corruptUrl.");
|
||||||
|
|
||||||
Assert.AreEqual("", handler.GetParam("/assets"));
|
Assert.AreEqual("", handler.GetParam("/assets"));
|
||||||
Assert.AreEqual("/", handler.GetParam("/assets/"));
|
Assert.AreEqual("/", handler.GetParam("/assets/"));
|
||||||
Assert.AreEqual("/a", handler.GetParam("/assets/a"));
|
Assert.AreEqual("/a", handler.GetParam("/assets/a"));
|
||||||
Assert.AreEqual("/b/", handler.GetParam("/assets/b/"));
|
Assert.AreEqual("/b/", handler.GetParam("/assets/b/"));
|
||||||
Assert.AreEqual("/c/d", handler.GetParam("/assets/c/d"));
|
Assert.AreEqual("/c/d", handler.GetParam("/assets/c/d"));
|
||||||
Assert.AreEqual("/e/f/", handler.GetParam("/assets/e/f/"));
|
Assert.AreEqual("/e/f/", handler.GetParam("/assets/e/f/"));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestSplitParams()
|
public void TestSplitParams()
|
||||||
{
|
{
|
||||||
TestHelper.InMethod();
|
TestHelper.InMethod();
|
||||||
|
|
||||||
GetAssetStreamHandler handler = new GetAssetStreamHandler(null);
|
GetAssetStreamHandler handler = new GetAssetStreamHandler(null);
|
||||||
|
|
||||||
Assert.AreEqual(new string[] { }, handler.SplitParams(null), "Failed on null.");
|
Assert.AreEqual(new string[] { }, handler.SplitParams(null), "Failed on null.");
|
||||||
Assert.AreEqual(new string[] { }, handler.SplitParams(""), "Failed on empty path.");
|
Assert.AreEqual(new string[] { }, handler.SplitParams(""), "Failed on empty path.");
|
||||||
Assert.AreEqual(new string[] { }, handler.SplitParams("corruptUrl"), "Failed on corrupt url.");
|
Assert.AreEqual(new string[] { }, handler.SplitParams("corruptUrl"), "Failed on corrupt url.");
|
||||||
|
|
||||||
Assert.AreEqual(new string[] { }, handler.SplitParams("/assets"), "Failed on empty params.");
|
Assert.AreEqual(new string[] { }, handler.SplitParams("/assets"), "Failed on empty params.");
|
||||||
Assert.AreEqual(new string[] { }, handler.SplitParams("/assets/"), "Failed on single slash.");
|
Assert.AreEqual(new string[] { }, handler.SplitParams("/assets/"), "Failed on single slash.");
|
||||||
Assert.AreEqual(new string[] { "a" }, handler.SplitParams("/assets/a"), "Failed on first segment.");
|
Assert.AreEqual(new string[] { "a" }, handler.SplitParams("/assets/a"), "Failed on first segment.");
|
||||||
Assert.AreEqual(new string[] { "b" }, handler.SplitParams("/assets/b/"), "Failed on second slash.");
|
Assert.AreEqual(new string[] { "b" }, handler.SplitParams("/assets/b/"), "Failed on second slash.");
|
||||||
Assert.AreEqual(new string[] { "c", "d" }, handler.SplitParams("/assets/c/d"), "Failed on second segment.");
|
Assert.AreEqual(new string[] { "c", "d" }, handler.SplitParams("/assets/c/d"), "Failed on second segment.");
|
||||||
Assert.AreEqual(new string[] { "e", "f" }, handler.SplitParams("/assets/e/f/"), "Failed on trailing slash.");
|
Assert.AreEqual(new string[] { "e", "f" }, handler.SplitParams("/assets/e/f/"), "Failed on trailing slash.");
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestHandleNoParams()
|
public void TestHandleNoParams()
|
||||||
{
|
{
|
||||||
TestHelper.InMethod();
|
TestHelper.InMethod();
|
||||||
|
|
||||||
byte[] emptyResult = new byte[] {};
|
byte[] emptyResult = new byte[] {};
|
||||||
GetAssetStreamHandler handler = new GetAssetStreamHandler(null);
|
GetAssetStreamHandler handler = new GetAssetStreamHandler(null);
|
||||||
|
|
||||||
Assert.AreEqual(new string[] { }, handler.Handle("/assets", null, null, null), "Failed on empty params.");
|
Assert.AreEqual(new string[] { }, handler.Handle("/assets", null, null, null), "Failed on empty params.");
|
||||||
Assert.AreEqual(new string[] { }, handler.Handle("/assets/", null, null, null ), "Failed on single slash.");
|
Assert.AreEqual(new string[] { }, handler.Handle("/assets/", null, null, null ), "Failed on single slash.");
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestHandleMalformedGuid()
|
public void TestHandleMalformedGuid()
|
||||||
{
|
{
|
||||||
TestHelper.InMethod();
|
TestHelper.InMethod();
|
||||||
|
|
||||||
byte[] emptyResult = new byte[] {};
|
byte[] emptyResult = new byte[] {};
|
||||||
GetAssetStreamHandler handler = new GetAssetStreamHandler(null);
|
GetAssetStreamHandler handler = new GetAssetStreamHandler(null);
|
||||||
|
|
||||||
Assert.AreEqual(new string[] {}, handler.Handle("/assets/badGuid", null, null, null), "Failed on bad guid.");
|
Assert.AreEqual(new string[] {}, handler.Handle("/assets/badGuid", null, null, null), "Failed on bad guid.");
|
||||||
}
|
}
|
||||||
|
|
||||||
//[Test]
|
//[Test]
|
||||||
//public void TestHandleFetchMissingAsset()
|
//public void TestHandleFetchMissingAsset()
|
||||||
//{
|
//{
|
||||||
|
|
||||||
// byte[] emptyResult = new byte[] { };
|
// byte[] emptyResult = new byte[] { };
|
||||||
// GetAssetStreamHandler handler = new GetAssetStreamHandler(null);
|
// GetAssetStreamHandler handler = new GetAssetStreamHandler(null);
|
||||||
|
|
||||||
// Assert.AreEqual(new string[] { }, handler.Handle("/assets/badGuid", null, null, null), "Failed on bad guid.");
|
// Assert.AreEqual(new string[] { }, handler.Handle("/assets/badGuid", null, null, null), "Failed on bad guid.");
|
||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue