Search in sources :

Example 6 with ExportManifest

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"));
}
Also used : ArrayList(java.util.ArrayList) ExportManifest(org.pentaho.platform.plugin.services.importexport.exportManifest.ExportManifest) JobScheduleRequest(org.pentaho.platform.web.http.api.resources.JobScheduleRequest) Test(org.junit.Test)

Example 7 with ExportManifest

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);
}
Also used : ExportManifest(org.pentaho.platform.plugin.services.importexport.exportManifest.ExportManifest) ExportManifestMetaStore(org.pentaho.platform.plugin.services.importexport.exportManifest.bindings.ExportManifestMetaStore) Test(org.junit.Test)

Example 8 with ExportManifest

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());
}
Also used : ExportManifest(org.pentaho.platform.plugin.services.importexport.exportManifest.ExportManifest) Test(org.junit.Test)

Example 9 with ExportManifest

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));
}
Also used : ExportManifestEntity(org.pentaho.platform.plugin.services.importexport.exportManifest.ExportManifestEntity) RepositoryFile(org.pentaho.platform.api.repository2.unified.RepositoryFile) ExportManifest(org.pentaho.platform.plugin.services.importexport.exportManifest.ExportManifest) Test(org.junit.Test)

Aggregations

ExportManifest (org.pentaho.platform.plugin.services.importexport.exportManifest.ExportManifest)9 Test (org.junit.Test)7 ArrayList (java.util.ArrayList)3 List (java.util.List)2 RepositoryFile (org.pentaho.platform.api.repository2.unified.RepositoryFile)2 ExportManifestMetaStore (org.pentaho.platform.plugin.services.importexport.exportManifest.bindings.ExportManifestMetaStore)2 ByteArrayInputStream (java.io.ByteArrayInputStream)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 HashMap (java.util.HashMap)1 ZipEntry (java.util.zip.ZipEntry)1 ZipInputStream (java.util.zip.ZipInputStream)1 ZipOutputStream (java.util.zip.ZipOutputStream)1 Mockito.anyString (org.mockito.Mockito.anyString)1 IDatabaseConnection (org.pentaho.database.model.IDatabaseConnection)1 DomainAlreadyExistsException (org.pentaho.metadata.repository.DomainAlreadyExistsException)1 DomainIdNullException (org.pentaho.metadata.repository.DomainIdNullException)1 DomainStorageException (org.pentaho.metadata.repository.DomainStorageException)1 IMetaStore (org.pentaho.metastore.api.IMetaStore)1 IUserRoleListService (org.pentaho.platform.api.engine.IUserRoleListService)1