From e65641dbb8a26fc02242dcf76bb3c5110d03a0e0 Mon Sep 17 00:00:00 2001 From: markfisher Date: Tue, 7 Feb 2017 14:20:55 -0500 Subject: [PATCH] removed bytecode loading sample --- spring-cloud-function-samples/pom.xml | 1 - .../.jdk8 | 0 .../pom.xml | 137 ------------------ .../java/com/example/SampleApplication.java | 92 ------------ .../com/example/SampleApplicationTests.java | 50 ------- 5 files changed, 280 deletions(-) delete mode 100644 spring-cloud-function-samples/spring-cloud-function-sample-bytecode/.jdk8 delete mode 100644 spring-cloud-function-samples/spring-cloud-function-sample-bytecode/pom.xml delete mode 100644 spring-cloud-function-samples/spring-cloud-function-sample-bytecode/src/main/java/com/example/SampleApplication.java delete mode 100644 spring-cloud-function-samples/spring-cloud-function-sample-bytecode/src/test/java/com/example/SampleApplicationTests.java diff --git a/spring-cloud-function-samples/pom.xml b/spring-cloud-function-samples/pom.xml index 5767b9c63..bc2c70251 100644 --- a/spring-cloud-function-samples/pom.xml +++ b/spring-cloud-function-samples/pom.xml @@ -16,7 +16,6 @@ spring-cloud-function-sample spring-cloud-function-sample-pojo spring-cloud-function-sample-compiler - spring-cloud-function-sample-bytecode diff --git a/spring-cloud-function-samples/spring-cloud-function-sample-bytecode/.jdk8 b/spring-cloud-function-samples/spring-cloud-function-sample-bytecode/.jdk8 deleted file mode 100644 index e69de29bb..000000000 diff --git a/spring-cloud-function-samples/spring-cloud-function-sample-bytecode/pom.xml b/spring-cloud-function-samples/spring-cloud-function-sample-bytecode/pom.xml deleted file mode 100644 index 7673d1ddc..000000000 --- a/spring-cloud-function-samples/spring-cloud-function-sample-bytecode/pom.xml +++ /dev/null @@ -1,137 +0,0 @@ - - - 4.0.0 - - com.example - function-sample-bytecode - 1.0.0.BUILD-SNAPSHOT - jar - spring-cloud-function-sample-bytecode - Spring Cloud Function ByteCode Loading Support - - - org.springframework.boot - spring-boot-starter-parent - 1.5.1.RELEASE - - - - - 1.8 - 1.0.0.BUILD-SNAPSHOT - 1.0.0.M1 - 3.0.4.RELEASE - - - - - - io.projectreactor - reactor-core - ${reactor.version} - - - org.springframework.cloud - spring-cloud-function-web - ${spring-cloud-function.version} - - - org.springframework.cloud - spring-cloud-function-stream - ${spring-cloud-function.version} - - - org.springframework.cloud - spring-cloud-function-compiler - ${spring-cloud-function.version} - - - org.springframework.boot - spring-boot-configuration-processor - true - - - - - - - org.apache.maven.plugins - maven-jar-plugin - 3.0.0 - - - org.springframework.boot - spring-boot-maven-plugin - 1.5.1.RELEASE - - - org.springframework.boot.experimental - spring-boot-thin-launcher - ${wrapper.version} - - - - - - - - - spring-snapshots - Spring Snapshots - https://repo.spring.io/libs-snapshot-local - - true - - - false - - - - spring-milestones - Spring Milestones - https://repo.spring.io/libs-milestone-local - - false - - - - spring-releases - Spring Releases - https://repo.spring.io/release - - false - - - - - - spring-snapshots - Spring Snapshots - https://repo.spring.io/libs-snapshot-local - - true - - - false - - - - spring-milestones - Spring Milestones - https://repo.spring.io/libs-milestone-local - - false - - - - spring-releases - Spring Releases - https://repo.spring.io/libs-release-local - - false - - - - - diff --git a/spring-cloud-function-samples/spring-cloud-function-sample-bytecode/src/main/java/com/example/SampleApplication.java b/spring-cloud-function-samples/spring-cloud-function-sample-bytecode/src/main/java/com/example/SampleApplication.java deleted file mode 100644 index 5dea31394..000000000 --- a/spring-cloud-function-samples/spring-cloud-function-sample-bytecode/src/main/java/com/example/SampleApplication.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright 2017 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.example; - -import java.util.function.Consumer; -import java.util.function.Function; -import java.util.function.Supplier; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.boot.context.properties.EnableConfigurationProperties; -import org.springframework.cloud.function.compiler.proxy.ByteCodeLoadingConsumer; -import org.springframework.cloud.function.compiler.proxy.ByteCodeLoadingFunction; -import org.springframework.cloud.function.compiler.proxy.ByteCodeLoadingSupplier; -import org.springframework.context.annotation.Bean; -import org.springframework.core.io.Resource; - -import reactor.core.publisher.Flux; - -@SpringBootApplication -@EnableConfigurationProperties(FunctionProperties.class) -public class SampleApplication { - - @Autowired - private FunctionProperties properties; - - @Bean - @SuppressWarnings({ "unchecked", "rawtypes" }) - @ConditionalOnProperty(name="function.type", havingValue="supplier") - public Supplier> supplier() { - return new ByteCodeLoadingSupplier(properties.getResource()); - } - - @Bean - @SuppressWarnings({ "unchecked", "rawtypes" }) - @ConditionalOnProperty(name="function.type", havingValue="function") - public Function, Flux> function() { - return new ByteCodeLoadingFunction(properties.getResource()); - } - - @Bean - @SuppressWarnings({ "unchecked", "rawtypes" }) - @ConditionalOnProperty(name="function.type", havingValue="consumer") - public Consumer consumer() { - return new ByteCodeLoadingConsumer(properties.getResource()); - } - - public static void main(String[] args) throws Exception { - SpringApplication.run(SampleApplication.class, args); - } -} - -@ConfigurationProperties("function") -class FunctionProperties { - - private String type = "function"; - - private Resource resource; - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public Resource getResource() { - return resource; - } - - public void setResource(Resource resource) { - this.resource = resource; - } -} diff --git a/spring-cloud-function-samples/spring-cloud-function-sample-bytecode/src/test/java/com/example/SampleApplicationTests.java b/spring-cloud-function-samples/spring-cloud-function-sample-bytecode/src/test/java/com/example/SampleApplicationTests.java deleted file mode 100644 index f10a9d892..000000000 --- a/spring-cloud-function-samples/spring-cloud-function-sample-bytecode/src/test/java/com/example/SampleApplicationTests.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright 2017 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.example; - -import static org.assertj.core.api.Assertions.assertThat; - -import org.junit.Ignore; -import org.junit.Test; -import org.junit.runner.RunWith; - -import org.springframework.boot.context.embedded.LocalServerPort; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; -import org.springframework.boot.test.web.client.TestRestTemplate; -import org.springframework.test.context.junit4.SpringRunner; - -/** - * @author Mark Fisher - */ -@RunWith(SpringRunner.class) -@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, - properties = "function.resource=file:///tmp/function-registry/functions/uppercase.fun") -public class SampleApplicationTests { - - @LocalServerPort - private int port; - - @Test - @Ignore - public void uppercase() { - assertThat(new TestRestTemplate().postForObject( - "http://localhost:" + port + "/function", "{\"value\":\"foo\"}", - String.class)).isEqualTo("{\"VALUE\":\"FOO\"}"); - } - -}