Skip to content

Commit

Permalink
GH-1163-function
Browse files Browse the repository at this point in the history
Added test for the fix provided in s-c-function
  • Loading branch information
olegz committed Jul 17, 2024
1 parent 07e7d81 commit f356599
Showing 1 changed file with 36 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,21 @@ public void after() {
System.clearProperty("spring.cloud.function.definition");
}

@Test
void foo() {
try (ConfigurableApplicationContext context = new SpringApplicationBuilder(
TestChannelBinderConfiguration.getCompleteConfiguration(DoNotFailOnUnknownPropertiesConfiguration.class))
.web(WebApplicationType.NONE)
.run("--spring.jmx.enabled=false", "--spring.cloud.function.definition=echo")) {

InputDestination input = context.getBean(InputDestination.class);
input.send(new GenericMessage<byte[]>("{\"name\":\"Bubles\",\"id\":\"2\"}".getBytes()), "echo-in-0");

OutputDestination output = context.getBean(OutputDestination.class);
Message<byte[]> result = output.receive(1000, "echo-out-0");
assertThat(result.getPayload()).isEqualTo("Bubles".getBytes());
}
}

@Test
void failedApplicationListenerConfiguration() {
Expand Down Expand Up @@ -1717,4 +1732,25 @@ public void setId(int id) {
}
}

public static class Employee {
private String name;

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}
}

@EnableAutoConfiguration
public static class DoNotFailOnUnknownPropertiesConfiguration {

@Bean
public Function<Employee, String> echo() {
return x -> x.getName();
}
}

}

0 comments on commit f356599

Please sign in to comment.