Test fix
This commit is contained in:
parent
e6ae368424
commit
13b80a294a
|
@ -302,6 +302,11 @@ public class FhirResourceDaoR4SearchOptimizedTest extends BaseJpaR4Test {
|
|||
* 20 should be prefetched since that's the initial page size
|
||||
*/
|
||||
|
||||
await().until(()-> runInTransaction(()->{
|
||||
Search search = mySearchEntityDao.findByUuidAndFetchIncludes(uuid).orElseThrow(() -> new InternalErrorException(""));
|
||||
return search.getNumFound() >= 200;
|
||||
}));
|
||||
|
||||
runInTransaction(() -> {
|
||||
Search search = mySearchEntityDao.findByUuidAndFetchIncludes(uuid).orElseThrow(() -> new InternalErrorException(""));
|
||||
assertEquals(200, search.getNumFound());
|
||||
|
|
|
@ -26,8 +26,8 @@ import org.apache.commons.lang3.Validate;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
|
||||
public class DropIndexTask extends BaseTableTask<DropIndexTask> {
|
||||
|
@ -56,18 +56,27 @@ public class DropIndexTask extends BaseTableTask<DropIndexTask> {
|
|||
|
||||
boolean isUnique = JdbcUtils.isIndexUnique(getConnectionProperties(), getTableName(), myIndexName);
|
||||
String uniquenessString = isUnique ? "unique" : "non-unique";
|
||||
|
||||
Optional<String> sql = createDropIndexSql(getConnectionProperties(), getTableName(), myIndexName, getDriverType());
|
||||
if (sql.isPresent()) {
|
||||
ourLog.info("Dropping {} index {} on table {}", uniquenessString, myIndexName, getTableName());
|
||||
|
||||
String sql = createDropIndexSql(getConnectionProperties(), getTableName(), myIndexName, getDriverType());
|
||||
executeSql(getTableName(), sql);
|
||||
|
||||
executeSql(getTableName(), sql.get());
|
||||
}
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
static String createDropIndexSql(DriverTypeEnum.ConnectionProperties theConnectionProperties, String theTableName, String theIndexName, DriverTypeEnum theDriverType) throws SQLException {
|
||||
public DropIndexTask setIndexName(String theIndexName) {
|
||||
myIndexName = theIndexName;
|
||||
return this;
|
||||
}
|
||||
|
||||
static Optional<String> createDropIndexSql(DriverTypeEnum.ConnectionProperties theConnectionProperties, String theTableName, String theIndexName, DriverTypeEnum theDriverType) throws SQLException {
|
||||
Validate.notBlank(theIndexName, "theIndexName must not be blank");
|
||||
Validate.notBlank(theTableName, "theTableName must not be blank");
|
||||
|
||||
if (!JdbcUtils.getIndexNames(theConnectionProperties, theTableName).contains(theIndexName)) {
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
boolean isUnique = JdbcUtils.isIndexUnique(theConnectionProperties, theTableName, theIndexName);
|
||||
|
||||
String sql = null;
|
||||
|
@ -109,12 +118,6 @@ public class DropIndexTask extends BaseTableTask<DropIndexTask> {
|
|||
break;
|
||||
}
|
||||
}
|
||||
return sql;
|
||||
}
|
||||
|
||||
|
||||
public DropIndexTask setIndexName(String theIndexName) {
|
||||
myIndexName = theIndexName;
|
||||
return this;
|
||||
return Optional.of(sql);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@ import org.slf4j.LoggerFactory;
|
|||
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
|
||||
public class DropTableTask extends BaseTableTask<DropTableTask> {
|
||||
|
@ -53,9 +54,11 @@ public class DropTableTask extends BaseTableTask<DropTableTask> {
|
|||
}
|
||||
|
||||
for (String nextIndex : indexNames) {
|
||||
String sql = DropIndexTask.createDropIndexSql(getConnectionProperties(), getTableName(), nextIndex, getDriverType());
|
||||
Optional<String> sql = DropIndexTask.createDropIndexSql(getConnectionProperties(), getTableName(), nextIndex, getDriverType());
|
||||
if (sql.isPresent()) {
|
||||
ourLog.info("Dropping index {} on table {} in preparation for table delete", nextIndex, getTableName());
|
||||
executeSql(getTableName(), sql);
|
||||
executeSql(getTableName(), sql.get());
|
||||
}
|
||||
}
|
||||
|
||||
ourLog.info("Dropping table: {}", getTableName());
|
||||
|
|
Loading…
Reference in New Issue