maven-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Behrooz N <nob...@gmail.com>
Subject [CHANGES PLUGIN] 'webUser' is ignored for JIRA report
Date Mon, 24 Mar 2014 09:11:36 GMT
Hello,

I want to generate a JIRA report using Changes Plugin. I've managed to
re-produce a situation which is contradictory:

   1. I use Maven and POM to generate the JIRA report.
   2. I checkout 2.9 source and use a JUnit test class to verify.

In case (1), the following Maven configuration is used:

    <reporting>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-changes-plugin</artifactId>
                <version>2.9</version>
                <configuration>
                    <useJql>true</useJql>
                    <onlyCurrentVersion>true</onlyCurrentVersion>
                    <statusIds>Closed,Resolved</statusIds>
                    <webUser>USER</webUser>
                    <webPassword>PASS</webPassword>
                </configuration>
            </plugin>
        </plugins>
    </reporting>

Then using mvn -X changes:jira-report, I get the following:

---------------------------
ID: 2
Address: https://MYJIRA.COM/issuetracker/rest/api/2/status
Http-Method: GET
Content-Type: */*
Headers: {Accept=[application/json], Content-Type=[*/*]}
--------------------------------------
[DEBUG] Accept: application/json
[DEBUG] Content-Type: */*
[DEBUG] No Trust Decider for Conduit
'{https://MYJIRA.COM/issuetracker}WebClient.http-conduit'. An
afirmative Trust Decision is assumed.
[DEBUG] Response Code: 200 Conduit:
{https://MYJIRA.COM/issuetracker}WebClient.http-conduit
[DEBUG] Content length: -1
[DEBUG] Header fields:
    null: [HTTP/1.1 200 OK]
    Transfer-Encoding: [chunked]
    Date: [Mon, 24 Mar 2014 08:23:14 GMT]
    Keep-Alive: [timeout=15, max=99]
    Via: [1.1 MYJIRA.COM]
    Set-Cookie:
[atlassian.xsrf.token=AMUY-0X4J-KTOA-WYA4|faf5142cf78de245e3573fc6cd122b41d1a0fe8e|lout;
Path=/issuetracker]
    Connection: [Keep-Alive]
    Content-Type: [application/json;charset=UTF-8]
    X-AUSERNAME: [anonymous]
    X-AREQUESTID: [563x130866x1]
    Server: [Apache-Coyote/1.1]
    Cache-Control: [no-cache, no-store, no-transform]

[DEBUG] Adding interceptor
org.apache.cxf.interceptor.LoggingInInterceptor@5af3a14 to phase
receive
[DEBUG] Chain org.apache.cxf.phase.PhaseInterceptorChain@574e6595 was
created. Current flow:
  receive [LoggingInInterceptor]

[DEBUG] Invoking handleMessage on interceptor
org.apache.cxf.interceptor.LoggingInInterceptor@5af3a14
[INFO] Inbound Message
----------------------------
ID: 2
Response-Code: 200
Encoding: UTF-8
Content-Type: application/json;charset=UTF-8
Headers: {Cache-Control=[no-cache, no-store, no-transform],
connection=[Keep-Alive],
content-type=[application/json;charset=UTF-8], Date=[Mon, 24 Mar 2014
08:23:14 GMT], Keep-Alive=[timeout=15, max=99],
Server=[Apache-Coyote/1.1],
Set-Cookie=[atlassian.xsrf.token=AMUY-0X4J-KTOA-WYA4|faf5142cf78de245e3573fc6cd122b41d1a0fe8e|lout;
Path=/issuetracker], transfer-encoding=[chunked], Via=[1.1
MYJIRA.COM], X-AREQUESTID=[563x130866x1], X-AUSERNAME=[anonymous]}
Payload: []

In the above note that HTTPS is used, result Payload is empty and "webUser"
is *ignored* (as anonymous) and Authorization Header is missing.
Additionally, Maven ends with the following exception which makes sense
based on the code:

org.apache.maven.plugin.MojoFailureException: Could not find status Closed.
    at org.apache.maven.plugin.jira.RestJiraDownloader.resolveOneItem(RestJiraDownloader.java:276)
    at org.apache.maven.plugin.jira.RestJiraDownloader.resolveList(RestJiraDownloader.java:253)
    at org.apache.maven.plugin.jira.RestJiraDownloader.resolveIds(RestJiraDownloader.java:210)
    at org.apache.maven.plugin.jira.RestJiraDownloader.doExecute(RestJiraDownloader.java:128)
    at org.apache.maven.plugin.jira.AdaptiveJiraDownloader.doExecute(AdaptiveJiraDownloader.java:47)
    at org.apache.maven.plugin.jira.JiraMojo.executeReport(JiraMojo.java:367)
    at org.apache.maven.reporting.AbstractMavenReport.generate(AbstractMavenReport.java:190)

In case (2), the source for the plugin version 2.9 is checked out. A simple
unit test is written to simulate the same configuration:

        RestJiraDownloader d = new RestJiraDownloader();
        Log log = new DefaultLog(new ConsoleLogger(Logger.LEVEL_DEBUG, "test"));
        d.setLog(log);
        d.project = new MavenProject();
        d.project.setIssueManagement(new IssueManagement());
        d.project.getIssueManagement().setUrl(
                "https://MYJIRA.COM/issuetracker/browse/CSP");
        d.project.getIssueManagement().setSystem("JIRA");
        d.setWebUser("USER");
        d.setWebPassword("PASS");
        d.setUseJql(true);
        d.setStatusIds("Resolved,Closed");

        Map<String, String> params = JiraHelper
                .getJiraUrlAndProjectName(d.project.getIssueManagement()
                        .getUrl());
        String jiraUrl = params.get("url");
        String project = params.get("project");
        System.out.println("JIRA: " + jiraUrl + "  | project: " + project);

        Thread.currentThread().setContextClassLoader(
                WebClient.class.getClassLoader());
        WebClient client = d.setupWebClient(jiraUrl);
        d.doSessionAuth(client);

        d.resolveIds(client, project);
        System.out.println(d.resolvedStatusIds);

Some small tweaks are made to RestJiraDownloader to make this test
runnable. The output of the unit test is:

Mar 24, 2014 9:17:53 AM org.apache.cxf.interceptor.LoggingOutInterceptor
INFO: Outbound Message
---------------------------
ID: 1
Address: https://MYJIRA.COM/issuetracker/rest/api/2/status
Http-Method: GET
Content-Type: */*
Headers: {Accept=[application/json], Content-Type=[*/*],
Authorization=[Basic ZmlsdGVyYWRtaW46ZmFzMTIz]}
--------------------------------------
Mar 24, 2014 9:17:54 AM org.apache.cxf.interceptor.LoggingInInterceptor
INFO: Inbound Message
----------------------------
ID: 1
Response-Code: 200
Encoding: UTF-8
Content-Type: application/json;charset=UTF-8
Headers: {Cache-Control=[no-cache, no-store, no-transform],
connection=[Keep-Alive], content-type=[application/json;char
set=UTF-8], Date=[Mon, 24 Mar 2014 08:17:54 GMT],
Keep-Alive=[timeout=15, max=100], Server=[Apache-Coyote/1.1], Set-Cook
ie=[atlassian.xsrf.token=AMUY-0X4J-KTOA-WYA4|7e39037e80032fd269019a7440f2e98242ad1f59|lin;
Path=/issuetracker, JSESSIONI
D=B33D7C89B30F1A336D114CF9E9E159D3; Path=/issuetracker/; HttpOnly],
transfer-encoding=[chunked], Via=[1.1 MYJIRA.COM],
X-AREQUESTID=[557x130229x1], X-ASESSIONID=[13jqi4n],
X-AUSERNAME=[USER], X-Seraph-LoginReason=[OK]}
Payload: [{"self":"...."}]

In this case, the Payload actually includes the JSON response for the
status ids. The Authorization Header is also visible.

An interesting observation is that in case (1), the following line:

No Trust Decider for Conduit
'{https://MYJIRA.COM/issuetracker}WebClient.http-conduit'. An
afirmative Trust Decision is assumed.

can it be the root cause? And, if so, how can I fix this?

I'd appreciate any help on this.

Thanks,
Behrooz

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message