use of org.pentaho.di.resource.ResourceNamingInterface in project pentaho-kettle by pentaho.
the class XMLOutputMetaTest method testExportResources.
@Test
public void testExportResources() throws Exception {
XMLOutputMeta xmlOutputMeta = new XMLOutputMeta();
xmlOutputMeta.setDefault();
ResourceNamingInterface resourceNamingInterface = mock(ResourceNamingInterface.class);
Variables space = new Variables();
when(resourceNamingInterface.nameResource(any(FileObject.class), eq(space), eq(true))).thenReturn("exportFile");
xmlOutputMeta.exportResources(space, null, resourceNamingInterface, null, null);
assertEquals("exportFile", xmlOutputMeta.getFileName());
}
use of org.pentaho.di.resource.ResourceNamingInterface in project pentaho-kettle by pentaho.
the class MetaInjectMetaTest method exportResources.
@Test
public void exportResources() throws KettleException {
VariableSpace variableSpace = mock(VariableSpace.class);
ResourceNamingInterface resourceNamingInterface = mock(ResourceNamingInterface.class);
Repository repository = mock(Repository.class);
IMetaStore metaStore = mock(IMetaStore.class);
MetaInjectMeta injectMetaSpy = spy(metaInjectMeta);
TransMeta transMeta = mock(TransMeta.class);
Map<String, ResourceDefinition> definitions = Collections.<String, ResourceDefinition>emptyMap();
doReturn(TEST_FILE_NAME).when(transMeta).exportResources(transMeta, definitions, resourceNamingInterface, repository, metaStore);
doReturn(transMeta).when(injectMetaSpy).loadTransformationMeta(repository, variableSpace);
String actualExportedFileName = injectMetaSpy.exportResources(variableSpace, definitions, resourceNamingInterface, repository, metaStore);
assertEquals(TEST_FILE_NAME, actualExportedFileName);
assertEquals(EXPORTED_FILE_NAME, injectMetaSpy.getFileName());
verify(transMeta).exportResources(transMeta, definitions, resourceNamingInterface, repository, metaStore);
}
Aggregations