X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fconfig%2Fyang-store-impl%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fconfig%2Fyang%2Fstore%2Fimpl%2FExtenderYangTrackerCustomizerTest.java;fp=opendaylight%2Fconfig%2Fyang-store-impl%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fconfig%2Fyang%2Fstore%2Fimpl%2FExtenderYangTrackerTest.java;h=f04dcc4abf7d2d6d50d05d992aff6ba05f81c25b;hp=e40d7348a06119d1b62b4082f82a38f1358a63b3;hb=f6c67b9b23b31b59bc2ca351365b890377db90fa;hpb=85f16942a4a1ccdf1bc10213cdedfa09f7d325b8 diff --git a/opendaylight/config/yang-store-impl/src/test/java/org/opendaylight/controller/config/yang/store/impl/ExtenderYangTrackerTest.java b/opendaylight/config/yang-store-impl/src/test/java/org/opendaylight/controller/config/yang/store/impl/ExtenderYangTrackerCustomizerTest.java similarity index 87% rename from opendaylight/config/yang-store-impl/src/test/java/org/opendaylight/controller/config/yang/store/impl/ExtenderYangTrackerTest.java rename to opendaylight/config/yang-store-impl/src/test/java/org/opendaylight/controller/config/yang/store/impl/ExtenderYangTrackerCustomizerTest.java index e40d7348a0..f04dcc4abf 100644 --- a/opendaylight/config/yang-store-impl/src/test/java/org/opendaylight/controller/config/yang/store/impl/ExtenderYangTrackerTest.java +++ b/opendaylight/config/yang-store-impl/src/test/java/org/opendaylight/controller/config/yang/store/impl/ExtenderYangTrackerCustomizerTest.java @@ -9,11 +9,7 @@ package org.opendaylight.controller.config.yang.store.impl; import static org.junit.Assert.assertEquals; import static org.mockito.Matchers.anyCollectionOf; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyNoMoreInteractions; +import static org.mockito.Mockito.*; import java.io.InputStream; import java.net.MalformedURLException; @@ -32,11 +28,10 @@ import org.osgi.framework.BundleContext; import com.google.common.collect.Lists; -public class ExtenderYangTrackerTest { +public class ExtenderYangTrackerCustomizerTest { - @Mock - private BundleContext context; - private ExtenderYangTracker tested; + + private ExtenderYangTrackerCustomizer tested; @Mock private MbeParser parser; @Mock @@ -45,12 +40,13 @@ public class ExtenderYangTrackerTest { @Before public void setUp() throws YangStoreException { MockitoAnnotations.initMocks(this); - doReturn("context").when(context).toString(); - tested = new ExtenderYangTracker(context, parser); + + tested = new ExtenderYangTrackerCustomizer(parser); doReturn(yangStoreSnapshot).when(parser).parseYangFiles( anyCollectionOf(InputStream.class)); doReturn(22).when(yangStoreSnapshot).countModuleMXBeanEntries(); doReturn("mock yang store").when(yangStoreSnapshot).toString(); + doNothing().when(yangStoreSnapshot).close(); } @Test @@ -74,9 +70,11 @@ public class ExtenderYangTrackerTest { bundle = getMockedBundle(10, false); tested.addingBundle(bundle, null); - tested.getYangStoreSnapshot(); + for(int i = 0; i< 10; i++){ + tested.getYangStoreSnapshot(); + } - verify(parser, times(3)).parseYangFiles( + verify(parser, times(5)).parseYangFiles( anyCollectionOf(InputStream.class)); returnedStore = tested.getYangStoreSnapshot(); @@ -90,6 +88,7 @@ public class ExtenderYangTrackerTest { private Bundle getMockedBundle(int sizeOfUrls, boolean system) throws MalformedURLException { Bundle mock = mock(Bundle.class); + doReturn(32).when(mock).getState();//mock just for logging List urls = Lists.newArrayList(); for (int i = 0; i < sizeOfUrls; i++) {