SGF-864 - Switch SnapshotService tests to use the temporary directory rather than 'user.home'.

This commit is contained in:
John Blum
2019-07-17 11:52:02 -07:00
parent c0b01c7800
commit c8894ec87d
2 changed files with 18 additions and 17 deletions

View File

@@ -742,8 +742,7 @@ public class SnapshotServiceFactoryBeanTest {
SnapshotOptions mockSnapshotOptionsTwo = mock(SnapshotOptions.class, "MockSnapshotOptionsTwo");
when(mockCache.getSnapshotService()).thenReturn(mockCacheSnapshotService);
when(mockCacheSnapshotService.createOptions()).thenReturn(mockSnapshotOptionsOne)
.thenReturn(mockSnapshotOptionsTwo);
when(mockCacheSnapshotService.createOptions()).thenReturn(mockSnapshotOptionsOne).thenReturn(mockSnapshotOptionsTwo);
when(mockSnapshotOptionsOne.invokeCallbacks(anyBoolean())).thenReturn(mockSnapshotOptionsOne);
when(mockSnapshotOptionsOne.setFilter(eq(mockSnapshotFilterOne))).thenReturn(mockSnapshotOptionsOne);
when(mockSnapshotOptionsOne.setParallelMode(anyBoolean())).thenReturn(mockSnapshotOptionsOne);
@@ -752,7 +751,7 @@ public class SnapshotServiceFactoryBeanTest {
when(mockSnapshotOptionsTwo.setParallelMode(anyBoolean())).thenReturn(mockSnapshotOptionsTwo);
SnapshotMetadata[] expectedImports = toArray(
newSnapshotMetadata(FileSystemUtils.USER_HOME, mockSnapshotFilterOne, false, true),
newSnapshotMetadata(FileSystemUtils.TEMPORARY_DIRECTORY, mockSnapshotFilterOne, false, true),
newSnapshotMetadata(mockSnapshotFilterTwo, true, false)
);
@@ -776,7 +775,7 @@ public class SnapshotServiceFactoryBeanTest {
verify(mockCache, times(1)).getSnapshotService();
verify(mockCacheSnapshotService, times(2)).createOptions();
verify(mockCacheSnapshotService, times(1))
.load(eq(FileSystemUtils.safeListFiles(FileSystemUtils.USER_HOME, FileSystemUtils.FileOnlyFilter.INSTANCE)),
.load(eq(FileSystemUtils.safeListFiles(FileSystemUtils.TEMPORARY_DIRECTORY, FileSystemUtils.FileOnlyFilter.INSTANCE)),
eq(SnapshotFormat.GEMFIRE), eq(mockSnapshotOptionsOne));
verify(mockCacheSnapshotService, times(1))
.load(eq(FileSystemUtils.safeListFiles(FileSystemUtils.WORKING_DIRECTORY, FileSystemUtils.FileOnlyFilter.INSTANCE)),