2 * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
9 package org.opendaylight.controller.remote.rpc;
12 import akka.actor.ActorSystem;
13 import junit.framework.Assert;
14 import org.junit.After;
15 import org.junit.Test;
16 import org.osgi.framework.Bundle;
17 import org.osgi.framework.BundleContext;
19 import static org.junit.Assert.fail;
20 import static org.mockito.Mockito.mock;
21 import static org.mockito.Mockito.when;
23 public class ActorSystemFactoryTest {
24 ActorSystem system = null;
27 public void testActorSystemCreation(){
28 BundleContext context = mock(BundleContext.class);
29 when(context.getBundle()).thenReturn(mock(Bundle.class));
30 ActorSystemFactory.createInstance(context);
31 system = ActorSystemFactory.getInstance();
32 Assert.assertNotNull(system);
33 // Check illegal state exception
36 ActorSystemFactory.createInstance(context);
37 fail("Illegal State exception should be thrown, while creating actor system second time");
38 } catch (IllegalStateException e) {
43 public void cleanup() throws InterruptedException {