summaryrefslogtreecommitdiffstats
path: root/sca-cpp/trunk/components
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--sca-cpp/trunk/components/cache/mcache.cpp2
-rwxr-xr-xsca-cpp/trunk/components/cache/server-test7
-rw-r--r--sca-cpp/trunk/components/chat/chat-listener.cpp8
-rw-r--r--sca-cpp/trunk/components/chat/chat-sender.cpp2
-rw-r--r--sca-cpp/trunk/components/queue/Makefile.am14
-rw-r--r--sca-cpp/trunk/components/queue/client-test.cpp71
-rw-r--r--sca-cpp/trunk/components/queue/qpid-test.cpp64
-rw-r--r--sca-cpp/trunk/components/queue/queue-listener.cpp8
-rw-r--r--sca-cpp/trunk/components/queue/queue-sender.cpp2
-rw-r--r--sca-cpp/trunk/components/webservice/Makefile.am4
-rwxr-xr-xsca-cpp/trunk/components/webservice/axis2-conf8
-rw-r--r--sca-cpp/trunk/components/webservice/axis2.hpp13
-rwxr-xr-xsca-cpp/trunk/components/webservice/echo-test6
-rwxr-xr-xsca-cpp/trunk/components/webservice/server-test15
-rw-r--r--sca-cpp/trunk/components/webservice/webservice-client.cpp5
-rw-r--r--sca-cpp/trunk/components/webservice/webservice-listener.cpp2
16 files changed, 191 insertions, 40 deletions
diff --git a/sca-cpp/trunk/components/cache/mcache.cpp b/sca-cpp/trunk/components/cache/mcache.cpp
index 46f707ee19..b1dc750ccb 100644
--- a/sca-cpp/trunk/components/cache/mcache.cpp
+++ b/sca-cpp/trunk/components/cache/mcache.cpp
@@ -99,7 +99,7 @@ const tuscany::value apply(const tuscany::list<tuscany::value>& params) {
return tuscany::cache::put(cdr(params));
if (func == "delete")
return tuscany::cache::del(cdr(params));
- return tuscany::mkfailure<tuscany::value>(tuscany::string("Function not supported: ") + func);
+ return tuscany::mkfailure<tuscany::value>();
}
}
diff --git a/sca-cpp/trunk/components/cache/server-test b/sca-cpp/trunk/components/cache/server-test
index a30d14b1b6..821724295d 100755
--- a/sca-cpp/trunk/components/cache/server-test
+++ b/sca-cpp/trunk/components/cache/server-test
@@ -22,14 +22,11 @@
../../modules/server/server-conf tmp
../../modules/server/scheme-conf tmp
cat >>tmp/conf/httpd.conf <<EOF
-
-<Location />
SCAContribution `pwd`/
SCAComposite mcache.composite
-</Location>
EOF
-apachectl -k start -d `pwd`/tmp
+../../modules/http/httpd-start tmp
mc="memcached -l 127.0.0.1 -m 4 -p 11211"
$mc &
@@ -41,6 +38,6 @@ rc=$?
# Cleanup
kill `ps -f | grep -v grep | grep "$mc" | awk '{ print $2 }'`
-apachectl -k stop -d `pwd`/tmp
+../../modules/http/httpd-stop tmp
sleep 2
return $rc
diff --git a/sca-cpp/trunk/components/chat/chat-listener.cpp b/sca-cpp/trunk/components/chat/chat-listener.cpp
index 57642036a6..884965839a 100644
--- a/sca-cpp/trunk/components/chat/chat-listener.cpp
+++ b/sca-cpp/trunk/components/chat/chat-listener.cpp
@@ -36,7 +36,7 @@ namespace chat {
/**
* Initialize the component.
*/
-const failable<value> init(unused const list<value>& params) {
+const failable<value> start(unused const list<value>& params) {
//TODO establish a session with an XMPP server for a JID and mark the current server instance busy
return value(true);
@@ -49,9 +49,9 @@ extern "C" {
const tuscany::value apply(const tuscany::list<tuscany::value>& params) {
const tuscany::value func(car(params));
- if (func == "init")
- return tuscany::chat::init(cdr(params));
- return tuscany::mkfailure<tuscany::value>(tuscany::string("Function not supported: ") + func);
+ if (func == "start")
+ return tuscany::chat::start(cdr(params));
+ return tuscany::mkfailure<tuscany::value>();
}
}
diff --git a/sca-cpp/trunk/components/chat/chat-sender.cpp b/sca-cpp/trunk/components/chat/chat-sender.cpp
index dfcae6796a..bd67bf7315 100644
--- a/sca-cpp/trunk/components/chat/chat-sender.cpp
+++ b/sca-cpp/trunk/components/chat/chat-sender.cpp
@@ -52,7 +52,7 @@ const tuscany::value apply(const tuscany::list<tuscany::value>& params) {
const tuscany::value func(car(params));
if (func == "post")
return tuscany::chat::post(cdr(params));
- return tuscany::mkfailure<tuscany::value>(tuscany::string("Function not supported: ") + func);
+ return tuscany::mkfailure<tuscany::value>();
}
}
diff --git a/sca-cpp/trunk/components/queue/Makefile.am b/sca-cpp/trunk/components/queue/Makefile.am
index cee3ce7820..6bbdc119b4 100644
--- a/sca-cpp/trunk/components/queue/Makefile.am
+++ b/sca-cpp/trunk/components/queue/Makefile.am
@@ -17,10 +17,13 @@
if WANT_QUEUE
+noinst_PROGRAMS = qpid-test client-test
+
INCLUDES = -I${QPIDC_INCLUDE}
compdir=$(prefix)/components/queue
comp_LTLIBRARIES = libqueue-sender.la libqueue-listener.la
+comp_DATA = qpidc.prefix
libqueue_sender_la_SOURCES = queue-sender.cpp
libqueue_sender_la_LDFLAGS = -L${QPIDC_LIB} -R${QPIDC_LIB} -lqpidclient
@@ -28,4 +31,15 @@ libqueue_sender_la_LDFLAGS = -L${QPIDC_LIB} -R${QPIDC_LIB} -lqpidclient
libqueue_listener_la_SOURCES = queue-listener.cpp
libqueue_listener_la_LDFLAGS = -L${QPIDC_LIB} -R${QPIDC_LIB} -lqpidclient
+qpid_test_SOURCES = qpid-test.cpp
+qpid_test_LDFLAGS = -L${QPIDC_LIB} -R${QPIDC_LIB} -lqpidclient
+
+client_test_SOURCES = client-test.cpp
+client_test_LDFLAGS = -lxml2 -lcurl -lmozjs
+
+qpidc.prefix: $(top_builddir)/config.status
+ echo ${QPIDC_PREFIX} >qpidc.prefix
+
+#TESTS = qpid-test server-test
+
endif
diff --git a/sca-cpp/trunk/components/queue/client-test.cpp b/sca-cpp/trunk/components/queue/client-test.cpp
new file mode 100644
index 0000000000..121a739e0d
--- /dev/null
+++ b/sca-cpp/trunk/components/queue/client-test.cpp
@@ -0,0 +1,71 @@
+/*
+ * 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 queue component.
+ */
+
+#include <assert.h>
+#include "stream.hpp"
+#include "string.hpp"
+#include "list.hpp"
+#include "element.hpp"
+#include "value.hpp"
+#include "monad.hpp"
+#include "perf.hpp"
+#include "../../modules/http/curl.hpp"
+
+namespace tuscany {
+namespace queue {
+
+
+bool testPost() {
+ http::CURLSession cs;
+
+ const value func = "http://ws.apache.org/axis2/c/samples/echoString";
+ const list<value> arg = mklist<value>(
+ list<value>() + "ns1:echoString"
+ + (list<value>() + "@xmlns:ns1" + string("http://ws.apache.org/axis2/services/echo"))
+ + (list<value>() + "text" + string("Hello World!")));
+
+ const failable<value> rval = http::evalExpr(mklist<value>(func, arg), "http://localhost:8090/echo-client", cs);
+ assert(hasContent(rval));
+
+ const list<value> r = mklist<value>(
+ list<value>() + "ns1:echoString"
+ + (list<value>() + "@xmlns:ns1" + string("http://ws.apache.org/axis2/c/samples"))
+ + (list<value>() + "text" + string("Hello World!")));
+ assert(content(rval) == r);
+ return true;
+}
+
+}
+}
+
+int main() {
+ tuscany::cout << "Testing..." << tuscany::endl;
+
+ tuscany::queue::testPost();
+
+ tuscany::cout << "OK" << tuscany::endl;
+
+ return 0;
+}
diff --git a/sca-cpp/trunk/components/queue/qpid-test.cpp b/sca-cpp/trunk/components/queue/qpid-test.cpp
new file mode 100644
index 0000000000..97d8d2f5d5
--- /dev/null
+++ b/sca-cpp/trunk/components/queue/qpid-test.cpp
@@ -0,0 +1,64 @@
+/*
+ * 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 Qpid support functions.
+ */
+
+#include <assert.h>
+#include "stream.hpp"
+#include "string.hpp"
+#include "list.hpp"
+#include "element.hpp"
+#include "monad.hpp"
+#include "value.hpp"
+#include "perf.hpp"
+#include "qpid.hpp"
+
+namespace tuscany {
+namespace queue {
+
+bool testPost() {
+ QpidConnection qc;
+
+ QpidSession qs(qc);
+
+ // Post the item
+ const list<value> params;
+ const value key = ((lambda<value(list<value>)>)cadr(params))(list<value>());
+ post(key, car(params), qs);
+
+ return value(true);
+ return true;
+}
+
+}
+}
+
+int main() {
+ tuscany::cout << "Testing..." << tuscany::endl;
+
+ tuscany::queue::testPost();
+
+ tuscany::cout << "OK" << tuscany::endl;
+
+ return 0;
+}
diff --git a/sca-cpp/trunk/components/queue/queue-listener.cpp b/sca-cpp/trunk/components/queue/queue-listener.cpp
index 6f1c54873c..75c53e7b41 100644
--- a/sca-cpp/trunk/components/queue/queue-listener.cpp
+++ b/sca-cpp/trunk/components/queue/queue-listener.cpp
@@ -44,7 +44,7 @@ QpidConnection qc;
/**
* Initialize the component.
*/
-const failable<value> init(const list<value>& params) {
+const failable<value> start(const list<value>& params) {
QpidSession qs(qc);
// Declare the configured AMQP key / queue pair
@@ -64,9 +64,9 @@ extern "C" {
const tuscany::value apply(const tuscany::list<tuscany::value>& params) {
const tuscany::value func(car(params));
- if (func == "init")
- return tuscany::queue::init(cdr(params));
- return tuscany::mkfailure<tuscany::value>(tuscany::string("Function not supported: ") + func);
+ if (func == "start")
+ return tuscany::queue::start(cdr(params));
+ return tuscany::mkfailure<tuscany::value>();
}
}
diff --git a/sca-cpp/trunk/components/queue/queue-sender.cpp b/sca-cpp/trunk/components/queue/queue-sender.cpp
index fbbbd0376b..15128411c2 100644
--- a/sca-cpp/trunk/components/queue/queue-sender.cpp
+++ b/sca-cpp/trunk/components/queue/queue-sender.cpp
@@ -63,7 +63,7 @@ const tuscany::value apply(const tuscany::list<tuscany::value>& params) {
const tuscany::value func(car(params));
if (func == "post")
return tuscany::queue::post(cdr(params));
- return tuscany::mkfailure<tuscany::value>(tuscany::string("Function not supported: ") + func);
+ return tuscany::mkfailure<tuscany::value>();
}
}
diff --git a/sca-cpp/trunk/components/webservice/Makefile.am b/sca-cpp/trunk/components/webservice/Makefile.am
index b12518076b..264b150c93 100644
--- a/sca-cpp/trunk/components/webservice/Makefile.am
+++ b/sca-cpp/trunk/components/webservice/Makefile.am
@@ -23,6 +23,7 @@ INCLUDES = -I${AXIS2C_INCLUDE}
compdir=$(prefix)/components/webservice
comp_LTLIBRARIES = libwebservice-client.la libwebservice-listener.la libaxis2-dispatcher.la libaxis2-service.la
+comp_DATA = axis2c.prefix
libwebservice_client_la_SOURCES = webservice-client.cpp
libwebservice_client_la_LDFLAGS = -lxml2 -L${AXIS2C_LIB} -R${AXIS2C_LIB} -laxis2_engine
@@ -45,6 +46,9 @@ axis2_test_LDFLAGS = -lxml2 -L${AXIS2C_LIB} -R${AXIS2C_LIB} -laxis2_engine
client_test_SOURCES = client-test.cpp
client_test_LDFLAGS = -lxml2 -lcurl -lmozjs -L${AXIS2C_LIB} -R${AXIS2C_LIB} -laxis2_engine
+axis2c.prefix: $(top_builddir)/config.status
+ echo ${AXIS2C_PREFIX} >axis2c.prefix
+
TESTS = axiom-test echo-test server-test
endif
diff --git a/sca-cpp/trunk/components/webservice/axis2-conf b/sca-cpp/trunk/components/webservice/axis2-conf
index 28f8a0be94..2e1f6116cd 100755
--- a/sca-cpp/trunk/components/webservice/axis2-conf
+++ b/sca-cpp/trunk/components/webservice/axis2-conf
@@ -20,14 +20,15 @@
# Generate an Axis2 server conf
here=`readlink -f $0`; here=`dirname $here`
root=`readlink -f $1`
+axis2_prefix=`cat axis2c.prefix`
# Create an Axis2 home directory
mkdir -p $root/axis2c
-ln -f -s $AXIS2C_HOME/lib $root/axis2c/lib
+ln -f -s $axis2_prefix/lib $root/axis2c/lib
mkdir -p $root/axis2c/logs
mkdir -p $root/axis2c/modules
-ln -f -s $AXIS2C_HOME/modules/addressing $root/axis2c/modules/addressing
-ln -f -s $AXIS2C_HOME/modules/logging $root/axis2c/modules/logging
+ln -f -s $axis2_prefix/modules/addressing $root/axis2c/modules/addressing
+ln -f -s $axis2_prefix/modules/logging $root/axis2c/modules/logging
mkdir -p $root/axis2c/services
# Install Tuscany Axis2 module and service
@@ -41,6 +42,7 @@ cp $here/axis2.xml $root/axis2c/axis2.xml
# Configure HTTPD Axis2 module
cat >>$root/conf/httpd.conf <<EOF
+SetEnv AXIS2C_HOME $root/axis2c
LoadModule axis2_module $root/axis2c/lib/libmod_axis2.so
Axis2RepoPath $root/axis2c
Axis2LogFile $root/axis2c/logs/mod_axis2.log
diff --git a/sca-cpp/trunk/components/webservice/axis2.hpp b/sca-cpp/trunk/components/webservice/axis2.hpp
index 7a67702b5c..c2886edb71 100644
--- a/sca-cpp/trunk/components/webservice/axis2.hpp
+++ b/sca-cpp/trunk/components/webservice/axis2.hpp
@@ -57,7 +57,7 @@ namespace webservice {
*/
class Axis2Context {
public:
- Axis2Context() : env(axutil_env_create_all("tuscany.log", AXIS2_LOG_LEVEL_WARNING)), owner(true) {
+ Axis2Context() : env(axutil_env_create_all("axis2.log", AXIS2_LOG_LEVEL_WARNING)), owner(true) {
}
Axis2Context(const Axis2Context& ax) : env(ax.env), owner(false) {
@@ -144,8 +144,6 @@ const failable<const list<value> > axiomNodeToValues(axiom_node_t* node, const A
* Evaluate an expression in the form (soap-action-string, document, uri). Send the
* SOAP action and document to the Web Service at the given URI using Axis2.
*/
-const char* axis2Home = getenv("AXIS2C_HOME");
-
const failable<value> evalExpr(const value& expr, const Axis2Context& ax) {
debug(expr, "webservice::evalExpr::input");
@@ -155,16 +153,13 @@ const failable<value> evalExpr(const value& expr, const Axis2Context& ax) {
const value uri(caddr<value>(expr));
// Create Axis2 client
+ axis2_svc_client_t *client = axis2_svc_client_create(env(ax), getenv("AXIS2C_HOME"));
+ if (client == NULL)
+ return mkfailure<value>("Couldn't create Axis2 client: " + axis2Error(ax));
axis2_endpoint_ref_t *epr = axis2_endpoint_ref_create(env(ax), c_str(uri));
axis2_options_t *opt = axis2_options_create(env(ax));
axis2_options_set_to(opt, env(ax), epr);
axis2_options_set_action(opt, env(ax), (const axis2_char_t*)c_str(func));
- axis2_svc_client_t *client = axis2_svc_client_create(env(ax), axis2Home);
- if (client == NULL) {
- axis2_endpoint_ref_free(epr, env(ax));
- axis2_options_free(opt, env(ax));
- return mkfailure<value>("Couldn't create Axis2 client: " + axis2Error(ax));
- }
axis2_svc_client_set_options(client, env(ax), opt);
axis2_svc_client_engage_module(client, env(ax), AXIS2_MODULE_ADDRESSING);
diff --git a/sca-cpp/trunk/components/webservice/echo-test b/sca-cpp/trunk/components/webservice/echo-test
index b999b1aede..5e7a380521 100755
--- a/sca-cpp/trunk/components/webservice/echo-test
+++ b/sca-cpp/trunk/components/webservice/echo-test
@@ -18,9 +18,11 @@
# under the License.
# Setup
-axis2="$AXIS2C_HOME/bin/axis2_http_server"
+axis2_prefix=`cat axis2c.prefix`
+export AXIS2C_HOME=$axis2_prefix
+axis2="$axis2_prefix/bin/axis2_http_server"
pwd=`pwd`
-cd $AXIS2C_HOME/bin
+cd "$axis2_prefix/bin"
$axis2 &
cd $pwd
sleep 1
diff --git a/sca-cpp/trunk/components/webservice/server-test b/sca-cpp/trunk/components/webservice/server-test
index eb3d53a33a..7d33223b3d 100755
--- a/sca-cpp/trunk/components/webservice/server-test
+++ b/sca-cpp/trunk/components/webservice/server-test
@@ -23,18 +23,17 @@
../../modules/server/scheme-conf tmp
./axis2-conf tmp
cat >>tmp/conf/httpd.conf <<EOF
-
-<Location />
SCAContribution `pwd`/
SCAComposite webservice.composite
-</Location>
EOF
-apachectl -k start -d `pwd`/tmp
+../../modules/http/httpd-start tmp
-axis2="$AXIS2C_HOME/bin/axis2_http_server"
+axis2_prefix=`cat axis2c.prefix`
+export AXIS2C_HOME=$axis2_prefix
+axis2="$axis2_prefix/bin/axis2_http_server"
pwd=`pwd`
-cd $AXIS2C_HOME/bin
+cd "$axis2_prefix/bin"
$axis2 &
cd $pwd
sleep 2
@@ -44,7 +43,7 @@ sleep 2
rc=$?
# Cleanup
-kill `ps -f | grep -v grep | grep "$axis2" | awk '{ print $2 }'`
-apachectl -k stop -d `pwd`/tmp
+kill `ps -f | grep -v grep | grep "${axis2}" | awk '{ print $2 }'`
+../../modules/http/httpd-stop tmp
sleep 2
return $rc
diff --git a/sca-cpp/trunk/components/webservice/webservice-client.cpp b/sca-cpp/trunk/components/webservice/webservice-client.cpp
index cc3a15c734..ae4e472e65 100644
--- a/sca-cpp/trunk/components/webservice/webservice-client.cpp
+++ b/sca-cpp/trunk/components/webservice/webservice-client.cpp
@@ -56,7 +56,10 @@ const failable<value> apply(const value& func, const list<value>& params) {
extern "C" {
const tuscany::value apply(const tuscany::list<tuscany::value>& params) {
- return tuscany::webservice::apply(car(params), cdr(params));
+ const tuscany::value func(car(params));
+ if (func == "start" || func == "stop" || func == "restart")
+ return tuscany::mkfailure<tuscany::value>();
+ return tuscany::webservice::apply(func, cdr(params));
}
}
diff --git a/sca-cpp/trunk/components/webservice/webservice-listener.cpp b/sca-cpp/trunk/components/webservice/webservice-listener.cpp
index 7198a00749..2127ecf0df 100644
--- a/sca-cpp/trunk/components/webservice/webservice-listener.cpp
+++ b/sca-cpp/trunk/components/webservice/webservice-listener.cpp
@@ -80,7 +80,7 @@ const tuscany::value apply(const tuscany::list<tuscany::value>& params) {
const tuscany::value func(car(params));
if (func == "handle")
return tuscany::webservice::handle(cdr(params));
- return tuscany::mkfailure<tuscany::value>(tuscany::string("Function not supported: ") + func);
+ return tuscany::mkfailure<tuscany::value>();
}
}