Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #932 - Does jcabi-github support Android? #1162

Closed
wants to merge 13 commits into from

Conversation

pecko
Copy link

@pecko pecko commented Sep 22, 2015

The ticket: #932

The PR solves two issues that disable using jcabi-github on Android or similar environment:

  1. The RtGithub class creates the USER_AGENT constant using the manifest file.
    Android repacks all libraries and the 'JCabi-Version' property and other similar properties doesn't exist in apk.
    All RtGithub constructors don't work. They throw:
java.lang.IllegalArgumentException: Attribute 'JCabi-Version' not found in MANIFEST.MF file(s) among 2 other attribute(s): ["Created-By", "Manifest-Version"]

Solution:

  • I have created the jcabi.properties resource file that will contain this property. The maven build updates this property (properties)
  1. The second problem is described above that the Dalvik (Android JRE) can't find javax.xml.bind.DatatypeConverter
    The problem happens when the issue pull requests API #1 is fixed and it is related only to "new RtGithub(user, pwd)" constructor.

Solution:

  • I have created the RtDatatypeConverter class based on DatatypeConverterImpl from OpenJDK.
    The class will use the standard DatatypeConverter class if exists or the method(s) copied from DatatypeConverterImpl.

I have tested the following code:

RtGithub github = new RtGithub("pecko", "MYPWD");
//RtGithub github = new RtGithub(oauth);
Repo repo = github.repos().get(new Coordinates.Simple("jcabi/jcabi-github"));
Issues issues = repo.issues();

within a Android activity.

@pecko pecko force-pushed the issue932 branch 3 times, most recently from 878819b to b611511 Compare September 22, 2015 05:42
@dmarkov
Copy link

dmarkov commented Sep 22, 2015

@pecko Many thanks, I will find someone to review it before we merge

@dmarkov
Copy link

dmarkov commented Sep 22, 2015

@darkled could you please review this PR

<groupId>com.jcabi</groupId>
<artifactId>jcabi-manifests</artifactId>
</dependency>
<!-- <dependency> -->
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pecko do we really need to have this comments here? would it be better to remove these lines completely?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pecko I don't see any fixing commit from you

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I fixed it locally.
I will commit when solving all issues.
Fighting with RtDatatypeConverter checkstyle :(

@asaen
Copy link

asaen commented Sep 22, 2015

@pecko please take a look at the few comments above. Also please add the original issue id and what have you done as described here:

  • Pull request description explains the solution proposed and contains a link to the original ticket it is related to.

package com.jcabi.github;

/**
*
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pecko could you please also remove redundant line here?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@asaen
Copy link

asaen commented Sep 23, 2015

@pecko please see few comments above

*/
package com.jcabi.github;
/**
*
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

redundant empty lines 32 and 37 still exist...

@pecko
Copy link
Author

pecko commented Sep 23, 2015

@darkled
I think that I fixed all issues. The AppVeyor and Travis passed.

BTW
Travis creates builds with 3 JDK and some of that fails sometimes without obvious reason. Do you know something more about that?

@asaen
Copy link

asaen commented Sep 23, 2015

@pecko thank you! If you find issues like this you can report a new defect and someone will try to fix it.

@asaen
Copy link

asaen commented Sep 23, 2015

@rultor merge pls

@rultor
Copy link
Contributor

rultor commented Sep 23, 2015

@rultor merge pls

@darkled Thanks for your request. @yegor256 Please confirm this.

@pecko
Copy link
Author

pecko commented Sep 23, 2015

@darkled

@pecko thank you! If you find issues like this you can report a new defect and someone will try to fix it

I have added #1165

@yegor256
Copy link
Member

@rultor merge pls

@rultor
Copy link
Contributor

rultor commented Sep 26, 2015

@rultor merge pls

@yegor256 OK, I'll try to merge now. You can check the progress of the merge here

@rultor
Copy link
Contributor

rultor commented Sep 26, 2015

@rultor merge pls

@pecko @yegor256 Oops, I failed. You can see the full log here (spent 3min)

[INFO] [INFO] Finished at: 2015-09-26T21:32:07+00:00
[INFO] [INFO] Final Memory: 14M/281M
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [WARNING] The requested profile "qulice" could not be activated because it does not exist.
[INFO] ..SUCCESS (6.1 s)
[INFO] -------------------------------------------------
[INFO] Build Summary:
[INFO]   Passed: 2, Failed: 0, Errors: 0, Skipped: 0
[INFO] -------------------------------------------------
[INFO] 
[INFO] --- maven-failsafe-plugin:2.17:verify (default) @ jcabi-github ---
[INFO] Failsafe report directory: /home/r/repo/target/failsafe-reports
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:13 min
[INFO] Finished at: 2015-09-26T21:32:07+00:00
[INFO] Final Memory: 59M/455M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-failsafe-plugin:2.17:verify (default) on project jcabi-github: There are test failures.
[ERROR] 
[ERROR] Please refer to /home/r/repo/target/failsafe-reports for the individual test results.
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-failsafe-plugin:2.17:verify (default) on project jcabi-github: There are test failures.

Please refer to /home/r/repo/target/failsafe-reports for the individual test results.
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:108)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:76)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:116)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:361)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:213)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:157)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoFailureException: There are test failures.

Please refer to /home/r/repo/target/failsafe-reports for the individual test results.
    at org.apache.maven.plugin.surefire.SurefireHelper.reportExecution(SurefireHelper.java:82)
    at org.apache.maven.plugin.failsafe.VerifyMojo.execute(VerifyMojo.java:194)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:133)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
    ... 19 more
[ERROR] 
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

@pecko
Copy link
Author

pecko commented Oct 1, 2015

@darkled

The 0ba5c77 ignores three tests mentioned in #1170

@asaen
Copy link

asaen commented Oct 1, 2015

@yegor256 try to merge once more please

@yegor256
Copy link
Member

yegor256 commented Oct 1, 2015

@rultor try to merge

@rultor
Copy link
Contributor

rultor commented Oct 1, 2015

@rultor try to merge

@yegor256 OK, I'll try to merge now. You can check the progress of the merge here

@rultor
Copy link
Contributor

rultor commented Oct 1, 2015

@rultor try to merge

@pecko @yegor256 Oops, I failed. You can see the full log here (spent 10min)

INFO: "reading src/test/java/com/jcabi/github/RtContentTest.java..."
INFO: "reading src/test/java/com/jcabi/github/RtContentsITCase.java..."
INFO: "puzzle 863-4e783bd3 0/IMP at src/test/java/com/jcabi/github/RtContentsITCase.java"
INFO: "reading src/test/java/com/jcabi/github/RtContentsTest.java..."
INFO: "reading src/test/java/com/jcabi/github/RtDeployKeyTest.java..."
INFO: "reading src/test/java/com/jcabi/github/RtDeployKeysITCase.java..."
INFO: "reading src/test/java/com/jcabi/github/RtDeployKeysTest.java..."
INFO: "reading src/test/java/com/jcabi/github/RtEventTest.java..."
INFO: "reading src/test/java/com/jcabi/github/RtForkTest.java..."
INFO: "puzzle 989-33d6f233 0/IMP at src/test/java/com/jcabi/github/RtForkTest.java"
INFO: "reading src/test/java/com/jcabi/github/RtForksITCase.java..."
INFO: "reading src/test/java/com/jcabi/github/RtForksTest.java..."
INFO: "reading src/test/java/com/jcabi/github/RtGistCommentITCase.java..."
INFO: "reading src/test/java/com/jcabi/github/RtGistCommentTest.java..."
INFO: "reading src/test/java/com/jcabi/github/RtGistCommentsITCase.java..."
INFO: "reading src/test/java/com/jcabi/github/RtGistCommentsTest.java..."
INFO: "reading src/test/java/com/jcabi/github/RtGistITCase.java..."
INFO: "reading src/test/java/com/jcabi/github/RtGistTest.java..."
INFO: "reading src/test/java/com/jcabi/github/RtGistsITCase.java..."
INFO: "reading src/test/java/com/jcabi/github/RtGistsTest.java..."
INFO: "reading src/test/java/com/jcabi/github/RtGitTest.java..."
INFO: "reading src/test/java/com/jcabi/github/RtGithubITCase.java..."
INFO: "reading src/test/java/com/jcabi/github/RtGithubTest.java..."
INFO: "reading src/test/java/com/jcabi/github/RtGitignoresITCase.java..."
INFO: "reading src/test/java/com/jcabi/github/RtGitignoresTest.java..."
INFO: "reading src/test/java/com/jcabi/github/RtHookTest.java..."
INFO: "reading src/test/java/com/jcabi/github/RtHooksITCase.java..."
INFO: "reading src/test/java/com/jcabi/github/RtHooksTest.java..."
INFO: "reading src/test/java/com/jcabi/github/RtIssueITCase.java..."
INFO: "reading src/test/java/com/jcabi/github/RtIssueLabelsITCase.java..."
INFO: "reading src/test/java/com/jcabi/github/RtIssueTest.java..."
INFO: "reading src/test/java/com/jcabi/github/RtIssuesITCase.java..."
INFO: "reading src/test/java/com/jcabi/github/RtIssuesTest.java..."
INFO: "reading src/test/java/com/jcabi/github/RtJsonTest.java..."
INFO: "reading src/test/java/com/jcabi/github/RtLabelTest.java..."
INFO: "reading src/test/java/com/jcabi/github/RtLabelsITCase.java..."
INFO: "reading src/test/java/com/jcabi/github/RtLabelsTest.java..."
INFO: "reading src/test/java/com/jcabi/github/RtLimitTest.java..."
INFO: "reading src/test/java/com/jcabi/github/RtLimitsITCase.java..."
INFO: "reading src/test/java/com/jcabi/github/RtMarkdownITCase.java..."
INFO: "reading src/test/java/com/jcabi/github/RtMarkdownTest.java..."
INFO: "reading src/test/java/com/jcabi/github/RtMilestonesITCase.java..."
INFO: "reading src/test/java/com/jcabi/github/RtMilestonesTest.java..."
INFO: "reading src/test/java/com/jcabi/github/RtNotificationsITestCase.java..."
/var/lib/gems/1.9.1/gems/pdd-0.15/lib/pdd/source.rb:144:in `rescue in puzzles': ["in /home/r/repo/src/test/java/com/jcabi/github/RtNotificationsITestCase.java", #<PDD::Error: Suspicious TODO in line #36>] (PDD::Error)
    from /var/lib/gems/1.9.1/gems/pdd-0.15/lib/pdd/source.rb:142:in `puzzles'
    from /var/lib/gems/1.9.1/gems/pdd-0.15/lib/pdd.rb:97:in `block (3 levels) in xml'
    from /var/lib/gems/1.9.1/gems/pdd-0.15/lib/pdd.rb:96:in `each'
    from /var/lib/gems/1.9.1/gems/pdd-0.15/lib/pdd.rb:96:in `block (2 levels) in xml'
    from /var/lib/gems/1.9.1/gems/nokogiri-1.6.5/lib/nokogiri/xml/builder.rb:391:in `call'
    from /var/lib/gems/1.9.1/gems/nokogiri-1.6.5/lib/nokogiri/xml/builder.rb:391:in `insert'
    from /var/lib/gems/1.9.1/gems/nokogiri-1.6.5/lib/nokogiri/xml/builder.rb:375:in `method_missing'
    from /var/lib/gems/1.9.1/gems/pdd-0.15/lib/pdd.rb:95:in `block in xml'
    from /var/lib/gems/1.9.1/gems/nokogiri-1.6.5/lib/nokogiri/xml/builder.rb:293:in `initialize'
    from /var/lib/gems/1.9.1/gems/pdd-0.15/lib/pdd.rb:93:in `new'
    from /var/lib/gems/1.9.1/gems/pdd-0.15/lib/pdd.rb:93:in `xml'
    from /var/lib/gems/1.9.1/gems/pdd-0.15/bin/pdd:90:in `<top (required)>'
    from /usr/local/bin/pdd:23:in `load'
    from /usr/local/bin/pdd:23:in `<main>'

@pecko
Copy link
Author

pecko commented Oct 1, 2015

@darkled @yegor256

A new error

/home/r/repo/src/test/java/com/jcabi/github/RtNotificationsITestCase.java", #<PDD::Error: Suspicious TODO in line #36>] (PDD::Error)

I will try to fix it.

@pecko
Copy link
Author

pecko commented Oct 1, 2015

@darkled @yegor256

I have found a few invalid todos and fixed them. The commit: bd2e007

Could you, please, try to merge again?

@pecko
Copy link
Author

pecko commented Oct 5, 2015

@darkled @yegor256

I'm sorry because repeat message, but could you please try to merge this PR once yet? There were a few invalid todos that are fixed.

@asaen
Copy link

asaen commented Oct 5, 2015

@rultor merge once more please

@rultor
Copy link
Contributor

rultor commented Oct 5, 2015

@rultor merge once more please

@darkled Thanks for your request. @yegor256 Please confirm this.

@yegor256
Copy link
Member

yegor256 commented Oct 5, 2015

@rultor try to merge

@rultor
Copy link
Contributor

rultor commented Oct 5, 2015

@rultor try to merge

@yegor256 OK, I'll try to merge now. You can check the progress of the merge here

@rultor
Copy link
Contributor

rultor commented Oct 5, 2015

@rultor try to merge

@pecko @yegor256 Oops, I failed. You can see the full log here (spent 6min)

[INFO] [INFO] Finished at: 2015-10-05T18:11:31+00:00
[INFO] [INFO] Final Memory: 19M/276M
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [WARNING] The requested profile "qulice" could not be activated because it does not exist.
[INFO] ..SUCCESS (10.8 s)
[INFO] -------------------------------------------------
[INFO] Build Summary:
[INFO]   Passed: 2, Failed: 0, Errors: 0, Skipped: 0
[INFO] -------------------------------------------------
[INFO] 
[INFO] --- maven-failsafe-plugin:2.17:verify (default) @ jcabi-github ---
[INFO] Failsafe report directory: /home/r/repo/target/failsafe-reports
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:46 min
[INFO] Finished at: 2015-10-05T18:11:32+00:00
[INFO] Final Memory: 37M/420M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-failsafe-plugin:2.17:verify (default) on project jcabi-github: There are test failures.
[ERROR] 
[ERROR] Please refer to /home/r/repo/target/failsafe-reports for the individual test results.
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-failsafe-plugin:2.17:verify (default) on project jcabi-github: There are test failures.

Please refer to /home/r/repo/target/failsafe-reports for the individual test results.
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:108)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:76)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:116)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:361)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:213)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:157)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoFailureException: There are test failures.

Please refer to /home/r/repo/target/failsafe-reports for the individual test results.
    at org.apache.maven.plugin.surefire.SurefireHelper.reportExecution(SurefireHelper.java:82)
    at org.apache.maven.plugin.failsafe.VerifyMojo.execute(VerifyMojo.java:194)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:133)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
    ... 19 more
[ERROR] 
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

@pecko
Copy link
Author

pecko commented Oct 5, 2015

@darkled @yegor256

Rultor fails in new test:

Tests run: 2, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 2.354 sec 
<<< FAILURE! - in com.jcabi.github.RtReposITCase create(com.jcabi.github.RtReposITCase) Time elapsed: 1.111 sec <<< FAILURE!

Will we ignore this test too?

@asaen
Copy link

asaen commented Oct 5, 2015

@pecko I am not sure, it seems we have problems with integration tests and cannot merge anything before these problems fixed.
@yegor256 are we waiting till #1170 is fixed?

@yegor256
Copy link
Member

yegor256 commented Oct 5, 2015

@darkled yes, seems so

@pecko
Copy link
Author

pecko commented Oct 5, 2015

@yegor256 @darkled

How it worked before? This PR introduce nothing related to these failures, errors, todos ...

@asaen
Copy link

asaen commented Oct 5, 2015

@pecko well, it worked pretty fine before. as you can see in the merged PRs. I think the problem came with some of previous merges, since other PRs has the same failures.

@pecko
Copy link
Author

pecko commented Oct 6, 2015

@darkled

I want just to understand it better. You claim that integration tests never fail before or they fail rarely?

@asaen
Copy link

asaen commented Oct 6, 2015

@pecko everything what happened before is on github, so you can easily check previous PRs :) I didn't see anything similar to our case. But now there are few PRs with very similar problems.

@pecko
Copy link
Author

pecko commented Oct 6, 2015

@darkled

I believe you :) . If they haven't fails before, we have some weird issue that can be in different projects (rultor, jcabi-github, jcabi-http...). I hope, we will fix it soon.

@amihaiemil
Copy link
Member

amihaiemil commented Apr 2, 2018

@pecko This PR is too big and too old, anyway. There is another PR for removing the Manifests mechanisms, so that issue will be solved there. If you care to make another PR with smaller changes (max 5 files, including test changes), that would improve the Android issue, it would be welcome.

@0crat
Copy link

0crat commented Apr 2, 2018

The job is not in WBS, won't close the order

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants