org.apache.geode.cache.RegionShortcut Java Examples

The following examples show how to use org.apache.geode.cache.RegionShortcut. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SpringSessionPropertiesIntegrationTests.java    From spring-boot-data-geode with Apache License 2.0 6 votes vote down vote up
@Test
public void springSessionPropertiesConfigurationIsCorrect() {

	assertThat(this.springSessionProperties.getCache()).isNotNull();
	assertThat(this.springSessionProperties.getCache().getClient().getPool()).isNotNull();
	assertThat(this.springSessionProperties.getCache().getClient().getPool().getName()).isEqualTo("DEAD");
	assertThat(this.springSessionProperties.getCache().getClient().getRegion()).isNotNull();
	assertThat(this.springSessionProperties.getCache().getClient().getRegion().getShortcut())
		.isEqualTo(ClientRegionShortcut.LOCAL);
	assertThat(this.springSessionProperties.getCache().getServer()).isNotNull();
	assertThat(this.springSessionProperties.getCache().getServer().getRegion()).isNotNull();
	assertThat(this.springSessionProperties.getCache().getServer().getRegion().getShortcut())
		.isEqualTo(RegionShortcut.REPLICATE);
	assertThat(this.springSessionProperties.getSession()).isNotNull();
	assertThat(this.springSessionProperties.getSession().getAttributes()).isNotNull();
	assertThat(this.springSessionProperties.getSession().getAttributes().getIndexable())
		.containsExactly("firstName", "lastName");
	assertThat(this.springSessionProperties.getSession().getExpiration()).isNotNull();
	assertThat(this.springSessionProperties.getSession().getExpiration().getMaxInactiveIntervalSeconds())
		.isEqualTo(300);
	assertThat(this.springSessionProperties.getSession().getRegion()).isNotNull();
	assertThat(this.springSessionProperties.getSession().getRegion().getName()).isEqualTo("TestSessions");
	assertThat(this.springSessionProperties.getSession().getSerializer()).isNotNull();
	assertThat(this.springSessionProperties.getSession().getSerializer().getBeanName())
		.isEqualTo("MockSessionSerializer");
}
 
Example #2
Source File: GemFirePropertiesIntegrationTests.java    From spring-boot-data-geode with Apache License 2.0 5 votes vote down vote up
@Test
public void clusterConfigurationIsCorrect() {

	ClusterProperties clusterProperties = this.gemfireProperties.getCluster();

	assertThat(clusterProperties).isNotNull();
	assertThat(clusterProperties.getRegion()).isNotNull();
	assertThat(clusterProperties.getRegion().getType()).isEqualTo(RegionShortcut.PARTITION_REDUNDANT_PERSISTENT);
}
 
Example #3
Source File: SpringSessionProperties.java    From spring-boot-data-geode with Apache License 2.0 4 votes vote down vote up
public RegionShortcut getShortcut() {
	return this.shortcut != null ? this.shortcut : DEFAULT_SERVER_REGION_SHORTCUT;
}
 
Example #4
Source File: SpringSessionProperties.java    From spring-boot-data-geode with Apache License 2.0 4 votes vote down vote up
public void setShortcut(RegionShortcut shortcut) {
	this.shortcut = shortcut;
}
 
Example #5
Source File: ClusterProperties.java    From spring-boot-data-geode with Apache License 2.0 4 votes vote down vote up
public RegionShortcut getType() {
	return this.peerRegionType;
}
 
Example #6
Source File: ClusterProperties.java    From spring-boot-data-geode with Apache License 2.0 4 votes vote down vote up
public void setType(RegionShortcut peerRegionType) {
	this.peerRegionType = peerRegionType;
}
 
Example #7
Source File: CustomConfiguredSessionCachingIntegrationTests.java    From spring-boot-data-geode with Apache License 2.0 4 votes vote down vote up
@Bean
SpringSessionGemFireConfigurer customSpringSessionGemFireConfiguration() {

	return new SpringSessionGemFireConfigurer() {

		@Override
		public ClientRegionShortcut getClientRegionShortcut() {
			return ClientRegionShortcut.CACHING_PROXY;
		}

		@Override
		public String[] getIndexableSessionAttributes() {
			return new String[] { "two", "four" };
		}

		@Override
		public int getMaxInactiveIntervalInSeconds() {
			return Long.valueOf(TimeUnit.MINUTES.toSeconds(15L)).intValue();
		}

		@Override
		public String getPoolName() {
			return "TestPool";
		}

		@Override
		public String getRegionName() {
			return "TestRegion";
		}

		@Override
		public RegionShortcut getServerRegionShortcut() {
			return RegionShortcut.PARTITION_REDUNDANT_PERSISTENT_OVERFLOW;
		}

		@Override
		public String getSessionSerializerBeanName() {
			return "TestSessionSerializer";
		}
	};
}
 
Example #8
Source File: CustomConfiguredSessionCachingIntegrationTests.java    From spring-boot-data-geode with Apache License 2.0 3 votes vote down vote up
@Test
public void springSessionConfigurationCustomizedWithConfigurer() {

	this.applicationContextFunction = newSpringSessionGemFirePropertiesConfigurationFunction();

	this.springApplicationBuilderFunction = newSpringBootSessionPropertiesConfigurationFunction()
		.andThen(newWebServerSessionPropertiesConfigurationFunction());

	newApplicationContext(TestConfiguration.class, SpringSessionGemFireConfigurerTestConfiguration.class);

	GemFireHttpSessionConfiguration sessionConfiguration = getBean(GemFireHttpSessionConfiguration.class);

	assertThat(sessionConfiguration).isNotNull();

	assertThat(ObjectUtils.<ClientRegionShortcut>invoke(sessionConfiguration, "getClientRegionShortcut"))
		.isEqualTo(ClientRegionShortcut.CACHING_PROXY);

	assertThat(ObjectUtils.<String[]>invoke(sessionConfiguration, "getIndexableSessionAttributes"))
		.contains("two", "four");

	assertThat(ObjectUtils.<Integer>invoke(sessionConfiguration, "getMaxInactiveIntervalInSeconds"))
		.isEqualTo(900);

	assertThat(ObjectUtils.<String>invoke(sessionConfiguration, "getPoolName")).isEqualTo("TestPool");

	assertThat(ObjectUtils.<RegionShortcut>invoke(sessionConfiguration, "getServerRegionShortcut"))
		.isEqualTo(RegionShortcut.PARTITION_REDUNDANT_PERSISTENT_OVERFLOW);

	assertThat(ObjectUtils.<String>invoke(sessionConfiguration, "getSessionRegionName"))
		.isEqualTo("TestRegion");

	assertThat(ObjectUtils.<String>invoke(sessionConfiguration, "getSessionSerializerBeanName"))
		.isEqualTo("TestSessionSerializer");
}
 
Example #9
Source File: CustomConfiguredSessionCachingIntegrationTests.java    From spring-boot-data-geode with Apache License 2.0 3 votes vote down vote up
@Test
public void springSessionConfigurationCustomizedWithProperties() {

	this.applicationContextFunction = newSpringSessionGemFirePropertiesConfigurationFunction();

	this.springApplicationBuilderFunction = newSpringBootSessionPropertiesConfigurationFunction()
		.andThen(newWebServerSessionPropertiesConfigurationFunction());

	newApplicationContext(TestConfiguration.class);

	GemFireHttpSessionConfiguration sessionConfiguration = getBean(GemFireHttpSessionConfiguration.class);

	assertThat(sessionConfiguration).isNotNull();

	assertThat(ObjectUtils.<ClientRegionShortcut>invoke(sessionConfiguration, "getClientRegionShortcut"))
		.isEqualTo(ClientRegionShortcut.LOCAL);

	assertThat(ObjectUtils.<String[]>invoke(sessionConfiguration, "getIndexableSessionAttributes"))
		.contains("one", "two");

	assertThat(ObjectUtils.<Integer>invoke(sessionConfiguration, "getMaxInactiveIntervalInSeconds"))
		.isEqualTo(600);

	assertThat(ObjectUtils.<String>invoke(sessionConfiguration, "getPoolName")).isEqualTo("MockPool");

	assertThat(ObjectUtils.<RegionShortcut>invoke(sessionConfiguration, "getServerRegionShortcut"))
		.isEqualTo(RegionShortcut.REPLICATE);

	assertThat(ObjectUtils.<String>invoke(sessionConfiguration, "getSessionRegionName"))
		.isEqualTo("MockRegion");

	assertThat(ObjectUtils.<String>invoke(sessionConfiguration, "getSessionSerializerBeanName"))
		.isEqualTo("MockSessionSerializer");
}