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 1894: Add LISP configuration options to etc/custom.properties in Karaf"
[controller.git]
/
opendaylight
/
md-sal
/
sal-distributed-datastore
/
src
/
test
/
java
/
org
/
opendaylight
/
controller
/
cluster
/
datastore
/
ShardManagerTest.java
diff --git
a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardManagerTest.java
b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardManagerTest.java
index e9ad450ed86614ff78114ff4bb545e23ab82367f..02201f7cd1672d2c8d02415ae4d65d8b71432f8e 100644
(file)
--- a/
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardManagerTest.java
+++ b/
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardManagerTest.java
@@
-15,8
+15,10
@@
import org.opendaylight.controller.cluster.datastore.messages.LocalShardFound;
import org.opendaylight.controller.cluster.datastore.messages.LocalShardNotFound;
import org.opendaylight.controller.cluster.datastore.messages.PrimaryFound;
import org.opendaylight.controller.cluster.datastore.messages.PrimaryNotFound;
import org.opendaylight.controller.cluster.datastore.messages.LocalShardNotFound;
import org.opendaylight.controller.cluster.datastore.messages.PrimaryFound;
import org.opendaylight.controller.cluster.datastore.messages.PrimaryNotFound;
+import org.opendaylight.controller.cluster.datastore.messages.UpdateSchemaContext;
import org.opendaylight.controller.cluster.datastore.utils.MockClusterWrapper;
import org.opendaylight.controller.cluster.datastore.utils.MockConfiguration;
import org.opendaylight.controller.cluster.datastore.utils.MockClusterWrapper;
import org.opendaylight.controller.cluster.datastore.utils.MockConfiguration;
+import org.opendaylight.controller.md.cluster.datastore.model.TestModel;
import scala.concurrent.duration.Duration;
import static junit.framework.Assert.assertEquals;
import scala.concurrent.duration.Duration;
import static junit.framework.Assert.assertEquals;
@@
-42,11
+44,12
@@
public class ShardManagerTest {
new JavaTestKit(system) {{
final Props props = ShardManager
.props("config", new MockClusterWrapper(),
new JavaTestKit(system) {{
final Props props = ShardManager
.props("config", new MockClusterWrapper(),
- new MockConfiguration());
+ new MockConfiguration()
, new DatastoreContext()
);
final TestActorRef<ShardManager> subject =
TestActorRef.create(system, props);
final TestActorRef<ShardManager> subject =
TestActorRef.create(system, props);
- new Within(duration("1 seconds")) {
+ new Within(duration("10 seconds")) {
+ @Override
protected void run() {
subject.tell(new FindPrimary("inventory").toSerializable(), getRef());
protected void run() {
subject.tell(new FindPrimary("inventory").toSerializable(), getRef());
@@
-66,11
+69,14
@@
public class ShardManagerTest {
new JavaTestKit(system) {{
final Props props = ShardManager
.props("config", new MockClusterWrapper(),
new JavaTestKit(system) {{
final Props props = ShardManager
.props("config", new MockClusterWrapper(),
- new MockConfiguration());
+ new MockConfiguration()
, new DatastoreContext()
);
final TestActorRef<ShardManager> subject =
TestActorRef.create(system, props);
final TestActorRef<ShardManager> subject =
TestActorRef.create(system, props);
- new Within(duration("1 seconds")) {
+ subject.tell(new UpdateSchemaContext(TestModel.createTestContext()), getRef());
+
+ new Within(duration("10 seconds")) {
+ @Override
protected void run() {
subject.tell(new FindPrimary(Shard.DEFAULT_NAME).toSerializable(), getRef());
protected void run() {
subject.tell(new FindPrimary(Shard.DEFAULT_NAME).toSerializable(), getRef());
@@
-89,16
+95,18
@@
public class ShardManagerTest {
new JavaTestKit(system) {{
final Props props = ShardManager
.props("config", new MockClusterWrapper(),
new JavaTestKit(system) {{
final Props props = ShardManager
.props("config", new MockClusterWrapper(),
- new MockConfiguration());
+ new MockConfiguration()
, new DatastoreContext()
);
final TestActorRef<ShardManager> subject =
TestActorRef.create(system, props);
final TestActorRef<ShardManager> subject =
TestActorRef.create(system, props);
- new Within(duration("1 seconds")) {
+ new Within(duration("10 seconds")) {
+ @Override
protected void run() {
subject.tell(new FindLocalShard("inventory"), getRef());
protected void run() {
subject.tell(new FindLocalShard("inventory"), getRef());
- final String out = new ExpectMsg<String>(duration("1 seconds"), "find local") {
+ final String out = new ExpectMsg<String>(duration("10 seconds"), "find local") {
+ @Override
protected String match(Object in) {
if (in instanceof LocalShardNotFound) {
return ((LocalShardNotFound) in).getShardName();
protected String match(Object in) {
if (in instanceof LocalShardNotFound) {
return ((LocalShardNotFound) in).getShardName();
@@
-124,16
+132,20
@@
public class ShardManagerTest {
new JavaTestKit(system) {{
final Props props = ShardManager
.props("config", mockClusterWrapper,
new JavaTestKit(system) {{
final Props props = ShardManager
.props("config", mockClusterWrapper,
- new MockConfiguration());
+ new MockConfiguration()
, new DatastoreContext()
);
final TestActorRef<ShardManager> subject =
TestActorRef.create(system, props);
final TestActorRef<ShardManager> subject =
TestActorRef.create(system, props);
- new Within(duration("1 seconds")) {
+ subject.tell(new UpdateSchemaContext(TestModel.createTestContext()), getRef());
+
+ new Within(duration("10 seconds")) {
+ @Override
protected void run() {
subject.tell(new FindLocalShard(Shard.DEFAULT_NAME), getRef());
protected void run() {
subject.tell(new FindLocalShard(Shard.DEFAULT_NAME), getRef());
- final ActorRef out = new ExpectMsg<ActorRef>(duration("1 seconds"), "find local") {
+ final ActorRef out = new ExpectMsg<ActorRef>(duration("10 seconds"), "find local") {
+ @Override
protected ActorRef match(Object in) {
if (in instanceof LocalShardFound) {
return ((LocalShardFound) in).getPath();
protected ActorRef match(Object in) {
if (in instanceof LocalShardFound) {
return ((LocalShardFound) in).getPath();
@@
-158,12
+170,13
@@
public class ShardManagerTest {
new JavaTestKit(system) {{
final Props props = ShardManager
.props("config", new MockClusterWrapper(),
new JavaTestKit(system) {{
final Props props = ShardManager
.props("config", new MockClusterWrapper(),
- new MockConfiguration());
+ new MockConfiguration()
, new DatastoreContext()
);
final TestActorRef<ShardManager> subject =
TestActorRef.create(system, props);
// the run() method needs to finish within 3 seconds
final TestActorRef<ShardManager> subject =
TestActorRef.create(system, props);
// the run() method needs to finish within 3 seconds
- new Within(duration("1 seconds")) {
+ new Within(duration("10 seconds")) {
+ @Override
protected void run() {
MockClusterWrapper.sendMemberUp(subject, "member-2", getRef().path().toString());
protected void run() {
MockClusterWrapper.sendMemberUp(subject, "member-2", getRef().path().toString());
@@
-172,6
+185,7
@@
public class ShardManagerTest {
final String out = new ExpectMsg<String>(duration("1 seconds"), "primary found") {
// do not put code outside this method, will run afterwards
final String out = new ExpectMsg<String>(duration("1 seconds"), "primary found") {
// do not put code outside this method, will run afterwards
+ @Override
protected String match(Object in) {
if (in.getClass().equals(PrimaryFound.SERIALIZABLE_CLASS)) {
PrimaryFound f = PrimaryFound.fromSerializable(in);
protected String match(Object in) {
if (in.getClass().equals(PrimaryFound.SERIALIZABLE_CLASS)) {
PrimaryFound f = PrimaryFound.fromSerializable(in);
@@
-196,12
+210,13
@@
public class ShardManagerTest {
new JavaTestKit(system) {{
final Props props = ShardManager
.props("config", new MockClusterWrapper(),
new JavaTestKit(system) {{
final Props props = ShardManager
.props("config", new MockClusterWrapper(),
- new MockConfiguration());
+ new MockConfiguration()
, new DatastoreContext()
);
final TestActorRef<ShardManager> subject =
TestActorRef.create(system, props);
// the run() method needs to finish within 3 seconds
final TestActorRef<ShardManager> subject =
TestActorRef.create(system, props);
// the run() method needs to finish within 3 seconds
- new Within(duration("1 seconds")) {
+ new Within(duration("10 seconds")) {
+ @Override
protected void run() {
MockClusterWrapper.sendMemberUp(subject, "member-2", getRef().path().toString());
protected void run() {
MockClusterWrapper.sendMemberUp(subject, "member-2", getRef().path().toString());