* ONAP PAP
* ================================================================================
* Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2022 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
private TopicListener topicListener = (infra, topic, text) -> toPdps.add(text);
+ private String topicPolicyPdpPap = "pdp-pap-topic";
/**
* Constructs the object.
*/
public End2EndContext() {
- toPapTopic = TopicEndpointManager.getManager().getNoopTopicSource(PapConstants.TOPIC_POLICY_PDP_PAP);
+ toPapTopic = TopicEndpointManager.getManager().getNoopTopicSource(topicPolicyPdpPap);
- TopicEndpointManager.getManager().getNoopTopicSink(PapConstants.TOPIC_POLICY_PDP_PAP).register(topicListener);
+ TopicEndpointManager.getManager().getNoopTopicSink(topicPolicyPdpPap).register(topicListener);
dispatcher = new MessageTypeDispatcher("messageName");
dispatcher.register(PdpMessageType.PDP_UPDATE.name(), new UpdateListener());
toPap.clear();
pdps.forEach(pdp -> toPap.add(DONE));
- TopicEndpointManager.getManager().getNoopTopicSink(PapConstants.TOPIC_POLICY_PDP_PAP).unregister(topicListener);
+ TopicEndpointManager.getManager().getNoopTopicSink(topicPolicyPdpPap).unregister(topicListener);
}
/**
break;
}
- dispatcher.onTopicEvent(CommInfrastructure.NOOP, PapConstants.TOPIC_POLICY_PDP_PAP, text);
+ dispatcher.onTopicEvent(CommInfrastructure.NOOP, topicPolicyPdpPap, text);
}
}
}
* {@link End2EndContext#DONE} message <i>for each PDP</i>.
*/
private class ToPapThread extends Thread {
- /**
- * Number of DONE messages that have been received.
- */
- private long ndone;
@Override
public void run() {
// pretend we received DONE from PDPs that are already finished
- ndone = pdps.stream().filter(pdp -> pdp.finished).count();
+ long ndone = pdps.stream().filter(pdp -> pdp.finished).count();
while (ndone < pdps.size()) {
String text;
*
* @param reply reply to be added to the list
* @return this PDP
- * @throws CoderException if the reply cannot be encoded
*/
- public PseudoPdp addReply(PdpStatus reply) throws CoderException {
+ public PseudoPdp addReply(PdpStatus reply) {
replies.add(reply);
finished = false;
return this;