summaryrefslogtreecommitdiffstats
path: root/bpmn/so-bpmn-infrastructure-common/src/main/java
diff options
context:
space:
mode:
authoreeginux <henry.xie@est.tech>2019-04-11 15:08:48 +0000
committereeginux <henry.xie@est.tech>2019-04-11 15:08:48 +0000
commite6df32457f49f26d08dcb2b7575b0e38438da777 (patch)
treee7f2ba9304defffc50b471ffa20fa83a4dfe68aa /bpmn/so-bpmn-infrastructure-common/src/main/java
parentcc243a6656540f9c2c1c204cec3797429c41fb41 (diff)
Revert the change to avoid break PNF PnP
Revert PnfEventReadyDmaapClient PnfEventReadyDmaapClientTest Update the IT CreateVcpeResCustServiceSimplifiedTest Bug SO-1779 raise to fix the issue with Configure Issue-ID: SO-1506 Change-Id: I8f0e474405db7f0c23266208cee89df12ac6c0a2 Signed-off-by: eeginux <henry.xie@est.tech>
Diffstat (limited to 'bpmn/so-bpmn-infrastructure-common/src/main/java')
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/PnfNotificationEvent.java42
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClient.java18
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java15
3 files changed, 10 insertions, 65 deletions
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/PnfNotificationEvent.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/PnfNotificationEvent.java
deleted file mode 100644
index 267ddbf6a7..0000000000
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/PnfNotificationEvent.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2019 Nordix Foundation.
- * ================================================================================
- * 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.bpmn.infrastructure.pnf;
-
-import org.springframework.context.ApplicationEvent;
-
-public class PnfNotificationEvent extends ApplicationEvent {
-
- private String pnfCorrelationId;
-
- /**
- * Create a new ApplicationEvent.
- *
- * @param source the object on which the event initially occurred (never {@code null})
- */
- public PnfNotificationEvent(Object source, String pnfCorrelationId) {
- super(source);
- this.pnfCorrelationId = pnfCorrelationId;
- }
-
- public String getPnfCorrelationId() {
- return pnfCorrelationId;
- }
-}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClient.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClient.java
index e2dc375cd1..94ceddae97 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClient.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClient.java
@@ -23,40 +23,30 @@ package org.onap.so.bpmn.infrastructure.pnf.delegate;
import org.camunda.bpm.engine.RuntimeService;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.engine.delegate.JavaDelegate;
-import org.onap.so.bpmn.infrastructure.pnf.PnfNotificationEvent;
+import org.camunda.bpm.engine.runtime.Execution;
import org.onap.so.bpmn.infrastructure.pnf.dmaap.DmaapClient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component;
@Component
-public class InformDmaapClient implements JavaDelegate, ApplicationListener<PnfNotificationEvent> {
+public class InformDmaapClient implements JavaDelegate {
private Logger logger = LoggerFactory.getLogger(getClass());
private DmaapClient dmaapClient;
- private DelegateExecution execution;
@Override
public void execute(DelegateExecution execution) {
String pnfCorrelationId = (String) execution.getVariable(ExecutionVariableNames.PNF_CORRELATION_ID);
RuntimeService runtimeService = execution.getProcessEngineServices().getRuntimeService();
+ String processBusinessKey = execution.getProcessBusinessKey();
dmaapClient.registerForUpdate(pnfCorrelationId, () -> runtimeService.createMessageCorrelation("WorkflowMessage")
- .processInstanceBusinessKey(execution.getProcessBusinessKey()).correlateWithResult());
- this.execution = execution;
+ .processInstanceBusinessKey(processBusinessKey).correlateWithResult());
}
@Autowired
public void setDmaapClient(DmaapClient dmaapClient) {
this.dmaapClient = dmaapClient;
}
-
- @Override
- public void onApplicationEvent(PnfNotificationEvent event) {
- logger.info("Received application event for pnfCorrelationId: {}", event.getPnfCorrelationId());
- RuntimeService runtimeService = execution.getProcessEngineServices().getRuntimeService();
- runtimeService.createMessageCorrelation("WorkflowMessage")
- .processInstanceBusinessKey(execution.getProcessBusinessKey()).correlateWithResult();
- }
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java
index 2869111485..96562fe90f 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java
@@ -35,11 +35,9 @@ import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.util.EntityUtils;
-import org.onap.so.bpmn.infrastructure.pnf.PnfNotificationEvent;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.ApplicationEventPublisher;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
@@ -55,11 +53,8 @@ public class PnfEventReadyDmaapClient implements DmaapClient {
private volatile ScheduledThreadPoolExecutor executor;
private volatile boolean dmaapThreadListenerIsRunning;
- private ApplicationEventPublisher applicationEventPublisher;
-
@Autowired
- public PnfEventReadyDmaapClient(Environment env, ApplicationEventPublisher applicationEventPublisher) {
- this.applicationEventPublisher = applicationEventPublisher;
+ public PnfEventReadyDmaapClient(Environment env) {
httpClient = HttpClientBuilder.create().build();
pnfCorrelationIdToThreadMap = new ConcurrentHashMap<>();
topicListenerDelayInSeconds = env.getProperty("pnf.dmaap.topicListenerDelayInSeconds", Integer.class);
@@ -135,9 +130,11 @@ public class PnfEventReadyDmaapClient implements DmaapClient {
}
private void informAboutPnfReadyIfPnfCorrelationIdFound(String pnfCorrelationId) {
- unregister(pnfCorrelationId);
- PnfNotificationEvent pnfNotificationEvent = new PnfNotificationEvent(this, pnfCorrelationId);
- applicationEventPublisher.publishEvent(pnfNotificationEvent);
+ Runnable runnable = unregister(pnfCorrelationId);
+ if (runnable != null) {
+ logger.debug("dmaap listener gets pnf ready event for pnfCorrelationId: {}", pnfCorrelationId);
+ runnable.run();
+ }
}
}
}