Skip to content

Commit

Permalink
Merge pull request #1580 from eddumelendez
Browse files Browse the repository at this point in the history
* pr/1580:
  Polish "Generate test application when spring ai cassandra is selected"
  Generate test application when spring ai cassandra is selected

Closes gh-1580
  • Loading branch information
mhalbritter committed Sep 11, 2024
2 parents df06977 + 7b3f6f3 commit d902c27
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 4 deletions.
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

0 comments on commit d902c27

Please sign in to comment.