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

DoNotApprove: Gradle, Parameters, and Paging #237

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
193 changes: 38 additions & 155 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,161 +1,44 @@
# Custom rules

target/
work/

# Created by https://www.gitignore.io

### Java ###
*.class

# Mobile Tools for Java (J2ME)
.mtj.tmp/

# Package Files #
*.jar
*.war
*.ear

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*


### OSX ###
.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon


# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk


### Eclipse ###
*.pydevproject
.metadata
.gradle
bin/
tmp/
*.tmp
*.bak
*.swp
*~.nib
local.properties
.settings/
.loadpath

# Eclipse Core
.project

# External tool builders
.externalToolBuilders/

# Locally stored "Eclipse launch configurations"
*.launch

# CDT-specific
.cproject

# JDT-specific (Eclipse Java Development Tools)
.classpath

# PDT-specific
.buildpath

# sbteclipse plugin
.target

# TeXlipse plugin
.texlipse


### Intellij ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm

.vscode
*.iml

## Directory-based project format:
.idea/
# if you remove the above rule, at least ignore the following:

# User-specific stuff:
# .idea/workspace.xml
# .idea/tasks.xml
# .idea/dictionaries

# Sensitive or high-churn files:
# .idea/dataSources.ids
# .idea/dataSources.xml
# .idea/sqlDataSources.xml
# .idea/dynamic.xml
# .idea/uiDesigner.xml

# Gradle:
# .idea/gradle.xml
# .idea/libraries

# Mongo Explorer plugin:
# .idea/mongoSettings.xml

## File-based project format:
out/
*.ipr
*.iws

## Plugin-specific files:

# IntelliJ
/out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
classpath.txt
version.properties
!modules/swagger-codegen-cli/src/main/resources/version.properties
.project
.classpath
lib/*
build/*
generated-files/*
generated-sources/*
generated-code/*
*.swp
*.swo
target
.idea
.lib
atlassian-ide-plugin.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties


### NetBeans ###
nbproject/private/
build/
nbbuild/
dist/
nbdist/
nbactions.xml
nb-configuration.xml
.nb-gradle/


### Vim ###
[._]*.s[a-w][a-z]
[._]s[a-w][a-z]
*.un~
Session.vim
.netrwhist
.DS_Store
packages/
.pub
.packages
.vagrant/
.vscode/

.settings

*.mustache~
*.java~
*.pm~
*.xml~
*.t~
*~
.gradle
.gradle/*
gradlew*
gradle/*

### Acquisio related test ###
*AcquisioTest.java
*AcquisioTest.groovy
credentials.groovy
/target
/generated-files
nbactions.xml
38 changes: 38 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
apply plugin: 'java'
apply plugin: 'maven'

group = 'net.rcarz'
version = '0.6-SNAPSHOT'

description = """jira-client"""

String powermockVersion = '2.0.0-beta.5'


sourceCompatibility = 1.8
targetCompatibility = 1.8
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}

configurations.all {
}

repositories {

maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
maven { url "http://repo.maven.apache.org/maven2" }
}
dependencies {
implementation group: 'org.apache.httpcomponents', name: 'httpclient', version:'4.2.5'
implementation group: 'org.apache.httpcomponents', name: 'httpmime', version:'4.2.5'
implementation group: 'net.sf.json-lib', name: 'json-lib', version:'2.4', classifier:'jdk15'
implementation group: 'joda-time', name: 'joda-time', version:'2.3'
testImplementation group: 'junit', name: 'junit', version:'4.12'
testImplementation group: 'net.bytebuddy', name: 'byte-buddy', version: '1.8.22'
testImplementation group: 'org.powermock', name: 'powermock-core', version: powermockVersion
testImplementation group: 'org.powermock', name: 'powermock-module-junit4', version: powermockVersion
testImplementation group: 'org.powermock', name: 'powermock-api-mockito2', version: powermockVersion

testImplementation group: 'org.codehaus.groovy', name: 'groovy-all', version:'2.4.6'
}
28 changes: 25 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@
<artifactId>oss-parent</artifactId>
<version>7</version>
</parent>

<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>

<dependencies>

Expand Down Expand Up @@ -70,20 +75,37 @@
<version>4.12</version>
<scope>test</scope>
</dependency>


<dependency>
<groupId>net.bytebuddy</groupId>
<artifactId>byte-buddy</artifactId>
<version>1.8.22</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-core</artifactId>
<version>2.0.0-beta.5</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-module-junit4</artifactId>
<version>1.6.3</version>
<version>2.0.0-beta.5</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-api-mockito</artifactId>
<version>1.6.3</version>
<artifactId>powermock-api-mockito2</artifactId>
<version>2.0.0-beta.5</version>
<scope>test</scope>
</dependency>



<dependency>
<groupId>org.codehaus.groovy</groupId>
Expand Down
1 change: 1 addition & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
rootProject.name = 'jira-client'
17 changes: 14 additions & 3 deletions src/main/java/net/rcarz/jiraclient/Field.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
import java.sql.Timestamp;
import java.text.ParsePosition;
import java.text.SimpleDateFormat;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeParseException;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
Expand Down Expand Up @@ -152,7 +156,7 @@ public ValueTuple(ValueType type, Object value) {
public static final String SECURITY = "security";

public static final String DATE_FORMAT = "yyyy-MM-dd";
public static final String DATETIME_FORMAT = "yyyy-MM-dd'T'HH:mm:ss.SSSZ";
public static final String DATETIME_FORMAT = "yyyy-MM-dd'T'HH:mm:ss.SSSX";

private Field() { }

Expand Down Expand Up @@ -242,8 +246,15 @@ public static Date getDate(Object d) {
Date result = null;

if (d instanceof String) {
SimpleDateFormat df = new SimpleDateFormat(DATE_FORMAT);
result = df.parse((String)d, new ParsePosition(0));
DateTimeFormatter dtf = DateTimeFormatter.ofPattern(DATETIME_FORMAT);
try {
result = Date.from(ZonedDateTime.parse((String) d, dtf)
.withZoneSameInstant(ZoneId.of("UTC"))
.toInstant());
} catch (DateTimeParseException dtpe) {
SimpleDateFormat df = new SimpleDateFormat(DATE_FORMAT);
result = df.parse((String)d, new ParsePosition(0));
}
}

return result;
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/net/rcarz/jiraclient/Issue.java
Original file line number Diff line number Diff line change
Expand Up @@ -764,6 +764,7 @@ private static Object requireContent(Object content) {

private String key = null;
private Map fields = null;
private Map properties = null;

/* system fields */
private User assignee = null;
Expand Down Expand Up @@ -821,6 +822,8 @@ private void deserialise(JSONObject json) {
if (fields == null)
return;

properties = (Map)map.get("properties");

assignee = Field.getResource(User.class, fields.get(Field.ASSIGNEE), restclient);
attachments = Field.getResourceArray(Attachment.class, fields.get(Field.ATTACHMENT), restclient);
changeLog = Field.getResource(ChangeLog.class, map.get(Field.CHANGE_LOG), restclient);
Expand Down
8 changes: 8 additions & 0 deletions src/main/java/net/rcarz/jiraclient/IssueType.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public class IssueType extends Resource {
private String name = null;
private boolean subtask = false;
private JSONObject fields = null;
private JSONObject properties = null;

/**
* Creates an issue type from a JSON payload.
Expand All @@ -60,6 +61,9 @@ private void deserialise(JSONObject json) {

if (map.containsKey("fields") && map.get("fields") instanceof JSONObject)
fields = (JSONObject)map.get("fields");

if (map.containsKey("properties") && map.get("properties") instanceof JSONObject)
properties = (JSONObject)map.get("properties");
}

/**
Expand Down Expand Up @@ -113,5 +117,9 @@ public boolean isSubtask() {
public JSONObject getFields() {
return fields;
}

public JSONObject getProperties() {
return properties;
}
}

Loading