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 "Avoid IllegalArgument on missing source"
[controller.git]
/
opendaylight
/
md-sal
/
sal-distributed-datastore
/
src
/
test
/
java
/
org
/
opendaylight
/
controller
/
cluster
/
datastore
/
AbstractShardTest.java
diff --git
a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/AbstractShardTest.java
b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/AbstractShardTest.java
index 3ac61f237131575e54f9c9f9b157d9b32e586771..34f0164504fe666e7cfb76090c57ed5b2362a268 100644
(file)
--- a/
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/AbstractShardTest.java
+++ b/
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/AbstractShardTest.java
@@
-16,6
+16,7
@@
import static org.mockito.Mockito.mock;
import akka.actor.ActorRef;
import akka.actor.PoisonPill;
import akka.actor.Props;
import akka.actor.ActorRef;
import akka.actor.PoisonPill;
import akka.actor.Props;
+import akka.dispatch.Dispatchers;
import akka.japi.Creator;
import akka.testkit.TestActorRef;
import com.google.common.base.Function;
import akka.japi.Creator;
import akka.testkit.TestActorRef;
import com.google.common.base.Function;
@@
-30,6
+31,7
@@
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import org.junit.After;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import org.junit.After;
+import org.junit.Assert;
import org.junit.Before;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
import org.junit.Before;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
@@
-86,7
+88,7
@@
public abstract class AbstractShardTest extends AbstractActorTest{
}
protected Props newShardProps() {
}
protected Props newShardProps() {
- return Shard.props(shardID, Collections.<S
hardIdentifier
,String>emptyMap(),
+ return Shard.props(shardID, Collections.<S
tring
,String>emptyMap(),
newDatastoreContext(), SCHEMA_CONTEXT);
}
newDatastoreContext(), SCHEMA_CONTEXT);
}
@@
-101,7
+103,7
@@
public abstract class AbstractShardTest extends AbstractActorTest{
Creator<Shard> creator = new Creator<Shard>() {
@Override
public Shard create() throws Exception {
Creator<Shard> creator = new Creator<Shard>() {
@Override
public Shard create() throws Exception {
- return new Shard(shardID, Collections.<S
hardIdentifier
,String>emptyMap(),
+ return new Shard(shardID, Collections.<S
tring
,String>emptyMap(),
newDatastoreContext(), SCHEMA_CONTEXT) {
@Override
protected void onRecoveryComplete() {
newDatastoreContext(), SCHEMA_CONTEXT) {
@Override
protected void onRecoveryComplete() {
@@
-116,7
+118,7
@@
public abstract class AbstractShardTest extends AbstractActorTest{
};
TestActorRef<Shard> shard = TestActorRef.create(getSystem(),
};
TestActorRef<Shard> shard = TestActorRef.create(getSystem(),
- Props.create(new DelegatingShardCreator(creator)), "testRecovery");
+ Props.create(new DelegatingShardCreator(creator))
.withDispatcher(Dispatchers.DefaultDispatcherId())
, "testRecovery");
assertEquals("Recovery complete", true, recoveryComplete.await(5, TimeUnit.SECONDS));
assertEquals("Recovery complete", true, recoveryComplete.await(5, TimeUnit.SECONDS));
@@
-153,16
+155,17
@@
public abstract class AbstractShardTest extends AbstractActorTest{
shard.tell(PoisonPill.getInstance(), ActorRef.noSender());
}
shard.tell(PoisonPill.getInstance(), ActorRef.noSender());
}
- protected void verifyLastLogIndex(TestActorRef<Shard> shard, long expectedValue) {
+ protected void verifyLastApplied(TestActorRef<Shard> shard, long expectedValue) {
+ long lastApplied = -1;
for(int i = 0; i < 20 * 5; i++) {
for(int i = 0; i < 20 * 5; i++) {
- l
ong lastLogIndex = shard.underlyingActor().getShardMBean().getLastLogIndex
();
- if(last
LogIndex
== expectedValue) {
-
break
;
+ l
astApplied = shard.underlyingActor().getShardMBean().getLastApplied
();
+ if(last
Applied
== expectedValue) {
+
return
;
}
Uninterruptibles.sleepUninterruptibly(50, TimeUnit.MILLISECONDS);
}
}
Uninterruptibles.sleepUninterruptibly(50, TimeUnit.MILLISECONDS);
}
-
assertEquals("Last log index", expectedValue, shard.underlyingActor().getShardMBean().getLastLogIndex(
));
+
Assert.fail(String.format("Expected last applied: %d, Actual: %d", expectedValue, lastApplied
));
}
protected NormalizedNode<?, ?> readStore(final InMemoryDOMDataStore store) throws ReadFailedException {
}
protected NormalizedNode<?, ?> readStore(final InMemoryDOMDataStore store) throws ReadFailedException {