diff options
Diffstat (limited to 'feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/FeatureTest.java')
-rw-r--r-- | feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/FeatureTest.java | 77 |
1 files changed, 38 insertions, 39 deletions
diff --git a/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/FeatureTest.java b/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/FeatureTest.java index d51e61e6..c35e525a 100644 --- a/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/FeatureTest.java +++ b/feature-pooling-dmaap/src/test/java/org/onap/policy/drools/pooling/FeatureTest.java @@ -7,9 +7,9 @@ * 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. @@ -76,7 +76,7 @@ import org.slf4j.LoggerFactory; * <dt>PolicyEngine, PolicyController, DroolsController</dt> * <dd>mocked</dd> * </dl> - * + * * <p>Invoke {@link #runSlow()}, before the test, to slow things down. */ public class FeatureTest { @@ -178,7 +178,7 @@ public class FeatureTest { private String makeMessage(int reqnum) { return "{\"reqid\":\"req" + reqnum + "\", \"data\":\"hello " + reqnum + "\"}"; } - + /** * Invoke this to slow the timers down. */ @@ -196,7 +196,7 @@ public class FeatureTest { /** * Decodes an event. - * + * * @param event event * @return the decoded event, or {@code null} if it cannot be decoded */ @@ -253,7 +253,7 @@ public class FeatureTest { /** * Constructor. - * + * * @param nEvents number of events to be processed */ public Context(int events) { @@ -270,7 +270,7 @@ public class FeatureTest { /** * Creates and adds a new host to the context. - * + * * @return the new Host */ public Host addHost() { @@ -308,7 +308,7 @@ public class FeatureTest { /** * Sets {@link #currentHost} to the specified host, and then invokes the given * function. Resets {@link #currentHost} to {@code null} before returning. - * + * * @param host host * @param func function to invoke */ @@ -320,7 +320,7 @@ public class FeatureTest { /** * Offers an event to the external topic. - * + * * @param event event */ public void offerExternal(String event) { @@ -329,7 +329,7 @@ public class FeatureTest { /** * Adds an internal channel to the set of channels. - * + * * @param channel channel * @param queue the channel's queue */ @@ -339,7 +339,7 @@ public class FeatureTest { /** * Offers a message to all internal channels. - * + * * @param message message */ public void offerInternal(String message) { @@ -348,7 +348,7 @@ public class FeatureTest { /** * Offers amessage to an internal channel. - * + * * @param channel channel * @param message message */ @@ -361,7 +361,7 @@ public class FeatureTest { /** * Associates a controller with its drools controller. - * + * * @param controller controller * @param droolsController drools controller */ @@ -371,7 +371,7 @@ public class FeatureTest { /** * Get controller. - * + * * @param droolsController drools controller * @return the controller associated with a drools controller, or {@code null} if * it has no associated controller @@ -382,7 +382,7 @@ public class FeatureTest { /** * Constructor. - * + * * @return queue for the external topic */ public BlockingQueue<String> getExternalTopic() { @@ -391,7 +391,7 @@ public class FeatureTest { /** * Get decode errors. - * + * * @return the number of decode errors so far */ public int getDecodeErrors() { @@ -407,7 +407,7 @@ public class FeatureTest { /** * Get remaining events. - * + * * @return the number of events that haven't been processed */ public long getRemainingEvents() { @@ -423,7 +423,7 @@ public class FeatureTest { /** * Waits, for a period of time, for all events to be processed. - * + * * @param time time * @param units units * @return {@code true} if all events have been processed, {@code false} otherwise @@ -436,7 +436,7 @@ public class FeatureTest { /** * Gets the current host, provided this is used from within a call to * {@link #withHost(Host, VoidFunction)}. - * + * * @return the current host, or {@code null} if there is no current host */ public Host getCurrentHost() { @@ -475,7 +475,7 @@ public class FeatureTest { /** * Constructor. - * + * * @param context context */ public Host(Context context) { @@ -496,13 +496,13 @@ public class FeatureTest { // arrange to read from the external topic externalSource = new TopicSourceImpl(context, false); - + feature = new PoolingFeatureImpl(context); } /** * Get name. - * + * * @return the host name */ public String getName() { @@ -543,7 +543,7 @@ public class FeatureTest { /** * Offers an event to the feature, before the policy controller handles it. - * + * * @param protocol protocol * @param topic2 topic * @param event event @@ -555,7 +555,7 @@ public class FeatureTest { /** * Offers an event to the feature, after the policy controller handles it. - * + * * @param protocol protocol * @param topic topic * @param event event @@ -569,7 +569,7 @@ public class FeatureTest { /** * Offers an event to the feature, before the drools controller handles it. - * + * * @param fact fact * @return {@code true} if the event was handled, {@code false} otherwise */ @@ -579,7 +579,7 @@ public class FeatureTest { /** * Offers an event to the feature, after the drools controller handles it. - * + * * @param fact fact * @param successInsert {@code true} if it was successfully inserted by the drools * controller, {@code false} otherwise @@ -598,7 +598,7 @@ public class FeatureTest { /** * Message seen. - * + * * @return {@code true} if a message was seen for this host, {@code false} * otherwise */ @@ -608,7 +608,7 @@ public class FeatureTest { /** * Get internal queue. - * + * * @return the queue associated with this host's internal topic */ public BlockingQueue<String> getInternalQueue() { @@ -681,7 +681,7 @@ public class FeatureTest { /** * Constructor. - * + * * @param context context */ public TopicSinkImpl(Context context) { @@ -738,7 +738,7 @@ public class FeatureTest { /** * Constructor. - * + * * @param context context * @param internal {@code true} if to read from the internal topic, {@code false} * to read from the external topic @@ -784,8 +784,7 @@ public class FeatureTest { try { do { processMessages(newPair.first(), listener); - } - while (!newPair.first().await(stdInterPollMs, TimeUnit.MILLISECONDS)); + } while (!newPair.first().await(stdInterPollMs, TimeUnit.MILLISECONDS)); logger.info("topic source thread completed"); @@ -816,7 +815,7 @@ public class FeatureTest { /** * Registers a new "pair" with this source, stopping the consumer associated with * any previous registration. - * + * * @param newPair the new "pair", or {@code null} to unregister */ private void reregister(Pair<CountDownLatch, CountDownLatch> newPair) { @@ -855,7 +854,7 @@ public class FeatureTest { /** * Polls for messages from the topic and offers them to the listener. - * + * * @param stopped triggered if processing should stop * @param listener listener * @throws InterruptedException throws interrupted exception @@ -967,7 +966,7 @@ public class FeatureTest { /** * Constructor. - * + * * @param context context */ public PoolingFeatureImpl(Context context) { @@ -1010,7 +1009,7 @@ public class FeatureTest { /** * Embeds a specializer within a property name, after the prefix. - * + * * @param propnm property name into which it should be embedded * @param spec specializer to be embedded * @return the property name, with the specializer embedded within it @@ -1025,7 +1024,7 @@ public class FeatureTest { CountDownLatch activeLatch) { currentContext.set(context); - + return new PoolingManagerTest(host, controller, props, activeLatch); } } @@ -1037,7 +1036,7 @@ public class FeatureTest { /** * Constructor. - * + * * @param host the host * @param controller the controller * @param props the properties @@ -1072,7 +1071,7 @@ public class FeatureTest { /** * Constructor. - * + * * @param context this manager's context * @param topic the topic * @throws PoolingFeatureException if an error occurs |