Rename getFullyQualifiedRegionName() to getSessionsRegionName().

This commit is contained in:
John Blum
2018-12-17 18:45:44 -08:00
parent 8e50d365f6
commit deb774f94f
4 changed files with 23 additions and 25 deletions

View File

@@ -281,19 +281,6 @@ public abstract class AbstractGemFireOperationsSessionRepository
return this.applicationEventPublisher;
}
/**
* Returns the {@link String fully-qualified name} of the cache {@link Region} used to store
* and manage {@link Session} state.
*
* @return a {@link String} containing the fully qualified name of the cache {@link Region}
* used to store and manage {@link Session} data.
* @see #getSessionsRegion()
*/
// TODO - rename to SessionRegionName
protected String getFullyQualifiedRegionName() {
return getSessionsRegion().getFullPath();
}
/**
* Configures the {@link IsDirtyPredicate} strategy interface used to determine whether the users' application
* domain objects are dirty or not.
@@ -411,6 +398,18 @@ public abstract class AbstractGemFireOperationsSessionRepository
return this.sessions;
}
/**
* Returns the {@link String fully-qualified name} of the cache {@link Region} used to store
* and manage {@link Session} state.
*
* @return a {@link String} containing the fully qualified name of the cache {@link Region}
* used to store and manage {@link Session} data.
* @see #getSessionsRegion()
*/
protected String getSessionsRegionName() {
return getSessionsRegion().getFullPath();
}
/**
* Returns a reference to the {@link GemfireOperations template} used to perform data access operations
* and other interactions on the cache {@link Region} storing and managing {@link Session} state

View File

@@ -141,11 +141,11 @@ public class GemFireOperationsSessionRepository extends AbstractGemFireOperation
* @param indexName a String indicating the name of the indexed Session attribute.
* @return an appropriate Pivotal GemFire OQL statement for querying on a particular indexed
* Session attribute.
* @see #getFullyQualifiedRegionName()
* @see #getSessionsRegionName()
*/
protected String prepareQuery(String indexName) {
String fullyQualifiedRegionName = getFullyQualifiedRegionName();
String fullyQualifiedRegionName = getSessionsRegionName();
return PRINCIPAL_NAME_INDEX_NAME.equals(indexName)
? String.format(FIND_SESSIONS_BY_PRINCIPAL_NAME_QUERY, fullyQualifiedRegionName)

View File

@@ -241,14 +241,13 @@ public class AbstractGemFireOperationsSessionRepositoryTests {
assertThat(sessionRepository.getApplicationEventPublisher()).isInstanceOf(ApplicationEventPublisher.class);
assertThat(sessionRepository.getApplicationEventPublisher()).isNotEqualTo(mockApplicationEventPublisher);
assertThat(sessionRepository.getFullyQualifiedRegionName())
.isEqualTo(RegionUtils.toRegionPath("Example"));
assertThat(sessionRepository.getMaxInactiveIntervalInSeconds())
.isEqualTo(GemFireHttpSessionConfiguration.DEFAULT_MAX_INACTIVE_INTERVAL_IN_SECONDS);
assertThat(sessionRepository.isRegisterInterestEnabled()).isTrue();
assertThat(sessionRepository.getSessionEventHandler().orElse(null))
.isInstanceOf(SessionEventHandlerCacheListenerAdapter.class);
assertThat(sessionRepository.getSessionsRegion()).isSameAs(mockRegion);
assertThat(sessionRepository.getSessionsRegionName()).isEqualTo(RegionUtils.toRegionPath("Example"));
assertThat(sessionRepository.getSessionsTemplate()).isSameAs(template);
assertThat(AbstractGemFireOperationsSessionRepository.isUsingDataSerialization()).isFalse();
@@ -332,9 +331,9 @@ public class AbstractGemFireOperationsSessionRepositoryTests {
@Test
public void getFullyQualifiedRegionNameUsesRegionFullPath() {
when(this.mockRegion.getFullPath()).thenReturn("/Region/Full/Path");
when(this.mockRegion.getFullPath()).thenReturn("/Sessions/Region/Full/Path");
assertThat(this.sessionRepository.getFullyQualifiedRegionName()).isEqualTo("/Region/Full/Path");
assertThat(this.sessionRepository.getSessionsRegionName()).isEqualTo("/Sessions/Region/Full/Path");
verify(this.sessionRepository, times(1)).getSessionsRegion();
verify(this.mockRegion, times(1)).getFullPath();

View File

@@ -123,10 +123,10 @@ public class GemFireOperationsSessionRepositoryTests {
this.sessionRepository.setUseDataSerialization(false);
assertThat(this.sessionRepository.getApplicationEventPublisher()).isSameAs(this.mockApplicationEventPublisher);
assertThat(this.sessionRepository.getFullyQualifiedRegionName()).isEqualTo(RegionUtils.toRegionPath("Example"));
assertThat(this.sessionRepository.getMaxInactiveIntervalInSeconds()).isEqualTo(MAX_INACTIVE_INTERVAL_IN_SECONDS);
assertThat(this.sessionRepository.getSessionEventHandler().orElse(null)).isInstanceOf(SessionEventHandlerCacheListenerAdapter.class);
assertThat(this.sessionRepository.getSessionsRegion()).isSameAs(mockRegion);
assertThat(this.sessionRepository.getSessionsRegionName()).isEqualTo(RegionUtils.toRegionPath("Example"));
assertThat(this.sessionRepository.getSessionsTemplate()).isSameAs(this.mockTemplate);
assertThat(GemFireOperationsSessionRepository.isUsingDataSerialization()).isFalse();
@@ -329,7 +329,7 @@ public class GemFireOperationsSessionRepositoryTests {
String expectedQql =
String.format(GemFireOperationsSessionRepository.FIND_SESSIONS_BY_INDEX_NAME_AND_INDEX_VALUE_QUERY,
this.sessionRepository.getFullyQualifiedRegionName(), indexName);
this.sessionRepository.getSessionsRegionName(), indexName);
when(this.mockTemplate.find(eq(expectedQql), eq(indexValue))).thenReturn(mockSelectResults);
@@ -374,7 +374,7 @@ public class GemFireOperationsSessionRepositoryTests {
String expectedOql =
String.format(GemFireOperationsSessionRepository.FIND_SESSIONS_BY_PRINCIPAL_NAME_QUERY,
this.sessionRepository.getFullyQualifiedRegionName());
this.sessionRepository.getSessionsRegionName());
when(this.mockTemplate.find(eq(expectedOql), eq(principalName))).thenReturn(mockSelectResults);
@@ -423,7 +423,7 @@ public class GemFireOperationsSessionRepositoryTests {
String expectedOql =
String.format(GemFireOperationsSessionRepository.FIND_SESSIONS_BY_PRINCIPAL_NAME_QUERY,
this.sessionRepository.getFullyQualifiedRegionName());
this.sessionRepository.getSessionsRegionName());
when(this.mockTemplate.find(eq(expectedOql), eq(principalName))).thenReturn(mockSelectResults);
@@ -451,7 +451,7 @@ public class GemFireOperationsSessionRepositoryTests {
String expectedOql =
String.format(GemFireOperationsSessionRepository.FIND_SESSIONS_BY_INDEX_NAME_AND_INDEX_VALUE_QUERY,
this.sessionRepository.getFullyQualifiedRegionName(), attributeName);
this.sessionRepository.getSessionsRegionName(), attributeName);
assertThat(actualOql).isEqualTo(expectedOql);
}
@@ -463,7 +463,7 @@ public class GemFireOperationsSessionRepositoryTests {
String expectedOql =
String.format(GemFireOperationsSessionRepository.FIND_SESSIONS_BY_PRINCIPAL_NAME_QUERY,
this.sessionRepository.getFullyQualifiedRegionName());
this.sessionRepository.getSessionsRegionName());
assertThat(actualQql).isEqualTo(expectedOql);
}