diff options
Diffstat (limited to 'vid-app-common')
9 files changed, 70 insertions, 241 deletions
diff --git a/vid-app-common/src/main/java/org/onap/vid/properties/Features.java b/vid-app-common/src/main/java/org/onap/vid/properties/Features.java index a3343d36b..abee30025 100644 --- a/vid-app-common/src/main/java/org/onap/vid/properties/Features.java +++ b/vid-app-common/src/main/java/org/onap/vid/properties/Features.java @@ -80,6 +80,7 @@ public enum Features implements Feature { FLAG_FLASH_MORE_ACTIONS_BUTTON_IN_OLD_VIEW_EDIT, FLAG_FLASH_CLOUD_REGION_AND_NF_ROLE_OPTIONAL_SEARCH, FLAG_1911_INSTANTIATION_ORDER_IN_ASYNC_ALACARTE, + FLAG_1911_INSTANTIATION_ORDER_BUTTON_IN_ASYNC_ALACARTE ; diff --git a/vid-app-common/src/main/java/org/onap/vid/services/AAITreeNodeBuilder.java b/vid-app-common/src/main/java/org/onap/vid/services/AAITreeNodeBuilder.java index d53eba8d3..c8434609e 100644 --- a/vid-app-common/src/main/java/org/onap/vid/services/AAITreeNodeBuilder.java +++ b/vid-app-common/src/main/java/org/onap/vid/services/AAITreeNodeBuilder.java @@ -20,8 +20,28 @@ package org.onap.vid.services; +import static java.util.stream.Collectors.toList; +import static java.util.stream.Collectors.toMap; +import static java.util.stream.Collectors.toSet; +import static org.onap.vid.utils.KotlinUtilsKt.JACKSON_OBJECT_MAPPER; +import static org.onap.vid.utils.Streams.not; + import com.fasterxml.jackson.databind.JsonNode; import com.google.common.collect.ImmutableList; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import java.util.Set; +import java.util.concurrent.Callable; +import java.util.concurrent.ConcurrentSkipListSet; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Future; +import java.util.concurrent.TimeUnit; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import javax.inject.Inject; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.tuple.ImmutablePair; import org.apache.commons.lang3.tuple.Pair; @@ -42,19 +62,10 @@ import org.onap.vid.properties.VidProperties; import org.onap.vid.utils.Streams; import org.onap.vid.utils.Tree; import org.onap.vid.utils.Unchecked; +import org.slf4j.MDC; import org.springframework.http.HttpMethod; import org.springframework.stereotype.Component; -import javax.inject.Inject; -import java.util.*; -import java.util.concurrent.*; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -import static java.util.stream.Collectors.*; -import static org.onap.vid.utils.KotlinUtilsKt.JACKSON_OBJECT_MAPPER; -import static org.onap.vid.utils.Streams.not; - @Component public class AAITreeNodeBuilder { @@ -205,7 +216,7 @@ public class AAITreeNodeBuilder { directly fetching a resource URI. */ - threadPool.execute(() -> { + Future<?> vfModulesTask = threadPool.submit(withCopyOfMDC(() -> { // the response is an array of vf-modules final JsonNode jsonNode; try { @@ -214,29 +225,40 @@ public class AAITreeNodeBuilder { if (e.getHttpCode().equals(404)) { // it's ok, as we're just optimistically fetching // the /vf-modules uri; 404 says this time it was a bad guess - return; + return true; } else { throw e; } } if (isArray(jsonNode, NodeType.VF_MODULE)) { - //create list of AAITreeNode represent the VfModules from AAI result List<AAITreeNode> vfModules = Streams.fromIterable(jsonNode.get(NodeType.VF_MODULE.getType())) - .map(vfModuleNode -> createAaiNode(NodeType.VF_MODULE, vfModuleNode, nodesAccumulator)) - .collect(toList()); + .map(vfModuleNode -> createAaiNode(NodeType.VF_MODULE, vfModuleNode, nodesAccumulator)) + .collect(toList()); //enrich each of the VfModule with placement info - vfModules.forEach(vfModule-> enrichPlacementDataUsingTenantInfo( - vfModule, - AAITreeNodeUtils.findFirstRelationshipByRelatedTo(vfModule.getRelationshipList(), "vserver") + vfModules.forEach(vfModule -> enrichPlacementDataUsingTenantInfo( + vfModule, + AAITreeNodeUtils.findFirstRelationshipByRelatedTo(vfModule.getRelationshipList(), "vserver") )); //add all VfModules to children list of parent node parentNode.getChildren().addAll(vfModules); } else { LOGGER.error(EELFLoggerDelegate.errorLogger, "Failed to get vf-modules for vnf " + parentNode.getId()); } - }); + + return true; // the Callable<> contract requires a return value + })); + + waitForCompletion(vfModulesTask); + } + + private void waitForCompletion(Future<?> future) { + try { + future.get(); + } catch (Exception e) { + throw new GenericUncheckedException(e); + } } List<Relationship> getFilteredRelationships(JsonNode json, Tree<AAIServiceTree.AaiRelationship> pathsTree) { @@ -256,24 +278,33 @@ public class AAITreeNodeBuilder { if (!relationships.isEmpty()) { List<Callable<List<AAITreeNode>>> tasks = relationships.stream() - .map(relationship -> - (Callable<List<AAITreeNode>>) () -> - getChildNode(threadPool, nodesAccumulator, relationship.getRelatedTo(), - relationship.getRelatedLink(), pathsTree)) - .collect(Collectors.toList()); + .map(relationship -> + withCopyOfMDC(() -> getChildNode(threadPool, nodesAccumulator, relationship.getRelatedTo(), + relationship.getRelatedLink(), pathsTree))) + .collect(Collectors.toList()); try { int depth = pathsTree.getChildrenDepth(); threadPool.invokeAll(tasks, timeout * depth, TimeUnit.SECONDS) - .forEach(future -> - addChildren(node, future) - ); + .forEach(future -> + addChildren(node, future) + ); } catch (Exception e) { throw new GenericUncheckedException(e); } } } + private <V> Callable<V> withCopyOfMDC(Callable<V> callable) { + //in order to be able to write the correct data while creating the node on a new thread + // save a copy of the current thread's context map, with keys and values of type String. + final Map<String, String> copyOfParentMDC = MDC.getCopyOfContextMap(); + return () -> { + MDC.setContextMap(copyOfParentMDC); + return callable.call(); + }; + } + private List<AAITreeNode> getChildNode(ExecutorService threadPool, ConcurrentSkipListSet<AAITreeNode> nodesAccumulator, String childNodeType, String childNodeUrl, Tree<AAIServiceTree.AaiRelationship> pathsTree) { diff --git a/vid-app-common/src/main/webapp/WEB-INF/conf/dev.features.properties b/vid-app-common/src/main/webapp/WEB-INF/conf/dev.features.properties index d4910bf25..6ed0c7bcd 100644 --- a/vid-app-common/src/main/webapp/WEB-INF/conf/dev.features.properties +++ b/vid-app-common/src/main/webapp/WEB-INF/conf/dev.features.properties @@ -36,4 +36,5 @@ FLAG_DISABLE_HOMING = true FLAG_FLASH_CLOUD_REGION_AND_NF_ROLE_OPTIONAL_SEARCH=false FLAG_FLASH_REDUCED_RESPONSE_CHANGEMG = false FLAG_1911_INSTANTIATION_ORDER_IN_ASYNC_ALACARTE = false -FLAG_SHOW_ORCHESTRATION_TYPE = false +FLAG_SHOW_ORCHESTRATION_TYPE = false, +FLAG_1911_INSTANTIATION_ORDER_BUTTON_IN_ASYNC_ALACARTE = false diff --git a/vid-app-common/src/test/resources/WEB-INF/conf/asdc.properties b/vid-app-common/src/test/resources/WEB-INF/conf/asdc.properties deleted file mode 100644 index c16d3f5d3..000000000 --- a/vid-app-common/src/test/resources/WEB-INF/conf/asdc.properties +++ /dev/null @@ -1,17 +0,0 @@ -asdc.client.type=REST -# -#asdc.client.rest.protocol=http -#asdc.client.rest.host=135.21.125.36 -#asdc.client.rest.port=8080 -#asdc.client.rest.auth=Basic VklEOnZpbjNSaXBlbmVkSnVtYjBKZXRTcHJpbmtsZXM= -# -#dev -#asdc.client.rest.protocol=http -#asdc.client.rest.host=135.21.125.105 -#asdc.client.rest.port=8080 -#asdc.client.rest.auth=Basic VGVzdDoxMjM0NTY= -#IST -asdc.client.rest.protocol=https -asdc.client.rest.host=asdcbe.mtsnjpw1.aic.cip.att.com -asdc.client.rest.port=8443 -asdc.client.rest.auth=Basic dmlkOnZpZGlzdA== diff --git a/vid-app-common/src/test/resources/WEB-INF/conf/raptor_app_fusion.properties b/vid-app-common/src/test/resources/WEB-INF/conf/raptor_app_fusion.properties index 4006c166d..b5ee2710e 100644 --- a/vid-app-common/src/test/resources/WEB-INF/conf/raptor_app_fusion.properties +++ b/vid-app-common/src/test/resources/WEB-INF/conf/raptor_app_fusion.properties @@ -3,8 +3,8 @@ upload_folder_path=/demeter/WebApps/dev/ECOMP_PORTAL/files/ excel_template_path=/demeter/WebApps/dev/ECOMP_PORTAL/files/raptor_template/ temp_folder_url=temp/ upload_folder_url=upload/ -smtp_server=zeus.homer.att.com -default_email_sender=dev-local@homer.att.com +smtp_server=todo.smtp.server +default_email_sender=email-name@email.com error_page=error_page.jsp jsp_context_path=raptor/ img_folder_url=static/fusion/raptor/images/ diff --git a/vid-app-common/src/test/resources/WEB-INF/conf/system.properties b/vid-app-common/src/test/resources/WEB-INF/conf/system.properties index 0fb8b1ca7..9c73e4cdd 100644 --- a/vid-app-common/src/test/resources/WEB-INF/conf/system.properties +++ b/vid-app-common/src/test/resources/WEB-INF/conf/system.properties @@ -19,7 +19,6 @@ #Mysql db.driver = com.mysql.jdbc.Driver -#db.connectionURL = jdbc:mysql://demeter.homer.att.com:3306/ecomp_sdk_1707_att db.connectionURL = jdbc:mysql://localhost:3306/vid_portal db.userName = euser db.password = euser @@ -100,14 +99,14 @@ mylogins_feed_cron = 0 0/60 * * * ?; my_login_feed_output_dir = /tmp/MyLogins # ECOMP Portal Shared Context REST API URL -ecomp_shared_context_rest_url= https://www.ecomp.att.com:8080/ecompportal/context +ecomp_shared_context_rest_url= https://shared.context.rest.url:8080/ecompportal/context # Link shown in Help menu -contact_us_link = https://wiki.web.att.com/display/EcompPortal/ECOMP+Portal+Home +contact_us_link = https://todo.contact.us.link homepage_contact_us_url = mailto:portal@lists.onap.org # Camunda cockpit link -camunda_cockpit_link = https://cloopwf.client.research.att.com:8443/camunda/app/cockpit/default/#/dashboard +camunda_cockpit_link = https://camunda.cockpit.link/ # An Unique 128-bit value defined to identify a specific version # of an application deployed on a specific virtual machine. # This value must be generated and updated by the application @@ -116,16 +115,7 @@ camunda_cockpit_link = https://cloopwf.client.research.att.com:8443/camunda/app/ instance_uuid=8da691c9-987d-43ed-a358-00ac2f35685d # R Cloud feature -guard_notebook_url=https://rcloud.research.att.com/mini.html?notebook=a06a9cf14211012e221bf842c168849d& - -#ECOMP redirect url -#ecomp_redirect_url = https://webtest.csp.att.com/ecomp_portal_dev_n1/ecompui/process_csp -#ecomp_rest_url = https://webtest.csp.att.com/ecomp_portal_dev_n1/ecompui/auxapi -# Replace these default values with the ones for your specific App. Ecomp Portal admin obtains from EP website. -#ueb_app_mailbox_name = ECOMP-PORTAL-OUTBOX-90 -#ueb_app_key = sYH0NJnsKmJC1B2A -#ueb_app_secret = YOtknsT2wVFz9WISlSPDaAtd - +guard_notebook_url=https://todo.guard.notebook.url #Policy related properties #simulator @@ -140,14 +130,6 @@ policy.Authorization= policy.environment= #MSO related properties -#simulator -#mso.server.url=http://localhost:8089 -#mso.server.url=https://msoapih-app.mtsnj.aic.cip.att.com:8443/ecomp/mso/infra -#dev2dev -#good -#dev -#mso.server.url=http://mtanjv9moah10-eth0.aic.cip.att.com:8080/ecomp/mso/infra -#istScrum-Master mso.restapi.svc.e2einstance=/e2eServiceInstances/v3 mso.client.type=LOCAL mso.server.url=http://vm1.mso.simpledemo.openecomp.org:8080 @@ -203,9 +185,7 @@ scheduler.get.time.slots=/v1/ChangeManagement/schedules/ scheduler.get.schedules=/v1/ChangeManagement/schedules/scheduleDetails/ vid.truststore.passwd.x=OBF:1wgg1wfq1uus1uui1x131x0r1x1v1x1j1uvo1uve1wg81wfi -#mso.dme2.server.url=http://mso-api-handler-anap-v1.mso.ecomp.att.com/services/ecomp/mso? -mso.dme2.server.url=http://mso-api-handler-anap-v1.mso.ecomp.att.com/services/ecomp/mso?version=1607&envContext=TEST&routeOffer=st_mtsnj -#mso.dme2.server.url=https://ActiveAndAvailableInventory-CloudNetwork-v1.aai.att.com/aai?version=1&envContext=DEV&routeOffer=devINT1 +mso.dme2.server.url=http://mso.dme2.server.url/services/ecomp/mso?version=1607&envContext=TEST&routeOffer=st_mtsnj mso.dme2.enabled=false asdc.model.namespace=org.openecomp. sdc.svc.api.path=sdc/v1/catalog/services @@ -215,10 +195,6 @@ sdc.resource.api.path=sdc/v1/catalog/resource mso.maxOpenedInstantiationRequests=200 mso.asyncPollingIntervalSeconds=0 -# Application base URL has the host and app context only; a proper prefix of the on-boarded URL. -# Only required for applications using WebJunction or FE/BE separation. For example: -# app_base_url = https://www.e-access.att.com/app_junction/app_context/ - features.set.filename=onap.features.properties vid.asyncJob.howLongToKeepOldJobsInDays=7 diff --git a/vid-app-common/src/test/resources/WEB-INF/conf/system.properties.cml b/vid-app-common/src/test/resources/WEB-INF/conf/system.properties.cml deleted file mode 100644 index 9c8b03caf..000000000 --- a/vid-app-common/src/test/resources/WEB-INF/conf/system.properties.cml +++ /dev/null @@ -1,93 +0,0 @@ -# Properties read by ECOMP Core library, epsdk-core.jar - -########################################################################## -# The following properties should NOT be changed by partner applications. -########################################################################## - -application_user_id = 30000 -post_default_role_id = 16 -clustered = true - -#Enable Fusion Mobile capabilities for the application -mobile_enable = false - -# Cache config file is needed on the classpath -cache_config_file_path = /WEB-INF/classes/cache.ccf -cache_switch = 199 -cache_load_on_startup = false - -user_name = fullName -decryption_key = AGLDdG4D04BKm2IxIWEr8o== - -########################################################################## -# The following properties REQUIRE changes by partner applications. -########################################################################## - -#Oracle -#db.userName=quantumbd -#db.password=c1syn2yhmr -#db.connectionURL=jdbc:oracle:thin:@dbhost.yourcompany.com:1527:mod112a -#db.hib.dialect=org.hibernate.dialect.Oracle10gDialect -#db.driver=oracle.jdbc.driver.OracleDriver -#Hibernate -#hb.dialect=org.hibernate.dialect.Oracle10gDialect -#hb.show_sql=true - -#Postgres -#db.userName=quantumbd -#db.password=c1syn2yhmr -#db.connectionURL=jdbc:postgresql://dbhost.yourcompany.com:61382/quantum -#db.hib.dialect=org.hibernate.dialect.PostgreSQLDialect -#db.driver=org.postgresql.Driver -#hb.dialect=org.hibernate.dialect.PostgreSQLDialect -#hb.show_sql=true - - - -#Mysql -db.driver = org.mariadb.jdbc.Driver -#db.connectionURL = jdbc:mariadb://localhost:3306/vid_openecomp_epsdk -#db.userName = ecomp_sdk_user -#db.password = ecomp_sdk_pass -db.hib.dialect = org.hibernate.dialect.MySQLDialect -db.min_pool_size = 5 -db.max_pool_size = 10 -hb.dialect = org.hibernate.dialect.MySQLDialect -# SQL statements are logged to stdout -hb.show_sql = true -hb.idle_connection_test_period = 3600 - -app_display_name = EPSDK App ATT -# license file area -files_path = /tmp - -#element map files -element_map_file_path = app/fusionapp/files/ -element_map_icon_path = app/fusionapp/icons/ - -#Cron Schedules have 6 required fields and 1 optional field: -# Seconds Minutes Hours Day-of-Month Month Day-of-Week Year -log_cron = 0 0/1 * * * ?; - -# ECOMP Portal Shared Context REST API URL -ecomp_shared_context_rest_url= https://www.ecomp.att.com:8080/ecompportal/context - -# Link shown in Help menu -contact_us_link = https://wiki.web.att.com/display/EcompPortal/ECOMP+Portal+Home - -# Camunda cockpit link -camunda_cockpit_link = https://cloopwf.client.research.att.com:8443/camunda/app/cockpit/default/#/dashboard - -# An Unique 128-bit value defined to identify a specific version -# of an application deployed on a specific virtual machine. -# This value must be generated and updated by the application -# which is using the ECOMP SDK at the time of its deployment. -# Online Unique UUID generator - https://www.uuidgenerator.net/ -instance_uuid=8da691c9-987d-43ed-a358-00ac2f35685d - -# R Cloud feature -guard_notebook_url=https://rcloud.research.att.com/mini.html?notebook=a06a9cf14211012e221bf842c168849d& - -# Application base URL has the host and app context only; a proper prefix of the on-boarded URL. -# Only required for applications using WebJunction or FE/BE separation. For example: -# app_base_url = https://www.e-access.att.com/app_junction/app_context/ diff --git a/vid-app-common/src/test/resources/WEB-INF/fusion/jsp/ds2/left-menu.jsp b/vid-app-common/src/test/resources/WEB-INF/fusion/jsp/ds2/left-menu.jsp index 8f6b5c2a8..afaf8b1ac 100644 --- a/vid-app-common/src/test/resources/WEB-INF/fusion/jsp/ds2/left-menu.jsp +++ b/vid-app-common/src/test/resources/WEB-INF/fusion/jsp/ds2/left-menu.jsp @@ -579,28 +579,7 @@ } $scope.createFavoriteErrorMenu=function() { - $scope.favoritesMenuItems = [ -// { -// "menuId": "93", -// "text": "JSONLint", -// "url": "http://http://jsonlint.com" -// }, -// { -// "menuId": "22", -// "text": "ECOMP Wasteland", -// "url": "https://ecomp.homer.att.com/ecompportal/applicationsHome" -// }, -// { -// "menuId": "94", -// "text": "HROneStop", -// "url": "http://ebiz.sbc.com/hronestop" -// }, -// { -// "menuId": "91", -// "text": "Andy and his Astrophotgraphy", -// "url": "https://ecomp.homer.att.com/ecompportal/applicationsHome" -// } - ]; + $scope.favoritesMenuItems = []; $scope.favoriteItemsCount = Object.keys($scope.favoritesMenuItems).length; $log.info('number of favorite menus: ' + $scope.favoriteItemsCount); } @@ -672,20 +651,6 @@ "url": "http://http://jsonlint.com" }, { - "menuId": 94, - "column": 2, - "text": "HROneStop", - "parentMenuId": 4, - "url": "http://ebiz.sbc.com/hronestop" - }, - { - "menuId": 95, - "column": 2, - "text": "4th Level App4a R16", - "parentMenuId": 4, - "url": "http://www.e-access.att.com/ecomp_portal_ist/ecompportal/widgets" - }, - { "menuId": 96, "column": 3, "text": "3rd Level App1c R200", diff --git a/vid-app-common/src/test/resources/WEB-INF/fusion/jsp/ebz/ebz_header.jsp b/vid-app-common/src/test/resources/WEB-INF/fusion/jsp/ebz/ebz_header.jsp index 067fce329..6ef2ea975 100644 --- a/vid-app-common/src/test/resources/WEB-INF/fusion/jsp/ebz/ebz_header.jsp +++ b/vid-app-common/src/test/resources/WEB-INF/fusion/jsp/ebz/ebz_header.jsp @@ -608,28 +608,7 @@ } $scope.createFavoriteErrorMenu=function() { - $scope.favoritesMenuItems = [ -// { -// "menuId": "93", -// "text": "JSONLint", -// "url": "http://http://jsonlint.com" -// }, -// { -// "menuId": "22", -// "text": "ECOMP Wasteland", -// "url": "https://ecomp.homer.att.com/ecompportal/applicationsHome" -// }, -// { -// "menuId": "94", -// "text": "HROneStop", -// "url": "http://ebiz.sbc.com/hronestop" -// }, -// { -// "menuId": "91", -// "text": "Andy and his Astrophotgraphy", -// "url": "https://ecomp.homer.att.com/ecompportal/applicationsHome" -// } - ]; + $scope.favoritesMenuItems = []; $scope.favoriteItemsCount = Object.keys($scope.favoritesMenuItems).length; $log.info('number of favorite menus: ' + $scope.favoriteItemsCount); } @@ -701,20 +680,6 @@ "url": "http://http://jsonlint.com" }, { - "menuId": 94, - "column": 2, - "text": "HROneStop", - "parentMenuId": 4, - "url": "http://ebiz.sbc.com/hronestop" - }, - { - "menuId": 95, - "column": 2, - "text": "4th Level App4a R16", - "parentMenuId": 4, - "url": "http://www.e-access.att.com/ecomp_portal_ist/ecompportal/widgets" - }, - { "menuId": 96, "column": 3, "text": "3rd Level App1c R200", |