diff options
author | jsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68> | 2012-03-17 18:10:05 +0000 |
---|---|---|
committer | jsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68> | 2012-03-17 18:10:05 +0000 |
commit | 46753b6278c89eb0c7095e1af5a84a4140f716a4 (patch) | |
tree | 31832b08f807bbbadd3bdd09b6e2f65055ead5c2 /sca-cpp/trunk/components | |
parent | 76835ec65da7e3749d7173816f1032a9a6efe6f8 (diff) |
Upgrade to newer version of CURL and integrate its SMTP support.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1301969 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-cpp/trunk/components')
21 files changed, 611 insertions, 13 deletions
diff --git a/sca-cpp/trunk/components/Makefile.am b/sca-cpp/trunk/components/Makefile.am index 078e04ee74..6d3807058c 100644 --- a/sca-cpp/trunk/components/Makefile.am +++ b/sca-cpp/trunk/components/Makefile.am @@ -15,5 +15,5 @@ # specific language governing permissions and limitations # under the License. -SUBDIRS = cache chat http log constdb filedb queue sqldb webservice +SUBDIRS = cache chat http smtp log constdb filedb queue sqldb webservice diff --git a/sca-cpp/trunk/components/http/Makefile.am b/sca-cpp/trunk/components/http/Makefile.am index 8b97f2e16d..623be12298 100644 --- a/sca-cpp/trunk/components/http/Makefile.am +++ b/sca-cpp/trunk/components/http/Makefile.am @@ -17,7 +17,7 @@ compdir=$(prefix)/components/http -EXTRA_DIST = http.composite httpget.componentType httpdelete.componentType *.scm +EXTRA_DIST = http.composite httpget.componentType httppost.componentType httpput.componentType httppatch.componentType httpdelete.componentType *.scm comp_LTLIBRARIES = libhttpget.la libhttpdelete.la libhttppost.la libhttpput.la libhttppatch.la noinst_DATA = libhttpget${libsuffix} libhttpdelete${libsuffix} libhttppost${libsuffix} libhttpput${libsuffix} libhttppatch${libsuffix} diff --git a/sca-cpp/trunk/components/http/client-test.cpp b/sca-cpp/trunk/components/http/client-test.cpp index 3ce9f1ae68..c040ed39df 100644 --- a/sca-cpp/trunk/components/http/client-test.cpp +++ b/sca-cpp/trunk/components/http/client-test.cpp @@ -20,7 +20,7 @@ /* $Rev$ $Date$ */ /** - * Test file database component. + * Test HTTP components. */ #include <assert.h> diff --git a/sca-cpp/trunk/components/http/httpdelete.componentType b/sca-cpp/trunk/components/http/httpdelete.componentType index 620f549e21..34e2a60632 100644 --- a/sca-cpp/trunk/components/http/httpdelete.componentType +++ b/sca-cpp/trunk/components/http/httpdelete.componentType @@ -22,7 +22,7 @@ xmlns:t="http://tuscany.apache.org/xmlns/sca/1.1" targetNamespace="http://tuscany.apache.org/xmlns/sca/components"> - <service name="http"/> + <service name="httpdelete"/> <reference name="url"/> -</composite> +</componentType> diff --git a/sca-cpp/trunk/components/http/httpget.componentType b/sca-cpp/trunk/components/http/httpget.componentType index 620f549e21..a45474b88d 100644 --- a/sca-cpp/trunk/components/http/httpget.componentType +++ b/sca-cpp/trunk/components/http/httpget.componentType @@ -22,7 +22,7 @@ xmlns:t="http://tuscany.apache.org/xmlns/sca/1.1" targetNamespace="http://tuscany.apache.org/xmlns/sca/components"> - <service name="http"/> + <service name="httpget"/> <reference name="url"/> -</composite> +</componentType> diff --git a/sca-cpp/trunk/components/http/httppatch.componentType b/sca-cpp/trunk/components/http/httppatch.componentType index 8f3173be85..0ab5ecf45b 100644 --- a/sca-cpp/trunk/components/http/httppatch.componentType +++ b/sca-cpp/trunk/components/http/httppatch.componentType @@ -22,8 +22,8 @@ xmlns:t="http://tuscany.apache.org/xmlns/sca/1.1" targetNamespace="http://tuscany.apache.org/xmlns/sca/components"> - <service name="http"/> + <service name="httppatch"/> <reference name="url"/> <reference name="content"/> -</composite> +</componentType> diff --git a/sca-cpp/trunk/components/http/httppost.componentType b/sca-cpp/trunk/components/http/httppost.componentType index 8f3173be85..2cb7310332 100644 --- a/sca-cpp/trunk/components/http/httppost.componentType +++ b/sca-cpp/trunk/components/http/httppost.componentType @@ -22,8 +22,8 @@ xmlns:t="http://tuscany.apache.org/xmlns/sca/1.1" targetNamespace="http://tuscany.apache.org/xmlns/sca/components"> - <service name="http"/> + <service name="httppost"/> <reference name="url"/> <reference name="content"/> -</composite> +</componentType> diff --git a/sca-cpp/trunk/components/http/httpput.componentType b/sca-cpp/trunk/components/http/httpput.componentType index 8f3173be85..654bb5e82f 100644 --- a/sca-cpp/trunk/components/http/httpput.componentType +++ b/sca-cpp/trunk/components/http/httpput.componentType @@ -22,8 +22,8 @@ xmlns:t="http://tuscany.apache.org/xmlns/sca/1.1" targetNamespace="http://tuscany.apache.org/xmlns/sca/components"> - <service name="http"/> + <service name="httpput"/> <reference name="url"/> <reference name="content"/> -</composite> +</componentType> diff --git a/sca-cpp/trunk/components/smtp/Makefile.am b/sca-cpp/trunk/components/smtp/Makefile.am new file mode 100644 index 0000000000..41fa686b9a --- /dev/null +++ b/sca-cpp/trunk/components/smtp/Makefile.am @@ -0,0 +1,36 @@ +# 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. + +compdir=$(prefix)/components/smtp + +EXTRA_DIST = smtp.composite smtppost.componentType *.scm + +comp_LTLIBRARIES = libsmtppost.la +noinst_DATA = libsmtppost${libsuffix} + +libsmtppost_la_SOURCES = smtppost.cpp +libsmtppost_la_LDFLAGS = -lxml2 -lmozjs -curl +libsmtppost${libsuffix}: + ln -s .libs/libsmtppost${libsuffix} + +client_test_SOURCES = client-test.cpp +client_test_LDFLAGS = -lxml2 -lcurl -lmozjs + +dist_noinst_SCRIPTS = server-test +noinst_PROGRAMS = client-test +#TESTS = server-test + diff --git a/sca-cpp/trunk/components/smtp/client-test.cpp b/sca-cpp/trunk/components/smtp/client-test.cpp new file mode 100644 index 0000000000..216861d35e --- /dev/null +++ b/sca-cpp/trunk/components/smtp/client-test.cpp @@ -0,0 +1,60 @@ +/* + * 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 SMTP post component. + */ + +#include <assert.h> +#include "stream.hpp" +#include "string.hpp" + +#include "list.hpp" +#include "value.hpp" +#include "monad.hpp" +#include "perf.hpp" +#include "../../modules/http/http.hpp" + +namespace tuscany { +namespace smtp { + +const string postURI("http://localhost:8090/smtppost"); + +bool testPost() { + http::CURLSession cs("", "", "", ""); + + const failable<value> val = http::get(postURI, cs); + assert(hasContent(val)); + return true; +} + +} +} + +int main() { + tuscany::cout << "Testing..." << tuscany::endl; + + tuscany::smtp::testPost(); + + tuscany::cout << "OK" << tuscany::endl; + + return 0; +} diff --git a/sca-cpp/trunk/components/smtp/content-test.scm b/sca-cpp/trunk/components/smtp/content-test.scm new file mode 100644 index 0000000000..eaf4a868c5 --- /dev/null +++ b/sca-cpp/trunk/components/smtp/content-test.scm @@ -0,0 +1,27 @@ +; 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. + +; Content test case + +(define (get id) +(list "text/plain; charset=utf-8" (list +"test test test + +- Jean-Sebastien" +)) +) + diff --git a/sca-cpp/trunk/components/smtp/from-test.scm b/sca-cpp/trunk/components/smtp/from-test.scm new file mode 100644 index 0000000000..083c060844 --- /dev/null +++ b/sca-cpp/trunk/components/smtp/from-test.scm @@ -0,0 +1,23 @@ +; 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. + +; From test case + +(define (get id) + "<jane@example.com>" +) + diff --git a/sca-cpp/trunk/components/smtp/password-test.scm b/sca-cpp/trunk/components/smtp/password-test.scm new file mode 100644 index 0000000000..0a28776865 --- /dev/null +++ b/sca-cpp/trunk/components/smtp/password-test.scm @@ -0,0 +1,23 @@ +; 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. + +; Password test case + +(define (get id) + "password" +) + diff --git a/sca-cpp/trunk/components/smtp/server-test b/sca-cpp/trunk/components/smtp/server-test new file mode 100755 index 0000000000..55464edc89 --- /dev/null +++ b/sca-cpp/trunk/components/smtp/server-test @@ -0,0 +1,40 @@ +#!/bin/sh + +# 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. + +# Setup +../../modules/http/httpd-conf tmp localhost 8090 ../../modules/http/htdocs +../../modules/http/httpd-loglevel-conf tmp debug +../../modules/server/server-conf tmp +../../modules/server/scheme-conf tmp +cat >>tmp/conf/httpd.conf <<EOF +SCAContribution `pwd`/ +SCAComposite smtp.composite +EOF + +../../modules/http/httpd-start tmp +sleep 2 + +# Test +./client-test #2>/dev/null +rc=$? + +# Cleanup +../../modules/http/httpd-stop tmp +sleep 2 +exit $rc diff --git a/sca-cpp/trunk/components/smtp/smtp.composite b/sca-cpp/trunk/components/smtp/smtp.composite new file mode 100644 index 0000000000..c740b68bc9 --- /dev/null +++ b/sca-cpp/trunk/components/smtp/smtp.composite @@ -0,0 +1,87 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * 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. +--> +<composite xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912" + targetNamespace="http://tuscany.apache.org/xmlns/sca/components" + name="smtp"> + + <component name="smtppost"> + <implementation.cpp path="." library="libsmtppost"/> + <service name="smtppost"> + <binding.http uri="smtppost"/> + </service> + <reference name="url" target="url-test"/> + <reference name="user" target="user-test"/> + <reference name="password" target="password-test"/> + <reference name="from" target="from-test"/> + <reference name="to" target="to-test"/> + <reference name="subject" target="subject-test"/> + <reference name="content" target="content-test"/> + </component> + + <component name="url-test"> + <implementation.scheme script="url-test.scm"/> + <service name="url-test"> + <binding.http uri="url-test"/> + </service> + </component> + + <component name="password-test"> + <implementation.scheme script="password-test.scm"/> + <service name="password-test"> + <binding.http uri="password-test"/> + </service> + </component> + + <component name="user-test"> + <implementation.scheme script="user-test.scm"/> + <service name="user-test"> + <binding.http uri="user-test"/> + </service> + </component> + + <component name="from-test"> + <implementation.scheme script="from-test.scm"/> + <service name="from-test"> + <binding.http uri="from-test"/> + </service> + </component> + + <component name="to-test"> + <implementation.scheme script="to-test.scm"/> + <service name="to-test"> + <binding.http uri="to-test"/> + </service> + </component> + + <component name="subject-test"> + <implementation.scheme script="subject-test.scm"/> + <service name="subject-test"> + <binding.http uri="subject-test"/> + </service> + </component> + + <component name="content-test"> + <implementation.scheme script="content-test.scm"/> + <service name="content-test"> + <binding.http uri="content-test"/> + </service> + </component> + +</composite> diff --git a/sca-cpp/trunk/components/smtp/smtppost.componentType b/sca-cpp/trunk/components/smtp/smtppost.componentType new file mode 100644 index 0000000000..f33673b53e --- /dev/null +++ b/sca-cpp/trunk/components/smtp/smtppost.componentType @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * 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. +--> +<componentType xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912" + xmlns:xsd="http://www.w3.org/2001/XMLSchema" + xmlns:t="http://tuscany.apache.org/xmlns/sca/1.1" + targetNamespace="http://tuscany.apache.org/xmlns/sca/components"> + + <service name="smtppost"/> + <reference name="url"/> + <reference name="user"/> + <reference name="password"/> + <reference name="from"/> + <reference name="to"/> + <reference name="subject"/> + <reference name="content"/> + +</componentType> diff --git a/sca-cpp/trunk/components/smtp/smtppost.cpp b/sca-cpp/trunk/components/smtp/smtppost.cpp new file mode 100644 index 0000000000..a3eae095ef --- /dev/null +++ b/sca-cpp/trunk/components/smtp/smtppost.cpp @@ -0,0 +1,176 @@ +/* + * 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$ */ + +/** + * SMTP client component implementation. + */ + +#define WANT_HTTPD_LOG 1 +#include "string.hpp" +#include "function.hpp" +#include "list.hpp" +#include "value.hpp" +#include "monad.hpp" +#include "parallel.hpp" +#include "../../modules/http/http.hpp" + +namespace tuscany { +namespace smtppost { + +/** + * Post/send an email message using SMTP. + */ +const failable<value> post(const string& url, const string& user, const string& pass, const string& from, const string& to, const string& subject, const value& val, const http::CURLSession& cs) { + // Convert value to a content request + const failable<list<list<string> > > freq = http::contentRequest(val, url); + if (!hasContent(freq)) + return mkfailure<value>(reason(freq)); + const list<list<string> > req = content(freq); + debug(req, "smtp::post::input"); + + // Setup the CURL session + const failable<CURL*> fch = http::setup(url, cs); + if (!hasContent(fch)) + return mkfailure<value>(reason(fch)); + CURL* ch = content(fch); + curl_easy_setopt(ch, CURLOPT_USE_SSL, (long)CURLUSESSL_ALL); + + // Convert message to a string + ostringstream os; + os << "From: " << from << "\n"; + os << "To: " << to << "\n"; + os << "Subject: " << subject << "\n"; + os << car(car(req)) << "\n\n"; + write(cadr(req), os); + + // Setup the read callbacks + http::CURLReadContext rcx(mklist(str(os))); + curl_easy_setopt(ch, CURLOPT_READFUNCTION, (size_t (*)(void*, size_t, size_t, void*))http::readCallback); + curl_easy_setopt(ch, CURLOPT_READDATA, &rcx); + + // Setup the message properties + curl_easy_setopt(ch, CURLOPT_USERNAME, c_str(user)); + curl_easy_setopt(ch, CURLOPT_PASSWORD, c_str(pass)); + curl_easy_setopt(ch, CURLOPT_MAIL_FROM, c_str(from)); + struct curl_slist* rcpt = curl_slist_append(NULL, c_str(to)); + curl_easy_setopt(ch, CURLOPT_MAIL_RCPT, rcpt); + + // Perform the SMTP send + const CURLcode rc = curl_easy_perform(ch); + + // Free the recipients + curl_slist_free_all(rcpt); + + // Return the CURL return code or true + if (rc) + return mkfailure<value>(string(curl_easy_strerror(rc))); + return value(true); +} + +/** + * Evaluate an SMTP post/send. + */ +const failable<value> get(const lambda<value(const list<value>&)> url, + const lambda<value(const list<value>&)> user, const lambda<value(const list<value>&)> pass, + const lambda<value(const list<value>&)> from, const lambda<value(const list<value>&)> to, + const lambda<value(const list<value>&)> subject, const lambda<value(const list<value>&)> val, + http::CURLSession& ch) { + debug("smtppost::get"); + const value u = url(mklist<value>("get", list<value>())); + const value i = user(mklist<value>("get", list<value>())); + const value p = pass(mklist<value>("get", list<value>())); + const value f = from(mklist<value>("get", list<value>())); + const value t = to(mklist<value>("get", list<value>())); + const value s = subject(mklist<value>("get", list<value>())); + const value v = val(mklist<value>("get", list<value>())); + debug(u, "smtppost::get::url"); + debug(i, "smtppost::get::user"); + debug(p, "smtppost::get::pass"); + debug(f, "smtppost::get::from"); + debug(t, "smtppost::get::to"); + debug(s, "smtppost::get::subject"); + debug(v, "smtppost::get::val"); + return post(u, i, p, f, t, s, v, ch); +} + +/** + * Component implementation lambda function. + */ +class applysmtp { +public: + applysmtp(const lambda<value(const list<value>&)> url, + const lambda<value(const list<value>&)> user, const lambda<value(const list<value>&)> pass, + const lambda<value(const list<value>&)> from, const lambda<value(const list<value>&)> to, + const lambda<value(const list<value>&)> subject, const lambda<value(const list<value>&)> val, + const perthread_ptr<http::CURLSession>& ch) : + url(url), user(user), pass(pass), from(from), to(to), subject(subject), val(val), ch(ch) { + } + + const value operator()(const list<value>& params) const { + debug(params, "smtppost::applysmtp::params"); + const value func(car(params)); + if (func == "get") + return get(url, user, pass, from, to, subject, val, *ch); + return tuscany::mkfailure<tuscany::value>(); + } + +private: + const lambda<value(const list<value>&)> url; + const lambda<value(const list<value>&)> user; + const lambda<value(const list<value>&)> pass; + const lambda<value(const list<value>&)> from; + const lambda<value(const list<value>&)> to; + const lambda<value(const list<value>&)> subject; + const lambda<value(const list<value>&)> val; + perthread_ptr<http::CURLSession> ch; +}; + +/** + * Create a new CURL session. + */ +const gc_ptr<http::CURLSession> newsession() { + return new (gc_new<http::CURLSession>()) http::CURLSession("", "", "", ""); +} + +/** + * Start the component. + */ +const failable<value> start(const list<value>& params) { + // Create a CURL session + const perthread_ptr<http::CURLSession> ch = perthread_ptr<http::CURLSession>(lambda<gc_ptr<http::CURLSession>()>(newsession)); + + // Return the component implementation lambda function + return value(lambda<value(const list<value>&)>(applysmtp(car(params), cadr(params), caddr(params), cadddr(params), caddddr(params), cadddddr(params), caddddddr(params), ch))); +} + +} +} + +extern "C" { + +const tuscany::value apply(const tuscany::list<tuscany::value>& params) { + const tuscany::value func(car(params)); + if (func == "start") + return tuscany::smtppost::start(cdr(params)); + return tuscany::mkfailure<tuscany::value>(); +} + +} diff --git a/sca-cpp/trunk/components/smtp/subject-test.scm b/sca-cpp/trunk/components/smtp/subject-test.scm new file mode 100644 index 0000000000..6a296cbea8 --- /dev/null +++ b/sca-cpp/trunk/components/smtp/subject-test.scm @@ -0,0 +1,23 @@ +; 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. + +; Subject test case + +(define (get id) + "Test email" +) + diff --git a/sca-cpp/trunk/components/smtp/to-test.scm b/sca-cpp/trunk/components/smtp/to-test.scm new file mode 100644 index 0000000000..079df89301 --- /dev/null +++ b/sca-cpp/trunk/components/smtp/to-test.scm @@ -0,0 +1,23 @@ +; 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. + +; To test case + +(define (get id) + "<jane@example.com>" +) + diff --git a/sca-cpp/trunk/components/smtp/url-test.scm b/sca-cpp/trunk/components/smtp/url-test.scm new file mode 100644 index 0000000000..aa73c59d5c --- /dev/null +++ b/sca-cpp/trunk/components/smtp/url-test.scm @@ -0,0 +1,23 @@ +; 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. + +; URL test case + +(define (get id) + "smtp://smtp.gmail.com:587" +) + diff --git a/sca-cpp/trunk/components/smtp/user-test.scm b/sca-cpp/trunk/components/smtp/user-test.scm new file mode 100644 index 0000000000..13862ac70c --- /dev/null +++ b/sca-cpp/trunk/components/smtp/user-test.scm @@ -0,0 +1,23 @@ +; 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. + +; URL test case + +(define (get id) + "jane" +) + |