List of usage examples for org.springframework.data.gemfire IndexFactoryBean resolveQueryService
QueryService resolveQueryService()
From source file:org.springframework.data.gemfire.IndexFactoryBeanTest.java
@Test public void resolveQueryServiceReturnsQueryServiceFromLookup() { QueryService mockQueryService = mockQueryService( "testResolveQueryServiceReturnsQueryServiceFromLookup.MockQueryService"); IndexFactoryBean indexFactoryBean = newIndexFactoryBean(); indexFactoryBean.setQueryService(null); doReturn(mockQueryService).when(indexFactoryBean).lookupQueryService(); assertThat(indexFactoryBean.resolveQueryService()).isSameAs(mockQueryService); verify(indexFactoryBean, times(1)).lookupQueryService(); }
From source file:org.springframework.data.gemfire.IndexFactoryBeanTest.java
@Test(expected = IllegalStateException.class) public void resolveQueryServiceThrowsExceptionForUnresolvableQueryService() { IndexFactoryBean indexFactoryBean = newIndexFactoryBean(); try {//from w w w. j a va2 s . c o m indexFactoryBean.setQueryService(null); doReturn(null).when(indexFactoryBean).lookupQueryService(); indexFactoryBean.resolveQueryService(); } catch (IllegalStateException expected) { assertThat(expected).hasMessage("QueryService is required to create an Index"); assertThat(expected).hasNoCause(); throw expected; } finally { verify(indexFactoryBean, times(1)).lookupQueryService(); } }