use of org.pentaho.di.repository.Repository in project pentaho-metaverse by pentaho.
the class JobJobEntryAnalyzerTest method testAnalyzeWithRepoByRefThrowsException.
@Test(expected = MetaverseAnalyzerException.class)
public void testAnalyzeWithRepoByRefThrowsException() 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())).thenThrow(new KettleException());
spyAnalyzer.analyze(descriptor, jobEntryJob);
}
use of org.pentaho.di.repository.Repository in project pentaho-metaverse by pentaho.
the class TransJobEntryAnalyzerTest method testAnalyzeWithRepoByNameThrowsException.
@Test(expected = MetaverseAnalyzerException.class)
public void testAnalyzeWithRepoByNameThrowsException() throws Exception {
Repository repo = mock(Repository.class);
when(mockParentJobMeta.getRepository()).thenReturn(repo);
when(jobEntryTrans.getSpecificationMethod()).thenReturn(ObjectLocationSpecificationMethod.REPOSITORY_BY_NAME);
// Test exception
when(repo.findDirectory(anyString())).thenThrow(new KettleException());
spyAnalyzer.analyze(descriptor, jobEntryTrans);
}
use of org.pentaho.di.repository.Repository in project pentaho-metaverse by pentaho.
the class TransJobEntryAnalyzerTest method testAnalyzeWithRepoByRefThrowsException.
@Test(expected = MetaverseAnalyzerException.class)
public void testAnalyzeWithRepoByRefThrowsException() throws Exception {
Repository repo = mock(Repository.class);
when(mockParentJobMeta.getRepository()).thenReturn(repo);
when(jobEntryTrans.getSpecificationMethod()).thenReturn(ObjectLocationSpecificationMethod.REPOSITORY_BY_REFERENCE);
// Test exception
when(repo.loadTransformation(any(ObjectId.class), anyString())).thenThrow(new KettleException());
spyAnalyzer.analyze(descriptor, jobEntryTrans);
}
use of org.pentaho.di.repository.Repository in project pentaho-metaverse by pentaho.
the class TransExecutorStepAnalyzerTest method testCustomAnalyze_repoFile_ErrorFindingRepoDir.
@Test(expected = MetaverseAnalyzerException.class)
public void testCustomAnalyze_repoFile_ErrorFindingRepoDir() throws Exception {
// we should get an exception if the sub transformation isn't found on the filesystem
when(meta.getDirectoryPath()).thenReturn("/home/admin");
when(meta.getTransName()).thenReturn("my.ktr");
Repository repo = mock(Repository.class);
when(parentTransMeta.getRepository()).thenReturn(repo);
when(repo.findDirectory(anyString())).thenThrow(new KettleException());
when(meta.getSpecificationMethod()).thenReturn(ObjectLocationSpecificationMethod.REPOSITORY_BY_NAME);
spyAnalyzer.customAnalyze(meta, node);
}
use of org.pentaho.di.repository.Repository in project pentaho-metaverse by pentaho.
the class TransExecutorStepAnalyzerTest method testCustomAnalyze_repoRef.
@Test
public void testCustomAnalyze_repoRef() throws Exception {
when(meta.getTransObjectId()).thenReturn(mock(ObjectId.class));
Repository repo = mock(Repository.class);
RepositoryDirectoryInterface repoDir = mock(RepositoryDirectoryInterface.class);
when(repo.findDirectory(anyString())).thenReturn(repoDir);
when(repo.loadTransformation(any(ObjectId.class), anyString())).thenReturn(childTransMeta);
when(parentTransMeta.getRepository()).thenReturn(repo);
doReturn(childTransMeta).when(spyAnalyzer).getSubTransMeta(anyString());
when(childTransMeta.getPathAndName()).thenReturn("/home/admin/my");
when(childTransMeta.getDefaultExtension()).thenReturn("ktr");
when(meta.getSpecificationMethod()).thenReturn(ObjectLocationSpecificationMethod.REPOSITORY_BY_REFERENCE);
// don't bother running the connectX methods, we'll test those later
doNothing().when(spyAnalyzer).connectToSubTransInputFields(eq(meta), any(TransMeta.class), any(IMetaverseNode.class), any(IComponentDescriptor.class));
doNothing().when(spyAnalyzer).connectToSubTransOutputFields(eq(meta), any(TransMeta.class), any(IMetaverseNode.class), any(IComponentDescriptor.class));
spyAnalyzer.customAnalyze(meta, node);
verify(node).setProperty(eq(TransExecutorStepAnalyzer.TRANSFORMATION_TO_EXECUTE), Mockito.contains("/home/admin/my.ktr"));
// we should have one link created that "executes" the sub transformation
verify(builder, times(1)).addLink(eq(node), eq(DictionaryConst.LINK_EXECUTES), any(IMetaverseNode.class));
}
Aggregations