!2 Fix build error for hamcrest-2.2
From: @wk333 Reviewed-by: @caodongxia Signed-off-by: @caodongxia
This commit is contained in:
commit
ab905fb761
189
fix-Upgrade-to-Hamcrest-2.2.patch
Normal file
189
fix-Upgrade-to-Hamcrest-2.2.patch
Normal file
@ -0,0 +1,189 @@
|
||||
From eb75a8f1df9e6f03b71391dc9e34e8405c25de45 Mon Sep 17 00:00:00 2001
|
||||
From: Valery Yatsynovich <valfirst@yandex.ru>
|
||||
Date: Tue, 15 Oct 2019 22:52:32 +0300
|
||||
Subject: [PATCH] Upgrade to Hamcrest 2.1
|
||||
Reference: https://github.com/json-path/JsonPath/commit/f07a582497809ecd7f27bfa563c28e2f937d59ac
|
||||
|
||||
https://github.com/hamcrest/JavaHamcrest/releases/tag/v2.1:
|
||||
"After a long hiatus without releases, this version simplifies the packaging of
|
||||
Hamcrest into a single jar: hamcrest-2.1.jar. Other big changes include
|
||||
Java 9 module compatibility, along with numerous other improvements and bug
|
||||
fixes."
|
||||
|
||||
---
|
||||
build.gradle | 5 ++---
|
||||
json-path-assert/build.gradle | 3 +--
|
||||
.../jsonassert/impl/matcher/IsCollectionWithSize.java | 6 ++----
|
||||
.../jayway/jsonassert/impl/matcher/IsEmptyCollection.java | 5 ++---
|
||||
.../jayway/jsonassert/impl/matcher/IsMapContainingKey.java | 4 +---
|
||||
.../jsonassert/impl/matcher/IsMapContainingValue.java | 4 +---
|
||||
6 files changed, 9 insertions(+), 18 deletions(-)
|
||||
|
||||
diff --git a/build.gradle b/build.gradle
|
||||
index 504f45b..3e15d32 100644
|
||||
--- a/build.gradle
|
||||
+++ b/build.gradle
|
||||
@@ -16,10 +16,9 @@ ext {
|
||||
jacksonDatabind: 'com.fasterxml.jackson.core:jackson-databind:2.6.3',
|
||||
gson: 'com.google.code.gson:gson:2.3.1',
|
||||
jsonOrg: 'org.json:json:20140107',
|
||||
- hamcrestCore: 'org.hamcrest:hamcrest-core:1.3',
|
||||
- hamcrestLibrary: 'org.hamcrest:hamcrest-library:1.3',
|
||||
+ hamcrest: 'org.hamcrest:hamcrest:2.2',
|
||||
|
||||
- test: ['org.slf4j:slf4j-simple:1.7.12', 'org.assertj:assertj-core:2.1.0', 'commons-io:commons-io:2.4','org.hamcrest:hamcrest-core:1.3', 'org.hamcrest:hamcrest-library:1.3', 'junit:junit:4.12']
|
||||
+ test: ['org.slf4j:slf4j-simple:1.7.12', 'org.assertj:assertj-core:2.1.0', 'commons-io:commons-io:2.4','org.hamcrest:hamcrest:2.2', 'junit:junit:4.12']
|
||||
]
|
||||
snapshotVersion = false
|
||||
}
|
||||
diff --git a/json-path-assert/build.gradle b/json-path-assert/build.gradle
|
||||
index 0a47bd0..4f23ac5 100644
|
||||
--- a/json-path-assert/build.gradle
|
||||
+++ b/json-path-assert/build.gradle
|
||||
@@ -13,8 +13,7 @@ jar {
|
||||
|
||||
dependencies {
|
||||
compile project(':json-path')
|
||||
- compile libs.hamcrestCore
|
||||
- compile libs.hamcrestLibrary
|
||||
+ compile libs.hamcrest
|
||||
compile libs.slf4jApi
|
||||
|
||||
testCompile libs.test
|
||||
diff --git a/json-path-assert/src/main/java/com/jayway/jsonassert/impl/matcher/IsCollectionWithSize.java b/json-path-assert/src/main/java/com/jayway/jsonassert/impl/matcher/IsCollectionWithSize.java
|
||||
index c4b7c1d..2a80384 100644
|
||||
--- a/json-path-assert/src/main/java/com/jayway/jsonassert/impl/matcher/IsCollectionWithSize.java
|
||||
+++ b/json-path-assert/src/main/java/com/jayway/jsonassert/impl/matcher/IsCollectionWithSize.java
|
||||
@@ -30,7 +30,6 @@ DAMAGE.
|
||||
package com.jayway.jsonassert.impl.matcher;
|
||||
|
||||
import org.hamcrest.Description;
|
||||
-import org.hamcrest.Factory;
|
||||
import org.hamcrest.Matcher;
|
||||
|
||||
import java.util.Collection;
|
||||
@@ -52,6 +51,7 @@ public class IsCollectionWithSize<E> extends CollectionMatcher<Collection<? exte
|
||||
return sizeMatcher.matches(item.size());
|
||||
}
|
||||
|
||||
+ @Override
|
||||
public void describeTo(Description description) {
|
||||
description.appendText("a collection with size ")
|
||||
.appendDescriptionOf(sizeMatcher);
|
||||
@@ -60,7 +60,6 @@ public class IsCollectionWithSize<E> extends CollectionMatcher<Collection<? exte
|
||||
/**
|
||||
* Does collection size satisfy a given matcher?
|
||||
*/
|
||||
- @Factory
|
||||
public static <E> Matcher<? super Collection<? extends E>> hasSize(Matcher<? super Integer> size) {
|
||||
return new IsCollectionWithSize<E>(size);
|
||||
}
|
||||
@@ -71,9 +70,8 @@ public class IsCollectionWithSize<E> extends CollectionMatcher<Collection<? exte
|
||||
* For example, assertThat(hasSize(equal_to(x)))
|
||||
* vs. assertThat(hasSize(x))
|
||||
*/
|
||||
- @Factory
|
||||
public static <E> Matcher<? super Collection<? extends E>> hasSize(int size) {
|
||||
Matcher<? super Integer> matcher = equalTo(size);
|
||||
return IsCollectionWithSize.<E>hasSize(matcher);
|
||||
}
|
||||
-}
|
||||
\ No newline at end of file
|
||||
+}
|
||||
diff --git a/json-path-assert/src/main/java/com/jayway/jsonassert/impl/matcher/IsEmptyCollection.java b/json-path-assert/src/main/java/com/jayway/jsonassert/impl/matcher/IsEmptyCollection.java
|
||||
index 23b12d0..2f4ec21 100644
|
||||
--- a/json-path-assert/src/main/java/com/jayway/jsonassert/impl/matcher/IsEmptyCollection.java
|
||||
+++ b/json-path-assert/src/main/java/com/jayway/jsonassert/impl/matcher/IsEmptyCollection.java
|
||||
@@ -30,7 +30,6 @@ DAMAGE.
|
||||
package com.jayway.jsonassert.impl.matcher;
|
||||
|
||||
import org.hamcrest.Description;
|
||||
-import org.hamcrest.Factory;
|
||||
import org.hamcrest.Matcher;
|
||||
|
||||
import java.util.Collection;
|
||||
@@ -45,6 +44,7 @@ public class IsEmptyCollection<E> extends CollectionMatcher<Collection<E>> {
|
||||
return item.isEmpty();
|
||||
}
|
||||
|
||||
+ @Override
|
||||
public void describeTo(Description description) {
|
||||
description.appendText("an empty collection");
|
||||
}
|
||||
@@ -52,8 +52,7 @@ public class IsEmptyCollection<E> extends CollectionMatcher<Collection<E>> {
|
||||
/**
|
||||
* Matches an empty collection.
|
||||
*/
|
||||
- @Factory
|
||||
public static <E> Matcher<Collection<E>> empty() {
|
||||
return new IsEmptyCollection<E>();
|
||||
}
|
||||
-}
|
||||
\ No newline at end of file
|
||||
+}
|
||||
diff --git a/json-path-assert/src/main/java/com/jayway/jsonassert/impl/matcher/IsMapContainingKey.java b/json-path-assert/src/main/java/com/jayway/jsonassert/impl/matcher/IsMapContainingKey.java
|
||||
index 9766944..c246716 100644
|
||||
--- a/json-path-assert/src/main/java/com/jayway/jsonassert/impl/matcher/IsMapContainingKey.java
|
||||
+++ b/json-path-assert/src/main/java/com/jayway/jsonassert/impl/matcher/IsMapContainingKey.java
|
||||
@@ -30,7 +30,6 @@ DAMAGE.
|
||||
package com.jayway.jsonassert.impl.matcher;
|
||||
|
||||
import org.hamcrest.Description;
|
||||
-import org.hamcrest.Factory;
|
||||
import org.hamcrest.Matcher;
|
||||
|
||||
import java.util.Map;
|
||||
@@ -54,17 +53,16 @@ public class IsMapContainingKey<K> extends MapTypeSafeMatcher<Map<K,?>> {
|
||||
return false;
|
||||
}
|
||||
|
||||
+ @Override
|
||||
public void describeTo(Description description) {
|
||||
description.appendText("map with key ")
|
||||
.appendDescriptionOf(keyMatcher);
|
||||
}
|
||||
|
||||
- @Factory
|
||||
public static <K> Matcher<Map<K,?>> hasKey(K key) {
|
||||
return hasKey(equalTo(key));
|
||||
}
|
||||
|
||||
- @Factory
|
||||
public static <K> Matcher<Map<K,?>> hasKey(Matcher<K> keyMatcher) {
|
||||
return new IsMapContainingKey<K>(keyMatcher);
|
||||
}
|
||||
diff --git a/json-path-assert/src/main/java/com/jayway/jsonassert/impl/matcher/IsMapContainingValue.java b/json-path-assert/src/main/java/com/jayway/jsonassert/impl/matcher/IsMapContainingValue.java
|
||||
index 9fb3a6d..d60462b 100644
|
||||
--- a/json-path-assert/src/main/java/com/jayway/jsonassert/impl/matcher/IsMapContainingValue.java
|
||||
+++ b/json-path-assert/src/main/java/com/jayway/jsonassert/impl/matcher/IsMapContainingValue.java
|
||||
@@ -30,7 +30,6 @@ DAMAGE.
|
||||
package com.jayway.jsonassert.impl.matcher;
|
||||
|
||||
import org.hamcrest.Description;
|
||||
-import org.hamcrest.Factory;
|
||||
import org.hamcrest.Matcher;
|
||||
|
||||
import java.util.Map;
|
||||
@@ -54,17 +53,16 @@ public class IsMapContainingValue<V> extends MapTypeSafeMatcher<Map<?,V>>{
|
||||
return false;
|
||||
}
|
||||
|
||||
+ @Override
|
||||
public void describeTo(Description description) {
|
||||
description.appendText("map with value ")
|
||||
.appendDescriptionOf(valueMatcher);
|
||||
}
|
||||
|
||||
- @Factory
|
||||
public static <V> Matcher<? super Map<?,V>> hasValue(V value) {
|
||||
return IsMapContainingValue.<V>hasValue(equalTo(value));
|
||||
}
|
||||
|
||||
- @Factory
|
||||
public static <V> Matcher<? super Map<?,V>> hasValue(Matcher<? super V> valueMatcher) {
|
||||
return new IsMapContainingValue<V>(valueMatcher);
|
||||
}
|
||||
--
|
||||
2.27.0
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
Name: json-path
|
||||
Version: 2.1.0
|
||||
Release: 1
|
||||
Release: 2
|
||||
Summary: Java JsonPath implementation
|
||||
License: ASL 2.0 and BSD
|
||||
URL: https://github.com/jayway/JsonPath
|
||||
@ -8,6 +8,7 @@ Source0: https://github.com/jayway/JsonPath/archive/json-path-%{vers
|
||||
Source1: https://repo1.maven.org/maven2/com/jayway/jsonpath/json-path/%{version}/json-path-%{version}.pom
|
||||
Source2: https://repo1.maven.org/maven2/com/jayway/jsonpath/json-path-assert/%{version}/json-path-assert-%{version}.pom
|
||||
Patch0: %{name}-2.1.0-JsonOrg.patch
|
||||
Patch1: fix-Upgrade-to-Hamcrest-2.2.patch
|
||||
BuildRequires: maven-local mvn(com.fasterxml.jackson.core:jackson-databind)
|
||||
BuildRequires: mvn(com.google.code.gson:gson) mvn(commons-io:commons-io) mvn(junit:junit)
|
||||
BuildRequires: mvn(net.minidev:json-smart) mvn(org.apache.felix:maven-bundle-plugin)
|
||||
@ -29,6 +30,7 @@ find -type f -name *.class -print -delete
|
||||
cp -p %{SOURCE1} %{name}/pom.xml
|
||||
cp -p %{SOURCE2} %{name}-assert/pom.xml
|
||||
%patch0 -p1
|
||||
%patch1 -p1
|
||||
rm -rf %{name}/src/main/java/com/jayway/jsonpath/spi/json/JsonOrg*.java \
|
||||
%{name}/src/main/java/com/jayway/jsonpath/spi/mapper/JsonOrg*.java \
|
||||
%{name}/src/test/java/com/jayway/jsonpath/JsonOrg*.java
|
||||
@ -105,5 +107,8 @@ done
|
||||
%license LICENSE
|
||||
|
||||
%changelog
|
||||
* Sat Oct 07 2023 wangkai <13474090681@163.com> - 2.1.0-2
|
||||
- Fix build error for hamcrest-2.2
|
||||
|
||||
* Mon Aug 24 2020 wangchong <wangchong56@huawei.com> - 2.1.0-1
|
||||
- package init
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user