summaryrefslogtreecommitdiffstats
path: root/sca-cpp/trunk/modules/server/impl-test.cpp
diff options
context:
space:
mode:
authorjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2009-11-30 08:36:32 +0000
committerjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2009-11-30 08:36:32 +0000
commitff124040623879bc48a0ba5cf06a841642adef53 (patch)
treee0bee552780b0852c10744017b7826b08f57d377 /sca-cpp/trunk/modules/server/impl-test.cpp
parentcd7dae28b034deebc9c2c2469ed9d8f1f3dab1ed (diff)
Fixes to the http client, httpd modules and memcached component to get the store and shopping cart test case working end to end.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@885349 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-cpp/trunk/modules/server/impl-test.cpp')
-rw-r--r--sca-cpp/trunk/modules/server/impl-test.cpp76
1 files changed, 76 insertions, 0 deletions
diff --git a/sca-cpp/trunk/modules/server/impl-test.cpp b/sca-cpp/trunk/modules/server/impl-test.cpp
new file mode 100644
index 0000000000..217c6f5171
--- /dev/null
+++ b/sca-cpp/trunk/modules/server/impl-test.cpp
@@ -0,0 +1,76 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/* $Rev$ $Date$ */
+
+/**
+ * Test component implementation.
+ */
+
+#include <string>
+
+#include "function.hpp"
+#include "list.hpp"
+#include "value.hpp"
+#include "monad.hpp"
+#include "debug.hpp"
+
+namespace tuscany {
+namespace server {
+
+const failable<value, std::string> get(unused const list<value>& params) {
+ return value(std::string("Hey"));
+}
+
+const failable<value, std::string> post(unused const list<value>& params) {
+ return value(std::string("1234"));
+}
+
+const failable<value, std::string> put(unused const list<value>& params) {
+ return value(true);
+}
+
+const failable<value, std::string> del(unused const list<value>& params) {
+ return value(true);
+}
+
+const failable<value, std::string> hello(const list<value>& params) {
+ return value("hello " + std::string(car(params)));
+}
+
+}
+}
+
+extern "C" {
+
+const tuscany::failable<tuscany::value, std::string> eval(const tuscany::value& func, const tuscany::list<tuscany::value>& params) {
+ if (func == "get")
+ return tuscany::server::get(params);
+ if (func == "post")
+ return tuscany::server::post(params);
+ if (func == "put")
+ return tuscany::server::put(params);
+ if (func == "del")
+ return tuscany::server::del(params);
+ if (func == "hello")
+ return tuscany::server::hello(params);
+ return tuscany::mkfailure<tuscany::value, std::string>(std::string("Function not supported: ") + std::string(func));
+}
+
+}