use of org.springframework.cloud.gcp.data.spanner.core.admin.SpannerSchemaUtils 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(SpannerEntityProcessor.class);
this.mutationFactory = mock(SpannerMutationFactory.class);
this.schemaUtils = new SpannerSchemaUtils(this.mappingContext, this.objectMapper, true);
this.readContext = mock(ReadContext.class);
when(this.databaseClient.singleUse()).thenReturn(this.readContext);
when(this.objectMapper.getWriteConverter()).thenReturn(new SpannerWriteConverter());
this.spannerTemplate = new SpannerTemplate(() -> this.databaseClient, this.mappingContext, this.objectMapper, this.mutationFactory, this.schemaUtils);
}
use of org.springframework.cloud.gcp.data.spanner.core.admin.SpannerSchemaUtils in project spring-cloud-gcp by spring-cloud.
the class SpannerMutationFactoryImplTests method setUp.
@Before
public void setUp() {
this.mappingContext = new SpannerMappingContext();
this.objectMapper = mock(SpannerEntityProcessor.class);
this.spannerSchemaUtils = new SpannerSchemaUtils(this.mappingContext, this.objectMapper, true);
this.spannerMutationFactory = new SpannerMutationFactoryImpl(this.objectMapper, this.mappingContext, this.spannerSchemaUtils);
}
use of org.springframework.cloud.gcp.data.spanner.core.admin.SpannerSchemaUtils in project spring-cloud-gcp by spring-cloud.
the class SqlSpannerQueryTests method initMocks.
@Before
public void initMocks() throws NoSuchMethodException {
this.queryMethod = mock(SpannerQueryMethod.class);
// this is a dummy object. it is not mockable otherwise.
Method method = Object.class.getMethod("toString");
when(this.queryMethod.getMethod()).thenReturn(method);
when(this.spannerEntityProcessor.getWriteConverter()).thenReturn(new SpannerWriteConverter());
this.spannerTemplate = spy(new SpannerTemplate(() -> this.databaseClient, this.spannerMappingContext, this.spannerEntityProcessor, mock(SpannerMutationFactory.class), new SpannerSchemaUtils(this.spannerMappingContext, this.spannerEntityProcessor, true)));
this.expressionParser = new SpelExpressionParser();
this.evaluationContextProvider = mock(QueryMethodEvaluationContextProvider.class);
}
Aggregations