Search in sources :

Example 1 with SpannerMappingContext

use of org.springframework.cloud.gcp.data.spanner.core.mapping.SpannerMappingContext in project spring-cloud-gcp by spring-cloud.

the class SpannerTemplateTests method setUp.

@Before
public void setUp() {
    this.databaseClient = mock(DatabaseClient.class);
    this.mappingContext = new SpannerMappingContext();
    this.objectMapper = mock(SpannerConverter.class);
    this.mutationFactory = mock(SpannerMutationFactory.class);
    this.readContext = mock(ReadContext.class);
    when(this.databaseClient.singleUse()).thenReturn(this.readContext);
    this.spannerTemplate = new SpannerTemplate(this.databaseClient, this.mappingContext, this.objectMapper, this.mutationFactory);
}
Also used : SpannerConverter(org.springframework.cloud.gcp.data.spanner.core.convert.SpannerConverter) DatabaseClient(com.google.cloud.spanner.DatabaseClient) SpannerMappingContext(org.springframework.cloud.gcp.data.spanner.core.mapping.SpannerMappingContext) ReadContext(com.google.cloud.spanner.ReadContext) Before(org.junit.Before)

Example 2 with SpannerMappingContext

use of org.springframework.cloud.gcp.data.spanner.core.mapping.SpannerMappingContext in project spring-cloud-gcp by spring-cloud.

the class SpannerMutationFactoryImplTests method setUp.

@Before
public void setUp() {
    this.mappingContext = new SpannerMappingContext();
    this.objectMapper = mock(SpannerConverter.class);
    this.spannerMutationFactory = new SpannerMutationFactoryImpl(this.objectMapper, this.mappingContext);
}
Also used : SpannerConverter(org.springframework.cloud.gcp.data.spanner.core.convert.SpannerConverter) SpannerMappingContext(org.springframework.cloud.gcp.data.spanner.core.mapping.SpannerMappingContext) Before(org.junit.Before)

Example 3 with SpannerMappingContext

use of org.springframework.cloud.gcp.data.spanner.core.mapping.SpannerMappingContext in project spring-cloud-gcp by spring-cloud.

the class SpannerQueryLookupStrategyTests method initMocks.

@Before
public void initMocks() {
    this.spannerOperations = mock(SpannerOperations.class);
    this.spannerMappingContext = new SpannerMappingContext();
    this.queryMethod = mock(QueryMethod.class);
    this.spannerQueryLookupStrategy = getSpannerQueryLookupStrategy();
}
Also used : SpannerMappingContext(org.springframework.cloud.gcp.data.spanner.core.mapping.SpannerMappingContext) QueryMethod(org.springframework.data.repository.query.QueryMethod) SpannerOperations(org.springframework.cloud.gcp.data.spanner.core.SpannerOperations) Before(org.junit.Before)

Example 4 with SpannerMappingContext

use of org.springframework.cloud.gcp.data.spanner.core.mapping.SpannerMappingContext in project spring-cloud-gcp by spring-cloud.

the class SpannerStatementQueryTests method initMocks.

@Before
public void initMocks() {
    this.queryMethod = mock(QueryMethod.class);
    this.spannerOperations = mock(SpannerOperations.class);
    this.spannerMappingContext = new SpannerMappingContext();
}
Also used : QueryMethod(org.springframework.data.repository.query.QueryMethod) SpannerMappingContext(org.springframework.cloud.gcp.data.spanner.core.mapping.SpannerMappingContext) SpannerOperations(org.springframework.cloud.gcp.data.spanner.core.SpannerOperations) Before(org.junit.Before)

Example 5 with SpannerMappingContext

use of org.springframework.cloud.gcp.data.spanner.core.mapping.SpannerMappingContext in project spring-cloud-gcp by spring-cloud.

the class SpannerRepositoryFactoryBeanTests method setUp.

@Before
public void setUp() {
    this.spannerMappingContext = new SpannerMappingContext();
    this.spannerOperations = mock(SpannerOperations.class);
    this.spannerRepositoryFactoryBean = new SpannerRepositoryFactoryBean(SpannerRepository.class);
    this.spannerRepositoryFactoryBean.setSpannerMappingContext(this.spannerMappingContext);
    this.spannerRepositoryFactoryBean.setSpannerOperations(this.spannerOperations);
}
Also used : SpannerMappingContext(org.springframework.cloud.gcp.data.spanner.core.mapping.SpannerMappingContext) SpannerRepository(org.springframework.cloud.gcp.data.spanner.repository.SpannerRepository) SpannerOperations(org.springframework.cloud.gcp.data.spanner.core.SpannerOperations) Before(org.junit.Before)

Aggregations

Before (org.junit.Before)6 SpannerMappingContext (org.springframework.cloud.gcp.data.spanner.core.mapping.SpannerMappingContext)6 SpannerOperations (org.springframework.cloud.gcp.data.spanner.core.SpannerOperations)4 SpannerConverter (org.springframework.cloud.gcp.data.spanner.core.convert.SpannerConverter)2 QueryMethod (org.springframework.data.repository.query.QueryMethod)2 DatabaseClient (com.google.cloud.spanner.DatabaseClient)1 ReadContext (com.google.cloud.spanner.ReadContext)1 SpannerRepository (org.springframework.cloud.gcp.data.spanner.repository.SpannerRepository)1