mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-12 17:04:57 +00:00
* [ACA-4227] Create a generic script to check plugin status before running e2e tests by plugin name * * Added governace env check * * Added AAE plugin check * * Updated script * small improvements, add uiName parameter for the command * * Fixed comments * * Moved check-plugin script in the common place * * Added table format to show plugin status Co-authored-by: adomi <ardit.domi@alfresco.com>
65 lines
2.0 KiB
TypeScript
65 lines
2.0 KiB
TypeScript
import { PluginInterface } from './plugin-model';
|
|
import { logger } from '../logger';
|
|
import { PluginConfiguration } from './plugin-config';
|
|
|
|
export class ProcessServiceHealth {
|
|
|
|
config: PluginConfiguration;
|
|
|
|
constructor(private plugInInfo: PluginInterface, private alfrescoJsApi: any) {
|
|
this.config = new PluginConfiguration(this.plugInInfo, this.alfrescoJsApi);
|
|
}
|
|
|
|
async isPluginEnabledFromAppConfiguration() {
|
|
try {
|
|
const url = `${this.plugInInfo.host}/app.config.json`;
|
|
const appConfig = await this.config.getAppConfig(url);
|
|
let isEnabled = true;
|
|
if (appConfig && appConfig.plugins && appConfig.plugins[this.plugInInfo.name]) {
|
|
logger.info(
|
|
`The plugin ${
|
|
this.plugInInfo.name
|
|
} has been correctly configured in app.config.json`
|
|
);
|
|
} else {
|
|
this.logConfigurationError();
|
|
return (isEnabled = false);
|
|
}
|
|
|
|
return isEnabled;
|
|
} catch (error) {
|
|
this.logConfigurationError(error);
|
|
return false;
|
|
}
|
|
}
|
|
|
|
async checkBackendHealth() {
|
|
try {
|
|
const systemProperties = await this.alfrescoJsApi.activiti.systemPropertiesApi.getProperties();
|
|
let isBackendActive = true;
|
|
if (systemProperties) {
|
|
logger.info(`${this.plugInInfo.host} is UP!`);
|
|
} else {
|
|
logger.error(`${this.plugInInfo.host} is DOWN `);
|
|
isBackendActive = false;
|
|
}
|
|
return isBackendActive;
|
|
} catch (error) {
|
|
logger.error(
|
|
`${this.plugInInfo.host} is not reachable error: `,
|
|
error
|
|
);
|
|
return false;
|
|
}
|
|
}
|
|
|
|
private logConfigurationError(error?: any) {
|
|
logger.error(
|
|
`The plugin ${
|
|
this.plugInInfo.name
|
|
} has not been correctly configured in app.config.json`,
|
|
error
|
|
);
|
|
}
|
|
}
|