Code Review
/
controller.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Implement consistency barrier in yang-store-impl.
[controller.git]
/
opendaylight
/
config
/
yang-store-impl
/
src
/
test
/
java
/
org
/
opendaylight
/
controller
/
config
/
yang
/
store
/
impl
/
ExtenderYangTrackerCustomizerTest.java
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 e40d7348a06119d1b62b4082f82a38f1358a63b3..f04dcc4abf7d2d6d50d05d992aff6ba05f81c25b 100644
(file)
--- 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.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;
import java.io.InputStream;
import java.net.MalformedURLException;
@@
-32,11
+28,10
@@
import org.osgi.framework.BundleContext;
import com.google.common.collect.Lists;
import com.google.common.collect.Lists;
-public class ExtenderYangTrackerTest {
+public class ExtenderYangTracker
Customizer
Test {
- @Mock
- private BundleContext context;
- private ExtenderYangTracker tested;
+
+ private ExtenderYangTrackerCustomizer tested;
@Mock
private MbeParser parser;
@Mock
@Mock
private MbeParser parser;
@Mock
@@
-45,12
+40,13
@@
public class ExtenderYangTrackerTest {
@Before
public void setUp() throws YangStoreException {
MockitoAnnotations.initMocks(this);
@Before
public void setUp() throws YangStoreException {
MockitoAnnotations.initMocks(this);
- doReturn("context").when(context).toString();
- tested = new ExtenderYangTracker
(context,
parser);
+
+ tested = new ExtenderYangTracker
Customizer(
parser);
doReturn(yangStoreSnapshot).when(parser).parseYangFiles(
anyCollectionOf(InputStream.class));
doReturn(22).when(yangStoreSnapshot).countModuleMXBeanEntries();
doReturn("mock yang store").when(yangStoreSnapshot).toString();
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
}
@Test
@@
-74,9
+70,11
@@
public class ExtenderYangTrackerTest {
bundle = getMockedBundle(10, false);
tested.addingBundle(bundle, null);
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();
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);
private Bundle getMockedBundle(int sizeOfUrls, boolean system)
throws MalformedURLException {
Bundle mock = mock(Bundle.class);
+ doReturn(32).when(mock).getState();//mock just for logging
List<URL> urls = Lists.newArrayList();
for (int i = 0; i < sizeOfUrls; i++) {
List<URL> urls = Lists.newArrayList();
for (int i = 0; i < sizeOfUrls; i++) {