use of org.pentaho.di.core.database.DatabaseMeta in project pentaho-kettle by pentaho.
the class KettleDatabaseRepositoryCreationHelperTest method testDefaultDBRepoStringLength.
@Test
public void testDefaultDBRepoStringLength() throws Exception {
KettleEnvironment.init();
DatabaseMeta databaseMeta = new DatabaseMeta();
databaseMeta.setDatabaseInterface(new TestDatabaseMeta());
repositoryMeta = new KettleDatabaseRepositoryMeta("KettleDatabaseRepository", "TestRepo", "Test Repository", databaseMeta);
repository = new KettleDatabaseRepository();
repository.init(repositoryMeta);
KettleDatabaseRepositoryCreationHelper helper = new KettleDatabaseRepositoryCreationHelper(repository);
int repoStringLength = helper.getRepoStringLength();
assertEquals(EXPECTED_DEFAULT_DB_REPO_STRING, repoStringLength);
}
use of org.pentaho.di.core.database.DatabaseMeta in project pentaho-kettle by pentaho.
the class JobEntrySetVariablesTest method testJobEntrySetVariablesExecute_VARIABLE_TYPE_CURRENT_JOB_NullVariable.
@Test
public void testJobEntrySetVariablesExecute_VARIABLE_TYPE_CURRENT_JOB_NullVariable() throws Exception {
List<DatabaseMeta> databases = mock(List.class);
List<SlaveServer> slaveServers = mock(List.class);
Repository repository = mock(Repository.class);
IMetaStore metaStore = mock(IMetaStore.class);
entry.loadXML(getEntryNode("nullVariable", null, "CURRENT_JOB"), databases, slaveServers, repository, metaStore);
Result result = entry.execute(new Result(), 0);
assertTrue("Result should be true", result.getResult());
assertNull(entry.getVariable("nullVariable"));
}
use of org.pentaho.di.core.database.DatabaseMeta in project pentaho-kettle by pentaho.
the class DataHandler method getOptionHelp.
public void getOptionHelp() {
String message = null;
DatabaseMeta database = new DatabaseMeta();
getInfo(database);
String url = database.getExtraOptionsHelpText();
if ((url == null) || (url.trim().length() == 0)) {
message = Messages.getString("DataHandler.USER_NO_HELP_AVAILABLE");
showMessage(message, false);
return;
}
Status status = Launch.openURL(url);
if (status.equals(Status.Failed)) {
message = Messages.getString("DataHandler.USER_UNABLE_TO_LAUNCH_BROWSER", url);
showMessage(message, false);
}
}
use of org.pentaho.di.core.database.DatabaseMeta in project pentaho-kettle by pentaho.
the class DataHandler method onOK.
public void onOK() {
DatabaseMeta database = new DatabaseMeta();
this.getInfo(database);
boolean passed = checkPoolingParameters();
if (!passed) {
return;
}
String[] remarks = database.checkParameters();
String message = "";
if (remarks.length != 0) {
for (int i = 0; i < remarks.length; i++) {
message = message.concat("* ").concat(remarks[i]).concat(System.getProperty("line.separator"));
}
showMessage(message, false);
} else {
if (databaseMeta == null) {
databaseMeta = new DatabaseMeta();
}
this.getInfo(databaseMeta);
databaseMeta.setChanged();
close();
}
}
use of org.pentaho.di.core.database.DatabaseMeta in project pentaho-kettle by pentaho.
the class PrivateDatabasesTestTemplate method createInjectingAnswer.
protected Answer<SharedObjects> createInjectingAnswer(final T meta, final SharedObjects fakeSharedObjects) throws Exception {
return new Answer<SharedObjects>() {
@Override
public SharedObjects answer(InvocationOnMock invocation) throws Throwable {
for (SharedObjectInterface value : fakeSharedObjects.getObjectsMap().values()) {
DatabaseMeta db = (DatabaseMeta) value;
meta.addOrReplaceDatabase(db);
}
return fakeSharedObjects;
}
};
}
Aggregations