From 1367b73c1d1d761939f5893c711f87716a7baad0 Mon Sep 17 00:00:00 2001 From: ilanap Date: Tue, 26 Nov 2019 11:53:36 +0200 Subject: Add API to retrieve UI configuration Added configuration file with the menu configuration from catalog-ui. Added to the configuration manager. to chef and to the ui rest APIs. Issue-ID: SDC-2663 Signed-off-by: ilanap Change-Id: Ia5e014a273238981241821c0d81b0455bd662b28 Signed-off-by: ilanap --- .../sdc/fe/config/ConfigurationManagerTest.java | 5 + .../sdc/fe/config/WorkspaceConfigurationTest.java | 56 ++++++ .../config/common/workspace-configuration.yaml | 199 +++++++++++++++++++++ 3 files changed, 260 insertions(+) create mode 100644 common-app-api/src/test/java/org/openecomp/sdc/fe/config/WorkspaceConfigurationTest.java create mode 100644 common-app-api/src/test/resources/config/common/workspace-configuration.yaml (limited to 'common-app-api/src/test') diff --git a/common-app-api/src/test/java/org/openecomp/sdc/fe/config/ConfigurationManagerTest.java b/common-app-api/src/test/java/org/openecomp/sdc/fe/config/ConfigurationManagerTest.java index a0c19b314f..0cf350cd73 100644 --- a/common-app-api/src/test/java/org/openecomp/sdc/fe/config/ConfigurationManagerTest.java +++ b/common-app-api/src/test/java/org/openecomp/sdc/fe/config/ConfigurationManagerTest.java @@ -49,6 +49,7 @@ public class ConfigurationManagerTest { private class TestPluginsConfiguration extends PluginsConfiguration {} private class TestRestConfigurationInfo extends RestConfigurationInfo {} private class TestEcompErrorConfiguration extends EcompErrorConfiguration {} + private class TestWorkspaceConfiguration extends WorkspaceConfiguration {} @Test public void validateConfigurationManageIsConstructWithAllConfiguration() { @@ -64,6 +65,9 @@ public class ConfigurationManagerTest { when(configurationSource. getAndWatchConfiguration(eq(EcompErrorConfiguration.class),any(ConfigurationListener.class)) ).thenReturn(new TestEcompErrorConfiguration()); + when(configurationSource. + getAndWatchConfiguration(eq(WorkspaceConfiguration.class),any(ConfigurationListener.class)) + ).thenReturn(new TestWorkspaceConfiguration()); configurationManager = new ConfigurationManager(configurationSource); @@ -71,6 +75,7 @@ public class ConfigurationManagerTest { assertEquals(configurationManager.getPluginsConfiguration().getClass(), TestPluginsConfiguration.class); assertEquals(configurationManager.getRestClientConfiguration().getClass(), TestRestConfigurationInfo.class); assertEquals(configurationManager.getEcompErrorConfiguration().getClass(), TestEcompErrorConfiguration.class); + assertEquals(configurationManager.getWorkspaceConfiguration().getClass(), TestWorkspaceConfiguration.class); } @Test diff --git a/common-app-api/src/test/java/org/openecomp/sdc/fe/config/WorkspaceConfigurationTest.java b/common-app-api/src/test/java/org/openecomp/sdc/fe/config/WorkspaceConfigurationTest.java new file mode 100644 index 0000000000..dd1fe8b2be --- /dev/null +++ b/common-app-api/src/test/java/org/openecomp/sdc/fe/config/WorkspaceConfigurationTest.java @@ -0,0 +1,56 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2019 Nokia. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.fe.config; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mock; +import org.mockito.junit.MockitoJUnitRunner; +import org.openecomp.sdc.common.api.ConfigurationSource; +import org.openecomp.sdc.common.impl.ExternalConfiguration; +import org.openecomp.sdc.common.impl.FSConfigurationSource; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +@RunWith(MockitoJUnitRunner.class) +public class WorkspaceConfigurationTest { + private WorkspaceConfiguration workspaceConfiguration = new WorkspaceConfiguration(); + + @Mock + private ConfigurationManager configurationManager; + + @Before + public void setUp() { + String appConfigDir = "src/test/resources/config/common"; + ConfigurationSource configurationSource = + new FSConfigurationSource(ExternalConfiguration.getChangeListener(), appConfigDir); + configurationManager = new ConfigurationManager(configurationSource); + } + + @Test + public void validateInstanceGetsProperTestManager() { + workspaceConfiguration = configurationManager.getWorkspaceConfiguration(); + assertEquals(7,workspaceConfiguration.getWorkspaceMenuConfiguration().size()); + assertTrue(workspaceConfiguration.getWorkspaceMenuConfiguration().containsKey("VFC")); + } +} diff --git a/common-app-api/src/test/resources/config/common/workspace-configuration.yaml b/common-app-api/src/test/resources/config/common/workspace-configuration.yaml new file mode 100644 index 0000000000..fd382592b7 --- /dev/null +++ b/common-app-api/src/test/resources/config/common/workspace-configuration.yaml @@ -0,0 +1,199 @@ +workspaceMenuConfiguration: + VFC: + - text: General + action: onMenuItemPressed + state: workspace.general + - text: Deployment Artifact + action: onMenuItemPressed + state: workspace.deployment_artifacts + - text: Information Artifact + action: onMenuItemPressed + state: workspace.information_artifacts + - text: TOSCA Artifacts + action: onMenuItemPressed + state: workspace.tosca_artifacts + - text: Properties + action: onMenuItemPressed + state: workspace.properties + - text: Attributes + action: onMenuItemPressed + state: workspace.attributes + - text: Req. & Capabilities + action: onMenuItemPressed + state: workspace.reqAndCap + - text: Activity Log + action: onMenuItemPressed + state: workspace.activity_log + VL: + - text: General + action: onMenuItemPressed + state: workspace.general + - text: Deployment Artifact + action: onMenuItemPressed + state: workspace.deployment_artifacts + - text: Information Artifact + action: onMenuItemPressed + state: workspace.information_artifacts + - text: TOSCA Artifacts + action: onMenuItemPressed + state: workspace.tosca_artifacts + - text: Properties + action: onMenuItemPressed + state: workspace.properties + - text: Attributes + action: onMenuItemPressed + state: workspace.attributes + - text: Req. & Capabilities + action: onMenuItemPressed + state: workspace.reqAndCap + - text: Activity Log + action: onMenuItemPressed + state: workspace.activity_log + CP: + - text: General + action: onMenuItemPressed + state: workspace.general + - text: Deployment Artifact + action: onMenuItemPressed + state: workspace.deployment_artifacts + - text: Information Artifact + action: onMenuItemPressed + state: workspace.information_artifacts + - text: TOSCA Artifacts + action: onMenuItemPressed + state: workspace.tosca_artifacts + - text: Properties + action: onMenuItemPressed + state: workspace.properties + - text: Attributes + action: onMenuItemPressed + state: workspace.attributes + - text: Req. & Capabilities + action: onMenuItemPressed + state: workspace.reqAndCap + - text: Activity Log + action: onMenuItemPressed + state: workspace.activity_log + VF: + - text: General + action: onMenuItemPressed + state: workspace.general + - text: Deployment Artifact + action: onMenuItemPressed + state: workspace.deployment_artifacts + - text: Information Artifact + action: onMenuItemPressed + state: workspace.information_artifacts + - text: TOSCA Artifacts + action: onMenuItemPressed + state: workspace.tosca_artifacts + - text: Composition + action: onMenuItemPressed + state: workspace.composition.details + - text: Operation + action: onMenuItemPressed + state: workspace.interface_operation + - text: Activity Log + action: onMenuItemPressed + state: workspace.activity_log + - text: Deployment + action: onMenuItemPressed + state: workspace.deployment + - text: Properties Assignment + action: onMenuItemPressed + state: workspace.properties_assignment + - text: Req. & Capabilities + action: onMenuItemPressed + state: workspace.reqAndCapEditable + PNF: + - text: General + action: onMenuItemPressed + state: workspace.general + - text: Deployment Artifact + action: onMenuItemPressed + state: workspace.deployment_artifacts + - text: Information Artifact + action: onMenuItemPressed + state: workspace.information_artifacts + - text: TOSCA Artifacts + action: onMenuItemPressed + state: workspace.tosca_artifacts + - text: Composition + action: onMenuItemPressed + state: workspace.composition.details + - text: Operation + action: onMenuItemPressed + state: workspace.interface_operation + - text: Activity Log + action: onMenuItemPressed + state: workspace.activity_log + - text: Properties Assignment + action: onMenuItemPressed + state: workspace.properties_assignment + - text: Req. & Capabilities + action: onMenuItemPressed + state: workspace.reqAndCapEditable + CR: + - text: General + action: onMenuItemPressed + state: workspace.general + - text: Deployment Artifact + action: onMenuItemPressed + state: workspace.deployment_artifacts + - text: Information Artifact + action: onMenuItemPressed + state: workspace.information_artifacts + - text: TOSCA Artifacts + action: onMenuItemPressed + state: workspace.tosca_artifacts + - text: Composition + action: onMenuItemPressed + state: workspace.composition.details + - text: Activity Log + action: onMenuItemPressed + state: workspace.activity_log + - text: Properties Assignment + action: onMenuItemPressed + state: workspace.properties_assignment + SERVICE: + - text: General + action: onMenuItemPressed + state: workspace.general + - text: TOSCA Artifacts + action: onMenuItemPressed + state: workspace.tosca_artifacts + - text: Composition + action: onMenuItemPressed + state: workspace.composition.details + - text: Operation + action: onMenuItemPressed + state: workspace.interface_operation + - text: Activity Log + action: onMenuItemPressed + state: workspace.activity_log + - text: Management Workflow + action: onMenuItemPressed + state: workspace.management_workflow + - text: 'Network Call Flow ' + action: onMenuItemPressed + state: workspace.network_call_flow + - text: Distribution + action: onMenuItemPressed + state: workspace.distribution + disabledRoles: + - ADMIN + - TESTER + - GOVERNOR + - DESIGNER + - text: Deployment + action: onMenuItemPressed + state: workspace.deployment + - text: Properties Assignment + action: onMenuItemPressed + state: workspace.properties_assignment + - text: Outputs + action: onMenuItemPressed + state: workspace.outputs_assignment + - text: Req. & Capabilities + action: onMenuItemPressed + state: workspace.reqAndCapEditable -- cgit 1.2.3-korg