Rename groovy-transformer to groovy-processor

This can be then used as a comnmon groovy-processor app that
can be used in lieu of the current groovy-transform and
groovy-filter processor apps.
This commit is contained in:
Soby Chacko
2020-05-11 14:59:11 -04:00
parent adf9d3fc0d
commit 43e3d7a8fb
11 changed files with 43 additions and 43 deletions

View File

@@ -0,0 +1,13 @@
//tag::ref-doc[]
= Groovy Processor
A Processor that applies a Groovy script against messages.
== Options
The **$$groovy-processor** $$processor$$ has the following options:
//tag::configuration-properties[]
//end::configuration-properties[]
//end::ref-doc[]

View File

@@ -4,8 +4,8 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>groovy-transform-processor</artifactId>
<name>groovy-transform-processor</name>
<description>groovy-transform processor apps</description>
<name>groovy-processor</name>
<description>groovy processor apps</description>
<version>3.0.0-SNAPSHOT</version>
<parent>
@@ -92,15 +92,15 @@
<type>processor</type>
<version>${project.version}</version>
<configClass>
org.springframework.cloud.stream.app.groovy.transform.processor.GroovyTransformProcessorConfiguration.class
org.springframework.cloud.stream.app.groovy.processor.GroovyProcessorConfiguration.class
</configClass>
<functionDefinition>byteArrayTextToString|groovyTransformFunction</functionDefinition>
<functionDefinition>byteArrayTextToString|groovyProcessorFunction</functionDefinition>
</generatedApp>
<dependencies>
<dependency>
<groupId>org.springframework.cloud.stream.app</groupId>
<artifactId>groovy-transform-processor</artifactId>
<artifactId>groovy-processor</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.cloud.stream.app.groovy.transform.processor;
package org.springframework.cloud.stream.app.groovy.processor;
import java.io.IOException;
import java.util.HashMap;
@@ -45,14 +45,14 @@ import org.springframework.util.CollectionUtils;
* @author Soby Chacko
*/
@Configuration
@EnableConfigurationProperties(GroovyTransformProcessorProperties.class)
public class GroovyTransformProcessorConfiguration {
@EnableConfigurationProperties(GroovyProcessorProperties.class)
public class GroovyProcessorConfiguration {
@Autowired
private GroovyTransformProcessorProperties properties;
private GroovyProcessorProperties properties;
@Bean
public Function<Message<?>, Object> groovyTransformFunction(ScriptVariableGenerator scriptVariableGenerator) {
public Function<Message<?>, Object> groovyProcessorFunction(ScriptVariableGenerator scriptVariableGenerator) {
return message -> transformer(scriptVariableGenerator).processMessage(message);
}

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.cloud.stream.app.groovy.transform.processor;
package org.springframework.cloud.stream.app.groovy.processor;
import java.util.Properties;
@@ -29,9 +29,9 @@ import org.springframework.validation.annotation.Validated;
*
* @author Eric Bottard
*/
@ConfigurationProperties("groovy-transformer")
@ConfigurationProperties("groovy-processor")
@Validated
public class GroovyTransformProcessorProperties {
public class GroovyProcessorProperties {
/**
* Reference to a script used to process messages.

View File

@@ -0,0 +1,3 @@
configuration-properties.classes=org.springframework.cloud.stream.app.groovy.processor.GroovyProcessorProperties

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.cloud.stream.app.groovy.transform.processor;
package org.springframework.cloud.stream.app.groovy.processor;
import java.nio.charset.StandardCharsets;
@@ -33,16 +33,16 @@ import org.springframework.messaging.support.GenericMessage;
import static org.assertj.core.api.Assertions.assertThat;
public class GroovyTransformProcessorIntegrationTests {
public class GroovyProcessorIntegrationTests {
@Test
public void testGroovyTransformerWithScript() {
public void testGroovyProcessorWithScript() {
try (ConfigurableApplicationContext context = new SpringApplicationBuilder(
TestChannelBinderConfiguration.getCompleteConfiguration(GroovyTransformTestAppConfiguration.class))
TestChannelBinderConfiguration.getCompleteConfiguration(GroovyProcessorTestAppConfiguration.class))
.web(WebApplicationType.NONE)
.run("--spring.cloud.function.definition=byteArrayTextToString|groovyTransformFunction",
"--groovy-transformer.script=script.groovy",
"--groovy-transformer.variables=limit=5\n foo=\\\40WORLD")) {
.run("--spring.cloud.function.definition=byteArrayTextToString|groovyProcessorFunction",
"--groovy-processor.script=script.groovy",
"--groovy-processor.variables=limit=5\n foo=\\\40WORLD")) {
InputDestination processorInput = context.getBean(InputDestination.class);
OutputDestination processorOutput = context.getBean(OutputDestination.class);
@@ -55,12 +55,12 @@ public class GroovyTransformProcessorIntegrationTests {
}
@Test
public void testGroovyTransformerWithGrab() {
public void testGroovyProcessorWithGrab() {
try (ConfigurableApplicationContext context = new SpringApplicationBuilder(
TestChannelBinderConfiguration.getCompleteConfiguration(GroovyTransformTestAppConfiguration.class))
TestChannelBinderConfiguration.getCompleteConfiguration(GroovyProcessorTestAppConfiguration.class))
.web(WebApplicationType.NONE)
.run("--spring.cloud.function.definition=byteArrayTextToString|groovyTransformFunction",
"--groovy-transformer.script=script-with-grab.groovy")) {
.run("--spring.cloud.function.definition=byteArrayTextToString|groovyProcessorFunction",
"--groovy-processor.script=script-with-grab.groovy")) {
InputDestination processorInput = context.getBean(InputDestination.class);
OutputDestination processorOutput = context.getBean(OutputDestination.class);
@@ -74,7 +74,7 @@ public class GroovyTransformProcessorIntegrationTests {
@EnableAutoConfiguration
@Import({GroovyTransformProcessorConfiguration.class})
public static class GroovyTransformTestAppConfiguration {
@Import({GroovyProcessorConfiguration.class})
public static class GroovyProcessorTestAppConfiguration {
}
}

View File

@@ -1,13 +0,0 @@
//tag::ref-doc[]
= Groovy Transform Processor
A Processor that transforms messages using a Groovy script.
== Options
The **$$groovy-transform$$** $$processor$$ has the following options:
//tag::configuration-properties[]
//end::configuration-properties[]
//end::ref-doc[]

View File

@@ -1,3 +0,0 @@
configuration-properties.classes=org.springframework.cloud.stream.app.groovy.transform.processor.GroovyTransformProcessorProperties

View File

@@ -11,7 +11,7 @@
<modules>
<module>bridge-processor</module>
<module>groovy-transform-processor</module>
<module>groovy-processor</module>
<module>header-enricher-processor</module>
<module>splitter-processor</module>
<module>filter-processor</module>