Java Code Examples for org.pentaho.di.core.database.DatabaseMeta#setHostname()

The following examples show how to use org.pentaho.di.core.database.DatabaseMeta#setHostname() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RepositoryTestBase.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
protected DatabaseMeta createDatabaseMeta( final String dbName ) throws Exception {
  DatabaseMeta dbMeta = new DatabaseMeta();
  dbMeta.setName( dbName );
  dbMeta.setHostname( EXP_DBMETA_HOSTNAME );
  dbMeta.setDatabaseType( EXP_DBMETA_TYPE );
  dbMeta.setAccessType( EXP_DBMETA_ACCESS );
  dbMeta.setDBName( EXP_DBMETA_DBNAME );
  dbMeta.setDBPort( EXP_DBMETA_PORT );
  dbMeta.setUsername( EXP_DBMETA_USERNAME );
  dbMeta.setPassword( EXP_DBMETA_PASSWORD );
  dbMeta.setServername( EXP_DBMETA_SERVERNAME );
  dbMeta.setDataTablespace( EXP_DBMETA_DATA_TABLESPACE );
  dbMeta.setIndexTablespace( EXP_DBMETA_INDEX_TABLESPACE );
  // Properties attrs = new Properties();
  // exposed mutable state; yikes
  dbMeta.getAttributes().put( EXP_DBMETA_ATTR1_KEY, EXP_DBMETA_ATTR1_VALUE );
  dbMeta.getAttributes().put( EXP_DBMETA_ATTR2_KEY, EXP_DBMETA_ATTR2_VALUE );
  // TODO mlowery more testing on DatabaseMeta options
  return dbMeta;
}
 
Example 2
Source File: RepositoryTestBase.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
@Test
public void testVersions() throws Exception {
  IRevisionService service = (IRevisionService) repository.getService( IRevisionService.class );
  DatabaseMeta dbMeta = createDatabaseMeta( EXP_DBMETA_NAME );
  repository.save( dbMeta, VERSION_COMMENT_V1, null );
  deleteStack.push( dbMeta );
  List<ObjectRevision> revs = service.getRevisions( dbMeta );
  assertTrue( revs.size() >= 1 );
  dbMeta.setHostname( EXP_DBMETA_HOSTNAME_V2 );
  repository.save( dbMeta, VERSION_COMMENT_V2, null );
  revs = service.getRevisions( dbMeta );
  assertTrue( revs.size() >= 2 );

  // RepositoryVersionRegistry vReg = repository.getVersionRegistry();
  // assertEquals(0, vReg.getVersions().size());
  // vReg.addVersion(new SimpleObjectVersion(EXP_OBJECT_VERSION_LABEL, null, null, null));
  // assertEquals(2, versions.size());
  // assertEquals("1.0", versions.get(0).getLabel());
  // assertEquals("1.1", versions.get(1).getLabel());

  // TODO mlowery finish me
}
 
Example 3
Source File: TransMetaTest.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
@Test
public void testDatabaseNotOverridden() throws Exception {
  final String name = "db meta";

  DatabaseMeta dbMetaShared = new DatabaseMeta();
  dbMetaShared.setName( name );
  dbMetaShared.setHostname( "host" );
  DatabaseMeta dbMetaStore = new DatabaseMeta();
  dbMetaStore.setName( name );
  dbMetaStore.setHostname( "anotherhost" );
  IMetaStore mstore = new MemoryMetaStore();
  DatabaseMetaStoreUtil.createDatabaseElement( mstore, dbMetaStore );

  TransMeta trans = new TransMeta();
  trans.addOrReplaceDatabase( dbMetaShared );
  trans.setMetaStore( mstore );
  trans.importFromMetaStore();
  DatabaseMeta dbMeta = trans.findDatabase( name );
  assertEquals( dbMetaShared.getHostname(), dbMeta.getHostname() );
}
 
Example 4
Source File: SharedObjectSyncUtilTest.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
@Test
public void synchronizeConnections_should_not_sync_unshared() throws Exception {
  final String databaseName = "DB";
  JobMeta job1 = createJobMeta();
  DatabaseMeta sharedDB1 = createDatabaseMeta( databaseName, true );
  job1.addDatabase( sharedDB1 );
  spoonDelegates.jobs.addJob( job1 );
  DatabaseMeta db2 = createDatabaseMeta( databaseName, false );
  JobMeta job2 = createJobMeta();
  spoonDelegates.jobs.addJob( job2 );
  job2.addDatabase( db2 );

  db2.setHostname( AFTER_SYNC_VALUE );
  sharedUtil.synchronizeConnections( db2, db2.getName() );
  assertThat( sharedDB1.getHostname(), equalTo( BEFORE_SYNC_VALUE ) );
}
 
Example 5
Source File: SharedObjectSyncUtilTest.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
@Test
public void synchronizeConnections() throws Exception {
  final String databaseName = "SharedDB";
  DatabaseMeta sharedDB0 = createDatabaseMeta( databaseName, true );
  saveSharedObjects( SHARED_OBJECTS_FILE, sharedDB0 );


  JobMeta job1 = createJobMeta();

  spoonDelegates.jobs.addJob( job1 );
  JobMeta job2 = createJobMeta();
  spoonDelegates.jobs.addJob( job2 );

  DatabaseMeta sharedDB2 = job2.getDatabase( 0 );
  assertEquals( databaseName, sharedDB2.getName() );
  DatabaseMeta sharedDB1 = job1.getDatabase( 0 );
  assertEquals( databaseName, sharedDB1.getName() );
  assertTrue( sharedDB1 != sharedDB2 );

  assertThat( sharedDB1.getHostname(), equalTo( BEFORE_SYNC_VALUE ) );
  sharedDB2.setHostname( AFTER_SYNC_VALUE );
  sharedUtil.synchronizeConnections( sharedDB2, sharedDB2.getName() );

  assertThat( sharedDB1.getHostname(), equalTo( AFTER_SYNC_VALUE ) );
}
 
Example 6
Source File: EditConnectionListenerTest.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
private static DatabaseMeta createDefaultDatabase( boolean sharedDb ) {
  DatabaseMeta existing = new DatabaseMeta();
  existing.setName( TEST_NAME );
  existing.setHostname( TEST_HOST );
  existing.setShared( sharedDb );
  return existing;
}
 
Example 7
Source File: SharedObjectSyncUtilTest.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
@Test
public void synchronizeConnectionsOpenNew() throws Exception {
  final String databaseName = "SharedDB";
  DatabaseMeta sharedDB0 = createDatabaseMeta( databaseName, true );
  saveSharedObjects( SHARED_OBJECTS_FILE, sharedDB0 );


  JobMeta job1 = createJobMeta();
  spoonDelegates.jobs.addJob( job1 );
  DatabaseMeta sharedDB1 = job1.getDatabase( 0 );

  JobMeta job2 = createJobMeta();
  spoonDelegates.jobs.addJob( job2 );
  DatabaseMeta sharedDB2 = job2.getDatabase( 0 );


  assertThat( sharedDB1.getHostname(), equalTo( BEFORE_SYNC_VALUE ) );
  sharedDB2.setHostname( AFTER_SYNC_VALUE );
  sharedUtil.synchronizeConnections( sharedDB2, sharedDB2.getName() );

  assertThat( sharedDB1.getHostname(), equalTo( AFTER_SYNC_VALUE ) );

  JobMeta job3 = createJobMeta();
  spoonDelegates.jobs.addJob( job3 );
  DatabaseMeta sharedDB3 = job3.getDatabase( 0 );
  assertThat( sharedDB3.getHostname(), equalTo( AFTER_SYNC_VALUE ) );
}
 
Example 8
Source File: SharedObjectSyncUtilTest.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
@Test
public void synchronizeConnections_use_case_sensitive_name() throws Exception {
  JobMeta job1 = createJobMeta();
  DatabaseMeta sharedDB1 = createDatabaseMeta( "DB", true );
  job1.addDatabase( sharedDB1 );
  spoonDelegates.jobs.addJob( job1 );
  DatabaseMeta sharedDB2 = createDatabaseMeta( "Db", true );
  JobMeta job2 = createJobMeta();
  spoonDelegates.jobs.addJob( job2 );
  job2.addDatabase( sharedDB2 );

  sharedDB2.setHostname( AFTER_SYNC_VALUE );
  sharedUtil.synchronizeConnections( sharedDB2, sharedDB2.getName() );
  assertThat( sharedDB1.getHostname(), equalTo( BEFORE_SYNC_VALUE ) );
}
 
Example 9
Source File: SharedObjectSyncUtilTest.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
@Test
public void synchronizeConnections_sync_shared_only() throws Exception {
  final String databaseName = "DB";
  DatabaseMeta sharedDB0 = createDatabaseMeta( databaseName, true );

  saveSharedObjects( SHARED_OBJECTS_FILE, sharedDB0 );

  JobMeta job1 = createJobMeta();
  DatabaseMeta sharedDB1 = job1.getDatabase( 0 );

  spoonDelegates.jobs.addJob( job1 );

  DatabaseMeta unsharedDB2 = createDatabaseMeta( databaseName, false );
  JobMeta job2 = createJobMeta();
  spoonDelegates.jobs.addJob( job2 );
  job2.removeDatabase( 0 );
  job2.addDatabase( unsharedDB2 );

  JobMeta job3 = createJobMeta();
  DatabaseMeta sharedDB3 = job3.getDatabase( 0 );
  spoonDelegates.jobs.addJob( job3 );
  job3.addDatabase( sharedDB3 );

  sharedDB3.setHostname( AFTER_SYNC_VALUE );
  sharedUtil.synchronizeConnections( sharedDB3, sharedDB3.getName() );
  assertThat( sharedDB1.getHostname(), equalTo( AFTER_SYNC_VALUE ) );
  assertThat( unsharedDB2.getHostname(), equalTo( BEFORE_SYNC_VALUE ) );
}
 
Example 10
Source File: BaseStepDialog_ConnectionLine_Test.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
@Override
public String answer( InvocationOnMock invocation ) throws Throwable {
  DatabaseMeta meta = (DatabaseMeta) invocation.getArguments()[ 0 ];
  meta.setName( name );
  meta.setHostname( host );
  return name;
}
 
Example 11
Source File: CwmSchemaFactory.java    From pentaho-metadata with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * Read a DatabaseMeta from a CWM model by providing the catalog reference.
 *
 * @param cwm
 * @param catalog
 * @return a new DatabaseMeta instance, read from the specified CWM model.
 */
public DatabaseMeta getDatabaseMeta( CWM cwm, CwmCatalog catalog ) {
  DatabaseMeta databaseMeta = new DatabaseMeta();

  databaseMeta.setName( catalog.getName() );

  databaseMeta.setHostname( cwm.getFirstTaggedValue( catalog, CWM.TAG_DATABASE_SERVER ) );
  databaseMeta.setDatabaseType( cwm.getFirstTaggedValue( catalog, CWM.TAG_DATABASE_TYPE ) );
  databaseMeta.setAccessType( DatabaseMeta
    .getAccessType( cwm.getFirstTaggedValue( catalog, CWM.TAG_DATABASE_ACCESS ) ) );
  databaseMeta.setDBName( cwm.getFirstTaggedValue( catalog, CWM.TAG_DATABASE_DATABASE ) );
  databaseMeta.setDBPort( cwm.getFirstTaggedValue( catalog, CWM.TAG_DATABASE_PORT ) );
  databaseMeta.setUsername( cwm.getFirstTaggedValue( catalog, CWM.TAG_DATABASE_USERNAME ) );
  databaseMeta.setPassword( cwm.getFirstTaggedValue( catalog, CWM.TAG_DATABASE_PASSWORD ) );
  databaseMeta.setServername( cwm.getFirstTaggedValue( catalog, CWM.TAG_DATABASE_SERVERNAME ) );
  databaseMeta.setDataTablespace( cwm.getFirstTaggedValue( catalog, CWM.TAG_DATABASE_DATA_TABLESPACE ) );
  databaseMeta.setIndexTablespace( cwm.getFirstTaggedValue( catalog, CWM.TAG_DATABASE_INDEX_TABLESPACE ) );

  // And now load the attributes...
  CwmTaggedValue[] taggedValue = cwm.getTaggedValues( catalog );
  for ( int i = 0; i < taggedValue.length; i++ ) {
    if ( taggedValue[ i ].getTag().startsWith( CWM.TAG_DATABASE_ATTRIBUTE_PREFIX ) ) {
      String key = taggedValue[ i ].getTag().substring( CWM.TAG_DATABASE_ATTRIBUTE_PREFIX.length() );
      String attribute = taggedValue[ i ].getValue();

      // Add the attribute
      databaseMeta.getAttributes().put( key, attribute );
    }
  }

  return databaseMeta;
}
 
Example 12
Source File: EditConnectionListenerTest.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
@Override
public String answer( InvocationOnMock invocation ) throws Throwable {
  DatabaseMeta meta = (DatabaseMeta) invocation.getArguments()[0];
  meta.setName( name );
  meta.setHostname( host );
  return name;
}
 
Example 13
Source File: JobEntryDialog_ConnectionLine_Test.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
@Override
public String answer( InvocationOnMock invocation ) throws Throwable {
  DatabaseMeta meta = (DatabaseMeta) invocation.getArguments()[ 0 ];
  meta.setName( name );
  meta.setHostname( host );
  return name;
}
 
Example 14
Source File: DatabaseMetaLoadSaveValidator.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
@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;
}
 
Example 15
Source File: ThinModelConverter.java    From pentaho-metadata with GNU Lesser General Public License v2.1 5 votes vote down vote up
public static DatabaseMeta convertToLegacy( String name, SqlDataSource datasource ) {
  // make sure that the Kettle environment is initialized before DatabaseMeta creation
  try {
    KettleEnvironment.init( false );
  } catch ( KettleException e ) {
    logger.error( "Error initializing the Kettle Environment", e );
    throw new RuntimeException( "Error initializing the Kettle Environment", e );
  }

  DatabaseMeta databaseMeta = new DatabaseMeta();

  databaseMeta.setName( name );

  databaseMeta.setHostname( datasource.getHostname() );
  if ( datasource.getDialectType() == null ) {
    // default to mysql if dialect is null
    databaseMeta.setDatabaseType( "GENERIC" ); //$NON-NLS-1$
  } else {
    databaseMeta.setDatabaseType( datasource.getDialectType() );
  }
  databaseMeta.setAccessType( DatabaseMeta.getAccessType( datasource.getType().toString() ) );
  databaseMeta.setDBName( datasource.getDatabaseName() );
  databaseMeta.setDBPort( datasource.getPort() );
  databaseMeta.setUsername( datasource.getUsername() );
  databaseMeta.setPassword( datasource.getPassword() );
  databaseMeta.setServername( datasource.getServername() );

  // And now load the attributes...
  for ( String key : datasource.getAttributes().keySet() ) {
    databaseMeta.getAttributes().put( key, datasource.getAttributes().get( key ) );
  }
  return databaseMeta;
}
 
Example 16
Source File: BaseStepDialog_ConnectionLine_Test.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
private DatabaseMeta createDefaultDatabase() {
  DatabaseMeta existing = new DatabaseMeta();
  existing.setName( INITIAL_NAME );
  existing.setHostname( INITIAL_HOST );
  return existing;
}
 
Example 17
Source File: JobEntryDialog_ConnectionLine_Test.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
private DatabaseMeta createDefaultDatabase() {
  DatabaseMeta existing = new DatabaseMeta();
  existing.setName( INITIAL_NAME );
  existing.setHostname( INITIAL_HOST );
  return existing;
}
 
Example 18
Source File: ExplorerHarness.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
/**
 * @param args
 */
@SuppressWarnings( "nls" )
public static void main( String[] args ) {
  KettleDatabaseRepositoryMeta repositoryMeta;
  KettleDatabaseRepository repository;
  @SuppressWarnings( "unused" )
  UserInfo userInfo;

  repositoryMeta = new KettleDatabaseRepositoryMeta();
  repositoryMeta.setName( "Kettle Database Repository" );
  repositoryMeta.setDescription( "Kettle database test repository" );

  DatabaseMeta connection = new DatabaseMeta();
  connection.setDatabaseType( "Hypersonic" );
  connection.setHostname( "localhost" );
  connection.setDBName( "kettle_repository_4x" );
  connection.setDBPort( "9002" );
  connection.setUsername( "sa" );

  repositoryMeta.setConnection( connection );

  userInfo = new UserInfo( "admin", "admin", "Administrator", "The system administrator", true );

  repository = new KettleDatabaseRepository();
  repository.init( repositoryMeta );

  @SuppressWarnings( "unused" )
  RepositoryExplorerCallback cb = new RepositoryExplorerCallback() {

    public boolean open( UIRepositoryContent element, String revision ) throws Exception {
      System.out.println( "Name: ".concat( element.getName() ) );
      System.out.println( "Type: ".concat( element.getRepositoryElementType().name() ) );
      System.out.println( "Directory: ".concat( element.getRepositoryDirectory().toString() ) );
      System.out.println( "Revision: ".concat( revision == null ? "null" : revision ) );
      return false; // do not close explorer
    }
    
    @Override
    public boolean error ( String message ) throws Exception {
      System.out.println( "Error message: ".concat( message ) );
      return true;
    }
  };

  /*
   * try { repository.connect(userInfo.getLogin(), userInfo.getPassword()); //RepositoryExplorer explorer = new
   * RepositoryExplorer(new Shell(), repository, cb, null); //explorer.show(); } catch (XulException e) {
   * e.printStackTrace(); } catch (KettleSecurityException e) { e.printStackTrace(); } catch (KettleException e) {
   * e.printStackTrace(); }
   */

}
 
Example 19
Source File: DatabaseConfigurationImportRuleIT.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
public void testRule() throws Exception {

    // Assemble a new database.
    //
    String DBNAME = "test";
    String HOSTNAME = "localhost";
    String PORT = "3306";
    String USERNAME = "foo";
    String PASSWORD = "bar";
    DatabaseMeta verifyMeta =
      new DatabaseMeta( "LOGDB", "MYSQL", "JDBC", HOSTNAME, DBNAME, PORT, USERNAME, PASSWORD );

    // Create a transformation to test.
    //
    TransMeta transMeta = new TransMeta();
    transMeta.addDatabase( (DatabaseMeta) verifyMeta.clone() );

    // Load the plugin to test from the registry.
    //
    PluginRegistry registry = PluginRegistry.getInstance();
    PluginInterface plugin = registry.findPluginWithId( ImportRulePluginType.class, "DatabaseConfiguration" );
    assertNotNull( "The 'database configuration' rule could not be found in the plugin registry!", plugin );
    DatabaseConfigurationImportRule rule = (DatabaseConfigurationImportRule) registry.loadClass( plugin );
    assertNotNull( "The 'database configuration' class could not be loaded by the plugin registry!", plugin );

    // Set the appropriate rule..
    //
    rule.setEnabled( true );

    List<ImportValidationFeedback> feedback = rule.verifyRule( transMeta );
    assertTrue( "We didn't get any feedback from the 'database configuration'", !feedback.isEmpty() );
    assertTrue(
      "An error ruling was expected", feedback.get( 0 ).getResultType() == ImportValidationResultType.ERROR );

    rule.setDatabaseMeta( verifyMeta );

    feedback = rule.verifyRule( transMeta );
    assertTrue( "We didn't get any feedback from the 'transformation has description rule'", !feedback.isEmpty() );
    assertTrue(
      "An approval ruling was expected",
      feedback.get( 0 ).getResultType() == ImportValidationResultType.APPROVAL );

    // Create some errors...
    //
    verifyMeta.setDBName( "incorrect-test" );
    feedback = rule.verifyRule( transMeta );
    assertTrue( "We didn't get any feedback from the 'transformation has description rule'", !feedback.isEmpty() );
    assertTrue(
      "An error ruling was expected validating the db name",
      feedback.get( 0 ).getResultType() == ImportValidationResultType.ERROR );
    verifyMeta.setDBName( DBNAME );

    verifyMeta.setHostname( "incorrect-hostname" );
    feedback = rule.verifyRule( transMeta );
    assertTrue( "We didn't get any feedback from the 'transformation has description rule'", !feedback.isEmpty() );
    assertTrue(
      "An error ruling was expected validating the db hostname",
      feedback.get( 0 ).getResultType() == ImportValidationResultType.ERROR );
    verifyMeta.setHostname( HOSTNAME );

    verifyMeta.setDBPort( "incorrect-port" );
    feedback = rule.verifyRule( transMeta );
    assertTrue( "We didn't get any feedback from the 'transformation has description rule'", !feedback.isEmpty() );
    assertTrue(
      "An error ruling was expected validating the db port",
      feedback.get( 0 ).getResultType() == ImportValidationResultType.ERROR );
    verifyMeta.setDBPort( PORT );

    verifyMeta.setUsername( "incorrect-username" );
    feedback = rule.verifyRule( transMeta );
    assertTrue( "We didn't get any feedback from the 'transformation has description rule'", !feedback.isEmpty() );
    assertTrue(
      "An error ruling was expected validating the db username",
      feedback.get( 0 ).getResultType() == ImportValidationResultType.ERROR );
    verifyMeta.setUsername( USERNAME );

    verifyMeta.setPassword( "incorrect-password" );
    feedback = rule.verifyRule( transMeta );
    assertTrue( "We didn't get any feedback from the 'transformation has description rule'", !feedback.isEmpty() );
    assertTrue(
      "An error ruling was expected validating the db password",
      feedback.get( 0 ).getResultType() == ImportValidationResultType.ERROR );
    verifyMeta.setPassword( PASSWORD );

    // No feedback expected!
    //
    rule.setEnabled( false );

    feedback = rule.verifyRule( transMeta );
    assertTrue(
      "We didn't expect any feedback from the 'transformation has trans log table configured' since disabled",
      feedback.isEmpty() );
  }
 
Example 20
Source File: RepositoryTestBase.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
/**
 * save(databaseMeta) loadDatabaseMeta() exists() deleteDatabaseMeta() getDatabaseID() getDatabaseIDs()
 * getDatabaseNames() readDatabases()
 */
@Test
public void testDatabases() throws Exception {
  DatabaseMeta dbMeta = createDatabaseMeta( EXP_DBMETA_NAME );
  repository.save( dbMeta, VERSION_COMMENT_V1, null );
  assertNotNull( dbMeta.getObjectId() );
  ObjectRevision v1 = dbMeta.getObjectRevision();
  assertNotNull( v1 );
  assertTrue( hasVersionWithComment( dbMeta, VERSION_COMMENT_V1 ) );
  // setting repository directory on dbMeta is not supported; use null parent directory
  assertTrue( repository.exists( EXP_DBMETA_NAME, null, RepositoryObjectType.DATABASE ) );

  DatabaseMeta fetchedDatabase = repository.loadDatabaseMeta( dbMeta.getObjectId(), null );
  assertEquals( EXP_DBMETA_NAME, fetchedDatabase.getName() );
  assertEquals( EXP_DBMETA_HOSTNAME, fetchedDatabase.getHostname() );
  assertEquals( EXP_DBMETA_TYPE, fetchedDatabase.getPluginId() );
  assertEquals( EXP_DBMETA_ACCESS, fetchedDatabase.getAccessType() );
  assertEquals( EXP_DBMETA_DBNAME, fetchedDatabase.getDatabaseName() );
  assertEquals( EXP_DBMETA_PORT, fetchedDatabase.getDatabasePortNumberString() );
  assertEquals( EXP_DBMETA_USERNAME, fetchedDatabase.getUsername() );
  assertEquals( EXP_DBMETA_PASSWORD, fetchedDatabase.getPassword() );
  assertEquals( EXP_DBMETA_SERVERNAME, fetchedDatabase.getServername() );
  assertEquals( EXP_DBMETA_DATA_TABLESPACE, fetchedDatabase.getDataTablespace() );
  assertEquals( EXP_DBMETA_INDEX_TABLESPACE, fetchedDatabase.getIndexTablespace() );

  // 2 for the ones explicitly set and 1 for port (set behind the scenes)
  assertEquals( 2 + 1, fetchedDatabase.getAttributes().size() );
  assertEquals( EXP_DBMETA_ATTR1_VALUE, fetchedDatabase.getAttributes().getProperty( EXP_DBMETA_ATTR1_KEY ) );
  assertEquals( EXP_DBMETA_ATTR2_VALUE, fetchedDatabase.getAttributes().getProperty( EXP_DBMETA_ATTR2_KEY ) );

  dbMeta.setHostname( EXP_DBMETA_HOSTNAME_V2 );
  repository.save( dbMeta, VERSION_COMMENT_V2, null );
  assertTrue( hasVersionWithComment( dbMeta, VERSION_COMMENT_V2 ) );
  fetchedDatabase = repository.loadDatabaseMeta( dbMeta.getObjectId(), null );
  assertEquals( EXP_DBMETA_HOSTNAME_V2, fetchedDatabase.getHostname() );
  fetchedDatabase = repository.loadDatabaseMeta( dbMeta.getObjectId(), v1.getName() );
  assertEquals( EXP_DBMETA_HOSTNAME, fetchedDatabase.getHostname() );

  assertEquals( dbMeta.getObjectId(), repository.getDatabaseID( EXP_DBMETA_NAME ) );

  assertEquals( 1, repository.getDatabaseIDs( false ).length );
  assertEquals( 1, repository.getDatabaseIDs( true ).length );
  assertEquals( dbMeta.getObjectId(), repository.getDatabaseIDs( false )[0] );

  assertEquals( 1, repository.getDatabaseNames( false ).length );
  assertEquals( 1, repository.getDatabaseNames( true ).length );
  assertEquals( EXP_DBMETA_NAME, repository.getDatabaseNames( false )[0] );

  assertEquals( 1, repository.readDatabases().size() );

  repository.deleteDatabaseMeta( EXP_DBMETA_NAME );
  assertFalse( repository.exists( EXP_DBMETA_NAME, null, RepositoryObjectType.DATABASE ) );

  assertEquals( 0, repository.getDatabaseIDs( false ).length );
  // shared object deletion is permanent by default
  assertEquals( 0, repository.getDatabaseIDs( true ).length );

  assertEquals( 0, repository.getDatabaseNames( false ).length );
  // shared object deletion is permanent by default
  assertEquals( 0, repository.getDatabaseNames( true ).length );

  assertEquals( 0, repository.readDatabases().size() );
}