use of org.pentaho.metaverse.api.analyzer.kettle.jobentry.IJobEntryAnalyzer in project pentaho-metaverse by pentaho.
the class JobAnalyzerTest method testAnalyzerWithEntriesGenericAnalyzer.
@Test
public void testAnalyzerWithEntriesGenericAnalyzer() throws MetaverseAnalyzerException {
analyzer.setJobEntryAnalyzerProvider(jobEntryAnalyzerProvider);
final List<IJobEntryAnalyzer> jobEntryAnalyzers = null;
when(jobEntryAnalyzerProvider.getAnalyzers(any(Collection.class))).thenReturn(jobEntryAnalyzers);
IMetaverseNode node = analyzer.analyze(descriptor, mockJobDoc);
assertNotNull(node);
}
use of org.pentaho.metaverse.api.analyzer.kettle.jobentry.IJobEntryAnalyzer in project pentaho-metaverse by pentaho.
the class JobAnalyzerTest method testAnalyzerWithEntriesSpecificAnalyzer.
@Test
public void testAnalyzerWithEntriesSpecificAnalyzer() throws MetaverseAnalyzerException {
analyzer.setJobEntryAnalyzerProvider(jobEntryAnalyzerProvider);
final Set<IJobEntryAnalyzer> jobEntryAnalyzers = null;
when(jobEntryAnalyzerProvider.getAnalyzers(any(Collection.class))).thenReturn(new ArrayList<IJobEntryAnalyzer>() {
{
add(mock(IJobEntryAnalyzer.class));
}
});
IMetaverseNode node = analyzer.analyze(descriptor, mockJobDoc);
assertNotNull(node);
}
use of org.pentaho.metaverse.api.analyzer.kettle.jobentry.IJobEntryAnalyzer in project pentaho-metaverse by pentaho.
the class AnalyzerInfoServiceTest method testGetSupportedEntries.
@Test
public void testGetSupportedEntries() throws Exception {
List<IJobEntryAnalyzer> analyzers = new ArrayList<>();
final TransJobEntryAnalyzer transJobEntryAnalyzer = new TransJobEntryAnalyzer();
analyzers.add(transJobEntryAnalyzer);
when(jobEntryAnalyzerProvider.getAnalyzers()).thenReturn(analyzers);
Response supportedJobEntries = service.getSupportedJobEntries();
assertEquals(Response.Status.OK.getStatusCode(), supportedJobEntries.getStatus());
assertNotNull(supportedJobEntries.getEntity());
assertTrue(supportedJobEntries.getEntity() instanceof List);
List<AnalyzerInfo> responseList = (List<AnalyzerInfo>) supportedJobEntries.getEntity();
assertEquals(analyzers.size(), responseList.size());
// should be sorted based on meta name
assertEquals(transJobEntryAnalyzer.getSupportedEntries().iterator().next().getSimpleName(), responseList.get(0).getMeta());
}
use of org.pentaho.metaverse.api.analyzer.kettle.jobentry.IJobEntryAnalyzer in project pentaho-metaverse by pentaho.
the class JobAnalyzer method getJobEntryAnalyzers.
public Set<IJobEntryAnalyzer> getJobEntryAnalyzers(final JobEntryInterface jobEntryInterface) {
Set<IJobEntryAnalyzer> jobEntryAnalyzers = new HashSet<>();
// Attempt to discover a BaseStepMeta from the given StepMeta
jobEntryAnalyzerProvider = getJobEntryAnalyzerProvider();
if (jobEntryAnalyzerProvider != null) {
if (jobEntryInterface == null) {
jobEntryAnalyzers.addAll(jobEntryAnalyzerProvider.getAnalyzers());
} else {
Set<Class<?>> analyzerClassSet = new HashSet<>(1);
analyzerClassSet.add(jobEntryInterface.getClass());
jobEntryAnalyzers.addAll(jobEntryAnalyzerProvider.getAnalyzers(analyzerClassSet));
}
} else {
jobEntryAnalyzers.add(new GenericJobEntryMetaAnalyzer());
}
return jobEntryAnalyzers;
}
use of org.pentaho.metaverse.api.analyzer.kettle.jobentry.IJobEntryAnalyzer in project pentaho-metaverse by pentaho.
the class JobEntryAnalyzerProviderTest method testRemoveAnalyzer_multipleWithTheSameType.
@Test
public void testRemoveAnalyzer_multipleWithTheSameType() throws Exception {
IJobEntryAnalyzer baseStepAnalyzer = mock(IJobEntryAnalyzer.class);
when(baseStepAnalyzer.getSupportedEntries()).thenReturn(Sets.newSet(JobEntryInterface.class));
IJobEntryAnalyzer jobEntryTransAnalyzer = mock(IJobEntryAnalyzer.class);
when(jobEntryTransAnalyzer.getSupportedEntries()).thenReturn(Sets.newSet(JobEntryTrans.class));
IJobEntryAnalyzer jobEntryTransAnalyzer2 = mock(IJobEntryAnalyzer.class);
when(jobEntryTransAnalyzer2.getSupportedEntries()).thenReturn(Sets.newSet(JobEntryTrans.class));
provider.setJobEntryAnalyzers(Lists.newArrayList(baseStepAnalyzer, jobEntryTransAnalyzer, jobEntryTransAnalyzer2));
Set<IJobEntryAnalyzer> tableOutputStepAnalyzers = provider.analyzerTypeMap.get(JobEntryTrans.class);
assertNotNull(tableOutputStepAnalyzers);
assertEquals(tableOutputStepAnalyzers.size(), 2);
provider.removeAnalyzer(jobEntryTransAnalyzer2);
tableOutputStepAnalyzers = provider.analyzerTypeMap.get(JobEntryTrans.class);
assertNotNull(tableOutputStepAnalyzers);
assertEquals(tableOutputStepAnalyzers.size(), 1);
}
Aggregations