Search in sources :

Example 1 with KeyValueTemplate

use of org.springframework.data.keyvalue.core.KeyValueTemplate in project spring-data-keyvalue by spring-projects.

the class AbstractRepositoryUnitTests method setup.

@BeforeEach
void setup() {
    KeyValueOperations operations = new KeyValueTemplate(new MapKeyValueAdapter());
    KeyValueRepositoryFactory keyValueRepositoryFactory = createKeyValueRepositoryFactory(operations);
    this.repository = getRepository(keyValueRepositoryFactory);
}
Also used : KeyValueOperations(org.springframework.data.keyvalue.core.KeyValueOperations) KeyValueRepositoryFactory(org.springframework.data.keyvalue.repository.support.KeyValueRepositoryFactory) KeyValueTemplate(org.springframework.data.keyvalue.core.KeyValueTemplate) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 2 with KeyValueTemplate

use of org.springframework.data.keyvalue.core.KeyValueTemplate in project spring-data-keyvalue by spring-projects.

the class MapRepositoriesConfigurationExtensionIntegrationTests method assertKeyValueTemplateWithAdapterFor.

private static void assertKeyValueTemplateWithAdapterFor(Class<?> mapType, ApplicationContext context) {
    KeyValueTemplate template = context.getBean(KeyValueTemplate.class);
    Object adapter = ReflectionTestUtils.getField(template, "adapter");
    assertThat(adapter).isInstanceOf(MapKeyValueAdapter.class);
    assertThat(ReflectionTestUtils.getField(adapter, "store")).isInstanceOf(mapType);
}
Also used : KeyValueTemplate(org.springframework.data.keyvalue.core.KeyValueTemplate)

Aggregations

KeyValueTemplate (org.springframework.data.keyvalue.core.KeyValueTemplate)2 BeforeEach (org.junit.jupiter.api.BeforeEach)1 KeyValueOperations (org.springframework.data.keyvalue.core.KeyValueOperations)1 KeyValueRepositoryFactory (org.springframework.data.keyvalue.repository.support.KeyValueRepositoryFactory)1