diff options
Diffstat (limited to 'src')
17 files changed, 338 insertions, 671 deletions
diff --git a/src/main/java/org/onap/clamp/clds/Application.java b/src/main/java/org/onap/clamp/clds/Application.java index 4fc68e1d0..0304a6806 100644 --- a/src/main/java/org/onap/clamp/clds/Application.java +++ b/src/main/java/org/onap/clamp/clds/Application.java @@ -36,6 +36,8 @@ 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; @@ -43,6 +45,7 @@ import org.springframework.boot.actuate.autoconfigure.ManagementWebSecurityAutoC import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.data.jpa.JpaRepositoriesAutoConfiguration; +import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration; import org.springframework.boot.autoconfigure.security.SecurityAutoConfiguration; import org.springframework.boot.builder.SpringApplicationBuilder; @@ -57,8 +60,8 @@ import org.springframework.scheduling.annotation.EnableAsync; @SpringBootApplication @ComponentScan(basePackages = { "org.onap.clamp.clds", "com.att.ajsc" }) -@EnableAutoConfiguration(exclude = { CamundaBpmWebappAutoConfiguration.class, HibernateJpaAutoConfiguration.class, - JpaRepositoriesAutoConfiguration.class, SecurityAutoConfiguration.class, +@EnableAutoConfiguration(exclude = { DataSourceAutoConfiguration.class, CamundaBpmWebappAutoConfiguration.class, + HibernateJpaAutoConfiguration.class, JpaRepositoriesAutoConfiguration.class, SecurityAutoConfiguration.class, ManagementWebSecurityAutoConfiguration.class }) @EnableAsync public class Application extends SpringBootServletInitializer { @@ -92,11 +95,19 @@ public class Application extends SpringBootServletInitializer { return application.sources(Application.class); } - public static void main(String[] args) throws Exception { + 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 SpringApplication.run(Application.class, args); // NOSONAR } + private static void initializeComponents() { + ModelProperties.registerModelElement(Holmes.class, Holmes.getType()); + } + @Bean public ServletRegistrationBean servletRegistrationBean() { ServletRegistrationBean registration = new ServletRegistrationBean(); 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 fa0ca9615..c00deea66 100644 --- a/src/main/java/org/onap/clamp/clds/config/CldsConfiguration.java +++ b/src/main/java/org/onap/clamp/clds/config/CldsConfiguration.java @@ -52,6 +52,7 @@ 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.boot.autoconfigure.jdbc.DataSourceBuilder; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.context.ApplicationContext; @@ -67,7 +68,7 @@ public class CldsConfiguration { private ApplicationContext context; /** - * Clds Identity databse DataSource configuration + * Clds Identity database DataSource configuration */ @Bean(name = "cldsDataSource") @ConfigurationProperties(prefix = "spring.datasource.cldsdb") @@ -86,9 +87,9 @@ public class CldsConfiguration { } @Bean(name = "cldsDao") - public CldsDao getCldsDao() { + public CldsDao getCldsDao(@Qualifier("cldsDataSource") DataSource dataSource) { CldsDao cldsDao = new CldsDao(); - cldsDao.setDataSource(cldsDataSource()); + cldsDao.setDataSource(dataSource); return cldsDao; } diff --git a/src/main/java/org/onap/clamp/clds/model/prop/ModelProperties.java b/src/main/java/org/onap/clamp/clds/model/prop/ModelProperties.java index ac25400db..dc0de326b 100644 --- a/src/main/java/org/onap/clamp/clds/model/prop/ModelProperties.java +++ b/src/main/java/org/onap/clamp/clds/model/prop/ModelProperties.java @@ -46,28 +46,28 @@ import org.onap.clamp.clds.service.CldsService; * Parse model properties. */ public class ModelProperties { - protected static final EELFLogger logger = EELFManager.getInstance() + protected static final EELFLogger logger = EELFManager.getInstance() .getLogger(CldsService.class); - protected static final EELFLogger auditLogger = EELFManager.getInstance() + protected static final EELFLogger auditLogger = EELFManager.getInstance() .getAuditLogger(); - private ModelBpmn modelBpmn; - private JsonNode modelJson; + private ModelBpmn modelBpmn; + private JsonNode modelJson; - private final String modelName; - private final String controlName; - private final String actionCd; + private final String modelName; + private final String controlName; + private final String actionCd; // Flag indicate whether it is triggered by Validation Test button from UI - private final boolean isTest; + private final boolean isTest; - private Global global; + private Global global; private final Map<String, AbstractModelElement> modelElements = new ConcurrentHashMap<>(); - private String currentModelElementId; - private String policyUniqueId; + private String currentModelElementId; + private String policyUniqueId; - private static final Object lock = new Object(); + private static final Object lock = new Object(); private static Map<Class<? extends AbstractModelElement>, String> modelElementClasses = new ConcurrentHashMap<>(); static { @@ -84,21 +84,28 @@ public class ModelProperties { * parse them all - parse them on demand if requested.) * * @param modelName + * The model name coming form the UI * @param controlName + * The closed loop name coming from the UI * @param actionCd + * Type of operation PUT,UPDATE,DELETE * @param isTest - * @param modelBpmnPropText + * The test flag coming from the UI (for validation only, no + * query are physically executed) + * @param modelBpmnText + * The BPMN flow in JSON from the UI * @param modelPropText - * @throws JsonProcessingException + * The BPMN parameters for all boxes defined in modelBpmnTest * @throws IOException + * In case there is an issue with the JSON decoding */ - public ModelProperties(String modelName, String controlName, String actionCd, boolean isTest, - String modelBpmnPropText, String modelPropText) throws IOException { + public ModelProperties(String modelName, String controlName, String actionCd, boolean isTest, String modelBpmnText, + String modelPropText) throws IOException { this.modelName = modelName; this.controlName = controlName; this.actionCd = actionCd; this.isTest = isTest; - modelBpmn = ModelBpmn.create(modelBpmnPropText); + modelBpmn = ModelBpmn.create(modelBpmnText); modelJson = new ObjectMapper().readTree(modelPropText); instantiateMissingModelElements(); diff --git a/src/main/java/org/onap/clamp/clds/service/LogService.java b/src/main/java/org/onap/clamp/clds/service/LogService.java deleted file mode 100644 index 1c3d9dc67..000000000 --- a/src/main/java/org/onap/clamp/clds/service/LogService.java +++ /dev/null @@ -1,38 +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.service; - -public interface LogService { - - String logMessage(String logMessageText, String javamail, String springmail, String commonsmail); - - String postLogMessage(String histEventList); - - String createLogMessage(String startTime, String endTime, String serviceName); - - String createLogMessageUsingHistory(String procInstId, String histEventList); - - String CreateHistLog(String procInstId); - -} diff --git a/src/main/java/org/onap/clamp/clds/service/LogServiceImpl.java b/src/main/java/org/onap/clamp/clds/service/LogServiceImpl.java deleted file mode 100644 index 2f02aa6ab..000000000 --- a/src/main/java/org/onap/clamp/clds/service/LogServiceImpl.java +++ /dev/null @@ -1,295 +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.service; - -import com.att.ajsc.camunda.core.AttCamundaHistoryEvent; -import com.att.ajsc.camunda.core.AttCamundaService; -import com.att.eelf.configuration.EELFLogger; -import com.att.eelf.configuration.EELFManager; -import com.google.gson.Gson; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Properties; - -import javax.mail.Message; -import javax.mail.MessagingException; -import javax.mail.Session; -import javax.mail.Transport; -import javax.mail.internet.InternetAddress; -import javax.mail.internet.MimeMessage; -import javax.ws.rs.core.Context; - -import org.apache.commons.mail.Email; -import org.apache.commons.mail.SimpleEmail; -import org.apache.cxf.jaxrs.ext.MessageContext; -import org.camunda.bpm.engine.HistoryService; -import org.camunda.bpm.engine.RuntimeService; -import org.camunda.bpm.engine.history.HistoricActivityInstance; -import org.camunda.bpm.engine.impl.history.event.HistoricActivityInstanceEventEntity; -import org.camunda.bpm.engine.runtime.ProcessInstance; -import org.onap.clamp.clds.common.LogMessages; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.mail.MailException; -import org.springframework.mail.SimpleMailMessage; -import org.springframework.mail.javamail.JavaMailSenderImpl; -import org.springframework.stereotype.Service; - -@Service -public class LogServiceImpl implements LogService { - protected static final EELFLogger logger = EELFManager.getInstance().getLogger(LogServiceImpl.class); - protected static final EELFLogger auditLogger = EELFManager.getInstance().getAuditLogger(); - - @Autowired - private RuntimeService runtimeService; - - @Autowired - private HistoryService historyService; - - @Context - private MessageContext context; - - public void setRuntimeService(RuntimeService runtimeService) { - this.runtimeService = runtimeService; - } - - public LogServiceImpl() { - // needed for instantiation - } - - @Override - public String logMessage(String logMessageText, String javamail, String springmail, String commonsmail) { - logger.info("Value of contexxt : " + context); - String convId = null; - if (context != null) { - convId = context.getHttpServletRequest().getHeader("X-CSI-ConversationId"); - if (convId == null) { - convId = (String) context.getHttpServletRequest().getAttribute("X-CSI-ConversationId"); - } - context.getHttpServletRequest().setAttribute("CALL_TYPE", "Testing"); - AttCamundaService.setHttpRequest(context.getHttpServletRequest()); - } - // input variables to example camunda process - Map<String, Object> variables = new HashMap<>(); - variables.put("logMessageText", logMessageText); - if (convId != null) { - variables.put("conversationId", convId); - } - - // BEGIN - added for send mail testing - // also added the following to the method signature: , - // @QueryParam("javamail") String javamail, @QueryParam("springmail") - // String springmail, @QueryParam("commonsmail") String commonsmail - // if javamail parameter provided, assume it contains an email address. - // use Java Mail to send an email from that address, to that address - if (javamail != null && javamail.length() > 0) { - variables.put("javamail", javamail); - try { - Properties props = new Properties(); - props.put("mail.smtp.host", "smtp.sbc.com"); // eMail.setHostName - Session session = Session.getInstance(props); - MimeMessage msg = new MimeMessage(session); - - msg.setFrom(new InternetAddress(javamail)); // eMail.setFrom - - InternetAddress[] fromAddresses = { new InternetAddress(javamail) }; - msg.setReplyTo(fromAddresses); // eMail.addReplyTo - msg.setSubject("test message using javax.mail"); // eMail.setSubject - msg.setText(logMessageText); // eMail.setMsg - - msg.addRecipient(Message.RecipientType.TO, new InternetAddress(javamail)); // eMail.addTo - Transport.send(msg); - } catch (MessagingException e) { - logger.error(LogMessages.LOGSERVICE_EMAIL_ERROR, e); - } - } - - // if springmail parameter provided, assume it contains an email - // address. - // use Spring Mail to send an email from that address, to that address - if (springmail != null && springmail.length() > 0) { - variables.put("springmail", springmail); - JavaMailSenderImpl sender = new JavaMailSenderImpl(); - SimpleMailMessage smsg = new SimpleMailMessage(); - - try { - sender.setHost("smtp.sbc.com"); // eMail.setHostName - smsg.setFrom(springmail); // eMail.setFrom - smsg.setReplyTo(springmail); // eMail.addReplyTo - smsg.setSubject("test message using spring mail"); // eMail.setSubject - smsg.setText(logMessageText); // eMail.setMsg - smsg.setTo(springmail); // eMail.addTo - sender.send(smsg); - } catch (MailException e) { - logger.error(LogMessages.LOGSERVICE_EMAIL_ERROR, e); - } - } - - // if commonsmail parameter provided, assume it contains an email - // address. - // use Apache Commons Mail to send an email from that address, to that - // address - if (commonsmail != null && commonsmail.length() > 0) { - variables.put("commonsmail", commonsmail); - Email email = new SimpleEmail(); - try { - email.setHostName("smtp.sbc.com"); - email.setFrom(commonsmail); - email.addReplyTo(commonsmail); - email.setSubject("test message using commons mail"); - email.setMsg(logMessageText); - email.addTo(commonsmail); - java.net.URL classUrl = this.getClass().getResource("com.sun.mail.util.TraceInputStream"); - if (classUrl != null) { - logger.info(LogMessages.LOGSERVICE_EMAIL_CLASS, classUrl.getFile()); - } else { - logger.info(LogMessages.LOGSERVICE_EMAIL_CLASS_NULL); - } - email.send(); - } catch (Exception e) { - logger.error(LogMessages.LOGSERVICE_EMAIL_ERROR, e); - } - } - // END - added for send mail testing - - // execute example camunda process, log-message-wf - ProcessInstance pi = runtimeService.startProcessInstanceByKey("log-message-wf", variables); - AttCamundaService.setHttpRequest(null); - // return text message of what was done - return "Started processDefinitionId=" + pi.getProcessDefinitionId() + ", processInstanceId=" - + pi.getProcessInstanceId() + ", to log message: " + logMessageText; - } - - @Override - public String postLogMessage(String histEventList) { - String message = "no logs Created"; - logger.info("value of history events:" + histEventList); - Gson gson = new Gson(); - AttCamundaHistoryEvent attCamundaHistoryEvent = gson.fromJson(histEventList, AttCamundaHistoryEvent.class); - if (attCamundaHistoryEvent != null && attCamundaHistoryEvent.getProcInstId() != null) { - logger.info(LogMessages.PROCESS_INSTANCE_ID, attCamundaHistoryEvent.getProcInstId()); - if (context != null && context.getHttpServletRequest() != null - && context.getHttpServletRequest().getAttribute("PERFORMANCE_TRACKER_BEAN") != null) { - context.getHttpServletRequest().setAttribute("CALL_TYPE", "Testing"); - List<HistoricActivityInstance> histActInstList = historyService.createHistoricActivityInstanceQuery() - .processInstanceId(attCamundaHistoryEvent.getProcInstId()).list(); - - if (histActInstList != null && histActInstList.size() > 0) { - for (HistoricActivityInstance currHistoricActivityInstance : histActInstList) { - if (currHistoricActivityInstance != null - && currHistoricActivityInstance.getActivityName() != null - && currHistoricActivityInstance.getStartTime() != null - && currHistoricActivityInstance.getEndTime() != null) { - logger.info("value of serviceTrack:" + currHistoricActivityInstance); - message = "Log Entry Created"; - logger.info(message); - } - } - } - if (attCamundaHistoryEvent.getHistoryEventList() != null - && attCamundaHistoryEvent.getHistoryEventList().size() > 0) { - List<HistoricActivityInstanceEventEntity> historyEventList = attCamundaHistoryEvent - .getHistoryEventList(); - for (HistoricActivityInstanceEventEntity actiEvent : historyEventList) { - // resolve null pointer exception if - // actiEvent.getActivityName() - message = "Log Entry Created"; - } - } - } - } - return message; - } - - @Override - public String createLogMessage(String startTime, String endTime, String serviceName) { - String message = "no logs Created"; - - if (context != null && context.getHttpServletRequest() != null - && context.getHttpServletRequest().getAttribute("PERFORMANCE_TRACKER_BEAN") != null) { - context.getHttpServletRequest().setAttribute("X-CSI-ClientApp", "AJSC-CSI~sdsds"); - /* - * PerformanceTrackingBean trackingBean =(PerformanceTrackingBean) - * context.getHttpServletRequest().getAttribute( - * "PERFORMANCE_TRACKER_BEAN"); - * PerformanceTracking.addInvokeServiceTrack(trackingBean, - * serviceName, Long.valueOf(startTime), Long.valueOf(endTime), - * "Completed", 500, 1000) ; - */ - message = "Log Entry Created"; - } - // return text message of what was done - return message; - } - - @Override - public String createLogMessageUsingHistory(String procInstId, String histEventList) { - String message = "no logs Created"; - logger.info("value of history events:" + histEventList); - logger.info("value of events:" + histEventList + ":" + histEventList); - if (context != null && context.getHttpServletRequest() != null - && context.getHttpServletRequest().getAttribute("PERFORMANCE_TRACKER_BEAN") != null) { - context.getHttpServletRequest().setAttribute("CALL_TYPE", "Testing"); - List<HistoricActivityInstance> histActInstList = historyService.createHistoricActivityInstanceQuery() - .processInstanceId(procInstId).list(); - - if (histActInstList != null && histActInstList.size() > 0) { - for (HistoricActivityInstance currHistoricActivityInstance : histActInstList) { - if (currHistoricActivityInstance != null && currHistoricActivityInstance.getActivityName() != null - && currHistoricActivityInstance.getStartTime() != null - && currHistoricActivityInstance.getEndTime() != null) { - logger.info("value of serviceTrack:" + currHistoricActivityInstance); - message = "Log Entry Created"; - logger.info(message); - } - } - } - } - return message; - } - - @Override - public String CreateHistLog(String procInstId) { - String message = "no logs Created"; - if (context != null && context.getHttpServletRequest() != null - && context.getHttpServletRequest().getAttribute("PERFORMANCE_TRACKER_BEAN") != null) { - List<HistoricActivityInstance> histActInstList = historyService.createHistoricActivityInstanceQuery() - .processInstanceId(procInstId).list(); - - if (histActInstList != null && histActInstList.size() > 0) { - for (HistoricActivityInstance currHistoricActivityInstance : histActInstList) { - if (currHistoricActivityInstance != null && currHistoricActivityInstance.getActivityName() != null - && currHistoricActivityInstance.getStartTime() != null - && currHistoricActivityInstance.getEndTime() != null) { - logger.info("value of serviceTrack:" + currHistoricActivityInstance); - context.getHttpServletRequest().setAttribute("X-CSI-ClientApp", "AJSC-CSI~sdsds"); - message = "Log Entry Created"; - } - } - } - } - return message; - } -} diff --git a/src/main/resources/META-INF/processes.xml b/src/main/resources/META-INF/processes.xml index bd3547dfc..921a1029b 100644 --- a/src/main/resources/META-INF/processes.xml +++ b/src/main/resources/META-INF/processes.xml @@ -25,14 +25,6 @@ <process-application xmlns="http://www.camunda.org/schema/1.0/ProcessApplication" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <process-archive name="example-process-archive"> - <process-engine>default</process-engine> - <resource>bpmn/log-message.bpmn</resource> - <properties> - <property name="isDeleteUponUndeploy">true</property> - <property name="isScanForProcessDefinitions">false</property> - </properties> - </process-archive> <process-archive name="clds-process-archive"> <process-engine>default</process-engine> <resource>bpmn/clds-process-action.bpmn</resource> diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index a66557835..a7b16f250 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -64,7 +64,6 @@ server.contextPath=/ #Modified engine-rest applicationpath
spring.jersey.application-path=/engine-rest
spring.profiles.active=clamp-default,clamp-spring-authentication
-spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration,org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration
#The max number of active threads in this pool
server.tomcat.max-threads=200
@@ -93,34 +92,41 @@ 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
-spring.datasource.camunda.url=jdbc:mariadb://localhost:${docker.mariadb.port.host}/camundabpm?verifyServerCertificate=false&useSSL=false&requireSSL=false&autoReconnect=true&maxReconnects=100
+spring.datasource.camunda.url=jdbc:mariadb:sequential://localhost:${docker.mariadb.port.host}/camundabpm?autoReconnect=true&retriesAllDown=2147483647&failoverLoopRetries=2147483647
spring.datasource.camunda.username=camunda
spring.datasource.camunda.password=ndMSpw4CAM
spring.datasource.camunda.validationQuery=SELECT 1
spring.datasource.camunda.validationQueryTimeout=20000
-spring.datasource.camunda.validationInterval=60000
+spring.datasource.camunda.validationInterval=30000
spring.datasource.camunda.testWhileIdle = true
+spring.datasource.camunda.minIdle = 0
+spring.datasource.camunda.initialSize=0
# Automatically test whether a connection provided is good or not
spring.datasource.camunda.testOnBorrow=true
+spring.datasource.camunda.ignoreExceptionOnPreLoad=true
#Camunda application properties
#Camunda history level
camunda.bpm.history-level=auto
+camunda.bpm.database.type=mariadb
+camunda.bpm.database.schema-update=false
#clds datasource connection details
-spring.datasource.camunda.driverClassName=org.mariadb.jdbc.Driver
-spring.datasource.cldsdb.url=jdbc:mariadb://localhost:${docker.mariadb.port.host}/cldsdb4?verifyServerCertificate=false&useSSL=false&requireSSL=false&autoReconnect=true&maxReconnects=100
+spring.datasource.cldsdb.driverClassName=org.mariadb.jdbc.Driver
+spring.datasource.cldsdb.url=jdbc:mariadb:sequential://localhost:${docker.mariadb.port.host}/cldsdb4?autoReconnect=true&retriesAllDown=2147483647&failoverLoopRetries=2147483647
spring.datasource.cldsdb.username=clds
spring.datasource.cldsdb.password=sidnnd83K
spring.datasource.cldsdb.validationQuery=SELECT 1
spring.datasource.cldsdb.validationQueryTimeout=20000
-spring.datasource.cldsdb.validationInterval=60000
+spring.datasource.cldsdb.validationInterval=30000
spring.datasource.cldsdb.testWhileIdle = true
+spring.datasource.cldsdb.minIdle = 0
+spring.datasource.cldsdb.initialSize=0
# Automatically test whether a connection provided is good or not
spring.datasource.cldsdb.testOnBorrow=true
+spring.datasource.cldsdb.ignoreExceptionOnPreLoad=true
#Async Executor default Parameters
async.core.pool.size=10
diff --git a/src/main/resources/bpmn/SampleTestProcessDelegate.bpmn b/src/main/resources/bpmn/SampleTestProcessDelegate.bpmn deleted file mode 100644 index 41ffdb6dc..000000000 --- a/src/main/resources/bpmn/SampleTestProcessDelegate.bpmn +++ /dev/null @@ -1,79 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd" id="_7-gSIF09EeWE96cFqGLI8w" exporter="camunda modeler" exporterVersion="2.7.0" targetNamespace="http://camunda.org/schema/1.0/bpmn"> - <bpmn2:process id="SampleTestProcessDeleagate-wf" name="SampleTestProcessDeleagate-wf" isExecutable="true"> - <bpmn2:startEvent id="StartEcho" name="StartEvent"> - <bpmn2:outgoing>SequenceFlow_2</bpmn2:outgoing> - </bpmn2:startEvent> - <bpmn2:serviceTask id="ServiceTask_1" camunda:class="com.att.ajsc.clds.designer.workflow.PublishMessageDelegate" name="Perform "> - <bpmn2:incoming>SequenceFlow_2</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_1</bpmn2:outgoing> - </bpmn2:serviceTask> - <bpmn2:sequenceFlow id="SequenceFlow_2" name="" sourceRef="StartEcho" targetRef="ServiceTask_1"/> - <bpmn2:sequenceFlow id="SequenceFlow_1" name="" sourceRef="ServiceTask_1" targetRef="UserTask_1"/> - <bpmn2:userTask id="UserTask_1" camunda:assignee="bharath" name="HumanTask1"> - <bpmn2:incoming>SequenceFlow_1</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_6</bpmn2:outgoing> - </bpmn2:userTask> - <bpmn2:sequenceFlow id="SequenceFlow_6" name="" sourceRef="UserTask_1" targetRef="ServiceTask_3"/> - <bpmn2:serviceTask id="ServiceTask_3" camunda:class="com.att.ajsc.clds.designer.workflow.ConsumeMessageDelegate" name="AddServiceTask3"> - <bpmn2:incoming>SequenceFlow_6</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_5</bpmn2:outgoing> - </bpmn2:serviceTask> - <bpmn2:sequenceFlow id="SequenceFlow_5" name="" sourceRef="ServiceTask_3" targetRef="EndEvent_1"/> - <bpmn2:endEvent id="EndEvent_1" name="Endevent"> - <bpmn2:incoming>SequenceFlow_5</bpmn2:incoming> - </bpmn2:endEvent> - </bpmn2:process> - <bpmndi:BPMNDiagram id="BPMNDiagram_1"> - <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="SampleTestProcessDeleagate-wf"> - <bpmndi:BPMNShape id="_BPMNShape_StartEvent_3" bpmnElement="StartEcho"> - <dc:Bounds height="36.0" width="36.0" x="191.0" y="253.0"/> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="_BPMNShape_ServiceTask_4" bpmnElement="ServiceTask_1"> - <dc:Bounds height="80.0" width="100.0" x="277.0" y="231.0"/> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_2" bpmnElement="SequenceFlow_2" sourceElement="_BPMNShape_StartEvent_3" targetElement="_BPMNShape_ServiceTask_4"> - <di:waypoint xsi:type="dc:Point" x="227.0" y="271.0"/> - <di:waypoint xsi:type="dc:Point" x="277.0" y="271.0"/> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="_BPMNShape_EndEvent_103" bpmnElement="EndEvent_1"> - <dc:Bounds height="36.0" width="36.0" x="955.0" y="253.0"/> - <bpmndi:BPMNLabel> - <dc:Bounds height="25.0" width="73.0" x="938.0" y="294.0"/> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="_BPMNShape_ServiceTask_6" bpmnElement="ServiceTask_3"> - <dc:Bounds height="80.0" width="100.0" x="497.0" y="454.0"/> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_5" bpmnElement="SequenceFlow_5" sourceElement="_BPMNShape_ServiceTask_6" targetElement="_BPMNShape_EndEvent_103"> - <di:waypoint xsi:type="dc:Point" x="597.0" y="494.0"/> - <di:waypoint xsi:type="dc:Point" x="918.0" y="494.0"/> - <di:waypoint xsi:type="dc:Point" x="918.0" y="271.0"/> - <di:waypoint xsi:type="dc:Point" x="955.0" y="271.0"/> - <bpmndi:BPMNLabel> - <dc:Bounds height="6.0" width="6.0" x="915.0" y="271.0"/> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="_BPMNShape_UserTask_2" bpmnElement="UserTask_1"> - <dc:Bounds height="80.0" width="100.0" x="630.0" y="117.0"/> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_6" bpmnElement="SequenceFlow_6" sourceElement="_BPMNShape_UserTask_2" targetElement="_BPMNShape_ServiceTask_6"> - <di:waypoint xsi:type="dc:Point" x="730.0" y="187.0"/> - <di:waypoint xsi:type="dc:Point" x="730.0" y="494.0"/> - <di:waypoint xsi:type="dc:Point" x="597.0" y="494.0"/> - <bpmndi:BPMNLabel> - <dc:Bounds height="6.0" width="6.0" x="701.0" y="271.0"/> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_1" bpmnElement="SequenceFlow_1" sourceElement="_BPMNShape_ServiceTask_4" targetElement="_BPMNShape_UserTask_2"> - <di:waypoint xsi:type="dc:Point" x="377.0" y="271.0"/> - <di:waypoint xsi:type="dc:Point" x="436.0" y="271.0"/> - <di:waypoint xsi:type="dc:Point" x="436.0" y="157.0"/> - <di:waypoint xsi:type="dc:Point" x="630.0" y="157.0"/> - <bpmndi:BPMNLabel> - <dc:Bounds height="6.0" width="6.0" x="457.0" y="271.0"/> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - </bpmndi:BPMNPlane> - </bpmndi:BPMNDiagram> -</bpmn2:definitions>
\ No newline at end of file diff --git a/src/main/resources/bpmn/TestHumanTask.bpmn b/src/main/resources/bpmn/TestHumanTask.bpmn deleted file mode 100644 index d456d65f1..000000000 --- a/src/main/resources/bpmn/TestHumanTask.bpmn +++ /dev/null @@ -1,80 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd" id="_7-gSIF09EeWE96cFqGLI8w" exporter="camunda modeler" exporterVersion="2.7.0" targetNamespace="http://bpmn.io/schema/bpmn"> - <bpmn2:process id="user-interact-wf" name="UserInteract" isExecutable="true"> - <bpmn2:startEvent id="StartEcho" camunda:formKey="embedded:app:forms/example-embedded-start-TestHumanTask.html" name="StartEvent"> - <bpmn2:outgoing>SequenceFlow_2</bpmn2:outgoing> - </bpmn2:startEvent> - <bpmn2:serviceTask id="ServiceTask_1" camunda:class="com.att.ajsc.clds.designer.workflow.LogMessageDelegate" name="Perform Echo Assignment"> - <bpmn2:incoming>SequenceFlow_2</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_3</bpmn2:outgoing> - </bpmn2:serviceTask> - <bpmn2:sequenceFlow id="SequenceFlow_2" name="" sourceRef="StartEcho" targetRef="ServiceTask_1"/> - <bpmn2:endEvent id="EndEvent_1" name="Endevent"> - <bpmn2:incoming>SequenceFlow_5</bpmn2:incoming> - </bpmn2:endEvent> - <bpmn2:serviceTask id="ServiceTask_3" camunda:class="com.att.ajsc.clds.designer.workflow.LogMessageDelegate" name="AddServiceTask3"> - <bpmn2:incoming>SequenceFlow_6</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_5</bpmn2:outgoing> - </bpmn2:serviceTask> - <bpmn2:sequenceFlow id="SequenceFlow_5" name="" sourceRef="ServiceTask_3" targetRef="EndEvent_1"/> - <bpmn2:userTask id="UserTask_1" camunda:assignee="admin" camunda:formKey="embedded:app:forms/example-embedded-task-TestHumanTask.html" name="HumanTask1"> - <bpmn2:incoming>SequenceFlow_027hi4f</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_6</bpmn2:outgoing> - </bpmn2:userTask> - <bpmn2:sequenceFlow id="SequenceFlow_3" name="" sourceRef="ServiceTask_1" targetRef="BusinessRuleTask_1m53dly"/> - <bpmn2:sequenceFlow id="SequenceFlow_6" name="" sourceRef="UserTask_1" targetRef="ServiceTask_3"/> - <bpmn2:businessRuleTask id="BusinessRuleTask_1m53dly" camunda:resultVariable="result" camunda:decisionRef="simpleDishDecisionTable" camunda:mapDecisionResult="singleResult" name="BusinessRuleTask"> - <bpmn2:incoming>SequenceFlow_3</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_027hi4f</bpmn2:outgoing> - </bpmn2:businessRuleTask> - <bpmn2:sequenceFlow id="SequenceFlow_027hi4f" sourceRef="BusinessRuleTask_1m53dly" targetRef="UserTask_1"/> - </bpmn2:process> - <bpmndi:BPMNDiagram id="BPMNDiagram_1"> - <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="user-interact-wf"> - <bpmndi:BPMNShape id="_BPMNShape_StartEvent_3" bpmnElement="StartEcho"> - <dc:Bounds height="36.0" width="36.0" x="191.0" y="253.0"/> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="_BPMNShape_ServiceTask_4" bpmnElement="ServiceTask_1"> - <dc:Bounds height="80.0" width="100.0" x="277.0" y="231.0"/> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_2" bpmnElement="SequenceFlow_2" sourceElement="_BPMNShape_StartEvent_3" targetElement="_BPMNShape_ServiceTask_4"> - <di:waypoint xsi:type="dc:Point" x="227.0" y="271.0"/> - <di:waypoint xsi:type="dc:Point" x="277.0" y="271.0"/> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="_BPMNShape_EndEvent_103" bpmnElement="EndEvent_1"> - <dc:Bounds height="36.0" width="36.0" x="1182.0" y="253.0"/> - <bpmndi:BPMNLabel> - <dc:Bounds height="25.0" width="90.0" x="1156.0" y="294.0"/> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="_BPMNShape_ServiceTask_6" bpmnElement="ServiceTask_3"> - <dc:Bounds height="80.0" width="100.0" x="923.0" y="231.0"/> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_5" bpmnElement="SequenceFlow_5" sourceElement="_BPMNShape_ServiceTask_6" targetElement="_BPMNShape_EndEvent_103"> - <di:waypoint xsi:type="dc:Point" x="1026.0" y="271.0"/> - <di:waypoint xsi:type="dc:Point" x="1182.0" y="271.0"/> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="_BPMNShape_UserTask_2" bpmnElement="UserTask_1"> - <dc:Bounds height="80.0" width="100.0" x="719.0" y="231.0"/> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_3" bpmnElement="SequenceFlow_3" sourceElement="_BPMNShape_ServiceTask_4" targetElement="_BPMNShape_UserTask_2"> - <di:waypoint xsi:type="dc:Point" x="377.0" y="271.0"/> - <di:waypoint xsi:type="dc:Point" x="492.0" y="271.0"/> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_6" bpmnElement="SequenceFlow_6" sourceElement="_BPMNShape_UserTask_2" targetElement="_BPMNShape_ServiceTask_6"> - <di:waypoint xsi:type="dc:Point" x="819.0" y="271.0"/> - <di:waypoint xsi:type="dc:Point" x="923.0" y="271.0"/> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="BusinessRuleTask_1m53dly_di" bpmnElement="BusinessRuleTask_1m53dly"> - <dc:Bounds height="80.0" width="100.0" x="492.0" y="231.0"/> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_027hi4f_di" bpmnElement="SequenceFlow_027hi4f"> - <di:waypoint xsi:type="dc:Point" x="592.0" y="271.0"/> - <di:waypoint xsi:type="dc:Point" x="719.0" y="271.0"/> - <bpmndi:BPMNLabel> - <dc:Bounds height="20.0" width="90.0" x="830.0" y="325.5"/> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - </bpmndi:BPMNPlane> - </bpmndi:BPMNDiagram> -</bpmn2:definitions>
\ No newline at end of file diff --git a/src/main/resources/bpmn/TestHumanTask.png b/src/main/resources/bpmn/TestHumanTask.png Binary files differdeleted file mode 100644 index 7d8af39d4..000000000 --- a/src/main/resources/bpmn/TestHumanTask.png +++ /dev/null diff --git a/src/main/resources/bpmn/dish.dmn b/src/main/resources/bpmn/dish.dmn deleted file mode 100644 index 473a07ae5..000000000 --- a/src/main/resources/bpmn/dish.dmn +++ /dev/null @@ -1,36 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<definitions xmlns="http://www.omg.org/spec/DMN/20151101/dmn11.xsd" id="definitions" name="definitions" namespace="http://camunda.org/schema/1.0/dmn"> - <decision id="simpleDishDecisionTable" name="SimpleDishDecisionTable"> - <decisionTable id="decisionTable"> - <input id="input1" label="Season"> - <inputExpression id="inputExpression1" typeRef="string"> <text>season</text> -</inputExpression> - </input> - <output id="output1" label="Dish" name="desiredDish" typeRef="string" /> - <rule id="row-72464069-3"> - <inputEntry id="UnaryTests_0zmcdq6"> <text><![CDATA["Fall"]]></text> -</inputEntry> - <outputEntry id="LiteralExpression_1ehb89n"> <text><![CDATA["Pad Thai"]]></text> -</outputEntry> - </rule> - <rule id="row-72464069-4"> - <inputEntry id="UnaryTests_0g5512k"> <text><![CDATA["Winter"]]></text> -</inputEntry> - <outputEntry id="LiteralExpression_0v3t89p"> <text><![CDATA["Lamb Jalfrazie, Mutter Paneer, and Nan"]]></text> -</outputEntry> - </rule> - <rule id="row-72464069-5"> - <inputEntry id="UnaryTests_0582crg"> <text><![CDATA["Spring"]]></text> -</inputEntry> - <outputEntry id="LiteralExpression_100afca"> <text><![CDATA["Chicken Moghlai, Baingan Bhartha, and Nan"]]></text> -</outputEntry> - </rule> - <rule id="row-72464069-6"> - <inputEntry id="UnaryTests_0fha0sl"> <text><![CDATA["Summer"]]></text> -</inputEntry> - <outputEntry id="LiteralExpression_06dk8fw"> <text><![CDATA["Satay and Laab"]]></text> -</outputEntry> - </rule> - </decisionTable> - </decision> -</definitions> diff --git a/src/main/resources/bpmn/log-message.bpmn b/src/main/resources/bpmn/log-message.bpmn deleted file mode 100644 index f38f254d8..000000000 --- a/src/main/resources/bpmn/log-message.bpmn +++ /dev/null @@ -1,50 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.5.1">
- <bpmn:process id="log-message-wf" name="Log Message Workflow" isExecutable="true">
- <bpmn:startEvent id="StartEvent_1" name="Start">
- <bpmn:outgoing>SequenceFlow_0k87nxp</bpmn:outgoing>
- </bpmn:startEvent>
- <bpmn:endEvent id="EndEvent_0udg3bj" name="End">
- <bpmn:incoming>SequenceFlow_0zjfjoh</bpmn:incoming>
- </bpmn:endEvent>
- <bpmn:sequenceFlow id="SequenceFlow_0k87nxp" sourceRef="StartEvent_1" targetRef="Task_1q1b38a" />
- <bpmn:sequenceFlow id="SequenceFlow_0zjfjoh" sourceRef="Task_1q1b38a" targetRef="EndEvent_0udg3bj" />
- <bpmn:serviceTask id="Task_1q1b38a" name="Display Log Message" camunda:class="org.onap.clamp.clds.workflow.LogMessageDelegate">
- <bpmn:incoming>SequenceFlow_0k87nxp</bpmn:incoming>
- <bpmn:outgoing>SequenceFlow_0zjfjoh</bpmn:outgoing>
- </bpmn:serviceTask>
- </bpmn:process>
- <bpmndi:BPMNDiagram id="BPMNDiagram_1">
- <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="log-message-wf">
- <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
- <dc:Bounds x="617" y="283" width="36" height="36" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="623" y="319" width="23" height="12" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="EndEvent_0udg3bj_di" bpmnElement="EndEvent_0udg3bj">
- <dc:Bounds x="961" y="283" width="36" height="36" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="969" y="319" width="19" height="12" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="SequenceFlow_0k87nxp_di" bpmnElement="SequenceFlow_0k87nxp">
- <di:waypoint xsi:type="dc:Point" x="653" y="301" />
- <di:waypoint xsi:type="dc:Point" x="758" y="301" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="706" y="286" width="0" height="0" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_0zjfjoh_di" bpmnElement="SequenceFlow_0zjfjoh">
- <di:waypoint xsi:type="dc:Point" x="858" y="301" />
- <di:waypoint xsi:type="dc:Point" x="961" y="301" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="910" y="286" width="0" height="0" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="ServiceTask_1o14w9n_di" bpmnElement="Task_1q1b38a">
- <dc:Bounds x="758" y="261" width="100" height="80" />
- </bpmndi:BPMNShape>
- </bpmndi:BPMNPlane>
- </bpmndi:BPMNDiagram>
-</bpmn:definitions>
diff --git a/src/main/resources/bpmn/log-message.png b/src/main/resources/bpmn/log-message.png Binary files differdeleted file mode 100644 index fa7c7565f..000000000 --- a/src/main/resources/bpmn/log-message.png +++ /dev/null diff --git a/src/test/java/org/onap/clamp/clds/model/prop/ModelPropertiesTest.java b/src/test/java/org/onap/clamp/clds/model/prop/ModelPropertiesTest.java index 22b3ba0cb..02e27ea8f 100644 --- a/src/test/java/org/onap/clamp/clds/model/prop/ModelPropertiesTest.java +++ b/src/test/java/org/onap/clamp/clds/model/prop/ModelPropertiesTest.java @@ -24,69 +24,65 @@ package org.onap.clamp.clds.model.prop; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; import java.io.IOException; +import java.util.ArrayList; +import java.util.List; -import org.junit.Assert; +import org.junit.Before; import org.junit.Test; import org.onap.clamp.clds.util.ResourceFileUtil; - /** * Test org.onap.clamp.ClampDesigner.model.prop package using ModelProperties. */ public class ModelPropertiesTest { - @Test - public void testJsonParse() throws IOException { - String modelBpmnProp = ResourceFileUtil.getResourceAsString("example/modelBpmnProp.json"); - String modelProp = ResourceFileUtil.getResourceAsString("example/modelProp.json"); - String modName = "example-model-name"; - String controlName = "example-control-name"; - - ModelProperties prop = new ModelProperties(modName, controlName, null, true, modelBpmnProp, modelProp); - Assert.assertEquals(modName, prop.getModelName()); - Assert.assertEquals(controlName, prop.getControlName()); - Assert.assertEquals(null, prop.getActionCd()); - Global global = prop.getGlobal(); - Assert.assertEquals("0f983e18-4603-4bb4-a98c-e29691fb16a1", global.getService()); - Assert.assertEquals("[SNDGCA64]", global.getLocation().toString()); - Assert.assertEquals("[6c7aaec2-59eb-41d9-8681-b7f976ab668d]", global.getResourceVf().toString()); - StringMatch sm = prop.getType(StringMatch.class); - Assert.assertEquals("StringMatch_", sm.getId()); - Policy policy = prop.getType(Policy.class); - Assert.assertEquals("Policy_", policy.getId()); - Assert.assertEquals(null, policy.getTopicPublishes()); - Assert.assertEquals(null, policy.getTopicSubscribes()); - - Tca tca = prop.getType(Tca.class); - Assert.assertEquals("Narra", tca.getTcaItems().get(0).getTcaName()); - Assert.assertEquals(Integer.valueOf(4), tca.getTcaItems().get(0).getTcaThreshholds().get(0).getThreshhold()); + @Before + public void registerNewClasses() { + ModelProperties.registerModelElement(Holmes.class, Holmes.getType()); } @Test - public void testPolicy() throws IOException { + public void testHolmes() throws IOException { - String modelBpmnProp = ResourceFileUtil.getResourceAsString("example/modelBpmnPropForPolicy.json"); - System.out.println(modelBpmnProp); + String modelBpmnProp = ResourceFileUtil.getResourceAsString("example/model-properties/modelBpmnProp.json"); + String modelBpmn = ResourceFileUtil.getResourceAsString("example/model-properties/modelBpmn.json"); + + ModelProperties prop = new ModelProperties("example-model-name", "example-control-name", null, true, modelBpmn, + modelBpmnProp); - String modelProp = ResourceFileUtil.getResourceAsString("example/modelPropForPolicy.json"); - System.out.println(modelProp); - ModelProperties prop = new ModelProperties("example-model-name", "example-control-name", - null, true, modelBpmnProp, modelProp); - System.out.println("attempting prop.getGlobal()..."); - Global global = prop.getGlobal(); - System.out.println("attempting prop.getStringMatch()..."); StringMatch stringMatch = prop.getType(StringMatch.class); - if (stringMatch.isFound()) { - System.out.println("stringMatch json object is present..."); - assertEquals("1", stringMatch.getResourceGroups().get(0).getPolicyId()); - } - System.out.println("attempting prop.getPolicy()..."); + assertTrue(stringMatch.isFound()); + assertEquals("1505133578560", stringMatch.getResourceGroups().get(0).getGroupNumber()); + assertEquals("0", stringMatch.getResourceGroups().get(0).getPolicyId()); + assertEquals(1, stringMatch.getResourceGroups().get(0).getServiceConfigurations().size()); + List<String> aaiMathcingFields = new ArrayList<String>(); + aaiMathcingFields.add("complex.city"); + assertEquals(aaiMathcingFields, + stringMatch.getResourceGroups().get(0).getServiceConfigurations().get(0).getaaiMatchingFields()); + assertEquals("1600", stringMatch.getResourceGroups().get(0).getServiceConfigurations().get(0).getAgeLimit()); + assertEquals(1, stringMatch.getResourceGroups().get(0).getServiceConfigurations().get(0).getStringSet().size()); + + Collector collector = prop.getType(Collector.class); + assertTrue(collector.isFound()); + assertEquals("DCAE-COLLECTOR-UCSNMP", collector.getTopicPublishes()); + Policy policy = prop.getType(Policy.class); - if (policy.isFound()) { - System.out.println("policy json object is present..."); - assertEquals("1", policy.getPolicyChains().get(0).getPolicyId()); - } + assertTrue(policy.isFound()); + assertEquals(1, policy.getPolicyChains().size()); + assertEquals("0", policy.getPolicyChains().get(0).getPolicyId()); + assertEquals(1, policy.getPolicyChains().get(0).getPolicyItems().size()); + + Tca tca = prop.getType(Tca.class); + assertTrue(tca.isFound()); + assertEquals(1, tca.getTcaItems().size()); + assertEquals(0, tca.getTcaItems().get(0).getTcaThreshholds().size()); + + Holmes holmes = prop.getType(Holmes.class); + assertTrue(holmes.isFound()); + assertEquals("policy1", holmes.getOperationalPolicy()); + assertEquals("blabla", holmes.getCorrelationLogic()); } }
\ No newline at end of file diff --git a/src/test/resources/example/model-properties/modelBpmn.json b/src/test/resources/example/model-properties/modelBpmn.json new file mode 100644 index 000000000..4737174c5 --- /dev/null +++ b/src/test/resources/example/model-properties/modelBpmn.json @@ -0,0 +1,38 @@ +{ + "collector": [ + { + "id": "Collector_1c72ct5", + "from": "StartEvent_1" + } + ], + "stringMatch": [ + { + "id": "StringMatch_05arstl", + "from": "Collector_1c72ct5" + } + ], + "policy": [ + { + "id": "Policy_0honxgv", + "from": "TCA_1jy9to4" + } + ], + "tca": [ + { + "id": "TCA_1jy9to4", + "from": "Holmes_0i4n2mm" + } + ], + "holmes": [ + { + "id": "Holmes_0i4n2mm", + "from": "VesCollector_0orydnh" + } + ], + "vesCollector": [ + { + "id": "VesCollector_0orydnh", + "from": "StringMatch_05arstl" + } + ] +}
\ No newline at end of file diff --git a/src/test/resources/example/model-properties/modelBpmnProp.json b/src/test/resources/example/model-properties/modelBpmnProp.json new file mode 100644 index 000000000..7e799aa8b --- /dev/null +++ b/src/test/resources/example/model-properties/modelBpmnProp.json @@ -0,0 +1,188 @@ +{ + "Collector_1c72ct5": [ + { + "name": "topicPublishes", + "value": "DCAE-COLLECTOR-UCSNMP" + } + ], + "StringMatch_05arstl": { + "group1": [ + { + "name": "rgname", + "value": "1505133578560" + }, + { + "name": "rgfriendlyname", + "value": "group1" + }, + { + "name": "policyName", + "value": "policy1" + }, + { + "name": "policyId", + "value": "0" + }, + { + "serviceConfigurations": [ + [ + { + "name": "aaiMatchingFields", + "value": [ + "complex.city" + ] + }, + { + "name": "aaiSendFields", + "value": [ + "cloud-region.identity-url" + ] + }, + { + "name": "timeWindow", + "value": [ + "0" + ] + }, + { + "name": "ageLimit", + "value": [ + "1600" + ] + }, + { + "name": "createClosedLoopEventId", + "value": [ + "Initial" + ] + }, + { + "name": "outputEventName", + "value": [ + "" + ] + }, + { + "stringSet": [ + { + + }, + { + "name": "eventSeverity", + "value": [ + "NORMAL" + ] + }, + { + "name": "eventSourceType", + "value": [ + "" + ] + } + ] + } + ] + ] + } + ] + }, + "Policy_0honxgv": { + "policy1": [ + { + "name": "pname", + "value": "policy1" + }, + { + "name": "pid", + "value": "0" + }, + { + "name": "timeout", + "value": "345" + }, + { + "policyConfigurations": [ + [ + { + "name": "maxRetries", + "value": [ + "3" + ] + }, + { + "name": "retryTimeLimit", + "value": [ + "180" + ] + }, + { + "name": "_id", + "value": [ + "dGLuNqg" + ] + }, + { + "name": "parentPolicy", + "value": [ + "" + ] + } + ] + ] + } + ] + }, + "TCA_1jy9to4": { + "tca1": [ + { + "name": "tname", + "value": "tca1" + }, + { + "name": "tuuid", + "value": "f43e3499-8c9c-teed-bb41-a0cb38ebf0d3" + }, + { + "name": "tnfc", + "value": "" + }, + { + "name": "tcaEnab", + "value": "on" + }, + { + "name": "tcaPol", + "value": "policy1" + }, + { + "name": "tcaPolId", + "value": "0" + }, + { + "name": "tcaInt", + "value": "1" + }, + { + "name": "tcaSev", + "value": "NORMAL" + }, + { + "name": "tcaVio", + "value": "1" + }, + { + "serviceConfigurations": [] + } + ] + }, + "Holmes_0i4n2mm": [ + { + "name": "correlationalLogic", + "value": "blabla" + }, + { + "name": "operationalPolicy", + "value": "policy1" + } + ] +}
\ No newline at end of file diff --git a/src/test/resources/https/https-test.properties b/src/test/resources/https/https-test.properties index b30f6aaf9..eaccd4ac4 100644 --- a/src/test/resources/https/https-test.properties +++ b/src/test/resources/https/https-test.properties @@ -64,7 +64,6 @@ server.contextPath=/ #Modified engine-rest applicationpath spring.jersey.application-path=/engine-rest spring.profiles.active=clamp-default,clamp-spring-authentication -spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration,org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration #The max number of active threads in this pool server.tomcat.max-threads=200 @@ -93,35 +92,42 @@ camel.defaultthreadpool.rejectpolicy=CallerRuns kubernetes.namespace=com-att-ajsc #server.port=0 - #Camunda Process Engine DataSource connection Details -spring.datasource.camunda.url=jdbc:mariadb://localhost:${docker.mariadb.port.host}/camundabpm?verifyServerCertificate=false&useSSL=false&requireSSL=false&autoReconnect=true&maxReconnects=100 +spring.datasource.camunda.driverClassName=org.mariadb.jdbc.Driver +spring.datasource.camunda.url=jdbc:mariadb://localhost:${docker.mariadb.port.host}/camundabpm?autoReconnect=true spring.datasource.camunda.username=camunda spring.datasource.camunda.password=ndMSpw4CAM -spring.datasource.camunda.driverClassName=org.mariadb.jdbc.Driver spring.datasource.camunda.validationQuery=SELECT 1 spring.datasource.camunda.validationQueryTimeout=20000 -spring.datasource.camunda.validationInterval=60000 +spring.datasource.camunda.validationInterval=30000 spring.datasource.camunda.testWhileIdle = true +spring.datasource.camunda.minIdle = 0 +spring.datasource.camunda.initialSize=0 # Automatically test whether a connection provided is good or not spring.datasource.camunda.testOnBorrow=true +spring.datasource.camunda.ignoreExceptionOnPreLoad=true + #Camunda application properties #Camunda history level camunda.bpm.history-level=auto +camunda.bpm.database.type=mariadb +camunda.bpm.database.schema-update=false #clds datasource connection details -spring.datasource.cldsdb.driver-class-name=org.mariadb.jdbc.Driver -spring.datasource.cldsdb.url=jdbc:mariadb://localhost:${docker.mariadb.port.host}/cldsdb4?verifyServerCertificate=false&useSSL=false&requireSSL=false&autoReconnect=true&maxReconnects=100 +spring.datasource.cldsdb.driverClassName=org.mariadb.jdbc.Driver +spring.datasource.cldsdb.url=jdbc:mariadb://localhost:${docker.mariadb.port.host}/cldsdb4?autoReconnect=true spring.datasource.cldsdb.username=clds spring.datasource.cldsdb.password=sidnnd83K -spring.datasource.cldsdb.driverClassName=com.mysql.jdbc.Driver spring.datasource.cldsdb.validationQuery=SELECT 1 spring.datasource.cldsdb.validationQueryTimeout=20000 -spring.datasource.cldsdb.validationInterval=60000 +spring.datasource.cldsdb.validationInterval=30000 spring.datasource.cldsdb.testWhileIdle = true +spring.datasource.cldsdb.minIdle = 0 +spring.datasource.cldsdb.initialSize=0 # Automatically test whether a connection provided is good or not spring.datasource.cldsdb.testOnBorrow=true +spring.datasource.cldsdb.ignoreExceptionOnPreLoad=true #Async Executor default Parameters async.core.pool.size=10 |