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.adapter.aws;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.function.Function;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -219,7 +220,7 @@ public class CustomRuntimeEventLoopTest {
|
||||
protected static class SingleFunctionConfiguration {
|
||||
@Bean
|
||||
public Function<String, String> uppercase() {
|
||||
return v -> v.toUpperCase();
|
||||
return v -> v.toUpperCase(Locale.ROOT);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -236,7 +237,7 @@ public class CustomRuntimeEventLoopTest {
|
||||
protected static class MultipleFunctionConfiguration {
|
||||
@Bean
|
||||
public Function<String, String> uppercase() {
|
||||
return v -> v.toUpperCase();
|
||||
return v -> v.toUpperCase(Locale.ROOT);
|
||||
}
|
||||
|
||||
@Bean
|
||||
@@ -246,7 +247,7 @@ public class CustomRuntimeEventLoopTest {
|
||||
|
||||
@Bean
|
||||
public Function<Person, Person> uppercasePerson() {
|
||||
return p -> new Person(p.getName().toUpperCase());
|
||||
return p -> new Person(p.getName().toUpperCase(Locale.ROOT));
|
||||
}
|
||||
|
||||
@Bean
|
||||
@@ -267,7 +268,7 @@ public class CustomRuntimeEventLoopTest {
|
||||
|
||||
@Override
|
||||
public Person apply(Person input) {
|
||||
return new Person(input.getName().toUpperCase());
|
||||
return new Person(input.getName().toUpperCase(Locale.ROOT));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ import java.nio.charset.StandardCharsets;
|
||||
import java.util.Base64;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Function;
|
||||
@@ -1492,7 +1493,7 @@ public class FunctionInvokerTests {
|
||||
@Bean
|
||||
public Function<Message<String>, Message<String>> uppercase() {
|
||||
return v -> {
|
||||
return MessageBuilder.withPayload(v.getPayload().toUpperCase()).build();
|
||||
return MessageBuilder.withPayload(v.getPayload().toUpperCase(Locale.ROOT)).build();
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -1525,7 +1526,7 @@ public class FunctionInvokerTests {
|
||||
|
||||
@Bean
|
||||
public Function<String, String> uppercase() {
|
||||
return v -> v.toUpperCase();
|
||||
return v -> v.toUpperCase(Locale.ROOT);
|
||||
}
|
||||
|
||||
@Bean
|
||||
@@ -1784,7 +1785,7 @@ public class FunctionInvokerTests {
|
||||
|
||||
@Bean
|
||||
public Function<String, String> uppercase() {
|
||||
return v -> v.toUpperCase();
|
||||
return v -> v.toUpperCase(Locale.ROOT);
|
||||
}
|
||||
|
||||
@Bean
|
||||
@@ -1795,7 +1796,7 @@ public class FunctionInvokerTests {
|
||||
@Bean
|
||||
public Function<Person, String> uppercasePojo() {
|
||||
return v -> {
|
||||
return v.getName().toUpperCase();
|
||||
return v.getName().toUpperCase(Locale.ROOT);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1803,7 +1804,7 @@ public class FunctionInvokerTests {
|
||||
public Function<Person, Person> uppercasePojoReturnPojo() {
|
||||
return v -> {
|
||||
Person p = new Person();
|
||||
p.setName(v.getName().toUpperCase());
|
||||
p.setName(v.getName().toUpperCase(Locale.ROOT));
|
||||
return p;
|
||||
};
|
||||
}
|
||||
@@ -1812,7 +1813,7 @@ public class FunctionInvokerTests {
|
||||
public Function<Flux<Person>, Flux<Person>> uppercasePojoReturnPojoReactive() {
|
||||
return flux -> flux.map(v -> {
|
||||
Person p = new Person();
|
||||
p.setName(v.getName().toUpperCase());
|
||||
p.setName(v.getName().toUpperCase(Locale.ROOT));
|
||||
return p;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ package org.springframework.cloud.function.adapter.azure;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -184,7 +185,7 @@ class CustomFunctionInvokerTests {
|
||||
|
||||
@Bean
|
||||
public Function<String, String> imperativeUppercase() {
|
||||
return (s) -> s.toUpperCase();
|
||||
return (s) -> s.toUpperCase(Locale.ROOT);
|
||||
}
|
||||
|
||||
@Bean
|
||||
|
||||
@@ -19,6 +19,7 @@ package org.springframework.cloud.function.adapter.azure;
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
@@ -195,7 +196,7 @@ public class FunctionInvokerTests {
|
||||
|
||||
@Bean
|
||||
public Function<Mono<String>, Mono<String>> uppercaseMono() {
|
||||
return f -> f.map(v -> v.toUpperCase());
|
||||
return f -> f.map(v -> v.toUpperCase(Locale.ROOT));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -241,7 +242,7 @@ public class FunctionInvokerTests {
|
||||
|
||||
@Bean("uppercase")
|
||||
public Function<Flux<Foo>, Flux<Bar>> function() {
|
||||
return foos -> foos.map(foo -> new Bar(foo.getValue().toUpperCase()));
|
||||
return foos -> foos.map(foo -> new Bar(foo.getValue().toUpperCase(Locale.ROOT)));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -256,7 +257,7 @@ public class FunctionInvokerTests {
|
||||
Foo foo = message.getPayload();
|
||||
ExecutionContext targetContext = (ExecutionContext) message.getHeaders().get("executionContext");
|
||||
targetContext.getLogger().info("Invoking 'uppercase' on " + foo.getValue());
|
||||
return new Bar(foo.getValue().toUpperCase());
|
||||
return new Bar(foo.getValue().toUpperCase(Locale.ROOT));
|
||||
};
|
||||
}
|
||||
|
||||
@@ -269,7 +270,7 @@ public class FunctionInvokerTests {
|
||||
@Bean
|
||||
public Function<List<Foo>, List<Bar>> uppercase() {
|
||||
return foos -> {
|
||||
List<Bar> bars = foos.stream().map(foo -> new Bar(foo.getValue().toUpperCase()))
|
||||
List<Bar> bars = foos.stream().map(foo -> new Bar(foo.getValue().toUpperCase(Locale.ROOT)))
|
||||
.collect(Collectors.toList());
|
||||
return bars;
|
||||
};
|
||||
@@ -283,7 +284,7 @@ public class FunctionInvokerTests {
|
||||
|
||||
@Bean
|
||||
public Function<List<Foo>, Bar> uppercase() {
|
||||
return foos -> new Bar(foos.stream().map(foo -> foo.getValue().toUpperCase())
|
||||
return foos -> new Bar(foos.stream().map(foo -> foo.getValue().toUpperCase(Locale.ROOT))
|
||||
.collect(Collectors.joining(",")));
|
||||
}
|
||||
|
||||
@@ -300,7 +301,7 @@ public class FunctionInvokerTests {
|
||||
ExecutionContext context = (ExecutionContext) message.getHeaders().get("executionContext");
|
||||
Foo foo = message.getPayload();
|
||||
context.getLogger().info("Executing uppercase function");
|
||||
return new Bar(foo.getValue().toUpperCase());
|
||||
return new Bar(foo.getValue().toUpperCase(Locale.ROOT));
|
||||
};
|
||||
}
|
||||
|
||||
@@ -310,7 +311,7 @@ public class FunctionInvokerTests {
|
||||
ExecutionContext context = (ExecutionContext) message.getHeaders().get("executionContext");
|
||||
Bar bar = message.getPayload();
|
||||
context.getLogger().info("Executing lowercase function");
|
||||
return new Foo(bar.getValue().toLowerCase());
|
||||
return new Foo(bar.getValue().toLowerCase(Locale.ROOT));
|
||||
};
|
||||
}
|
||||
|
||||
@@ -330,11 +331,11 @@ class Foo {
|
||||
}
|
||||
|
||||
public String lowercase() {
|
||||
return this.value.toLowerCase();
|
||||
return this.value.toLowerCase(Locale.ROOT);
|
||||
}
|
||||
|
||||
public String uppercase() {
|
||||
return this.value.toUpperCase();
|
||||
return this.value.toUpperCase(Locale.ROOT);
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
|
||||
@@ -21,6 +21,7 @@ import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Function;
|
||||
@@ -122,7 +123,7 @@ public class HttpFunctionInvokerTests {
|
||||
return (foo -> {
|
||||
Map<String, Object> headers = new HashMap<>();
|
||||
return new GenericMessage<>(
|
||||
new Bar(foo.getPayload().getValue().toUpperCase()), headers);
|
||||
new Bar(foo.getPayload().getValue().toUpperCase(Locale.ROOT)), headers);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package org.springframework.cloud.function.adapter.azure.injector;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.Optional;
|
||||
import java.util.function.Function;
|
||||
|
||||
@@ -106,7 +107,7 @@ public class AzureFunctionInstanceInjectorTest {
|
||||
Assertions.assertThat(context).isNotNull();
|
||||
Assertions.assertThat(context.getFunctionName()).isEqualTo("hello");
|
||||
|
||||
return message.getPayload().toUpperCase();
|
||||
return message.getPayload().toUpperCase(Locale.ROOT);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package org.springframework.cloud.function.adapter.azure.injector;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.Locale;
|
||||
import java.util.Optional;
|
||||
import java.util.ServiceLoader;
|
||||
import java.util.function.Function;
|
||||
@@ -108,7 +109,7 @@ public class FunctionInstanceInjectorServiceLoadingTest {
|
||||
.get(AzureFunctionUtil.EXECUTION_CONTEXT);
|
||||
Assertions.assertThat(context).isNotNull();
|
||||
Assertions.assertThat(context.getFunctionName()).isEqualTo("hello");
|
||||
return message.getPayload().toUpperCase();
|
||||
return message.getPayload().toUpperCase(Locale.ROOT);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package org.springframework.cloud.function.adapter.gcp.integration;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Locale;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
@@ -98,7 +99,7 @@ public class FunctionInvokerIntegrationTests {
|
||||
|
||||
@Bean
|
||||
Function<String, String> uppercase() {
|
||||
return input -> input.toUpperCase();
|
||||
return input -> input.toUpperCase(Locale.ROOT);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -109,7 +110,7 @@ public class FunctionInvokerIntegrationTests {
|
||||
|
||||
@Bean
|
||||
Function<String, String> uppercase() {
|
||||
return input -> input.toUpperCase();
|
||||
return input -> input.toUpperCase(Locale.ROOT);
|
||||
}
|
||||
|
||||
@Bean
|
||||
|
||||
@@ -19,6 +19,7 @@ package org.springframework.cloud.function.grpc;
|
||||
import java.time.Duration;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Random;
|
||||
import java.util.function.Function;
|
||||
|
||||
@@ -323,17 +324,17 @@ public class GrpcInteractionTests {
|
||||
|
||||
@Bean
|
||||
public Function<String, String> uppercase() {
|
||||
return v -> v.toUpperCase();
|
||||
return v -> v.toUpperCase(Locale.ROOT);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Function<String, Mono<String>> uppercaseMonoReturn() {
|
||||
return v -> Mono.just(v.toUpperCase());
|
||||
return v -> Mono.just(v.toUpperCase(Locale.ROOT));
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Function<String, Flux<String>> uppercaseFluxReturn() {
|
||||
return v -> Flux.just(v.toUpperCase(), v.toUpperCase() + "-1", v.toUpperCase() + "-2");
|
||||
return v -> Flux.just(v.toUpperCase(Locale.ROOT), v.toUpperCase(Locale.ROOT) + "-1", v.toUpperCase(Locale.ROOT) + "-2");
|
||||
}
|
||||
|
||||
@Bean
|
||||
@@ -343,7 +344,7 @@ public class GrpcInteractionTests {
|
||||
|
||||
@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
|
||||
@@ -360,7 +361,7 @@ public class GrpcInteractionTests {
|
||||
|
||||
@Bean
|
||||
public Function<String, Flux<String>> stringInStreamOut() {
|
||||
return value -> Flux.just(value, value.toUpperCase());
|
||||
return value -> Flux.just(value, value.toUpperCase(Locale.ROOT));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ import java.io.IOException;
|
||||
import java.io.PrintStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
@@ -157,7 +158,7 @@ public class ServerlessWebApplication extends SpringApplication {
|
||||
ResourceLoader resourceLoader = (this.getResourceLoader() != null) ? this.getResourceLoader()
|
||||
: new DefaultResourceLoader(null);
|
||||
Banner.Mode bannerMode = environment.containsProperty("spring.main.banner-mode")
|
||||
? Banner.Mode.valueOf(environment.getProperty("spring.main.banner-mode").trim().toUpperCase())
|
||||
? Banner.Mode.valueOf(environment.getProperty("spring.main.banner-mode").trim().toUpperCase(Locale.ROOT))
|
||||
: Banner.Mode.CONSOLE;
|
||||
|
||||
if (bannerMode == Banner.Mode.OFF) {
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package org.springframework.cloud.function.actuator;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.TreeMap;
|
||||
@@ -72,10 +73,10 @@ public class FunctionsEndpoint {
|
||||
|
||||
|
||||
private String toSimplePolyOut(FunctionInvocationWrapper function) {
|
||||
return FunctionTypeUtils.getRawType(function.getItemType(function.getOutputType())).getSimpleName().toLowerCase();
|
||||
return FunctionTypeUtils.getRawType(function.getItemType(function.getOutputType())).getSimpleName().toLowerCase(Locale.ROOT);
|
||||
}
|
||||
|
||||
private String toSimplePolyIn(FunctionInvocationWrapper function) {
|
||||
return FunctionTypeUtils.getRawType(function.getItemType(function.getInputType())).getSimpleName().toLowerCase();
|
||||
return FunctionTypeUtils.getRawType(function.getItemType(function.getInputType())).getSimpleName().toLowerCase(Locale.ROOT);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
@@ -908,7 +909,7 @@ public class SimpleFunctionRegistry implements FunctionRegistry {
|
||||
if (contentType == null) {
|
||||
contentType = msg.getHeaders().get(HttpHeaders.CONTENT_TYPE);
|
||||
if (contentType == null) {
|
||||
contentType = msg.getHeaders().get(HttpHeaders.CONTENT_TYPE.toLowerCase());
|
||||
contentType = msg.getHeaders().get(HttpHeaders.CONTENT_TYPE.toLowerCase(Locale.ROOT));
|
||||
}
|
||||
}
|
||||
return Objects.toString(contentType);
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
|
||||
package org.springframework.cloud.function.utils;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import org.springframework.cloud.function.context.message.MessageUtils;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.MessageHeaders;
|
||||
@@ -59,7 +61,7 @@ public final class FunctionMessageUtils {
|
||||
else if (key.startsWith("solace_")) {
|
||||
return "solace";
|
||||
}
|
||||
else if (key.toLowerCase().equals("user-agent") || key.toLowerCase().equals("accept-encoding") || key.toLowerCase().equals("host")) {
|
||||
else if (key.toLowerCase(Locale.ROOT).equals("user-agent") || key.toLowerCase(Locale.ROOT).equals("accept-encoding") || key.toLowerCase(Locale.ROOT).equals("host")) {
|
||||
return "http";
|
||||
}
|
||||
// add rsocket
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package org.springframework.cloud.function.context;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.function.Function;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -90,7 +91,7 @@ public class HybridFunctionalRegistrationTests {
|
||||
|
||||
@Override
|
||||
public String apply(String t) {
|
||||
return t.toUpperCase();
|
||||
return t.toUpperCase(Locale.ROOT);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,7 +106,7 @@ public class HybridFunctionalRegistrationTests {
|
||||
public String apply(Message<String> message) {
|
||||
assertThat(message.getHeaders().get("foo")).isEqualTo("foo");
|
||||
assertThat(message.getHeaders().get("blah")).isEqualTo("blah");
|
||||
return message.getPayload().toUpperCase();
|
||||
return message.getPayload().toUpperCase(Locale.ROOT);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -118,7 +119,7 @@ public class HybridFunctionalRegistrationTests {
|
||||
|
||||
@Override
|
||||
public Flux<String> apply(Flux<String> flux) {
|
||||
return flux.map(v -> v.toUpperCase());
|
||||
return flux.map(v -> v.toUpperCase(Locale.ROOT));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ import java.nio.ByteBuffer;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.function.BiFunction;
|
||||
import java.util.function.Function;
|
||||
|
||||
@@ -303,7 +304,7 @@ public class BeanFactoryAwareFunctionRegistryMultiInOutTests {
|
||||
|
||||
@Bean
|
||||
public Function<String, String> uppercase() {
|
||||
return v -> v.toUpperCase();
|
||||
return v -> v.toUpperCase(Locale.ROOT);
|
||||
}
|
||||
|
||||
// ============= MULTI-INPUT and MULTI-OUTPUT functions ============
|
||||
|
||||
@@ -27,6 +27,7 @@ import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
@@ -916,7 +917,7 @@ public class BeanFactoryAwareFunctionRegistryTests {
|
||||
|
||||
@Bean
|
||||
public Function<String, String> uppercase() {
|
||||
return v -> v.toUpperCase();
|
||||
return v -> v.toUpperCase(Locale.ROOT);
|
||||
}
|
||||
|
||||
@Bean
|
||||
@@ -931,7 +932,7 @@ public class BeanFactoryAwareFunctionRegistryTests {
|
||||
|
||||
@Bean
|
||||
public Function<Message<Person>, String> uppercasePerson() {
|
||||
return v -> v.getPayload().getName().toUpperCase();
|
||||
return v -> v.getPayload().getName().toUpperCase(Locale.ROOT);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1121,7 +1122,7 @@ public class BeanFactoryAwareFunctionRegistryTests {
|
||||
protected static class WrappedWithAroundAdviseConfiguration {
|
||||
@Bean
|
||||
public Function<Message<String>, Message<String>> uppercase() {
|
||||
return v -> MessageBuilder.withPayload(v.getPayload().toUpperCase()).copyHeaders(v.getHeaders()).build();
|
||||
return v -> MessageBuilder.withPayload(v.getPayload().toUpperCase(Locale.ROOT)).copyHeaders(v.getHeaders()).build();
|
||||
}
|
||||
|
||||
@Bean
|
||||
@@ -1148,7 +1149,7 @@ public class BeanFactoryAwareFunctionRegistryTests {
|
||||
|
||||
@Bean
|
||||
public Function<String, String> uppercase() {
|
||||
return x -> x.toUpperCase();
|
||||
return x -> x.toUpperCase(Locale.ROOT);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1166,7 +1167,7 @@ public class BeanFactoryAwareFunctionRegistryTests {
|
||||
@Bean
|
||||
public Function<Person, Person> uppercasePerson() {
|
||||
return person -> {
|
||||
return new Person(person.getName().toUpperCase(), person.getId());
|
||||
return new Person(person.getName().toUpperCase(Locale.ROOT), person.getId());
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1178,7 +1179,7 @@ public class BeanFactoryAwareFunctionRegistryTests {
|
||||
@Bean
|
||||
public BiFunction<String, Map, String> biFuncUpperCase() {
|
||||
return (p, h) -> {
|
||||
return p.toUpperCase();
|
||||
return p.toUpperCase(Locale.ROOT);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1192,7 +1193,7 @@ public class BeanFactoryAwareFunctionRegistryTests {
|
||||
|
||||
@Bean
|
||||
public Function<String, String> uppercase() {
|
||||
return v -> v.toUpperCase();
|
||||
return v -> v.toUpperCase(Locale.ROOT);
|
||||
}
|
||||
|
||||
@Bean
|
||||
@@ -1214,7 +1215,7 @@ public class BeanFactoryAwareFunctionRegistryTests {
|
||||
|
||||
@Bean
|
||||
public Function<Flux<String>, Flux<String>> uppercaseFlux() {
|
||||
return flux -> flux.map(v -> v.toUpperCase());
|
||||
return flux -> flux.map(v -> v.toUpperCase(Locale.ROOT));
|
||||
}
|
||||
|
||||
@Bean
|
||||
@@ -1499,7 +1500,7 @@ public class BeanFactoryAwareFunctionRegistryTests {
|
||||
public static class ComplexTypeFunctionConfiguration {
|
||||
@Bean
|
||||
public Function<Event<String, Product>, String> function() {
|
||||
return v -> v.getData().getName().toUpperCase();
|
||||
return v -> v.getData().getName().toUpperCase(Locale.ROOT);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1578,12 +1579,12 @@ public class BeanFactoryAwareFunctionRegistryTests {
|
||||
|
||||
@Bean
|
||||
public Function<Flux<String>, Flux<String>> functionPrimitive() {
|
||||
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>>> functionMessage() {
|
||||
return flux -> flux.map(v -> MessageBuilder.withPayload(v.getPayload().toUpperCase()).build());
|
||||
return flux -> flux.map(v -> MessageBuilder.withPayload(v.getPayload().toUpperCase(Locale.ROOT)).build());
|
||||
}
|
||||
|
||||
@Bean
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package org.springframework.cloud.function.context.catalog;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.function.Function;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -123,7 +124,7 @@ public class BeanFactoryAwarePojoFunctionRegistryTests {
|
||||
// POJO Function that implements Function
|
||||
private static class MyFunction implements Function<String, String> {
|
||||
public String uppercase(String value) {
|
||||
return value.toUpperCase();
|
||||
return value.toUpperCase(Locale.ROOT);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -135,7 +136,7 @@ public class BeanFactoryAwarePojoFunctionRegistryTests {
|
||||
// POJO Function
|
||||
public static class MyFunctionLike {
|
||||
public String uppercase(String value) {
|
||||
return value.toUpperCase();
|
||||
return value.toUpperCase(Locale.ROOT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.UUID;
|
||||
@@ -665,7 +666,7 @@ public class SimpleFunctionRegistryTests {
|
||||
}
|
||||
|
||||
public Function<String, String> uppercase() {
|
||||
return v -> v.toUpperCase();
|
||||
return v -> v.toUpperCase(Locale.ROOT);
|
||||
}
|
||||
|
||||
|
||||
@@ -779,7 +780,7 @@ public class SimpleFunctionRegistryTests {
|
||||
|
||||
@Override
|
||||
public String apply(String t) {
|
||||
return t.toUpperCase();
|
||||
return t.toUpperCase(Locale.ROOT);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -798,7 +799,7 @@ public class SimpleFunctionRegistryTests {
|
||||
|
||||
@Override
|
||||
public Message<String> apply(Message<String> t) {
|
||||
return MessageBuilder.withPayload(t.getPayload().toUpperCase())
|
||||
return MessageBuilder.withPayload(t.getPayload().toUpperCase(Locale.ROOT))
|
||||
.copyHeaders(t.getHeaders()).build();
|
||||
}
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ import java.net.URLClassLoader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Function;
|
||||
@@ -476,7 +477,7 @@ public class ContextFunctionCatalogAutoConfigurationTests {
|
||||
|
||||
@Bean
|
||||
public Function<String, String> function() {
|
||||
return value -> value.toUpperCase();
|
||||
return value -> value.toUpperCase(Locale.ROOT);
|
||||
}
|
||||
|
||||
@Bean
|
||||
@@ -543,7 +544,7 @@ public class ContextFunctionCatalogAutoConfigurationTests {
|
||||
|
||||
@Bean
|
||||
public Function<String, Foo> foos(String foo) {
|
||||
return value -> new Foo(foo + ": " + value.toUpperCase());
|
||||
return value -> new Foo(foo + ": " + value.toUpperCase(Locale.ROOT));
|
||||
}
|
||||
|
||||
@Bean
|
||||
@@ -560,7 +561,7 @@ public class ContextFunctionCatalogAutoConfigurationTests {
|
||||
|
||||
@Override
|
||||
public Flux<Foo> apply(Flux<String> flux) {
|
||||
return flux.map(foo -> new Foo(value() + ": " + foo.toUpperCase()));
|
||||
return flux.map(foo -> new Foo(value() + ": " + foo.toUpperCase(Locale.ROOT)));
|
||||
}
|
||||
|
||||
@Bean
|
||||
@@ -588,7 +589,7 @@ public class ContextFunctionCatalogAutoConfigurationTests {
|
||||
|
||||
@Bean
|
||||
public Function<String, Foo> foos() {
|
||||
return value -> new Foo(value.toUpperCase());
|
||||
return value -> new Foo(value.toUpperCase(Locale.ROOT));
|
||||
}
|
||||
|
||||
@Bean
|
||||
@@ -605,7 +606,7 @@ public class ContextFunctionCatalogAutoConfigurationTests {
|
||||
|
||||
@Bean
|
||||
public Function<String, Foo> foos() {
|
||||
return value -> new Foo(value.toUpperCase());
|
||||
return value -> new Foo(value.toUpperCase(Locale.ROOT));
|
||||
}
|
||||
|
||||
@Bean
|
||||
@@ -632,7 +633,7 @@ public class ContextFunctionCatalogAutoConfigurationTests {
|
||||
@Bean
|
||||
public Function<Map<String, String>, Map<String, String>> function() {
|
||||
return m -> m.entrySet().stream().collect(Collectors.toMap(e -> e.getKey(),
|
||||
e -> e.getValue().toString().toUpperCase()));
|
||||
e -> e.getValue().toString().toUpperCase(Locale.ROOT)));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -726,7 +727,7 @@ public class ContextFunctionCatalogAutoConfigurationTests {
|
||||
@Bean
|
||||
public Function<Flux<Map<String, String>>, Flux<Map<String, String>>> function() {
|
||||
return flux -> flux.map(m -> m.entrySet().stream().collect(Collectors
|
||||
.toMap(e -> e.getKey(), e -> e.getValue().toString().toUpperCase())));
|
||||
.toMap(e -> e.getKey(), e -> e.getValue().toString().toUpperCase(Locale.ROOT))));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -738,7 +739,7 @@ public class ContextFunctionCatalogAutoConfigurationTests {
|
||||
@Bean
|
||||
public Function<Flux<Message<String>>, Flux<Message<String>>> function() {
|
||||
return flux -> flux.map(m -> MessageBuilder
|
||||
.withPayload(m.getPayload().toUpperCase()).build());
|
||||
.withPayload(m.getPayload().toUpperCase(Locale.ROOT)).build());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -750,7 +751,7 @@ public class ContextFunctionCatalogAutoConfigurationTests {
|
||||
@Bean
|
||||
public Function<Publisher<Message<String>>, Publisher<Message<String>>> function() {
|
||||
return flux -> Flux.from(flux).map(m -> MessageBuilder
|
||||
.withPayload(m.getPayload().toUpperCase()).build());
|
||||
.withPayload(m.getPayload().toUpperCase(Locale.ROOT)).build());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -784,7 +785,7 @@ public class ContextFunctionCatalogAutoConfigurationTests {
|
||||
|
||||
@Bean
|
||||
public Function<Message<String>, Message<String>> function() {
|
||||
return m -> MessageBuilder.withPayload(m.getPayload().toUpperCase()).build();
|
||||
return m -> MessageBuilder.withPayload(m.getPayload().toUpperCase(Locale.ROOT)).build();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -796,7 +797,7 @@ public class ContextFunctionCatalogAutoConfigurationTests {
|
||||
@Bean
|
||||
@Qualifier("other")
|
||||
public Function<String, String> function() {
|
||||
return value -> value.toUpperCase();
|
||||
return value -> value.toUpperCase(Locale.ROOT);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -807,7 +808,7 @@ public class ContextFunctionCatalogAutoConfigurationTests {
|
||||
|
||||
@Bean({ "function", "other" })
|
||||
public Function<String, String> function() {
|
||||
return value -> value.toUpperCase();
|
||||
return value -> value.toUpperCase(Locale.ROOT);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -824,7 +825,7 @@ public class ContextFunctionCatalogAutoConfigurationTests {
|
||||
|
||||
@Bean
|
||||
public Function<String, String> function() {
|
||||
return value -> value.toUpperCase();
|
||||
return value -> value.toUpperCase(Locale.ROOT);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -861,7 +862,7 @@ public class ContextFunctionCatalogAutoConfigurationTests {
|
||||
|
||||
@Override
|
||||
protected Function<String, String> createInstance() throws Exception {
|
||||
return s -> s.toUpperCase() + "-bar";
|
||||
return s -> s.toUpperCase(Locale.ROOT) + "-bar";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Function;
|
||||
@@ -235,7 +236,7 @@ public class ContextFunctionCatalogInitializerTests {
|
||||
|
||||
@Bean
|
||||
public Function<String, String> function() {
|
||||
return value -> value.toUpperCase();
|
||||
return value -> value.toUpperCase(Locale.ROOT);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -264,7 +265,7 @@ public class ContextFunctionCatalogInitializerTests {
|
||||
public Function<Person, Person> function() {
|
||||
return person -> {
|
||||
Person p = new Person();
|
||||
p.setName(person.getName().toUpperCase());
|
||||
p.setName(person.getName().toUpperCase(Locale.ROOT));
|
||||
return p;
|
||||
};
|
||||
}
|
||||
@@ -359,7 +360,7 @@ public class ContextFunctionCatalogInitializerTests {
|
||||
|
||||
@Bean
|
||||
public Function<String, Foo> foos(String foo) {
|
||||
return value -> new Foo(foo + ": " + value.toUpperCase());
|
||||
return value -> new Foo(foo + ": " + value.toUpperCase(Locale.ROOT));
|
||||
}
|
||||
|
||||
@Bean
|
||||
@@ -383,7 +384,7 @@ public class ContextFunctionCatalogInitializerTests {
|
||||
|
||||
@Override
|
||||
public Flux<Foo> apply(Flux<String> flux) {
|
||||
return flux.map(foo -> new Foo(value() + ": " + foo.toUpperCase()));
|
||||
return flux.map(foo -> new Foo(value() + ": " + foo.toUpperCase(Locale.ROOT)));
|
||||
}
|
||||
|
||||
@Bean
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package org.springframework.cloud.function.context.scan;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.function.Function;
|
||||
|
||||
/**
|
||||
@@ -26,7 +27,7 @@ public class TestFunction implements Function<String, String> {
|
||||
|
||||
@Override
|
||||
public String apply(String t) {
|
||||
return t.toUpperCase();
|
||||
return t.toUpperCase(Locale.ROOT);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package org.springframework.cloud.function.context.string;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.function.Function;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -52,7 +53,7 @@ public class FunctionalStringSourceTests {
|
||||
|
||||
@Override
|
||||
public String apply(String value) {
|
||||
return value.toUpperCase();
|
||||
return value.toUpperCase(Locale.ROOT);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package org.springframework.cloud.function.context.test;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.function.Function;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -49,7 +50,7 @@ public class FunctionalTests {
|
||||
|
||||
@Override
|
||||
public String apply(String value) {
|
||||
return value.toUpperCase();
|
||||
return value.toUpperCase(Locale.ROOT);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package org.springframework.cloud.function.inject;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.function.Function;
|
||||
|
||||
import org.springframework.cloud.function.context.config.ContextFunctionCatalogAutoConfigurationTests.Foo;
|
||||
@@ -27,7 +28,7 @@ public class FooConfiguration {
|
||||
|
||||
@Bean
|
||||
public Function<String, Foo> foos(String foo) {
|
||||
return value -> new Foo(foo + ": " + value.toUpperCase());
|
||||
return value -> new Foo(foo + ": " + value.toUpperCase(Locale.ROOT));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package org.springframework.cloud.function.scan;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -33,7 +34,7 @@ public class ScannedFunction
|
||||
@Override
|
||||
public Map<String, String> apply(Map<String, String> m) {
|
||||
return m.entrySet().stream().collect(Collectors.toMap(e -> e.getKey(),
|
||||
e -> e.getValue().toString().toUpperCase()));
|
||||
e -> e.getValue().toString().toUpperCase(Locale.ROOT)));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package org.springframework.cloud.function.test;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -33,7 +34,7 @@ public class GenericFunction {
|
||||
@Bean
|
||||
public Function<Map<String, String>, Map<String, String>> function() {
|
||||
return m -> m.entrySet().stream().collect(Collectors.toMap(e -> e.getKey(),
|
||||
e -> e.getValue().toString().toUpperCase()));
|
||||
e -> e.getValue().toString().toUpperCase(Locale.ROOT)));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package function.example;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.function.Function;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
@@ -25,7 +26,7 @@ public class SimpleFunctionAppApplication {
|
||||
return person -> {
|
||||
Person p = new Person();
|
||||
p.setId(person.getId());
|
||||
p.setName(person.getName().toUpperCase());
|
||||
p.setName(person.getName().toUpperCase(Locale.ROOT));
|
||||
return p;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package function.example;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.function.Function;
|
||||
|
||||
import javax.mail.Address;
|
||||
@@ -17,7 +18,7 @@ public class UpperCaseFunction implements Function<String, String> {
|
||||
catch (AddressException e) {
|
||||
throw new IllegalStateException("Failed to create and address: ", e);
|
||||
}
|
||||
return value.toUpperCase();
|
||||
return value.toUpperCase(Locale.ROOT);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package function.example;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.function.Function;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
@@ -31,7 +32,7 @@ public class SimpleFunctionAppApplication {
|
||||
return person -> {
|
||||
Person p = new Person();
|
||||
p.setId(person.getId());
|
||||
p.setName(person.getName().toUpperCase());
|
||||
p.setName(person.getName().toUpperCase(Locale.ROOT));
|
||||
return p;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package function.example;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.function.Function;
|
||||
|
||||
public class UpperCaseFunction implements Function<String, String> {
|
||||
@@ -7,7 +8,7 @@ public class UpperCaseFunction implements Function<String, String> {
|
||||
@Override
|
||||
public String apply(String value) {
|
||||
System.out.println("Uppercasing " + value);
|
||||
return value.toUpperCase();
|
||||
return value.toUpperCase(Locale.ROOT);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package function.example;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.function.Function;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
@@ -25,7 +26,7 @@ public class SimpleFunctionAppApplication {
|
||||
return person -> {
|
||||
Person p = new Person();
|
||||
p.setId(person.getId());
|
||||
p.setName(person.getName().toUpperCase());
|
||||
p.setName(person.getName().toUpperCase(Locale.ROOT));
|
||||
return p;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package function.example;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.function.Function;
|
||||
|
||||
public class UpperCaseFunction implements Function<String, String> {
|
||||
@@ -7,7 +8,7 @@ public class UpperCaseFunction implements Function<String, String> {
|
||||
@Override
|
||||
public String apply(String value) {
|
||||
System.out.println("Uppercasing " + value);
|
||||
return value.toUpperCase();
|
||||
return value.toUpperCase(Locale.ROOT);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package function.example;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.function.Function;
|
||||
|
||||
public class UpperCaseFunction implements Function<String, String> {
|
||||
@@ -7,7 +8,7 @@ public class UpperCaseFunction implements Function<String, String> {
|
||||
@Override
|
||||
public String apply(String value) {
|
||||
System.out.println("Uppercasing " + value);
|
||||
return value.toUpperCase();
|
||||
return value.toUpperCase(Locale.ROOT);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package function.example;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.function.Function;
|
||||
|
||||
public class UpperCaseFunction implements Function<String, String> {
|
||||
@@ -7,7 +8,7 @@ public class UpperCaseFunction implements Function<String, String> {
|
||||
@Override
|
||||
public String apply(String value) {
|
||||
System.out.println("Uppercasing " + value);
|
||||
return value.toUpperCase();
|
||||
return value.toUpperCase(Locale.ROOT);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package functions;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.function.Function;
|
||||
|
||||
public class UpperCaseFunction implements Function<String, String> {
|
||||
@@ -7,7 +8,7 @@ public class UpperCaseFunction implements Function<String, String> {
|
||||
@Override
|
||||
public String apply(String value) {
|
||||
System.out.println("Uppercasing " + value);
|
||||
return value.toUpperCase();
|
||||
return value.toUpperCase(Locale.ROOT);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package example;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.function.Function;
|
||||
|
||||
import org.springframework.boot.SpringBootConfiguration;
|
||||
@@ -25,7 +26,7 @@ public class FunctionConfiguration implements ApplicationContextInitializer<Gene
|
||||
|
||||
@Override
|
||||
public void initialize(GenericApplicationContext context) {
|
||||
Function<String, String> function = (str) -> str + str.toUpperCase();
|
||||
Function<String, String> function = (str) -> str + str.toUpperCase(Locale.ROOT);
|
||||
|
||||
context.registerBean("uppercase", FunctionRegistration.class,
|
||||
() -> new FunctionRegistration<>(function).type(FunctionTypeUtils.functionType(String.class, String.class)));
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.example;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Locale;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Function;
|
||||
|
||||
@@ -30,7 +31,7 @@ public class LambdaApplication {
|
||||
public Function<String, String> uppercase() {
|
||||
return value -> {
|
||||
logger.info("UPPERCASING: " + value);
|
||||
return value.toUpperCase();
|
||||
return value.toUpperCase(Locale.ROOT);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.example;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.function.Function;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
@@ -24,7 +25,7 @@ public class LambdaApplication
|
||||
if (value.equals("error")) {
|
||||
throw new IllegalArgumentException("Intentional");
|
||||
}
|
||||
return value.toUpperCase();
|
||||
return value.toUpperCase(Locale.ROOT);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.example.demo;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.function.Function;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
@@ -35,7 +36,7 @@ public class NativeFunctionApplication {
|
||||
public Function<String, String> uppercase() {
|
||||
return v -> {
|
||||
System.out.println("Uppercasing " + v);
|
||||
return v.toUpperCase();
|
||||
return v.toUpperCase(Locale.ROOT);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package example;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.function.Function;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
@@ -19,7 +20,7 @@ public class FunctionConfiguration {
|
||||
|
||||
@Bean
|
||||
public Function<String, String> uppercase() {
|
||||
return value -> value.toUpperCase();
|
||||
return value -> value.toUpperCase(Locale.ROOT);
|
||||
}
|
||||
|
||||
@Bean
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package example;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.function.Function;
|
||||
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
@@ -24,7 +25,7 @@ public class FunctionConfiguration {
|
||||
throw new RuntimeException("Intentional exception");
|
||||
}
|
||||
else {
|
||||
return value.toUpperCase();
|
||||
return value.toUpperCase(Locale.ROOT);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package com.example.azure.di.azureblobtriggerdemo;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.function.Function;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
@@ -31,6 +32,6 @@ public class AzureBlobTriggerDemoApplication {
|
||||
|
||||
@Bean
|
||||
public Function<byte[], byte[]> uppercase() {
|
||||
return payload -> new String(payload).toUpperCase().getBytes();
|
||||
return payload -> new String(payload).toUpperCase(Locale.ROOT).getBytes();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.scf.azure.gradle;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.Optional;
|
||||
import java.util.function.Function;
|
||||
|
||||
@@ -49,11 +50,11 @@ public class GradleDemoApplication {
|
||||
return message -> {
|
||||
ExecutionContext context = (ExecutionContext) message.getHeaders().get(AzureFunctionUtil.EXECUTION_CONTEXT);
|
||||
|
||||
String updatedPayload = message.getPayload().toUpperCase();
|
||||
String updatedPayload = message.getPayload().toUpperCase(Locale.ROOT);
|
||||
|
||||
context.getLogger().info("Azure Test: " + updatedPayload);
|
||||
|
||||
return message.getPayload().toUpperCase();
|
||||
return message.getPayload().toUpperCase(Locale.ROOT);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package com.example.azure.di.httptriggerdemo;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.function.Function;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
@@ -32,7 +33,7 @@ public class HttpTriggerDemoApplication {
|
||||
|
||||
@Bean
|
||||
public Function<String, String> uppercase() {
|
||||
return payload -> payload.toUpperCase();
|
||||
return payload -> payload.toUpperCase(Locale.ROOT);
|
||||
}
|
||||
|
||||
@Bean
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package example;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
|
||||
@@ -45,7 +46,7 @@ public class KafkaTriggerDemoApplication {
|
||||
Map<String, Object> valueMap = mapper.fromJson(kafkaEntity.getValue(), Map.class);
|
||||
if (valueMap != null) {
|
||||
valueMap.forEach((k, v) -> valueMap.put(k,
|
||||
v != null && v instanceof String ? ((String) v).toUpperCase() : null));
|
||||
v != null && v instanceof String ? ((String) v).toUpperCase(Locale.ROOT) : null));
|
||||
return mapper.toString(valueMap);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package com.example.azure.di.timetriggerdemo;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import com.microsoft.azure.functions.ExecutionContext;
|
||||
@@ -40,7 +41,7 @@ public class TimeTriggerDemoApplication {
|
||||
public Consumer<Message<String>> uppercase() {
|
||||
return message -> {
|
||||
String timeInfo = message.getPayload();
|
||||
String value = timeInfo.toUpperCase();
|
||||
String value = timeInfo.toUpperCase(Locale.ROOT);
|
||||
|
||||
logger.info("Timer is triggered with TimeInfo: " + value);
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package example;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
|
||||
@@ -54,7 +55,7 @@ public class Config {
|
||||
Map<String, String> map = mapper.fromJson(value, Map.class);
|
||||
|
||||
if(map != null)
|
||||
map.forEach((k, v) -> map.put(k, v != null ? v.toUpperCase() : null));
|
||||
map.forEach((k, v) -> map.put(k, v != null ? v.toUpperCase(Locale.ROOT) : null));
|
||||
|
||||
if(context != null)
|
||||
context.getLogger().info(new StringBuilder().append("Function: ")
|
||||
@@ -73,12 +74,12 @@ public class Config {
|
||||
|
||||
@Bean
|
||||
public Function<Mono<String>, Mono<String>> uppercaseReactive() {
|
||||
return mono -> mono.map(value -> value.toUpperCase());
|
||||
return mono -> mono.map(value -> value.toUpperCase(Locale.ROOT));
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Function<Flux<String>, Flux<String>> echoStream() {
|
||||
return flux -> flux.map(value -> value.toUpperCase());
|
||||
return flux -> flux.map(value -> value.toUpperCase(Locale.ROOT));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package example;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import com.microsoft.azure.functions.ExecutionContext;
|
||||
import com.microsoft.azure.functions.HttpMethod;
|
||||
@@ -54,7 +55,7 @@ public class ReactiveEchoCustomResultHandler extends FunctionInvoker<List<String
|
||||
) {
|
||||
functionResult
|
||||
.doFirst(() -> executionContext.getLogger().info("BEGIN echo post-processing work ..."))
|
||||
.mapNotNull((v) -> v.toString().toUpperCase())
|
||||
.mapNotNull((v) -> v.toString().toUpperCase(Locale.ROOT))
|
||||
.doFinally((signalType) -> executionContext.getLogger().info("END echo post-processing work"))
|
||||
.subscribe((v) -> executionContext.getLogger().info(" " + v));
|
||||
return "Kicked off job for " + rawInputs;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package example;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.function.Function;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
@@ -23,7 +24,7 @@ public class FunctionConfiguration implements ApplicationContextInitializer<Gene
|
||||
}
|
||||
|
||||
public Function<String, String> uppercase() {
|
||||
return value -> value.toUpperCase();
|
||||
return value -> value.toUpperCase(Locale.ROOT);
|
||||
}
|
||||
|
||||
public Function<String, String> reverse() {
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package com.example;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.function.Function;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
@@ -31,6 +32,6 @@ public class CloudFunctionMain {
|
||||
|
||||
@Bean
|
||||
public Function<String, String> function() {
|
||||
return value -> value.toUpperCase();
|
||||
return value -> value.toUpperCase(Locale.ROOT);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.example.grpc.demo;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
|
||||
@@ -55,7 +56,7 @@ public class DemoGrpcApplication {
|
||||
@Bean
|
||||
public Function<Message<String>, Message<String>> uppercase() {
|
||||
return message -> {
|
||||
return MessageBuilder.withPayload(message.getPayload().toUpperCase())
|
||||
return MessageBuilder.withPayload(message.getPayload().toUpperCase(Locale.ROOT))
|
||||
.copyHeaders(message.getHeaders())
|
||||
.setHeader("uppercased", "true")
|
||||
.build();
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package com.example;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
@@ -71,11 +72,11 @@ class Foo {
|
||||
}
|
||||
|
||||
public String lowercase() {
|
||||
return this.value.toLowerCase();
|
||||
return this.value.toLowerCase(Locale.ROOT);
|
||||
}
|
||||
|
||||
public String uppercase() {
|
||||
return this.value.toUpperCase();
|
||||
return this.value.toUpperCase(Locale.ROOT);
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package com.example;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.util.Locale;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
@@ -38,17 +39,17 @@ public class SampleApplication {
|
||||
|
||||
@Bean
|
||||
public Function<String, String> uppercase() {
|
||||
return value -> value.toUpperCase();
|
||||
return value -> value.toUpperCase(Locale.ROOT);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Function<Message<String>, Integer> uppercaseMessage() {
|
||||
return value -> value.getPayload().toUpperCase().length();
|
||||
return value -> value.getPayload().toUpperCase(Locale.ROOT).length();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Function<Flux<String>, Flux<String>> lowercase() {
|
||||
return flux -> flux.map(value -> value.toLowerCase());
|
||||
return flux -> flux.map(value -> value.toLowerCase(Locale.ROOT));
|
||||
}
|
||||
|
||||
@Bean
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package oz.spring.aws.functions;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.function.Function;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
@@ -10,6 +11,6 @@ public class FunctionConfiguration {
|
||||
|
||||
@Bean
|
||||
public Function<String, String> uppercase() {
|
||||
return value -> value.toUpperCase();
|
||||
return value -> value.toUpperCase(Locale.ROOT);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package oz.spring.aws.functions;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.function.Function;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
@@ -10,7 +11,7 @@ public class FunctionRoutingConfiguration {
|
||||
|
||||
@Bean
|
||||
public Function<String, String> lowercase() {
|
||||
return value -> value.toLowerCase();
|
||||
return value -> value.toLowerCase(Locale.ROOT);
|
||||
}
|
||||
|
||||
@Bean
|
||||
|
||||
@@ -21,6 +21,7 @@ import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.http.HttpHeaders;
|
||||
@@ -59,7 +60,7 @@ public final class HeaderUtils {
|
||||
HttpHeaders result = new HttpHeaders();
|
||||
for (String name : headers.keySet()) {
|
||||
Object value = headers.get(name);
|
||||
name = name.toLowerCase();
|
||||
name = name.toLowerCase(Locale.ROOT);
|
||||
if (!IGNORED.containsKey(name) && !ignoredHeders.contains(name)) {
|
||||
Collection<?> values = multi(value);
|
||||
for (Object object : values) {
|
||||
@@ -80,7 +81,7 @@ public final class HeaderUtils {
|
||||
HttpHeaders result = new HttpHeaders();
|
||||
for (String name : request.keySet()) {
|
||||
List<String> value = request.get(name);
|
||||
name = name.toLowerCase();
|
||||
name = name.toLowerCase(Locale.ROOT);
|
||||
if (!IGNORED.containsKey(name) && !REQUEST_ONLY.containsKey(name) && !ignoredHeders.contains(name) && !requestOnlyHeaders.contains(name)) {
|
||||
result.put(name, value);
|
||||
}
|
||||
@@ -97,10 +98,10 @@ public final class HeaderUtils {
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
for (String name : headers.keySet()) {
|
||||
Collection<?> values = multi(headers.get(name));
|
||||
name = name.toLowerCase();
|
||||
name = name.toLowerCase(Locale.ROOT);
|
||||
Object value = values == null ? null
|
||||
: (values.size() == 1 ? values.iterator().next() : values);
|
||||
if (name.toLowerCase().equals(HttpHeaders.CONTENT_TYPE.toLowerCase())) {
|
||||
if (name.toLowerCase(Locale.ROOT).equals(HttpHeaders.CONTENT_TYPE.toLowerCase(Locale.ROOT))) {
|
||||
name = MessageHeaders.CONTENT_TYPE;
|
||||
}
|
||||
map.put(name, value);
|
||||
|
||||
@@ -22,6 +22,7 @@ import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
@@ -300,13 +301,13 @@ public class FluxRestApplicationTests {
|
||||
@PostMapping({ "/uppercase", "/transform", "/post/more" })
|
||||
public Flux<?> uppercase(@RequestBody List<String> flux) {
|
||||
return Flux.fromIterable(flux).log()
|
||||
.map(value -> "[" + value.trim().toUpperCase() + "]");
|
||||
.map(value -> "[" + value.trim().toUpperCase(Locale.ROOT) + "]");
|
||||
}
|
||||
|
||||
@PostMapping({ "/alt" })
|
||||
public Mono<ResponseEntity<?>> alt(@RequestBody List<String> flux) {
|
||||
Publisher<?> result = Flux.fromIterable(flux)
|
||||
.map(value -> "[" + value.trim().toUpperCase() + "]");
|
||||
.map(value -> "[" + value.trim().toUpperCase(Locale.ROOT) + "]");
|
||||
return Flux.from(result).log()
|
||||
.then(Mono.fromSupplier(() -> ResponseEntity.ok(result)));
|
||||
}
|
||||
@@ -314,12 +315,12 @@ public class FluxRestApplicationTests {
|
||||
@PostMapping("/upFoos")
|
||||
public Flux<Foo> upFoos(@RequestBody List<Foo> list) {
|
||||
return Flux.fromIterable(list).log()
|
||||
.map(value -> new Foo(value.getValue().trim().toUpperCase()));
|
||||
.map(value -> new Foo(value.getValue().trim().toUpperCase(Locale.ROOT)));
|
||||
}
|
||||
|
||||
@GetMapping("/uppercase/{id}")
|
||||
public Mono<ResponseEntity<?>> uppercaseGet(@PathVariable String id) {
|
||||
return Mono.just(id).map(value -> "[" + value.trim().toUpperCase() + "]")
|
||||
return Mono.just(id).map(value -> "[" + value.trim().toUpperCase(Locale.ROOT) + "]")
|
||||
.flatMap(body -> Mono.just(ResponseEntity.ok(body)));
|
||||
}
|
||||
|
||||
@@ -339,7 +340,7 @@ public class FluxRestApplicationTests {
|
||||
public Flux<Map<String, String>> maps(
|
||||
@RequestBody List<Map<String, String>> flux) {
|
||||
return Flux.fromIterable(flux).map(value -> {
|
||||
value.put("value", value.get("value").trim().toUpperCase());
|
||||
value.put("value", value.get("value").trim().toUpperCase(Locale.ROOT));
|
||||
return value;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
@@ -289,18 +290,18 @@ public class MvcRestApplicationTests {
|
||||
@PostMapping({ "/uppercase", "/transform", "/post/more" })
|
||||
public Flux<?> uppercase(@RequestBody List<String> flux) {
|
||||
return Flux.fromIterable(flux).log()
|
||||
.map(value -> "[" + value.trim().toUpperCase() + "]");
|
||||
.map(value -> "[" + value.trim().toUpperCase(Locale.ROOT) + "]");
|
||||
}
|
||||
|
||||
@PostMapping("/upFoos")
|
||||
public Flux<Foo> upFoos(@RequestBody List<Foo> list) {
|
||||
return Flux.fromIterable(list).log()
|
||||
.map(value -> new Foo(value.getValue().trim().toUpperCase()));
|
||||
.map(value -> new Foo(value.getValue().trim().toUpperCase(Locale.ROOT)));
|
||||
}
|
||||
|
||||
@GetMapping("/uppercase/{id}")
|
||||
public Mono<?> uppercaseGet(@PathVariable String id) {
|
||||
return Mono.just(id).map(value -> "[" + value.trim().toUpperCase() + "]");
|
||||
return Mono.just(id).map(value -> "[" + value.trim().toUpperCase(Locale.ROOT) + "]");
|
||||
}
|
||||
|
||||
@GetMapping("/wrap/{id}")
|
||||
@@ -318,7 +319,7 @@ public class MvcRestApplicationTests {
|
||||
public Flux<Map<String, String>> maps(
|
||||
@RequestBody List<Map<String, String>> flux) {
|
||||
return Flux.fromIterable(flux).map(value -> {
|
||||
value.put("value", value.get("value").trim().toUpperCase());
|
||||
value.put("value", value.get("value").trim().toUpperCase(Locale.ROOT));
|
||||
return value;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package org.springframework.cloud.function.test;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.function.Function;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -54,7 +55,7 @@ public class ExplicitNonFunctionalTests {
|
||||
|
||||
@Override
|
||||
public String apply(String value) {
|
||||
return value.toUpperCase();
|
||||
return value.toUpperCase(Locale.ROOT);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ package org.springframework.cloud.function.test;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
|
||||
@@ -111,7 +112,7 @@ public class FunctionalExporterTests {
|
||||
Function<Message<Person>, Message<String>> uppercase() {
|
||||
return value -> {
|
||||
headers.putAll(value.getHeaders());
|
||||
return MessageBuilder.withPayload(value.getPayload().getName().toUpperCase())
|
||||
return MessageBuilder.withPayload(value.getPayload().getName().toUpperCase(Locale.ROOT))
|
||||
.copyHeaders(value.getHeaders()).build();
|
||||
};
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package org.springframework.cloud.function.test;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.function.Function;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -50,7 +51,7 @@ public class FunctionalTests {
|
||||
|
||||
@Override
|
||||
public String apply(String value) {
|
||||
return value.toUpperCase();
|
||||
return value.toUpperCase(Locale.ROOT);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package org.springframework.cloud.function.test;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -54,7 +55,7 @@ public class FunctionalWithInputListTests {
|
||||
|
||||
@Override
|
||||
public Foo apply(List<Foo> value) {
|
||||
return new Foo(value.stream().map(foo -> foo.getValue().toUpperCase())
|
||||
return new Foo(value.stream().map(foo -> foo.getValue().toUpperCase(Locale.ROOT))
|
||||
.collect(Collectors.joining()));
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package org.springframework.cloud.function.test;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -62,7 +63,7 @@ public class FunctionalWithInputSetTests {
|
||||
|
||||
@Override
|
||||
public Foo apply(Set<Foo> value) {
|
||||
return new Foo(value.stream().map(foo -> foo.getValue().toUpperCase())
|
||||
return new Foo(value.stream().map(foo -> foo.getValue().toUpperCase(Locale.ROOT))
|
||||
.collect(Collectors.joining()));
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package org.springframework.cloud.function.test;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.function.Function;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -57,7 +58,7 @@ public class HeadersToMessageTests {
|
||||
@Override
|
||||
public Message<String> apply(Message<String> request) {
|
||||
Message<String> message = MessageBuilder
|
||||
.withPayload(request.getPayload().toUpperCase())
|
||||
.withPayload(request.getPayload().toUpperCase(Locale.ROOT))
|
||||
.setHeader("X-Content-Type", "application/xml")
|
||||
.setHeader("foo", "bar").build();
|
||||
return message;
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package org.springframework.cloud.function.test;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.function.Function;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -54,7 +55,7 @@ public class ImplicitNonFunctionalTests {
|
||||
|
||||
@Bean
|
||||
public Function<String, String> uppercase() {
|
||||
return value -> value.toUpperCase();
|
||||
return value -> value.toUpperCase(Locale.ROOT);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package org.springframework.cloud.function.test;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.function.Function;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -60,7 +61,7 @@ public class PojoTests {
|
||||
|
||||
@Override
|
||||
public Foo apply(Foo value) {
|
||||
return new Foo(value.getValue().toUpperCase());
|
||||
return new Foo(value.getValue().toUpperCase(Locale.ROOT));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
@@ -278,7 +279,7 @@ public class HttpGetIntegrationTests {
|
||||
@Bean({ "uppercase", "post/more" })
|
||||
public Function<Flux<String>, Flux<String>> uppercase() {
|
||||
return flux -> flux.log()
|
||||
.map(value -> "(" + value.trim().toUpperCase() + ")");
|
||||
.map(value -> "(" + value.trim().toUpperCase(Locale.ROOT) + ")");
|
||||
}
|
||||
|
||||
@Bean
|
||||
|
||||
@@ -21,6 +21,7 @@ import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Function;
|
||||
@@ -410,37 +411,37 @@ public class HttpPostIntegrationTests {
|
||||
@Bean({ "uppercase", "transform", "post/more" })
|
||||
public Function<Flux<String>, Flux<String>> uppercase() {
|
||||
return flux -> flux.log()
|
||||
.map(value -> "(" + value.trim().toUpperCase() + ")");
|
||||
.map(value -> "(" + value.trim().toUpperCase(Locale.ROOT) + ")");
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Function<String, String> bareUppercase() {
|
||||
return value -> "(" + value.trim().toUpperCase() + ")";
|
||||
return value -> "(" + value.trim().toUpperCase(Locale.ROOT) + ")";
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Function<Message<String>, Message<String>> messages() {
|
||||
return value -> MessageBuilder
|
||||
.withPayload("(" + value.getPayload().trim().toUpperCase() + ")")
|
||||
.withPayload("(" + value.getPayload().trim().toUpperCase(Locale.ROOT) + ")")
|
||||
.copyHeaders(value.getHeaders()).build();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Function<Flux<Message<String>>, Flux<Message<String>>> headers() {
|
||||
return flux -> flux.map(value -> MessageBuilder
|
||||
.withPayload("(" + value.getPayload().trim().toUpperCase() + ")")
|
||||
.withPayload("(" + value.getPayload().trim().toUpperCase(Locale.ROOT) + ")")
|
||||
.setHeader("foo", "bar").build());
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Function<Flux<Foo>, Flux<Foo>> upFoos() {
|
||||
return flux -> flux.log()
|
||||
.map(value -> new Foo(value.getValue().trim().toUpperCase()));
|
||||
.map(value -> new Foo(value.getValue().trim().toUpperCase(Locale.ROOT)));
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Function<Foo, Foo> bareUpFoos() {
|
||||
return value -> new Foo(value.getValue().trim().toUpperCase());
|
||||
return value -> new Foo(value.getValue().trim().toUpperCase(Locale.ROOT));
|
||||
}
|
||||
|
||||
@Bean
|
||||
@@ -464,7 +465,7 @@ public class HttpPostIntegrationTests {
|
||||
@Bean
|
||||
public Function<Flux<HashMap<String, String>>, Flux<Map<String, String>>> maps() {
|
||||
return flux -> flux.map(value -> {
|
||||
value.put("value", value.get("value").trim().toUpperCase());
|
||||
value.put("value", value.get("value").trim().toUpperCase(Locale.ROOT));
|
||||
return value;
|
||||
});
|
||||
}
|
||||
@@ -473,7 +474,7 @@ public class HttpPostIntegrationTests {
|
||||
@Qualifier("foos")
|
||||
public Function<String, Foo> qualifier() {
|
||||
return value -> {
|
||||
return new Foo("[" + value.trim().toUpperCase() + "]");
|
||||
return new Foo("[" + value.trim().toUpperCase(Locale.ROOT) + "]");
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package org.springframework.cloud.function.web.function;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Locale;
|
||||
import java.util.function.Function;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -66,12 +67,12 @@ public class FunctionEndpointInitializerMVCTests {
|
||||
|
||||
@Bean
|
||||
public Function<String, String> uppercase() {
|
||||
return s -> s.toUpperCase();
|
||||
return s -> s.toUpperCase(Locale.ROOT);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Function<String, String> lowercase() {
|
||||
return s -> s.toLowerCase();
|
||||
return s -> s.toLowerCase(Locale.ROOT);
|
||||
}
|
||||
|
||||
@Bean
|
||||
|
||||
@@ -19,6 +19,7 @@ package org.springframework.cloud.function.web.function;
|
||||
import java.net.URI;
|
||||
import java.time.Duration;
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.function.BiFunction;
|
||||
import java.util.function.Consumer;
|
||||
@@ -196,11 +197,11 @@ public class FunctionEndpointInitializerTests {
|
||||
}
|
||||
|
||||
public Function<String, String> uppercase() {
|
||||
return s -> s.toUpperCase();
|
||||
return s -> s.toUpperCase(Locale.ROOT);
|
||||
}
|
||||
|
||||
public Function<String, String> lowercase() {
|
||||
return s -> s.toLowerCase();
|
||||
return s -> s.toLowerCase(Locale.ROOT);
|
||||
}
|
||||
|
||||
public Function<String, String> reverse() {
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package org.springframework.cloud.function.web.function;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Locale;
|
||||
import java.util.function.Function;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -69,7 +70,7 @@ public class UserSubmittedTests {
|
||||
|
||||
@Bean
|
||||
public Function<String, String> echo() {
|
||||
return s -> s.toUpperCase();
|
||||
return s -> s.toUpperCase(Locale.ROOT);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package org.springframework.cloud.function.web.mvc;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Locale;
|
||||
import java.util.function.Function;
|
||||
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
@@ -77,7 +78,7 @@ public class DefaultRouteTests {
|
||||
|
||||
@Bean
|
||||
public Function<Flux<String>, Flux<String>> uppercase() {
|
||||
return flux -> flux.map(value -> value.toUpperCase());
|
||||
return flux -> flux.map(value -> value.toUpperCase(Locale.ROOT));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
@@ -292,7 +293,7 @@ public class HttpGetIntegrationTests {
|
||||
@Bean({ "uppercase", "post/more" })
|
||||
public Function<Flux<String>, Flux<String>> uppercase() {
|
||||
return flux -> flux.log()
|
||||
.map(value -> "(" + value.trim().toUpperCase() + ")");
|
||||
.map(value -> "(" + value.trim().toUpperCase(Locale.ROOT) + ")");
|
||||
}
|
||||
|
||||
@Bean
|
||||
|
||||
@@ -21,6 +21,7 @@ import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Function;
|
||||
@@ -348,37 +349,37 @@ public class HttpPostIntegrationTests {
|
||||
@Bean({ "uppercase", "transform", "post/more" })
|
||||
public Function<Flux<String>, Flux<String>> uppercase() {
|
||||
return flux -> flux.log()
|
||||
.map(value -> "(" + value.trim().toUpperCase() + ")");
|
||||
.map(value -> "(" + value.trim().toUpperCase(Locale.ROOT) + ")");
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Function<String, String> bareUppercase() {
|
||||
return value -> "(" + value.trim().toUpperCase() + ")";
|
||||
return value -> "(" + value.trim().toUpperCase(Locale.ROOT) + ")";
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Function<Message<String>, Message<String>> messages() {
|
||||
return value -> MessageBuilder
|
||||
.withPayload("(" + value.getPayload().trim().toUpperCase() + ")")
|
||||
.withPayload("(" + value.getPayload().trim().toUpperCase(Locale.ROOT) + ")")
|
||||
.copyHeaders(value.getHeaders()).build();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Function<Flux<Message<String>>, Flux<Message<String>>> headers() {
|
||||
return flux -> flux.map(value -> MessageBuilder
|
||||
.withPayload("(" + value.getPayload().trim().toUpperCase() + ")")
|
||||
.withPayload("(" + value.getPayload().trim().toUpperCase(Locale.ROOT) + ")")
|
||||
.setHeader("foo", "bar").build());
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Function<Flux<Foo>, Flux<Foo>> upFoos() {
|
||||
return flux -> flux.log()
|
||||
.map(value -> new Foo(value.getValue().trim().toUpperCase()));
|
||||
.map(value -> new Foo(value.getValue().trim().toUpperCase(Locale.ROOT)));
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Function<Foo, Foo> bareUpFoos() {
|
||||
return value -> new Foo(value.getValue().trim().toUpperCase());
|
||||
return value -> new Foo(value.getValue().trim().toUpperCase(Locale.ROOT));
|
||||
}
|
||||
|
||||
@Bean
|
||||
@@ -394,7 +395,7 @@ public class HttpPostIntegrationTests {
|
||||
@Bean
|
||||
public Function<Flux<HashMap<String, String>>, Flux<Map<String, String>>> maps() {
|
||||
return flux -> flux.map(value -> {
|
||||
value.put("value", value.get("value").trim().toUpperCase());
|
||||
value.put("value", value.get("value").trim().toUpperCase(Locale.ROOT));
|
||||
return value;
|
||||
});
|
||||
}
|
||||
@@ -402,7 +403,7 @@ public class HttpPostIntegrationTests {
|
||||
@Bean
|
||||
@Qualifier("foos")
|
||||
public Function<String, Foo> qualifier() {
|
||||
return value -> new Foo("[" + value.trim().toUpperCase() + "]");
|
||||
return value -> new Foo("[" + value.trim().toUpperCase(Locale.ROOT) + "]");
|
||||
}
|
||||
|
||||
@Bean
|
||||
|
||||
@@ -18,6 +18,7 @@ package org.springframework.cloud.function.web.mvc;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.function.Function;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -93,7 +94,7 @@ public class MultipartFileTests {
|
||||
@Bean
|
||||
public Function<MultipartFile, String> uppercase() {
|
||||
return value -> {
|
||||
return value.getOriginalFilename().toUpperCase();
|
||||
return value.getOriginalFilename().toUpperCase(Locale.ROOT);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package org.springframework.cloud.function.web.mvc;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Function;
|
||||
@@ -210,7 +211,7 @@ public class RoutingFunctionTests {
|
||||
public Function<Flux<String>, Flux<String>> fluxuppercase() {
|
||||
return v -> v.map(s -> {
|
||||
System.out.println(s);
|
||||
return s.toUpperCase();
|
||||
return s.toUpperCase(Locale.ROOT);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.function.Function;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
@@ -94,7 +95,7 @@ public class FunctionAutoConfigurationIntegrationTests {
|
||||
|
||||
@Bean
|
||||
public Function<String, String> uppercase() {
|
||||
return value -> value.toUpperCase();
|
||||
return value -> value.toUpperCase(Locale.ROOT);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ package org.springframework.cloud.function.web.source;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.function.Function;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
@@ -96,7 +97,7 @@ public class FunctionAutoConfigurationWithRetriesIntegrationTests {
|
||||
|
||||
@Bean
|
||||
public Function<String, String> uppercase() {
|
||||
return value -> value.toUpperCase();
|
||||
return value -> value.toUpperCase(Locale.ROOT);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user