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) {
|
||||
|
||||
Reference in New Issue
Block a user