diff --git a/.github/workflows/ci_integration_spring.yml b/.github/workflows/ci_integration_spring.yml new file mode 100644 index 000000000000..acd369fc0cb3 --- /dev/null +++ b/.github/workflows/ci_integration_spring.yml @@ -0,0 +1,52 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you 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. + +name: Integration Spring CI + +on: + push: + branches: + - main + pull_request: + branches: + - main + paths: + - "integrations/spring/**" + - "core/**" + - ".github/workflows/ci_integration_spring.yml" + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }} + cancel-in-progress: true + +jobs: + integration_spring: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Setup Rust toolchain + uses: ./.github/actions/setup + + - name: Set up Java + uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'temurin' + + - name: package and test + run: mvn -B clean package diff --git a/integrations/spring/opendal-spring-boot-starter-reactive/src/test/java/org/apache/opendal/spring/OpenDALApplication.java b/integrations/spring/opendal-spring-boot-starter-reactive/src/test/java/org/apache/opendal/spring/OpenDALApplication.java new file mode 100644 index 000000000000..ff92ea931f50 --- /dev/null +++ b/integrations/spring/opendal-spring-boot-starter-reactive/src/test/java/org/apache/opendal/spring/OpenDALApplication.java @@ -0,0 +1,30 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 org.apache.opendal.spring; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class OpenDALApplication { + public static void main(String[] args) { + SpringApplication.run(OpenDALApplication.class, args); + } +} diff --git a/integrations/spring/opendal-spring-boot-starter-reactive/src/test/java/org/apache/opendal/spring/config/OpenDALReactiveAutoConfigurationTest.java b/integrations/spring/opendal-spring-boot-starter-reactive/src/test/java/org/apache/opendal/spring/config/OpenDALReactiveAutoConfigurationTest.java new file mode 100644 index 000000000000..712ccda9dab7 --- /dev/null +++ b/integrations/spring/opendal-spring-boot-starter-reactive/src/test/java/org/apache/opendal/spring/config/OpenDALReactiveAutoConfigurationTest.java @@ -0,0 +1,51 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 org.apache.opendal.spring.config; + +import org.apache.opendal.spring.OpenDALApplication; +import org.apache.opendal.spring.core.OpenDALProperties; +import org.apache.opendal.spring.core.ReactiveOpenDALOperations; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; + +@SpringJUnitConfig +@SpringBootTest(classes = OpenDALApplication.class) +public class OpenDALReactiveAutoConfigurationTest { + + @Autowired + private OpenDALProperties openDALProperties; + + @Autowired + private ReactiveOpenDALOperations openDALReactive; + + @Test + public void properties_bean_should_be_declared() { + Assertions.assertNotNull(openDALProperties); + } + + @Test + public void reactive_bean_should_be_declared() { + Assertions.assertNotNull(openDALReactive); + } + +} diff --git a/integrations/spring/opendal-spring-boot-starter-reactive/src/test/resources/application.yml b/integrations/spring/opendal-spring-boot-starter-reactive/src/test/resources/application.yml new file mode 100644 index 000000000000..7a7b612c1716 --- /dev/null +++ b/integrations/spring/opendal-spring-boot-starter-reactive/src/test/resources/application.yml @@ -0,0 +1,22 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you 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. + +spring: + opendal: + schema: "fs" + conf: + root: "/tmp" diff --git a/integrations/spring/opendal-spring-boot-starter/src/test/java/org/apache/opendal/spring/OpenDALApplication.java b/integrations/spring/opendal-spring-boot-starter/src/test/java/org/apache/opendal/spring/OpenDALApplication.java new file mode 100644 index 000000000000..ff92ea931f50 --- /dev/null +++ b/integrations/spring/opendal-spring-boot-starter/src/test/java/org/apache/opendal/spring/OpenDALApplication.java @@ -0,0 +1,30 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 org.apache.opendal.spring; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class OpenDALApplication { + public static void main(String[] args) { + SpringApplication.run(OpenDALApplication.class, args); + } +} diff --git a/integrations/spring/opendal-spring-boot-starter/src/test/java/org/apache/opendal/spring/config/OpenDALAutoConfigurationTest.java b/integrations/spring/opendal-spring-boot-starter/src/test/java/org/apache/opendal/spring/config/OpenDALAutoConfigurationTest.java new file mode 100644 index 000000000000..c91018b8953e --- /dev/null +++ b/integrations/spring/opendal-spring-boot-starter/src/test/java/org/apache/opendal/spring/config/OpenDALAutoConfigurationTest.java @@ -0,0 +1,49 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 org.apache.opendal.spring.config; + +import org.apache.opendal.spring.OpenDALApplication; +import org.apache.opendal.spring.core.OpenDALOperations; +import org.apache.opendal.spring.core.OpenDALProperties; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit.jupiter.SpringJUnitConfig; + +@SpringJUnitConfig +@SpringBootTest(classes = OpenDALApplication.class) +public class OpenDALAutoConfigurationTest { + @Autowired + private OpenDALProperties openDALProperties; + + @Autowired + private OpenDALOperations openDAL; + + @Test + public void properties_bean_should_be_declared() { + Assertions.assertNotNull(openDALProperties); + } + + @Test + public void bean_should_be_declared() { + Assertions.assertNotNull(openDAL); + } +} diff --git a/integrations/spring/opendal-spring-boot-starter/src/test/resources/application.yml b/integrations/spring/opendal-spring-boot-starter/src/test/resources/application.yml new file mode 100644 index 000000000000..7a7b612c1716 --- /dev/null +++ b/integrations/spring/opendal-spring-boot-starter/src/test/resources/application.yml @@ -0,0 +1,22 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you 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. + +spring: + opendal: + schema: "fs" + conf: + root: "/tmp" diff --git a/integrations/spring/pom.xml b/integrations/spring/pom.xml index 8d2241e76939..b5c838e5f40e 100644 --- a/integrations/spring/pom.xml +++ b/integrations/spring/pom.xml @@ -42,6 +42,9 @@ 0.47.0 3.3.2 + + + 1.7.1 @@ -67,6 +70,23 @@ opendal ${opendal.version} + + org.apache.opendal + opendal + ${opendal.version} + ${os.detected.classifier} + test + + + + + kr.motd.maven + os-maven-plugin + ${os-maven-plugin.version} + + + +