Updates to*Case() to use Locale.ROOT
This commit is contained in:
committed by
Oleg Zhurakousky
parent
b65577d515
commit
900d03f816
@@ -16,6 +16,7 @@
|
||||
|
||||
package org.springframework.cloud.function.rsocket;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.function.Function;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -117,22 +118,22 @@ public class MessageRoutingCallbackRSocketTests {
|
||||
|
||||
@Bean
|
||||
public Function<String, String> uppercase() {
|
||||
return v -> v.toUpperCase();
|
||||
return v -> v.toUpperCase(Locale.ROOT);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Function<Message<String>, Message<String>> uppercaseMessage() {
|
||||
return m -> MessageBuilder.withPayload(m.getPayload().toUpperCase()).copyHeaders(m.getHeaders()).build();
|
||||
return m -> MessageBuilder.withPayload(m.getPayload().toUpperCase(Locale.ROOT)).copyHeaders(m.getHeaders()).build();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Function<Flux<String>, Flux<String>> uppercaseReactive() {
|
||||
return flux -> flux.map(v -> v.toUpperCase());
|
||||
return flux -> flux.map(v -> v.toUpperCase(Locale.ROOT));
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Function<Flux<Message<String>>, Flux<Message<String>>> uppercaseReactiveMessage() {
|
||||
return flux -> flux.map(m -> MessageBuilder.withPayload(m.getPayload().toUpperCase()).copyHeaders(m.getHeaders()).build());
|
||||
return flux -> flux.map(m -> MessageBuilder.withPayload(m.getPayload().toUpperCase(Locale.ROOT)).copyHeaders(m.getHeaders()).build());
|
||||
}
|
||||
|
||||
@Bean
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package org.springframework.cloud.function.rsocket;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
|
||||
@@ -155,7 +156,7 @@ public class MessagingTests {
|
||||
Message<Person> message = MessageBuilder.withPayload(p).setHeader("someHeader", "foo").build();
|
||||
|
||||
Person result = new Person();
|
||||
result.setName(p.getName().toUpperCase());
|
||||
result.setName(p.getName().toUpperCase(Locale.ROOT));
|
||||
rsocketRequesterBuilder.tcp("localhost", port)
|
||||
.route("pojoMessageToPojo")
|
||||
.data(message)
|
||||
@@ -190,7 +191,7 @@ public class MessagingTests {
|
||||
Map map = jsonMapper.fromJson(message, Map.class);
|
||||
|
||||
Person result = new Person();
|
||||
result.setName(p.getName().toUpperCase());
|
||||
result.setName(p.getName().toUpperCase(Locale.ROOT));
|
||||
rsocketRequesterBuilder.tcp("localhost", port)
|
||||
.route("pojoMessageToPojo")
|
||||
.data(map)
|
||||
@@ -330,7 +331,7 @@ public class MessagingTests {
|
||||
@Bean
|
||||
public Function<Person, String> pojoToString() {
|
||||
return v -> {
|
||||
return v.getName().toUpperCase();
|
||||
return v.getName().toUpperCase(Locale.ROOT);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -355,7 +356,7 @@ public class MessagingTests {
|
||||
return p -> {
|
||||
assertThat(p.getHeaders().get("someHeader").equals("foo"));
|
||||
Person newPerson = new Person();
|
||||
newPerson.setName(p.getPayload().getName().toUpperCase());
|
||||
newPerson.setName(p.getPayload().getName().toUpperCase(Locale.ROOT));
|
||||
return newPerson;
|
||||
};
|
||||
}
|
||||
@@ -365,7 +366,7 @@ public class MessagingTests {
|
||||
return p -> {
|
||||
assertThat(p.getHeaders().get("someHeader").equals("foo"));
|
||||
Person newPerson = new Person();
|
||||
newPerson.setName(p.getPayload().getName().toUpperCase());
|
||||
newPerson.setName(p.getPayload().getName().toUpperCase(Locale.ROOT));
|
||||
return MessageBuilder.withPayload(newPerson).copyHeaders(p.getHeaders()).setHeader("xyz", "hello").build();
|
||||
};
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package org.springframework.cloud.function.rsocket;
|
||||
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
@@ -183,7 +184,7 @@ public class RSocketAutoConfigurationRoutingTests {
|
||||
|
||||
@Bean
|
||||
public Function<String, String> uppercase() {
|
||||
return v -> v.toUpperCase();
|
||||
return v -> v.toUpperCase(Locale.ROOT);
|
||||
}
|
||||
|
||||
@Bean
|
||||
@@ -193,7 +194,7 @@ public class RSocketAutoConfigurationRoutingTests {
|
||||
.get(DestinationPatternsMessageCondition.LOOKUP_DESTINATION_HEADER)).toString().equals("uppercase");
|
||||
assertThat(msg.getHeaders()
|
||||
.get(FunctionRSocketMessageHandler.RECONCILED_LOOKUP_DESTINATION_HEADER)).toString().equals(RoutingFunction.FUNCTION_NAME);
|
||||
return msg.getPayload().toUpperCase();
|
||||
return msg.getPayload().toUpperCase(Locale.ROOT);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -211,7 +212,7 @@ public class RSocketAutoConfigurationRoutingTests {
|
||||
public Function<Flux<String>, Flux<String>> uppercaseReactive() {
|
||||
return flux -> flux.map(v -> {
|
||||
System.out.println("Uppercasing: " + v);
|
||||
return v.toUpperCase();
|
||||
return v.toUpperCase(Locale.ROOT);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package org.springframework.cloud.function.rsocket;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Function;
|
||||
@@ -644,7 +645,7 @@ public class RSocketAutoConfigurationTests {
|
||||
|
||||
@Bean
|
||||
public Function<String, String> uppercase() {
|
||||
return v -> v.toUpperCase();
|
||||
return v -> v.toUpperCase(Locale.ROOT);
|
||||
}
|
||||
|
||||
@Bean
|
||||
@@ -667,7 +668,7 @@ public class RSocketAutoConfigurationTests {
|
||||
public Function<Flux<String>, Flux<String>> uppercaseReactive() {
|
||||
return flux -> flux.map(v -> {
|
||||
System.out.println("Uppercasing: " + v);
|
||||
return v.toUpperCase();
|
||||
return v.toUpperCase(Locale.ROOT);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package org.springframework.cloud.function.rsocket;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.util.Locale;
|
||||
import java.util.function.Function;
|
||||
|
||||
import io.rsocket.broker.client.spring.BrokerMetadata;
|
||||
@@ -139,7 +140,7 @@ public class RoutingBrokerTests {
|
||||
public static class SampleFunctionConfiguration {
|
||||
@Bean
|
||||
public Function<String, String> uppercase() {
|
||||
return v -> v.toUpperCase();
|
||||
return v -> v.toUpperCase(Locale.ROOT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user