Skip to content

Commit 865d429

Browse files
sobychackoilayaperumalg
authored andcommitted
Checkstyle changes
1 parent c1fc687 commit 865d429

File tree

12 files changed

+81
-73
lines changed

12 files changed

+81
-73
lines changed

models/spring-ai-bedrock/src/main/java/org/springframework/ai/bedrock/api/AbstractBedrockApi.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ protected Flux<SO> internalInvocationStream(I request, Class<SO> clazz) {
291291
})
292292
.onDefault(event -> {
293293
logger.error("Unknown or unhandled event: " + event.toString());
294-
eventSink.emitError(new Throwable("Unknown or unhandled event: " + event.toString()),DEFAULT_EMIT_FAILURE_HANDLER);
294+
eventSink.emitError(new Throwable("Unknown or unhandled event: " + event.toString()), DEFAULT_EMIT_FAILURE_HANDLER);
295295
})
296296
.build();
297297

models/spring-ai-oci-genai/src/main/java/org/springframework/ai/oci/cohere/OCICohereChatModel.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ private void validateChatOptions(OCICohereChatOptions options) {
170170
}
171171

172172
private List<Generation> getGenerations(Prompt prompt, OCICohereChatOptions options) {
173-
com.oracle.bmc.generativeaiinference.responses.ChatResponse cr = genAi
173+
com.oracle.bmc.generativeaiinference.responses.ChatResponse cr = this.genAi
174174
.chat(toCohereChatRequest(prompt, options));
175175
return toGenerations(cr, options);
176176

models/spring-ai-oci-genai/src/test/java/org/springframework/ai/oci/BaseOCIGenAITest.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
/*
2-
* Copyright 2024 the original author or authors.
2+
* Copyright 2023-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.
66
* You may obtain a copy of the License at
77
*
8-
* https://www.apache.org/licenses/LICENSE-2.0
8+
* https://www.apache.org/licenses/LICENSE-2.0
99
*
1010
* Unless required by applicable law or agreed to in writing, software
1111
* distributed under the License is distributed on an "AS IS" BASIS,
1212
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16+
1617
package org.springframework.ai.oci;
1718

1819
import java.io.IOException;
@@ -22,6 +23,7 @@
2223
import com.oracle.bmc.auth.ConfigFileAuthenticationDetailsProvider;
2324
import com.oracle.bmc.generativeaiinference.GenerativeAiInference;
2425
import com.oracle.bmc.generativeaiinference.GenerativeAiInferenceClient;
26+
2527
import org.springframework.ai.oci.cohere.OCICohereChatOptions;
2628

2729
public class BaseOCIGenAITest {

models/spring-ai-oci-genai/src/test/java/org/springframework/ai/oci/cohere/OCICohereChatModelIT.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,24 @@
11
/*
2-
* Copyright 2024 the original author or authors.
2+
* Copyright 2023-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.
66
* You may obtain a copy of the License at
77
*
8-
* https://www.apache.org/licenses/LICENSE-2.0
8+
* https://www.apache.org/licenses/LICENSE-2.0
99
*
1010
* Unless required by applicable law or agreed to in writing, software
1111
* distributed under the License is distributed on an "AS IS" BASIS,
1212
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16+
1617
package org.springframework.ai.oci.cohere;
1718

1819
import org.junit.jupiter.api.Test;
1920
import org.junit.jupiter.api.condition.EnabledIfEnvironmentVariable;
21+
2022
import org.springframework.ai.chat.messages.SystemMessage;
2123
import org.springframework.ai.chat.messages.UserMessage;
2224
import org.springframework.ai.chat.model.ChatModel;
@@ -25,11 +27,10 @@
2527
import org.springframework.ai.oci.BaseOCIGenAITest;
2628

2729
import static org.assertj.core.api.Assertions.assertThat;
28-
import static org.springframework.ai.oci.BaseOCIGenAITest.OCI_CHAT_MODEL_ID_KEY;
29-
import static org.springframework.ai.oci.BaseOCIGenAITest.OCI_COMPARTMENT_ID_KEY;
3030

31-
@EnabledIfEnvironmentVariable(named = OCI_COMPARTMENT_ID_KEY, matches = ".+")
32-
@EnabledIfEnvironmentVariable(named = OCI_CHAT_MODEL_ID_KEY, matches = ".+")
31+
@EnabledIfEnvironmentVariable(named = org.springframework.ai.oci.BaseOCIGenAITest.OCI_COMPARTMENT_ID_KEY,
32+
matches = ".+")
33+
@EnabledIfEnvironmentVariable(named = org.springframework.ai.oci.BaseOCIGenAITest.OCI_CHAT_MODEL_ID_KEY, matches = ".+")
3334
public class OCICohereChatModelIT extends BaseOCIGenAITest {
3435

3536
private static final ChatModel chatModel = new OCICohereChatModel(getGenerativeAIClient(), options().build());

models/spring-ai-openai/src/test/java/org/springframework/ai/openai/chat/OpenAiChatModelResponseFormatIT.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
import com.fasterxml.jackson.databind.DeserializationFeature;
2424
import com.fasterxml.jackson.databind.JsonMappingException;
2525
import com.fasterxml.jackson.databind.ObjectMapper;
26-
import org.junit.Assert;
2726
import org.junit.jupiter.api.Test;
2827
import org.junit.jupiter.api.condition.EnabledIfEnvironmentVariable;
2928
import org.slf4j.Logger;
@@ -42,7 +41,6 @@
4241
import org.springframework.boot.test.context.SpringBootTest;
4342
import org.springframework.context.annotation.Bean;
4443

45-
import static org.assertj.core.api.Assertions.as;
4644
import static org.assertj.core.api.Assertions.assertThat;
4745

4846
/**
@@ -161,7 +159,8 @@ record Items(@JsonProperty(required = true, value = "explanation") String explan
161159
}
162160

163161
var outputConverter = new BeanOutputConverter<>(MathReasoning.class);
164-
162+
// @formatter:off
163+
// CHECKSTYLE:OFF
165164
var expectedJsonSchema = """
166165
{
167166
"$schema" : "https://json-schema.org/draft/2020-12/schema",
@@ -197,6 +196,8 @@ record Items(@JsonProperty(required = true, value = "explanation") String explan
197196
"required" : [ "steps", "final_answer" ],
198197
"additionalProperties" : false
199198
}""";
199+
// @formatter:on
200+
// CHECKSTYLE:ON
200201
var jsonSchema1 = outputConverter.getJsonSchema();
201202

202203
assertThat(jsonSchema1).isNotNull();

spring-ai-spring-boot-autoconfigure/src/main/java/org/springframework/ai/autoconfigure/oci/genai/OCICohereChatModelProperties.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public class OCICohereChatModelProperties {
4141
.build();
4242

4343
public boolean isEnabled() {
44-
return enabled;
44+
return this.enabled;
4545
}
4646

4747
public void setEnabled(boolean enabled) {

spring-ai-spring-boot-autoconfigure/src/main/java/org/springframework/ai/autoconfigure/oci/genai/OCIGenAiAutoConfiguration.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
@AutoConfiguration
4949
@ConditionalOnClass({ GenerativeAiInferenceClient.class, OCIEmbeddingModel.class })
5050
@EnableConfigurationProperties({ OCIConnectionProperties.class, OCIEmbeddingModelProperties.class,
51-
OCICohereChatModelProperties.class, })
51+
OCICohereChatModelProperties.class })
5252
public class OCIGenAiAutoConfiguration {
5353

5454
private static BasicAuthenticationDetailsProvider authenticationProvider(OCIConnectionProperties properties)

spring-ai-spring-boot-autoconfigure/src/test/java/org/springframework/ai/autoconfigure/oci/genai/OCIGenAIAutoConfigurationTest.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
/*
2-
* Copyright 2024 the original author or authors.
2+
* Copyright 2023-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.
66
* You may obtain a copy of the License at
77
*
8-
* https://www.apache.org/licenses/LICENSE-2.0
8+
* https://www.apache.org/licenses/LICENSE-2.0
99
*
1010
* Unless required by applicable law or agreed to in writing, software
1111
* distributed under the License is distributed on an "AS IS" BASIS,
1212
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16+
1617
package org.springframework.ai.autoconfigure.oci.genai;
1718

1819
import java.nio.file.Files;
@@ -23,6 +24,7 @@
2324
import com.oracle.bmc.http.client.pki.Pem;
2425
import org.junit.jupiter.api.Test;
2526
import org.junit.jupiter.api.io.TempDir;
27+
2628
import org.springframework.ai.oci.cohere.OCICohereChatModel;
2729
import org.springframework.ai.oci.cohere.OCICohereChatOptions;
2830
import org.springframework.boot.autoconfigure.AutoConfigurations;

spring-ai-spring-boot-autoconfigure/src/test/java/org/springframework/ai/autoconfigure/oci/genai/OCIGenAiAutoConfigurationIT.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,10 @@ public class OCIGenAiAutoConfigurationIT {
5757
private final ApplicationContextRunner cohereChatContextRunner = new ApplicationContextRunner().withPropertyValues(
5858
// @formatter:off
5959
"spring.ai.oci.genai.authenticationType=file",
60-
"spring.ai.oci.genai.file=" + CONFIG_FILE,
61-
"spring.ai.oci.genai.cohere.chat.options.compartment=" + COMPARTMENT_ID,
60+
"spring.ai.oci.genai.file=" + this.CONFIG_FILE,
61+
"spring.ai.oci.genai.cohere.chat.options.compartment=" + this.COMPARTMENT_ID,
6262
"spring.ai.oci.genai.cohere.chat.options.servingMode=on-demand",
63-
"spring.ai.oci.genai.cohere.chat.options.model=" + CHAT_MODEL_ID
63+
"spring.ai.oci.genai.cohere.chat.options.model=" + this.CHAT_MODEL_ID
6464
// @formatter:on
6565
).withConfiguration(AutoConfigurations.of(OCIGenAiAutoConfiguration.class));
6666

src/checkstyle/checkstyle-suppressions.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,7 @@
2929
<suppress files="FiltersParser\.java" checks="MultipleVariableDeclarations"/>
3030
<suppress files="FiltersLexer\.java" checks="MultipleVariableDeclarations"/>
3131
<suppress files="BaseOllamaIT.java" checks="HideUtilityClassConstructor"/>
32+
<suppress files="BaseOCIGenAITest.java" checks="HideUtilityClassConstructor"/>
33+
<suppress files="OpenAiChatModelResponseFormatIT.java" checks="RegexpSinglelineJava"/>
3234

3335
</suppressions>

0 commit comments

Comments
 (0)