I'm tryin to do JIRA Fisheye Integration via a a program . I have all repositories and projects setup both in JIRA and FIshEye . Somehow it is not working.. Can somebody help me in doing this..
JIRA VErsion: 4.1.2
JIRA FishEYe Plugin :3.0.17
code which does the JIRA Fisheye Integration
import com.gs.apg.conductor.domain.build.Base64Encryption;
import org.apache.commons.httpclient.Cookie;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.methods.GetMethod;
import org.apache.commons.httpclient.methods.PostMethod;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.protocol.BasicHttpContext;
import org.apache.http.protocol.HttpContext;
import org.apache.http.util.EntityUtils;
public class TestClient
{
public static final String username="xxxx";
public static final String password="xxx";
public static final String JIRA_HOST_NAME="http://XXXXX:7150/jira";
public void test()
{
HttpClient client = new HttpClient();
GetMethod method = new GetMethod(JIRA_HOST_NAME + "/plugins/servlet/token");
final String userNameWithPassword = username + ":" + password;
String encodedUserNameWithPassword = Base64Encryption.encodeBytes(userNameWithPassword.getBytes());
method.setRequestHeader("Authorization", "Basic " + encodedUserNameWithPassword);
method.getParams().setParameter("os_authType","basic");
method.getParams().setParameter("os_username",username);
method.getParams().setParameter("os_password",password);
try {
int result = client.executeMethod(method);
System.out.println("Response status code: " + method.getResponseBodyAsString());
String atl_token = method.getResponseBodyAsString();
Cookie[] cookies = client.getState().getCookies();
System.out.println("Present cookies: ");
for (int i = 0; i < cookies.length; i++) {
Cookie cookie = cookies[i];
System.out.println(cookie.getName() + "-" +cookie.toExternalForm());
}
PostMethod method2 = new PostMethod(JIRA_HOST_NAME + "/secure/admin/AssociateFishEyeReps!default.jspa");
method2.addParameter("rep_TEST1","TEST1");
method2.addParameter("rep_TEST2","TEST2");
method2.addParameter("rep_TEST3","TEST3");
method2.addRequestHeader("atl_token",atl_token);
int result2 = client.executeMethod(method2);
System.out.println("Method2 Response Body: " + method2.getResponseBodyAsString());
cookies = client.getState().getCookies();
System.out.println("Present cookies: ");
for (int i = 0; i < cookies.length; i++) {
Cookie cookie = cookies[i];
System.out.println(cookie.getName() + "-" +cookie.toExternalForm());
}
method.releaseConnection();
}catch (Exception ex) {
ex.printStackTrace();
}
}
As Joe said, please post any log output or error output that indicates what is failing.
Also, try leveraging a simple API action (submit a new ticket, etc) first to ensure you are authenticating and getting a token properly.
It'd be easier to diagnose your problem if you post the 'errors'.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.