X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fconfig%2Fconfig-manager%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fconfig%2Fmanager%2Fimpl%2Fosgi%2FExtensibleBundleTrackerTest.java;fp=opendaylight%2Fconfig%2Fconfig-manager%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fconfig%2Fmanager%2Fimpl%2Fosgi%2FExtensibleBundleTrackerTest.java;h=0000000000000000000000000000000000000000;hp=ed128799a2bbb2953c506a788abd3140228f9c06;hb=ac6f2699cd0c1e340cc32e8f0d0ca94c8e9c0cc0;hpb=f43b01b81319959b1907e3e04537f5169e7f33d8 diff --git a/opendaylight/config/config-manager/src/test/java/org/opendaylight/controller/config/manager/impl/osgi/ExtensibleBundleTrackerTest.java b/opendaylight/config/config-manager/src/test/java/org/opendaylight/controller/config/manager/impl/osgi/ExtensibleBundleTrackerTest.java deleted file mode 100644 index ed128799a2..0000000000 --- a/opendaylight/config/config-manager/src/test/java/org/opendaylight/controller/config/manager/impl/osgi/ExtensibleBundleTrackerTest.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2014, 2015 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.config.manager.impl.osgi; - -import static org.junit.Assert.assertEquals; -import static org.mockito.Mockito.doNothing; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.verifyZeroInteractions; - -import com.google.common.util.concurrent.Futures; -import org.junit.Before; -import org.junit.Test; -import org.mockito.InOrder; -import org.mockito.Mock; -import org.mockito.Mockito; -import org.mockito.MockitoAnnotations; -import org.osgi.framework.Bundle; -import org.osgi.framework.BundleContext; -import org.osgi.framework.BundleEvent; -import org.osgi.util.tracker.BundleTrackerCustomizer; - -public class ExtensibleBundleTrackerTest { - - @Mock - private BundleContext bundleContext; - @Mock - private Bundle bundle; - @Mock - private BundleEvent bundleEvent; - - @Mock - private BundleTrackerCustomizer primaryTracker; - @Mock - private BundleTrackerCustomizer additionalTracker; - - private ExtensibleBundleTracker extensibleBundleTracker; - private Object primaryValue = new Object(); - - @Before - public void setUp() throws Exception { - MockitoAnnotations.initMocks(this); - doReturn("bundle").when(bundle).toString(); - doReturn("bundleEvent").when(bundleEvent).toString(); - - doReturn(primaryValue).when(primaryTracker).addingBundle(bundle, bundleEvent); - doNothing().when(primaryTracker).modifiedBundle(bundle, bundleEvent, primaryValue); - doNothing().when(primaryTracker).removedBundle(bundle, bundleEvent, primaryValue); - - doReturn(new Object()).when(additionalTracker).addingBundle(bundle, bundleEvent); - doNothing().when(additionalTracker).modifiedBundle(bundle, bundleEvent, null); - doNothing().when(additionalTracker).removedBundle(bundle, bundleEvent, null); - extensibleBundleTracker = new ExtensibleBundleTracker<>(bundleContext, primaryTracker, additionalTracker); - } - - @Test - public void testAddingBundle() throws Exception { - assertEquals(primaryValue, extensibleBundleTracker.addingBundle(bundle, bundleEvent).get()); - InOrder inOrder = Mockito.inOrder(primaryTracker, additionalTracker); - inOrder.verify(primaryTracker).addingBundle(bundle, bundleEvent); - inOrder.verify(additionalTracker).addingBundle(bundle, bundleEvent); - } - - @Test - public void testRemovedBundle() throws Exception { - extensibleBundleTracker.removedBundle(bundle, bundleEvent, Futures.immediateFuture(primaryValue)); - InOrder inOrder = Mockito.inOrder(primaryTracker, additionalTracker); - inOrder.verify(primaryTracker).removedBundle(bundle, bundleEvent, primaryValue); - inOrder.verify(additionalTracker).removedBundle(bundle, bundleEvent, null); - } - - @Test - public void testRemovedBundleWithEx() throws Exception { - IllegalStateException throwable = new IllegalStateException(); - extensibleBundleTracker.removedBundle(bundle, bundleEvent, Futures.immediateFailedFuture(throwable)); - verifyZeroInteractions(primaryTracker); - verifyZeroInteractions(additionalTracker); - } -}