Switch to the 'DEFAULT' Pool.

Create Spring beans for the 'gemfirePool', 'MockPool' and 'TestPool' Pools.
This commit is contained in:
John Blum
2019-05-04 12:32:41 -07:00
parent 27b52f0e1d
commit 9a4442fe42
3 changed files with 25 additions and 4 deletions

View File

@@ -13,7 +13,6 @@
* or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
package org.springframework.geode.boot.autoconfigure.session;
import static org.assertj.core.api.Assertions.assertThat;
@@ -66,7 +65,10 @@ import org.springframework.test.context.junit4.SpringRunner;
*/
@RunWith(SpringRunner.class)
@SpringBootTest(
properties = "spring.session.data.gemfire.cache.client.region.shortcut=",
properties = {
"spring.session.data.gemfire.cache.client.pool.name=DEFAULT",
"spring.session.data.gemfire.cache.client.region.shortcut="
},
webEnvironment = SpringBootTest.WebEnvironment.MOCK
)
@SuppressWarnings("unused")

View File

@@ -13,7 +13,6 @@
* or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
package org.springframework.geode.boot.autoconfigure.session;
import static org.assertj.core.api.Assertions.assertThat;
@@ -35,6 +34,7 @@ import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.PropertySource;
import org.springframework.data.gemfire.client.PoolFactoryBean;
import org.springframework.data.gemfire.tests.integration.SpringBootApplicationIntegrationTestsSupport;
import org.springframework.data.gemfire.tests.mock.GemFireMockObjectsSupport;
import org.springframework.data.gemfire.tests.mock.annotation.EnableGemFireMockObjects;
@@ -268,6 +268,21 @@ public class CustomConfiguredSessionCachingIntegrationTests extends SpringBootAp
SessionSerializer<Session, ?, ?> mockSessionSerializer() {
return mock(SessionSerializer.class);
}
@Bean
PoolFactoryBean gemfirePool() {
return new PoolFactoryBean();
}
@Bean("MockPool")
PoolFactoryBean mockPool() {
return new PoolFactoryBean();
}
@Bean("TestPool")
PoolFactoryBean testPool() {
return new PoolFactoryBean();
}
}
@Configuration

View File

@@ -13,7 +13,6 @@
* or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
package org.springframework.geode.boot.autoconfigure.session;
import static org.assertj.core.api.Assertions.assertThat;
@@ -31,6 +30,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.context.ApplicationListener;
import org.springframework.context.annotation.Bean;
import org.springframework.data.gemfire.config.annotation.EnableLogging;
import org.springframework.data.gemfire.tests.integration.IntegrationTestsSupport;
import org.springframework.geode.boot.autoconfigure.ContinuousQueryAutoConfiguration;
import org.springframework.session.Session;
@@ -59,12 +59,15 @@ import org.springframework.test.context.junit4.SpringRunner;
*/
@RunWith(SpringRunner.class)
@SpringBootTest(properties = {
"spring.session.data.gemfire.cache.client.pool.name=DEFAULT",
"spring.session.data.gemfire.cache.client.region.shortcut=LOCAL",
"spring.session.timeout=1",
}, webEnvironment = SpringBootTest.WebEnvironment.MOCK)
@SuppressWarnings("unused")
public class SessionExpirationIntegrationTests extends IntegrationTestsSupport {
private static final String GEMFIRE_LOG_LEVEL = "error";
@Resource(name = GemFireHttpSessionConfiguration.DEFAULT_SESSION_REGION_NAME)
private Region<Object, Session> sessionRegion;
@@ -138,6 +141,7 @@ public class SessionExpirationIntegrationTests extends IntegrationTestsSupport {
}
@SpringBootApplication(exclude = ContinuousQueryAutoConfiguration.class)
@EnableLogging(logLevel = GEMFIRE_LOG_LEVEL)
static class TestConfiguration {
@Bean