use of org.pentaho.di.www.SlaveServerConfig 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);
}
use of org.pentaho.di.www.SlaveServerConfig 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;
}
Aggregations