Search in sources :

Example 96 with DatabaseMeta

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);
}
Also used : DatabaseMeta(org.pentaho.di.core.database.DatabaseMeta) OracleDatabaseMeta(org.pentaho.di.core.database.OracleDatabaseMeta) Test(org.junit.Test)

Example 97 with DatabaseMeta

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"));
}
Also used : Repository(org.pentaho.di.repository.Repository) SlaveServer(org.pentaho.di.cluster.SlaveServer) DatabaseMeta(org.pentaho.di.core.database.DatabaseMeta) IMetaStore(org.pentaho.metastore.api.IMetaStore) Result(org.pentaho.di.core.Result) Test(org.junit.Test)

Example 98 with DatabaseMeta

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);
    }
}
Also used : Status(org.pentaho.ui.util.Launch.Status) DatabaseMeta(org.pentaho.di.core.database.DatabaseMeta) MSSQLServerNativeDatabaseMeta(org.pentaho.di.core.database.MSSQLServerNativeDatabaseMeta) PartitionDatabaseMeta(org.pentaho.di.core.database.PartitionDatabaseMeta) GenericDatabaseMeta(org.pentaho.di.core.database.GenericDatabaseMeta) OracleDatabaseMeta(org.pentaho.di.core.database.OracleDatabaseMeta) BaseDatabaseMeta(org.pentaho.di.core.database.BaseDatabaseMeta)

Example 99 with DatabaseMeta

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();
    }
}
Also used : DatabaseMeta(org.pentaho.di.core.database.DatabaseMeta) MSSQLServerNativeDatabaseMeta(org.pentaho.di.core.database.MSSQLServerNativeDatabaseMeta) PartitionDatabaseMeta(org.pentaho.di.core.database.PartitionDatabaseMeta) GenericDatabaseMeta(org.pentaho.di.core.database.GenericDatabaseMeta) OracleDatabaseMeta(org.pentaho.di.core.database.OracleDatabaseMeta) BaseDatabaseMeta(org.pentaho.di.core.database.BaseDatabaseMeta)

Example 100 with DatabaseMeta

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;
        }
    };
}
Also used : Answer(org.mockito.stubbing.Answer) InvocationOnMock(org.mockito.invocation.InvocationOnMock) SharedObjectInterface(org.pentaho.di.shared.SharedObjectInterface) DatabaseMeta(org.pentaho.di.core.database.DatabaseMeta)

Aggregations

DatabaseMeta (org.pentaho.di.core.database.DatabaseMeta)522 Test (org.junit.Test)133 KettleException (org.pentaho.di.core.exception.KettleException)131 Database (org.pentaho.di.core.database.Database)88 MessageBox (org.eclipse.swt.widgets.MessageBox)66 ErrorDialog (org.pentaho.di.ui.core.dialog.ErrorDialog)63 TransMeta (org.pentaho.di.trans.TransMeta)57 StepMeta (org.pentaho.di.trans.step.StepMeta)54 ArrayList (java.util.ArrayList)53 KettleDatabaseException (org.pentaho.di.core.exception.KettleDatabaseException)48 RowMetaInterface (org.pentaho.di.core.row.RowMetaInterface)44 ValueMetaString (org.pentaho.di.core.row.value.ValueMetaString)42 SlaveServer (org.pentaho.di.cluster.SlaveServer)33 IMetaStore (org.pentaho.metastore.api.IMetaStore)30 ObjectId (org.pentaho.di.repository.ObjectId)29 DatabaseExplorerDialog (org.pentaho.di.ui.core.database.dialog.DatabaseExplorerDialog)29 JobMeta (org.pentaho.di.job.JobMeta)26 TransHopMeta (org.pentaho.di.trans.TransHopMeta)26 RowMetaAndData (org.pentaho.di.core.RowMetaAndData)24 PluginRegistry (org.pentaho.di.core.plugins.PluginRegistry)24