Code Review
/
controller.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Merge changes I8e90a7d5,I25249fe8
[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 441de36db07655558a3f882e7ebbb9ba929e964f..97d1c63ed2770da0ceb4fb504a4795a775b12c89 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
@@
-30,7
+30,6
@@
import javax.management.InstanceNotFoundException;
import javax.management.MBeanException;
import javax.management.ObjectName;
import javax.management.ReflectionException;
import javax.management.MBeanException;
import javax.management.ObjectName;
import javax.management.ReflectionException;
-import javax.management.RuntimeMBeanException;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
@@
-57,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
@@
-69,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()));
}
@@
-97,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);
@@
-135,7
+134,7
@@
public class SimpleConfigurationTest extends AbstractConfigTest {
private void testValidation(ConfigTransactionClient transaction)
throws InstanceAlreadyExistsException, ReflectionException,
private void testValidation(ConfigTransactionClient transaction)
throws InstanceAlreadyExistsException, ReflectionException,
- InstanceNotFoundException, MBeanException {
+ InstanceNotFoundException, MBeanException
, ConflictingVersionException
{
ObjectName fixed1names = transaction.createModule(
TestingFixedThreadPoolModuleFactory.NAME, fixed1);
// call validate on config bean
ObjectName fixed1names = transaction.createModule(
TestingFixedThreadPoolModuleFactory.NAME, fixed1);
// call validate on config bean
@@
-143,8
+142,8
@@
public class SimpleConfigurationTest extends AbstractConfigTest {
platformMBeanServer.invoke(fixed1names, "validate", new Object[0],
new String[0]);
fail();
platformMBeanServer.invoke(fixed1names, "validate", new Object[0],
new String[0]);
fail();
- } catch (
Runtime
MBeanException e) {
-
Runtime
Exception targetException = e.getTargetException();
+ } catch (MBeanException e) {
+ Exception targetException = e.getTargetException();
assertNotNull(targetException);
assertEquals(ValidationException.class, targetException.getClass());
}
assertNotNull(targetException);
assertEquals(ValidationException.class, targetException.getClass());
}
@@
-247,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 {
@@
-279,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,
@@
-309,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);
}
@@
-327,26
+325,19
@@
public class SimpleConfigurationTest extends AbstractConfigTest {
}
@Test
}
@Test
- public void testAbort() {
+ 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 (Exception e) {
- assertTrue(e.getCause() instanceof InstanceNotFoundException);
- }
- try {
- transaction.validateConfig();
+ platformMBeanServer.getMBeanInfo(transaction.getObjectName());
fail();
fail();
- }
catch (Exception e)
{
- assert
True(e.getCause() instanceof InstanceNotFoundException
);
+ }
catch(InstanceNotFoundException e)
{
+ assert
Equals("org.opendaylight.controller:TransactionName=ConfigTransaction-0-1,type=ConfigTransaction", e.getMessage()
);
}
}
- assertEquals(0, configRegistryClient.getOpenConfigs().size());
}
@Test
}
@Test