Search in sources :

Example 81 with Repository

use of org.pentaho.di.repository.Repository in project pentaho-metaverse by pentaho.

the class JobJobEntryAnalyzerTest method testAnalyzeWithRepoByName.

@Test
public void testAnalyzeWithRepoByName() throws Exception {
    Repository repo = mock(Repository.class);
    RepositoryDirectoryInterface repoDir = mock(RepositoryDirectoryInterface.class);
    when(mockParentJobMeta.getRepository()).thenReturn(repo);
    when(jobEntryJob.getSpecificationMethod()).thenReturn(ObjectLocationSpecificationMethod.REPOSITORY_BY_NAME);
    // Test exception
    when(repo.findDirectory(anyString())).thenReturn(repoDir);
    when(repo.loadJob(anyString(), eq(repoDir), any(ProgressMonitorListener.class), anyString())).thenReturn(childJobMeta);
    spyAnalyzer.analyze(descriptor, jobEntryJob);
}
Also used : RepositoryDirectoryInterface(org.pentaho.di.repository.RepositoryDirectoryInterface) Repository(org.pentaho.di.repository.Repository) ProgressMonitorListener(org.pentaho.di.core.ProgressMonitorListener) Test(org.junit.Test)

Example 82 with Repository

use of org.pentaho.di.repository.Repository in project pentaho-metaverse by pentaho.

the class JobJobEntryAnalyzerTest method testAnalyzeWithRepoByRef.

@Test
public void testAnalyzeWithRepoByRef() throws Exception {
    Repository repo = mock(Repository.class);
    when(mockParentJobMeta.getRepository()).thenReturn(repo);
    when(jobEntryJob.getSpecificationMethod()).thenReturn(ObjectLocationSpecificationMethod.REPOSITORY_BY_REFERENCE);
    // Test exception
    when(repo.loadJob(any(ObjectId.class), anyString())).thenReturn(childJobMeta);
    spyAnalyzer.analyze(descriptor, jobEntryJob);
}
Also used : Repository(org.pentaho.di.repository.Repository) ObjectId(org.pentaho.di.repository.ObjectId) Test(org.junit.Test)

Example 83 with Repository

use of org.pentaho.di.repository.Repository in project pentaho-metaverse by pentaho.

the class TransJobEntryAnalyzerTest method testAnalyzeWithRepoByRef.

@Test
public void testAnalyzeWithRepoByRef() throws Exception {
    Repository repo = mock(Repository.class);
    when(mockParentJobMeta.getRepository()).thenReturn(repo);
    when(jobEntryTrans.getSpecificationMethod()).thenReturn(ObjectLocationSpecificationMethod.REPOSITORY_BY_REFERENCE);
    when(repo.loadTransformation(any(ObjectId.class), anyString())).thenReturn(childTransMeta);
    when(childTransMeta.getPathAndName()).thenReturn("/path/to/test");
    when(childTransMeta.getDefaultExtension()).thenReturn("ktr");
    spyAnalyzer.analyze(descriptor, jobEntryTrans);
}
Also used : Repository(org.pentaho.di.repository.Repository) ObjectId(org.pentaho.di.repository.ObjectId) Test(org.junit.Test)

Example 84 with Repository

use of org.pentaho.di.repository.Repository in project pentaho-metaverse by pentaho.

the class TransJobEntryAnalyzerTest method testAnalyzeWithRepoByName.

@Test
public void testAnalyzeWithRepoByName() throws Exception {
    Repository repo = mock(Repository.class);
    RepositoryDirectoryInterface repoDir = mock(RepositoryDirectoryInterface.class);
    when(mockParentJobMeta.getRepository()).thenReturn(repo);
    when(jobEntryTrans.getSpecificationMethod()).thenReturn(ObjectLocationSpecificationMethod.REPOSITORY_BY_NAME);
    when(repo.findDirectory(anyString())).thenReturn(repoDir);
    when(repo.loadTransformation(anyString(), eq(repoDir), any(ProgressMonitorListener.class), anyBoolean(), anyString())).thenReturn(childTransMeta);
    spyAnalyzer.analyze(descriptor, jobEntryTrans);
}
Also used : RepositoryDirectoryInterface(org.pentaho.di.repository.RepositoryDirectoryInterface) Repository(org.pentaho.di.repository.Repository) ProgressMonitorListener(org.pentaho.di.core.ProgressMonitorListener) Test(org.junit.Test)

Example 85 with Repository

use of org.pentaho.di.repository.Repository in project pentaho-metaverse by pentaho.

the class TransExecutorStepAnalyzerTest method testCustomAnalyze_repoFile_NoRepo.

@Test(expected = MetaverseAnalyzerException.class)
public void testCustomAnalyze_repoFile_NoRepo() throws Exception {
    // we should get an exception if the sub transformation isn't found in the repo
    when(meta.getDirectoryPath()).thenReturn("/home/admin");
    when(meta.getTransName()).thenReturn("my.ktr");
    Repository repo = null;
    when(parentTransMeta.getRepository()).thenReturn(repo);
    when(meta.getSpecificationMethod()).thenReturn(ObjectLocationSpecificationMethod.REPOSITORY_BY_NAME);
    spyAnalyzer.customAnalyze(meta, node);
}
Also used : Repository(org.pentaho.di.repository.Repository) Test(org.junit.Test)

Aggregations

Repository (org.pentaho.di.repository.Repository)143 Test (org.junit.Test)69 KettleException (org.pentaho.di.core.exception.KettleException)54 TransMeta (org.pentaho.di.trans.TransMeta)39 RepositoryDirectoryInterface (org.pentaho.di.repository.RepositoryDirectoryInterface)21 IMetaStore (org.pentaho.metastore.api.IMetaStore)20 RepositoryMeta (org.pentaho.di.repository.RepositoryMeta)19 JobMeta (org.pentaho.di.job.JobMeta)18 ObjectId (org.pentaho.di.repository.ObjectId)14 StepMeta (org.pentaho.di.trans.step.StepMeta)14 IUnifiedRepository (org.pentaho.platform.api.repository2.unified.IUnifiedRepository)14 StringObjectId (org.pentaho.di.repository.StringObjectId)13 Variables (org.pentaho.di.core.variables.Variables)12 ArrayList (java.util.ArrayList)11 DatabaseMeta (org.pentaho.di.core.database.DatabaseMeta)11 SimpleLoggingObject (org.pentaho.di.core.logging.SimpleLoggingObject)11 VariableSpace (org.pentaho.di.core.variables.VariableSpace)11 RepositoriesMeta (org.pentaho.di.repository.RepositoriesMeta)11 RepositoryPluginType (org.pentaho.di.core.plugins.RepositoryPluginType)10 IOException (java.io.IOException)9