本文整理了Java中org.influxdb.InfluxDB.describeDatabases()
方法的一些代码示例,展示了InfluxDB.describeDatabases()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。InfluxDB.describeDatabases()
方法的具体详情如下:
包路径:org.influxdb.InfluxDB
类名称:InfluxDB
方法名:describeDatabases
[英]Describe all available databases.
[中]描述所有可用的数据库。
代码示例来源:origin: testcontainers/testcontainers-java
@Test
public void describeDatabases() {
InfluxDB actual = influxDBContainer.getNewInfluxDB();
assertThat(actual, notNullValue());
assertThat(actual.describeDatabases(), hasItem(DATABASE));
}
代码示例来源:origin: inspectIT/inspectIT
/**
* Checks whether database exists.
*
* @param database
* database
* @return Returns true if database is available, false if database is not available or the user
* has not the rights to "SHOW DATABASES".
*/
private boolean isDatabaseAvailable(String database) {
try {
List<String> dbNames = influxDB.describeDatabases();
return dbNames.contains(database);
} catch (Exception ex) {
if (log.isDebugEnabled()) {
log.debug("Database availability check failed with the following message: " + ex.getMessage());
}
return false;
}
}
代码示例来源:origin: NovatecConsulting/JMeter-InfluxDB-Writer
/**
* Creates the configured database in influx if it does not exist yet.
*/
private void createDatabaseIfNotExistent() {
List<String> dbNames = influxDB.describeDatabases();
if (!dbNames.contains(influxDBConfig.getInfluxDatabase())) {
influxDB.createDatabase(influxDBConfig.getInfluxDatabase());
}
}
代码示例来源:origin: inspectIT/inspectIT
@Test
public void writeTestFailsDatabaseExists() {
influxDao.active = true;
Mockito.doThrow(new RuntimeException()).when(influxDb).write(any(String.class), any(String.class), any(Point.class));
when(influxDb.describeDatabases()).thenReturn(Arrays.asList(influxDao.database));
influxDao.propertiesUpdated();
assertThat(influxDao.isConnected(), is(false));
verify(executor, times(1)).submit(any(Runnable.class));
verify(influxDb).write(any(String.class), any(String.class), any(Point.class));
verify(clientFactory).createClient();
verify(influxDb).describeDatabases();
verifyNoMoreInteractions(future, influxDb, executor, clientFactory);
}
代码示例来源:origin: inspectIT/inspectIT
@Test
public void reconnectedDatabaseExists() {
influxDao.active = true;
when(influxDb.isBatchEnabled()).thenReturn(false);
when(influxDb.describeDatabases()).thenReturn(Arrays.asList(influxDao.database));
influxDao.onReconnection();
verify(influxDb).isBatchEnabled();
verify(influxDb).enableBatch(InfluxDBDao.BATCH_BUFFER_SIZE, InfluxDBDao.BATCH_FLUSH_TIMER, TimeUnit.SECONDS);
verify(influxDb).describeDatabases();
verifyNoMoreInteractions(influxDb);
verifyZeroInteractions(future, executor, availabilityChecker, clientFactory);
}
}
代码示例来源:origin: inspectIT/inspectIT
@Test
public void writeTestFailsDatabaseCreationFails() {
influxDao.active = true;
Mockito.doThrow(new RuntimeException()).when(influxDb).write(any(String.class), any(String.class), any(Point.class));
Mockito.doThrow(new RuntimeException()).when(influxDb).describeDatabases();
Mockito.doThrow(new RuntimeException()).when(influxDb).createDatabase(any(String.class));
influxDao.propertiesUpdated();
assertThat(influxDao.isConnected(), is(false));
verify(executor, times(1)).submit(any(Runnable.class));
verify(clientFactory).createClient();
verify(influxDb).write(any(String.class), any(String.class), any(Point.class));
verify(influxDb).describeDatabases();
verify(influxDb).createDatabase(any(String.class));
verifyNoMoreInteractions(future, influxDb, executor, clientFactory);
}
代码示例来源:origin: inspectIT/inspectIT
@Test
public void reconnectedBatchEnabled() {
influxDao.active = true;
when(influxDb.isBatchEnabled()).thenReturn(true);
influxDao.onReconnection();
verify(influxDb).isBatchEnabled();
verify(influxDb).describeDatabases();
verify(influxDb).createDatabase(influxDao.database);
verifyNoMoreInteractions(influxDb);
verifyZeroInteractions(future, executor, availabilityChecker, clientFactory);
}
代码示例来源:origin: inspectIT/inspectIT
@Test
public void reconnected() {
influxDao.active = true;
when(influxDb.isBatchEnabled()).thenReturn(false);
influxDao.onReconnection();
assertThat(influxDao.isConnected(), is(true));
assertThat(influxDao.getServiceStatus(), is(ExternalServiceStatus.CONNECTED));
verify(influxDb).isBatchEnabled();
verify(influxDb).enableBatch(InfluxDBDao.BATCH_BUFFER_SIZE, InfluxDBDao.BATCH_FLUSH_TIMER, TimeUnit.SECONDS);
verify(influxDb).describeDatabases();
verify(influxDb).createDatabase(influxDao.database);
verifyNoMoreInteractions(influxDb);
verifyZeroInteractions(future, executor, availabilityChecker, clientFactory);
}
代码示例来源:origin: inspectIT/inspectIT
@Test
public void writeTestFailsDatabaseCreationSucceeds() {
influxDao.active = true;
Mockito.doThrow(new RuntimeException()).when(influxDb).write(any(String.class), any(String.class), any(Point.class));
influxDao.propertiesUpdated();
assertThat(influxDao.isConnected(), is(true));
verify(executor, times(1)).submit(any(Runnable.class));
verify(influxDb).write(any(String.class), any(String.class), any(Point.class));
verify(clientFactory).createClient();
verify(influxDb).describeDatabases();
verify(influxDb).createDatabase(any(String.class));
verify(influxDb, times(1)).isBatchEnabled();
verify(influxDb).enableBatch(InfluxDBDao.BATCH_BUFFER_SIZE, InfluxDBDao.BATCH_FLUSH_TIMER, TimeUnit.SECONDS);
verify(influxDb).ping();
verify(availabilityChecker, times(1)).deactivate();
verify(availabilityChecker).setInflux(influxDb);
verify(availabilityChecker).activate();
verifyNoMoreInteractions(future, influxDb, executor, clientFactory);
}
代码示例来源:origin: inspectIT/inspectIT
@Test
public void enableInfluxDatabaseExists() {
influxDao.active = true;
when(influxDb.describeDatabases()).thenReturn(Arrays.asList(influxDao.database));
influxDao.propertiesUpdated();
assertThat(influxDao.isConnected(), is(true));
assertThat(influxDao.getServiceStatus(), is(ExternalServiceStatus.CONNECTED));
verify(executor, times(1)).submit(any(Runnable.class));
verify(influxDb).ping();
verify(influxDb).write(any(String.class), any(String.class), any(Point.class));
verify(influxDb).query(any(Query.class));
verify(influxDb).isBatchEnabled();
verify(influxDb).enableBatch(InfluxDBDao.BATCH_BUFFER_SIZE, InfluxDBDao.BATCH_FLUSH_TIMER, TimeUnit.SECONDS);
verify(availabilityChecker).deactivate();
verify(availabilityChecker).setInflux(influxDb);
verify(availabilityChecker).activate();
verify(clientFactory).createClient();
verifyNoMoreInteractions(influxDb, availabilityChecker, executor, clientFactory);
verifyZeroInteractions(future);
}
内容来源于网络,如有侵权,请联系作者删除!