TSK-1252: Fixed new code smells of the last 30 days

This commit is contained in:
Jörg Heffner 2020-05-15 14:36:05 +02:00
parent 7dcd42bd52
commit df4fd17264
3 changed files with 20 additions and 19 deletions

View File

@ -13,7 +13,9 @@ import pro.taskana.spi.history.api.TaskanaHistory;
import pro.taskana.spi.history.api.events.TaskanaHistoryEvent; import pro.taskana.spi.history.api.events.TaskanaHistoryEvent;
import pro.taskana.spi.history.api.exceptions.TaskanaHistoryEventNotFoundException; import pro.taskana.spi.history.api.exceptions.TaskanaHistoryEventNotFoundException;
/** This is the implementation of TaskanaHistory. */ /**
* This is the implementation of TaskanaHistory.
*/
public class SimpleHistoryServiceImpl implements TaskanaHistory { public class SimpleHistoryServiceImpl implements TaskanaHistory {
private static final Logger LOGGER = LoggerFactory.getLogger(SimpleHistoryServiceImpl.class); private static final Logger LOGGER = LoggerFactory.getLogger(SimpleHistoryServiceImpl.class);
@ -23,16 +25,14 @@ public class SimpleHistoryServiceImpl implements TaskanaHistory {
@Override @Override
public void initialize(TaskanaEngineConfiguration taskanaEngineConfiguration) { public void initialize(TaskanaEngineConfiguration taskanaEngineConfiguration) {
try {
this.taskanaHistoryEngine = getTaskanaEngine(taskanaEngineConfiguration); this.taskanaHistoryEngine = getTaskanaEngine(taskanaEngineConfiguration);
if (LOGGER.isDebugEnabled()) { if (LOGGER.isDebugEnabled()) {
LOGGER.debug( LOGGER.debug(
"Simple history service implementation initialized with schemaName: {} ", "Simple history service implementation initialized with schemaName: {} ",
taskanaEngineConfiguration.getSchemaName()); taskanaEngineConfiguration.getSchemaName());
} }
} catch (SQLException e) {
LOGGER.error("There was an error creating Taskana history engine", e);
}
this.historyEventMapper = this.historyEventMapper =
this.taskanaHistoryEngine.getSqlSession().getMapper(HistoryEventMapper.class); this.taskanaHistoryEngine.getSqlSession().getMapper(HistoryEventMapper.class);
this.historyQueryMapper = this.historyQueryMapper =
@ -88,8 +88,7 @@ public class SimpleHistoryServiceImpl implements TaskanaHistory {
/* /*
* ATTENTION: This method exists for testing purposes. * ATTENTION: This method exists for testing purposes.
*/ */
TaskanaHistoryEngineImpl getTaskanaEngine(TaskanaEngineConfiguration taskanaEngineConfiguration) TaskanaHistoryEngineImpl getTaskanaEngine(TaskanaEngineConfiguration taskanaEngineConfiguration) {
throws SQLException {
return TaskanaHistoryEngineImpl.createTaskanaEngine(taskanaEngineConfiguration); return TaskanaHistoryEngineImpl.createTaskanaEngine(taskanaEngineConfiguration);
} }
} }

View File

@ -122,9 +122,11 @@ public class DbSchemaCreator {
} }
private static String selectDbSchemaDetectionScript(String dbProductName) { private static String selectDbSchemaDetectionScript(String dbProductName) {
return DB.isPostgreSql(dbProductName)
? DB_SCHEMA_DETECTION_POSTGRES if (DB.isPostgreSql(dbProductName)) {
: DB.isH2(dbProductName) ? DB_SCHEMA_DETECTION_H2 : DB_SCHEMA_DETECTION_DB2; return DB_SCHEMA_DETECTION_POSTGRES;
}
return DB.isH2(dbProductName) ? DB_SCHEMA_DETECTION_H2 : DB_SCHEMA_DETECTION_DB2;
} }
private ScriptRunner getScriptRunnerInstance(Connection connection) { private ScriptRunner getScriptRunnerInstance(Connection connection) {

View File

@ -292,11 +292,11 @@ public class LdapCacheTestImpl implements LdapCache {
new AccessIdRepresentationModel( new AccessIdRepresentationModel(
"manager_domain_D", "cn=manager_domain_d,ou=groups,o=taskanatest"), "manager_domain_D", "cn=manager_domain_d,ou=groups,o=taskanatest"),
new AccessIdRepresentationModel( new AccessIdRepresentationModel(
"teamlead_2", "cn=teamlead_2" + ",ou=groups,o=taskanatest"), "teamlead_2", "cn=teamlead_2,ou=groups,o=taskanatest"),
new AccessIdRepresentationModel( new AccessIdRepresentationModel(
"teamlead_4", "cn=teamlead_4" + ",ou=groups,o=taskanatest"), "teamlead_4", "cn=teamlead_4,ou=groups,o=taskanatest"),
new AccessIdRepresentationModel("team_3", "cn=team_3" + ",ou=groups,o=taskanatest"), new AccessIdRepresentationModel("team_3", "cn=team_3,ou=groups,o=taskanatest"),
new AccessIdRepresentationModel("team_4", "cn=team_4" + ",ou=groups,o=taskanatest"))); new AccessIdRepresentationModel("team_4", "cn=team_4,ou=groups,o=taskanatest")));
@Override @Override
public List<AccessIdRepresentationModel> findMatchingAccessId( public List<AccessIdRepresentationModel> findMatchingAccessId(