aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-fe/src/main
diff options
context:
space:
mode:
authorIdan Amit <ia096e@intl.att.com>2018-03-15 18:07:16 +0200
committerMichael Lando <ml636r@att.com>2018-03-18 08:39:31 +0000
commitd03d20a800a41dc04e70803ae2c6851bfb9948b9 (patch)
tree680b2b345ba0628acbba175db9d9347f982aab7b /catalog-fe/src/main
parentde67b61f2fcd1bfc3cd6c44d9f1e66786777a238 (diff)
Add timeout and connection status
Added timeout and connection status to the plugins configuration. Added support in ui to display a temporary error screen in case a plugin in offline Change-Id: Id4a0909cc704903be6183f22c67caec6f5050103 Issue-ID: SDC-1081 Signed-off-by: Idan Amit <ia096e@intl.att.com>
Diffstat (limited to 'catalog-fe/src/main')
-rw-r--r--catalog-fe/src/main/java/org/openecomp/sdc/fe/impl/PluginStatusBL.java23
-rw-r--r--catalog-fe/src/main/resources/config/plugins-configuration.yaml6
2 files changed, 15 insertions, 14 deletions
diff --git a/catalog-fe/src/main/java/org/openecomp/sdc/fe/impl/PluginStatusBL.java b/catalog-fe/src/main/java/org/openecomp/sdc/fe/impl/PluginStatusBL.java
index 563dc22507..5ed4585e10 100644
--- a/catalog-fe/src/main/java/org/openecomp/sdc/fe/impl/PluginStatusBL.java
+++ b/catalog-fe/src/main/java/org/openecomp/sdc/fe/impl/PluginStatusBL.java
@@ -23,11 +23,13 @@ public class PluginStatusBL {
private static Logger log = LoggerFactory.getLogger(PluginStatusBL.class.getName());
private static Gson gson = new GsonBuilder().setPrettyPrinting().create();
private CloseableHttpClient client = null;
-
+ private PluginsConfiguration pluginsConfiguration = ConfigurationManager.getConfigurationManager().getPluginsConfiguration();
+ private Integer connectionTimeout;
+
public PluginStatusBL() {
this.client = HttpClients.createDefault();
}
-
+
public PluginStatusBL(CloseableHttpClient client) {
this.client = client;
@@ -36,21 +38,18 @@ public class PluginStatusBL {
public String checkPluginsListAvailability() {
String result = null;
- PluginsConfiguration pluginsConfiguration = ConfigurationManager.getConfigurationManager()
- .getPluginsConfiguration();
-
if (pluginsConfiguration == null || pluginsConfiguration.getPluginsList() == null) {
log.warn("Configuration of type {} was not found", PluginsConfiguration.class);
} else {
log.debug("The value returned from getConfig is {}", pluginsConfiguration);
+ connectionTimeout = pluginsConfiguration.getConnectionTimeout();
List<Plugin> availablePluginsList = new ArrayList<>();
- pluginsConfiguration.getPluginsList().forEach(value -> {
- if (checkPluginAvailability(value)) {
- availablePluginsList.add(value);
- }
+ pluginsConfiguration.getPluginsList().forEach(plugin -> {
+ plugin.setOnline(checkPluginAvailability(plugin));
+ availablePluginsList.add(plugin);
});
result = gson.toJson(availablePluginsList);
}
@@ -62,9 +61,9 @@ public class PluginStatusBL {
HttpHead head = new HttpHead(plugin.getPluginDiscoveryUrl());
RequestConfig requestConfig = RequestConfig.custom()
- .setSocketTimeout(1000)
- .setConnectTimeout(1000)
- .setConnectionRequestTimeout(1000).build();
+ .setSocketTimeout(connectionTimeout)
+ .setConnectTimeout(connectionTimeout)
+ .setConnectionRequestTimeout(connectionTimeout).build();
head.setConfig(requestConfig);
diff --git a/catalog-fe/src/main/resources/config/plugins-configuration.yaml b/catalog-fe/src/main/resources/config/plugins-configuration.yaml
index 69598e0ebe..eb36945715 100644
--- a/catalog-fe/src/main/resources/config/plugins-configuration.yaml
+++ b/catalog-fe/src/main/resources/config/plugins-configuration.yaml
@@ -17,5 +17,7 @@ pluginsList:
displayName: "WORKFLOW"
context:
displayName: "Workflow Designer"
- displayContext: ["VF"]
- displayRoles: ["DESIGNER", "TESTER"] \ No newline at end of file
+ displayContext: ["VF", "SERVICE"]
+ displayRoles: ["DESIGNER", "TESTER"]
+
+connectionTimeout: 1000 \ No newline at end of file