use of org.pentaho.platform.api.repository2.unified.IUnifiedRepository in project data-access by pentaho.
the class SerializeServiceIT method createMetadataDomainRepository.
public PentahoMetadataDomainRepository createMetadataDomainRepository() throws Exception {
IUnifiedRepository repository = new FileSystemBackedUnifiedRepository("target/test-classes/solution1");
booter.defineInstance(IUnifiedRepository.class, repository);
Assert.assertNotNull(new RepositoryUtils(repository).getFolder("/etc/metadata", true, true, null));
Assert.assertNotNull(new RepositoryUtils(repository).getFolder("/etc/mondrian", true, true, null));
Assert.assertNotNull(new RepositoryUtils(repository).getFolder("/savetest", true, true, null));
PentahoMetadataDomainRepository pentahoMetadataDomainRepository = new PentahoMetadataDomainRepository(repository);
return pentahoMetadataDomainRepository;
}
use of org.pentaho.platform.api.repository2.unified.IUnifiedRepository in project pentaho-metaverse by pentaho.
the class LocatorTestUtils method getMockIUnifiedRepository.
public static IUnifiedRepository getMockIUnifiedRepository() {
IUnifiedRepository repo = mock(IUnifiedRepository.class);
when(repo.getTree(any(RepositoryRequest.class))).thenAnswer(new Answer<RepositoryFileTree>() {
@Override
public RepositoryFileTree answer(InvocationOnMock invocationOnMock) throws Throwable {
Object[] args = invocationOnMock.getArguments();
return getTree((RepositoryRequest) args[0]);
}
});
return repo;
}
use of org.pentaho.platform.api.repository2.unified.IUnifiedRepository in project pentaho-kettle by pentaho.
the class UnifiedRepositoryPurgeServiceTest method verifyAllVersionsDeleted.
private static void verifyAllVersionsDeleted(HashMap<String, List<VersionSummary>> versionListMap, IUnifiedRepository mockRepo, String fileId) {
List<VersionSummary> list = versionListMap.get(fileId);
int i = 1;
for (VersionSummary sum : list) {
if (i < list.size()) {
verify(mockRepo, times(1)).deleteFileAtVersion(fileId, sum.getId());
}
i++;
}
}
use of org.pentaho.platform.api.repository2.unified.IUnifiedRepository in project pentaho-kettle by pentaho.
the class UnifiedRepositoryPurgeServiceTest method deleteVersionsBeforeDate.
@Test
public void deleteVersionsBeforeDate() throws KettleException {
IUnifiedRepository mockRepo = mock(IUnifiedRepository.class);
final HashMap<String, List<VersionSummary>> versionListMap = processVersionMap(mockRepo);
UnifiedRepositoryPurgeService purgeService = new UnifiedRepositoryPurgeService(mockRepo);
String fileId = "1";
Date beforeDate = getDate("01/02/2006");
purgeService.deleteVersionsBeforeDate(element1, beforeDate);
verifyDateBeforeDeletion(versionListMap, mockRepo, fileId, beforeDate);
verify(mockRepo, never()).deleteFileAtVersion(eq("2"), anyString());
}
use of org.pentaho.platform.api.repository2.unified.IUnifiedRepository in project pentaho-kettle by pentaho.
the class UnifiedRepositoryPurgeServiceTest method keepNumberOfVersions0Test.
@Test
public void keepNumberOfVersions0Test() throws KettleException {
IUnifiedRepository mockRepo = mock(IUnifiedRepository.class);
final HashMap<String, List<VersionSummary>> versionListMap = processVersionMap(mockRepo);
UnifiedRepositoryPurgeService purgeService = new UnifiedRepositoryPurgeService(mockRepo);
String fileId = "1";
int versionCount = 0;
purgeService.keepNumberOfVersions(element1, versionCount);
verifyVersionCountDeletion(versionListMap, mockRepo, fileId, versionCount);
verify(mockRepo, never()).deleteFileAtVersion(eq("2"), anyString());
}
Aggregations