* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-
package ntfbenchmark.impl;
+import com.google.common.util.concurrent.ListenableFuture;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
-import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
-import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
-import org.opendaylight.controller.md.sal.binding.api.NotificationService;
+import org.opendaylight.mdsal.binding.api.NotificationPublishService;
+import org.opendaylight.mdsal.binding.api.NotificationService;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ntfbenchmark.rev150105.NtfbenchmarkService;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ntfbenchmark.rev150105.StartTestInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ntfbenchmark.rev150105.StartTestInput.ProducerType;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ntfbenchmark.rev150105.StartTestOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ntfbenchmark.rev150105.StartTestOutputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ntfbenchmark.rev150105.TestStatusInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ntfbenchmark.rev150105.TestStatusOutput;
import org.opendaylight.yangtools.concepts.ListenerRegistration;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.slf4j.LoggerFactory;
public class NtfbenchmarkProvider implements AutoCloseable, NtfbenchmarkService {
-
private static final Logger LOG = LoggerFactory.getLogger(NtfbenchmarkProvider.class);
+ private static final int TEST_TIMEOUT = 5;
+
private final NotificationService listenService;
private final NotificationPublishService publishService;
- private static final int testTimeout = 5;
public NtfbenchmarkProvider(final NotificationService listenServiceDependency,
final NotificationPublishService publishServiceDependency) {
}
@Override
- public void close() throws Exception {
+ public void close() {
LOG.info("NtfbenchmarkProvider closed");
}
@Override
- public Future<RpcResult<StartTestOutput>> startTest(final StartTestInput input) {
+ public ListenableFuture<RpcResult<StartTestOutput>> startTest(final StartTestInput input) {
final int producerCount = input.getProducers().intValue();
final int listenerCount = input.getListeners().intValue();
final int iterations = input.getIterations().intValue();
}
executor.shutdown();
try {
- executor.awaitTermination(testTimeout, TimeUnit.MINUTES);
+ executor.awaitTermination(TEST_TIMEOUT, TimeUnit.MINUTES);
for (ListenerRegistration<NtfbenchTestListener> listenerRegistration : listeners) {
listenerRegistration.getInstance().getAllDone().get();
}
} catch (final InterruptedException | ExecutionException e) {
- LOG.error("Out of time: test did not finish within the {} min deadline ", testTimeout);
+ LOG.error("Out of time: test did not finish within the {} min deadline ", TEST_TIMEOUT);
}
final long producerEndTime = System.nanoTime();
}
@Override
- public Future<RpcResult<TestStatusOutput>> testStatus() {
+ public ListenableFuture<RpcResult<TestStatusOutput>> testStatus(final TestStatusInput input) {
// TODO Auto-generated method stub
return null;
}