summaryrefslogtreecommitdiffstats
path: root/sca-cpp/branches/lightweight-sca/components/smtp
diff options
context:
space:
mode:
Diffstat (limited to 'sca-cpp/branches/lightweight-sca/components/smtp')
-rw-r--r--sca-cpp/branches/lightweight-sca/components/smtp/Makefile.am36
-rw-r--r--sca-cpp/branches/lightweight-sca/components/smtp/client-test.cpp60
-rw-r--r--sca-cpp/branches/lightweight-sca/components/smtp/content-test.scm27
-rw-r--r--sca-cpp/branches/lightweight-sca/components/smtp/from-test.scm23
-rw-r--r--sca-cpp/branches/lightweight-sca/components/smtp/password-test.scm23
-rwxr-xr-xsca-cpp/branches/lightweight-sca/components/smtp/server-test41
-rw-r--r--sca-cpp/branches/lightweight-sca/components/smtp/smtp.composite87
-rw-r--r--sca-cpp/branches/lightweight-sca/components/smtp/smtppost.componentType34
-rw-r--r--sca-cpp/branches/lightweight-sca/components/smtp/smtppost.cpp182
-rw-r--r--sca-cpp/branches/lightweight-sca/components/smtp/subject-test.scm23
-rw-r--r--sca-cpp/branches/lightweight-sca/components/smtp/to-test.scm23
-rw-r--r--sca-cpp/branches/lightweight-sca/components/smtp/url-test.scm23
-rw-r--r--sca-cpp/branches/lightweight-sca/components/smtp/user-test.scm23
13 files changed, 605 insertions, 0 deletions
diff --git a/sca-cpp/branches/lightweight-sca/components/smtp/Makefile.am b/sca-cpp/branches/lightweight-sca/components/smtp/Makefile.am
new file mode 100644
index 0000000000..41fa686b9a
--- /dev/null
+++ b/sca-cpp/branches/lightweight-sca/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/branches/lightweight-sca/components/smtp/client-test.cpp b/sca-cpp/branches/lightweight-sca/components/smtp/client-test.cpp
new file mode 100644
index 0000000000..10274a6248
--- /dev/null
+++ b/sca-cpp/branches/lightweight-sca/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("", "", "", "", 0);
+
+ 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/branches/lightweight-sca/components/smtp/content-test.scm b/sca-cpp/branches/lightweight-sca/components/smtp/content-test.scm
new file mode 100644
index 0000000000..eaf4a868c5
--- /dev/null
+++ b/sca-cpp/branches/lightweight-sca/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/branches/lightweight-sca/components/smtp/from-test.scm b/sca-cpp/branches/lightweight-sca/components/smtp/from-test.scm
new file mode 100644
index 0000000000..083c060844
--- /dev/null
+++ b/sca-cpp/branches/lightweight-sca/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/branches/lightweight-sca/components/smtp/password-test.scm b/sca-cpp/branches/lightweight-sca/components/smtp/password-test.scm
new file mode 100644
index 0000000000..0a28776865
--- /dev/null
+++ b/sca-cpp/branches/lightweight-sca/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/branches/lightweight-sca/components/smtp/server-test b/sca-cpp/branches/lightweight-sca/components/smtp/server-test
new file mode 100755
index 0000000000..c111021c85
--- /dev/null
+++ b/sca-cpp/branches/lightweight-sca/components/smtp/server-test
@@ -0,0 +1,41 @@
+#!/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
+rm -rf tmp
+../../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/branches/lightweight-sca/components/smtp/smtp.composite b/sca-cpp/branches/lightweight-sca/components/smtp/smtp.composite
new file mode 100644
index 0000000000..c740b68bc9
--- /dev/null
+++ b/sca-cpp/branches/lightweight-sca/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/branches/lightweight-sca/components/smtp/smtppost.componentType b/sca-cpp/branches/lightweight-sca/components/smtp/smtppost.componentType
new file mode 100644
index 0000000000..f33673b53e
--- /dev/null
+++ b/sca-cpp/branches/lightweight-sca/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/branches/lightweight-sca/components/smtp/smtppost.cpp b/sca-cpp/branches/lightweight-sca/components/smtp/smtppost.cpp
new file mode 100644
index 0000000000..1030ccc223
--- /dev/null
+++ b/sca-cpp/branches/lightweight-sca/components/smtp/smtppost.cpp
@@ -0,0 +1,182 @@
+/*
+ * 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, 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>(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)) {
+ http::cleanup(cs);
+ return mkfailure<value>(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) {
+ http::cleanup(cs);
+ return mkfailure<value>(string(curl_easy_strerror(rc)));
+ }
+
+ http::cleanup(cs);
+ 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,
+ 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 mkfailure<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("", "", "", "", 0);
+}
+
+/**
+ * Start the component.
+ */
+const failable<value> start(const list<value>& params) {
+ // Create a CURL session
+ 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/branches/lightweight-sca/components/smtp/subject-test.scm b/sca-cpp/branches/lightweight-sca/components/smtp/subject-test.scm
new file mode 100644
index 0000000000..6a296cbea8
--- /dev/null
+++ b/sca-cpp/branches/lightweight-sca/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/branches/lightweight-sca/components/smtp/to-test.scm b/sca-cpp/branches/lightweight-sca/components/smtp/to-test.scm
new file mode 100644
index 0000000000..079df89301
--- /dev/null
+++ b/sca-cpp/branches/lightweight-sca/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/branches/lightweight-sca/components/smtp/url-test.scm b/sca-cpp/branches/lightweight-sca/components/smtp/url-test.scm
new file mode 100644
index 0000000000..aa73c59d5c
--- /dev/null
+++ b/sca-cpp/branches/lightweight-sca/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/branches/lightweight-sca/components/smtp/user-test.scm b/sca-cpp/branches/lightweight-sca/components/smtp/user-test.scm
new file mode 100644
index 0000000000..13862ac70c
--- /dev/null
+++ b/sca-cpp/branches/lightweight-sca/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"
+)
+