Skip to content

Commit

Permalink
Merge pull request #257 from Enigmatis/release-8.1
Browse files Browse the repository at this point in the history
Release 8.1
  • Loading branch information
yarinvak authored Aug 12, 2020
2 parents 26e6ce2 + 616014f commit ddb218e
Show file tree
Hide file tree
Showing 9 changed files with 118 additions and 50 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ If you would like to use a tool that creates a graphql spring boot server using

```groovy
dependencies {
compile "io.github.graphql-java:graphql-java-annotations:8.0.1"
compile "io.github.graphql-java:graphql-java-annotations:8.1"
}
```

Expand All @@ -47,7 +47,7 @@ dependencies {
<dependency>
<groupId>io.github.graphql-java</groupId>
<artifactId>graphql-java-annotations</artifactId>
<version>8.0.1</version>
<version>8.1</version>
</dependency>
```

Expand Down Expand Up @@ -250,7 +250,7 @@ public String field(@GraphQLDefaultValue(DefaultValue.class) String value) {
The `DefaultValue` class can define a `getInstance` method that will be called instead of the default constructor.

`@GraphQLDeprecate` and Java's `@Deprecated` can be used to specify a deprecated
field.
field or method.

### Custom data fetcher

Expand Down
20 changes: 6 additions & 14 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,18 @@ buildscript {
mavenCentral()
}
dependencies {
classpath 'biz.aQute.bnd:biz.aQute.bnd.gradle:3.1.0'
classpath 'biz.aQute.bnd:biz.aQute.bnd.gradle:5.1.2'
}
}
plugins {
id "com.jfrog.bintray" version "1.8.4"
id 'net.researchgate.release' version '2.3.4'
id "com.github.hierynomus.license" version "0.14.0"
id 'com.jfrog.bintray' version '1.8.5'
id 'net.researchgate.release' version '2.8.1'
id 'com.github.hierynomus.license' version '0.15.0'
}

apply plugin: 'java'
apply plugin: 'idea'

apply plugin: 'osgi'
apply plugin: 'biz.aQute.bnd.builder'
apply plugin: 'com.jfrog.bintray'
apply plugin: 'maven-publish'
Expand All @@ -43,12 +42,6 @@ release {
failOnCommitNeeded = false
}

jar {
manifest {
instruction 'Import-Package', 'javax.validation.constraints', '*'
}
}

repositories {
mavenCentral()
}
Expand Down Expand Up @@ -182,7 +175,6 @@ task bundle(type: Bundle) {
bndfile = file('bundle.bnd')
}

task wrapper(type: Wrapper) {
gradleVersion = '2.0'
wrapper {
gradleVersion = '6.5.1'
}

2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ org.gradle.daemon=true
org.gradle.parallel=true
org.gradle.jvmargs=-Dfile.encoding=UTF-8

version = 8.0.1
version = 8.1
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 1 addition & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#Thu Jun 22 22:50:08 AEST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.0-all.zip
68 changes: 41 additions & 27 deletions gradlew
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@
#!/usr/bin/env bash
#!/usr/bin/env sh

#
# Copyright 2015 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

##############################################################################
##
Expand Down Expand Up @@ -28,16 +44,16 @@ APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"

warn ( ) {
warn () {
echo "$*"
}

die ( ) {
die () {
echo
echo "$*"
echo
Expand Down Expand Up @@ -109,8 +125,8 @@ if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi

# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
# For Cygwin or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
Expand Down Expand Up @@ -138,32 +154,30 @@ if $cygwin ; then
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
i=`expr $i + 1`
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
0) set -- ;;
1) set -- "$args0" ;;
2) set -- "$args0" "$args1" ;;
3) set -- "$args0" "$args1" "$args2" ;;
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi

# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
function splitJvmOpts() {
JVM_OPTS=("$@")
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
APP_ARGS=`save "$@"`

# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [[ "$(uname)" == "Darwin" ]] && [[ "$HOME" == "$PWD" ]]; then
cd "$(dirname "$0")"
fi
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"

exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
exec "$JAVACMD" "$@"
18 changes: 17 additions & 1 deletion gradlew.bat
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem

@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
Expand All @@ -14,7 +30,7 @@ set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"

@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

@Target(ElementType.METHOD)
@Target({ElementType.METHOD, ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME)
public @interface GraphQLDeprecate {
String value() default "";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,22 @@
import graphql.annotations.annotationTypes.GraphQLDeprecate;
import org.testng.annotations.Test;

import java.lang.reflect.Field;
import java.lang.reflect.Method;

import static org.testng.AssertJUnit.assertEquals;
import static org.testng.AssertJUnit.assertNull;

public class DeprecateBuilderTest {

@GraphQLDeprecate("test field deprecated")
public String testField;

@GraphQLDeprecate
public String testField1;

public String testField2;

@GraphQLDeprecate("test deprecated")
public int testMethod() {
return 1;
Expand Down Expand Up @@ -56,7 +65,6 @@ public void build_graphQLDeprecateAnnotationExistsWithValue_returnAnnotationValu
assertEquals(deprecate, "test deprecated");
}


@Test
public void build_graphQLDeprecateAnnotationExistsWithNoValue_returnEmptyString() throws NoSuchMethodException {
// arrange
Expand Down Expand Up @@ -95,4 +103,43 @@ public void build_noDeprecatedAnnotation_returnNull() throws NoSuchMethodExcepti
// assert
assertNull(deprecate);
}

@Test
public void build_deprecatedAnnotationDoesNotExistsOnField_returnNull() throws NoSuchFieldException {
// arrange
Field field = getClass().getField("testField2");
DeprecateBuilder deprecateBuilder = new DeprecateBuilder(field);

// act
String deprecate = deprecateBuilder.build();

// assert
assertNull(deprecate);
}

@Test
public void build_graphQLDeprecateAnnotationExistsOnFieldWithNoValue_returnEmptyString() throws NoSuchFieldException {
// arrange
Field field = getClass().getField("testField1");
DeprecateBuilder deprecateBuilder = new DeprecateBuilder(field);

// act
String deprecate = deprecateBuilder.build();

// assert
assertEquals(deprecate, "Deprecated");
}

@Test
public void build_graphQLDeprecateAnnotationExistsOnFieldWithValue_returnAnnotationValue() throws NoSuchFieldException {
// arrange
Field field = getClass().getField("testField");
DeprecateBuilder deprecateBuilder = new DeprecateBuilder(field);

// act
String deprecate = deprecateBuilder.build();

// assert
assertEquals(deprecate, "test field deprecated");
}
}

0 comments on commit ddb218e

Please sign in to comment.