Skip to content

Commit d902c27

Browse files
committed
Merge pull request #1580 from eddumelendez
* pr/1580: Polish "Generate test application when spring ai cassandra is selected" Generate test application when spring ai cassandra is selected Closes gh-1580
2 parents df06977 + 7b3f6f3 commit d902c27

File tree

5 files changed

+30
-4
lines changed

5 files changed

+30
-4
lines changed

start-site/src/main/java/io/spring/start/site/extension/dependency/cassandra/CassandraProjectGenerationConfiguration.java

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2023 the original author or authors.
2+
* Copyright 2012-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -31,6 +31,7 @@
3131
*
3232
* @author Moritz Halbritter
3333
* @author Stephane Nicoll
34+
* @author Eddú Meléndez
3435
*/
3536
@Configuration(proxyBeanMethods = false)
3637
class CassandraProjectGenerationConfiguration {
@@ -63,7 +64,8 @@ ComposeFileCustomizer cassandraComposeFileCustomizer(Build build, DockerServiceR
6364
}
6465

6566
private boolean isCassandraEnabled(Build build) {
66-
return build.dependencies().has("data-cassandra") || build.dependencies().has("data-cassandra-reactive");
67+
return build.dependencies().has("data-cassandra") || build.dependencies().has("data-cassandra-reactive")
68+
|| build.dependencies().has("spring-ai-vectordb-cassandra");
6769
}
6870

6971
}

start-site/src/main/java/io/spring/start/site/extension/dependency/testcontainers/TestcontainersModuleRegistry.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ static Iterable<ImplicitDependency> create(Version platformVersion) {
5858
.customizeHelpDocument(addReferenceLink("Consul Module", "consul/")));
5959
builders.add(onDependencies("cloud-starter-vault-config").customizeBuild(addModule("vault"))
6060
.customizeHelpDocument(addReferenceLink("Vault Module", "vault/")));
61-
builders.add(onDependencies("data-cassandra", "data-cassandra-reactive").customizeBuild(addModule("cassandra"))
61+
builders.add(onDependencies("data-cassandra", "data-cassandra-reactive", "spring-ai-vectordb-cassandra")
62+
.customizeBuild(addModule("cassandra"))
6263
.customizeHelpDocument(addReferenceLink("Cassandra Module", "databases/cassandra/")));
6364
builders.add(onDependencies("data-couchbase", "data-couchbase-reactive").customizeBuild(addModule("couchbase"))
6465
.customizeHelpDocument(addReferenceLink("Couchbase Module", "databases/couchbase/")));

start-site/src/main/resources/application.yml

+15
Original file line numberDiff line numberDiff line change
@@ -1448,6 +1448,21 @@ initializr:
14481448
links:
14491449
- rel: reference
14501450
href: https://docs.spring.io/spring-ai/reference/api/bedrock-chat.html
1451+
- name: Apache Cassandra Vector Database
1452+
id: spring-ai-vectordb-cassandra
1453+
group-id: org.springframework.ai
1454+
artifact-id: spring-ai-cassandra-store-spring-boot-starter
1455+
# spring-ai-cassandra-store-spring-boot-starter is not managed in the BOM
1456+
# See https://github.com/spring-projects/spring-ai/pull/1312
1457+
mappings:
1458+
- compatibilityRange: "[3.2.0,3.4.0-M1)"
1459+
version: 1.0.0-M2
1460+
repository: spring-milestones
1461+
description: Spring AI vector database support for Apache Cassandra.
1462+
starter: true
1463+
links:
1464+
- rel: reference
1465+
href: https://docs.spring.io/spring-ai/reference/api/vectordbs/apache-cassandra.html
14511466
- name: Chroma Vector Database
14521467
id: spring-ai-vectordb-chroma
14531468
group-id: org.springframework.ai

start-site/src/test/java/io/spring/start/site/extension/dependency/cassandra/CassandraProjectGenerationConfigurationTests.java

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2023 the original author or authors.
2+
* Copyright 2012-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -29,6 +29,7 @@
2929
* Tests for {@link CassandraProjectGenerationConfiguration}.
3030
*
3131
* @author Moritz Halbritter
32+
* @author Eddú Meléndez
3233
*/
3334
class CassandraProjectGenerationConfigurationTests extends AbstractExtensionTests {
3435

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

55+
@Test
56+
void createsCassandraServiceWhenSpringAiIsSelected() {
57+
ProjectRequest request = createProjectRequest("docker-compose", "spring-ai-vectordb-cassandra");
58+
assertThat(composeFile(request)).hasSameContentAs(new ClassPathResource("compose/cassandra.yaml"));
59+
}
60+
5461
@Test
5562
void doesNotFailWhenBothCassandraAndReactiveCassandraAreSelected() {
5663
ProjectRequest request = createProjectRequest("docker-compose", "data-cassandra", "data-cassandra-reactive");

start-site/src/test/java/io/spring/start/site/extension/dependency/testcontainers/TestcontainersProjectGenerationConfigurationTests.java

+1
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ static Stream<Arguments> supportedEntriesBuild320() {
9797
Arguments.arguments("mysql", "mysql"), Arguments.arguments("postgresql", "postgresql"),
9898
Arguments.arguments("oracle", "oracle-free"), Arguments.arguments("pulsar", "pulsar"),
9999
Arguments.arguments("pulsar-reactive", "pulsar"), Arguments.arguments("solace", "solace"),
100+
Arguments.arguments("spring-ai-vectordb-cassandra", "cassandra"),
100101
Arguments.arguments("spring-ai-vectordb-elasticsearch", "elasticsearch"),
101102
Arguments.arguments("spring-ai-vectordb-neo4j", "neo4j"),
102103
Arguments.arguments("spring-ai-vectordb-oracle", "oracle-free"),

0 commit comments

Comments
 (0)