From 7e44fa716640f855fa066c7b0d8f7dca767837b0 Mon Sep 17 00:00:00 2001 From: "Determe, Sebastien (sd378r)" Date: Wed, 7 Feb 2018 10:11:30 +0100 Subject: [PATCH] Remove AJSC container. Remove AJSC container and adapt the dependencies & unit tests Issue-ID: CLAMP-85 Change-Id: I4289dd8a13645df238f35d2791718639b04a509f Signed-off-by: Determe, Sebastien (sd378r) --- pom.xml | 217 +++++++++------------ src/main/java/org/onap/clamp/clds/Application.java | 56 ++---- .../clds/client/req/tca/TcaRequestFormatter.java | 8 +- .../clds/config/CamundaAuthFilterInitializer.java | 81 -------- .../onap/clamp/clds/config/CldsConfiguration.java | 27 +-- .../clamp/clds/config/CsiLoggingConfiguration.java | 49 ----- .../SystemPropertiesLoader.java} | 25 +-- src/main/java/org/onap/clamp/clds/dao/CldsDao.java | 41 +++- .../clamp/clds/model/CLDSMonitoringDetails.java | 104 ++++++++++ .../org/onap/clamp/clds/service/CldsService.java | 110 ++++++----- .../clamp/clds/service/CldsTemplateService.java | 11 +- .../JerseyConfig.java} | 44 ++--- src/main/resources/application.properties | 21 +- src/main/resources/bootstrap.properties | 34 ---- src/main/resources/clds/clds-reference.properties | 5 +- src/main/resources/logback.xml | 24 --- src/main/resources/system.properties | 4 +- .../java/org/onap/clamp/clds/AbstractItCase.java | 5 +- .../resources/application-no-camunda.properties | 24 +-- src/test/resources/https/https-test.properties | 23 +-- src/test/resources/processes.xml | 37 ---- 21 files changed, 381 insertions(+), 569 deletions(-) delete mode 100644 src/main/java/org/onap/clamp/clds/config/CamundaAuthFilterInitializer.java delete mode 100644 src/main/java/org/onap/clamp/clds/config/CsiLoggingConfiguration.java rename src/main/java/org/onap/clamp/clds/{Routes.java => config/SystemPropertiesLoader.java} (67%) create mode 100644 src/main/java/org/onap/clamp/clds/model/CLDSMonitoringDetails.java rename src/main/java/org/onap/clamp/clds/{exception/AjscExceptionMapper.java => service/JerseyConfig.java} (59%) delete mode 100644 src/main/resources/bootstrap.properties delete mode 100644 src/test/resources/processes.xml diff --git a/pom.xml b/pom.xml index 433aef12..e11e44e1 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ ============LICENSE_START======================================================= ONAP CLAMP ================================================================================ - Copyright (C) 2017 AT&T Intellectual Property. All rights + Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. ================================================================================ Licensed under the Apache License, Version 2.0 (the "License"); @@ -33,11 +33,11 @@ org.onap.oparent oparent - 1.0.0-SNAPSHOT + 1.1.0-SNAPSHOT - This project build the ONAP CLAMP JAR that contains AJSC + CLAMP code. + This project build the ONAP CLAMP JAR that contains CLAMP back-end code and its UI part. By Default "mvn clean install" command will execute also the unit tests and the integration tests. The integration tests require a docker engine running. @@ -54,7 +54,7 @@ - org.onap.clamp.config.files.cldsUsers=classpath:/clds/clds-users.json - org.onap.clamp.config.files.globalClds=classpath:/clds/globalClds.properties - + yyyy.MM.dd'T'hh.mm.ss'Z' @@ -66,12 +66,12 @@ UTF-8 3306 - 0.0.3-oss git-server 1.8 - 6.1.0.6-oss - 6.2.0.6-oss - 6.1.0.3-oss + + 1.0.0 + 2.20.1 + 1.5.9.RELEASE java jacoco @@ -145,11 +145,27 @@ + - org.springframework.boot spring-boot-dependencies - 1.4.1.RELEASE + ${springboot.version} + pom + import + + + + org.camunda.bpm + camunda-bom + 7.6.0 + import + pom + + + + org.apache.camel + camel-spring-boot-dependencies + ${camel.version} pom import @@ -158,60 +174,83 @@ - commons-io - commons-io - 2.6 + com.att.eelf + eelf-core + ${eelf.core.version} + - com.googlecode.json-simple - json-simple - 1.1 + org.apache.camel + camel-spring-boot-starter + - org.apache.commons - commons-vfs2 - 2.0 + org.apache.camel + camel-jaxb-starter - - org.springframework.security - spring-security-test - - test + org.apache.camel + camel-cxf-starter - - - + - com.att.ajsc - sdk-java-common-logging - ${sdk.java.common.logging} + org.springframework.boot + spring-boot-starter-web org.springframework.boot spring-boot-starter-tomcat - compile org.springframework.boot - spring-boot-starter-actuator + spring-boot-starter-jersey + + + org.springframework + spring-jdbc org.springframework.boot spring-boot-starter-security + + org.springframework.boot + spring-boot-starter-actuator + org.springframework.boot spring-boot-starter-test test + + - joda-time - joda-time + org.camunda.bpm.extension.springboot + camunda-bpm-spring-boot-starter + 2.0.0 - org.springframework - spring-context + org.camunda.bpm.extension.springboot + camunda-bpm-spring-boot-starter-webapp + 2.0.0 + + + commons-io + commons-io + 2.6 + + + com.googlecode.json-simple + json-simple + + + org.apache.commons + commons-vfs2 + 2.0 + + + joda-time + joda-time org.slf4j @@ -222,10 +261,6 @@ javax.ws.rs-api 2.0 - - org.springframework - spring-test - junit junit @@ -235,15 +270,6 @@ mockito-all 1.9.5 - - commons-logging - commons-logging - 1.1.1 - - - org.springframework - spring-aspects - com.fasterxml.jackson.core jackson-core @@ -252,27 +278,6 @@ com.fasterxml.jackson.core jackson-databind - - org.springframework - spring-webmvc - - - org.springframework.boot - spring-boot-starter-web - - - log4j - log4j - 1.2.17 - - - org.springframework.boot - spring-boot - - - org.springframework.boot - spring-boot-autoconfigure - javax.transaction jta @@ -288,57 +293,16 @@ hibernate-annotations 3.5.6-Final - - org.apache.geronimo.specs - geronimo-jpa_2.0_spec - 1.1 - + + + + + dom4j dom4j - 1.6.1 - - - - com.att.ajsc - sdk-java-camel-rest - ${sdk.camel.rest} - - - com.att.ajsc - sdk-java-camunda-core - ${sdk.camunda.core} - - - mysql - mysql-connector-java - - - - - - org.springframework - spring-context-support - - - - com.att.ajsc - sdk-java-common-interceptors - ${csi.logging} - - - org.eclipse.jetty.orbit - javax.servlet - - - com.att.ajsc - ajsc-core - - - - org.onap.policy.engine PolicyEngineAPI @@ -364,6 +328,10 @@ mysql mysql-connector-java + + commons-io + commons-io + @@ -402,6 +370,14 @@ apache-log4j-extras log4j + + mysql + mysql-connector-java + + + org.mariadb.jdbc + mariadb-java-client + @@ -464,23 +440,16 @@ com.fasterxml.jackson.core jackson-databind - 2.6.3 com.fasterxml.jackson.dataformat jackson-dataformat-yaml - 2.6.3 org.apache.commons commons-csv 1.3 - - org.jboss.resteasy - resteasy-client - 3.0.8.Final - com.sun.faces jsf-api @@ -596,7 +565,7 @@ org.springframework.boot spring-boot-maven-plugin - 1.5.3.RELEASE + ${springboot.version} diff --git a/src/main/java/org/onap/clamp/clds/Application.java b/src/main/java/org/onap/clamp/clds/Application.java index e2bfbd77..2727535e 100644 --- a/src/main/java/org/onap/clamp/clds/Application.java +++ b/src/main/java/org/onap/clamp/clds/Application.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP CLAMP * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights + * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -23,22 +23,12 @@ package org.onap.clamp.clds; -import com.att.ajsc.common.utility.SystemPropertiesLoader; import com.att.eelf.configuration.EELFLogger; import com.att.eelf.configuration.EELFManager; -import java.util.ArrayList; -import java.util.Collection; - -import javax.ws.rs.client.Client; -import javax.ws.rs.client.ClientBuilder; - -import org.apache.camel.component.servlet.CamelHttpTransportServlet; import org.apache.catalina.connector.Connector; -import org.camunda.bpm.spring.boot.starter.webapp.CamundaBpmWebappAutoConfiguration; import org.onap.clamp.clds.model.prop.Holmes; import org.onap.clamp.clds.model.prop.ModelProperties; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.SpringApplication; import org.springframework.boot.actuate.autoconfigure.ManagementWebSecurityAutoConfiguration; @@ -51,38 +41,36 @@ import org.springframework.boot.autoconfigure.security.SecurityAutoConfiguration import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.context.embedded.EmbeddedServletContainerFactory; import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory; -import org.springframework.boot.web.servlet.ServletRegistrationBean; import org.springframework.boot.web.support.SpringBootServletInitializer; -import org.springframework.context.ApplicationContext; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.scheduling.annotation.EnableAsync; @SpringBootApplication -@ComponentScan(basePackages = { "org.onap.clamp.clds", "com.att.ajsc" }) -@EnableAutoConfiguration(exclude = { DataSourceAutoConfiguration.class, CamundaBpmWebappAutoConfiguration.class, - HibernateJpaAutoConfiguration.class, JpaRepositoriesAutoConfiguration.class, SecurityAutoConfiguration.class, - ManagementWebSecurityAutoConfiguration.class }) +@ComponentScan(basePackages = { + "org.onap.clamp.clds" +}) +@EnableAutoConfiguration(exclude = { + DataSourceAutoConfiguration.class, HibernateJpaAutoConfiguration.class, JpaRepositoriesAutoConfiguration.class, + SecurityAutoConfiguration.class, ManagementWebSecurityAutoConfiguration.class +}) @EnableAsync public class Application extends SpringBootServletInitializer { - protected static final EELFLogger EELF_LOGGER = EELFManager.getInstance().getLogger(Application.class); - @Autowired - private ApplicationContext appContext; - private static final String CAMEL_SERVLET_NAME = "CamelServlet"; - private static final String CAMEL_URL_MAPPING = "/restservices/clds/v1/*"; + + protected static final EELFLogger EELF_LOGGER = EELFManager.getInstance().getLogger(Application.class); // This settings is an additional one to Spring config, // only if we want to have an additional port automatically redirected to // HTTPS @Value("${server.http-to-https-redirection.port:none}") - private String httpRedirectedPort; + private String httpRedirectedPort; /** * This 8080 is the default port used by spring if this parameter is not * specified in application.properties. */ @Value("${server.port:8080}") - private String springServerPort; + private String springServerPort; @Value("${server.ssl.key-store:none}") - private String sslKeystoreFile; + private String sslKeystoreFile; @Override protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { @@ -90,8 +78,6 @@ public class Application extends SpringBootServletInitializer { } public static void main(String[] args) { - // This is to load the system.properties file parameters - SystemPropertiesLoader.addSystemProperties(); // This is to initialize some Onap Clamp components initializeComponents(); // Start the Spring application @@ -102,22 +88,6 @@ public class Application extends SpringBootServletInitializer { ModelProperties.registerModelElement(Holmes.class, Holmes.getType()); } - @Bean - public ServletRegistrationBean servletRegistrationBean() { - ServletRegistrationBean registration = new ServletRegistrationBean(); - registration.setName(CAMEL_SERVLET_NAME); - registration.setServlet(new CamelHttpTransportServlet()); - Collection urlMappings = new ArrayList<>(); - urlMappings.add(CAMEL_URL_MAPPING); - registration.setUrlMappings(urlMappings); - return registration; - } - - @Bean - public Client restClient() { - return ClientBuilder.newClient(); - } - /** * This method is used by Spring to create the servlet container factory. * diff --git a/src/main/java/org/onap/clamp/clds/client/req/tca/TcaRequestFormatter.java b/src/main/java/org/onap/clamp/clds/client/req/tca/TcaRequestFormatter.java index 385a4e41..f13f4222 100644 --- a/src/main/java/org/onap/clamp/clds/client/req/tca/TcaRequestFormatter.java +++ b/src/main/java/org/onap/clamp/clds/client/req/tca/TcaRequestFormatter.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP CLAMP * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights + * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -28,7 +28,6 @@ import com.att.eelf.configuration.EELFManager; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.node.ArrayNode; import com.fasterxml.jackson.databind.node.ObjectNode; -import com.fasterxml.jackson.dataformat.yaml.snakeyaml.Yaml; import java.io.IOException; import java.util.Map; @@ -39,13 +38,14 @@ import org.onap.clamp.clds.model.prop.Tca; import org.onap.clamp.clds.model.prop.TcaItem; import org.onap.clamp.clds.model.prop.TcaThreshold; import org.onap.clamp.clds.model.refprop.RefProp; +import org.yaml.snakeyaml.Yaml; /** * Construct the requests for TCA policy and SDC. - * */ public class TcaRequestFormatter { - protected static final EELFLogger logger = EELFManager.getInstance().getLogger(TcaRequestFormatter.class); + + protected static final EELFLogger logger = EELFManager.getInstance().getLogger(TcaRequestFormatter.class); protected static final EELFLogger metricsLogger = EELFManager.getInstance().getMetricsLogger(); /** diff --git a/src/main/java/org/onap/clamp/clds/config/CamundaAuthFilterInitializer.java b/src/main/java/org/onap/clamp/clds/config/CamundaAuthFilterInitializer.java deleted file mode 100644 index af9e695e..00000000 --- a/src/main/java/org/onap/clamp/clds/config/CamundaAuthFilterInitializer.java +++ /dev/null @@ -1,81 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP CLAMP - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. 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============================================ - * =================================================================== - * ECOMP is a trademark and service mark of AT&T Intellectual Property. - */ - -package org.onap.clamp.clds.config; - -import com.att.eelf.configuration.EELFLogger; -import com.att.eelf.configuration.EELFManager; - -import java.util.EnumSet; -import java.util.Map; - -import javax.servlet.DispatcherType; -import javax.servlet.Filter; -import javax.servlet.FilterRegistration; -import javax.servlet.ServletContext; -import javax.servlet.ServletException; - -import org.camunda.bpm.spring.boot.starter.CamundaBpmAutoConfiguration; -import org.camunda.bpm.webapp.impl.security.auth.AuthenticationFilter; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.boot.autoconfigure.AutoConfigureAfter; -import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication; -import org.springframework.boot.web.servlet.ServletContextInitializer; -import org.springframework.context.annotation.Configuration; - -@Configuration -@ConditionalOnWebApplication -@AutoConfigureAfter(CamundaBpmAutoConfiguration.class) -public class CamundaAuthFilterInitializer implements ServletContextInitializer { - private static final EnumSet DISPATCHER_TYPES = EnumSet.of(DispatcherType.REQUEST); - private ServletContext servletContext; - @Value("${com.att.ajsc.camunda.contextPath:/camunda}") - private String camundaSuffix; - protected static final EELFLogger logger = EELFManager.getInstance() - .getLogger(CamundaAuthFilterInitializer.class); - protected static final EELFLogger metricsLogger = EELFManager.getInstance().getMetricsLogger(); - - @Override - public void onStartup(ServletContext servletContext) throws ServletException { - this.servletContext = servletContext; - registerFilter("Authentication Filter", AuthenticationFilter.class, camundaSuffix + "/*"); - } - - private FilterRegistration registerFilter(final String filterName, final Class filterClass, - final String... urlPatterns) { - return registerFilter(filterName, filterClass, null, urlPatterns); - } - - private FilterRegistration registerFilter(final String filterName, final Class filterClass, - final Map initParameters, final String... urlPatterns) { - FilterRegistration filterRegistration = servletContext.getFilterRegistration(filterName); - if (filterRegistration == null) { - filterRegistration = servletContext.addFilter(filterName, filterClass); - filterRegistration.addMappingForUrlPatterns(DISPATCHER_TYPES, true, urlPatterns); - if (initParameters != null) { - filterRegistration.setInitParameters(initParameters); - } - } - return filterRegistration; - } -} diff --git a/src/main/java/org/onap/clamp/clds/config/CldsConfiguration.java b/src/main/java/org/onap/clamp/clds/config/CldsConfiguration.java index 9367bc24..b99d3a96 100644 --- a/src/main/java/org/onap/clamp/clds/config/CldsConfiguration.java +++ b/src/main/java/org/onap/clamp/clds/config/CldsConfiguration.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP CLAMP * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights + * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -23,12 +23,6 @@ package org.onap.clamp.clds.config; -import com.att.ajsc.common.AjscProvider; -import com.att.ajsc.common.AjscService; - -import java.util.ArrayList; -import java.util.List; - import javax.sql.DataSource; import javax.xml.transform.TransformerConfigurationException; @@ -48,19 +42,17 @@ import org.onap.clamp.clds.client.req.sdc.SdcReq; import org.onap.clamp.clds.dao.CldsDao; import org.onap.clamp.clds.model.refprop.RefProp; import org.onap.clamp.clds.transform.XslTransformer; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.beans.factory.config.PropertiesFactoryBean; import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.ApplicationContext; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Profile; +import org.springframework.core.io.ClassPathResource; @Configuration @Profile("clamp-default") public class CldsConfiguration { - @Autowired - private ApplicationContext context; /** * Clds Identity database DataSource configuration @@ -73,14 +65,11 @@ public class CldsConfiguration { return new EncodedPasswordBasicDataSource(); } - @Bean(name = "jaxrsProviders") - public List jaxrsProviders() { - return new ArrayList(context.getBeansWithAnnotation(AjscProvider.class).values()); - } - - @Bean(name = "jaxrsServices") - public List jaxrsServices() { - return new ArrayList(context.getBeansWithAnnotation(AjscService.class).values()); + @Bean(name = "mapper") + public PropertiesFactoryBean mapper() { + PropertiesFactoryBean bean = new PropertiesFactoryBean(); + bean.setLocation(new ClassPathResource("system.properties")); + return bean; } @Bean(name = "cldsDao") diff --git a/src/main/java/org/onap/clamp/clds/config/CsiLoggingConfiguration.java b/src/main/java/org/onap/clamp/clds/config/CsiLoggingConfiguration.java deleted file mode 100644 index 5b48e8d8..00000000 --- a/src/main/java/org/onap/clamp/clds/config/CsiLoggingConfiguration.java +++ /dev/null @@ -1,49 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP CLAMP - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. 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============================================ - * =================================================================== - * ECOMP is a trademark and service mark of AT&T Intellectual Property. - */ - -package org.onap.clamp.clds.config; - -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -import com.att.ajsc.csilogging.common.AsyncSupport; -import com.att.ajsc.csilogging.interceptors.CsiLoggingCamelPostInterceptor; -import com.att.ajsc.csilogging.interceptors.CsiLoggingCamelPreInterceptor; - -@Configuration -public class CsiLoggingConfiguration { - @Bean - public CsiLoggingCamelPreInterceptor csiLoggingCamelPreInterceptor() { - return new CsiLoggingCamelPreInterceptor(); - } - - @Bean - public CsiLoggingCamelPostInterceptor csiLoggingCamelPostInterceptor() { - return new CsiLoggingCamelPostInterceptor(); - } - - @Bean - public AsyncSupport asyncsupport() { - return new AsyncSupport(); - } -} diff --git a/src/main/java/org/onap/clamp/clds/Routes.java b/src/main/java/org/onap/clamp/clds/config/SystemPropertiesLoader.java similarity index 67% rename from src/main/java/org/onap/clamp/clds/Routes.java rename to src/main/java/org/onap/clamp/clds/config/SystemPropertiesLoader.java index d9520e78..83325f3d 100644 --- a/src/main/java/org/onap/clamp/clds/Routes.java +++ b/src/main/java/org/onap/clamp/clds/config/SystemPropertiesLoader.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP CLAMP * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights + * Copyright (C) 2018 AT&T Intellectual Property. All rights * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -21,23 +21,24 @@ * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.onap.clamp.clds; +package org.onap.clamp.clds.config; -import com.att.ajsc.common.camel.AjscRouteBuilder; +import java.util.Properties; -import org.apache.camel.builder.RouteBuilder; -import org.springframework.beans.factory.annotation.Autowired; +import javax.annotation.Resource; + +import org.springframework.context.ApplicationListener; +import org.springframework.context.event.ContextRefreshedEvent; import org.springframework.stereotype.Component; @Component -public class Routes extends RouteBuilder { - @Autowired - private AjscRouteBuilder ajscRoute; +public class SystemPropertiesLoader implements ApplicationListener { + + @Resource(name = "mapper") + private Properties myTranslator; @Override - public void configure() { - ajscRoute.initialize(this); - ajscRoute - .setRoute(from("servlet:/?matchOnUriPrefix=true").to("cxfbean:jaxrsServices?providers=jaxrsProviders")); + public void onApplicationEvent(ContextRefreshedEvent contextRefreshedEvent) { + System.getProperties().putAll(myTranslator); } } diff --git a/src/main/java/org/onap/clamp/clds/dao/CldsDao.java b/src/main/java/org/onap/clamp/clds/dao/CldsDao.java index 7bef430d..088d4733 100644 --- a/src/main/java/org/onap/clamp/clds/dao/CldsDao.java +++ b/src/main/java/org/onap/clamp/clds/dao/CldsDao.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP CLAMP * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights + * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -27,6 +27,7 @@ import com.att.eelf.configuration.EELFLogger; import com.att.eelf.configuration.EELFManager; import java.io.InputStream; +import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -34,6 +35,7 @@ import java.util.Map; import javax.sql.DataSource; +import org.onap.clamp.clds.model.CLDSMonitoringDetails; import org.onap.clamp.clds.model.CldsDBServiceCache; import org.onap.clamp.clds.model.CldsEvent; import org.onap.clamp.clds.model.CldsModel; @@ -54,6 +56,7 @@ import org.springframework.stereotype.Repository; */ @Repository("cldsDao") public class CldsDao { + private static final EELFLogger logger = EELFManager.getInstance().getLogger(CldsDao.class); private JdbcTemplate jdbcTemplateObject; private SimpleJdbcCall procGetModel; @@ -413,4 +416,40 @@ public class CldsDao { } return cldsModelPropList; } + + /** + * Method to get deployed/active models with model properties. + * + * @return list of CLDS-Monitoring-Details: CLOSELOOP_NAME | Close loop name + * used in the CLDS application (prefix: ClosedLoop- + unique + * ClosedLoop ID) MODEL_NAME | Model Name in CLDS application + * SERVICE_TYPE_ID | TypeId returned from the DCAE application when + * the ClosedLoop is submitted (DCAEServiceTypeRequest generated in + * DCAE application). DEPLOYMENT_ID | Id generated when the + * ClosedLoop is deployed in DCAE. TEMPLATE_NAME | Template used to + * generate the ClosedLoop model. ACTION_CD | Current state of the + * ClosedLoop in CLDS application. + */ + public List getCLDSMonitoringDetails() { + SimpleDateFormat sdf = new SimpleDateFormat("MM-dd-yyyy HH:mm:ss"); + List cldsMonitoringDetailsList = new ArrayList(); + String modelsSql = "SELECT CONCAT(M.CONTROL_NAME_PREFIX, M.CONTROL_NAME_UUID) AS CLOSELOOP_NAME , M.MODEL_NAME, M.SERVICE_TYPE_ID, M.DEPLOYMENT_ID, T.TEMPLATE_NAME, E.ACTION_CD, E.USER_ID, E.TIMESTAMP " + + "FROM MODEL M, TEMPLATE T, EVENT E " + + "WHERE M.TEMPLATE_ID = T.TEMPLATE_ID AND M.EVENT_ID = E.EVENT_ID " + "ORDER BY ACTION_CD"; + List> rows = jdbcTemplateObject.queryForList(modelsSql); + CLDSMonitoringDetails cldsMonitoringDetails = null; + for (Map row : rows) { + cldsMonitoringDetails = new CLDSMonitoringDetails(); + cldsMonitoringDetails.setCloseloopName((String) row.get("CLOSELOOP_NAME")); + cldsMonitoringDetails.setModelName((String) row.get("MODEL_NAME")); + cldsMonitoringDetails.setServiceTypeId((String) row.get("SERVICE_TYPE_ID")); + cldsMonitoringDetails.setDeploymentId((String) row.get("DEPLOYMENT_ID")); + cldsMonitoringDetails.setTemplateName((String) row.get("TEMPLATE_NAME")); + cldsMonitoringDetails.setAction((String) row.get("ACTION_CD")); + cldsMonitoringDetails.setUserid((String) row.get("USER_ID")); + cldsMonitoringDetails.setTimestamp(sdf.format(row.get("TIMESTAMP"))); + cldsMonitoringDetailsList.add(cldsMonitoringDetails); + } + return cldsMonitoringDetailsList; + } } diff --git a/src/main/java/org/onap/clamp/clds/model/CLDSMonitoringDetails.java b/src/main/java/org/onap/clamp/clds/model/CLDSMonitoringDetails.java new file mode 100644 index 00000000..be4f9509 --- /dev/null +++ b/src/main/java/org/onap/clamp/clds/model/CLDSMonitoringDetails.java @@ -0,0 +1,104 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP CLAMP + * ================================================================================ + * Copyright (C) 2018 AT&T Intellectual Property. 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============================================ + * =================================================================== + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + */ + +package org.onap.clamp.clds.model; + +/** + * Maintains model and template details. + */ +public class CLDSMonitoringDetails { + + private String closeloopName; + private String modelName; + private String serviceTypeId; + private String deploymentId; + private String templateName; + private String action; + private String userid; + private String timestamp; + + public String getCloseloopName() { + return closeloopName; + } + + public void setCloseloopName(String closeloopName) { + this.closeloopName = closeloopName; + } + + public String getModelName() { + return modelName; + } + + public void setModelName(String modelName) { + this.modelName = modelName; + } + + public String getServiceTypeId() { + return serviceTypeId; + } + + public void setServiceTypeId(String serviceTypeId) { + this.serviceTypeId = serviceTypeId; + } + + public String getDeploymentId() { + return deploymentId; + } + + public void setDeploymentId(String deploymentId) { + this.deploymentId = deploymentId; + } + + public String getTemplateName() { + return templateName; + } + + public void setTemplateName(String templateName) { + this.templateName = templateName; + } + + public String getAction() { + return action; + } + + public void setAction(String action) { + this.action = action; + } + + public String getUserid() { + return userid; + } + + public void setUserid(String userid) { + this.userid = userid; + } + + public String getTimestamp() { + return timestamp; + } + + public void setTimestamp(String time) { + this.timestamp = time; + } + +} diff --git a/src/main/java/org/onap/clamp/clds/service/CldsService.java b/src/main/java/org/onap/clamp/clds/service/CldsService.java index 3c9e4704..1238236f 100644 --- a/src/main/java/org/onap/clamp/clds/service/CldsService.java +++ b/src/main/java/org/onap/clamp/clds/service/CldsService.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP CLAMP * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights + * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -23,7 +23,6 @@ package org.onap.clamp.clds.service; -import com.att.ajsc.common.AjscService; import com.att.eelf.configuration.EELFLogger; import com.att.eelf.configuration.EELFManager; import com.fasterxml.jackson.databind.JsonNode; @@ -33,6 +32,7 @@ import com.fasterxml.jackson.databind.node.ObjectNode; import java.io.IOException; import java.io.InputStream; import java.security.GeneralSecurityException; +import java.util.ArrayList; import java.util.Date; import java.util.HashMap; import java.util.List; @@ -68,6 +68,7 @@ import org.onap.clamp.clds.dao.CldsDao; import org.onap.clamp.clds.exception.CldsConfigException; import org.onap.clamp.clds.exception.SdcCommunicationException; import org.onap.clamp.clds.exception.policy.PolicyClientException; +import org.onap.clamp.clds.model.CLDSMonitoringDetails; import org.onap.clamp.clds.model.CldsDBServiceCache; import org.onap.clamp.clds.model.CldsEvent; import org.onap.clamp.clds.model.CldsHealthCheck; @@ -90,38 +91,36 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.ApplicationContext; import org.springframework.http.HttpStatus; +import org.springframework.stereotype.Component; import org.springframework.web.client.HttpClientErrorException; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; - /** * Service to save and retrieve the CLDS model attributes. */ -@AjscService -@Api(value = "/clds") +@Component @Path("/clds") public class CldsService extends SecureServiceBase { + protected static final EELFLogger securityLogger = EELFManager.getInstance().getSecurityLogger(); @Autowired - private ApplicationContext appContext; - private static final String RESOURCE_NAME = "clds-version.properties"; + private ApplicationContext appContext; + private static final String RESOURCE_NAME = "clds-version.properties"; @Value("${CLDS_PERMISSION_TYPE_CL:permission-type-cl}") - private String cldsPersmissionTypeCl; + private String cldsPersmissionTypeCl; @Value("${CLDS_PERMISSION_TYPE_CL_MANAGE:permission-type-cl-manage}") - private String cldsPermissionTypeClManage; + private String cldsPermissionTypeClManage; @Value("${CLDS_PERMISSION_TYPE_CL_EVENT:permission-type-cl-event}") - private String cldsPermissionTypeClEvent; + private String cldsPermissionTypeClEvent; @Value("${CLDS_PERMISSION_TYPE_FILTER_VF:permission-type-filter-vf}") - private String cldsPermissionTypeFilterVf; + private String cldsPermissionTypeFilterVf; @Value("${CLDS_PERMISSION_TYPE_TEMPLATE:permission-type-template}") - private String cldsPermissionTypeTemplate; + private String cldsPermissionTypeTemplate; @Value("${CLDS_PERMISSION_INSTANCE:dev}") - private String cldsPermissionInstance; - private SecureServicePermission permissionReadCl; - private SecureServicePermission permissionUpdateCl; - private SecureServicePermission permissionReadTemplate; - private SecureServicePermission permissionUpdateTemplate; + private String cldsPermissionInstance; + private SecureServicePermission permissionReadCl; + private SecureServicePermission permissionUpdateCl; + private SecureServicePermission permissionReadTemplate; + private SecureServicePermission permissionUpdateTemplate; @PostConstruct private final void afterConstruction() { @@ -134,28 +133,51 @@ public class CldsService extends SecureServiceBase { } @Value("${org.onap.clamp.config.files.globalClds:'classpath:/clds/globalClds.properties'}") - private String globalClds; - private Properties globalCldsProperties; + private String globalClds; + private Properties globalCldsProperties; @Autowired - private CldsDao cldsDao; + private CldsDao cldsDao; @Autowired - private RuntimeService runtimeService; + private RuntimeService runtimeService; @Autowired - private XslTransformer cldsBpmnTransformer; + private XslTransformer cldsBpmnTransformer; @Autowired - private RefProp refProp; + private RefProp refProp; @Autowired - private SdcCatalogServices sdcCatalogServices; + private SdcCatalogServices sdcCatalogServices; @Autowired private DcaeDispatcherServices dcaeDispatcherServices; @Autowired - private DcaeInventoryServices dcaeInventoryServices; + private DcaeInventoryServices dcaeInventoryServices; + + /* + * @return list of CLDS-Monitoring-Details: CLOSELOOP_NAME | Close loop name + * used in the CLDS application (prefix: ClosedLoop- + unique ClosedLoop ID) + * MODEL_NAME | Model Name in CLDS application SERVICE_TYPE_ID | TypeId + * returned from the DCAE application when the ClosedLoop is submitted + * (DCAEServiceTypeRequest generated in DCAE application). DEPLOYMENT_ID | + * Id generated when the ClosedLoop is deployed in DCAE. TEMPLATE_NAME | + * Template used to generate the ClosedLoop model. ACTION_CD | Current state + * of the ClosedLoop in CLDS application. + */ + @GET + @Path("/cldsDetails") + @Produces(MediaType.APPLICATION_JSON) + public List getCLDSDetails() { + Date startTime = new Date(); + LoggingUtils.setRequestContext("CldsService: GET model details", getPrincipalName()); + List cldsMonitoringDetailsList = new ArrayList(); + cldsMonitoringDetailsList = cldsDao.getCLDSMonitoringDetails(); + // audit log + LoggingUtils.setTimeContext(startTime, new Date()); + LoggingUtils.setResponseContext("0", "Get cldsDetails success", this.getClass().getName()); + auditLogger.info("GET cldsDetails completed"); + return cldsMonitoringDetailsList; + } /* - * * CLDS IFO service will return 3 things 1. User Name 2. CLDS code version * that is currently installed from pom.xml file 3. User permissions - * */ @GET @Path("/cldsInfo") @@ -229,7 +251,6 @@ public class CldsService extends SecureServiceBase { * @param modelName * @return bpmn xml text - content of bpmn given name */ - @ApiOperation(value = "Retrieves BPMN for a CLDS model name from the database", notes = "This is only expected to be used for testing purposes, not by the UI", response = String.class) @GET @Path("/model/bpmn/{modelName}") @Produces(MediaType.TEXT_XML) @@ -254,7 +275,6 @@ public class CldsService extends SecureServiceBase { * @param modelName * @return image xml text - content of image given name */ - @ApiOperation(value = "Retrieves image for a CLDS model name from the database", notes = "This is only expected to be used for testing purposes, not by the UI", response = String.class) @GET @Path("/model/image/{modelName}") @Produces(MediaType.TEXT_XML) @@ -277,7 +297,6 @@ public class CldsService extends SecureServiceBase { * @param modelName * @return clds model - clds model for the given model name */ - @ApiOperation(value = "Retrieves a CLDS model by name from the database", notes = "", response = String.class) @GET @Path("/model/{modelName}") @Produces(MediaType.APPLICATION_JSON) @@ -288,15 +307,10 @@ public class CldsService extends SecureServiceBase { logger.debug("GET model for modelName={}", modelName); CldsModel cldsModel = CldsModel.retrieve(cldsDao, modelName, false); isAuthorizedForVf(cldsModel); - /** - * Checking condition whether our CLDS model can call INventory Method - */ + // Checking condition whether our CLDS model can call Inventory Method if (cldsModel.canInventoryCall()) { try { - /* - * Below is the method to for inventory call and DB insert for - * event methods - */ + // Method to call dcae inventory and invoke insert event method dcaeInventoryServices.setEventInventory(cldsModel, getUserId()); } catch (Exception e) { LoggingUtils.setErrorContext("900", "Set event inventory error"); @@ -315,7 +329,6 @@ public class CldsService extends SecureServiceBase { * * @param modelName */ - @ApiOperation(value = "Saves a CLDS model by name in the database", notes = "", response = String.class) @PUT @Path("/model/{modelName}") @Consumes(MediaType.APPLICATION_JSON) @@ -350,7 +363,6 @@ public class CldsService extends SecureServiceBase { * * @return model names in JSON */ - @ApiOperation(value = "Retrieves a list of CLDS model names", notes = "", response = String.class) @GET @Path("/model-names") @Produces(MediaType.APPLICATION_JSON) @@ -384,7 +396,6 @@ public class CldsService extends SecureServiceBase { * @throws DecoderException * In case of issues with the Hex String decoding */ - @ApiOperation(value = "Saves and processes an action for a CLDS model by name", notes = "", response = String.class) @PUT @Path("/action/{action}/{modelName}") @Consumes(MediaType.APPLICATION_JSON) @@ -476,8 +487,9 @@ public class CldsService extends SecureServiceBase { } // refresh model info from db (get fresh event info) CldsModel retreivedModel = CldsModel.retrieve(cldsDao, modelName, false); - if (actionCd.equalsIgnoreCase(CldsEvent.ACTION_SUBMIT) - || actionCd.equalsIgnoreCase(CldsEvent.ACTION_RESUBMIT)) { + if (!isTest && (actionCd.equalsIgnoreCase(CldsEvent.ACTION_SUBMIT) + || actionCd.equalsIgnoreCase(CldsEvent.ACTION_RESUBMIT) + || actionCd.equalsIgnoreCase(CldsEvent.ACTION_SUBMITDCAE))) { // To verify inventory status and modify model status to distribute dcaeInventoryServices.setEventInventory(retreivedModel, getUserId()); retreivedModel.save(cldsDao, getUserId()); @@ -495,7 +507,6 @@ public class CldsService extends SecureServiceBase { * @param test * @param dcaeEvent */ - @ApiOperation(value = "Accepts events for a model", notes = "", response = String.class) @POST @Path("/dcae/event") @Consumes(MediaType.APPLICATION_JSON) @@ -550,9 +561,7 @@ public class CldsService extends SecureServiceBase { * In case of issue when decryting the SDC password * @throws DecoderException * In case of issues with the decoding of the Hex String - * */ - @ApiOperation(value = "Retrieves sdc services", notes = "", response = String.class) @GET @Path("/sdc/services") @Produces(MediaType.APPLICATION_JSON) @@ -580,9 +589,7 @@ public class CldsService extends SecureServiceBase { * * @throws IOException * In case of issues - * */ - @ApiOperation(value = "Retrieves total properties required by UI", notes = "", response = String.class) @GET @Path("/properties") @Produces(MediaType.APPLICATION_JSON) @@ -598,9 +605,7 @@ public class CldsService extends SecureServiceBase { * In case of issues with the decryting the encrypted password * @throws DecoderException * In case of issues with the decoding of the Hex String - * */ - @ApiOperation(value = "Retrieves total properties by using invariantUUID based on refresh and non refresh", notes = "", response = String.class) @GET @Path("/properties/{serviceInvariantUUID}") @Produces(MediaType.APPLICATION_JSON) @@ -950,10 +955,9 @@ public class CldsService extends SecureServiceBase { && resourceVf.get(0).equalsIgnoreCase(currentVf.get(0))) { throw new BadRequestException("Same Service/VF already exists in " + cldsModelProp.getName() + " model, please select different Service/VF."); - } } } } } -} +} \ No newline at end of file diff --git a/src/main/java/org/onap/clamp/clds/service/CldsTemplateService.java b/src/main/java/org/onap/clamp/clds/service/CldsTemplateService.java index 070c0667..e64f74bb 100644 --- a/src/main/java/org/onap/clamp/clds/service/CldsTemplateService.java +++ b/src/main/java/org/onap/clamp/clds/service/CldsTemplateService.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP CLAMP * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights + * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -23,7 +23,6 @@ package org.onap.clamp.clds.service; -import com.att.ajsc.common.AjscService; import com.fasterxml.jackson.core.JsonParseException; import com.fasterxml.jackson.databind.JsonMappingException; @@ -47,17 +46,19 @@ import org.onap.clamp.clds.model.ValueItem; import org.onap.clamp.clds.util.LoggingUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; /** * Service to save and retrieve the CLDS model attributes. */ -@AjscService +@Component @Path("/cldsTempate") public class CldsTemplateService extends SecureServiceBase { + @Value("${CLDS_PERMISSION_TYPE_TEMPLATE:permission-type-template}") - private String cldsPermissionTypeTemplate; + private String cldsPermissionTypeTemplate; @Value("${CLDS_PERMISSION_INSTANCE:dev}") - private String cldsPermissionInstance; + private String cldsPermissionInstance; private SecureServicePermission permissionReadTemplate; private SecureServicePermission permissionUpdateTemplate; diff --git a/src/main/java/org/onap/clamp/clds/exception/AjscExceptionMapper.java b/src/main/java/org/onap/clamp/clds/service/JerseyConfig.java similarity index 59% rename from src/main/java/org/onap/clamp/clds/exception/AjscExceptionMapper.java rename to src/main/java/org/onap/clamp/clds/service/JerseyConfig.java index 6aeadc54..0ffe4103 100644 --- a/src/main/java/org/onap/clamp/clds/exception/AjscExceptionMapper.java +++ b/src/main/java/org/onap/clamp/clds/service/JerseyConfig.java @@ -2,40 +2,40 @@ * ============LICENSE_START======================================================= * ONAP CLAMP * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights + * Copyright (C) 2018 AT&T Intellectual Property. 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. + * 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 + * + * 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============================================ * =================================================================== * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.onap.clamp.clds.exception; +package org.onap.clamp.clds.service; -import javax.ws.rs.core.Response; -import javax.ws.rs.ext.ExceptionMapper; +import org.glassfish.jersey.server.ResourceConfig; +import org.springframework.stereotype.Component; -import com.att.ajsc.common.AjscProvider; -import com.att.ajsc.common.exception.ServerErrorException; -import com.att.ajsc.common.exception.ServiceException; +@Component +public class JerseyConfig extends ResourceConfig { -@AjscProvider -public class AjscExceptionMapper implements ExceptionMapper { + public JerseyConfig() { + registerEndpoints(); + } - @Override - public Response toResponse(final Exception exception) { - return exception instanceof ServiceException ? ((ServiceException) exception).toResponse() - : new ServerErrorException(exception.getMessage()).toResponse(); + private void registerEndpoints() { + register(CldsService.class); + register(UserService.class); + register(CldsTemplateService.class); } -} +} \ No newline at end of file diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 321d88e1..1db0875a 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -2,7 +2,7 @@ # ============LICENSE_START======================================================= # ONAP CLAMP # ================================================================================ -# Copyright (C) 2017 AT&T Intellectual Property. All rights +# Copyright (C) 2017-2018 AT&T Intellectual Property. All rights # reserved. # ================================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); @@ -62,7 +62,8 @@ server.port=8080 server.contextPath=/ #Modified engine-rest applicationpath -spring.jersey.application-path=/engine-rest +#camel.component.servlet.mapping.context-path=/restservices/clds/v1/* +spring.jersey.application-path=/restservices/clds/v1 spring.profiles.active=clamp-default,clamp-spring-authentication #The max number of active threads in this pool @@ -72,11 +73,6 @@ server.tomcat.min-Spare-Threads=25 #The number of milliseconds before an idle thread shutsdown, unless the number of active threads are less or equal to minSpareThreads server.tomcat.max-idle-time=60000 - -#Add this properties only if you want to change the URL, AJSC Framework interceptors will intercept -#com.att.ajsc.common.interceptors.PreInterceptor.url=/** -#com.att.ajsc.common.interceptors.PostInterceptor.url=/** - #Servlet context parameters server.context_parameters.p-name=value #context parameter with p-name as key and value as value. @@ -89,8 +85,6 @@ camel.defaultthreadpool.maxqueuesize=1000 camel.defaultthreadpool.keepaliveTime=60 camel.defaultthreadpool.rejectpolicy=CallerRuns -kubernetes.namespace=com-att-ajsc - #server.port=0 #Camunda Process Engine DataSource connection Details spring.datasource.camunda.driverClassName=org.mariadb.jdbc.Driver @@ -111,7 +105,7 @@ spring.datasource.camunda.ignoreExceptionOnPreLoad=true #Camunda history level camunda.bpm.history-level=auto camunda.bpm.database.type=mariadb -camunda.bpm.database.schema-update=false +camunda.bpm.database.schema-update=true #clds datasource connection details spring.datasource.cldsdb.driverClassName=org.mariadb.jdbc.Driver @@ -133,13 +127,6 @@ async.core.pool.size=10 async.max.pool.size=20 async.queue.capacity=500 -#GRM Edge endpoint details -service.name=ajsc6camundademo -service.version=1.0.0.0 -routeoffer=TEST -#Update with your application name -application.name=AJSC6CAMUNDA - org.onap.clamp.config.files.cldsReference=classpath:/clds/clds-reference.properties org.onap.clamp.config.files.cldsPolicyConfig=classpath:/clds/clds-policy-config.properties org.onap.clamp.config.files.cldsUsers=classpath:/clds/clds-users.json diff --git a/src/main/resources/bootstrap.properties b/src/main/resources/bootstrap.properties deleted file mode 100644 index b0cfde57..00000000 --- a/src/main/resources/bootstrap.properties +++ /dev/null @@ -1,34 +0,0 @@ -### -# ============LICENSE_START======================================================= -# ONAP CLAMP -# ================================================================================ -# Copyright (C) 2017 AT&T Intellectual Property. 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============================================ -# =================================================================== -# ECOMP is a trademark and service mark of AT&T Intellectual Property. -### - -spring.cloud.config.discovery.enabled=false -spring.cloud.config.enabled=false - -# Allow Spring Cloud properties configuration to override properties set from System Properties and ENV Properties -spring.cloud.config.overrideSystemProperties=true - -# Path to the file containing the dynamic logger levels -com.att.ajsc.dynamic.logging.path=./logging.properties - -# File watcher polling frequency in milliseconds -com.att.ajsc.dynamic.watcher.delay=5000 diff --git a/src/main/resources/clds/clds-reference.properties b/src/main/resources/clds/clds-reference.properties index 998bf7c7..95ba919c 100644 --- a/src/main/resources/clds/clds-reference.properties +++ b/src/main/resources/clds/clds-reference.properties @@ -2,7 +2,7 @@ # ============LICENSE_START======================================================= # ONAP CLAMP # ================================================================================ -# Copyright (C) 2017 AT&T Intellectual Property. All rights +# Copyright (C) 2017-2018 AT&T Intellectual Property. All rights # reserved. # ================================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); @@ -88,7 +88,7 @@ sdc.artifactType=DCAE_INVENTORY_BLUEPRINT sdc.locationArtifactLabel=locationclampcockpit sdc.locationArtifactType=DCAE_INVENTORY_JSON sdc.InstanceID=X-ECOMP-InstanceID -sdc.header.requestId=X-ECOMP-RequestID +sdc.header.requestId = X-ECOMP-RequestID # # ui.location.default={"DC1":"Data Center 1","DC2":"Data Center 2","DC3":"Data Center 3"} @@ -106,4 +106,3 @@ DCAE_INVENTORY_URL = http://dcae.api.simpledemo.onap.org:8080 #DCAE Dispatcher Url Properties DCAE_DISPATCHER_URL = http://dcae.api.simpledemo.onap.org:8080 dcae.header.requestId = X-ECOMP-RequestID - diff --git a/src/main/resources/logback.xml b/src/main/resources/logback.xml index e02a320d..b898998c 100644 --- a/src/main/resources/logback.xml +++ b/src/main/resources/logback.xml @@ -1,5 +1,4 @@ - ${module.ajsc.namespace.name} @@ -149,29 +148,6 @@ - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/main/resources/system.properties b/src/main/resources/system.properties index 9d6386f4..08b9b19c 100644 --- a/src/main/resources/system.properties +++ b/src/main/resources/system.properties @@ -2,7 +2,7 @@ # ============LICENSE_START======================================================= # ONAP CLAMP # ================================================================================ -# Copyright (C) 2017 AT&T Intellectual Property. All rights +# Copyright (C) 2017-2018 AT&T Intellectual Property. All rights # reserved. # ================================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); @@ -29,8 +29,6 @@ com.att.eelf.logging.file=classpath:/logback.xml com.att.eelf.logging.path=./ logging.config=classpath:/logback.xml -com.att.ajsc.app.prop.path=./ - # # JVM SSL/TLS properties jdk.tls.client.protocols=TLSv1.1,TLSv1.2 diff --git a/src/test/java/org/onap/clamp/clds/AbstractItCase.java b/src/test/java/org/onap/clamp/clds/AbstractItCase.java index d3f64240..2903248b 100644 --- a/src/test/java/org/onap/clamp/clds/AbstractItCase.java +++ b/src/test/java/org/onap/clamp/clds/AbstractItCase.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP CLAMP * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights + * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -33,13 +33,12 @@ import org.springframework.test.context.ActiveProfiles; public abstract class AbstractItCase { @Autowired - protected RefProp refProp; + protected RefProp refProp; @Autowired protected PolicyClient policyClient; @BeforeClass public static void oneTimeSetUp() { - System.setProperty("AJSC_CONF_HOME", System.getProperty("user.dir") + "/src/it/resources/"); System.setProperty("CLDS_DCAE_URL", "http://localhost:13786/cl-dcae-services"); } } diff --git a/src/test/resources/application-no-camunda.properties b/src/test/resources/application-no-camunda.properties index ece42484..f7b2bade 100644 --- a/src/test/resources/application-no-camunda.properties +++ b/src/test/resources/application-no-camunda.properties @@ -2,7 +2,7 @@ # ============LICENSE_START======================================================= # ONAP CLAMP # ================================================================================ -# Copyright (C) 2017 AT&T Intellectual Property. All rights +# Copyright (C) 2017-2018 AT&T Intellectual Property. All rights # reserved. # ================================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); @@ -35,7 +35,6 @@ server.port=10443 server.ssl.key-store=classpath:https/keystore-test.jks server.ssl.key-store-password=testpass server.ssl.key-password=testpass -spring.autoconfigure.exclude=com.att.ajsc.camunda.config.CamundaBpmWebappInitializer,com.att.ajsc.camunda.config.CamundaBpmWebappAutoConfiguration ### In order to be user friendly when HTTPS is enabled, ### you can add another HTTP port that will be automatically redirected to HTTPS ### by enabling this parameter (server.http.port) and set it to another port (80 or 8080, 8090, etc ...) @@ -62,7 +61,7 @@ spring.autoconfigure.exclude=com.att.ajsc.camunda.config.CamundaBpmWebappInitial server.contextPath=/ #Modified engine-rest applicationpath -spring.jersey.application-path=/engine-rest +spring.jersey.application-path=/restservices/clds/v1 spring.profiles.active=clamp-default,clamp-spring-authentication #The max number of active threads in this pool @@ -72,11 +71,6 @@ server.tomcat.min-Spare-Threads=25 #The number of milliseconds before an idle thread shutsdown, unless the number of active threads are less or equal to minSpareThreads server.tomcat.max-idle-time=60000 - -#Add this properties only if you want to change the URL, AJSC Framework interceptors will intercept -#com.att.ajsc.common.interceptors.PreInterceptor.url=/** -#com.att.ajsc.common.interceptors.PostInterceptor.url=/** - #Servlet context parameters server.context_parameters.p-name=value #context parameter with p-name as key and value as value. @@ -89,8 +83,6 @@ camel.defaultthreadpool.maxqueuesize=1000 camel.defaultthreadpool.keepaliveTime=60 camel.defaultthreadpool.rejectpolicy=CallerRuns -kubernetes.namespace=com-att-ajsc - #server.port=0 #Camunda Process Engine DataSource connection Details @@ -110,13 +102,16 @@ spring.datasource.camunda.ignoreExceptionOnPreLoad=true #Camunda application properties #Camunda history level -camunda.bpm.history-level=auto +camunda.bpm.history-level=none camunda.bpm.enabled=false +camunda.bpm.jpa.enabled=false camunda.bpm.auto-deployment-enabled=false camunda.bpm.job-execution.active=false camunda.bpm.job-execution.enabled=false camunda.bpm.management.health.camunda.enabled=false camunda.bpm.metrics.enabled=false +camunda.bpm.management.health.camunda.enabled=false +camunda.bpm.database.schema-update=true #clds datasource connection details spring.datasource.cldsdb.driverClassName=org.mariadb.jdbc.Driver @@ -138,13 +133,6 @@ async.core.pool.size=10 async.max.pool.size=20 async.queue.capacity=500 -#GRM Edge endpoint details -service.name=ajsc6camundademo -service.version=1.0.0.0 -routeoffer=TEST -#Update with your application name -application.name=AJSC6CAMUNDA - org.onap.clamp.config.files.cldsReference=classpath:/clds/clds-reference.properties org.onap.clamp.config.files.cldsPolicyConfig=classpath:/clds/clds-policy-config.properties org.onap.clamp.config.files.cldsUsers=classpath:/clds/clds-users.json diff --git a/src/test/resources/https/https-test.properties b/src/test/resources/https/https-test.properties index bd84242e..54005ef2 100644 --- a/src/test/resources/https/https-test.properties +++ b/src/test/resources/https/https-test.properties @@ -2,7 +2,7 @@ # ============LICENSE_START======================================================= # ONAP CLAMP # ================================================================================ -# Copyright (C) 2017 AT&T Intellectual Property. All rights +# Copyright (C) 2017-2018 AT&T Intellectual Property. All rights # reserved. # ================================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); @@ -62,7 +62,7 @@ server.http-to-https-redirection.port=10080 server.contextPath=/ #Modified engine-rest applicationpath -spring.jersey.application-path=/engine-rest +spring.jersey.application-path=/restservices/clds/v1 spring.profiles.active=clamp-default,clamp-spring-authentication #The max number of active threads in this pool @@ -72,11 +72,6 @@ server.tomcat.min-Spare-Threads=25 #The number of milliseconds before an idle thread shutsdown, unless the number of active threads are less or equal to minSpareThreads server.tomcat.max-idle-time=60000 - -#Add this properties only if you want to change the URL, AJSC Framework interceptors will intercept -#com.att.ajsc.common.interceptors.PreInterceptor.url=/** -#com.att.ajsc.common.interceptors.PostInterceptor.url=/** - #Servlet context parameters server.context_parameters.p-name=value #context parameter with p-name as key and value as value. @@ -89,8 +84,6 @@ camel.defaultthreadpool.maxqueuesize=1000 camel.defaultthreadpool.keepaliveTime=60 camel.defaultthreadpool.rejectpolicy=CallerRuns -kubernetes.namespace=com-att-ajsc - #server.port=0 #Camunda Process Engine DataSource connection Details spring.datasource.camunda.driverClassName=org.mariadb.jdbc.Driver @@ -110,13 +103,16 @@ spring.datasource.camunda.ignoreExceptionOnPreLoad=true #Camunda application properties #Camunda history level -camunda.bpm.history-level=auto +camunda.bpm.history-level=none camunda.bpm.enabled=false +camunda.bpm.jpa.enabled=false camunda.bpm.auto-deployment-enabled=false camunda.bpm.job-execution.active=false camunda.bpm.job-execution.enabled=false camunda.bpm.management.health.camunda.enabled=false camunda.bpm.metrics.enabled=false +camunda.bpm.management.health.camunda.enabled=false +camunda.bpm.database.schema-update=true #clds datasource connection details spring.datasource.cldsdb.driverClassName=org.mariadb.jdbc.Driver @@ -138,13 +134,6 @@ async.core.pool.size=10 async.max.pool.size=20 async.queue.capacity=500 -#GRM Edge endpoint details -service.name=ajsc6camundademo -service.version=1.0.0.0 -routeoffer=TEST -#Update with your application name -application.name=AJSC6CAMUNDA - org.onap.clamp.config.files.cldsReference=classpath:/clds/clds-reference.properties org.onap.clamp.config.files.cldsPolicyConfig=classpath:/clds/clds-policy-config.properties org.onap.clamp.config.files.cldsUsers=classpath:/clds/clds-users.json diff --git a/src/test/resources/processes.xml b/src/test/resources/processes.xml deleted file mode 100644 index fddc60d1..00000000 --- a/src/test/resources/processes.xml +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - default - bpmn/log-message.bpmn - - true - false - - - - -- 2.16.6