verified repository use
This commit is contained in:
@@ -25,6 +25,8 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.data.gemfire.ForkUtil;
|
||||
import org.springframework.data.gemfire.fork.SpringCacheServerProcess;
|
||||
import org.springframework.data.gemfire.repository.sample.Person;
|
||||
import org.springframework.data.gemfire.repository.sample.PersonRepository;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
@@ -54,11 +56,21 @@ public class GemFireDataSourceTest {
|
||||
public void testServerDataSource() {
|
||||
Cache cache = ctx.getBean("gemfireCache",Cache.class);
|
||||
Pool pool = ctx.getBean("gemfirePool",Pool.class);
|
||||
PoolFactoryBean pfb = ctx.getBean("&gemfirePool",PoolFactoryBean.class);
|
||||
Region<Object,Object> r1 = ctx.getBean("r1",Region.class);
|
||||
r1.put("hello","world");
|
||||
assertEquals("world",r1.get("hello"));
|
||||
|
||||
String regions[] = ctx.getBeanNamesForType(Region.class);
|
||||
List<String> regionList = Arrays.asList(regions);
|
||||
assertTrue(regionList.contains("r1"));
|
||||
assertTrue(regionList.contains("r2"));
|
||||
assertTrue(regionList.contains("simple"));
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testRepositoryCreated() {
|
||||
PersonRepository repo = ctx.getBean(PersonRepository.class);
|
||||
Person dave = new Person(1L,"Dave","Mathhews");
|
||||
repo.save(dave);
|
||||
Person saved = repo.findOne(1L);
|
||||
assertEquals("Dave",saved.getFirstname());
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
|
||||
@@ -6,7 +6,8 @@
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/data/gemfire http://www.springframework.org/schema/data/gemfire/spring-data-gemfire-1.3.xsd">
|
||||
|
||||
<gfe-data:datasource >
|
||||
<gfe-data:datasource>
|
||||
<gfe-data:server host="localhost" port="40404"/>
|
||||
</gfe-data:datasource>
|
||||
<gfe-data:repositories base-package="org.springframework.data.gemfire.repository.sample"/>
|
||||
</beans>
|
||||
|
||||
@@ -9,4 +9,5 @@
|
||||
<gfe:cache-server/>
|
||||
<gfe:replicated-region id="r1"/>
|
||||
<gfe:replicated-region id="r2"/>
|
||||
<gfe:replicated-region id="simple"/>
|
||||
</beans>
|
||||
|
||||
Reference in New Issue
Block a user