- Set the default value of the "isTestEnvironment" property to "true", in order to avoid undesired outcomes in the production db.

- Code polishing.
This commit is contained in:
Lampros Smyrnaios 2023-03-21 17:04:28 +02:00
parent e975bec911
commit 4280f89296
7 changed files with 10 additions and 11 deletions

View File

@ -20,4 +20,4 @@ public class ScheduledTasks {
public void reportCurrentTime() {
logger.info("Server is live! Time is now {}", dateFormat.format(new Date()));
}
}
}

View File

@ -69,9 +69,10 @@ public class ImpalaConnector {
jdbcTemplate.execute("CREATE TABLE IF NOT EXISTS " + testDatabaseName + ".datasource stored as parquet as select * from " + initialDatabaseName + ".datasource");
jdbcTemplate.execute("COMPUTE STATS " + testDatabaseName + ".datasource");
databaseName = testDatabaseName; // For the rest of the queries.
databaseName = testDatabaseName;
} else {
logger.info("Going to create or validate the tables that are populated by the Controller, for the \"initialDatabase\" = \"" + initialDatabaseName + "\"");
// Note that for the "initialDatabase", the initial 4 tables are expected to be created either manually or by other pieces of software, as views of the contents of the Graph.
databaseName = initialDatabaseName;
}

View File

@ -40,11 +40,9 @@ public class UrlsServiceImpl implements UrlsService {
@Autowired
private JdbcTemplate jdbcTemplate;
@Autowired
private FileUtils fileUtils;
@Autowired
private ParquetFileUtils parquetFileUtils;
@ -75,12 +73,12 @@ public class UrlsServiceImpl implements UrlsService {
for ( int i=0; i < exclusionListSize; ++i ) {
sb.append("\"").append(excludedIDs.get(i)).append("\"");
if ( i < (exclusionListSize -1) )
sb.append(",");
sb.append(", ");
}
sb.append(")");
excludedDatasourceIDsStringList = sb.toString();
//logger.debug("excludedDatasourceIDsStringList :\n" + excludedDatasourceIDsStringList); // DEBUG!
logger.info("The following datasources will be excluded from crawling: " + excludedDatasourceIDsStringList);
}

View File

@ -240,7 +240,7 @@ public class FileUtils {
String baseUrl = "http://" + remoteAddr + ":1881/api/full-texts/getFullTexts/" + assignmentsBatchCounter + "/" + numOfBatches + "/";
// TODO - The worker should send the port in which it accepts requests, along with the current request.
// TODO - The least we have to do it to expose the port-assignment somewhere more obvious like inside the "application.properties" file.
// TODO - The least we have to do it to expose the port-assignment somewhere more obvious like inside the "application.yml" file.
String curAssignmentsBaseLocation = baseFilesLocation + "assignments_" + assignmentsBatchCounter + File.separator;
// Note: the "curAssignmentsBaseLocation"-directory will be created once the first batch subdirectory is called for creation.

View File

@ -631,7 +631,7 @@ public class ParquetFileUtils {
int statusCode = conn.getResponseCode();
if ( statusCode == 200 ) {
logger.debug("The file \"" + parquetFileName + "\" was successfully deleted."); // DEBUG!
logger.debug("The file \"" + parquetFileName + "\" was successfully deleted.");
} else {
String errorMsg = "The file \"" + parquetFileName + "\" could not be deleted! Response-code: " + statusCode;
logger.error(errorMsg);

View File

@ -25,7 +25,7 @@ public class UriBuilder {
String sslEnabled = environment.getProperty("server.ssl.enabled");
if (sslEnabled == null) { // It's expected to not exist if there is no SSL-configuration.
logger.warn("No property \"server.ssl.enabled\" was found in \"application.properties\". Continuing with plain HTTP..");
logger.warn("No property \"server.ssl.enabled\" was found in \"application.yml\". Continuing with plain HTTP..");
sslEnabled = "false";
}
baseUrl += sslEnabled.equals("true") ? "s" : "";
@ -45,7 +45,7 @@ public class UriBuilder {
if ( !baseInternalPath.endsWith("/") )
baseUrl += "/";
} else {
logger.warn("No property \"server.servlet.context-path\" was found in \"application.properties\"!"); // Yes it's expected.
logger.warn("No property \"server.servlet.context-path\" was found in \"application.yml\"!"); // Yes it's expected.
baseUrl += "/";
}

View File

@ -6,7 +6,7 @@ server:
services:
pdfaggregation:
controller:
isTestEnvironment: false
isTestEnvironment: true
# In case the "isTestEnvironment" is "true", the "testDatabase" below and all its tables are created (if not exist).
# The tables "datasource", "publication", "publication_pids" and "publication_urls" are filled with the data from the same tables existing in the "initialDatabase", if they don't exist.
# In case the "isTestEnvironment" is "false", the "initialDatabase" is used. The Controller assumes that the above 4 tables are present, and only creates, if they don't exist, the following tables: