diff --git a/spring-data-geode/src/test/java/org/springframework/data/gemfire/repository/config/ClientRegionNamespaceRepositoryIntegrationTests.java b/spring-data-geode/src/test/java/org/springframework/data/gemfire/repository/config/ClientRegionNamespaceRepositoryIntegrationTests.java index 091d71cd..2ce21212 100644 --- a/spring-data-geode/src/test/java/org/springframework/data/gemfire/repository/config/ClientRegionNamespaceRepositoryIntegrationTests.java +++ b/spring-data-geode/src/test/java/org/springframework/data/gemfire/repository/config/ClientRegionNamespaceRepositoryIntegrationTests.java @@ -19,10 +19,14 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; import org.springframework.data.gemfire.fork.ServerProcess; import org.springframework.data.gemfire.repository.GemfireRepository; +import org.springframework.data.gemfire.repository.sample.Person; import org.springframework.data.gemfire.repository.sample.PersonRepository; import org.springframework.data.gemfire.tests.integration.ForkingClientServerIntegrationTestsSupport; +import org.springframework.data.gemfire.tests.objects.geode.cache.RegionDataInitializingPostProcessor; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringRunner; @@ -40,7 +44,7 @@ import org.springframework.test.context.junit4.SpringRunner; * @see org.springframework.test.context.junit4.SpringRunner */ @RunWith(SpringRunner.class) -@ContextConfiguration +@ContextConfiguration(locations = "ClientRegionNamespaceRepositoryIntegrationTests-context.xml") @SuppressWarnings("unused") public class ClientRegionNamespaceRepositoryIntegrationTests extends ForkingClientServerIntegrationTestsSupport { @@ -59,4 +63,17 @@ public class ClientRegionNamespaceRepositoryIntegrationTests extends ForkingClie assertThat(this.repository.count()).isEqualTo(2); assertThat(this.repository.findAll()).hasSize(2); } + + @Configuration + static class TestConfiguration { + + @Bean + RegionDataInitializingPostProcessor peopleRegionDataInitializer() { + + return RegionDataInitializingPostProcessor.withRegion("simple") + .useAsEntityIdentifier(Person::getId) + .store(new Person(1L, "First1", "Last1")) + .store(new Person(2L, "First2", "Last2")); + } + } } diff --git a/spring-data-geode/src/test/java/org/springframework/data/gemfire/repository/sample/RegionPopulator.java b/spring-data-geode/src/test/java/org/springframework/data/gemfire/repository/sample/RegionPopulator.java deleted file mode 100644 index 1906c057..00000000 --- a/spring-data-geode/src/test/java/org/springframework/data/gemfire/repository/sample/RegionPopulator.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2002-2021 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.springframework.data.gemfire.repository.sample; - -import javax.annotation.Resource; - -import org.apache.geode.cache.Region; - -import org.springframework.beans.factory.InitializingBean; - -/** - * @author David Turanski - * - */ -public class RegionPopulator implements InitializingBean { - @Resource(name="region") - Region region; - - /* (non-Javadoc) - * @see org.springframework.beans.factory.InitializingBean#afterPropertiesSet() - */ - @Override - public void afterPropertiesSet() throws Exception { - region.put(1L,new Person(1L,"first1", "last1")); - region.put(2L,new Person(2L,"first2", "last2")); - - } - - public void setRegion(Region region) { - this.region=region; - } - -} diff --git a/spring-data-geode/src/test/resources/org/springframework/data/gemfire/repository/config/ClientRegionNamespaceRepositoryIntegrationTests-server-context.xml b/spring-data-geode/src/test/resources/org/springframework/data/gemfire/repository/config/ClientRegionNamespaceRepositoryIntegrationTests-server-context.xml index 81c132af..cf1f22de 100644 --- a/spring-data-geode/src/test/resources/org/springframework/data/gemfire/repository/config/ClientRegionNamespaceRepositoryIntegrationTests-server-context.xml +++ b/spring-data-geode/src/test/resources/org/springframework/data/gemfire/repository/config/ClientRegionNamespaceRepositoryIntegrationTests-server-context.xml @@ -11,6 +11,7 @@ http://www.springframework.org/schema/util https://www.springframework.org/schema/util/spring-util.xsd "> + @@ -24,8 +25,6 @@ - - - +