X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fconfig%2Fyang-store-impl%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fconfig%2Fyang%2Fstore%2Fimpl%2FExtenderYangTrackerCustomizerTest.java;h=8a7b95ff3ec47c6cbe2c9f7c2199932fee682624;hb=9070e358923aca6229137d46f9cae7ff458204dd;hp=c4c523992f271391b33f6220b9f49fc28a4fc4ca;hpb=90e562e3dcc64e46a657ef4ab3047b2b709339c7;p=controller.git diff --git a/opendaylight/config/yang-store-impl/src/test/java/org/opendaylight/controller/config/yang/store/impl/ExtenderYangTrackerCustomizerTest.java b/opendaylight/config/yang-store-impl/src/test/java/org/opendaylight/controller/config/yang/store/impl/ExtenderYangTrackerCustomizerTest.java index c4c523992f..8a7b95ff3e 100644 --- a/opendaylight/config/yang-store-impl/src/test/java/org/opendaylight/controller/config/yang/store/impl/ExtenderYangTrackerCustomizerTest.java +++ b/opendaylight/config/yang-store-impl/src/test/java/org/opendaylight/controller/config/yang/store/impl/ExtenderYangTrackerCustomizerTest.java @@ -9,12 +9,14 @@ package org.opendaylight.controller.config.yang.store.impl; import com.google.common.base.Optional; import com.google.common.collect.Lists; +import com.google.common.collect.Maps; import org.junit.Before; import org.junit.Test; import org.mockito.Mock; import org.mockito.MockitoAnnotations; import org.opendaylight.controller.config.yang.store.api.YangStoreException; import org.opendaylight.controller.config.yang.store.api.YangStoreSnapshot; +import org.opendaylight.yangtools.yang.model.api.Module; import org.osgi.framework.Bundle; import org.osgi.framework.BundleContext; import org.osgi.framework.BundleListener; @@ -25,9 +27,9 @@ import java.net.URL; import java.util.Collections; import java.util.Enumeration; import java.util.List; +import java.util.Map; import java.util.regex.Pattern; -import static org.junit.Assert.assertEquals; import static org.mockito.Matchers.any; import static org.mockito.Matchers.anyCollectionOf; import static org.mockito.Mockito.doNothing; @@ -48,8 +50,28 @@ public class ExtenderYangTrackerCustomizerTest { @Mock private BundleContext bundleContext; + private Map> moduleMap = Maps.newHashMap(); + @Before public void setUp() throws YangStoreException { + + moduleMap.put("1", new Map.Entry() { + @Override + public Module getKey() { + return mock(Module.class); + } + + @Override + public String getValue() { + return "v"; + } + + @Override + public String setValue(String value) { + return "v"; + } + }); + MockitoAnnotations.initMocks(this); doNothing().when(bundleContext).addBundleListener(any(BundleListener.class)); doReturn(new Bundle[0]).when(bundleContext).getBundles(); @@ -59,7 +81,9 @@ public class ExtenderYangTrackerCustomizerTest { doReturn(22).when(yangStoreSnapshot).countModuleMXBeanEntries(); doReturn("mock yang store").when(yangStoreSnapshot).toString(); doNothing().when(yangStoreSnapshot).close(); - doReturn(Collections.emptyMap()).when(yangStoreSnapshot).getModuleMap(); + doReturn(Collections.emptyMap()).when(yangStoreSnapshot).getModuleMXBeanEntryMap(); + doReturn(Collections.emptyMap()).when(yangStoreSnapshot).getModulesToSources(); + doReturn(Collections.emptyMap()).when(yangStoreSnapshot).getQNamesToIdentitiesToModuleMXBeanEntries(); } @Test @@ -75,7 +99,6 @@ public class ExtenderYangTrackerCustomizerTest { returnedStore = tested.getYangStoreSnapshot(); - assertEquals(yangStoreSnapshot, returnedStore); tested.removedBundle(bundle, null, null); tested.getYangStoreSnapshot(); @@ -87,7 +110,7 @@ public class ExtenderYangTrackerCustomizerTest { tested.getYangStoreSnapshot(); } - verify(parser, times(7)).parseYangFiles(anyCollectionOf(InputStream.class)); + verify(parser, times(5)).parseYangFiles(anyCollectionOf(InputStream.class)); returnedStore = tested.getYangStoreSnapshot();