Bug 414360 - add support for the new REST API (Bugzilla 5.0)
Summary: add support for the new REST API (Bugzilla 5.0)
Status: ASSIGNED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Mylyn (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Frank Becker CLA
QA Contact:
URL:
Whiteboard:
Keywords: plan
: 411951 (view as bug list)
Depends on: 372600 422002 426644 427698 449535 470016 483745 490542 499382 500370 510464 515975
Blocks: 160573 151807
  Show dependency tree
 
Reported: 2013-08-03 09:40 EDT by Frank Becker CLA
Modified: 2017-04-29 10:27 EDT (History)
4 users (show)

See Also:


Attachments
mylyn/context/zip (1.36 MB, application/octet-stream)
2013-08-12 12:07 EDT, Frank Becker CLA
no flags Details
mylyn/context/zip (750.65 KB, application/octet-stream)
2013-08-25 14:27 EDT, Frank Becker CLA
no flags Details
mylyn/context/zip (165.17 KB, application/octet-stream)
2013-09-28 09:58 EDT, Frank Becker CLA
no flags Details
mylyn/context/zip (18.36 KB, application/octet-stream)
2013-10-09 08:09 EDT, Frank Becker CLA
no flags Details
mylyn/context/zip (29.74 KB, application/octet-stream)
2013-10-20 03:31 EDT, Frank Becker CLA
no flags Details
mylyn/context/zip (25.72 KB, application/octet-stream)
2013-11-10 16:12 EST, Frank Becker CLA
no flags Details
mylyn/context/zip (14.10 KB, application/octet-stream)
2013-11-17 10:38 EST, Frank Becker CLA
no flags Details
mylyn/context/zip (29.47 KB, application/octet-stream)
2013-11-24 11:52 EST, Frank Becker CLA
no flags Details
mylyn/context/zip (68.56 KB, application/octet-stream)
2013-12-02 14:57 EST, Frank Becker CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Frank Becker CLA 2013-08-03 09:40:09 EDT
Here a part of an Mail from Frédéric Buclin

Hello Frank,

During the last Bugzilla meeting this week, it has been announced that
the current XML-RPC and JSON-RPC APIs will be deprecated in favor of a
REST API which will appear in Bugzilla 5.0. It has also been announced
that these existing APIs will be totally removed from the source code in
Bugzilla 6.0.
Comment 1 Steffen Pingel CLA 2013-08-11 23:22:52 EDT
Thanks for sharing! This is very interesting. Let's discuss before we move on this. A REST API could warrant forking/re-implementing the Bugzilla connector for 5.0+ to remove all legacy support from the architecture.
Comment 2 Frank Becker CLA 2013-08-12 12:07:38 EDT
Draft for getRepositoryConfiguration is in review https://git.eclipse.org/r/15370
Comment 3 Frank Becker CLA 2013-08-12 12:07:44 EDT
Created attachment 234321 [details]
mylyn/context/zip
Comment 4 Frank Becker CLA 2013-08-25 14:27:20 EDT
new review for 
* getTaskData
* getHitSearch
* getRepositoryConfiguration
Comment 5 Frank Becker CLA 2013-08-25 14:27:25 EDT
Created attachment 234731 [details]
mylyn/context/zip
Comment 6 Frank Becker CLA 2013-09-28 09:58:58 EDT
Created attachment 235923 [details]
mylyn/context/zip
Comment 7 Frank Becker CLA 2013-10-08 04:48:25 EDT
I create 3 new reviews instead of review  https://git.eclipse.org/r/15370  

1) create AbstractBugzillaClient
2) new review as replacement for https://git.eclipse.org/r/#/c/8752/ (372600: create new storage structure for RepositoryConfiguration)
3) create BugzillRESTClient
Comment 9 Frank Becker CLA 2013-10-09 08:09:05 EDT
Created attachment 236270 [details]
mylyn/context/zip
Comment 10 Robert Elves CLA 2013-10-10 12:54:22 EDT
Hi Frank, do you have a sense for how complete the Bugzilla 5.0 REST API is?  I.e. could we replace all the older RDF/XML/RPC calls used in the Bugzilla Connector today without loss of functionality?
Comment 11 Frank Becker CLA 2013-10-10 17:05:09 EDT
*** Bug 411951 has been marked as a duplicate of this bug. ***
Comment 12 Frank Becker CLA 2013-10-10 17:32:10 EDT
(In reply to Robert Elves from comment #10)
> Hi Frank, do you have a sense for how complete the Bugzilla 5.0 REST API is?
> I.e. could we replace all the older RDF/XML/RPC calls used in the Bugzilla
> Connector today without loss of functionality?

There is a problem with Mid-Ari collision which must be implementer in mylyn.

User matching is not supported.

For all other see review https://git.eclipse.org/r/#/c/17210/
Comment 13 Frank Becker CLA 2013-10-10 17:35:59 EDT
for the review you need to apply the patch sudo patch -p0  </tmp/vagrant-bugzilla/modules/bugzilla/files/MylynPatch_756048_916254.patch to the dir  /home/tools/bugzilla/bugzilla-REST-trunk/.

Hope that this is soon in the bugzilla trunk!
Comment 14 Robert Elves CLA 2013-10-10 17:51:28 EDT
(In reply to comment #12)
> (In reply to Robert Elves from comment #10)
> > Hi Frank, do you have a sense for how complete the Bugzilla 5.0 REST API is?
> > I.e. could we replace all the older RDF/XML/RPC calls used in the Bugzilla
> > Connector today without loss of functionality?
> 
> There is a problem with Mid-Ari collision which must be implementer in mylyn.

Meaning the Bugzilla server won't respond with a mid-air collision upon submit over the REST api currently?

> 
> User matching is not supported.
> 
> For all other see review https://git.eclipse.org/r/#/c/17210/
Thanks!
Comment 15 Frank Becker CLA 2013-10-11 03:30:50 EDT
(In reply to Robert Elves from comment #14)
> (In reply to comment #12)
> > (In reply to Robert Elves from comment #10)
> > > Hi Frank, do you have a sense for how complete the Bugzilla 5.0 REST API is?
> > > I.e. could we replace all the older RDF/XML/RPC calls used in the Bugzilla
> > > Connector today without loss of functionality?
> > 
> > There is a problem with Mid-Ari collision which must be implementer in mylyn.
> 
> Meaning the Bugzilla server won't respond with a mid-air collision upon
> submit over the REST api currently?
Yes you can have lost changes.
> > 
> > User matching is not supported.
> > 
> > For all other see review https://git.eclipse.org/r/#/c/17210/
> Thanks!
Comment 16 Frank Becker CLA 2013-10-13 11:22:05 EDT
I create an patch for Bugzilla.

Please see https://bugzilla.mozilla.org/show_bug.cgi?id=432910
Comment 17 Frank Becker CLA 2013-10-20 03:31:01 EDT
create Patch Set 5 for review https://git.eclipse.org/r/#/c/17210/

new is that I add support for getBugHistory and getAttachmentData (sorry I forgot to do this)

Actual there are two patches from bugzilla that need to apply to the bugzilla codebase
 * https://bugzilla.mozilla.org/show_bug.cgi?id=432910 (Mid-Air Collision checking for Bug.update())
 * https://bugzilla.mozilla.org/show_bug.cgi?id=756048 (Add and update bug and attachment flags using the the webservices API)
 
 you can do vagrant ssh
 
cd /home/tools/bugzilla/bugzilla-REST-trunk/
sudo patch -p0  </tmp/vagrant-bugzilla/modules/bugzilla/files/Mylyn.patch

to get both patch applyed.
Comment 18 Frank Becker CLA 2013-10-20 03:31:06 EDT
Created attachment 236689 [details]
mylyn/context/zip
Comment 19 Steffen Pingel CLA 2013-11-07 17:13:56 EST
I would like to propose something radical to make it easier to proceed with the proposed changes: How about we create a new clean slate Bugzilla connector that only supports REST (i.e. it would only work with Bugzilla 5.0 and later). 

It would have a clean architecture and not carry any of the previous CGI/HTML, XML-RPC, Bugzilla 3.x, 4.x etc. baggage. This would allow us to move faster on the new code base without having to worry about breaking users or integrators that build on the existing connector.

My hope would be that we deprecate the Bugzilla 3.x/4.x connector once Bugzilla 5.0 is out and the new connector is working. This could take a few month or even a year and should provide enough time evolve the new connector to a state where it has feature parity with the old connector.  We would keep the old connector around for a bit longer to allow people to migrate but enhancements would only get into the 5.0/REST connector. Considering the maturity of the current connector I would even argue that new features should only be implemented for the new connector.

In terms of architecture it would be great if the new connector used all the latest libraries such as Apache HttpClient 4.2, Guava, Gson and not carried forward any of the legacy dependencies. This would enable us to remove HttpClient 3.x and other old libraries from Mylyn at some point.

To simplify maintenance of the connector moving forward I would also like to get rid of as much custom UI as possible and move that into the framework. We should also look at the usage of schemas to better define the data model for tasks and such. Additionally we should consider generalizing some of the test infrastructure to reduce duplication between connectors.

Thoughts?
Comment 20 Frank Becker CLA 2013-11-08 15:52:41 EST
Steffen,

this has some problems.

When we do no longer support the HTML/CGI client then in bugzilla 5.0 the REST API needs to be enabled by default. Should we request this enhancement?

For me the REST client should desperate the XMLRPC client.

So this was the reason for me to first refactor the common part out of the bugzilla client (review https://git.eclipse.org/r/#/c/17206/) instead of create new connector from scratch.

Yes to keep backward compatible with bugzilla 3.x and 4.x needs a lot of translate attribute names.

The HTML/CGI client supports actual features like user matching that are not implemented for the REST API.

Maybe we can implement an new client using the latest libraries and a new schema for the REST API and then implement the same for the HTML/CGI.
Comment 21 Steffen Pingel CLA 2013-11-08 16:45:54 EST
(In reply to comment #20)
> When we do no longer support the HTML/CGI client then in bugzilla 5.0 the REST
> API needs to be enabled by default. Should we request this enhancement?

Yes, that sounds like the right thing to do to me. That said, even if that isn't the default in 5.0 it wouldn't necessarily be a show stopper. A Mylyn connector could be good reason for administrators to flip the switch.
  
> For me the REST client should desperate the XMLRPC client.

I agree that it should replace it but I would go one step further and would like to see it be the only interface to Bugzilla. REST APIs provide much better error handling and are much simpler to work with than XML-PRC or custom CGI/HTML. It will make our live much easier if we only need to code against one interface.

> So this was the reason for me to first refactor the common part out of the
> bugzilla client (review https://git.eclipse.org/r/#/c/17206/) instead of create
> new connector from scratch.

I'm worried that we introduce a lot of risk to break the existing connector (and integrations building on its internals). Also, we end up with a complicated code base with a lot of abstraction and modes that need to be tested. 

> Yes to keep backward compatible with bugzilla 3.x and 4.x needs a lot of
> translate attribute names.

I think to some extend we can worry about migration later. I would think that it is acceptable for instance to re-synchronize all tasks when migrating from 3.x/4.x to the 5.x connector. We should come up with a reasonable plan for migration but it shouldn't substantially influence the design of the new connector, e.g. attribute names should just make sense in the new context otherwise we'll litter the code with a lot of mapping that is only really relevant once but we'll have to keep it forever.

> The HTML/CGI client supports actual features like user matching that are not
> implemented for the REST API.

I find that an acceptable limitation. A very important part of developing the connector is to determine what is missing in the REST API and file enhancement requests against Bugzilla to provide the missing APIs (or help them to develop them). You have already done a great job of that with mid-air collision detection for instance. 

> Maybe we can implement an new client using the latest libraries and a new schema
> for the REST API and then implement the same for the HTML/CGI.

In terms of maintainability I would like to get rid of HTML/CGI sooner rather than later. It has helped us to make the connector work with existing Bugzilla instances but this is a great opportunity to drive the modernization of the Bugzilla REST API to cover all the aspects needed to provide a well working connector.
Comment 22 Steffen Pingel CLA 2013-11-08 17:32:08 EST
I would suggest that we move the new connector into a sub-directory. This makes it easier to see which bundles are part of the new connector vs. the old one and we may start doing that for other components as well in the near future:

pre. 
connector-bugzilla-rest/
  org.eclipse.mylyn.bugzilla.rest-feature
  org.eclipse.mylyn.bugzilla.rest.core
  org.eclipse.mylyn.bugzilla.rest.core.tests
  org.eclipse.mylyn.bugzilla.rest.ui
  org.eclipse.mylyn.bugzilla.rest.core.tests
Comment 23 Steffen Pingel CLA 2013-11-08 17:33:02 EST
(In reply to comment #22)
...
> org.eclipse.mylyn.bugzilla.rest.ui
> org.eclipse.mylyn.bugzilla.rest.core.tests

That should have been org.eclipse.mylyn.bugzilla.rest.ui.tests of course.
Comment 24 Frank Becker CLA 2013-11-10 16:12:03 EST
I create review https://git.eclipse.org/r/18252 with the new projects (see comment#22 and comment#23).

I include
* new bugzilla test instance
* 5 new projects
* "Dummy implementation" (Ui for repository and Task Creation without connection to bugzilla)
   Maybe this can be a blueprint for an creation of a new connector.
Comment 25 Frank Becker CLA 2013-11-10 16:12:09 EST
Created attachment 237346 [details]
mylyn/context/zip
Comment 26 Frank Becker CLA 2013-11-11 00:17:46 EST
Steffen,

can you please integrate the new projects into the build of the review. I chreate the pom.xml but the projects did not get build.
Comment 27 Frank Becker CLA 2013-11-14 15:00:53 EST
create https://git.eclipse.org/r/18409 for the setup of the new testinstance
Comment 28 Frank Becker CLA 2013-11-17 10:38:04 EST
create review https://git.eclipse.org/r/18474 with an minimal UI
add TaskRepositorySetting with validation, Query an EditorPage
Comment 29 Frank Becker CLA 2013-11-17 10:38:12 EST
Created attachment 237511 [details]
mylyn/context/zip
Comment 30 Frank Becker CLA 2013-11-24 11:52:10 EST
review https://git.eclipse.org/r/#/c/18474/ patch set 2 implements the core part of the previous patch set 

For the UI part I create a new review.
Comment 31 Frank Becker CLA 2013-11-24 11:52:17 EST
Created attachment 237672 [details]
mylyn/context/zip
Comment 32 Frank Becker CLA 2013-12-02 14:57:06 EST
review https://git.eclipse.org/r/#/c/19178/ creates a minimal UI
review https://git.eclipse.org/r/#/c/19220/ add a first version of an configuration without support for flags. Here we need to wait until https://bugzilla.mozilla.org/show_bug.cgi?id=756048 is fixed
Comment 33 Frank Becker CLA 2013-12-02 14:57:12 EST
Created attachment 237928 [details]
mylyn/context/zip
Comment 34 Frank Becker CLA 2013-12-04 12:01:59 EST
review https://git.eclipse.org/r/#/c/19220/ failed because

mylyn.org setup gets an new field (comment_tag) that was not present at the time I did my local setup
Comment 35 Steffen Pingel CLA 2013-12-06 14:57:21 EST
Frank, it looks like some of the tests failed against HEAD with the old connector now:  http://ci.mylyn.org/job/mylyn-3.11.x/17/testReport/ . If you get a chance it'd be great if you took a look. Not sure if it's related to the test fixture changes.
Comment 36 Frank Becker CLA 2013-12-06 15:24:09 EST
(In reply to Steffen Pingel from comment #35)
> Frank, it looks like some of the tests failed against HEAD with the old
> connector now:  http://ci.mylyn.org/job/mylyn-3.11.x/17/testReport/ . If you
> get a chance it'd be great if you took a look. Not sure if it's related to
> the test fixture changes.

The problem is that we now longer get "invalid username or password" we now get "invalid login or password". This must be a change within Bugzilla.

I create a review!
Comment 37 Frank Becker CLA 2013-12-06 16:16:04 EST
https://git.eclipse.org/r/19466 please review!
Comment 38 Steffen Pingel CLA 2013-12-09 04:07:47 EST
It looks like this test still has the same problem:

junit.framework.AssertionFailedError
	at junit.framework.Assert.fail(Assert.java:55)
	at junit.framework.Assert.assertTrue(Assert.java:22)
	at junit.framework.Assert.assertTrue(Assert.java:31)
	at junit.framework.TestCase.assertTrue(TestCase.java:201)
	at org.eclipse.mylyn.bugzilla.tests.BugzillaAttachmentHandlerTest.testContextAttachFailure(BugzillaAttachmentHandlerTest.java:504)

Could be worth adding a utility method to detect login failures?
Comment 39 Frank Becker CLA 2013-12-11 14:27:32 EST
create review https://git.eclipse.org/r/#/c/19667/
Comment 40 Eclipse Genie CLA 2015-07-22 13:04:52 EDT
New Gerrit change created: https://git.eclipse.org/r/52372
Comment 41 Eclipse Genie CLA 2015-07-22 13:08:51 EDT
New Gerrit change created: https://git.eclipse.org/r/52373
Comment 42 Eclipse Genie CLA 2015-07-22 13:11:22 EDT
New Gerrit change created: https://git.eclipse.org/r/52374
Comment 46 Eclipse Genie CLA 2015-08-01 07:05:57 EDT
New Gerrit change created: https://git.eclipse.org/r/53003