1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
|
package fr.testserveur;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Vector;
import org.apache.xmlrpc.client.XmlRpcClient;
import org.apache.xmlrpc.XmlRpcException;
import org.apache.xmlrpc.client.XmlRpcClientConfigImpl;
import org.xml.sax.helpers.DefaultHandler;
import java.lang.Object;
import javax.naming.*;
public class TestConnexion {
// Global variable declaration
String testJira = null;
String testBd = null;
public static String Jira_URL = "https://calitrack.calyon.cib";
public static String RPC_PATH = "/rpc/xmlrpc";
public static final String USER_NAME = "moa";
public static final String PASSWORD = "mdp";
public static final String Search_TERM = "zo";
/* Connection test jira : realizes a research on Calitrack Application
* @author Elodie Bardaji
* @return OK if the research performed and KO if not
*/
public String testJIRA() {
try
{
// Initialisation of RCP Client
XmlRpcClient rpcClient = new XmlRpcClient();
// Login and retrieve logon token
Vector loginParams = new Vector(2);
loginParams.add(USER_NAME);
loginParams.add(PASSWORD);
String loginToken = (String) rpcClient.execute("jira1.login", loginParams);
// Retrieve issues
Vector loginTokenVector = new Vector(1);
loginTokenVector.add(loginToken);
loginTokenVector.add(Search_TERM);
List issues = (List)rpcClient.execute("jira1.getIssuesFromTextSearch", loginTokenVector);
// Analyse the result
testJira = "OK";
return (testJira);
}
catch (Exception e)
{
testJira = "KO";
return (testJira);
}
}
/* Connection test database : realizes a connection to the data base and a request.
* @author Elodie Bardaji
* @return OK if the database is available and KO if not
*/
/*public String testBD() {
return (testBd);
}*/
} |
Partager