Skip to content
Merged
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
Expand Up @@ -56,7 +56,7 @@
import org.springframework.ai.mcp.annotation.McpToolParam;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Service;
import tools.jackson.databind.ObjectMapper;
import tools.jackson.databind.json.JsonMapper;

/**
* Spring Service providing comprehensive Solr collection management and monitoring capabilities for
Expand Down Expand Up @@ -265,7 +265,7 @@ public class CollectionService {
/** SolrJ client for communicating with Solr server */
private final SolrClient solrClient;

private final ObjectMapper objectMapper;
private final JsonMapper objectMapper;

/**
* Constructs a new CollectionService with the required dependencies.
Expand All @@ -274,11 +274,11 @@ public class CollectionService {
* application startup.
*
* @param solrClient the SolrJ client instance for communicating with Solr
* @param objectMapper the Jackson ObjectMapper for JSON serialization
* @param objectMapper the Jackson JsonMapper for JSON serialization
* @see SolrClient
* @see SolrConfigurationProperties
*/
public CollectionService(SolrClient solrClient, ObjectMapper objectMapper) {
public CollectionService(SolrClient solrClient, JsonMapper objectMapper) {
this.solrClient = solrClient;
this.objectMapper = objectMapper;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import org.springframework.http.MediaType;
import tools.jackson.core.JacksonException;
import tools.jackson.databind.JsonNode;
import tools.jackson.databind.ObjectMapper;
import tools.jackson.databind.json.JsonMapper;

/**
* SolrJ {@link ResponseParser} that requests JSON wire format ({@code wt=json}) and converts the
Expand Down Expand Up @@ -64,9 +64,9 @@
*/
class JsonResponseParser extends ResponseParser {

private final ObjectMapper mapper;
private final JsonMapper mapper;

JsonResponseParser(ObjectMapper mapper) {
JsonResponseParser(JsonMapper mapper) {
this.mapper = mapper;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.util.StringUtils;
import tools.jackson.databind.ObjectMapper;
import tools.jackson.databind.json.JsonMapper;

/**
* Spring Configuration class for Apache Solr client setup and connection management.
Expand Down Expand Up @@ -158,7 +158,7 @@ SolrClient solrClient(
* @return the JSON response parser
*/
@Bean
JsonResponseParser jsonResponseParser(ObjectMapper objectMapper) {
JsonResponseParser jsonResponseParser(JsonMapper objectMapper) {
return new JsonResponseParser(objectMapper);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import org.springframework.stereotype.Component;
import tools.jackson.core.JacksonException;
import tools.jackson.databind.JsonNode;
import tools.jackson.databind.ObjectMapper;
import tools.jackson.databind.json.JsonMapper;

/**
* Utility class for processing JSON documents and converting them to SolrInputDocument objects.
Expand All @@ -35,14 +35,14 @@
@Component
public class JsonDocumentCreator implements SolrDocumentCreator {

private final ObjectMapper objectMapper;
private final JsonMapper objectMapper;

/**
* Constructs the creator with the Jackson {@link ObjectMapper} used to parse incoming JSON.
* Constructs the creator with the Jackson {@link JsonMapper} used to parse incoming JSON.
*
* @param objectMapper the JSON parser injected by Spring
*/
public JsonDocumentCreator(ObjectMapper objectMapper) {
public JsonDocumentCreator(JsonMapper objectMapper) {
this.objectMapper = objectMapper;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
* <p><strong>Usage Example:</strong>
*
* <pre>{@code
* SolrDocumentCreator creator = new JsonDocumentCreator(new ObjectMapper());
* SolrDocumentCreator creator = new JsonDocumentCreator(JsonMapper.builder().build());
* String jsonData = "[{\"title\":\"Document 1\",\"content\":\"Content here\"}]";
* List<SolrInputDocument> documents = creator.create(jsonData);
* }</pre>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
import org.springframework.ai.mcp.annotation.McpToolParam;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Service;
import tools.jackson.databind.ObjectMapper;
import tools.jackson.databind.json.JsonMapper;

/**
* Spring Service providing schema introspection and management capabilities for Apache Solr
Expand Down Expand Up @@ -122,7 +122,7 @@ public class SchemaService {
/** SolrJ client for communicating with Solr server */
private final SolrClient solrClient;

private final ObjectMapper objectMapper;
private final JsonMapper objectMapper;

/**
* Constructs a new SchemaService with the required dependencies.
Expand All @@ -132,10 +132,10 @@ public class SchemaService {
* operations.
*
* @param solrClient the SolrJ client instance for communicating with Solr
* @param objectMapper the Jackson ObjectMapper for JSON serialization
* @param objectMapper the Jackson JsonMapper for JSON serialization
* @see SolrClient
*/
public SchemaService(SolrClient solrClient, ObjectMapper objectMapper) {
public SchemaService(SolrClient solrClient, JsonMapper objectMapper) {
this.solrClient = solrClient;
this.objectMapper = objectMapper;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
import org.junit.jupiter.api.TestInstance;
import org.junit.jupiter.api.TestMethodOrder;
import tools.jackson.core.type.TypeReference;
import tools.jackson.databind.ObjectMapper;
import tools.jackson.databind.json.JsonMapper;

/**
Expand All @@ -69,7 +68,7 @@ public abstract class McpClientIntegrationTestBase {
*/
protected static final int SHOWS_DOC_COUNT = 61;

protected static final ObjectMapper OBJECT_MAPPER = JsonMapper.builder().build();
protected static final JsonMapper OBJECT_MAPPER = JsonMapper.builder().build();

@AutoClose
@SuppressWarnings("NotNullFieldNotInitialized") // set by beforeAll()
Expand Down
3 changes: 1 addition & 2 deletions src/test/java/org/apache/solr/mcp/server/TestDocuments.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import java.util.Map;
import tools.jackson.core.JacksonException;
import tools.jackson.core.type.TypeReference;
import tools.jackson.databind.ObjectMapper;
import tools.jackson.databind.json.JsonMapper;

/**
Expand All @@ -30,7 +29,7 @@
*/
public final class TestDocuments {

private static final ObjectMapper OBJECT_MAPPER = JsonMapper.builder().build();
private static final JsonMapper OBJECT_MAPPER = JsonMapper.builder().build();

private static final TypeReference<List<Map<String, Object>>> DOCUMENTS =
new TypeReference<>() {};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.json.JsonTest;
import org.springframework.util.ReflectionUtils;
import tools.jackson.databind.ObjectMapper;
import tools.jackson.databind.json.JsonMapper;

/**
* Unit tests for the optional HTTP Basic Authentication wiring performed by {@link SolrConfig}.
Expand All @@ -49,7 +49,7 @@
@DisabledInNativeImage
class SolrConfigAuthTest {

@Autowired private ObjectMapper objectMapper;
@Autowired private JsonMapper objectMapper;

@Test
void noCredentialsWhenBothMissing() throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import java.util.TreeMap;
import org.apache.solr.common.SolrInputDocument;
import org.junit.jupiter.api.Test;
import tools.jackson.databind.ObjectMapper;
import tools.jackson.databind.json.JsonMapper;

/**
Expand All @@ -37,7 +36,7 @@
*/
class JsonDocumentCreatorTest {

private final ObjectMapper objectMapper = JsonMapper.builder().build();
private final JsonMapper objectMapper = JsonMapper.builder().build();

private final JsonDocumentCreator creator = new JsonDocumentCreator(objectMapper);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import org.springframework.web.client.RestClient;
import org.testcontainers.grafana.LgtmStackContainer;
import tools.jackson.databind.JsonNode;
import tools.jackson.databind.ObjectMapper;
import tools.jackson.databind.json.JsonMapper;

/**
* Helper class to query LGTM stack backends (Tempo, Prometheus, Loki).
Expand Down Expand Up @@ -53,11 +53,11 @@ public class LgtmAssertions {

private final LgtmStackContainer lgtm;

private final ObjectMapper objectMapper;
private final JsonMapper objectMapper;

private final RestClient restClient;

public LgtmAssertions(LgtmStackContainer lgtm, ObjectMapper objectMapper) {
public LgtmAssertions(LgtmStackContainer lgtm, JsonMapper objectMapper) {
this.lgtm = lgtm;
this.objectMapper = objectMapper;
this.restClient = RestClient.create();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
import org.testcontainers.junit.jupiter.Container;
import org.testcontainers.junit.jupiter.Testcontainers;
import tools.jackson.databind.JsonNode;
import tools.jackson.databind.ObjectMapper;
import tools.jackson.databind.json.JsonMapper;

/**
* Integration test verifying that observability signals (traces, metrics, logs) are exported via
Expand Down Expand Up @@ -100,7 +100,7 @@ class OtlpExportIntegrationTest {

@Autowired private SolrClient solrClient;

@Autowired private ObjectMapper objectMapper;
@Autowired private JsonMapper objectMapper;

@BeforeAll
static void setUpCollection(@Autowired SolrClient solrClient) throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
import org.mockito.ArgumentCaptor;
import org.mockito.Mock;
import org.mockito.junit.jupiter.MockitoExtension;
import tools.jackson.databind.ObjectMapper;
import tools.jackson.databind.json.JsonMapper;

/**
* Comprehensive test suite for the SchemaService class. Tests schema retrieval functionality with
Expand All @@ -50,7 +50,7 @@ class SchemaServiceTest {

@Mock private SolrClient solrClient;

@Mock private ObjectMapper objectMapper;
@Mock private JsonMapper objectMapper;

private SchemaService schemaService;

Expand Down Expand Up @@ -213,8 +213,8 @@ void addFieldTypes_emptyList_throws() {

@Test
void addFieldTypes_happyPathWithAnalyzer_buildsCorrectFieldTypeDefinition() throws Exception {
// Use a real ObjectMapper so convertValue actually works
ObjectMapper realMapper = new ObjectMapper();
// Use a real JsonMapper so convertValue actually works
JsonMapper realMapper = JsonMapper.builder().build();
SchemaService service = new SchemaService(solrClient, realMapper);

List<Map<String, Object>> types =
Expand Down Expand Up @@ -244,7 +244,7 @@ void addFieldTypes_happyPathWithAnalyzer_buildsCorrectFieldTypeDefinition() thro

@Test
void addFieldTypes_separateAnalyzers_buildsCorrectFieldTypeDefinition() throws Exception {
ObjectMapper realMapper = new ObjectMapper();
JsonMapper realMapper = JsonMapper.builder().build();
SchemaService service = new SchemaService(solrClient, realMapper);

List<Map<String, Object>> types =
Expand Down Expand Up @@ -284,7 +284,7 @@ void addFieldTypes_separateAnalyzers_buildsCorrectFieldTypeDefinition() throws E

@Test
void addFieldTypes_denseVectorField_noAnalyzer() throws Exception {
ObjectMapper realMapper = new ObjectMapper();
JsonMapper realMapper = JsonMapper.builder().build();
SchemaService service = new SchemaService(solrClient, realMapper);

List<Map<String, Object>> types =
Expand All @@ -310,7 +310,7 @@ void addFieldTypes_denseVectorField_noAnalyzer() throws Exception {

@Test
void addFieldTypes_solrThrows_propagates() throws Exception {
ObjectMapper realMapper = new ObjectMapper();
JsonMapper realMapper = JsonMapper.builder().build();
SchemaService service = new SchemaService(solrClient, realMapper);

when(solrClient.request(any(SolrRequest.class), eq("col")))
Expand All @@ -331,7 +331,7 @@ void addFieldTypes_solrThrows_propagates() throws Exception {
*/
@Test
void addFieldTypes_analyzerWithOnlyClassKey_preservesClassInWireFormat() throws Exception {
ObjectMapper realMapper = new ObjectMapper();
JsonMapper realMapper = JsonMapper.builder().build();
SchemaService service = new SchemaService(solrClient, realMapper);

List<Map<String, Object>> types =
Expand Down