diff options
author | jsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68> | 2009-11-16 06:01:41 +0000 |
---|---|---|
committer | jsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68> | 2009-11-16 06:01:41 +0000 |
commit | 51a97b5d9350b37f95d6f0c00d013b886e64fcd3 (patch) | |
tree | 480092faac7c7deb40265fb070d1b4b059638814 /cpp/sca/test/store-script/store-script-test.cpp | |
parent | ada8802640aa232d34b1fe2793b9f52cd62b41f1 (diff) |
Added test cases and scripts to test the HTTP binding support. Refactored httpd module and added a wiring httpd module. Implementation of the store demo prepared for ApacheCon.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@880601 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/sca/test/store-script/store-script-test.cpp')
-rw-r--r-- | cpp/sca/test/store-script/store-script-test.cpp | 28 |
1 files changed, 10 insertions, 18 deletions
diff --git a/cpp/sca/test/store-script/store-script-test.cpp b/cpp/sca/test/store-script/store-script-test.cpp index 5a29d8caba..add5cb75e5 100644 --- a/cpp/sca/test/store-script/store-script-test.cpp +++ b/cpp/sca/test/store-script/store-script-test.cpp @@ -43,50 +43,42 @@ bool contains(const std::string& str, const std::string& pattern) { } bool testScript() { - std::ifstream is("store.scm", std::ios_base::in); + std::ifstream is("store-script.scm", std::ios_base::in); std::ostringstream os; eval::evalDriverRun(is, os); assert(contains(os.str(), "(\"Sample Feed\" \"")); assert(contains(os.str(), "\" (\"Item\" \"")); - assert(contains(os.str(), "\" ((javaClass \"services.Item\") (name \"Orange\") (currency \"USD\") (symbol \"$\") (price 3.55))) (\"Item\" \"")); - assert(contains(os.str(), "\" ((javaClass \"services.Item\") (name \"Apple\") (currency \"USD\") (symbol \"$\") (price 2.99))))")); + assert(contains(os.str(), "\" ((javaClass \"services.Item\") (name \"Orange\") (currencyCode \"USD\") (currencySymbol \"$\") (price 3.55))) (\"Item\" \"")); + assert(contains(os.str(), "\" ((javaClass \"services.Item\") (name \"Apple\") (currencyCode \"USD\") (currencySymbol \"$\") (price 2.99))))")); return true; } -const value evalLoop(std::istream& is, const value& req, eval::Env& globalEnv, const gc_pool& pool) { - value in = eval::readValue(is); - if(isNil(in)) - return eval::evalExpr(req, globalEnv, pool); - eval::evalExpr(in, globalEnv, pool); - return evalLoop(is, req, globalEnv, pool); -} - bool testEval() { { - std::ifstream is("store.scm", std::ios_base::in); + std::ifstream is("store-script.scm", std::ios_base::in); std::ostringstream os; eval::setupDisplay(os); gc_pool pool; eval::Env globalEnv = eval::setupEnvironment(pool); - const value req(mklist<value>("storeui_service", std::string("getcatalog"))); - const value val = evalLoop(is, req, globalEnv, pool); + const value exp(mklist<value>("storeui_service", std::string("getcatalog"))); + const value val = eval::evalScript(exp, is, globalEnv, pool); std::ostringstream vs; vs << val; - assert(contains(vs.str(), "(((javaClass \"services.Item\") (name \"Apple\") (currency \"USD\") (symbol \"$\") (price 2.99)) ((javaClass \"services.Item\") (name \"Orange\") (currency \"USD\") (symbol \"$\") (price 3.55)) ((javaClass \"services.Item\") (name \"Pear\") (currency \"USD\") (symbol \"$\") (price 1.55)))")); + assert(contains(vs.str(), "(((javaClass \"services.Item\") (name \"Apple\") (currencyCode \"USD\") (currencySymbol \"$\") (price 2.99)) ((javaClass \"services.Item\") (name \"Orange\") (currencyCode \"USD\") (currencySymbol \"$\") (price 3.55)) ((javaClass \"services.Item\") (name \"Pear\") (currencyCode \"USD\") (currencySymbol \"$\") (price 1.55)))")); } { - std::ifstream is("store.scm", std::ios_base::in); + std::ifstream is("store-script.scm", std::ios_base::in); std::ostringstream os; eval::setupDisplay(os); gc_pool pool; eval::Env globalEnv = eval::setupEnvironment(pool); - const value req(mklist<value>("storeui_service", std::string("gettotal"))); - const value res = evalLoop(is, req, globalEnv, pool); + const value exp(mklist<value>("storeui_service", std::string("gettotal"))); + const value res = eval::evalScript(exp, is, globalEnv, pool); std::ostringstream rs; rs << res; |