use of org.apache.hop.core.logging.LogChannel in project hop by apache.
the class FieldHelperTest method getGetSignature_Serializable.
@Test
public void getGetSignature_Serializable() throws Exception {
LogChannel log = mock(LogChannel.class);
whenNew(LogChannel.class).withAnyArguments().thenReturn(log);
ValueMetaSerializable v = new ValueMetaSerializable("Data");
String accessor = FieldHelper.getAccessor(true, "Data");
assertEquals("Object Data = get(Fields.In, \"Data\").getObject(r);", FieldHelper.getGetSignature(accessor, v));
assertNotNull(getMethod(FieldHelper.class, "getObject", Object[].class));
}
use of org.apache.hop.core.logging.LogChannel in project hop by apache.
the class FieldHelperTest method getNativeDataTypeSimpleName_Unknown.
@Test
public void getNativeDataTypeSimpleName_Unknown() throws Exception {
HopValueException e = new HopValueException();
IValueMeta v = mock(IValueMeta.class);
doThrow(e).when(v).getNativeDataTypeClass();
LogChannel log = mock(LogChannel.class);
whenNew(LogChannel.class).withAnyArguments().thenReturn(log);
assertEquals("Object", FieldHelper.getNativeDataTypeSimpleName(v));
verify(log, times(1)).logDebug("Unable to get name from data type");
}
use of org.apache.hop.core.logging.LogChannel in project hop by apache.
the class HopImport method run.
@Override
public void run() {
try {
log = new LogChannel("HopImport");
if (listPluginTypes != null && listPluginTypes) {
printPluginTypes();
return;
}
if (!validateOptions()) {
cmd.usage(System.err);
return;
}
hopImport = loadImportPlugin();
if (hopImport == null) {
return;
}
log.logDetailed("Start of Hop Import");
// Set the options...
//
hopImport.setValidateInputFolder(inputFolderName);
hopImport.setValidateOutputFolder(outputFolderName);
hopImport.setKettlePropertiesFilename(kettlePropertiesFilename);
hopImport.setJdbcPropertiesFilename(jdbcPropertiesFilename);
hopImport.setSharedXmlFilename(sharedXmlFilename);
if (skippingExistingTargetFiles != null) {
log.logBasic("Import is " + (skippingExistingTargetFiles ? "" : "not ") + "skipping existing target files");
hopImport.setSkippingExistingTargetFiles(skippingExistingTargetFiles);
}
if (skippingHiddenFilesAndFolders != null) {
log.logBasic("Import is " + (skippingHiddenFilesAndFolders ? "" : "not ") + "skipping hidden files and folders");
hopImport.setSkippingHiddenFilesAndFolders(skippingHiddenFilesAndFolders);
}
if (skippingFolders != null) {
log.logBasic("Import is " + (skippingFolders ? "" : "not ") + "skipping sub-folders");
hopImport.setSkippingFolders(skippingFolders);
}
hopImport.setTargetConfigFilename(targetConfigFilename);
// Allow plugins to modify the elements loaded so far, before a pipeline or workflow is even
// loaded
//
ExtensionPointHandler.callExtensionPoint(log, variables, HopExtensionPoint.HopImportStart.id, this);
// Handle the options of the configuration plugins
//
Map<String, Object> mixins = cmd.getMixins();
for (String key : mixins.keySet()) {
Object mixin = mixins.get(key);
if (mixin instanceof IConfigOptions) {
IConfigOptions configOptions = (IConfigOptions) mixin;
configOptions.handleOption(log, this, variables);
}
}
// Text version of a progress monitor...
//
IProgressMonitor monitor = new LogProgressMonitor(log);
// Run the import...
//
hopImport.runImport(monitor);
// Print the report...
//
log.logBasic(Const.CR);
log.logBasic(hopImport.getImportReport());
ExtensionPointHandler.callExtensionPoint(log, variables, HopExtensionPoint.HopImportEnd.id, this);
} catch (Exception e) {
throw new ExecutionException(cmd, "There was an error during import", e);
}
}
use of org.apache.hop.core.logging.LogChannel in project hop by apache.
the class MailConnectionTest method beforeExec.
@Before
public void beforeExec() throws HopException, MessagingException {
Object subj = new Object();
ILogChannel log = new LogChannel(subj);
conn = new Mconn(log);
}
use of org.apache.hop.core.logging.LogChannel in project hop by apache.
the class FileUtilsTest method testCreateParentFolder.
@Test
public void testCreateParentFolder() {
String tempDir = TestUtils.createTempDir();
String suff = tempDir.substring(tempDir.lastIndexOf(File.separator) + 1);
tempDir += File.separator + suff + File.separator + suff;
assertTrue("Dir should be created", FileUtil.createParentFolder(getClass(), tempDir, true, new LogChannel(this)));
File fl = new File(tempDir.substring(0, tempDir.lastIndexOf(File.separator)));
assertTrue("Dir should exist", fl.exists());
fl.delete();
new File(tempDir).delete();
}
Aggregations