Search in sources :

Example 41 with LogChannel

use of org.pentaho.di.core.logging.LogChannel in project pentaho-kettle by pentaho.

the class MasterSlaveIT method createLogChannel.

private static LogChannel createLogChannel(String string) {
    LogChannel logChannel = new LogChannel(string);
    logChannel.setLogLevel(LogLevel.BASIC);
    return logChannel;
}
Also used : LogChannel(org.pentaho.di.core.logging.LogChannel)

Example 42 with LogChannel

use of org.pentaho.di.core.logging.LogChannel in project pentaho-kettle by pentaho.

the class PartitioningIT method testClusteringWithPartitioningOnMaster.

/**
 * See PDI-12766
 *
 * @throws Exception
 */
public void testClusteringWithPartitioningOnMaster() throws Exception {
    init();
    ClusterGenerator clusterGenerator = new ClusterGenerator();
    LogChannel log = new LogChannel("cluster unit test <test-partitioning-on-master-and-clustering>");
    try {
        clusterGenerator.launchSlaveServers();
        TransMeta transMeta = loadAndModifyTestTransformation(clusterGenerator, "src/it/resources/org/pentaho/di/cluster/test-partitioning-on-master-and-clustering.ktr");
        TransExecutionConfiguration config = createClusteredTransExecutionConfiguration();
        TransSplitter transSplitter = Trans.executeClustered(transMeta, config);
        long nrErrors = Trans.monitorClusteredTransformation(log, transSplitter, null);
        assertEquals(0L, nrErrors);
    } catch (Exception e) {
        e.printStackTrace();
        fail(e.toString());
    } finally {
        try {
            clusterGenerator.stopSlaveServers();
        } catch (Exception e) {
            e.printStackTrace();
            fail(e.toString());
        }
    }
}
Also used : TransExecutionConfiguration(org.pentaho.di.trans.TransExecutionConfiguration) TransMeta(org.pentaho.di.trans.TransMeta) LogChannel(org.pentaho.di.core.logging.LogChannel) TransSplitter(org.pentaho.di.trans.cluster.TransSplitter)

Example 43 with LogChannel

use of org.pentaho.di.core.logging.LogChannel in project pentaho-platform by pentaho.

the class DIServerConfigTest method setup.

@Before
public void setup() throws Exception {
    IApplicationContext mockAppContext = mock(IApplicationContext.class);
    when(mockAppContext.getFullyQualifiedServerURL()).thenReturn(SERVER_URL);
    PentahoSystem.setApplicationContext(mockAppContext);
    IPentahoSession pentahoSession = mock(IPentahoSession.class);
    when(pentahoSession.getName()).thenReturn(MOCK_USER);
    PentahoSessionHolder.setSession(pentahoSession);
    baseConfig = new SlaveServerConfig();
    pluginRegistry = mock(PluginRegistry.class);
    purRepositoryMeta = mock(RepositoryMeta.class);
    purRepository = mock(Repository.class);
    purMetaStore = mock(IMetaStore.class);
    when(pluginRegistry.loadClass(RepositoryPluginType.class, DIServerConfig.PUR_REPOSITORY_PLUGIN_ID, Repository.class)).thenReturn(purRepository);
    when(pluginRegistry.loadClass(RepositoryPluginType.class, DIServerConfig.PUR_REPOSITORY_PLUGIN_ID, RepositoryMeta.class)).thenReturn(purRepositoryMeta);
    when(purRepository.getMetaStore()).thenReturn(purMetaStore);
    when(purMetaStore.getName()).thenReturn("Mock MetaStore");
    logChannel = mock(LogChannel.class);
}
Also used : RepositoryMeta(org.pentaho.di.repository.RepositoryMeta) Repository(org.pentaho.di.repository.Repository) IPentahoSession(org.pentaho.platform.api.engine.IPentahoSession) PluginRegistry(org.pentaho.di.core.plugins.PluginRegistry) LogChannel(org.pentaho.di.core.logging.LogChannel) IApplicationContext(org.pentaho.platform.api.engine.IApplicationContext) SlaveServerConfig(org.pentaho.di.www.SlaveServerConfig) IMetaStore(org.pentaho.metastore.api.IMetaStore) Before(org.junit.Before)

Example 44 with LogChannel

use of org.pentaho.di.core.logging.LogChannel in project pentaho-platform by pentaho.

the class KettleSystemListener method startup.

public boolean startup(final IPentahoSession session) {
    // Default DI_HOME System Property if not set
    if (StringUtils.isEmpty(System.getProperty("DI_HOME"))) {
        String defaultKettleHomePath = PentahoSystem.getApplicationContext().getSolutionPath("system" + File.separator + "kettle");
        logger.error("DI_HOME System Property not properly set. The default location of " + defaultKettleHomePath + " will be used.");
        System.setProperty("DI_HOME", defaultKettleHomePath);
    }
    if (usePlatformLogFile) {
        KettleLogStore.init(false, false);
        initLogging();
    }
    hookInDataSourceProvider();
    try {
        KettleSystemListener.environmentInit(session);
    } catch (Throwable t) {
        t.printStackTrace();
        Logger.error(KettleSystemListener.class.getName(), Messages.getInstance().getErrorString(// $NON-NLS-1$
        "KettleSystemListener.ERROR_0001_PLUGIN_LOAD_FAILED"));
    }
    try {
        String slaveServerConfigFilename = // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
        "system" + File.separator + "kettle" + File.separator + "slave-server-config.xml";
        File slaveServerConfigFile = new File(PentahoSystem.getApplicationContext().getSolutionPath(slaveServerConfigFilename));
        if (slaveServerConfigFile.exists()) {
            InputStream is = new FileInputStream(slaveServerConfigFile);
            Node configNode = getSlaveServerConfigNode(is);
            SlaveServerConfig config = new DIServerConfig(new LogChannel("Slave server config"), configNode);
            config.setFilename(slaveServerConfigFile.getAbsolutePath());
            SlaveServer slaveServer = new SlaveServer();
            config.setSlaveServer(slaveServer);
            CarteSingleton.setSlaveServerConfig(config);
        }
    } catch (Throwable t) {
        t.printStackTrace();
        Logger.error(KettleSystemListener.class.getName(), t.getMessage());
    }
    return true;
}
Also used : FileInputStream(java.io.FileInputStream) InputStream(java.io.InputStream) Node(org.w3c.dom.Node) LogChannel(org.pentaho.di.core.logging.LogChannel) SlaveServerConfig(org.pentaho.di.www.SlaveServerConfig) SlaveServer(org.pentaho.di.cluster.SlaveServer) File(java.io.File) FileInputStream(java.io.FileInputStream)

Aggregations

LogChannel (org.pentaho.di.core.logging.LogChannel)44 TransMeta (org.pentaho.di.trans.TransMeta)17 TransExecutionConfiguration (org.pentaho.di.trans.TransExecutionConfiguration)13 TransSplitter (org.pentaho.di.trans.cluster.TransSplitter)13 Test (org.junit.Test)8 File (java.io.File)6 LogChannelInterface (org.pentaho.di.core.logging.LogChannelInterface)6 Before (org.junit.Before)4 Repository (org.pentaho.di.repository.Repository)4 Node (org.w3c.dom.Node)4 IOException (java.io.IOException)3 FileObject (org.apache.commons.vfs2.FileObject)3 InvocationOnMock (org.mockito.invocation.InvocationOnMock)3 SlaveServer (org.pentaho.di.cluster.SlaveServer)3 FileInputStream (java.io.FileInputStream)2 InputStream (java.io.InputStream)2 ArrayList (java.util.ArrayList)2 Display (org.eclipse.swt.widgets.Display)2 Matchers.anyObject (org.mockito.Matchers.anyObject)2 KettleException (org.pentaho.di.core.exception.KettleException)2