Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
kistlers committed Jun 20, 2023
2 parents 68a56ff + c435151 commit 89f2803
Show file tree
Hide file tree
Showing 12 changed files with 52 additions and 29 deletions.
2 changes: 1 addition & 1 deletion apt-test-generator/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.4.1</version>
<version>3.5.0</version>
<executions>
<execution>
<phase>package</phase>
Expand Down
2 changes: 1 addition & 1 deletion benchmark/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.4.1</version>
<version>3.5.0</version>
<executions>
<execution>
<phase>package</phase>
Expand Down
2 changes: 1 addition & 1 deletion core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>6.0.9</version>
<version>6.0.10</version>
<scope>test</scope>
</dependency>

Expand Down
3 changes: 3 additions & 0 deletions core/src/main/java/feign/querymap/BeanQueryMapEncoder.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ public class BeanQueryMapEncoder implements QueryMapEncoder {

@Override
public Map<String, Object> encode(Object object) throws EncodeException {
if (object == null) {
return Collections.emptyMap();
}
try {
ObjectParamMetadata metadata = getMetadata(object.getClass());
Map<String, Object> propertyNameToValue = new HashMap<String, Object>();
Expand Down
3 changes: 3 additions & 0 deletions core/src/main/java/feign/querymap/FieldQueryMapEncoder.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ public class FieldQueryMapEncoder implements QueryMapEncoder {

@Override
public Map<String, Object> encode(Object object) throws EncodeException {
if (object == null) {
return Collections.emptyMap();
}
ObjectParamMetadata metadata =
classToMetadata.computeIfAbsent(object.getClass(), ObjectParamMetadata::parseObjectType);

Expand Down
42 changes: 21 additions & 21 deletions core/src/test/java/feign/LoggerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -267,23 +267,23 @@ public static Iterable<Object[]> data() {
return Arrays.asList(new Object[][] {
{Level.NONE, Collections.emptyList()},
{Level.BASIC, Arrays.asList(
"\\[SendsStuff#login\\] ---> POST http://robofu.abc/ HTTP/1.1",
"\\[SendsStuff#login\\] <--- ERROR UnknownHostException: robofu.abc \\([0-9]+ms\\)")},
"\\[SendsStuff#login\\] ---> POST http://non-exist.invalid/ HTTP/1.1",
"\\[SendsStuff#login\\] <--- ERROR UnknownHostException: non-exist.invalid \\([0-9]+ms\\)")},
{Level.HEADERS, Arrays.asList(
"\\[SendsStuff#login\\] ---> POST http://robofu.abc/ HTTP/1.1",
"\\[SendsStuff#login\\] ---> POST http://non-exist.invalid/ HTTP/1.1",
"\\[SendsStuff#login\\] Content-Length: 80",
"\\[SendsStuff#login\\] Content-Type: application/json",
"\\[SendsStuff#login\\] ---> END HTTP \\(80-byte body\\)",
"\\[SendsStuff#login\\] <--- ERROR UnknownHostException: robofu.abc \\([0-9]+ms\\)")},
"\\[SendsStuff#login\\] <--- ERROR UnknownHostException: non-exist.invalid \\([0-9]+ms\\)")},
{Level.FULL, Arrays.asList(
"\\[SendsStuff#login\\] ---> POST http://robofu.abc/ HTTP/1.1",
"\\[SendsStuff#login\\] ---> POST http://non-exist.invalid/ HTTP/1.1",
"\\[SendsStuff#login\\] Content-Length: 80",
"\\[SendsStuff#login\\] Content-Type: application/json",
"\\[SendsStuff#login\\] ",
"\\[SendsStuff#login\\] \\{\"customer_name\": \"netflix\", \"user_name\": \"denominator\", \"password\": \"password\"\\}",
"\\[SendsStuff#login\\] ---> END HTTP \\(80-byte body\\)",
"\\[SendsStuff#login\\] <--- ERROR UnknownHostException: robofu.abc \\([0-9]+ms\\)",
"(?s)\\[SendsStuff#login\\] java.net.UnknownHostException: robofu.abc.*",
"\\[SendsStuff#login\\] <--- ERROR UnknownHostException: non-exist.invalid \\([0-9]+ms\\)",
"(?s)\\[SendsStuff#login\\] java.net.UnknownHostException: non-exist.invalid.*",
"\\[SendsStuff#login\\] <--- END ERROR")}
});
}
Expand All @@ -304,7 +304,7 @@ public Retryer clone() {
return this;
}
})
.target(SendsStuff.class, "http://robofu.abc");
.target(SendsStuff.class, "http://non-exist.invalid");

thrown.expect(FeignException.class);

Expand All @@ -329,23 +329,23 @@ public static Iterable<Object[]> data() {
return Arrays.asList(new Object[][] {
{Level.NONE, Collections.emptyList()},
{Level.BASIC, Arrays.asList(
"\\[SendsStuff#login\\] ---> POST http://sna%fu.abc/ HTTP/1.1",
"\\[SendsStuff#login\\] <--- ERROR UnknownHostException: sna%fu.abc \\([0-9]+ms\\)")},
"\\[SendsStuff#login\\] ---> POST http://non-exist.invalid/ HTTP/1.1",
"\\[SendsStuff#login\\] <--- ERROR UnknownHostException: non-exist.invalid \\([0-9]+ms\\)")},
{Level.HEADERS, Arrays.asList(
"\\[SendsStuff#login\\] ---> POST http://sna%fu.abc/ HTTP/1.1",
"\\[SendsStuff#login\\] ---> POST http://non-exist.invalid/ HTTP/1.1",
"\\[SendsStuff#login\\] Content-Length: 80",
"\\[SendsStuff#login\\] Content-Type: application/json",
"\\[SendsStuff#login\\] ---> END HTTP \\(80-byte body\\)",
"\\[SendsStuff#login\\] <--- ERROR UnknownHostException: sna%fu.abc \\([0-9]+ms\\)")},
"\\[SendsStuff#login\\] <--- ERROR UnknownHostException: non-exist.invalid \\([0-9]+ms\\)")},
{Level.FULL, Arrays.asList(
"\\[SendsStuff#login\\] ---> POST http://sna%fu.abc/ HTTP/1.1",
"\\[SendsStuff#login\\] ---> POST http://non-exist.invalid/ HTTP/1.1",
"\\[SendsStuff#login\\] Content-Length: 80",
"\\[SendsStuff#login\\] Content-Type: application/json",
"\\[SendsStuff#login\\] ",
"\\[SendsStuff#login\\] \\{\"customer_name\": \"netflix\", \"user_name\": \"denominator\", \"password\": \"password\"\\}",
"\\[SendsStuff#login\\] ---> END HTTP \\(80-byte body\\)",
"\\[SendsStuff#login\\] <--- ERROR UnknownHostException: sna%fu.abc \\([0-9]+ms\\)",
"(?s)\\[SendsStuff#login\\] java.net.UnknownHostException: sna%fu.abc.*",
"\\[SendsStuff#login\\] <--- ERROR UnknownHostException: non-exist.invalid \\([0-9]+ms\\)",
"(?s)\\[SendsStuff#login\\] java.net.UnknownHostException: non-exist.invalid.*",
"\\[SendsStuff#login\\] <--- END ERROR")}
});
}
Expand All @@ -366,7 +366,7 @@ public Retryer clone() {
return this;
}
})
.target(SendsStuff.class, "http://sna%25fu.abc");
.target(SendsStuff.class, "http://non-exist.invalid");

thrown.expect(FeignException.class);

Expand All @@ -390,11 +390,11 @@ public static Iterable<Object[]> data() {
return Arrays.asList(new Object[][] {
{Level.NONE, Collections.emptyList()},
{Level.BASIC, Arrays.asList(
"\\[SendsStuff#login\\] ---> POST http://robofu.abc/ HTTP/1.1",
"\\[SendsStuff#login\\] <--- ERROR UnknownHostException: robofu.abc \\([0-9]+ms\\)",
"\\[SendsStuff#login\\] ---> POST http://non-exist.invalid/ HTTP/1.1",
"\\[SendsStuff#login\\] <--- ERROR UnknownHostException: non-exist.invalid \\([0-9]+ms\\)",
"\\[SendsStuff#login\\] ---> RETRYING",
"\\[SendsStuff#login\\] ---> POST http://robofu.abc/ HTTP/1.1",
"\\[SendsStuff#login\\] <--- ERROR UnknownHostException: robofu.abc \\([0-9]+ms\\)")}
"\\[SendsStuff#login\\] ---> POST http://non-exist.invalid/ HTTP/1.1",
"\\[SendsStuff#login\\] <--- ERROR UnknownHostException: non-exist.invalid \\([0-9]+ms\\)")}
});
}

Expand Down Expand Up @@ -422,7 +422,7 @@ public Retryer clone() {
return this;
}
})
.target(SendsStuff.class, "http://robofu.abc");
.target(SendsStuff.class, "http://non-exist.invalid");

api.login("netflix", "denominator", "password");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
Expand All @@ -34,6 +35,11 @@ public class BeanQueryMapEncoderTest {

private final QueryMapEncoder encoder = new BeanQueryMapEncoder();

@Test
public void testDefaultEncoder_acceptNullValue() {
assertEquals("Empty map should be returned", Collections.EMPTY_MAP, encoder.encode(null));
}

@Test
public void testDefaultEncoder_normalClassWithValues() {
Map<String, Object> expected = new HashMap<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
Expand All @@ -33,6 +34,11 @@ public class FieldQueryMapEncoderTest {

private final QueryMapEncoder encoder = new FieldQueryMapEncoder();

@Test
public void testDefaultEncoder_acceptNullValue() {
assertEquals("Empty map should be returned", Collections.EMPTY_MAP, encoder.encode(null));
}

@Test
public void testDefaultEncoder_normalClassWithValues() {
final Map<String, Object> expected = new HashMap<>();
Expand Down
2 changes: 1 addition & 1 deletion example-github-with-coroutine/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.4.1</version>
<version>3.5.0</version>
<executions>
<execution>
<phase>package</phase>
Expand Down
2 changes: 1 addition & 1 deletion example-github/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.4.1</version>
<version>3.5.0</version>
<executions>
<execution>
<phase>package</phase>
Expand Down
2 changes: 1 addition & 1 deletion example-wikipedia/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.4.1</version>
<version>3.5.0</version>
<executions>
<execution>
<phase>package</phase>
Expand Down
9 changes: 7 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,14 @@
<gson.version>2.10.1</gson.version>
<slf4j.version>2.0.7</slf4j.version>
<bouncy.version>1.70</bouncy.version>
<json.version>20230227</json.version>
<json.version>20230618</json.version>

<junit.version>4.13.2</junit.version>
<junit5.version>5.9.3</junit5.version>
<jackson.version>2.15.2</jackson.version>
<assertj.version>3.24.2</assertj.version>
<hamcrest.version>2.2</hamcrest.version>
<mockito.version>5.3.1</mockito.version>
<mockito.version>5.4.0</mockito.version>

<maven-compiler-plugin.version>3.11.0</maven-compiler-plugin.version>
<maven-install-plugin.version>3.1.1</maven-install-plugin.version>
Expand Down Expand Up @@ -422,11 +422,13 @@
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven-compiler-plugin.version}</version>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>${maven-jar-plugin.version}</version>
<configuration>
Expand Down Expand Up @@ -532,6 +534,7 @@
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<inherited>true</inherited>
<configuration>
Expand Down Expand Up @@ -570,11 +573,13 @@
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>${maven-install-plugin.version}</version>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>${maven-release-plugin.version}</version>
<configuration>
Expand Down

0 comments on commit 89f2803

Please sign in to comment.