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 "BUG-1690: catch wildcard InstanceIdentifiers"
[controller.git]
/
opendaylight
/
md-sal
/
sal-distributed-datastore
/
src
/
test
/
java
/
org
/
opendaylight
/
controller
/
cluster
/
datastore
/
jmx
/
mbeans
/
shard
/
ShardStatsTest.java
diff --git
a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/jmx/mbeans/shard/ShardStatsTest.java
b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/jmx/mbeans/shard/ShardStatsTest.java
index c4d0b85fb54546faa5e0667e58e472d549d5836f..e9df3ecd49ed83a5d7021d86487277545bbd5787 100644
(file)
--- a/
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/jmx/mbeans/shard/ShardStatsTest.java
+++ b/
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/jmx/mbeans/shard/ShardStatsTest.java
@@
-11,10
+11,12
@@
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
-import org.opendaylight.controller.
cluster.datastore.jmx.mbeans.AbstractBaseM
Bean;
+import org.opendaylight.controller.
md.sal.common.util.jmx.AbstractMX
Bean;
import javax.management.MBeanServer;
import javax.management.ObjectName;
import javax.management.MBeanServer;
import javax.management.ObjectName;
+
+import java.lang.management.ManagementFactory;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.text.SimpleDateFormat;
import java.util.Date;
@@
-26,11
+28,11
@@
public class ShardStatsTest {
@Before
public void setUp() throws Exception {
@Before
public void setUp() throws Exception {
- shardStats = new ShardStats("shard-1");
+ shardStats = new ShardStats("shard-1"
, "DataStore"
);
shardStats.registerMBean();
shardStats.registerMBean();
- mbeanServer =
shardStats.get
MBeanServer();
+ mbeanServer =
ManagementFactory.getPlatform
MBeanServer();
String objectName =
String objectName =
- Abstract
BaseM
Bean.BASE_JMX_PREFIX + "type=" + shardStats
+ Abstract
MX
Bean.BASE_JMX_PREFIX + "type=" + shardStats
.getMBeanType() + ",Category=" +
shardStats.getMBeanCategory() + ",name=" +
shardStats.getMBeanName();
.getMBeanType() + ",Category=" +
shardStats.getMBeanCategory() + ",name=" +
shardStats.getMBeanName();
@@
-46,7
+48,7
@@
public class ShardStatsTest {
public void testGetShardName() throws Exception {
Object attribute = mbeanServer.getAttribute(testMBeanName, "ShardName");
public void testGetShardName() throws Exception {
Object attribute = mbeanServer.getAttribute(testMBeanName, "ShardName");
- Assert.assertEquals(
(String)
attribute, "shard-1");
+ Assert.assertEquals(attribute, "shard-1");
}
}
@@
-60,7
+62,7
@@
public class ShardStatsTest {
//now let us get from MBeanServer what is the transaction count.
Object attribute = mbeanServer.getAttribute(testMBeanName,
"CommittedTransactionsCount");
//now let us get from MBeanServer what is the transaction count.
Object attribute = mbeanServer.getAttribute(testMBeanName,
"CommittedTransactionsCount");
- Assert.assertEquals(
(Long) attribute, (Long)
3L);
+ Assert.assertEquals(
attribute,
3L);
}
}
@@
-71,13
+73,13
@@
public class ShardStatsTest {
Assert.assertEquals(shardStats.getLastCommittedTransactionTime(),
sdf.format(new Date(0L)));
long millis = System.currentTimeMillis();
Assert.assertEquals(shardStats.getLastCommittedTransactionTime(),
sdf.format(new Date(0L)));
long millis = System.currentTimeMillis();
- shardStats.setLastCommittedTransactionTime(
new Date(millis)
);
+ shardStats.setLastCommittedTransactionTime(
millis
);
//now let us get from MBeanServer what is the transaction count.
Object attribute = mbeanServer.getAttribute(testMBeanName,
"LastCommittedTransactionTime");
//now let us get from MBeanServer what is the transaction count.
Object attribute = mbeanServer.getAttribute(testMBeanName,
"LastCommittedTransactionTime");
- Assert.assertEquals(
(String)
attribute, sdf.format(new Date(millis)));
- Assert.assertNotEquals(
(String)
attribute,
+ Assert.assertEquals(attribute, sdf.format(new Date(millis)));
+ Assert.assertNotEquals(attribute,
sdf.format(new Date(millis - 1)));
}
sdf.format(new Date(millis - 1)));
}
@@
-92,7
+94,7
@@
public class ShardStatsTest {
//now let us get from MBeanServer what is the transaction count.
Object attribute =
mbeanServer.getAttribute(testMBeanName, "FailedTransactionsCount");
//now let us get from MBeanServer what is the transaction count.
Object attribute =
mbeanServer.getAttribute(testMBeanName, "FailedTransactionsCount");
- Assert.assertEquals(
(Long) attribute, (Long)
2L);
+ Assert.assertEquals(
attribute,
2L);
}
@Test
}
@Test
@@
-105,7
+107,7
@@
public class ShardStatsTest {
//now let us get from MBeanServer what is the transaction count.
Object attribute =
mbeanServer.getAttribute(testMBeanName, "AbortTransactionsCount");
//now let us get from MBeanServer what is the transaction count.
Object attribute =
mbeanServer.getAttribute(testMBeanName, "AbortTransactionsCount");
- Assert.assertEquals(
(Long) attribute, (Long)
2L);
+ Assert.assertEquals(
attribute,
2L);
}
@Test
}
@Test
@@
-118,7
+120,7
@@
public class ShardStatsTest {
//now let us get from MBeanServer what is the transaction count.
Object attribute =
mbeanServer.getAttribute(testMBeanName, "FailedReadTransactionsCount");
//now let us get from MBeanServer what is the transaction count.
Object attribute =
mbeanServer.getAttribute(testMBeanName, "FailedReadTransactionsCount");
- Assert.assertEquals(
(Long) attribute, (Long)
2L);
+ Assert.assertEquals(
attribute,
2L);
}
@Test
}
@Test
@@
-132,7
+134,7
@@
public class ShardStatsTest {
//now let us get from MBeanServer what is the transaction count.
Object attribute = mbeanServer.getAttribute(testMBeanName,
"CommittedTransactionsCount");
//now let us get from MBeanServer what is the transaction count.
Object attribute = mbeanServer.getAttribute(testMBeanName,
"CommittedTransactionsCount");
- Assert.assertEquals(
(Long) attribute, (Long)
3L);
+ Assert.assertEquals(
attribute,
3L);
//let us increment FailedReadTransactions count and then check
shardStats.incrementFailedReadTransactionsCount();
//let us increment FailedReadTransactions count and then check
shardStats.incrementFailedReadTransactionsCount();
@@
-142,7
+144,7
@@
public class ShardStatsTest {
//now let us get from MBeanServer what is the transaction count.
attribute =
mbeanServer.getAttribute(testMBeanName, "FailedReadTransactionsCount");
//now let us get from MBeanServer what is the transaction count.
attribute =
mbeanServer.getAttribute(testMBeanName, "FailedReadTransactionsCount");
- Assert.assertEquals(
(Long) attribute, (Long)
2L);
+ Assert.assertEquals(
attribute,
2L);
//here we will reset the counters and check the above ones are 0 after reset
//here we will reset the counters and check the above ones are 0 after reset
@@
-151,11
+153,11
@@
public class ShardStatsTest {
//now let us get from MBeanServer what is the transaction count.
attribute = mbeanServer.getAttribute(testMBeanName,
"CommittedTransactionsCount");
//now let us get from MBeanServer what is the transaction count.
attribute = mbeanServer.getAttribute(testMBeanName,
"CommittedTransactionsCount");
- Assert.assertEquals(
(Long) attribute, (Long)
0L);
+ Assert.assertEquals(
attribute,
0L);
attribute =
mbeanServer.getAttribute(testMBeanName, "FailedReadTransactionsCount");
attribute =
mbeanServer.getAttribute(testMBeanName, "FailedReadTransactionsCount");
- Assert.assertEquals(
(Long) attribute, (Long)
0L);
+ Assert.assertEquals(
attribute,
0L);
}
}