KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > axis2 > transport > SimpleMailListnerTest


1 /*
2  * Copyright 2001-2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package org.apache.axis2.transport;
17 import junit.framework.TestCase;
18 import org.apache.axis2.transport.mail.SimpleMailListener;
19
20 public class SimpleMailListnerTest extends TestCase {
21     private SimpleMailListener sas;
22     public SimpleMailListnerTest(String JavaDoc testName) {
23         super(testName);
24     }
25     
26 // public void setUp(){
27
// Thread thread = new Thread(new Runnable() {
28
// public void run() {
29
// boolean optDoThreads = true;
30
// String optHostName = "localhost";
31
// boolean optUseCustomPort = false;
32
// int optCustomPortToUse = 0;
33
// String optDir = "FIX_ME_PLS";
34
// String optUserName = "server";
35
// String optPassword = "server";
36
// System.out.println("Starting the mail listner");
37
// try {
38
// String host = optHostName;
39
// int port = ((optUseCustomPort) ? optCustomPortToUse : 110);
40
// POP3Client pop3 = new POP3Client();
41
// sas = new SimpleMailListner(host, port, optUserName,
42
// optPassword, optDir);
43
// sas.setDoThreads(optDoThreads);
44
// sas.setPOP3(pop3);
45
// sas.start();
46
// } catch (Exception e) {
47
// System.out.println("An error occured in the main method of SimpleMailListner. TODO Detailed error message needs to be inserted here.");
48
// return;
49
// }
50
//
51
//
52
// }
53
// });
54
// thread.start();
55
//
56
// }
57

58     public void testSendViaMailAndRecieve() throws Exception JavaDoc {
59 // // CREATE CLIENT INSTANCE MailClient(String user, String host, String password)
60
// MailClient mailclient = new MailClient("client", "localhost", "client");
61
//
62
// String fileContents = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\"> <soapenv:Header></soapenv:Header> <soapenv:Body> <samples:echo xmlns:samples=\"http://apache.ws.apache.org/samples\"> <samples:param1 xmlns:arrays=\"http://axis.apache.org/encoding/Arrays\"> <arrays:item>Hello testing1</arrays:item> <arrays:item>Hello testing2</arrays:item> <arrays:item>Hello testing3</arrays:item> <arrays:item>Hello testing4</arrays:item> <arrays:item>Hello testing5</arrays:item> </samples:param1> </samples:echo> </soapenv:Body></soapenv:Envelope>";
63
// String soapService = "sample1";
64
//
65
// // SEND A MESSAGE TO THE SERVER
66
// mailclient.sendMessage(
67
// "server@localhost",
68
// "Testing SOAP with service - " + soapService,
69
// fileContents, soapService);
70
//
71
// int count =0;
72
// boolean success = false;
73
//
74
// while (count<10 && !success) {
75
// Thread.sleep(10000);
76
// success = (mailclient.checkInbox(3)>0);
77
// }
78
//
79
}
80     
81     public void tearDown() throws Exception JavaDoc{
82 // sas.stop();
83
}
84     
85 }
86
87
Popular Tags