diff options
Diffstat (limited to 'so-monitoring/so-monitoring-handler')
32 files changed, 0 insertions, 3022 deletions
diff --git a/so-monitoring/so-monitoring-handler/pom.xml b/so-monitoring/so-monitoring-handler/pom.xml deleted file mode 100644 index aa804c47ba..0000000000 --- a/so-monitoring/so-monitoring-handler/pom.xml +++ /dev/null @@ -1,91 +0,0 @@ -<!-- - ============LICENSE_START======================================================= - Copyright (C) 2018 Ericsson. 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. - - SPDX-License-Identifier: Apache-2.0 - ============LICENSE_END========================================================= ---> - -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>org.onap.so.monitoring</groupId> - <artifactId>so-monitoring</artifactId> - <version>1.8.0-SNAPSHOT</version> - </parent> - <artifactId>so-monitoring-handler</artifactId> - <name>${project.artifactId}</name> - - <properties> - <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> - <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> - </properties> - - - <dependencies> - <dependency> - <groupId>com.google.guava</groupId> - <artifactId>guava</artifactId> - </dependency> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-data-jpa</artifactId> - <exclusions> - <exclusion> - <groupId>org.apache.tomcat</groupId> - <artifactId>tomcat-jdbc</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-ext</artifactId> - </dependency> - <dependency> - <groupId>org.apache.httpcomponents</groupId> - <artifactId>httpclient</artifactId> - </dependency> - <dependency> - <groupId>org.apache.httpcomponents</groupId> - <artifactId>httpcore</artifactId> - </dependency> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-web</artifactId> - </dependency> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-configuration-processor</artifactId> - <scope>compile</scope> - </dependency> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-test</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>nl.jqno.equalsverifier</groupId> - <artifactId>equalsverifier</artifactId> - <version>3.4.1</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.onap.so</groupId> - <artifactId>common</artifactId> - <version>${project.version}</version> - </dependency> - </dependencies> -</project> diff --git a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/camunda/model/ActivityInstance.java b/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/camunda/model/ActivityInstance.java deleted file mode 100644 index 7ef00bd798..0000000000 --- a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/camunda/model/ActivityInstance.java +++ /dev/null @@ -1,187 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2018 Ericsson. 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. - * - * SPDX-License-Identifier: Apache-2.0 - * ============LICENSE_END========================================================= - */ -package org.onap.so.monitoring.camunda.model; - -import static org.onap.so.monitoring.utils.ObjectEqualsUtils.isEqual; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; - -/** - * @author waqas.ikram@ericsson.com - * - */ -@JsonIgnoreProperties(ignoreUnknown = true) -public class ActivityInstance { - - private String activityId; - private String activityName; - private String activityType; - private String processInstanceId; - private String calledProcessInstanceId; - private String startTime; - private String endTime; - private String durationInMillis; - - public ActivityInstance() {} - - - /** - * @return the activityId - */ - public String getActivityId() { - return activityId; - } - - /** - * @param activityId the activityId to set - */ - public void setActivityId(final String activityId) { - this.activityId = activityId; - } - - /** - * @return the activityName - */ - public String getActivityName() { - return activityName; - } - - /** - * @param activityName the activityName to set - */ - public void setActivityName(final String activityName) { - this.activityName = activityName; - } - - /** - * @return the activityType - */ - public String getActivityType() { - return activityType; - } - - /** - * @param activityType the activityType to set - */ - public void setActivityType(final String activityType) { - this.activityType = activityType; - } - - /** - * @return the processInstanceId - */ - public String getProcessInstanceId() { - return processInstanceId; - } - - /** - * @param processInstanceId the processInstanceId to set - */ - public void setProcessInstanceId(final String processInstanceId) { - this.processInstanceId = processInstanceId; - } - - /** - * @return the calledProcessInstanceId - */ - public String getCalledProcessInstanceId() { - return calledProcessInstanceId; - } - - /** - * @param calledProcessInstanceId the calledProcessInstanceId to set - */ - public void setCalledProcessInstanceId(final String calledProcessInstanceId) { - this.calledProcessInstanceId = calledProcessInstanceId; - } - - /** - * @return the startTime - */ - public String getStartTime() { - return startTime; - } - - /** - * @param startTime the startTime to set - */ - public void setStartTime(final String startTime) { - this.startTime = startTime; - } - - /** - * @return the endTime - */ - public String getEndTime() { - return endTime; - } - - /** - * @param endTime the endTime to set - */ - public void setEndTime(final String endTime) { - this.endTime = endTime; - } - - /** - * @return the durationInMillis - */ - public String getDurationInMillis() { - return durationInMillis; - } - - /** - * @param durationInMillis the durationInMillis to set - */ - public void setDurationInMillis(final String durationInMillis) { - this.durationInMillis = durationInMillis; - } - - @JsonIgnore - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((activityId == null) ? 0 : activityId.hashCode()); - result = prime * result + ((activityName == null) ? 0 : activityName.hashCode()); - result = prime * result + ((activityType == null) ? 0 : activityType.hashCode()); - result = prime * result + ((calledProcessInstanceId == null) ? 0 : calledProcessInstanceId.hashCode()); - result = prime * result + ((durationInMillis == null) ? 0 : durationInMillis.hashCode()); - result = prime * result + ((endTime == null) ? 0 : endTime.hashCode()); - result = prime * result + ((processInstanceId == null) ? 0 : processInstanceId.hashCode()); - result = prime * result + ((startTime == null) ? 0 : startTime.hashCode()); - return result; - } - - @JsonIgnore - @Override - public boolean equals(final Object obj) { - if (obj instanceof ActivityInstance) { - final ActivityInstance other = (ActivityInstance) obj; - return isEqual(activityId, other.activityId) && isEqual(activityName, other.activityName) - && isEqual(activityType, other.activityType) && isEqual(processInstanceId, other.processInstanceId) - && isEqual(calledProcessInstanceId, other.calledProcessInstanceId) - && isEqual(startTime, other.startTime) && isEqual(endTime, other.endTime) - && isEqual(durationInMillis, other.durationInMillis); - } - return false; - } - -} diff --git a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/camunda/model/ProcessDefinition.java b/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/camunda/model/ProcessDefinition.java deleted file mode 100644 index 76dc096c45..0000000000 --- a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/camunda/model/ProcessDefinition.java +++ /dev/null @@ -1,87 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2018 Ericsson. 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. - * - * SPDX-License-Identifier: Apache-2.0 - * ============LICENSE_END========================================================= - */ -package org.onap.so.monitoring.camunda.model; - -import static org.onap.so.monitoring.utils.ObjectEqualsUtils.isEqual; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; - -/** - * @author waqas.ikram@ericsson.com - * - */ -@JsonIgnoreProperties(ignoreUnknown = true) -public class ProcessDefinition { - - private String id; - private String bpmn20Xml; - - public ProcessDefinition() {} - - /** - * @return the id - */ - public String getId() { - return id; - } - - /** - * @param id the id to set - */ - public void setId(final String id) { - this.id = id; - } - - /** - * @return the bpmn20Xml - */ - public String getBpmn20Xml() { - return bpmn20Xml; - } - - /** - * @param bpmn20Xml the bpmn20Xml to set - */ - public void setBpmn20Xml(final String bpmn20Xml) { - this.bpmn20Xml = bpmn20Xml; - } - - @JsonIgnore - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((id == null) ? 0 : id.hashCode()); - result = prime * result + ((bpmn20Xml == null) ? 0 : bpmn20Xml.hashCode()); - return result; - } - - @JsonIgnore - @Override - public boolean equals(final Object obj) { - if (obj instanceof ProcessDefinition) { - final ProcessDefinition other = (ProcessDefinition) obj; - return isEqual(id, other.id) && isEqual(bpmn20Xml, other.bpmn20Xml); - } - return false; - } - - -} diff --git a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/camunda/model/ProcessInstance.java b/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/camunda/model/ProcessInstance.java deleted file mode 100644 index 872fae50b0..0000000000 --- a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/camunda/model/ProcessInstance.java +++ /dev/null @@ -1,128 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2018 Ericsson. 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. - * - * SPDX-License-Identifier: Apache-2.0 - * ============LICENSE_END========================================================= - */ -package org.onap.so.monitoring.camunda.model; - -import static org.onap.so.monitoring.utils.ObjectEqualsUtils.isEqual; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; - -/** - * @author waqas.ikram@ericsson.com - */ -@JsonIgnoreProperties(ignoreUnknown = true) -public class ProcessInstance { - - private String id; - private String processDefinitionId; - private String processDefinitionName; - private String superProcessInstanceId; - - public ProcessInstance() {} - - /** - * @return the id - */ - public String getId() { - return id; - } - - /** - * @param id the id to set - */ - public void setId(final String id) { - this.id = id; - } - - - /** - * @return the processDefinitionId - */ - public String getProcessDefinitionId() { - return processDefinitionId; - } - - /** - * @param processDefinitionId the processDefinitionId to set - */ - public void setProcessDefinitionId(final String processDefinitionId) { - this.processDefinitionId = processDefinitionId; - } - - /** - * @return the processDefinitionName - */ - public String getProcessDefinitionName() { - return processDefinitionName; - } - - /** - * @param processDefinitionName the processDefinitionName to set - */ - public void setProcessDefinitionName(final String processDefinitionName) { - this.processDefinitionName = processDefinitionName; - } - - /** - * @return the superProcessInstanceId - */ - public String getSuperProcessInstanceId() { - return superProcessInstanceId; - } - - /** - * @param superProcessInstanceId the superProcessInstanceId to set - */ - public void setSuperProcessInstanceId(final String superProcessInstanceId) { - this.superProcessInstanceId = superProcessInstanceId; - } - - - @JsonIgnore - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((id == null) ? 0 : id.hashCode()); - result = prime * result + ((processDefinitionId == null) ? 0 : processDefinitionId.hashCode()); - result = prime * result + ((processDefinitionName == null) ? 0 : processDefinitionName.hashCode()); - result = prime * result + ((superProcessInstanceId == null) ? 0 : superProcessInstanceId.hashCode()); - return result; - } - - @JsonIgnore - @Override - public boolean equals(final Object obj) { - if (obj instanceof ProcessInstance) { - final ProcessInstance other = (ProcessInstance) obj; - return isEqual(id, other.id) && isEqual(processDefinitionId, other.processDefinitionId) - && isEqual(processDefinitionName, other.processDefinitionName) - && isEqual(superProcessInstanceId, other.superProcessInstanceId); - } - - return false; - } - - @JsonIgnore - @Override - public String toString() { - return "ProcessInstance [id=" + id + ", processDefinitionId=" + processDefinitionId + ", processDefinitionName=" - + processDefinitionName + "]"; - } -} diff --git a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/camunda/model/ProcessInstanceVariable.java b/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/camunda/model/ProcessInstanceVariable.java deleted file mode 100644 index 6d7da58f90..0000000000 --- a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/camunda/model/ProcessInstanceVariable.java +++ /dev/null @@ -1,105 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2018 Ericsson. 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. - * - * SPDX-License-Identifier: Apache-2.0 - * ============LICENSE_END========================================================= - */ -package org.onap.so.monitoring.camunda.model; - -import static org.onap.so.monitoring.utils.ObjectEqualsUtils.isEqual; -import com.fasterxml.jackson.annotation.JsonIgnore; - -/** - * @author waqas.ikram@ericsson.com - */ -public class ProcessInstanceVariable { - - private String name; - private Object value; - private String type; - - public ProcessInstanceVariable() {} - - /** - * @return the name - */ - public String getName() { - return name; - } - - /** - * @param name the name to set - */ - public void setName(final String name) { - this.name = name; - } - - /** - * @return the value - */ - public Object getValue() { - return value; - } - - /** - * @param value the value to set - */ - public void setValue(final Object value) { - this.value = value; - } - - /** - * @return the type - */ - public String getType() { - return type; - } - - /** - * @param type the type to set - */ - public void setType(final String type) { - this.type = type; - } - - @JsonIgnore - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((name == null) ? 0 : name.hashCode()); - result = prime * result + ((value == null) ? 0 : value.hashCode()); - result = prime * result + ((type == null) ? 0 : type.hashCode()); - return result; - } - - @JsonIgnore - @Override - public boolean equals(final Object obj) { - if (obj instanceof ProcessInstanceVariable) { - final ProcessInstanceVariable other = (ProcessInstanceVariable) obj; - return isEqual(name, other.name) && isEqual(value, other.value) && isEqual(type, other.type); - } - - return false; - } - - @JsonIgnore - @Override - public String toString() { - return "ProcessInstance [name=" + name + ", value=" + value + ", type=" + type + "]"; - } -} diff --git a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/camunda/model/SoActiveInfraRequests.java b/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/camunda/model/SoActiveInfraRequests.java deleted file mode 100644 index 6c1d1ad99f..0000000000 --- a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/camunda/model/SoActiveInfraRequests.java +++ /dev/null @@ -1,195 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2018 Ericsson. 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. - * - * SPDX-License-Identifier: Apache-2.0 - * ============LICENSE_END========================================================= - */ -package org.onap.so.monitoring.camunda.model; - -import static org.onap.so.monitoring.utils.ObjectEqualsUtils.isEqual; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; - -/** - * @author waqas.ikram@ericsson.com - * - */ -@JsonIgnoreProperties(ignoreUnknown = true) -public class SoActiveInfraRequests { - - private String requestId; - private String serviceInstanceId; - private String networkId; - private String startTime; - private String endTime; - private String requestStatus; - private String serviceInstanceName; - private String serviceType; - - /** - * @return the requestId - */ - public String getRequestId() { - return requestId; - } - - /** - * @param requestId the requestId to set - */ - public void setRequestId(final String requestId) { - this.requestId = requestId; - } - - /** - * @return the serviceInstanceId - */ - public String getServiceInstanceId() { - return serviceInstanceId; - } - - /** - * @param serviceInstanceId the serviceInstanceId to set - */ - public void setServiceInstanceId(final String serviceInstanceId) { - this.serviceInstanceId = serviceInstanceId; - } - - /** - * @return the networkId - */ - public String getNetworkId() { - return networkId; - } - - /** - * @param networkId the networkId to set - */ - public void setNetworkId(final String networkId) { - this.networkId = networkId; - } - - /** - * @return the startTime - */ - public String getStartTime() { - return startTime; - } - - /** - * @param startTime the startTime to set - */ - public void setStartTime(final String startTime) { - this.startTime = startTime; - } - - /** - * @return the endTime - */ - public String getEndTime() { - return endTime; - } - - /** - * @param endTime the endTime to set - */ - public void setEndTime(final String endTime) { - this.endTime = endTime; - } - - /** - * @return the requestStatus - */ - public String getRequestStatus() { - return requestStatus; - } - - /** - * @param requestStatus the requestStatus to set - */ - public void setRequestStatus(final String requestStatus) { - this.requestStatus = requestStatus; - } - - /** - * @return the serviceInstanceName - */ - public String getServiceInstanceName() { - return serviceInstanceName; - } - - /** - * @param serviceInstanceName the serviceInstanceName to set - */ - public void setServiceInstanceName(final String serviceInstanceName) { - this.serviceInstanceName = serviceInstanceName; - } - - /** - * @return the serviceType - */ - public String getServiceType() { - return serviceType; - } - - /** - * @param serviceType the serviceType to set - */ - public void setServiceType(final String serviceType) { - this.serviceType = serviceType; - } - - @JsonIgnore - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((endTime == null) ? 0 : endTime.hashCode()); - result = prime * result + ((networkId == null) ? 0 : networkId.hashCode()); - result = prime * result + ((requestId == null) ? 0 : requestId.hashCode()); - result = prime * result + ((requestStatus == null) ? 0 : requestStatus.hashCode()); - result = prime * result + ((serviceInstanceId == null) ? 0 : serviceInstanceId.hashCode()); - result = prime * result + ((serviceInstanceName == null) ? 0 : serviceInstanceName.hashCode()); - result = prime * result + ((serviceType == null) ? 0 : serviceType.hashCode()); - result = prime * result + ((startTime == null) ? 0 : startTime.hashCode()); - return result; - } - - @JsonIgnore - @Override - public boolean equals(final Object obj) { - if (obj instanceof SoActiveInfraRequests) { - SoActiveInfraRequests other = (SoActiveInfraRequests) obj; - return isEqual(requestId, other.requestId) && isEqual(serviceInstanceId, other.serviceInstanceId) - && isEqual(networkId, other.networkId) && isEqual(startTime, other.startTime) - && isEqual(endTime, other.endTime) && isEqual(requestStatus, other.requestStatus) - && isEqual(serviceInstanceName, other.serviceInstanceName) - && isEqual(serviceType, other.serviceType); - } - - return false; - } - - @JsonIgnore - @Override - public String toString() { - return "SoActiveInfraRequests [requestId=" + requestId + ", serviceInstanceId=" + serviceInstanceId - + ", networkId=" + networkId + ", startTime=" + startTime + ", endTime=" + endTime + ", requestStatus=" - + requestStatus + ", serviceInstanceName=" + serviceInstanceName + ", serviceType=" + serviceType + "]"; - } - - - -} diff --git a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/configuration/camunda/CamundaConfiguration.java b/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/configuration/camunda/CamundaConfiguration.java deleted file mode 100644 index e5194da8f0..0000000000 --- a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/configuration/camunda/CamundaConfiguration.java +++ /dev/null @@ -1,38 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2018 Ericsson. 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. - * - * SPDX-License-Identifier: Apache-2.0 - * ============LICENSE_END========================================================= - */ -package org.onap.so.monitoring.configuration.camunda; - -import org.springframework.beans.factory.annotation.Value; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -/** - * @author waqas.ikram@ericsson.com - */ - -@Configuration -public class CamundaConfiguration { - - @Bean - public CamundaRestUrlProvider camundaRestUrlProvider(@Value(value = "${camunda.rest.api.url}") final String httpURL, - @Value(value = "${camunda.rest.api.engine:default}") final String engineName) { - return new CamundaRestUrlProvider(httpURL, engineName); - } -} diff --git a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/configuration/camunda/CamundaRestUrlProvider.java b/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/configuration/camunda/CamundaRestUrlProvider.java deleted file mode 100644 index ab23f24b2a..0000000000 --- a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/configuration/camunda/CamundaRestUrlProvider.java +++ /dev/null @@ -1,104 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2018 Ericsson. 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. - * - * SPDX-License-Identifier: Apache-2.0 - * ============LICENSE_END========================================================= - */ -package org.onap.so.monitoring.configuration.camunda; - -import java.net.URI; -import org.springframework.stereotype.Service; -import org.springframework.web.util.UriComponentsBuilder; - -/** - * @author waqas.ikram@ericsson.com - */ -@Service -public class CamundaRestUrlProvider { - - private static final String HISTORY_PATH = "history"; - private final URI baseUri; - - public CamundaRestUrlProvider(final String httpUrl, final String engineName) { - this.baseUri = UriComponentsBuilder.fromHttpUrl(httpUrl).path(engineName).build().toUri(); - } - - /** - * see {@link <a href= - * "https://docs.camunda.org/manual/7.5/reference/rest/history/process-instance/get-process-instance-query/">Get - * Process Instances</a>}. - * - * @param requestId the request ID - * @return URL - */ - public String getHistoryProcessInstanceUrl(final String requestId) { - return UriComponentsBuilder.fromUri(baseUri).pathSegment(HISTORY_PATH).pathSegment("process-instance") - .query("variables=requestId_eq_{requestID}").buildAndExpand(requestId).toString(); - } - - /** - * see {@link <a href= - * "https://docs.camunda.org/manual/7.5/reference/rest/history/process-instance/get-process-instance/">Get Single - * Process Instance</a>}. - * - * @param processInstanceId the process instance id. - * @return URL - */ - public String getSingleProcessInstanceUrl(final String processInstanceId) { - return UriComponentsBuilder.fromUri(baseUri).pathSegment(HISTORY_PATH).pathSegment("process-instance") - .pathSegment(processInstanceId).build().toString(); - } - - /** - * see {@link <a href= "https://docs.camunda.org/manual/7.5/reference/rest/process-definition/get-xml/">Get BPMN 2.0 - * XML</a>}. - * - * @param processDefinitionId the process definition id. - * @return URL - */ - public String getProcessDefinitionUrl(final String processDefinitionId) { - return UriComponentsBuilder.fromUri(baseUri).pathSegment("process-definition").pathSegment(processDefinitionId) - .pathSegment("xml").build().toString(); - } - - /** - * see {@link <a href= - * "https://docs.camunda.org/manual/7.5/reference/rest/history/activity-instance/get-activity-instance/">Get Single - * Activity Instance (Historic)</a>}. - * - * @param processInstanceId the process instance id. - * @return URL - */ - public String getActivityInstanceUrl(final String processInstanceId) { - return UriComponentsBuilder.fromUri(baseUri).pathSegment(HISTORY_PATH).pathSegment("activity-instance") - .query("processInstanceId={processInstanceId}").queryParam("sortBy", "startTime") - .queryParam("sortOrder", "asc").buildAndExpand(processInstanceId).toString(); - } - - /** - * see {@link <a href= - * "https://docs.camunda.org/manual/7.5/reference/rest/history/variable-instance/get-variable-instance/">Get Single - * Variable Instance</a>}. - * - * @param processInstanceId the process instance id. - * @return URL - */ - public String getProcessInstanceVariablesUrl(final String processInstanceId) { - return UriComponentsBuilder.fromUri(baseUri).pathSegment(HISTORY_PATH).pathSegment("variable-instance") - .query("processInstanceId={processInstanceId}").buildAndExpand(processInstanceId).toString(); - } - -} diff --git a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/configuration/database/DatabaseConfiguration.java b/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/configuration/database/DatabaseConfiguration.java deleted file mode 100644 index 359c334cde..0000000000 --- a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/configuration/database/DatabaseConfiguration.java +++ /dev/null @@ -1,37 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * 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========================================================= - */ - -package org.onap.so.monitoring.configuration.database; - - -import org.springframework.beans.factory.annotation.Value; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -@Configuration -public class DatabaseConfiguration { - - @Bean - public DatabaseUrlProvider databaseUrlProvider( - @Value(value = "${mso.database.rest.api.url}") final String baseUrl) { - return new DatabaseUrlProvider(baseUrl); - } - -} diff --git a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/configuration/database/DatabaseUrlProvider.java b/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/configuration/database/DatabaseUrlProvider.java deleted file mode 100644 index 67f588eb54..0000000000 --- a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/configuration/database/DatabaseUrlProvider.java +++ /dev/null @@ -1,47 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2018 Ericsson. 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. - * - * SPDX-License-Identifier: Apache-2.0 - * ============LICENSE_END========================================================= - */ -package org.onap.so.monitoring.configuration.database; - -import java.net.URI; -import org.springframework.web.util.UriComponentsBuilder; - -/** - * @author waqas.ikram@ericsson.com - * - */ -public class DatabaseUrlProvider { - - private final URI baseUri; - - public DatabaseUrlProvider(final String baseUrl) { - this.baseUri = UriComponentsBuilder.fromHttpUrl(baseUrl).build().toUri(); - } - - public String getSearchUrl(final long from, final long to, final Integer maxResult) { - final UriComponentsBuilder builder = UriComponentsBuilder.fromUri(baseUri).pathSegment("v1") - .pathSegment("getInfraActiveRequests").queryParam("from", from).queryParam("to", to); - if (maxResult != null) { - return builder.queryParam("maxResult", maxResult).build().toString(); - } - - return builder.build().toString(); - } - -} diff --git a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/configuration/rest/CorsConfigurer.java b/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/configuration/rest/CorsConfigurer.java deleted file mode 100644 index 4d0fd443e9..0000000000 --- a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/configuration/rest/CorsConfigurer.java +++ /dev/null @@ -1,43 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2018 Ericsson. 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. - * - * SPDX-License-Identifier: Apache-2.0 - * ============LICENSE_END========================================================= - */ - -package org.onap.so.monitoring.configuration.rest; - -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.web.cors.CorsConfiguration; -import org.springframework.web.cors.UrlBasedCorsConfigurationSource; -import org.springframework.web.filter.CorsFilter; - -/** - * @author waqas.ikram@ericsson, eoin.hanan@ericsson.com - */ -@Configuration -public class CorsConfigurer { - - @Bean - public CorsFilter corsFilter() { - final UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); - source.registerCorsConfiguration("/**", new CorsConfiguration().applyPermitDefaultValues()); - return new CorsFilter(source); - } -} - - diff --git a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/configuration/rest/HttpServiceProviderConfiguration.java b/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/configuration/rest/HttpServiceProviderConfiguration.java deleted file mode 100644 index 6d8d82bc44..0000000000 --- a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/configuration/rest/HttpServiceProviderConfiguration.java +++ /dev/null @@ -1,66 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2018 Ericsson. 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. - * - * SPDX-License-Identifier: Apache-2.0 - * ============LICENSE_END========================================================= - */ -package org.onap.so.monitoring.configuration.rest; - -import static org.onap.so.client.RestTemplateConfig.CONFIGURABLE_REST_TEMPLATE; -import org.onap.so.configuration.rest.BasicHttpHeadersProvider; -import org.onap.so.configuration.rest.HttpHeadersProvider; -import org.onap.so.rest.service.HttpRestServiceProvider; -import org.onap.so.rest.service.HttpRestServiceProviderImpl; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.web.client.RestTemplate; - -/** - * @author waqas.ikram@ericsson.com - * - */ -@Configuration -public class HttpServiceProviderConfiguration { - - public static final String DATABASE_HTTP_REST_SERVICE_PROVIDER = "databaseHttpRestServiceProvider"; - public static final String CAMUNDA_HTTP_REST_SERVICE_PROVIDER = "camundaHttpRestServiceProvider"; - - @Bean - @Qualifier(CAMUNDA_HTTP_REST_SERVICE_PROVIDER) - public HttpRestServiceProvider camundaHttpRestServiceProvider( - @Qualifier(CONFIGURABLE_REST_TEMPLATE) @Autowired final RestTemplate restTemplate, - @Value(value = "${camunda.rest.api.auth:#{null}}") final String authorization) { - return getHttpRestServiceProvider(restTemplate, new BasicHttpHeadersProvider(authorization)); - } - - @Bean - @Qualifier(DATABASE_HTTP_REST_SERVICE_PROVIDER) - public HttpRestServiceProvider databaseHttpRestServiceProvider( - @Qualifier(CONFIGURABLE_REST_TEMPLATE) @Autowired final RestTemplate restTemplate, - @Value(value = "${mso.database.rest.api.auth:#{null}}") final String authorization) { - return getHttpRestServiceProvider(restTemplate, new BasicHttpHeadersProvider(authorization)); - } - - private HttpRestServiceProvider getHttpRestServiceProvider(final RestTemplate restTemplate, - final HttpHeadersProvider httpHeadersProvider) { - return new HttpRestServiceProviderImpl(restTemplate, httpHeadersProvider); - } - - -} diff --git a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/db/service/DatabaseServiceProvider.java b/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/db/service/DatabaseServiceProvider.java deleted file mode 100644 index b701203564..0000000000 --- a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/db/service/DatabaseServiceProvider.java +++ /dev/null @@ -1,35 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2018 Ericsson. 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. - * - * SPDX-License-Identifier: Apache-2.0 - * ============LICENSE_END========================================================= - */ -package org.onap.so.monitoring.db.service; - -import java.util.List; -import java.util.Map; -import org.onap.so.monitoring.model.SoInfraRequest; - - -/** - * @author waqas.ikram@ericsson.com - */ -public interface DatabaseServiceProvider { - - List<SoInfraRequest> getSoInfraRequest(final Map<String, String[]> filters, final long startTime, - final long endTime, final Integer maxResult); - -} diff --git a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/db/service/DatabaseServiceProviderImpl.java b/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/db/service/DatabaseServiceProviderImpl.java deleted file mode 100644 index 4278a26a69..0000000000 --- a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/db/service/DatabaseServiceProviderImpl.java +++ /dev/null @@ -1,86 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2018 Ericsson. 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. - * - * SPDX-License-Identifier: Apache-2.0 - * ============LICENSE_END========================================================= - */ -package org.onap.so.monitoring.db.service; - -import static org.onap.so.monitoring.configuration.rest.HttpServiceProviderConfiguration.DATABASE_HTTP_REST_SERVICE_PROVIDER; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Map; -import org.onap.so.monitoring.camunda.model.SoActiveInfraRequests; -import org.onap.so.monitoring.configuration.database.DatabaseUrlProvider; -import org.onap.so.monitoring.model.SoInfraRequest; -import org.onap.so.monitoring.model.SoInfraRequestBuilder; -import org.onap.so.rest.service.HttpRestServiceProvider; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.stereotype.Service; -import com.google.common.base.Optional; - -/** - * @author waqas.ikram@ericsson.com - */ -@Service -public class DatabaseServiceProviderImpl implements DatabaseServiceProvider { - - private final DatabaseUrlProvider urlProvider; - - private final HttpRestServiceProvider httpRestServiceProvider; - - @Autowired - public DatabaseServiceProviderImpl(final DatabaseUrlProvider urlProvider, - @Qualifier(DATABASE_HTTP_REST_SERVICE_PROVIDER) @Autowired final HttpRestServiceProvider httpRestServiceProvider) { - this.urlProvider = urlProvider; - this.httpRestServiceProvider = httpRestServiceProvider; - } - - @Override - public List<SoInfraRequest> getSoInfraRequest(final Map<String, String[]> filters, final long startTime, - final long endTime, final Integer maxResult) { - final String url = urlProvider.getSearchUrl(startTime, endTime, maxResult); - - final Optional<SoActiveInfraRequests[]> optionalRequests = - httpRestServiceProvider.post(filters, url, SoActiveInfraRequests[].class); - if (optionalRequests.isPresent()) { - return getSoInfraRequest(optionalRequests.get()); - } - return Collections.emptyList(); - } - - - private List<SoInfraRequest> getSoInfraRequest(final SoActiveInfraRequests[] requests) { - final List<SoInfraRequest> result = new ArrayList<>(requests.length); - for (final SoActiveInfraRequests activeRequests : requests) { - final SoInfraRequest soInfraRequest = - new SoInfraRequestBuilder().setRequestId(activeRequests.getRequestId()) - .setServiceInstanceId(activeRequests.getServiceInstanceId()) - .setNetworkId(activeRequests.getNetworkId()).setEndTime(activeRequests.getEndTime()) - .setRequestStatus(activeRequests.getRequestStatus()) - .setServiceInstanceName(activeRequests.getServiceInstanceName()) - .setServiceType(activeRequests.getServiceType()).setStartTime(activeRequests.getStartTime()) - .build(); - result.add(soInfraRequest); - - } - return result; - } - - -} diff --git a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/model/ActivityInstanceDetail.java b/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/model/ActivityInstanceDetail.java deleted file mode 100644 index 2b26a4a25c..0000000000 --- a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/model/ActivityInstanceDetail.java +++ /dev/null @@ -1,192 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2018 Ericsson. 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. - * - * SPDX-License-Identifier: Apache-2.0 - * ============LICENSE_END========================================================= - */ -package org.onap.so.monitoring.model; - -import static org.onap.so.monitoring.utils.ObjectEqualsUtils.isEqual; - -/** - * @author waqas.ikram@ericsson.com - * - */ -public class ActivityInstanceDetail { - private final String activityId; - private final String activityName; - private final String activityType; - private final String processInstanceId; - private final String calledProcessInstanceId; - private final String startTime; - private final String endTime; - private final String durationInMilliseconds; - - public ActivityInstanceDetail(final ActivityInstanceDetailBuilder builder) { - this.activityId = builder.activityId; - this.activityName = builder.activityName; - this.activityType = builder.activityType; - this.processInstanceId = builder.processInstanceId; - this.calledProcessInstanceId = builder.calledProcessInstanceId; - this.startTime = builder.startTime; - this.endTime = builder.endTime; - this.durationInMilliseconds = builder.durationInMilliseconds; - } - - /** - * @return the activityId - */ - public String getActivityId() { - return activityId; - } - - /** - * @return the activityName - */ - public String getActivityName() { - return activityName; - } - - /** - * @return the activityType - */ - public String getActivityType() { - return activityType; - } - - /** - * @return the processInstanceId - */ - public String getProcessInstanceId() { - return processInstanceId; - } - - /** - * @return the calledProcessInstanceId - */ - public String getCalledProcessInstanceId() { - return calledProcessInstanceId; - } - - /** - * @return the startTime - */ - public String getStartTime() { - return startTime; - } - - /** - * @return the endTime - */ - public String getEndTime() { - return endTime; - } - - /** - * @return the durationInMillis - */ - public String getDurationInMillis() { - return durationInMilliseconds; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((activityId == null) ? 0 : activityId.hashCode()); - result = prime * result + ((activityName == null) ? 0 : activityName.hashCode()); - result = prime * result + ((activityType == null) ? 0 : activityType.hashCode()); - result = prime * result + ((calledProcessInstanceId == null) ? 0 : calledProcessInstanceId.hashCode()); - result = prime * result + ((durationInMilliseconds == null) ? 0 : durationInMilliseconds.hashCode()); - result = prime * result + ((endTime == null) ? 0 : endTime.hashCode()); - result = prime * result + ((processInstanceId == null) ? 0 : processInstanceId.hashCode()); - result = prime * result + ((startTime == null) ? 0 : startTime.hashCode()); - return result; - } - - @Override - public boolean equals(final Object obj) { - - if (obj instanceof ActivityInstanceDetail) { - final ActivityInstanceDetail other = (ActivityInstanceDetail) obj; - return isEqual(activityId, other.activityId) && isEqual(activityName, other.activityName) - && isEqual(activityType, other.activityType) && isEqual(processInstanceId, other.processInstanceId) - && isEqual(calledProcessInstanceId, other.calledProcessInstanceId) - && isEqual(startTime, other.startTime) && isEqual(endTime, other.endTime) - && isEqual(durationInMilliseconds, other.durationInMilliseconds); - } - - return false; - } - - - public static final class ActivityInstanceDetailBuilder { - - private String activityId; - private String activityName; - private String activityType; - private String processInstanceId; - private String calledProcessInstanceId; - private String startTime; - private String endTime; - private String durationInMilliseconds; - - public ActivityInstanceDetailBuilder activityId(final String activityId) { - this.activityId = activityId; - return this; - } - - public ActivityInstanceDetailBuilder activityName(final String activityName) { - this.activityName = activityName; - return this; - } - - public ActivityInstanceDetailBuilder activityType(final String activityType) { - this.activityType = activityType; - return this; - } - - public ActivityInstanceDetailBuilder processInstanceId(final String processInstanceId) { - this.processInstanceId = processInstanceId; - return this; - } - - public ActivityInstanceDetailBuilder calledProcessInstanceId(final String calledProcessInstanceId) { - this.calledProcessInstanceId = calledProcessInstanceId; - return this; - } - - public ActivityInstanceDetailBuilder startTime(final String startTime) { - this.startTime = startTime; - return this; - } - - public ActivityInstanceDetailBuilder endTime(final String endTime) { - this.endTime = endTime; - return this; - } - - public ActivityInstanceDetailBuilder durationInMilliseconds(final String durationInMilliseconds) { - this.durationInMilliseconds = durationInMilliseconds; - return this; - } - - public ActivityInstanceDetail build() { - return new ActivityInstanceDetail(this); - } - } - -} diff --git a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/model/ProcessDefinitionDetail.java b/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/model/ProcessDefinitionDetail.java deleted file mode 100644 index 5e988f6aa6..0000000000 --- a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/model/ProcessDefinitionDetail.java +++ /dev/null @@ -1,76 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2018 Ericsson. 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. - * - * SPDX-License-Identifier: Apache-2.0 - * ============LICENSE_END========================================================= - */ -package org.onap.so.monitoring.model; - -import static org.onap.so.monitoring.utils.ObjectEqualsUtils.isEqual; - -/** - * @author waqas.ikram@ericsson.com - * - */ -public class ProcessDefinitionDetail { - - private final String processDefinitionId; - private final String processDefinitionXml; - - public ProcessDefinitionDetail(final String processDefinitionId, final String processDefinitionXml) { - this.processDefinitionId = processDefinitionId; - this.processDefinitionXml = processDefinitionXml; - } - - /** - * @return the processDefinitionId - */ - public String getProcessDefinitionId() { - return processDefinitionId; - } - - /** - * @return the processDefinitionXml - */ - public String getProcessDefinitionXml() { - return processDefinitionXml; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((processDefinitionId == null) ? 0 : processDefinitionId.hashCode()); - result = prime * result + ((processDefinitionXml == null) ? 0 : processDefinitionXml.hashCode()); - return result; - } - - @Override - public boolean equals(final Object obj) { - if (obj instanceof ProcessDefinitionDetail) { - final ProcessDefinitionDetail other = (ProcessDefinitionDetail) obj; - return isEqual(processDefinitionId, other.processDefinitionId) - && isEqual(processDefinitionXml, other.processDefinitionXml); - } - return false; - } - - @Override - public String toString() { - return "ProcessDefinitionDetail [processDefinitionId=" + processDefinitionId + ", processDefinitionXml=" - + processDefinitionXml + "]"; - } -} diff --git a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/model/ProcessInstanceDetail.java b/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/model/ProcessInstanceDetail.java deleted file mode 100644 index 2f8e756b8c..0000000000 --- a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/model/ProcessInstanceDetail.java +++ /dev/null @@ -1,103 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2018 Ericsson. 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. - * - * SPDX-License-Identifier: Apache-2.0 - * ============LICENSE_END========================================================= - */ -package org.onap.so.monitoring.model; - -import static org.onap.so.monitoring.utils.ObjectEqualsUtils.isEqual; - -/** - * @author waqas.ikram@ericsson.com - */ -public class ProcessInstanceDetail { - - private final String processInstanceId; - private final String processDefinitionId; - private final String processDefinitionName; - private final String superProcessInstanceId; - - - public ProcessInstanceDetail(final String processInstanceId, final String processDefinitionId, - final String processDefinitionName, final String superProcessInstanceId) { - this.processInstanceId = processInstanceId; - this.processDefinitionId = processDefinitionId; - this.processDefinitionName = processDefinitionName; - this.superProcessInstanceId = superProcessInstanceId; - } - - /** - * @return the processInstanceId - */ - public String getProcessInstanceId() { - return processInstanceId; - } - - /** - * @return the processDefinitionId - */ - public String getProcessDefinitionId() { - return processDefinitionId; - } - - /** - * @return the processDefinitionName - */ - public String getProcessDefinitionName() { - return processDefinitionName; - } - - /** - * @return the superProcessInstanceId - */ - public String getSuperProcessInstanceId() { - return superProcessInstanceId; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((processInstanceId == null) ? 0 : processInstanceId.hashCode()); - result = prime * result + ((processDefinitionId == null) ? 0 : processDefinitionId.hashCode()); - result = prime * result + ((processDefinitionName == null) ? 0 : processDefinitionName.hashCode()); - result = prime * result + ((superProcessInstanceId == null) ? 0 : superProcessInstanceId.hashCode()); - return result; - } - - @Override - public boolean equals(final Object obj) { - if (obj instanceof ProcessInstanceDetail) { - final ProcessInstanceDetail other = (ProcessInstanceDetail) obj; - - return isEqual(processInstanceId, other.processInstanceId) - && isEqual(processDefinitionId, other.processDefinitionId) - && isEqual(processDefinitionName, other.processDefinitionName) - && isEqual(superProcessInstanceId, other.superProcessInstanceId); - } - return false; - } - - @Override - public String toString() { - return "ProcessInstanceDetail [processInstanceId=" + processInstanceId + ", processDefinitionId=" - + processDefinitionId + ", processDefinitionName=" + processDefinitionName + ", superProcessInstanceId=" - + superProcessInstanceId + "]"; - } - - -} diff --git a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/model/ProcessInstanceIdDetail.java b/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/model/ProcessInstanceIdDetail.java deleted file mode 100644 index 0f34664935..0000000000 --- a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/model/ProcessInstanceIdDetail.java +++ /dev/null @@ -1,66 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2018 Ericsson. 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. - * - * SPDX-License-Identifier: Apache-2.0 - * ============LICENSE_END========================================================= - */ -package org.onap.so.monitoring.model; - -import static org.onap.so.monitoring.utils.ObjectEqualsUtils.isEqual; - -/** - * @author waqas.ikram@ericsson.com - */ -public class ProcessInstanceIdDetail { - - private final String processInstanceId; - - - public ProcessInstanceIdDetail(final String processInstanceId) { - this.processInstanceId = processInstanceId; - } - - /** - * @return the processInstanceId - */ - public String getProcessInstanceId() { - return processInstanceId; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((processInstanceId == null) ? 0 : processInstanceId.hashCode()); - return result; - } - - @Override - public boolean equals(final Object obj) { - if (obj instanceof ProcessInstanceIdDetail) { - final ProcessInstanceIdDetail other = (ProcessInstanceIdDetail) obj; - - return isEqual(processInstanceId, other.processInstanceId); - } - return false; - } - - @Override - public String toString() { - return "ProcessInstanceIdDetail [processInstanceId=" + processInstanceId + "]"; - } - -} diff --git a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/model/ProcessInstanceVariableDetail.java b/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/model/ProcessInstanceVariableDetail.java deleted file mode 100644 index a52121d7c5..0000000000 --- a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/model/ProcessInstanceVariableDetail.java +++ /dev/null @@ -1,84 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2018 Ericsson. 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. - * - * SPDX-License-Identifier: Apache-2.0 - * ============LICENSE_END========================================================= - */ -package org.onap.so.monitoring.model; - -/** - * @author waqas.ikram@ericsson.com - */ -import static org.onap.so.monitoring.utils.ObjectEqualsUtils.isEqual; - -public class ProcessInstanceVariableDetail { - - private final String name; - private final Object value; - private final String type; - - public ProcessInstanceVariableDetail(final String name, final Object value, final String type) { - this.name = name; - this.value = value; - this.type = type; - } - - /** - * @return the name - */ - public String getName() { - return name; - } - - /** - * @return the value - */ - public Object getValue() { - return value; - } - - /** - * @return the type - */ - public String getType() { - return type; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((name == null) ? 0 : name.hashCode()); - result = prime * result + ((value == null) ? 0 : value.hashCode()); - result = prime * result + ((type == null) ? 0 : type.hashCode()); - return result; - } - - @Override - public boolean equals(final Object obj) { - if (obj instanceof ProcessInstanceVariableDetail) { - final ProcessInstanceVariableDetail other = (ProcessInstanceVariableDetail) obj; - - return isEqual(name, other.name) && isEqual(value, other.value) && isEqual(type, other.type); - } - return false; - } - - @Override - public String toString() { - return "ProcessInstanceVariableDetail [name=" + name + ", value=" + value + ", type=" + type + "]"; - } -} diff --git a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/model/SoInfraRequest.java b/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/model/SoInfraRequest.java deleted file mode 100644 index 53b928b88e..0000000000 --- a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/model/SoInfraRequest.java +++ /dev/null @@ -1,132 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2018 Ericsson. 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. - * - * SPDX-License-Identifier: Apache-2.0 - * ============LICENSE_END========================================================= - */ -package org.onap.so.monitoring.model; - -import static org.onap.so.monitoring.utils.ObjectEqualsUtils.isEqual; - -/** - * @author waqas.ikram@ericsson.com - */ -public class SoInfraRequest { - - private final String requestId; - private final String serviceInstanceId; - private final String serviceInstanceName; - private final String networkId; - private final String requestStatus; - private final String serviceType; - private final String startTime; - private final String endTime; - - public SoInfraRequest(final SoInfraRequestBuilder requestBuilder) { - this.requestId = requestBuilder.getRequestId(); - this.serviceInstanceId = requestBuilder.getServiceInstanceId(); - this.serviceInstanceName = requestBuilder.getServiceInstanceName(); - this.networkId = requestBuilder.getNetworkId(); - this.requestStatus = requestBuilder.getRequestStatus(); - this.serviceType = requestBuilder.getServiceType(); - this.startTime = requestBuilder.getStartTime(); - this.endTime = requestBuilder.getEndTime(); - } - - /** - * @return the requestId - */ - public String getRequestId() { - return requestId; - } - - /** - * @return the serviceInstanceId - */ - public String getServiceInstanceId() { - return serviceInstanceId; - } - - /** - * @return the serviceInstanceName - */ - public String getServiceInstanceName() { - return serviceInstanceName; - } - - /** - * @return the networkId - */ - public String getNetworkId() { - return networkId; - } - - /** - * @return the requestStatus - */ - public String getRequestStatus() { - return requestStatus; - } - - /** - * @return the serviceType - */ - public String getServiceType() { - return serviceType; - } - - /** - * @return the startTime - */ - public String getStartTime() { - return startTime; - } - - /** - * @return the endTime - */ - public String getEndTime() { - return endTime; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((endTime == null) ? 0 : endTime.hashCode()); - result = prime * result + ((networkId == null) ? 0 : networkId.hashCode()); - result = prime * result + ((requestId == null) ? 0 : requestId.hashCode()); - result = prime * result + ((requestStatus == null) ? 0 : requestStatus.hashCode()); - result = prime * result + ((serviceInstanceId == null) ? 0 : serviceInstanceId.hashCode()); - result = prime * result + ((serviceInstanceName == null) ? 0 : serviceInstanceName.hashCode()); - result = prime * result + ((serviceType == null) ? 0 : serviceType.hashCode()); - result = prime * result + ((startTime == null) ? 0 : startTime.hashCode()); - return result; - } - - @Override - public boolean equals(final Object obj) { - if (obj instanceof SoInfraRequest) { - final SoInfraRequest other = (SoInfraRequest) obj; - return isEqual(requestId, other.requestId) && isEqual(serviceInstanceId, other.serviceInstanceId) - && isEqual(serviceInstanceName, other.serviceInstanceName) && isEqual(networkId, other.networkId) - && isEqual(requestStatus, other.requestStatus) && isEqual(serviceType, other.serviceType) - && isEqual(startTime, other.startTime) && isEqual(endTime, other.endTime); - } - return false; - } - -} diff --git a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/model/SoInfraRequestBuilder.java b/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/model/SoInfraRequestBuilder.java deleted file mode 100644 index 235c481930..0000000000 --- a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/model/SoInfraRequestBuilder.java +++ /dev/null @@ -1,148 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2018 Ericsson. 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. - * - * SPDX-License-Identifier: Apache-2.0 - * ============LICENSE_END========================================================= - */ -package org.onap.so.monitoring.model; - -import java.sql.Timestamp; - -/** - * @author waqas.ikram@ericsson.com - */ -public class SoInfraRequestBuilder { - - private String requestId; - private String serviceInstanceId; - private String serviceInstanceName; - private String networkId; - private String requestStatus; - private String serviceType; - private String startTime; - private String endTime; - - public SoInfraRequestBuilder setRequestId(final String requestId) { - this.requestId = requestId; - return this; - } - - public SoInfraRequestBuilder setServiceInstanceId(final String serviceInstanceId) { - this.serviceInstanceId = serviceInstanceId; - return this; - } - - public SoInfraRequestBuilder setServiceInstanceName(final String serviceInstanceName) { - this.serviceInstanceName = serviceInstanceName; - return this; - } - - public SoInfraRequestBuilder setNetworkId(final String networkId) { - this.networkId = networkId; - return this; - } - - public SoInfraRequestBuilder setRequestStatus(final String requestStatus) { - this.requestStatus = requestStatus; - return this; - } - - public SoInfraRequestBuilder setServiceType(final String serviceType) { - this.serviceType = serviceType; - return this; - } - - public SoInfraRequestBuilder setEndTime(final String endTime) { - this.endTime = endTime; - return this; - } - - public SoInfraRequestBuilder setEndTime(final Timestamp endTime) { - this.endTime = endTime != null ? endTime.toString() : null; - return this; - } - - - public SoInfraRequestBuilder setStartTime(final String startTime) { - this.startTime = startTime; - return this; - } - - public SoInfraRequestBuilder setStartTime(final Timestamp startTime) { - this.startTime = startTime != null ? startTime.toString() : null; - return this; - } - - public SoInfraRequest build() { - return new SoInfraRequest(this); - } - - /** - * @return the requestId - */ - public String getRequestId() { - return requestId; - } - - /** - * @return the serviceInstanceId - */ - public String getServiceInstanceId() { - return serviceInstanceId; - } - - /** - * @return the serviceInstanceName - */ - public String getServiceInstanceName() { - return serviceInstanceName; - } - - /** - * @return the networkId - */ - public String getNetworkId() { - return networkId; - } - - /** - * @return the requestStatus - */ - public String getRequestStatus() { - return requestStatus; - } - - /** - * @return the serviceType - */ - public String getServiceType() { - return serviceType; - } - - /** - * @return the startTime - */ - public String getStartTime() { - return startTime; - } - - /** - * @return the endTime - */ - public String getEndTime() { - return endTime; - } -} diff --git a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/rest/service/CamundaProcessDataServiceProvider.java b/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/rest/service/CamundaProcessDataServiceProvider.java deleted file mode 100644 index 729e57b885..0000000000 --- a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/rest/service/CamundaProcessDataServiceProvider.java +++ /dev/null @@ -1,45 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2018 Ericsson. 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. - * - * SPDX-License-Identifier: Apache-2.0 - * ============LICENSE_END========================================================= - */ -package org.onap.so.monitoring.rest.service; - -import java.util.List; -import org.onap.so.monitoring.model.ActivityInstanceDetail; -import org.onap.so.monitoring.model.ProcessDefinitionDetail; -import org.onap.so.monitoring.model.ProcessInstanceDetail; -import org.onap.so.monitoring.model.ProcessInstanceIdDetail; -import org.onap.so.monitoring.model.ProcessInstanceVariableDetail; -import com.google.common.base.Optional; - -/** - * @author waqas.ikram@ericsson.com - */ -public interface CamundaProcessDataServiceProvider { - - Optional<ProcessInstanceIdDetail> getProcessInstanceIdDetail(final String requestId); - - Optional<ProcessInstanceDetail> getSingleProcessInstanceDetail(final String processInstanceId); - - Optional<ProcessDefinitionDetail> getProcessDefinition(final String processDefinitionId); - - List<ActivityInstanceDetail> getActivityInstance(final String processInstanceId); - - List<ProcessInstanceVariableDetail> getProcessInstanceVariable(final String processInstanceId); - -} diff --git a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/rest/service/CamundaProcessDataServiceProviderImpl.java b/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/rest/service/CamundaProcessDataServiceProviderImpl.java deleted file mode 100644 index e0996fd2ad..0000000000 --- a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/rest/service/CamundaProcessDataServiceProviderImpl.java +++ /dev/null @@ -1,169 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2018 Ericsson. 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. - * - * SPDX-License-Identifier: Apache-2.0 - * ============LICENSE_END========================================================= - */ -package org.onap.so.monitoring.rest.service; - -import static org.onap.so.monitoring.configuration.rest.HttpServiceProviderConfiguration.CAMUNDA_HTTP_REST_SERVICE_PROVIDER; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import org.onap.so.monitoring.camunda.model.ActivityInstance; -import org.onap.so.monitoring.camunda.model.ProcessDefinition; -import org.onap.so.monitoring.camunda.model.ProcessInstance; -import org.onap.so.monitoring.camunda.model.ProcessInstanceVariable; -import org.onap.so.monitoring.configuration.camunda.CamundaRestUrlProvider; -import org.onap.so.monitoring.model.ActivityInstanceDetail; -import org.onap.so.monitoring.model.ProcessDefinitionDetail; -import org.onap.so.monitoring.model.ProcessInstanceDetail; -import org.onap.so.monitoring.model.ProcessInstanceIdDetail; -import org.onap.so.monitoring.model.ProcessInstanceVariableDetail; -import org.onap.so.rest.service.HttpRestServiceProvider; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.stereotype.Service; -import com.google.common.base.Optional; - -/** - * @author waqas.ikram@ericsson.com - */ -@Service -public class CamundaProcessDataServiceProviderImpl implements CamundaProcessDataServiceProvider { - private static final Logger LOGGER = LoggerFactory.getLogger(CamundaProcessDataServiceProviderImpl.class); - private final CamundaRestUrlProvider urlProvider; - - private final HttpRestServiceProvider httpRestServiceProvider; - - @Autowired - public CamundaProcessDataServiceProviderImpl(final CamundaRestUrlProvider urlProvider, - @Qualifier(CAMUNDA_HTTP_REST_SERVICE_PROVIDER) @Autowired final HttpRestServiceProvider httpRestServiceProvider) { - this.urlProvider = urlProvider; - this.httpRestServiceProvider = httpRestServiceProvider; - } - - @Override - public Optional<ProcessInstanceIdDetail> getProcessInstanceIdDetail(final String requestId) { - final String url = urlProvider.getHistoryProcessInstanceUrl(requestId); - final Optional<ProcessInstance[]> processInstances = httpRestServiceProvider.get(url, ProcessInstance[].class); - - if (processInstances.isPresent()) { - final ProcessInstance[] instances = processInstances.get(); - final String message = - "found process instance for request id: " + requestId + ", result size: " + instances.length; - LOGGER.debug(message); - - if (instances.length > 0) { - for (int index = 0; index < instances.length; index++) { - final ProcessInstance processInstance = instances[index]; - if (processInstance.getSuperProcessInstanceId() == null) { - return Optional.of(new ProcessInstanceIdDetail(processInstance.getId())); - } - LOGGER.debug("found sub process instance id with super process instanceId: " - + processInstance.getSuperProcessInstanceId()); - } - } - } - LOGGER.error("Unable to find process intance for request id: " + requestId); - return Optional.absent(); - } - - @Override - public Optional<ProcessInstanceDetail> getSingleProcessInstanceDetail(final String processInstanceId) { - final String url = urlProvider.getSingleProcessInstanceUrl(processInstanceId); - final Optional<ProcessInstance> processInstances = httpRestServiceProvider.get(url, ProcessInstance.class); - - if (processInstances.isPresent()) { - final ProcessInstance processInstance = processInstances.get(); - - final ProcessInstanceDetail instanceDetail = - new ProcessInstanceDetail(processInstance.getId(), processInstance.getProcessDefinitionId(), - processInstance.getProcessDefinitionName(), processInstance.getSuperProcessInstanceId()); - return Optional.of(instanceDetail); - - } - LOGGER.error("Unable to find process intance for id: " + processInstanceId); - return Optional.absent(); - } - - - @Override - public Optional<ProcessDefinitionDetail> getProcessDefinition(final String processDefinitionId) { - final String url = urlProvider.getProcessDefinitionUrl(processDefinitionId); - final Optional<ProcessDefinition> response = httpRestServiceProvider.get(url, ProcessDefinition.class); - if (response.isPresent()) { - final ProcessDefinition processDefinition = response.get(); - final String xmlDefinition = processDefinition.getBpmn20Xml(); - if (xmlDefinition != null) { - return Optional.of(new ProcessDefinitionDetail(processDefinitionId, xmlDefinition)); - } - } - LOGGER.error("Unable to find process definition for processDefinitionId: " + processDefinitionId); - return Optional.absent(); - } - - @Override - public List<ActivityInstanceDetail> getActivityInstance(final String processInstanceId) { - final String url = urlProvider.getActivityInstanceUrl(processInstanceId); - final Optional<ActivityInstance[]> response = httpRestServiceProvider.get(url, ActivityInstance[].class); - if (response.isPresent()) { - final ActivityInstance[] activityInstances = response.get(); - final List<ActivityInstanceDetail> activityInstanceDetails = new ArrayList<>(activityInstances.length); - for (int index = 0; index < activityInstances.length; index++) { - - final ActivityInstance activityInstance = activityInstances[index]; - - activityInstanceDetails.add(new ActivityInstanceDetail.ActivityInstanceDetailBuilder() - .activityId(activityInstance.getActivityId()).activityName(activityInstance.getActivityName()) - .activityType(activityInstance.getActivityType()) - .calledProcessInstanceId(activityInstance.getCalledProcessInstanceId()) - .startTime(activityInstance.getStartTime()).endTime(activityInstance.getEndTime()) - .durationInMilliseconds(activityInstance.getDurationInMillis()) - .processInstanceId(activityInstance.getProcessInstanceId()).build()); - - } - return activityInstanceDetails; - } - LOGGER.error("Unable to find activity intance detail for process instance id: " + processInstanceId); - return Collections.emptyList(); - } - - @Override - public List<ProcessInstanceVariableDetail> getProcessInstanceVariable(final String processInstanceId) { - final String url = urlProvider.getProcessInstanceVariablesUrl(processInstanceId); - final Optional<ProcessInstanceVariable[]> response = - httpRestServiceProvider.get(url, ProcessInstanceVariable[].class); - if (response.isPresent()) { - final ProcessInstanceVariable[] instanceVariables = response.get(); - final List<ProcessInstanceVariableDetail> instanceVariableDetails = - new ArrayList<>(instanceVariables.length); - for (int index = 0; index < instanceVariables.length; index++) { - final ProcessInstanceVariable processInstanceVariable = instanceVariables[index]; - final ProcessInstanceVariableDetail instanceVariableDetail = - new ProcessInstanceVariableDetail(processInstanceVariable.getName(), - processInstanceVariable.getValue(), processInstanceVariable.getType()); - instanceVariableDetails.add(instanceVariableDetail); - } - return instanceVariableDetails; - } - LOGGER.error("Unable to find process intance variable details for process instance id: " + processInstanceId); - return Collections.emptyList(); - } - -} diff --git a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/utils/ObjectEqualsUtils.java b/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/utils/ObjectEqualsUtils.java deleted file mode 100644 index d8e331baae..0000000000 --- a/so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/utils/ObjectEqualsUtils.java +++ /dev/null @@ -1,36 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2018 Ericsson. 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. - * - * SPDX-License-Identifier: Apache-2.0 - * ============LICENSE_END========================================================= - */ -package org.onap.so.monitoring.utils; - -/** - * @author waqas.ikram@ericsson.com - */ -public class ObjectEqualsUtils { - - private ObjectEqualsUtils() {} - - public static boolean isEqual(final Object objectA, final Object objectB) { - if (objectA == null) { - return objectB == null; - } - return objectA.equals(objectB); - } - -} diff --git a/so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/monitoring/configuration/CamundaConfigurationTest.java b/so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/monitoring/configuration/CamundaConfigurationTest.java deleted file mode 100644 index b08d247106..0000000000 --- a/so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/monitoring/configuration/CamundaConfigurationTest.java +++ /dev/null @@ -1,43 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2018 Ericsson. 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. - * - * SPDX-License-Identifier: Apache-2.0 - * ============LICENSE_END========================================================= - */ -package org.onap.so.monitoring.configuration; - -import static org.junit.Assert.assertEquals; -import org.junit.Test; -import org.onap.so.monitoring.configuration.camunda.CamundaConfiguration; -import org.onap.so.monitoring.configuration.camunda.CamundaRestUrlProvider; - - -/** - * @author waqas.ikram@ericsson.com - * - */ -public class CamundaConfigurationTest { - - @Test - public void test_CamundaRestURIConfiguration_ValidUrl() { - final CamundaConfiguration objUnderTest = new CamundaConfiguration(); - final CamundaRestUrlProvider provider = objUnderTest.camundaRestUrlProvider("http://localhost:8080", "default"); - assertEquals( - "http://localhost:8080/default/history/activity-instance?processInstanceId=Deadpool&sortBy=startTime&sortOrder=asc", - provider.getActivityInstanceUrl("Deadpool")); - } - -} diff --git a/so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/monitoring/configuration/CamundaRestUrlProviderTest.java b/so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/monitoring/configuration/CamundaRestUrlProviderTest.java deleted file mode 100644 index e2d6ddb959..0000000000 --- a/so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/monitoring/configuration/CamundaRestUrlProviderTest.java +++ /dev/null @@ -1,78 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2018 Ericsson. 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. - * - * SPDX-License-Identifier: Apache-2.0 - * ============LICENSE_END========================================================= - */ -package org.onap.so.monitoring.configuration; - -import static org.junit.Assert.assertEquals; -import java.util.UUID; -import org.junit.Test; -import org.onap.so.monitoring.configuration.camunda.CamundaRestUrlProvider; - -/** - * @author waqas.ikram@ericsson.com - */ -public class CamundaRestUrlProviderTest { - private static final String DEFAULT = "default"; - private static final String CAMUNDA_REST_API_URL = "http://localhost:9080/engine-rest/engine/"; - private static final String BASE_URL = CAMUNDA_REST_API_URL + DEFAULT; - private final CamundaRestUrlProvider objUnderTest = new CamundaRestUrlProvider(CAMUNDA_REST_API_URL, DEFAULT); - private static final String ID = UUID.randomUUID().toString(); - - - @Test - public void test_GetHistoryProcessInstanceUrl() { - final String expectedUrl = BASE_URL + "/history/process-instance?variables=requestId_eq_" + ID; - final String actualUrl = objUnderTest.getHistoryProcessInstanceUrl(ID); - assertEquals(expectedUrl, actualUrl); - } - - @Test - public void test_GetProcessInstanceUrl() { - final String expectedUrl = BASE_URL + "/history/process-instance/" + ID; - final String actualUrl = objUnderTest.getSingleProcessInstanceUrl(ID); - assertEquals(expectedUrl, actualUrl); - } - - - @Test - public void test_GetProcessDefinitionUrl() { - final String expectedUrl = BASE_URL + "/process-definition/" + ID + "/xml"; - final String actualUrl = objUnderTest.getProcessDefinitionUrl(ID); - assertEquals(expectedUrl, actualUrl); - - } - - @Test - public void test_GetActivityIntanceUrl() { - final String expectedUrl = - BASE_URL + "/history/activity-instance?processInstanceId=" + ID + "&sortBy=startTime&sortOrder=asc"; - final String actualUrl = objUnderTest.getActivityInstanceUrl(ID); - assertEquals(expectedUrl, actualUrl); - - } - - @Test - public void test_GetProcessInstanceVariablesUrl() { - final String expectedUrl = BASE_URL + "/history/variable-instance?processInstanceId=" + ID; - final String actualUrl = objUnderTest.getProcessInstanceVariablesUrl(ID); - assertEquals(expectedUrl, actualUrl); - - } - -} diff --git a/so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/monitoring/configuration/HttpServiceProviderConfigurationTest.java b/so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/monitoring/configuration/HttpServiceProviderConfigurationTest.java deleted file mode 100644 index d85a03485f..0000000000 --- a/so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/monitoring/configuration/HttpServiceProviderConfigurationTest.java +++ /dev/null @@ -1,69 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2018 Ericsson. 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. - * - * SPDX-License-Identifier: Apache-2.0 - * ============LICENSE_END========================================================= - */ -package org.onap.so.monitoring.configuration; - -import static org.junit.Assert.assertNotNull; -import org.junit.Test; -import org.onap.so.monitoring.configuration.rest.HttpServiceProviderConfiguration; -import org.onap.so.rest.service.HttpRestServiceProvider; -import org.springframework.web.client.RestTemplate; - -/** - * @author waqas.ikram@ericsson.com - * - */ -public class HttpServiceProviderConfigurationTest { - - private final HttpServiceProviderConfiguration objUnderTest = new HttpServiceProviderConfiguration(); - private static final String AUTHORIZATION = - "Basic YWRtaW46S3A4Yko0U1hzek0wV1hsaGFrM2VIbGNzZTJnQXc4NHZhb0dHbUp2VXkyVQ=="; - - @Test - public void test_CamundaHttpRestServiceProvider_NotNull() { - - final HttpRestServiceProvider serviceProvider = - objUnderTest.camundaHttpRestServiceProvider(new RestTemplate(), AUTHORIZATION); - - assertNotNull(serviceProvider); - } - - @Test - public void test_DatabaseHttpRestServiceProvider_NotNull() { - - final HttpRestServiceProvider serviceProvider = - objUnderTest.databaseHttpRestServiceProvider(new RestTemplate(), AUTHORIZATION); - - assertNotNull(serviceProvider); - } - - @Test - public void test_DatabaseHttpRestServiceProviderWithAuthorizationNullOrEmpty_NotNull() { - - HttpRestServiceProvider serviceProvider = - objUnderTest.databaseHttpRestServiceProvider(new RestTemplate(), null); - - assertNotNull(serviceProvider); - - serviceProvider = objUnderTest.databaseHttpRestServiceProvider(new RestTemplate(), ""); - - assertNotNull(serviceProvider); - } - -} diff --git a/so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/monitoring/configuration/PojoClassesTests.java b/so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/monitoring/configuration/PojoClassesTests.java deleted file mode 100644 index fbd0aea5ec..0000000000 --- a/so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/monitoring/configuration/PojoClassesTests.java +++ /dev/null @@ -1,78 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2018 Ericsson. 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. - * - * SPDX-License-Identifier: Apache-2.0 - * ============LICENSE_END========================================================= - */ -package org.onap.so.monitoring.configuration; - -import static org.junit.Assert.assertFalse; -import java.util.Set; -import java.util.regex.Pattern; -import org.junit.Test; -import org.onap.so.openpojo.rules.ToStringTester; -import org.springframework.beans.factory.config.BeanDefinition; -import org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider; -import org.springframework.core.type.filter.RegexPatternTypeFilter; -import com.openpojo.reflection.filters.FilterPackageInfo; -import com.openpojo.validation.Validator; -import com.openpojo.validation.ValidatorBuilder; -import com.openpojo.validation.test.impl.GetterTester; -import com.openpojo.validation.test.impl.SetterTester; -import nl.jqno.equalsverifier.EqualsVerifier; -import nl.jqno.equalsverifier.Warning; - -/** - * @author waqas.ikram@ericsson.com - */ -public class PojoClassesTests { - - @Test - public void test_camunda_module_pojo_classes() throws ClassNotFoundException { - test("org.onap.so.monitoring.camunda.model"); - assertEqualMethod("org.onap.so.monitoring.camunda.model"); - } - - @Test - public void test_so_monitoring_pojo_classes() throws ClassNotFoundException { - test("org.onap.so.monitoring.model"); - assertEqualMethod("org.onap.so.monitoring.model"); - } - - public void assertEqualMethod(final String pojoPackage) throws ClassNotFoundException { - final Set<BeanDefinition> classes = getBeanDefinition(pojoPackage); - assertFalse(classes.isEmpty()); - for (final BeanDefinition bean : classes) { - final Class<?> clazz = Class.forName(bean.getBeanClassName()); - if (!clazz.getName().endsWith("Builder")) { - EqualsVerifier.forClass(clazz).suppress(Warning.STRICT_INHERITANCE, Warning.NONFINAL_FIELDS).verify(); - } - } - } - - private Set<BeanDefinition> getBeanDefinition(final String pojoPackage) { - final ClassPathScanningCandidateComponentProvider provider = - new ClassPathScanningCandidateComponentProvider(false); - provider.addIncludeFilter(new RegexPatternTypeFilter(Pattern.compile(pojoPackage + ".*"))); - return provider.findCandidateComponents(pojoPackage); - } - - private void test(final String pojoPackage) { - final Validator validator = ValidatorBuilder.create().with(new SetterTester()).with(new GetterTester()) - .with(new ToStringTester()).build(); - validator.validate(pojoPackage, new FilterPackageInfo()); - } -} diff --git a/so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/monitoring/configuration/database/DatabaseUrlProviderTest.java b/so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/monitoring/configuration/database/DatabaseUrlProviderTest.java deleted file mode 100644 index 5484b7a7ca..0000000000 --- a/so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/monitoring/configuration/database/DatabaseUrlProviderTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2018 Ericsson. 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. - * - * SPDX-License-Identifier: Apache-2.0 - * ============LICENSE_END========================================================= - */ -package org.onap.so.monitoring.configuration.database; - -import static org.junit.Assert.assertEquals; -import org.junit.Test; - - -/** - * @author waqas.ikram@ericsson.com - */ -public class DatabaseUrlProviderTest { - - private static final int MAX_RESULT = 1; - private static final String URL = "http://localhost:8081/infraActiveRequests/"; - private final DatabaseUrlProvider objUnderTest = new DatabaseUrlProvider(URL); - - @Test - public void test_maxResultNull() { - final long from = System.currentTimeMillis(); - final long to = System.currentTimeMillis(); - final String actualUrl = objUnderTest.getSearchUrl(from, to, null); - assertEquals(URL + "v1/getInfraActiveRequests?from=" + from + "&to=" + to, actualUrl); - } - - @Test - public void test_maxResultNotNull() { - final long from = System.currentTimeMillis(); - final long to = System.currentTimeMillis(); - final String actualUrl = objUnderTest.getSearchUrl(from, to, MAX_RESULT); - assertEquals(URL + "v1/getInfraActiveRequests?from=" + from + "&to=" + to + "&maxResult=" + MAX_RESULT, - actualUrl); - } -} diff --git a/so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/monitoring/db/api/DatabaseServiceProviderTest.java b/so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/monitoring/db/api/DatabaseServiceProviderTest.java deleted file mode 100644 index 36a39d9cad..0000000000 --- a/so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/monitoring/db/api/DatabaseServiceProviderTest.java +++ /dev/null @@ -1,104 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2018 Ericsson. 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. - * - * SPDX-License-Identifier: Apache-2.0 - * ============LICENSE_END========================================================= - */ -package org.onap.so.monitoring.db.api; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; -import org.junit.Test; -import org.onap.so.monitoring.camunda.model.SoActiveInfraRequests; -import org.onap.so.monitoring.configuration.database.DatabaseUrlProvider; -import org.onap.so.monitoring.db.service.DatabaseServiceProvider; -import org.onap.so.monitoring.db.service.DatabaseServiceProviderImpl; -import org.onap.so.monitoring.model.SoInfraRequest; -import org.onap.so.rest.service.HttpRestServiceProvider; -import com.google.common.base.Optional; - - -/** - * @author waqas.ikram@ericsson.com - */ -public class DatabaseServiceProviderTest { - - private final static DatabaseUrlProvider URL_PROVIDER = - new DatabaseUrlProvider("http://localhost:8081/infraActiveRequests/"); - - @Test - public void test_GetSoInfraRequest_WithEmptyFilters_EmptyList() { - final HttpRestServiceProvider mockServiceProvider = mock(HttpRestServiceProvider.class); - final String searchUrl = URL_PROVIDER.getSearchUrl(0, 0, null); - final Optional<SoActiveInfraRequests[]> response = Optional.of(new SoActiveInfraRequests[] {}); - - when(mockServiceProvider.post(eq(Collections.emptyMap()), eq(searchUrl), eq(SoActiveInfraRequests[].class))) - .thenReturn(response); - - final DatabaseServiceProvider objUnderTest = new DatabaseServiceProviderImpl(URL_PROVIDER, mockServiceProvider); - - assertTrue(objUnderTest.getSoInfraRequest(Collections.emptyMap(), 0, 0, null).isEmpty()); - } - - @Test - public void test_GetSoInfraRequest_OptionalAbsent_EmptyList() { - final HttpRestServiceProvider mockServiceProvider = mock(HttpRestServiceProvider.class); - final String searchUrl = URL_PROVIDER.getSearchUrl(0, 0, null); - final Optional<SoActiveInfraRequests[]> response = Optional.absent(); - - when(mockServiceProvider.post(eq(Collections.emptyMap()), eq(searchUrl), eq(SoActiveInfraRequests[].class))) - .thenReturn(response); - - final DatabaseServiceProvider objUnderTest = new DatabaseServiceProviderImpl(URL_PROVIDER, mockServiceProvider); - - assertTrue(objUnderTest.getSoInfraRequest(Collections.emptyMap(), 0, 0, null).isEmpty()); - } - - @Test - public void test_GetSoInfraRequest_WithFilters_InfraActiveRequestsList() { - final String searchUrl = URL_PROVIDER.getSearchUrl(0, 0, null); - final String requestID = UUID.randomUUID().toString(); - final Map<String, String[]> filters = new HashMap<>(); - filters.put("requestId", new String[] {"EQ", requestID}); - - final SoActiveInfraRequests soActiveInfraRequests = new SoActiveInfraRequests(); - soActiveInfraRequests.setRequestId(requestID); - - final Optional<SoActiveInfraRequests[]> response = - Optional.of(new SoActiveInfraRequests[] {soActiveInfraRequests}); - - final HttpRestServiceProvider mockServiceProvider = mock(HttpRestServiceProvider.class); - - when(mockServiceProvider.post(eq(filters), eq(searchUrl), eq(SoActiveInfraRequests[].class))) - .thenReturn(response); - - final DatabaseServiceProvider objUnderTest = new DatabaseServiceProviderImpl(URL_PROVIDER, mockServiceProvider); - - final List<SoInfraRequest> actualList = objUnderTest.getSoInfraRequest(filters, 0, 0, null); - assertFalse(actualList.isEmpty()); - assertEquals(requestID, actualList.get(0).getRequestId()); - - } -} diff --git a/so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/monitoring/rest/service/CamundaProcessDataServiceProviderTest.java b/so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/monitoring/rest/service/CamundaProcessDataServiceProviderTest.java deleted file mode 100644 index 61b8b898a9..0000000000 --- a/so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/monitoring/rest/service/CamundaProcessDataServiceProviderTest.java +++ /dev/null @@ -1,230 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2018 Ericsson. 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. - * - * SPDX-License-Identifier: Apache-2.0 - * ============LICENSE_END========================================================= - */ -package org.onap.so.monitoring.rest.service; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; -import java.util.List; -import java.util.UUID; -import org.junit.Test; -import org.onap.so.monitoring.camunda.model.ActivityInstance; -import org.onap.so.monitoring.camunda.model.ProcessDefinition; -import org.onap.so.monitoring.camunda.model.ProcessInstance; -import org.onap.so.monitoring.camunda.model.ProcessInstanceVariable; -import org.onap.so.monitoring.configuration.camunda.CamundaRestUrlProvider; -import org.onap.so.monitoring.model.ActivityInstanceDetail; -import org.onap.so.monitoring.model.ProcessDefinitionDetail; -import org.onap.so.monitoring.model.ProcessInstanceIdDetail; -import org.onap.so.monitoring.model.ProcessInstanceVariableDetail; -import org.onap.so.rest.service.HttpRestServiceProvider; -import com.google.common.base.Optional; - - -/** - * @author waqas.ikram@ericsson.com - */ -public class CamundaProcessDataServiceProviderTest { - private static final String DURATION = "1"; - private static final String FLOW_XML = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"; - private static final String NAME = "Test"; - private static final String DEFAULT = "default"; - private static final String CAMUNDA_REST_API_URL = "http://localhost:9080/engine-rest/engine/"; - - private static final String ID = UUID.randomUUID().toString(); - private static final String PROCESS_ID = UUID.randomUUID().toString(); - private static final String DEF_ID = UUID.randomUUID().toString(); - private static final String SUPER_PROCESS_ID = UUID.randomUUID().toString(); - private final HttpRestServiceProvider httpRestServiceProvider = mock(HttpRestServiceProvider.class); - private final CamundaRestUrlProvider camundaRestUrlProvider = - new CamundaRestUrlProvider(CAMUNDA_REST_API_URL, DEFAULT); - - - @Test - public void test_GetProcessInstanceDetail_EmptyResponse() { - final Optional<ProcessInstance[]> response = Optional.<ProcessInstance[]>absent(); - final String url = CAMUNDA_REST_API_URL + DEFAULT + "/history/process-instance?variables=requestId_eq_" + ID; - when(httpRestServiceProvider.get(url, ProcessInstance[].class)).thenReturn(response); - final CamundaProcessDataServiceProvider objUnderTest = - new CamundaProcessDataServiceProviderImpl(camundaRestUrlProvider, httpRestServiceProvider); - - final Optional<ProcessInstanceIdDetail> actualResponse = objUnderTest.getProcessInstanceIdDetail(ID); - assertFalse(actualResponse.isPresent()); - } - - @Test - public void test_GetProcessInstanceDetail_NonEmptyResponseWithSuperProcessIdNull() { - final Optional<ProcessInstance[]> response = Optional.of(getProcessInstance()); - final String url = CAMUNDA_REST_API_URL + DEFAULT + "/history/process-instance?variables=requestId_eq_" + ID; - when(httpRestServiceProvider.get(url, ProcessInstance[].class)).thenReturn(response); - final CamundaProcessDataServiceProvider objUnderTest = - new CamundaProcessDataServiceProviderImpl(camundaRestUrlProvider, httpRestServiceProvider); - - final Optional<ProcessInstanceIdDetail> actualResponse = objUnderTest.getProcessInstanceIdDetail(ID); - assertTrue(actualResponse.isPresent()); - - final ProcessInstanceIdDetail actualProcessInstanceDetail = actualResponse.get(); - assertEquals(PROCESS_ID, actualProcessInstanceDetail.getProcessInstanceId()); - } - - @Test - public void test_GetProcessInstanceDetail_NonEmptyResponseWithSuperProcessIdNotNull() { - final Optional<ProcessInstance[]> response = Optional.of(getProcessInstance(SUPER_PROCESS_ID)); - final String url = CAMUNDA_REST_API_URL + DEFAULT + "/history/process-instance?variables=requestId_eq_" + ID; - when(httpRestServiceProvider.get(url, ProcessInstance[].class)).thenReturn(response); - final CamundaProcessDataServiceProvider objUnderTest = - new CamundaProcessDataServiceProviderImpl(camundaRestUrlProvider, httpRestServiceProvider); - - final Optional<ProcessInstanceIdDetail> actualResponse = objUnderTest.getProcessInstanceIdDetail(ID); - assertFalse(actualResponse.isPresent()); - - } - - @Test - public void test_GetProcessDefinition_EmptyResponse() { - final Optional<ProcessDefinition> response = Optional.<ProcessDefinition>absent(); - final String url = CAMUNDA_REST_API_URL + DEFAULT + "/process-definition/" + ID + "/xml"; - when(httpRestServiceProvider.get(url, ProcessDefinition.class)).thenReturn(response); - final CamundaProcessDataServiceProvider objUnderTest = - new CamundaProcessDataServiceProviderImpl(camundaRestUrlProvider, httpRestServiceProvider); - - final Optional<ProcessDefinitionDetail> actualResponse = objUnderTest.getProcessDefinition(ID); - assertFalse(actualResponse.isPresent()); - } - - @Test - public void test_GetProcessDefinition_NonEmptyResponse() { - final Optional<ProcessDefinition> response = getProcessDefinition(); - final String url = CAMUNDA_REST_API_URL + DEFAULT + "/process-definition/" + PROCESS_ID + "/xml"; - when(httpRestServiceProvider.get(url, ProcessDefinition.class)).thenReturn(response); - final CamundaProcessDataServiceProvider objUnderTest = - new CamundaProcessDataServiceProviderImpl(camundaRestUrlProvider, httpRestServiceProvider); - - final Optional<ProcessDefinitionDetail> actualResponse = objUnderTest.getProcessDefinition(PROCESS_ID); - assertTrue(actualResponse.isPresent()); - assertEquals(PROCESS_ID, actualResponse.get().getProcessDefinitionId()); - assertEquals(FLOW_XML, actualResponse.get().getProcessDefinitionXml()); - } - - @Test - public void test_GetActivityInstance_EmptyResponse() { - final Optional<ActivityInstance[]> response = Optional.<ActivityInstance[]>absent(); - final String url = CAMUNDA_REST_API_URL + DEFAULT + "/history/activity-instance?processInstanceId=" + PROCESS_ID - + "&sortBy=startTime&sortOrder=asc"; - when(httpRestServiceProvider.get(url, ActivityInstance[].class)).thenReturn(response); - final CamundaProcessDataServiceProvider objUnderTest = - new CamundaProcessDataServiceProviderImpl(camundaRestUrlProvider, httpRestServiceProvider); - - final List<ActivityInstanceDetail> actualResponse = objUnderTest.getActivityInstance(PROCESS_ID); - assertTrue(actualResponse.isEmpty()); - - } - - @Test - public void test_GetActivityInstance_NonEmptyResponse() { - final Optional<ActivityInstance[]> response = getActivityInstance(); - final String url = CAMUNDA_REST_API_URL + DEFAULT + "/history/activity-instance?processInstanceId=" + PROCESS_ID - + "&sortBy=startTime&sortOrder=asc"; - when(httpRestServiceProvider.get(url, ActivityInstance[].class)).thenReturn(response); - final CamundaProcessDataServiceProvider objUnderTest = - new CamundaProcessDataServiceProviderImpl(camundaRestUrlProvider, httpRestServiceProvider); - - final List<ActivityInstanceDetail> actualResponse = objUnderTest.getActivityInstance(PROCESS_ID); - assertFalse(actualResponse.isEmpty()); - final ActivityInstanceDetail actualActivityInstanceDetail = actualResponse.get(0); - assertEquals(ID, actualActivityInstanceDetail.getActivityId()); - assertEquals(NAME, actualActivityInstanceDetail.getActivityName()); - assertEquals(NAME, actualActivityInstanceDetail.getActivityType()); - - } - - @Test - public void test_GetProcessInstanceVariable_EmptyResponse() { - final Optional<ProcessInstanceVariable[]> response = Optional.<ProcessInstanceVariable[]>absent(); - final String url = - CAMUNDA_REST_API_URL + DEFAULT + "/history/variable-instance?processInstanceId=" + PROCESS_ID; - when(httpRestServiceProvider.get(url, ProcessInstanceVariable[].class)).thenReturn(response); - final CamundaProcessDataServiceProvider objUnderTest = - new CamundaProcessDataServiceProviderImpl(camundaRestUrlProvider, httpRestServiceProvider); - - final List<ProcessInstanceVariableDetail> actualResponse = objUnderTest.getProcessInstanceVariable(PROCESS_ID); - assertTrue(actualResponse.isEmpty()); - - } - - @Test - public void test_GetProcessInstanceVariable_NonEmptyResponse() { - final Optional<ProcessInstanceVariable[]> response = getProcessInstanceVariable(); - final String url = - CAMUNDA_REST_API_URL + DEFAULT + "/history/variable-instance?processInstanceId=" + PROCESS_ID; - when(httpRestServiceProvider.get(url, ProcessInstanceVariable[].class)).thenReturn(response); - final CamundaProcessDataServiceProvider objUnderTest = - new CamundaProcessDataServiceProviderImpl(camundaRestUrlProvider, httpRestServiceProvider); - - final List<ProcessInstanceVariableDetail> actualResponse = objUnderTest.getProcessInstanceVariable(PROCESS_ID); - assertFalse(actualResponse.isEmpty()); - final ProcessInstanceVariableDetail variableDetail = actualResponse.get(0); - assertEquals(NAME, variableDetail.getName()); - assertEquals(NAME, variableDetail.getType()); - assertEquals(NAME, variableDetail.getValue()); - - } - - private Optional<ProcessInstanceVariable[]> getProcessInstanceVariable() { - final ProcessInstanceVariable instanceVariable = new ProcessInstanceVariable(); - instanceVariable.setName(NAME); - instanceVariable.setType(NAME); - instanceVariable.setValue(NAME); - return Optional.of(new ProcessInstanceVariable[] {instanceVariable}); - } - - private Optional<ActivityInstance[]> getActivityInstance() { - final ActivityInstance activityInstance = new ActivityInstance(); - activityInstance.setActivityId(ID); - activityInstance.setActivityName(NAME); - activityInstance.setActivityType(NAME); - activityInstance.setDurationInMillis(DURATION); - return Optional.of(new ActivityInstance[] {activityInstance}); - } - - private Optional<ProcessDefinition> getProcessDefinition() { - final ProcessDefinition processDefinition = new ProcessDefinition(); - processDefinition.setId(PROCESS_ID); - processDefinition.setBpmn20Xml(FLOW_XML); - return Optional.of(processDefinition); - } - - private ProcessInstance[] getProcessInstance() { - return getProcessInstance(null); - } - - private ProcessInstance[] getProcessInstance(final String superProcessInstanceId) { - final ProcessInstance instance = new ProcessInstance(); - instance.setId(PROCESS_ID); - instance.setProcessDefinitionId(DEF_ID); - instance.setProcessDefinitionName(NAME); - instance.setSuperProcessInstanceId(superProcessInstanceId); - return new ProcessInstance[] {instance}; - } - - -} diff --git a/so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/monitoring/utils/ObjectEqualsUtilsTest.java b/so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/monitoring/utils/ObjectEqualsUtilsTest.java deleted file mode 100644 index b4dd27129d..0000000000 --- a/so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/monitoring/utils/ObjectEqualsUtilsTest.java +++ /dev/null @@ -1,69 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2018 Ericsson. 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. - * - * SPDX-License-Identifier: Apache-2.0 - * ============LICENSE_END========================================================= - */ -package org.onap.so.monitoring.utils; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import java.util.Arrays; -import java.util.List; -import org.junit.Test; - - -/** - * @author waqas.ikram@ericsson.com - * - */ -public class ObjectEqualsUtilsTest { - - private static final String VALUE = "Humpty Dumpty Sat On The Wall"; - - @Test - public void test_ObjectEqualsUtils_isEqual_NullValues() { - assertTrue(ObjectEqualsUtils.isEqual(null, null)); - } - - @Test - public void test_ObjectEqualsUtils_isEqual_FirstValueNullSecondNotNull() { - assertFalse(ObjectEqualsUtils.isEqual(null, VALUE)); - } - - @Test - public void test_ObjectEqualsUtils_isEqual_FirstValueNotNullSecondNull() { - assertFalse(ObjectEqualsUtils.isEqual(VALUE, null)); - } - - @Test - public void test_ObjectEqualsUtils_isEqual_NotNullValues() { - assertTrue(ObjectEqualsUtils.isEqual(VALUE, VALUE)); - } - - @Test - public void test_ObjectEqualsUtils_isEqual_CollectionValues() { - final List<Object> firstObject = Arrays.asList(VALUE); - final List<Object> secondObject = Arrays.asList(VALUE); - assertTrue(ObjectEqualsUtils.isEqual(firstObject, secondObject)); - } - - @Test - public void test_ObjectEqualsUtils_isEqual_CollectionAndStringValues() { - final List<Object> firstObject = Arrays.asList(VALUE); - assertFalse(ObjectEqualsUtils.isEqual(firstObject, VALUE)); - } -} |