Metrics and Configuration
[controller.git] / opendaylight / md-sal / sal-clustering-commons / src / test / java / org / opendaylight / controller / common / actor / MeteredBoundedMailboxTest.java
diff --git a/opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/common/actor/MeteredBoundedMailboxTest.java b/opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/common/actor/MeteredBoundedMailboxTest.java
deleted file mode 100644 (file)
index 0f96c10..0000000
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * 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 org.opendaylight.controller.common.actor;
-
-import akka.actor.ActorRef;
-import akka.actor.ActorSystem;
-import akka.actor.DeadLetter;
-import akka.actor.Props;
-import akka.actor.UntypedActor;
-import akka.japi.Creator;
-import akka.testkit.JavaTestKit;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import scala.concurrent.duration.FiniteDuration;
-
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.locks.ReentrantLock;
-
-public class MeteredBoundedMailboxTest {
-
-    private static ActorSystem actorSystem;
-    private final ReentrantLock lock = new ReentrantLock();
-
-    @Before
-    public void setUp() throws Exception {
-        actorSystem = ActorSystem.create("testsystem");
-    }
-
-    @After
-    public void tearDown() throws Exception {
-       if (actorSystem != null)
-           actorSystem.shutdown();
-    }
-
-    @Test
-    public void test_WhenQueueIsFull_ShouldSendMsgToDeadLetter() throws InterruptedException {
-        final JavaTestKit mockReceiver = new JavaTestKit(actorSystem);
-        actorSystem.eventStream().subscribe(mockReceiver.getRef(), DeadLetter.class);
-
-
-        final FiniteDuration TWENTY_SEC = new FiniteDuration(20, TimeUnit.SECONDS);
-
-        String boundedMailBox = actorSystem.name() + ".bounded-mailbox";
-        ActorRef pingPongActor = actorSystem.actorOf(PingPongActor.props(lock).withMailbox(boundedMailBox),
-                                                     "pingpongactor");
-
-        actorSystem.mailboxes().settings();
-        lock.lock();
-        //queue capacity = 10
-        //need to send 12 messages; 1 message is dequeued and actor waits on lock,
-        //2nd to 11th messages are put on the queue
-        //12th message is sent to dead letter.
-        for (int i=0;i<12;i++){
-            pingPongActor.tell("ping", mockReceiver.getRef());
-        }
-
-        mockReceiver.expectMsgClass(TWENTY_SEC, DeadLetter.class);
-
-        lock.unlock();
-
-        Object[] eleven = mockReceiver.receiveN(11, TWENTY_SEC);
-    }
-
-    /**
-     * For testing
-     */
-    public static class PingPongActor extends UntypedActor{
-
-        ReentrantLock lock;
-
-        private PingPongActor(ReentrantLock lock){
-            this.lock = lock;
-        }
-
-        public static Props props(final ReentrantLock lock){
-            return Props.create(new Creator<PingPongActor>(){
-                @Override
-                public PingPongActor create() throws Exception {
-                    return new PingPongActor(lock);
-                }
-            });
-        }
-
-        @Override
-        public void onReceive(Object message) throws Exception {
-            lock.lock();
-            try {
-                if ("ping".equals(message))
-                    getSender().tell("pong", getSelf());
-            } finally {
-                lock.unlock();
-            }
-        }
-    }
-}
\ No newline at end of file