Skip to content

Commit 85f1869

Browse files
committed
Merge branch 'immutables-upgrade' into 2.x
2 parents d9bfd01 + e50bf66 commit 85f1869

File tree

145 files changed

+424
-183
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

145 files changed

+424
-183
lines changed

.idea/google-java-format.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cloudfoundry-client-reactor/cloudfoundry-client-reactor.iml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
<orderEntry type="module" module-name="cloudfoundry-util" />
5151
<orderEntry type="library" name="Maven: org.apache.commons:commons-compress:1.16.1" level="project" />
5252
<orderEntry type="library" name="Maven: org.atteo:evo-inflector:1.2.2" level="project" />
53-
<orderEntry type="library" scope="PROVIDED" name="Maven: org.immutables:value:2.5.6" level="project" />
53+
<orderEntry type="library" scope="PROVIDED" name="Maven: org.immutables:value:2.6.1" level="project" />
5454
<orderEntry type="library" scope="TEST" name="Maven: org.mockito:mockito-core:1.10.19" level="project" />
5555
<orderEntry type="library" name="Maven: org.objenesis:objenesis:2.5.1" level="project" />
5656
<orderEntry type="library" name="Maven: org.slf4j:jcl-over-slf4j:1.7.25" level="project" />

cloudfoundry-client-reactor/src/main/java/org/cloudfoundry/reactor/_DefaultConnectionContext.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@
4646
import java.util.Optional;
4747

4848
import static com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL;
49-
import static com.fasterxml.jackson.databind.DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES;
5049
import static io.netty.channel.ChannelOption.CONNECT_TIMEOUT_MILLIS;
5150
import static io.netty.channel.ChannelOption.SO_KEEPALIVE;
5251
import static io.netty.channel.ChannelOption.SO_RCVBUF;
@@ -120,7 +119,7 @@ public HttpClient getHttpClient() {
120119
@Value.Default
121120
public ObjectMapper getObjectMapper() {
122121
ObjectMapper objectMapper = new ObjectMapper()
123-
.disable(FAIL_ON_UNKNOWN_PROPERTIES)
122+
.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
124123
.enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY)
125124
.registerModule(new Jdk8Module())
126125
.setSerializationInclusion(NON_NULL);

cloudfoundry-client-reactor/src/main/java/org/cloudfoundry/reactor/util/AnnotationUtils.java

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ public final class AnnotationUtils {
2525
private AnnotationUtils() {
2626
}
2727

28-
public static <T extends Annotation> Optional<T> findAnnotation(Method method, Class<T> type) {
28+
public static <T extends Annotation> Optional<T> findAnnotation(Method method, Class<T> annotationType) {
2929
Class<?> clazz = method.getDeclaringClass();
30-
T annotation = method.getAnnotation(type);
30+
T annotation = method.getAnnotation(annotationType);
3131

3232
while (annotation == null) {
3333
clazz = clazz.getSuperclass();
@@ -37,7 +37,7 @@ public static <T extends Annotation> Optional<T> findAnnotation(Method method, C
3737
}
3838

3939
try {
40-
annotation = clazz.getDeclaredMethod(method.getName(), method.getParameterTypes()).getAnnotation(type);
40+
annotation = clazz.getDeclaredMethod(method.getName(), method.getParameterTypes()).getAnnotation(annotationType);
4141
} catch (NoSuchMethodException e) {
4242
// No equivalent method found
4343
}
@@ -46,4 +46,21 @@ public static <T extends Annotation> Optional<T> findAnnotation(Method method, C
4646
return Optional.ofNullable(annotation);
4747
}
4848

49+
public static <T extends Annotation> Optional<T> findAnnotation(Class<?> type, Class<T> annotationType) {
50+
Class<?> clazz = type;
51+
T annotation = clazz.getAnnotation(annotationType);
52+
53+
while (annotation == null) {
54+
clazz = clazz.getSuperclass();
55+
56+
if (clazz == null || Object.class == clazz) {
57+
break;
58+
}
59+
60+
annotation = clazz.getAnnotation(annotationType);
61+
}
62+
63+
return Optional.ofNullable(annotation);
64+
}
65+
4966
}

cloudfoundry-client-reactor/src/main/java/org/cloudfoundry/reactor/util/JsonCodec.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
import com.fasterxml.jackson.core.JsonProcessingException;
2020
import com.fasterxml.jackson.databind.ObjectMapper;
21+
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
2122
import io.netty.handler.codec.http.HttpHeaderNames;
2223
import io.netty.handler.codec.http.HttpHeaderValues;
2324
import io.netty.handler.codec.json.JsonObjectDecoder;
@@ -53,7 +54,7 @@ public static <T> Function<Mono<HttpClientResponse>, Flux<T>> decode(ObjectMappe
5354
}
5455

5556
static Function<Mono<HttpClientRequest>, Publisher<Void>> encode(ObjectMapper objectMapper, Object requestPayload) {
56-
if (!objectMapper.canSerialize(requestPayload.getClass())) {
57+
if (!AnnotationUtils.findAnnotation(requestPayload.getClass(), JsonSerialize.class).isPresent()) {
5758
return outbound -> outbound
5859
.then(HttpClientRequest::send);
5960
}

cloudfoundry-client-reactor/src/test/java/org/cloudfoundry/reactor/client/v2/securitygroups/ReactorSecurityGroupsTest.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ public void associateSpace() {
100100
.build())
101101
.entity(SecurityGroupEntity.builder()
102102
.name("dummy1")
103-
.rule()
103+
.rules()
104104
.runningDefault(false)
105105
.stagingDefault(false)
106106
.spacesUrl("/v2/security_groups/1452e164-0c3e-4a6c-b3c3-c40ad9fd0159/spaces")
@@ -306,7 +306,7 @@ public void get() {
306306
.build())
307307
.entity(SecurityGroupEntity.builder()
308308
.name("dummy1")
309-
.rule()
309+
.rules()
310310
.runningDefault(false)
311311
.stagingDefault(false)
312312
.spacesUrl("/v2/security_groups/1452e164-0c3e-4a6c-b3c3-c40ad9fd0159/spaces")
@@ -344,7 +344,7 @@ public void list() {
344344
.build())
345345
.entity(SecurityGroupEntity.builder()
346346
.name("dummy1")
347-
.rule()
347+
.rules()
348348
.runningDefault(false)
349349
.stagingDefault(false)
350350
.spacesUrl("/v2/security_groups/1452e164-0c3e-4a6c-b3c3-c40ad9fd0159/spaces")
@@ -358,7 +358,7 @@ public void list() {
358358
.build())
359359
.entity(SecurityGroupEntity.builder()
360360
.name("dummy2")
361-
.rule()
361+
.rules()
362362
.runningDefault(false)
363363
.stagingDefault(false)
364364
.spacesUrl("/v2/security_groups/61a3df25-f372-4554-9b77-811aaa5374c1/spaces")
@@ -671,7 +671,7 @@ public void update() {
671671
this.securityGroups
672672
.update(UpdateSecurityGroupRequest.builder()
673673
.name("new_name")
674-
.rule()
674+
.rules()
675675
.securityGroupId("1452e164-0c3e-4a6c-b3c3-c40ad9fd0159")
676676
.build())
677677
.as(StepVerifier::create)
@@ -684,7 +684,7 @@ public void update() {
684684
.build())
685685
.entity(SecurityGroupEntity.builder()
686686
.name("new_name")
687-
.rule()
687+
.rules()
688688
.runningDefault(false)
689689
.stagingDefault(false)
690690
.spacesUrl("/v2/security_groups/1452e164-0c3e-4a6c-b3c3-c40ad9fd0159/spaces")

cloudfoundry-client-reactor/src/test/java/org/cloudfoundry/reactor/client/v3/applications/ReactorApplicationsV3Test.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -794,7 +794,6 @@ public void listDroplets() {
794794
.processType("redacted_message", "[PRIVATE DATA HIDDEN IN LISTS]")
795795
.image("cloudfoundry/diego-docker-app-custom:latest")
796796
.checksum(null)
797-
.buildpacks(null)
798797
.stack(null)
799798
.createdAt("2016-03-17T00:00:01Z")
800799
.updatedAt("2016-03-17T21:41:32Z")

cloudfoundry-client-reactor/src/test/java/org/cloudfoundry/reactor/client/v3/droplets/ReactorDropletsTest.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@ public void copy() {
9494
.executionMetadata("")
9595
.processTypes(null)
9696
.checksum(null)
97-
.buildpacks(null)
9897
.stack(null)
9998
.image(null)
10099
.createdAt("2016-03-28T23:39:34Z")
@@ -275,7 +274,6 @@ public void list() {
275274
.processType("redacted_message", "[PRIVATE DATA HIDDEN IN LISTS]")
276275
.image("cloudfoundry/diego-docker-app-custom:latest")
277276
.checksum(null)
278-
.buildpacks(null)
279277
.stack(null)
280278
.createdAt("2016-03-17T00:00:01Z")
281279
.updatedAt("2016-03-17T21:41:32Z")

cloudfoundry-client-reactor/src/test/java/org/cloudfoundry/reactor/client/v3/packages/ReactorPackagesTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,6 @@ public void listDroplets() {
438438
.processType("redacted_message", "[PRIVATE DATA HIDDEN IN LISTS]")
439439
.image("cloudfoundry/diego-docker-app-custom:latest")
440440
.checksum(null)
441-
.buildpacks(null)
442441
.stack(null)
443442
.createdAt("2016-03-17T00:00:01Z")
444443
.updatedAt("2016-03-17T21:41:32Z")

cloudfoundry-client-reactor/src/test/java/org/cloudfoundry/reactor/uaa/authorizations/ReactorAuthorizationsTest.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -261,20 +261,20 @@ public void getOpenIdProviderConfigurationRequest() {
261261
.as(StepVerifier::create)
262262
.expectNext(GetOpenIdProviderConfigurationResponse.builder()
263263
.authorizationEndpoint("http://localhost/oauth/authorize")
264-
.supportedClaim("sub", "user_name", "origin", "iss", "auth_time", "amr", "acr", "client_id", "aud", "zid", "grant_type", "user_id", "azp", "scope", "exp", "iat", "jti", "rev_sig",
264+
.supportedClaims("sub", "user_name", "origin", "iss", "auth_time", "amr", "acr", "client_id", "aud", "zid", "grant_type", "user_id", "azp", "scope", "exp", "iat", "jti", "rev_sig",
265265
"cid", "given_name", "family_name", "phone_number", "email")
266266
.claimsParameterSupported(false)
267267
.supportedClaimType("normal")
268268
.issuer("http://localhost:8080/uaa/oauth/token")
269269
.javaWebKeySetEndpoint("http://localhost/token_keys")
270270
.serviceDocumentation("http://docs.cloudfoundry.org/api/uaa/")
271271
.supportedIdTokenEncryptionAlgorithm("none")
272-
.supportedIdTokenSigningAlgorithm("RS256", "HS256")
272+
.supportedIdTokenSigningAlgorithms("RS256", "HS256")
273273
.supportedSubjectType("public")
274-
.supportedResponseType("code", "code id_token", "id_token", "token id_token")
275-
.supportedScope("openid", "profile", "email", "phone", "roles", "user_attributes")
276-
.supportedTokenEndpointAuthorizationMethod("client_secret_basic", "client_secret_post")
277-
.supportedTokenEndpointAuthorizationSigningAlgorithm("RS256", "HS256")
274+
.supportedResponseTypes("code", "code id_token", "id_token", "token id_token")
275+
.supportedScopes("openid", "profile", "email", "phone", "roles", "user_attributes")
276+
.supportedTokenEndpointAuthorizationMethods("client_secret_basic", "client_secret_post")
277+
.supportedTokenEndpointAuthorizationSigningAlgorithms("RS256", "HS256")
278278
.supportedUiLocale(Locale.US)
279279
.tokenEndpoint("http://localhost/oauth/token")
280280
.userInfoEndpoint("http://localhost/userinfo")

0 commit comments

Comments
 (0)