summaryrefslogtreecommitdiff
path: root/indra/llmessage/tests
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llmessage/tests')
-rwxr-xr-x[-rw-r--r--]indra/llmessage/tests/commtest.h0
-rwxr-xr-x[-rw-r--r--]indra/llmessage/tests/llareslistener_test.cpp0
-rwxr-xr-x[-rw-r--r--]indra/llmessage/tests/llavatarnamecache_test.cpp0
-rwxr-xr-x[-rw-r--r--]indra/llmessage/tests/llcurl_stub.cpp0
-rwxr-xr-x[-rw-r--r--]indra/llmessage/tests/llhost_test.cpp0
-rwxr-xr-x[-rw-r--r--]indra/llmessage/tests/llhttpclient_test.cpp84
-rwxr-xr-x[-rw-r--r--]indra/llmessage/tests/llhttpclientadapter_test.cpp0
-rwxr-xr-x[-rw-r--r--]indra/llmessage/tests/llmime_test.cpp0
-rwxr-xr-x[-rw-r--r--]indra/llmessage/tests/llmockhttpclient.h0
-rwxr-xr-x[-rw-r--r--]indra/llmessage/tests/llnamevalue_test.cpp0
-rwxr-xr-x[-rw-r--r--]indra/llmessage/tests/llpartdata_test.cpp0
-rwxr-xr-x[-rw-r--r--]indra/llmessage/tests/llregionpresenceverifier_test.cpp0
-rwxr-xr-x[-rw-r--r--]indra/llmessage/tests/llsdmessage_test.cpp0
-rwxr-xr-x[-rw-r--r--]indra/llmessage/tests/lltemplatemessagedispatcher_test.cpp0
-rwxr-xr-x[-rw-r--r--]indra/llmessage/tests/lltesthttpclientadapter.cpp0
-rwxr-xr-x[-rw-r--r--]indra/llmessage/tests/lltesthttpclientadapter.h0
-rwxr-xr-x[-rw-r--r--]indra/llmessage/tests/lltestmessagesender.cpp0
-rwxr-xr-x[-rw-r--r--]indra/llmessage/tests/lltestmessagesender.h0
-rwxr-xr-x[-rw-r--r--]indra/llmessage/tests/lltrustedmessageservice_test.cpp0
-rwxr-xr-x[-rw-r--r--]indra/llmessage/tests/llxfer_file_test.cpp0
-rwxr-xr-x[-rw-r--r--]indra/llmessage/tests/networkio.h0
-rwxr-xr-x[-rw-r--r--]indra/llmessage/tests/test_llsdmessage_peer.py46
-rwxr-xr-x[-rw-r--r--]indra/llmessage/tests/testrunner.py0
23 files changed, 43 insertions, 87 deletions
diff --git a/indra/llmessage/tests/commtest.h b/indra/llmessage/tests/commtest.h
index 0d149b5258..0d149b5258 100644..100755
--- a/indra/llmessage/tests/commtest.h
+++ b/indra/llmessage/tests/commtest.h
diff --git a/indra/llmessage/tests/llareslistener_test.cpp b/indra/llmessage/tests/llareslistener_test.cpp
index 60c91e12cf..60c91e12cf 100644..100755
--- a/indra/llmessage/tests/llareslistener_test.cpp
+++ b/indra/llmessage/tests/llareslistener_test.cpp
diff --git a/indra/llmessage/tests/llavatarnamecache_test.cpp b/indra/llmessage/tests/llavatarnamecache_test.cpp
index ec6b65d483..ec6b65d483 100644..100755
--- a/indra/llmessage/tests/llavatarnamecache_test.cpp
+++ b/indra/llmessage/tests/llavatarnamecache_test.cpp
diff --git a/indra/llmessage/tests/llcurl_stub.cpp b/indra/llmessage/tests/llcurl_stub.cpp
index 9b298d0c04..9b298d0c04 100644..100755
--- a/indra/llmessage/tests/llcurl_stub.cpp
+++ b/indra/llmessage/tests/llcurl_stub.cpp
diff --git a/indra/llmessage/tests/llhost_test.cpp b/indra/llmessage/tests/llhost_test.cpp
index eadf83c428..eadf83c428 100644..100755
--- a/indra/llmessage/tests/llhost_test.cpp
+++ b/indra/llmessage/tests/llhost_test.cpp
diff --git a/indra/llmessage/tests/llhttpclient_test.cpp b/indra/llmessage/tests/llhttpclient_test.cpp
index 7c3def6024..87cbafa404 100644..100755
--- a/indra/llmessage/tests/llhttpclient_test.cpp
+++ b/indra/llmessage/tests/llhttpclient_test.cpp
@@ -47,37 +47,6 @@
namespace tut
{
- LLSD storage;
-
- class LLSDStorageNode : public LLHTTPNode
- {
- public:
- LLSD simpleGet() const { return storage; }
- LLSD simplePut(const LLSD& value) const { storage = value; return LLSD(); }
- };
-
- class ErrorNode : public LLHTTPNode
- {
- public:
- void get(ResponsePtr r, const LLSD& context) const
- { r->status(599, "Intentional error"); }
- void post(ResponsePtr r, const LLSD& context, const LLSD& input) const
- { r->status(input["status"], input["reason"]); }
- };
-
- class TimeOutNode : public LLHTTPNode
- {
- public:
- void get(ResponsePtr r, const LLSD& context) const
- {
- /* do nothing, the request will eventually time out */
- }
- };
-
- LLHTTPRegistration<LLSDStorageNode> gStorageNode("/test/storage");
- LLHTTPRegistration<ErrorNode> gErrorNode("/test/error");
- LLHTTPRegistration<TimeOutNode> gTimeOutNode("/test/timeout");
-
struct HTTPClientTestData
{
public:
@@ -91,7 +60,6 @@ namespace tut
ensure("Set environment variable PORT to local test server port", PORT);
apr_pool_create(&mPool, NULL);
LLCurl::initClass(false);
- mServerPump = new LLPumpIO(mPool);
mClientPump = new LLPumpIO(mPool);
LLHTTPClient::setPump(*mClientPump);
@@ -99,20 +67,11 @@ namespace tut
~HTTPClientTestData()
{
- delete mServerPump;
delete mClientPump;
LLProxy::cleanupClass();
apr_pool_destroy(mPool);
}
- void setupTheServer()
- {
- LLHTTPNode& root = LLIOHTTPServer::create(mPool, *mServerPump, 8888);
-
- LLHTTPStandardServices::useServices();
- LLHTTPRegistrar::buildAllServices(root);
- }
-
void runThePump(float timeout = 100.0f)
{
LLTimer timer;
@@ -120,11 +79,7 @@ namespace tut
while(!mSawCompleted && !mSawCompletedHeader && !timer.hasExpired())
{
- if (mServerPump)
- {
- mServerPump->pump();
- mServerPump->callback();
- }
+ LLFrameTimer::updateFrameTime();
if (mClientPump)
{
mClientPump->pump();
@@ -133,18 +88,11 @@ namespace tut
}
}
- void killServer()
- {
- delete mServerPump;
- mServerPump = NULL;
- }
-
const char* const PORT;
const std::string local_server;
private:
apr_pool_t* mPool;
- LLPumpIO* mServerPump;
LLPumpIO* mClientPump;
protected:
@@ -288,14 +236,12 @@ namespace tut
sd["list"][1]["three"] = 3;
sd["list"][1]["four"] = 4;
- setupTheServer();
-
- LLHTTPClient::post("http://localhost:8888/web/echo", sd, newResult());
+ LLHTTPClient::post(local_server + "web/echo", sd, newResult());
runThePump();
ensureStatusOK();
ensure_equals("echoed result matches", getResult(), sd);
}
-
+
template<> template<>
void HTTPClientTestObject::test<4>()
{
@@ -303,12 +249,11 @@ namespace tut
sd["message"] = "This is my test message.";
- setupTheServer();
- LLHTTPClient::put("http://localhost:8888/test/storage", sd, newResult());
+ LLHTTPClient::put(local_server + "test/storage", sd, newResult());
runThePump();
ensureStatusOK();
- LLHTTPClient::get("http://localhost:8888/test/storage", newResult());
+ LLHTTPClient::get(local_server + "test/storage", newResult());
runThePump();
ensureStatusOK();
ensure_equals("echoed result matches", getResult(), sd);
@@ -322,9 +267,7 @@ namespace tut
sd["status"] = 543;
sd["reason"] = "error for testing";
- setupTheServer();
-
- LLHTTPClient::post("http://localhost:8888/test/error", sd, newResult());
+ LLHTTPClient::post(local_server + "test/error", sd, newResult());
runThePump();
ensureStatusError();
ensure_contains("reason", mReason, sd["reason"]);
@@ -333,23 +276,16 @@ namespace tut
template<> template<>
void HTTPClientTestObject::test<6>()
{
- setupTheServer();
-
- LLHTTPClient::get("http://localhost:8888/test/timeout", newResult());
- runThePump(1.0f);
- killServer();
- runThePump();
+ const F32 timeout = 1.0f;
+ LLHTTPClient::get(local_server + "test/timeout", newResult(), LLSD(), timeout);
+ runThePump(timeout * 5.0f);
ensureStatusError();
- ensure_equals("reason", mReason, "STATUS_ERROR");
+ ensure_equals("reason", mReason, "STATUS_EXPIRED");
}
template<> template<>
void HTTPClientTestObject::test<7>()
{
- // Can not use the little mini server. The blocking request
- // won't ever let it run. Instead get from a known LLSD
- // source and compare results with the non-blocking get which
- // is tested against the mini server earlier.
LLHTTPClient::get(local_server, newResult());
runThePump();
ensureStatusOK();
diff --git a/indra/llmessage/tests/llhttpclientadapter_test.cpp b/indra/llmessage/tests/llhttpclientadapter_test.cpp
index 13ce0a0edd..13ce0a0edd 100644..100755
--- a/indra/llmessage/tests/llhttpclientadapter_test.cpp
+++ b/indra/llmessage/tests/llhttpclientadapter_test.cpp
diff --git a/indra/llmessage/tests/llmime_test.cpp b/indra/llmessage/tests/llmime_test.cpp
index aed5c4589c..aed5c4589c 100644..100755
--- a/indra/llmessage/tests/llmime_test.cpp
+++ b/indra/llmessage/tests/llmime_test.cpp
diff --git a/indra/llmessage/tests/llmockhttpclient.h b/indra/llmessage/tests/llmockhttpclient.h
index af26bf8803..af26bf8803 100644..100755
--- a/indra/llmessage/tests/llmockhttpclient.h
+++ b/indra/llmessage/tests/llmockhttpclient.h
diff --git a/indra/llmessage/tests/llnamevalue_test.cpp b/indra/llmessage/tests/llnamevalue_test.cpp
index 8902fdd2e8..8902fdd2e8 100644..100755
--- a/indra/llmessage/tests/llnamevalue_test.cpp
+++ b/indra/llmessage/tests/llnamevalue_test.cpp
diff --git a/indra/llmessage/tests/llpartdata_test.cpp b/indra/llmessage/tests/llpartdata_test.cpp
index 9123bd06c7..9123bd06c7 100644..100755
--- a/indra/llmessage/tests/llpartdata_test.cpp
+++ b/indra/llmessage/tests/llpartdata_test.cpp
diff --git a/indra/llmessage/tests/llregionpresenceverifier_test.cpp b/indra/llmessage/tests/llregionpresenceverifier_test.cpp
index 5b89f2a8c6..5b89f2a8c6 100644..100755
--- a/indra/llmessage/tests/llregionpresenceverifier_test.cpp
+++ b/indra/llmessage/tests/llregionpresenceverifier_test.cpp
diff --git a/indra/llmessage/tests/llsdmessage_test.cpp b/indra/llmessage/tests/llsdmessage_test.cpp
index 44b024a83f..44b024a83f 100644..100755
--- a/indra/llmessage/tests/llsdmessage_test.cpp
+++ b/indra/llmessage/tests/llsdmessage_test.cpp
diff --git a/indra/llmessage/tests/lltemplatemessagedispatcher_test.cpp b/indra/llmessage/tests/lltemplatemessagedispatcher_test.cpp
index 3b04530c1a..3b04530c1a 100644..100755
--- a/indra/llmessage/tests/lltemplatemessagedispatcher_test.cpp
+++ b/indra/llmessage/tests/lltemplatemessagedispatcher_test.cpp
diff --git a/indra/llmessage/tests/lltesthttpclientadapter.cpp b/indra/llmessage/tests/lltesthttpclientadapter.cpp
index 4539e4a540..4539e4a540 100644..100755
--- a/indra/llmessage/tests/lltesthttpclientadapter.cpp
+++ b/indra/llmessage/tests/lltesthttpclientadapter.cpp
diff --git a/indra/llmessage/tests/lltesthttpclientadapter.h b/indra/llmessage/tests/lltesthttpclientadapter.h
index c29cbb3a2a..c29cbb3a2a 100644..100755
--- a/indra/llmessage/tests/lltesthttpclientadapter.h
+++ b/indra/llmessage/tests/lltesthttpclientadapter.h
diff --git a/indra/llmessage/tests/lltestmessagesender.cpp b/indra/llmessage/tests/lltestmessagesender.cpp
index ee40e0249e..ee40e0249e 100644..100755
--- a/indra/llmessage/tests/lltestmessagesender.cpp
+++ b/indra/llmessage/tests/lltestmessagesender.cpp
diff --git a/indra/llmessage/tests/lltestmessagesender.h b/indra/llmessage/tests/lltestmessagesender.h
index bb89289585..bb89289585 100644..100755
--- a/indra/llmessage/tests/lltestmessagesender.h
+++ b/indra/llmessage/tests/lltestmessagesender.h
diff --git a/indra/llmessage/tests/lltrustedmessageservice_test.cpp b/indra/llmessage/tests/lltrustedmessageservice_test.cpp
index b287a29841..b287a29841 100644..100755
--- a/indra/llmessage/tests/lltrustedmessageservice_test.cpp
+++ b/indra/llmessage/tests/lltrustedmessageservice_test.cpp
diff --git a/indra/llmessage/tests/llxfer_file_test.cpp b/indra/llmessage/tests/llxfer_file_test.cpp
index a8c1adf9b4..a8c1adf9b4 100644..100755
--- a/indra/llmessage/tests/llxfer_file_test.cpp
+++ b/indra/llmessage/tests/llxfer_file_test.cpp
diff --git a/indra/llmessage/tests/networkio.h b/indra/llmessage/tests/networkio.h
index 2aff90ca1e..2aff90ca1e 100644..100755
--- a/indra/llmessage/tests/networkio.h
+++ b/indra/llmessage/tests/networkio.h
diff --git a/indra/llmessage/tests/test_llsdmessage_peer.py b/indra/llmessage/tests/test_llsdmessage_peer.py
index fe4f3a8c01..e45249b1cb 100644..100755
--- a/indra/llmessage/tests/test_llsdmessage_peer.py
+++ b/indra/llmessage/tests/test_llsdmessage_peer.py
@@ -39,6 +39,9 @@ sys.path.insert(0, os.path.join(mydir, os.pardir, os.pardir, "lib", "python"))
from indra.util.fastest_elementtree import parse as xml_parse
from indra.base import llsd
from testrunner import freeport, run, debug, VERBOSE
+import time
+
+_storage=None
class TestHTTPRequestHandler(BaseHTTPRequestHandler):
"""This subclass of BaseHTTPRequestHandler is to receive and echo
@@ -90,21 +93,14 @@ class TestHTTPRequestHandler(BaseHTTPRequestHandler):
# Read the provided POST data.
self.answer(self.read_xml())
+ def do_PUT(self):
+ # Read the provided PUT data.
+ self.answer(self.read_xml())
+
def answer(self, data, withdata=True):
+ global _storage
debug("%s.answer(%s): self.path = %r", self.__class__.__name__, data, self.path)
- if "fail" not in self.path:
- data = data.copy() # we're going to modify
- # Ensure there's a "reply" key in data, even if there wasn't before
- data["reply"] = data.get("reply", llsd.LLSD("success"))
- response = llsd.format_xml(data)
- debug("success: %s", response)
- self.send_response(200)
- self.send_header("Content-type", "application/llsd+xml")
- self.send_header("Content-Length", str(len(response)))
- self.end_headers()
- if withdata:
- self.wfile.write(response)
- else: # fail requested
+ if "fail" in self.path or "test/error" in self.path: # fail requested
status = data.get("status", 500)
# self.responses maps an int status to a (short, long) pair of
# strings. We want the longer string. That's why we pass a string
@@ -117,6 +113,30 @@ class TestHTTPRequestHandler(BaseHTTPRequestHandler):
"without providing a reason" % status))[1])
debug("fail requested: %s: %r", status, reason)
self.send_error(status, reason)
+ else:
+ if "web/echo" in self.path:
+ pass
+ elif "test/timeout" in self.path:
+ time.sleep(5.0)
+ return
+ elif "test/storage" in self.path:
+ if "GET" == self.command:
+ data = _storage
+ else:
+ _storage = data
+ data = "ok"
+ else:
+ data = data.copy() # we're going to modify
+ # Ensure there's a "reply" key in data, even if there wasn't before
+ data["reply"] = data.get("reply", llsd.LLSD("success"))
+ response = llsd.format_xml(data)
+ debug("success: %s", response)
+ self.send_response(200)
+ self.send_header("Content-type", "application/llsd+xml")
+ self.send_header("Content-Length", str(len(response)))
+ self.end_headers()
+ if withdata:
+ self.wfile.write(response)
if not VERBOSE:
# When VERBOSE is set, skip both these overrides because they exist to
diff --git a/indra/llmessage/tests/testrunner.py b/indra/llmessage/tests/testrunner.py
index 5b9beb359b..5b9beb359b 100644..100755
--- a/indra/llmessage/tests/testrunner.py
+++ b/indra/llmessage/tests/testrunner.py