Search in sources :

Example 36 with LongObjectId

use of org.pentaho.di.repository.LongObjectId in project pentaho-kettle by pentaho.

the class MemoryRepository method saveDatabaseMetaStepAttribute.

@Override
public void saveDatabaseMetaStepAttribute(ObjectId id_transformation, ObjectId id_step, String code, DatabaseMeta database) throws KettleException {
    ObjectId id = null;
    if (database != null) {
        id = database.getObjectId();
        Long id_database = id == null ? Long.valueOf(-1L) : new LongObjectId(id).longValue();
        saveStepAttribute(id_transformation, id_step, code, id_database);
    }
}
Also used : StringObjectId(org.pentaho.di.repository.StringObjectId) LongObjectId(org.pentaho.di.repository.LongObjectId) ObjectId(org.pentaho.di.repository.ObjectId) LongObjectId(org.pentaho.di.repository.LongObjectId)

Example 37 with LongObjectId

use of org.pentaho.di.repository.LongObjectId in project pentaho-kettle by pentaho.

the class DatabaseMetaLoadSaveValidator method getTestObject.

@Override
public DatabaseMeta getTestObject() {
    DatabaseMeta db = new DatabaseMeta();
    db.setObjectId(new LongObjectId(rand.nextInt(Integer.MAX_VALUE)));
    db.setName(UUID.randomUUID().toString());
    db.setHostname(UUID.randomUUID().toString());
    db.setUsername(UUID.randomUUID().toString());
    db.setPassword(UUID.randomUUID().toString());
    return db;
}
Also used : LongObjectId(org.pentaho.di.repository.LongObjectId) DatabaseMeta(org.pentaho.di.core.database.DatabaseMeta)

Example 38 with LongObjectId

use of org.pentaho.di.repository.LongObjectId in project pentaho-kettle by pentaho.

the class KettleDatabaseRepositoryTest method testInsertTransStepCondition.

@Test
public void testInsertTransStepCondition() throws KettleException {
    ArgumentCaptor<String> argumentTableName = ArgumentCaptor.forClass(String.class);
    ArgumentCaptor<RowMetaAndData> argumentTableData = ArgumentCaptor.forClass(RowMetaAndData.class);
    doNothing().when(repo.connectionDelegate).insertTableRow(argumentTableName.capture(), argumentTableData.capture());
    repo.insertTransStepCondition(new LongObjectId(234), new LongObjectId(567), new LongObjectId(468));
    RowMetaAndData insertRecord = argumentTableData.getValue();
    assertEquals(KettleDatabaseRepository.TABLE_R_TRANS_STEP_CONDITION, argumentTableName.getValue());
    assertEquals(3, insertRecord.size());
    assertEquals(ValueMetaInterface.TYPE_INTEGER, insertRecord.getValueMeta(0).getType());
    assertEquals(KettleDatabaseRepository.FIELD_TRANS_STEP_CONDITION_ID_TRANSFORMATION, insertRecord.getValueMeta(0).getName());
    assertEquals(Long.valueOf(234), insertRecord.getInteger(0));
    assertEquals(ValueMetaInterface.TYPE_INTEGER, insertRecord.getValueMeta(1).getType());
    assertEquals(KettleDatabaseRepository.FIELD_TRANS_STEP_CONDITION_ID_STEP, insertRecord.getValueMeta(1).getName());
    assertEquals(Long.valueOf(567), insertRecord.getInteger(1));
    assertEquals(ValueMetaInterface.TYPE_INTEGER, insertRecord.getValueMeta(2).getType());
    assertEquals(KettleDatabaseRepository.FIELD_TRANS_STEP_CONDITION_ID_CONDITION, insertRecord.getValueMeta(2).getName());
    assertEquals(Long.valueOf(468), insertRecord.getInteger(2));
}
Also used : RowMetaAndData(org.pentaho.di.core.RowMetaAndData) Matchers.anyString(org.mockito.Matchers.anyString) LongObjectId(org.pentaho.di.repository.LongObjectId) Test(org.junit.Test)

Example 39 with LongObjectId

use of org.pentaho.di.repository.LongObjectId in project pentaho-kettle by pentaho.

the class KettleDatabaseRepositoryTest method testInsertTransformationCluster.

@Test
public void testInsertTransformationCluster() throws KettleException {
    ArgumentCaptor<String> argumentTableName = ArgumentCaptor.forClass(String.class);
    ArgumentCaptor<RowMetaAndData> argumentTableData = ArgumentCaptor.forClass(RowMetaAndData.class);
    doNothing().when(repo.connectionDelegate).insertTableRow(argumentTableName.capture(), argumentTableData.capture());
    doReturn(new LongObjectId(123)).when(repo.connectionDelegate).getNextTransformationClusterID();
    ObjectId result = repo.insertTransformationCluster(new LongObjectId(456), new LongObjectId(789));
    RowMetaAndData insertRecord = argumentTableData.getValue();
    assertEquals(KettleDatabaseRepository.TABLE_R_TRANS_CLUSTER, argumentTableName.getValue());
    assertEquals(3, insertRecord.size());
    assertEquals(ValueMetaInterface.TYPE_INTEGER, insertRecord.getValueMeta(0).getType());
    assertEquals(KettleDatabaseRepository.FIELD_TRANS_CLUSTER_ID_TRANS_CLUSTER, insertRecord.getValueMeta(0).getName());
    assertEquals(Long.valueOf(123), insertRecord.getInteger(0));
    assertEquals(ValueMetaInterface.TYPE_INTEGER, insertRecord.getValueMeta(1).getType());
    assertEquals(KettleDatabaseRepository.FIELD_TRANS_CLUSTER_ID_TRANSFORMATION, insertRecord.getValueMeta(1).getName());
    assertEquals(Long.valueOf(456), insertRecord.getInteger(1));
    assertEquals(ValueMetaInterface.TYPE_INTEGER, insertRecord.getValueMeta(2).getType());
    assertEquals(KettleDatabaseRepository.FIELD_TRANS_CLUSTER_ID_CLUSTER, insertRecord.getValueMeta(2).getName());
    assertEquals(Long.valueOf(789), insertRecord.getInteger(2));
    assertEquals(new LongObjectId(123), result);
}
Also used : RowMetaAndData(org.pentaho.di.core.RowMetaAndData) LongObjectId(org.pentaho.di.repository.LongObjectId) ObjectId(org.pentaho.di.repository.ObjectId) Matchers.anyString(org.mockito.Matchers.anyString) LongObjectId(org.pentaho.di.repository.LongObjectId) Test(org.junit.Test)

Example 40 with LongObjectId

use of org.pentaho.di.repository.LongObjectId in project pentaho-kettle by pentaho.

the class KettleDatabaseRepositoryTest method testInsertTransNote.

@Test
public void testInsertTransNote() throws KettleException {
    ArgumentCaptor<String> argumentTableName = ArgumentCaptor.forClass(String.class);
    ArgumentCaptor<RowMetaAndData> argumentTableData = ArgumentCaptor.forClass(RowMetaAndData.class);
    doNothing().when(repo.connectionDelegate).insertTableRow(argumentTableName.capture(), argumentTableData.capture());
    repo.insertTransNote(new LongObjectId(456), new LongObjectId(789));
    RowMetaAndData insertRecord = argumentTableData.getValue();
    assertEquals(KettleDatabaseRepository.TABLE_R_TRANS_NOTE, argumentTableName.getValue());
    assertEquals(2, insertRecord.size());
    assertEquals(ValueMetaInterface.TYPE_INTEGER, insertRecord.getValueMeta(0).getType());
    assertEquals(KettleDatabaseRepository.FIELD_TRANS_NOTE_ID_TRANSFORMATION, insertRecord.getValueMeta(0).getName());
    assertEquals(Long.valueOf(456), insertRecord.getInteger(0));
    assertEquals(ValueMetaInterface.TYPE_INTEGER, insertRecord.getValueMeta(1).getType());
    assertEquals(KettleDatabaseRepository.FIELD_TRANS_NOTE_ID_NOTE, insertRecord.getValueMeta(1).getName());
    assertEquals(Long.valueOf(789), insertRecord.getInteger(1));
}
Also used : RowMetaAndData(org.pentaho.di.core.RowMetaAndData) Matchers.anyString(org.mockito.Matchers.anyString) LongObjectId(org.pentaho.di.repository.LongObjectId) Test(org.junit.Test)

Aggregations

LongObjectId (org.pentaho.di.repository.LongObjectId)81 RowMetaAndData (org.pentaho.di.core.RowMetaAndData)54 ValueMetaString (org.pentaho.di.core.row.value.ValueMetaString)36 ObjectId (org.pentaho.di.repository.ObjectId)30 KettleException (org.pentaho.di.core.exception.KettleException)18 Test (org.junit.Test)17 ValueMetaInteger (org.pentaho.di.core.row.value.ValueMetaInteger)17 KettleDatabaseException (org.pentaho.di.core.exception.KettleDatabaseException)14 Matchers.anyString (org.mockito.Matchers.anyString)10 MetaStoreException (org.pentaho.metastore.api.exceptions.MetaStoreException)10 ArrayList (java.util.ArrayList)9 RepositoryDirectory (org.pentaho.di.repository.RepositoryDirectory)9 RepositoryObject (org.pentaho.di.repository.RepositoryObject)8 MetaStoreDependenciesExistsException (org.pentaho.metastore.api.exceptions.MetaStoreDependenciesExistsException)8 MetaStoreElementExistException (org.pentaho.metastore.api.exceptions.MetaStoreElementExistException)8 MetaStoreElementTypeExistsException (org.pentaho.metastore.api.exceptions.MetaStoreElementTypeExistsException)8 MetaStoreNamespaceExistsException (org.pentaho.metastore.api.exceptions.MetaStoreNamespaceExistsException)8 SimpleLoggingObject (org.pentaho.di.core.logging.SimpleLoggingObject)7 RowMetaInterface (org.pentaho.di.core.row.RowMetaInterface)7 StringObjectId (org.pentaho.di.repository.StringObjectId)7