use of org.pentaho.platform.plugin.services.importexport.exportManifest.ExportManifest in project pentaho-platform by pentaho.
the class SolutionImportHandlerTest method testFileIsScheduleInputSource.
@Test
public void testFileIsScheduleInputSource() {
ExportManifest manifest = Mockito.mock(ExportManifest.class);
SolutionImportHandler spyHandler = Mockito.spy(importHandler);
List<JobScheduleRequest> scheduleRequests = new ArrayList<>();
for (int i = 0; i < 10; i++) {
JobScheduleRequest jobScheduleRequest = new JobScheduleRequest();
jobScheduleRequest.setInputFile("/public/test/file" + i);
scheduleRequests.add(jobScheduleRequest);
}
Assert.assertFalse(spyHandler.fileIsScheduleInputSource(manifest, null));
Mockito.when(manifest.getScheduleList()).thenReturn(scheduleRequests);
Assert.assertFalse(spyHandler.fileIsScheduleInputSource(manifest, "/public/file"));
Assert.assertTrue(spyHandler.fileIsScheduleInputSource(manifest, "/public/test/file3"));
Assert.assertTrue(spyHandler.fileIsScheduleInputSource(manifest, "public/test/file3"));
}
use of org.pentaho.platform.plugin.services.importexport.exportManifest.ExportManifest in project pentaho-platform by pentaho.
the class SolutionImportHandlerTest method testImportMetaStore.
@Test
public void testImportMetaStore() throws Exception {
ExportManifest manifest = Mockito.spy(new ExportManifest());
String path = "/path/to/file.zip";
ExportManifestMetaStore manifestMetaStore = new ExportManifestMetaStore(path, "metastore", "description of the metastore");
importHandler.cachedImports = new HashMap<String, RepositoryFileImportBundle.Builder>();
Mockito.when(manifest.getMetaStore()).thenReturn(manifestMetaStore);
importHandler.importMetaStore(manifest, true);
Assert.assertEquals(1, importHandler.cachedImports.size());
Assert.assertTrue(importHandler.cachedImports.get(path) != null);
}
use of org.pentaho.platform.plugin.services.importexport.exportManifest.ExportManifest in project pentaho-platform by pentaho.
the class ImportSessionTest method testClearSession.
@Test
public void testClearSession() {
ExportManifest manifest = mock(ExportManifest.class);
ImportSession.getSession().setManifest(manifest);
assertNotNull(ImportSession.getSession().getManifest());
ImportSession.clearSession();
assertNull(ImportSession.getSession().getManifest());
}
use of org.pentaho.platform.plugin.services.importexport.exportManifest.ExportManifest in project pentaho-platform by pentaho.
the class ImportSessionTest method fileHiddenPropertyIsDefinedWhenAclIsEnabled.
@Test
public void fileHiddenPropertyIsDefinedWhenAclIsEnabled() {
importSession.setAclProperties(true, false, false);
RepositoryFile virtualFile = mock(RepositoryFile.class);
when(virtualFile.isHidden()).thenReturn(Boolean.TRUE);
ExportManifestEntity fake = mock(ExportManifestEntity.class);
when(fake.getRepositoryFile()).thenReturn(virtualFile);
ExportManifest manifest = mock(ExportManifest.class);
when(manifest.getExportManifestEntity(PATH)).thenReturn(fake);
importSession.setManifest(manifest);
assertEquals(virtualFile.isHidden(), importSession.isFileHidden(PATH));
}
Aggregations