diff options
4 files changed, 75 insertions, 60 deletions
diff --git a/appc-adapters/appc-dmaap-adapter/appc-message-adapter-factory/src/main/java/org/onap/appc/adapter/factory/DmaapMessageAdapterFactoryImpl.java b/appc-adapters/appc-dmaap-adapter/appc-message-adapter-factory/src/main/java/org/onap/appc/adapter/factory/DmaapMessageAdapterFactoryImpl.java index ab016374a..6e6891dee 100644 --- a/appc-adapters/appc-dmaap-adapter/appc-message-adapter-factory/src/main/java/org/onap/appc/adapter/factory/DmaapMessageAdapterFactoryImpl.java +++ b/appc-adapters/appc-dmaap-adapter/appc-message-adapter-factory/src/main/java/org/onap/appc/adapter/factory/DmaapMessageAdapterFactoryImpl.java @@ -1,57 +1,57 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP : APPC - * ================================================================================ - * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Copyright (C) 2017 Amdocs - * ============================================================================= - * 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.appc.adapter.factory; - -import java.util.Collection; -import java.util.Set; - -import org.onap.appc.adapter.message.Consumer; -import org.onap.appc.adapter.message.MessageAdapterFactory; -import org.onap.appc.adapter.message.Producer; -import org.onap.appc.adapter.messaging.dmaap.http.HttpDmaapConsumerImpl; -import org.onap.appc.adapter.messaging.dmaap.http.HttpDmaapProducerImpl; - -public class DmaapMessageAdapterFactoryImpl implements MessageAdapterFactory { - - - @Override - public Producer createProducer(Collection<String> pools, String writeTopic, String apiKey, String apiSecret) { - return new HttpDmaapProducerImpl(pools, writeTopic); - } - - @Override - public Producer createProducer(Collection<String> pools, Set<String> writeTopics, String apiKey, String apiSecret) { - String topic = ""; - for(String s : writeTopics){ - topic = s; - } - return new HttpDmaapProducerImpl(pools,topic); - } - - @Override - public Consumer createConsumer(Collection<String> pool, String readTopic, - String clientName, String clientId, String filterJson, String apiKey, String apiSecret) { - return new HttpDmaapConsumerImpl(pool, readTopic, clientName, clientId, apiKey, apiSecret, filterJson); - } -} +/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APPC
+ * ================================================================================
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Copyright (C) 2017 Amdocs
+ * =============================================================================
+ * 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.appc.adapter.factory;
+
+import java.util.Collection;
+import java.util.Set;
+
+import org.onap.appc.adapter.message.Consumer;
+import org.onap.appc.adapter.message.MessageAdapterFactory;
+import org.onap.appc.adapter.message.Producer;
+import org.onap.appc.adapter.messaging.dmaap.http.HttpDmaapConsumerImpl;
+import org.onap.appc.adapter.messaging.dmaap.http.HttpDmaapProducerImpl;
+
+public class DmaapMessageAdapterFactoryImpl implements MessageAdapterFactory {
+
+
+ @Override
+ public Producer createProducer(Collection<String> pools, String writeTopic, String apiKey, String apiSecret) {
+ return new HttpDmaapProducerImpl(pools, writeTopic);
+ }
+
+ @Override
+ public Producer createProducer(Collection<String> pools, Set<String> writeTopics, String apiKey, String apiSecret) {
+ String topic = "";
+ for(String s : writeTopics){
+ topic = s;
+ }
+ return new HttpDmaapProducerImpl(pools,topic);
+ }
+
+ @Override
+ public Consumer createConsumer(Collection<String> pool, String readTopic,
+ String clientName, String clientId, String filterJson, String apiKey, String apiSecret) {
+ return new HttpDmaapConsumerImpl(pool, readTopic, clientName, clientId, apiKey, apiSecret, filterJson);
+ }
+}
diff --git a/appc-dispatcher/appc-request-handler/appc-request-handler-core/src/main/java/org/onap/appc/messageadapter/impl/MessageAdapterImpl.java b/appc-dispatcher/appc-request-handler/appc-request-handler-core/src/main/java/org/onap/appc/messageadapter/impl/MessageAdapterImpl.java index f60bb5bc9..d7422415e 100644 --- a/appc-dispatcher/appc-request-handler/appc-request-handler-core/src/main/java/org/onap/appc/messageadapter/impl/MessageAdapterImpl.java +++ b/appc-dispatcher/appc-request-handler/appc-request-handler-core/src/main/java/org/onap/appc/messageadapter/impl/MessageAdapterImpl.java @@ -114,14 +114,17 @@ public class MessageAdapterImpl implements MessageAdapter{ if (logger.isTraceEnabled()) { logger.trace("Entering to post with AsyncResponse = " + ObjectUtils.toString(asyncResponse)); } - + logger.debug("Entered MessageAdapterImpl.post()"); String jsonMessage; try { + logger.debug("Before converting Async Response"); jsonMessage = Converter.convAsyncResponseToDmaapOutgoingMessageJsonString(operation, rpcName, asyncResponse); if (logger.isDebugEnabled()) { logger.debug("DMaaP Response = " + jsonMessage); } + logger.debug("Before Invoking producer.post(): jsonMessage is::" + jsonMessage); success = producer.post(this.partition, jsonMessage); + logger.debug("After Invoking producer.post()"); } catch (JsonProcessingException e1) { logger.error("Error generating Json from DMaaP message "+ e1.getMessage()); success= false; @@ -129,6 +132,7 @@ public class MessageAdapterImpl implements MessageAdapter{ logger.error("Error sending message to DMaaP "+e.getMessage()); success= false; } + logger.debug("Exiting MesageAdapterImpl.post()"); if (logger.isTraceEnabled()) { logger.trace("Exiting from post with (success = "+ ObjectUtils.toString(success)+")"); } diff --git a/appc-dispatcher/appc-request-handler/appc-request-handler-core/src/main/java/org/onap/appc/requesthandler/conv/Converter.java b/appc-dispatcher/appc-request-handler/appc-request-handler-core/src/main/java/org/onap/appc/requesthandler/conv/Converter.java index 1071b7605..b01d36bc4 100644 --- a/appc-dispatcher/appc-request-handler/appc-request-handler-core/src/main/java/org/onap/appc/requesthandler/conv/Converter.java +++ b/appc-dispatcher/appc-request-handler/appc-request-handler-core/src/main/java/org/onap/appc/requesthandler/conv/Converter.java @@ -48,6 +48,7 @@ import org.opendaylight.yangtools.concepts.Builder; import org.opendaylight.yangtools.yang.binding.DataContainer; import org.onap.appc.domainmodel.lcm.ResponseContext; import org.onap.appc.domainmodel.lcm.VNFOperation; +import org.onap.appc.requesthandler.impl.AbstractRequestHandlerImpl; import org.onap.appc.requesthandler.impl.DmaapOutgoingMessage; import java.text.ParseException; @@ -60,6 +61,7 @@ public class Converter { private static final String ISO_FORMAT = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"; private final static String DMaaP_ROOT_VALUE = "output"; private static final SimpleDateFormat isoFormatter = new SimpleDateFormat(ISO_FORMAT); + private final static EELFLogger logger = EELFManager.getInstance().getLogger(Converter.class); static { isoFormatter.setTimeZone(TimeZone.getTimeZone("UTC")); } @@ -72,10 +74,12 @@ public class Converter { if(vnfOperation == null){ throw new IllegalArgumentException("empty asyncResponse.action"); } + logger.debug("Entered Converter.convAsyncResponseToBuilder()"); Action action = Action.valueOf(vnfOperation.name()); CommonHeader commonHeader = convAsyncResponseTorev160108CommonHeader(response); Status status = convAsyncResponseTorev160108Status(response); Payload payload = convAsyncResponseTorev160108Payload(response); + logger.debug("Extracted action, status, payload "); switch (action){ case Rollback: outObj = new RollbackOutputBuilder(); @@ -103,6 +107,7 @@ public class Converter { ((HealthCheckOutputBuilder)outObj).setCommonHeader(commonHeader); ((HealthCheckOutputBuilder)outObj).setStatus(status); ((HealthCheckOutputBuilder)outObj).setPayload(payload); + logger.debug("In HealthCheck case- created outObj, returning"); return outObj; case LiveUpgrade: outObj = new LiveUpgradeOutputBuilder(); @@ -407,7 +412,8 @@ public class Converter { } public static String convAsyncResponseToDmaapOutgoingMessageJsonString(VNFOperation vnfOperation, String rpcName, ResponseContext asyncResponse) throws JsonProcessingException { - DmaapOutgoingMessage dmaapOutgoingMessage = convAsyncResponseToDmaapOutgoingMessage(vnfOperation, rpcName, asyncResponse); + logger.debug("Entered Converter.convAsyncResponseToDmaapOutgoingMessageJsonString()"); + DmaapOutgoingMessage dmaapOutgoingMessage = convAsyncResponseToDmaapOutgoingMessage(vnfOperation, rpcName, asyncResponse); ObjectMapper objectMapper = new ObjectMapper(); objectMapper.addMixInAnnotations(dmaapOutgoingMessage.getBody().getOutput().getClass(), MixInFlagsMessage.class); objectMapper.addMixInAnnotations(CommonHeader.class, MixInCommonHeader.class); @@ -418,11 +424,13 @@ public class Converter { // .configure(SerializationConfig.Feature.SORT_PROPERTIES_ALPHABETICALLY,true) ObjectWriter writer = objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL).configure(MapperFeature.SORT_PROPERTIES_ALPHABETICALLY,true).writer(); + logger.debug("Exiting Converter.convAsyncResponseToDmaapOutgoingMessageJsonString()"); return writer.writeValueAsString(dmaapOutgoingMessage); } public static DmaapOutgoingMessage convAsyncResponseToDmaapOutgoingMessage(VNFOperation vnfOperation, String rpcName, ResponseContext asyncResponse) throws JsonProcessingException { - DmaapOutgoingMessage outObj = new DmaapOutgoingMessage(); + logger.debug("Entered Converter.convAsyncResponseToDmaapOutgoingMessage()"); + DmaapOutgoingMessage outObj = new DmaapOutgoingMessage(); String correlationID = getCorrelationID(asyncResponse); outObj.setCorrelationID(correlationID); outObj.setType("response"); @@ -431,6 +439,7 @@ public class Converter { Object messageBody = builder.build(); DmaapOutgoingMessage.Body body = new DmaapOutgoingMessage.Body(messageBody); outObj.setBody(body); + logger.debug("Exiting Converter.convAsyncResponseToDmaapOutgoingMessage():messageBody is :::"+body.toString()); return outObj; } diff --git a/appc-dispatcher/appc-request-handler/appc-request-handler-core/src/main/java/org/onap/appc/requesthandler/impl/AbstractRequestHandlerImpl.java b/appc-dispatcher/appc-request-handler/appc-request-handler-core/src/main/java/org/onap/appc/requesthandler/impl/AbstractRequestHandlerImpl.java index cd9011f4b..73c98e939 100644 --- a/appc-dispatcher/appc-request-handler/appc-request-handler-core/src/main/java/org/onap/appc/requesthandler/impl/AbstractRequestHandlerImpl.java +++ b/appc-dispatcher/appc-request-handler/appc-request-handler-core/src/main/java/org/onap/appc/requesthandler/impl/AbstractRequestHandlerImpl.java @@ -395,7 +395,9 @@ public abstract class AbstractRequestHandlerImpl implements RequestHandler { logger.trace("Entering to postMessageToDMaaP with AsyncResponse = " + ObjectUtils.toString(responseContext)); } + logger.debug("In postMessageToDMaap before invoking post()"); boolean callbackResponse = messageAdapter.post(operation, rpcName, responseContext); + logger.debug("In postMessageToDMaap after invoking post()"); if (!callbackResponse) { logger.error("DMaaP posting status: false", "dmaapMessage: " + responseContext); } |