Skip to content

Generate test application when spring ai cassandra is selected #1580

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2024 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.
Expand Down Expand Up @@ -31,6 +31,7 @@
*
* @author Moritz Halbritter
* @author Stephane Nicoll
* @author Eddú Meléndez
*/
@Configuration(proxyBeanMethods = false)
class CassandraProjectGenerationConfiguration {
Expand Down Expand Up @@ -63,7 +64,8 @@ ComposeFileCustomizer cassandraComposeFileCustomizer(Build build, DockerServiceR
}

private boolean isCassandraEnabled(Build build) {
return build.dependencies().has("data-cassandra") || build.dependencies().has("data-cassandra-reactive");
return build.dependencies().has("data-cassandra") || build.dependencies().has("data-cassandra-reactive")
|| build.dependencies().has("spring-ai-vectordb-cassandra");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ static Iterable<ImplicitDependency> create(Version platformVersion) {
.customizeHelpDocument(addReferenceLink("Consul Module", "consul/")));
builders.add(onDependencies("cloud-starter-vault-config").customizeBuild(addModule("vault"))
.customizeHelpDocument(addReferenceLink("Vault Module", "vault/")));
builders.add(onDependencies("data-cassandra", "data-cassandra-reactive").customizeBuild(addModule("cassandra"))
builders.add(onDependencies("data-cassandra", "data-cassandra-reactive", "spring-ai-vectordb-cassandra")
.customizeBuild(addModule("cassandra"))
.customizeHelpDocument(addReferenceLink("Cassandra Module", "databases/cassandra/")));
builders.add(onDependencies("data-couchbase", "data-couchbase-reactive").customizeBuild(addModule("couchbase"))
.customizeHelpDocument(addReferenceLink("Couchbase Module", "databases/couchbase/")));
Expand Down
15 changes: 15 additions & 0 deletions start-site/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1448,6 +1448,21 @@ initializr:
links:
- rel: reference
href: https://docs.spring.io/spring-ai/reference/api/bedrock-chat.html
- name: Apache Cassandra Vector Database
id: spring-ai-vectordb-cassandra
group-id: org.springframework.ai
artifact-id: spring-ai-cassandra-store-spring-boot-starter
# spring-ai-cassandra-store-spring-boot-starter is not managed in the BOM
# See https://github.com/spring-projects/spring-ai/pull/1312
mappings:
- compatibilityRange: "[3.2.0,3.4.0-M1)"
version: 1.0.0-M2
repository: spring-milestones
description: Spring AI vector database support for Apache Cassandra.
starter: true
links:
- rel: reference
href: https://docs.spring.io/spring-ai/reference/api/vectordbs/apache-cassandra.html
- name: Chroma Vector Database
id: spring-ai-vectordb-chroma
group-id: org.springframework.ai
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2024 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.
Expand Down Expand Up @@ -29,6 +29,7 @@
* Tests for {@link CassandraProjectGenerationConfiguration}.
*
* @author Moritz Halbritter
* @author Eddú Meléndez
*/
class CassandraProjectGenerationConfigurationTests extends AbstractExtensionTests {

Expand All @@ -51,6 +52,12 @@ void createsCassandraServiceWhenReactive() {
assertThat(composeFile(request)).hasSameContentAs(new ClassPathResource("compose/cassandra.yaml"));
}

@Test
void createsCassandraServiceWhenSpringAiIsSelected() {
ProjectRequest request = createProjectRequest("docker-compose", "spring-ai-vectordb-cassandra");
assertThat(composeFile(request)).hasSameContentAs(new ClassPathResource("compose/cassandra.yaml"));
}

@Test
void doesNotFailWhenBothCassandraAndReactiveCassandraAreSelected() {
ProjectRequest request = createProjectRequest("docker-compose", "data-cassandra", "data-cassandra-reactive");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ static Stream<Arguments> supportedEntriesBuild320() {
Arguments.arguments("mysql", "mysql"), Arguments.arguments("postgresql", "postgresql"),
Arguments.arguments("oracle", "oracle-free"), Arguments.arguments("pulsar", "pulsar"),
Arguments.arguments("pulsar-reactive", "pulsar"), Arguments.arguments("solace", "solace"),
Arguments.arguments("spring-ai-vectordb-cassandra", "cassandra"),
Arguments.arguments("spring-ai-vectordb-elasticsearch", "elasticsearch"),
Arguments.arguments("spring-ai-vectordb-neo4j", "neo4j"),
Arguments.arguments("spring-ai-vectordb-oracle", "oracle-free"),
Expand Down