Skip to content

Commit

Permalink
Merge pull request #53 from treasure-data/embulk-input-jira_java
Browse files Browse the repository at this point in the history
Rewrite embulk-input-jira in Java
  • Loading branch information
minidragon88 authored Mar 1, 2019
2 parents 66b74de + f28889a commit b368bf5
Show file tree
Hide file tree
Showing 55 changed files with 3,370 additions and 1,765 deletions.
14 changes: 10 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
*~
/pkg/
/tmp/
/.bundle/
/Gemfile.lock
/.ruby-version
/coverage/
*.gemspec
.gradle/
/classpath/
build/
.idea
/.settings/
/.metadata/
.classpath
.project
/bin/
38 changes: 4 additions & 34 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,41 +1,11 @@
language: ruby
language: java

jdk: oraclejdk8

env:
global:
secure: "NCkU3f60cn5Gmzq+NwDmKdQSq+ApF/rPqSHPirk1+ZPW9n+H9912meUuJr9qyn03MPdc6wAQinsl3skdPNh1Qz02TI/WZGMiCQTLh3nKIMzaaxx6I+OZ1TV7A4MoJMQ7oYQdXdbvRYXpOVRnfVDxpUC+BDk2T8xmjfm9cht+PGTzM6RxpmSL842hiudkcyxHxgEf66EGpi6h2G2PqYNfQrksqiVMWlLiTO5a2ee+iw9qTMhgKrhEKLCb+dFB56gtKIOpd3MxieLwf3PDcsjM+TSaWo6Bp+mjdA3zGJNz5wbWRVSdrIvKvxmf3eRqAGssBhBDO/LUN3LnI+/T/7J9XZZd7WXNudo/t6HQXhJkUIvOucCxSg8/uRsxrMAmF2zkJOnYGSvN3HNqdzyz86TK4/Xckl+gX51b0uYncHfZYSojn4py1RWPYpX/L2RHbzMn1MJ7B3/VZ21vY97aHhDgNyyAMxPnTAuR1IZicEgA8y8AmZkkK9tWq5wvAOKI91V+W8iBEaO2dZIib+KdJSUUj/Q3TM3i4wX9O/AU7tknsnCApvxQeveELJ4SxfFd/Z2imqmQWM0wIgp1u7Vjguf8kSaxcuQHonZNdwvvYOkbYxHvUqltzlmE1qFC/kQe6o9fS3NuiugHCYVeFs+LXVVW+nl0pWztFYMicUmQq7T781w="

before_install:
- |
ruby -v
# Currently, Travis can't treat jruby 9.0.5.0
rvm get head
rvm use jruby-9.0.5.0 --install
ruby -v
gem i bundler
bundle install
rvm: jruby-9.0.5.0

gemfile:
- gemfiles/embulk-0.8.0-latest
- gemfiles/embulk-0.8.7
- gemfiles/embulk-0.8.8
- gemfiles/embulk-latest

matrix:
exclude:
- jdk: oraclejdk8 # Ignore all matrix at first, use `include` to allow build
include:
- {rvm: jruby-9.0.5.0, gemfile: gemfiles/embulk-0.8.0-latest}
- {rvm: jruby-9.0.5.0, gemfile: gemfiles/embulk-0.8.7}
- {rvm: jruby-9.0.5.0, gemfile: gemfiles/embulk-0.8.8}
- {rvm: jruby-9.0.5.0, gemfile: gemfiles/embulk-latest}


allow_failures:
# Ignore failure for *-latest
- gemfile: embulk-0.8.0-latest
- gemfile: embulk-latest

script:
- ./gradlew gem
- ./gradlew checkstyle test jacocoTestReport
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.2.5 - 2019-03-05

* [enhancement] Change from ruby to java plugin [#53](https://github.com/treasure-data/embulk-input-jira/pull/53)

## 0.2.5 - 2018-11-27

* [fixed] Fix infinitive 401 errors and dynamically adjust parallel threads [#52](https://github.com/treasure-data/embulk-input-jira/pull/52)
Expand Down
3 changes: 0 additions & 3 deletions Gemfile

This file was deleted.

13 changes: 0 additions & 13 deletions LICENSE

This file was deleted.

21 changes: 21 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@

MIT License

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@ Required Embulk version >= 0.8.7
* **Guess supported**: yes

## Configuration
**Since JIRA is going to deprecate the basic authentication with passwords and cookie-based authentication to their APIs, we highly recommend you to use email and API key to authenticate to JIRA APIs. [Deprecated notice](https://developer.atlassian.com/cloud/jira/platform/deprecation-notice-basic-auth-and-cookie-based-auth/)**

- **username** JIRA username (string, required)
- **password** JIRA password (string, required)
- **username** JIRA username or email (string, required)
- **password** JIRA password or API keys (string, required)
- **uri** JIRA API endpoint (string, required)
- **jql** [JQL](https://confluence.atlassian.com/display/JIRA/Advanced+Searching) for extract target issues (string, required)
- **columns** target issue attributes. You can generate this configuration by `guess` command (array, required)
Expand All @@ -46,5 +47,5 @@ in:
## Build
```
$ bundle exec rake build
```
$ ./gradlew gem # -t to watch change of files and rebuild continuously
```
15 changes: 0 additions & 15 deletions Rakefile

This file was deleted.

116 changes: 116 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
plugins {
id "com.jfrog.bintray" version "1.1"
id "com.github.jruby-gradle.base" version "1.5.0"
id "java"
id "checkstyle"
id "jacoco"
}
import com.github.jrubygradle.JRubyExec
repositories {
mavenCentral()
jcenter()
maven {
url "https://dl.bintray.com/embulk-base-restclient/maven"
}
}
configurations {
provided
}

version = "0.2.6"

sourceCompatibility = 1.8
targetCompatibility = 1.8

dependencies {
compile "org.embulk:embulk-core:0.9.11"
provided "org.embulk:embulk-core:0.9.11"
compile "org.embulk.base.restclient:embulk-util-retryhelper-jetty92:0.6.0"
compile group: 'org.apache.httpcomponents', name: 'httpclient', version: '4.5.6'
compile group: 'org.glassfish.jersey.core', name: 'jersey-client', version: '2.27'
compile group: 'com.google.code.gson', name: 'gson', version: '2.8.5'
testCompile "junit:junit:4.+"
testCompile "org.mockito:mockito-core:2.+"
testCompile "org.embulk:embulk-test:0.9.11"
testCompile "org.embulk:embulk-core:0.9.11:tests"
}

task classpath(type: Copy, dependsOn: ["jar"]) {
doFirst { file("classpath").deleteDir() }
from (configurations.runtime - configurations.provided + files(jar.archivePath))
into "classpath"
}
clean { delete "classpath" }

checkstyle {
configFile = file("${project.rootDir}/config/checkstyle/checkstyle.xml")
toolVersion = '6.14.1'
}
checkstyleMain {
configFile = file("${project.rootDir}/config/checkstyle/default.xml")
ignoreFailures = true
}
checkstyleTest {
configFile = file("${project.rootDir}/config/checkstyle/default.xml")
ignoreFailures = true
}
task checkstyle(type: Checkstyle) {
classpath = sourceSets.main.output + sourceSets.test.output
source = sourceSets.main.allJava + sourceSets.test.allJava
}

task gem(type: JRubyExec, dependsOn: ["gemspec", "classpath"]) {
jrubyArgs "-S"
script "gem"
scriptArgs "build", "${project.name}.gemspec"
doLast { ant.move(file: "${project.name}-${project.version}.gem", todir: "pkg") }
}

task gemPush(type: JRubyExec, dependsOn: ["gem"]) {
jrubyArgs "-S"
script "gem"
scriptArgs "push", "pkg/${project.name}-${project.version}.gem"
}

task "package"(dependsOn: ["gemspec", "classpath"]) {
doLast {
println "> Build succeeded."
println "> You can run embulk with '-L ${file(".").absolutePath}' argument."
}
}

jacocoTestReport {
group = "Reporting"
reports {
xml.enabled false
csv.enabled false
html.destination "${buildDir}/reports/coverage"
}
}

task gemspec {
ext.gemspecFile = file("${project.name}.gemspec")
inputs.file "build.gradle"
outputs.file gemspecFile
doLast { gemspecFile.write($/
Gem::Specification.new do |spec|
spec.name = "${project.name}"
spec.version = "${project.version}"
spec.authors = ["uu59", "yoshihara"]
spec.summary = %[Jira input plugin for Embulk]
spec.description = %[Loads records from Jira.]
spec.email = ["[email protected]", "[email protected]"]
spec.licenses = ["Apache-2.0"]
spec.homepage = "https://github.com/treasure-data/embulk-input-jira"

spec.files = `git ls-files`.split("\n") + Dir["classpath/*.jar"]
spec.test_files = spec.files.grep(%r"^(test|spec)/")
spec.require_paths = ["lib"]

spec.add_development_dependency 'bundler', ['~> 1.0']
spec.add_development_dependency 'rake', ['~> 12.0']
end
/$)
}
}
clean { delete "${project.name}.gemspec" }
128 changes: 128 additions & 0 deletions config/checkstyle/checkstyle.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC
"-//Puppy Crawl//DTD Check Configuration 1.3//EN"
"http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
<module name="Checker">
<!-- https://github.com/facebook/presto/blob/master/src/checkstyle/checks.xml -->
<module name="FileTabCharacter"/>
<module name="NewlineAtEndOfFile">
<property name="lineSeparator" value="lf"/>
</module>
<module name="RegexpMultiline">
<property name="format" value="\r"/>
<property name="message" value="Line contains carriage return"/>
</module>
<module name="RegexpMultiline">
<property name="format" value=" \n"/>
<property name="message" value="Line has trailing whitespace"/>
</module>
<module name="RegexpMultiline">
<property name="format" value="\{\n\n"/>
<property name="message" value="Blank line after opening brace"/>
</module>
<module name="RegexpMultiline">
<property name="format" value="\n\n\s*\}"/>
<property name="message" value="Blank line before closing brace"/>
</module>
<module name="RegexpMultiline">
<property name="format" value="\n\n\n"/>
<property name="message" value="Multiple consecutive blank lines"/>
</module>
<module name="RegexpMultiline">
<property name="format" value="\n\n\Z"/>
<property name="message" value="Blank line before end of file"/>
</module>
<module name="RegexpMultiline">
<property name="format" value="Preconditions\.checkNotNull"/>
<property name="message" value="Use of checkNotNull"/>
</module>

<module name="TreeWalker">
<module name="EmptyBlock">
<property name="option" value="text"/>
<property name="tokens" value="
LITERAL_DO, LITERAL_ELSE, LITERAL_FINALLY, LITERAL_IF,
LITERAL_FOR, LITERAL_TRY, LITERAL_WHILE, INSTANCE_INIT, STATIC_INIT"/>
</module>
<module name="EmptyStatement"/>
<module name="EmptyForInitializerPad"/>
<module name="EmptyForIteratorPad">
<property name="option" value="space"/>
</module>
<module name="MethodParamPad">
<property name="allowLineBreaks" value="true"/>
<property name="option" value="nospace"/>
</module>
<module name="ParenPad"/>
<module name="TypecastParenPad"/>
<module name="NeedBraces"/>
<module name="LeftCurly">
<property name="option" value="nl"/>
<property name="tokens" value="CLASS_DEF, CTOR_DEF, INTERFACE_DEF, METHOD_DEF"/>
</module>
<module name="LeftCurly">
<property name="option" value="eol"/>
<property name="tokens" value="
LITERAL_CATCH, LITERAL_DO, LITERAL_ELSE, LITERAL_FINALLY, LITERAL_FOR,
LITERAL_IF, LITERAL_SWITCH, LITERAL_SYNCHRONIZED, LITERAL_TRY, LITERAL_WHILE"/>
</module>
<module name="RightCurly">
<property name="option" value="alone"/>
</module>
<module name="GenericWhitespace"/>
<module name="WhitespaceAfter"/>
<module name="NoWhitespaceBefore"/>

<module name="UpperEll"/>
<module name="DefaultComesLast"/>
<module name="ArrayTypeStyle"/>
<module name="MultipleVariableDeclarations"/>
<module name="ModifierOrder"/>
<module name="OneStatementPerLine"/>
<module name="StringLiteralEquality"/>
<module name="MutableException"/>
<module name="EqualsHashCode"/>
<module name="InnerAssignment"/>
<module name="InterfaceIsType"/>
<module name="HideUtilityClassConstructor"/>

<module name="MemberName"/>
<module name="LocalVariableName"/>
<module name="LocalFinalVariableName"/>
<module name="TypeName"/>
<module name="PackageName"/>
<module name="ParameterName"/>
<module name="StaticVariableName"/>
<module name="ClassTypeParameterName">
<property name="format" value="^[A-Z][0-9]?$"/>
</module>
<module name="MethodTypeParameterName">
<property name="format" value="^[A-Z][0-9]?$"/>
</module>

<module name="AvoidStarImport"/>
<module name="RedundantImport"/>
<module name="UnusedImports"/>
<module name="ImportOrder">
<property name="groups" value="*,javax,java"/>
<property name="separated" value="true"/>
<property name="option" value="bottom"/>
<property name="sortStaticImportsAlphabetically" value="true"/>
</module>

<module name="WhitespaceAround">
<property name="allowEmptyConstructors" value="true"/>
<property name="allowEmptyMethods" value="true"/>
<property name="ignoreEnhancedForColon" value="false"/>
<property name="tokens" value="
ASSIGN, BAND, BAND_ASSIGN, BOR, BOR_ASSIGN, BSR, BSR_ASSIGN,
BXOR, BXOR_ASSIGN, COLON, DIV, DIV_ASSIGN, EQUAL, GE, GT, LAND, LE,
LITERAL_ASSERT, LITERAL_CATCH, LITERAL_DO, LITERAL_ELSE,
LITERAL_FINALLY, LITERAL_FOR, LITERAL_IF, LITERAL_RETURN,
LITERAL_SYNCHRONIZED, LITERAL_TRY, LITERAL_WHILE,
LOR, LT, MINUS, MINUS_ASSIGN, MOD, MOD_ASSIGN, NOT_EQUAL,
PLUS, PLUS_ASSIGN, QUESTION, SL, SLIST, SL_ASSIGN, SR, SR_ASSIGN,
STAR, STAR_ASSIGN, TYPE_EXTENSION_AND"/>
</module>
</module>
</module>
Loading

0 comments on commit b368bf5

Please sign in to comment.