Skip to content

Commit ac204bd

Browse files
Fix enforcer config, ported import check changes to orchestration
1 parent 8527e31 commit ac204bd

File tree

3 files changed

+9
-18
lines changed

3 files changed

+9
-18
lines changed

orchestration/src/test/java/com/sap/ai/sdk/orchestration/spring/ImportCheckTest.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,12 @@
1616
import lombok.val;
1717
import org.junit.jupiter.api.Test;
1818

19-
public class ImportCheckTest {
19+
class ImportCheckTest {
20+
21+
private static final JavaParser PARSER = new JavaParser();
2022

2123
@Test
22-
public void testSpringAIOptional() throws IOException {
24+
void testSpringAIOptional() throws IOException {
2325
String springAI = "org.springframework.ai";
2426
checkImports("com/sap/ai/sdk/orchestration", springAI, false);
2527
checkImports("com/sap/ai/sdk/orchestration/spring", springAI, true);
@@ -31,7 +33,7 @@ private void checkImports(String packagePath, String imports, boolean shouldCont
3133

3234
boolean hasImport = false;
3335
for (File file : javaFiles) {
34-
val result = new JavaParser().parse(file).getResult();
36+
val result = PARSER.parse(file).getResult();
3537
assertThat(result).isPresent();
3638

3739
hasImport =
@@ -55,7 +57,7 @@ private List<File> getJavaFiles(String packagePath) throws IOException {
5557
try (Stream<Path> files = Files.list(orchestrationPackage)) {
5658
return files
5759
.filter(Files::isRegularFile)
58-
.map(java.nio.file.Path::toFile)
60+
.map(Path::toFile)
5961
.filter(file -> file.getName().endsWith(".java"))
6062
.collect(Collectors.toList());
6163
}

pom.xml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@
8383
<enforcer.skipEnforceScopeLoggerBridges>false</enforcer.skipEnforceScopeLoggerBridges>
8484
<enforcer.skipEnforceScopeLombok>false</enforcer.skipEnforceScopeLombok>
8585
<enforcer.skipBanGeneratedModulesReference>false</enforcer.skipBanGeneratedModulesReference>
86+
<enforcer.skipEnforceSpringAIOptional>false</enforcer.skipEnforceSpringAIOptional>
8687
<!-- Test coverage DO NOT CHANGE IN THE ROOT POM -->
8788
<coverage.complexity>100%</coverage.complexity>
8889
<coverage.line>100%</coverage.line>
@@ -435,15 +436,13 @@
435436
<goal>enforce</goal>
436437
</goals>
437438
<configuration>
439+
<skip>${enforcer.skipEnforceSpringAIOptional}</skip>
438440
<rules>
439441
<bannedDependencies>
440442
<message>Spring AI dependencies should be optional</message>
441443
<excludes>
442444
<exclude>org.springframework.ai:*</exclude>
443445
</excludes>
444-
<includes>
445-
<include>com.sap.ai.sdk.app:*</include>
446-
</includes>
447446
</bannedDependencies>
448447
</rules>
449448
</configuration>

sample-code/spring-app/pom.xml

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
<!-- Allow logging frameworks because this module is not released -->
4242
<enforcer.skipBanLoggingFrameworks>true</enforcer.skipBanLoggingFrameworks>
4343
<enforcer.skipEnforceScopeLoggerBridges>true</enforcer.skipEnforceScopeLoggerBridges>
44-
<enforcer.enforce-spring-ai-optional>false</enforcer.enforce-spring-ai-optional>
44+
<enforcer.skipEnforceSpringAIOptional>true</enforcer.skipEnforceSpringAIOptional>
4545
</properties>
4646

4747
<dependencies>
@@ -215,16 +215,6 @@
215215
<skipAddThirdParty>true</skipAddThirdParty>
216216
</configuration>
217217
</plugin>
218-
<plugin>
219-
<groupId>org.apache.maven.plugins</groupId>
220-
<artifactId>maven-enforcer-plugin</artifactId>
221-
<executions>
222-
<execution>
223-
<id>enforce-spring-ai-optional</id>
224-
<phase>none</phase>
225-
</execution>
226-
</executions>
227-
</plugin>
228218
</plugins>
229219
</build>
230220
</project>

0 commit comments

Comments
 (0)