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

Update Embulk Version To 0.10.32 And Add Github Action To Check Commit #78

Merged
merged 6 commits into from May 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
41 changes: 41 additions & 0 deletions .github/workflows/check.yml
@@ -0,0 +1,41 @@
name: Check

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Set up JDK 1.8
uses: actions/setup-java@v3
with:
java-version: 8
distribution: "zulu"

- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Build with testing
run: ./gradlew check --console rich --info

- uses: actions/upload-artifact@v3
if: always()
with:
name: tests
path: ./build/reports/tests/test

- name: JaCoCo test report
if: success()
run: ./gradlew jacocoTestReport

- uses: actions/upload-artifact@v3
if: success()
with:
name: jacoco
path: ./build/reports/coverage
4 changes: 4 additions & 0 deletions CHANGELOG.md
@@ -1,3 +1,7 @@
## 0.3.1-SNAPSHOT - 2023-05-19
* [enhancement] Update library, minor code refactoring
* PR [#78](https://github.com/treasure-data/embulk-input-jira/pull/78)

## 0.2.15 - 2022-05-23
* [enhancement] Catchup with embulk v0.10.32
* PR [#71](https://github.com/treasure-data/embulk-input-jira/pull/71)
Expand Down
10 changes: 7 additions & 3 deletions README.md
Expand Up @@ -48,11 +48,15 @@ in:
## Build

```
$ ./gradlew gem # -t to watch change of files and rebuild continuously
$ ./gradlew checkstyle test jacocoTestReport; ./gradlew gem;
```

## Test
## Build and Test With Local File
```
$ rm -rf build; ./gradlew gem; embulk guess -L ./build/gemContents/ {path_to_yaml_file}
```

## Publish
```
$ ./gradlew checkstyle test jacocoTestReport
$ rm -rf build; ./gradlew gem; ./gradlew publishMavenPublicationToMavenCentralRepository
```
21 changes: 7 additions & 14 deletions build.gradle
Expand Up @@ -12,14 +12,14 @@ repositories {
mavenCentral()
}

version = "0.3.0-SNAPSHOT"
version = "0.3.1-SNAPSHOT"
group = "com.treasuredata.embulk.plugins"
description = "JIRA Embulk input plugin."

sourceCompatibility = 1.8
targetCompatibility = 1.8

def embulkVersion = '0.10.28'
def embulkVersion = '0.10.32'

tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:deprecation" << "-Xlint:unchecked"
Expand All @@ -46,12 +46,12 @@ dependencies {
compile 'org.embulk:embulk-util-timestamp:0.2.1'
compile('org.embulk:embulk-util-guess:0.1.2')

compile('org.embulk:embulk-util-json:0.1.0') {
compile('org.embulk:embulk-util-json:0.1.1') {
exclude group: 'com.fasterxml.jackson.core', module: 'jackson-core'
exclude group: 'org.msgpack', module: 'msgpack-core'
}

// Explicit dependencies for embulk-util-* that matches with Embulk 0.10.28
// Explicit dependencies for embulk-util-* that matches with Embulk 0.10.32
compile 'com.fasterxml.jackson.core:jackson-core:2.6.7'
compile 'com.fasterxml.jackson.core:jackson-annotations:2.6.7'
compile 'com.fasterxml.jackson.core:jackson-databind:2.6.7'
Expand All @@ -71,18 +71,11 @@ dependencies {
compile 'com.google.guava:guava:18.0'
compile 'org.apache.commons:commons-lang3:3.4'

testCompile "junit:junit:4.13"
testCompile("org.embulk:embulk-core:$embulkVersion") {
exclude group: 'com.fasterxml.jackson.core', module: 'jackson-annotations'
exclude group: 'com.fasterxml.jackson.core', module: 'jackson-core'
exclude group: 'com.fasterxml.jackson.core', module: 'jackson-databind'
exclude group: 'com.fasterxml.jackson.datatype', module: 'jackson-datatype-jdk8'
exclude group: 'javax.validation', module: 'validation-api'
}
testCompile "org.embulk:embulk-standards:$embulkVersion"
testCompile "junit:junit:4.10"
testCompile "org.embulk:embulk-junit4:$embulkVersion"
testCompile "org.embulk:embulk-core:$embulkVersion"
testCompile "org.embulk:embulk-core:$embulkVersion:tests"
testCompile "org.embulk:embulk-deps:$embulkVersion"
testCompile "org.embulk:embulk-junit4:$embulkVersion"
testCompile "org.mockito:mockito-core:2.28.2"
}

Expand Down
2 changes: 1 addition & 1 deletion gradle/dependency-locks/embulkPluginRuntime.lockfile
Expand Up @@ -27,7 +27,7 @@ org.eclipse.jetty:jetty-util:9.2.14.v20151106
org.embulk:embulk-util-config:0.3.1
org.embulk:embulk-util-file:0.1.1
org.embulk:embulk-util-guess:0.1.2
org.embulk:embulk-util-json:0.1.0
org.embulk:embulk-util-json:0.1.1
org.embulk:embulk-util-retryhelper-jetty92:0.8.2
org.embulk:embulk-util-retryhelper:0.8.2
org.embulk:embulk-util-rubytime:0.3.2
Expand Down
4 changes: 1 addition & 3 deletions src/main/java/org/embulk/input/jira/Issue.java
Expand Up @@ -53,9 +53,7 @@ else if (keys.isEmpty() || (json.isJsonArray() && json.getAsJsonArray().size() =
}
return get(arrays, keys);
}
else {
return get(json.getAsJsonObject().get(key), keys);
}
return get(json.getAsJsonObject().get(key), keys);
}

public synchronized JsonObject getFlatten()
Expand Down
Expand Up @@ -60,9 +60,7 @@ public void checkUserCredentials(final PluginTask task)
if (e.getStatusCode() == HttpStatus.SC_UNAUTHORIZED) {
throw new ConfigException("Could not authorize with your credential.");
}
else {
throw new ConfigException("Could not authorize with your credential due to problems when contacting JIRA API.");
}
throw new ConfigException("Could not authorize with your credential due to problems when contacting JIRA API.");
}
}

Expand Down
24 changes: 9 additions & 15 deletions src/main/java/org/embulk/input/jira/util/JiraUtil.java
Expand Up @@ -116,13 +116,12 @@ private static Instant getTimestampValue(final PluginTask task, final Column col
.builder(pattern, true)
.setDefaultZoneFromString("UTC")
.build();
Instant result = null;
try {
result = formatter.parse(value);
return formatter.parse(value);
}
catch (final Exception e) {
return null;
}
return result;
}

/*
Expand All @@ -131,13 +130,12 @@ private static Instant getTimestampValue(final PluginTask task, final Column col
* */
private static Long getLongValue(final JsonElement value)
{
Long result = null;
try {
result = value.getAsLong();
return value.getAsLong();
}
catch (final Exception e) {
return null;
}
return result;
}

/*
Expand All @@ -146,13 +144,12 @@ private static Long getLongValue(final JsonElement value)
* */
private static Double getDoubleValue(final JsonElement value)
{
Double result = null;
try {
result = value.getAsDouble();
return value.getAsDouble();
}
catch (final Exception e) {
return null;
}
return result;
}

/*
Expand All @@ -161,13 +158,12 @@ private static Double getDoubleValue(final JsonElement value)
* */
private static Boolean getBooleanValue(final JsonElement value)
{
Boolean result = null;
try {
result = value.getAsBoolean();
return value.getAsBoolean();
}
catch (final Exception e) {
return null;
}
return result;
}

public static void addRecord(final Issue issue, final Schema schema, final PluginTask task, final PageBuilder pageBuilder)
Expand Down Expand Up @@ -201,9 +197,7 @@ else if (data.isJsonArray()) {
if (obj.isJsonPrimitive()) {
return obj.getAsString();
}
else {
return obj.toString();
}
return obj.toString();
})
.collect(Collectors.joining(",")));
}
Expand Down