Code Review
/
controller.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Remove yang-test
[controller.git]
/
opendaylight
/
config
/
config-manager
/
src
/
test
/
java
/
org
/
opendaylight
/
controller
/
config
/
manager
/
impl
/
dependencyresolver
/
DependencyResolverManagerTest.java
diff --git
a/opendaylight/config/config-manager/src/test/java/org/opendaylight/controller/config/manager/impl/dependencyresolver/DependencyResolverManagerTest.java
b/opendaylight/config/config-manager/src/test/java/org/opendaylight/controller/config/manager/impl/dependencyresolver/DependencyResolverManagerTest.java
index 48d7de0e82f200f0dae9a4480d5b317b8e0fe47b..0f099e77b0eb32b29f1d8c79414ab3c17b8cfa2c 100644
(file)
--- a/
opendaylight/config/config-manager/src/test/java/org/opendaylight/controller/config/manager/impl/dependencyresolver/DependencyResolverManagerTest.java
+++ b/
opendaylight/config/config-manager/src/test/java/org/opendaylight/controller/config/manager/impl/dependencyresolver/DependencyResolverManagerTest.java
@@
-1,5
+1,5
@@
/*
/*
- * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
+ * Copyright (c) 2013
, 2017
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,
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
@@
-34,10
+34,8
@@
public class DependencyResolverManagerTest extends AbstractLockedPlatformMBeanSe
final ModuleIdentifier apspName = new ModuleIdentifier("apsp", "apsp"); // depends
// on:
final ModuleIdentifier apspName = new ModuleIdentifier("apsp", "apsp"); // depends
// on:
- final ModuleIdentifier threadPoolName = new ModuleIdentifier("threadpool",
- "threadpool"); // depends on:
- final ModuleIdentifier threadFactoryName = new ModuleIdentifier(
- "threadfactory", "threadfactory");
+ final ModuleIdentifier threadPoolName = new ModuleIdentifier("threadpool", "threadpool"); // depends on:
+ final ModuleIdentifier threadFactoryName = new ModuleIdentifier("threadfactory", "threadfactory");
private DependencyResolverManager tested;
TransactionStatus transactionStatus;
private DependencyResolverManager tested;
TransactionStatus transactionStatus;
@@
-54,10
+52,9
@@
public class DependencyResolverManagerTest extends AbstractLockedPlatformMBeanSe
@Test
public void testOrdering() {
@Test
public void testOrdering() {
- DependencyResolverImpl apspDRI = tested.getOrCreate(apspName);
+
final
DependencyResolverImpl apspDRI = tested.getOrCreate(apspName);
mockGetInstance(tested, apspName);
mockGetInstance(tested, apspName);
- DependencyResolverImpl threadPoolDRI = tested
- .getOrCreate(threadPoolName);
+ final DependencyResolverImpl threadPoolDRI = tested.getOrCreate(threadPoolName);
mockGetInstance(tested, threadPoolName);
tested.getOrCreate(threadFactoryName);
mockGetInstance(tested, threadFactoryName);
mockGetInstance(tested, threadPoolName);
tested.getOrCreate(threadFactoryName);
mockGetInstance(tested, threadFactoryName);
@@
-69,47
+66,41
@@
public class DependencyResolverManagerTest extends AbstractLockedPlatformMBeanSe
// switch to second phase committed
reset(transactionStatus);
// switch to second phase committed
reset(transactionStatus);
+ doNothing().when(transactionStatus).checkCommitStarted();
doNothing().when(transactionStatus).checkCommitted();
doNothing().when(transactionStatus).checkCommitted();
- List<ModuleIdentifier> sortedModuleIdentifiers = tested
- .getSortedModuleIdentifiers();
- assertEquals(
- Arrays.asList(threadFactoryName, threadPoolName, apspName),
- sortedModuleIdentifiers);
+ doNothing().when(transactionStatus).checkNotCommitted();
+ List<ModuleIdentifier> sortedModuleIdentifiers = tested.getSortedModuleIdentifiers();
+ assertEquals(Arrays.asList(threadFactoryName, threadPoolName, apspName), sortedModuleIdentifiers);
}
/**
* Simulate dependentResolver resolving its dependency identified by
* dependentName.
*/
}
/**
* Simulate dependentResolver resolving its dependency identified by
* dependentName.
*/
- private
void declareDependency(
DependencyResolverImpl dependerResolver,
- ModuleIdentifier dependentName) {
+ private
static void declareDependency(final
DependencyResolverImpl dependerResolver,
+
final
ModuleIdentifier dependentName) {
JmxAttribute dummyAttribute = new JmxAttribute("dummy");
JmxAttribute dummyAttribute = new JmxAttribute("dummy");
- dependerResolver.resolveInstance(Object.class,
- ObjectNameUtil.createReadOnlyModuleON(dependentName),
+ dependerResolver.resolveInstance(Object.class, ObjectNameUtil.createReadOnlyModuleON(dependentName),
dummyAttribute);
}
dummyAttribute);
}
- private static void mockGetInstance(DependencyResolverManager tested,
- ModuleIdentifier moduleIdentifier) {
+ private static void mockGetInstance(
final
DependencyResolverManager tested,
+
final
ModuleIdentifier moduleIdentifier) {
ModuleFactory moduleFactory = mock(ModuleFactory.class);
ModuleInternalInfo maybeOldInternalInfo = null;
TransactionModuleJMXRegistration transactionModuleJMXRegistration = null;
boolean isDefaultBean = false;
ModuleFactory moduleFactory = mock(ModuleFactory.class);
ModuleInternalInfo maybeOldInternalInfo = null;
TransactionModuleJMXRegistration transactionModuleJMXRegistration = null;
boolean isDefaultBean = false;
- tested.put(moduleIdentifier,
- mockedModule(),
- moduleFactory,
- maybeOldInternalInfo,
- transactionModuleJMXRegistration,
- isDefaultBean, mock(BundleContext.class));
+ tested.put(moduleIdentifier, mockedModule(), moduleFactory, maybeOldInternalInfo,
+ transactionModuleJMXRegistration, isDefaultBean, mock(BundleContext.class));
}
private static Module mockedModule() {
Module mockedModule = mock(Module.class);
doReturn(mock(AutoCloseable.class)).when(mockedModule).getInstance();
}
private static Module mockedModule() {
Module mockedModule = mock(Module.class);
doReturn(mock(AutoCloseable.class)).when(mockedModule).getInstance();
+ doReturn(new ModuleIdentifier("fact", "instance")).when(mockedModule).getIdentifier();
return mockedModule;
}
return mockedModule;
}
-
}
}