Code Review
/
controller.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Bug-1520 Config subsystem:config-impl tests
[controller.git]
/
opendaylight
/
config
/
config-manager
/
src
/
test
/
java
/
org
/
opendaylight
/
controller
/
config
/
manager
/
testingservices
/
threadpool
/
test
/
SimpleConfigurationTest.java
diff --git
a/opendaylight/config/config-manager/src/test/java/org/opendaylight/controller/config/manager/testingservices/threadpool/test/SimpleConfigurationTest.java
b/opendaylight/config/config-manager/src/test/java/org/opendaylight/controller/config/manager/testingservices/threadpool/test/SimpleConfigurationTest.java
index 28408abed2fb564c05688302cc0d3b20be0465a9..4ba3dc89399d11f157fdc833b5a72277e8e33ea1 100644
(file)
--- a/
opendaylight/config/config-manager/src/test/java/org/opendaylight/controller/config/manager/testingservices/threadpool/test/SimpleConfigurationTest.java
+++ b/
opendaylight/config/config-manager/src/test/java/org/opendaylight/controller/config/manager/testingservices/threadpool/test/SimpleConfigurationTest.java
@@
-56,7
+56,7
@@
import static org.junit.Assert.fail;
* dependencies.
*/
public class SimpleConfigurationTest extends AbstractConfigTest {
* dependencies.
*/
public class SimpleConfigurationTest extends AbstractConfigTest {
- private final int numberOfThreads = 5;
+ private
static
final int numberOfThreads = 5;
private final int numberOfThreads2 = 10;
private static final String fixed1 = "fixed1";
private static final List<ObjectName> emptyONs = Collections
private final int numberOfThreads2 = 10;
private static final String fixed1 = "fixed1";
private static final List<ObjectName> emptyONs = Collections
@@
-68,7
+68,7
@@
public class SimpleConfigurationTest extends AbstractConfigTest {
@Before
public void setUp() {
@Before
public void setUp() {
- super.initConfigTransactionManagerImpl(new HardcodedModuleFactoriesResolver(
+ super.initConfigTransactionManagerImpl(new HardcodedModuleFactoriesResolver(
mockedContext,
new TestingFixedThreadPoolModuleFactory()));
}
new TestingFixedThreadPoolModuleFactory()));
}
@@
-96,7
+96,7
@@
public class SimpleConfigurationTest extends AbstractConfigTest {
return fixed1names;
}
return fixed1names;
}
-
private
ObjectName createFixedThreadPool(
+
static
ObjectName createFixedThreadPool(
ConfigTransactionJMXClient transaction)
throws InstanceAlreadyExistsException, InstanceNotFoundException {
transaction.assertVersion(0, 1);
ConfigTransactionJMXClient transaction)
throws InstanceAlreadyExistsException, InstanceNotFoundException {
transaction.assertVersion(0, 1);
@@
-246,8
+246,7
@@
public class SimpleConfigurationTest extends AbstractConfigTest {
// 4, check
assertEquals(2, configRegistryClient.getVersion());
// 4, check
assertEquals(2, configRegistryClient.getVersion());
- assertEquals(1, TestingFixedThreadPool.allExecutors.size());
- assertTrue(TestingFixedThreadPool.allExecutors.get(0).isShutdown());
+ assertEquals(0, TestingFixedThreadPool.allExecutors.size());
// dynamic config should be removed from platform
try {
// dynamic config should be removed from platform
try {
@@
-278,7
+277,7
@@
public class SimpleConfigurationTest extends AbstractConfigTest {
// commit
transaction.commit();
// check that first threadpool is closed
// commit
transaction.commit();
// check that first threadpool is closed
- checkThreadPools(
2
, numberOfThreads2);
+ checkThreadPools(
1
, numberOfThreads2);
}
private void checkThreadPools(int expectedTotalNumberOfExecutors,
}
private void checkThreadPools(int expectedTotalNumberOfExecutors,
@@
-308,7
+307,7
@@
public class SimpleConfigurationTest extends AbstractConfigTest {
// commit
CommitStatus commitStatus = transaction.commit();
// check that new threadpool is created and old one is closed
// commit
CommitStatus commitStatus = transaction.commit();
// check that new threadpool is created and old one is closed
- checkThreadPools(
2
, numberOfThreads);
+ checkThreadPools(
1
, numberOfThreads);
CommitStatus expected = new CommitStatus(emptyONs, emptyONs, fixed1List);
assertEquals(expected, commitStatus);
}
CommitStatus expected = new CommitStatus(emptyONs, emptyONs, fixed1List);
assertEquals(expected, commitStatus);
}
@@
-326,26
+325,19
@@
public class SimpleConfigurationTest extends AbstractConfigTest {
}
@Test
}
@Test
- public void testAbort() throws
InstanceAlreadyExistsException, Validation
Exception {
+ public void testAbort() throws Exception {
ConfigTransactionJMXClient transaction = configRegistryClient
.createTransaction();
assertEquals(1, configRegistryClient.getOpenConfigs().size());
transaction.abortConfig();
ConfigTransactionJMXClient transaction = configRegistryClient
.createTransaction();
assertEquals(1, configRegistryClient.getOpenConfigs().size());
transaction.abortConfig();
+ assertEquals(0, configRegistryClient.getOpenConfigs().size());
try {
try {
- transaction.createModule(TestingFixedThreadPoolModuleFactory.NAME,
- fixed1);
- fail();
- } catch (IllegalStateException e) {
- assertEquals("Configuration was aborted", e.getMessage());
- }
- try {
- transaction.validateConfig();
+ platformMBeanServer.getMBeanInfo(transaction.getObjectName());
fail();
fail();
- }
catch (IllegalStateException e)
{
- assertEquals("
Configuration was aborted
", e.getMessage());
+ }
catch(InstanceNotFoundException e)
{
+ assertEquals("
org.opendaylight.controller:TransactionName=ConfigTransaction-0-1,type=ConfigTransaction
", e.getMessage());
}
}
- assertEquals(0, configRegistryClient.getOpenConfigs().size());
}
@Test
}
@Test
@@
-388,7
+380,8
@@
public class SimpleConfigurationTest extends AbstractConfigTest {
@Test
public void testQNames() {
Set<String> availableModuleFactoryQNames = configRegistryClient.getAvailableModuleFactoryQNames();
@Test
public void testQNames() {
Set<String> availableModuleFactoryQNames = configRegistryClient.getAvailableModuleFactoryQNames();
- String expected = "(namespace?revision=revision)name";
+ String expected = "(namespace?revision=2012-12-12)name";
+
assertEquals(Sets.newHashSet(expected), availableModuleFactoryQNames);
}
assertEquals(Sets.newHashSet(expected), availableModuleFactoryQNames);
}