Prevent NPE's on failures
[netconf.git] / opendaylight / netconf / netconf-topology / src / test / java / org / opendaylight / netconf / topology / ActorTest.java
index 544cb87d21c37a80d36e20ba28c2424b23f38a72..599acc92473dc7c1289f9f4aa1c60503cb1f3120 100644 (file)
@@ -572,6 +572,34 @@ public class ActorTest {
         public void onReceive(Object o, ActorRef actorRef) {
 
         }
+
+        @Nonnull
+        @Override
+        public Node getInitialState(@Nonnull NodeId nodeId, @Nonnull Node configNode) {
+            return new NodeBuilder()
+                    .setNodeId(nodeId)
+                    .addAugmentation(NetconfNode.class,
+                            new NetconfNodeBuilder()
+                                    .setConnectionStatus(ConnectionStatus.Connecting)
+                                    .setHost(new Host(new IpAddress(new Ipv4Address("127.0.0.1"))))
+                                    .setPort(new PortNumber(65535))
+                                    .build())
+                    .build();
+        }
+
+        @Nonnull
+        @Override
+        public Node getFailedState(@Nonnull NodeId nodeId, @Nonnull Node configNode) {
+            return new NodeBuilder()
+                    .setNodeId(nodeId)
+                    .addAugmentation(NetconfNode.class,
+                            new NetconfNodeBuilder()
+                                    .setConnectionStatus(ConnectionStatus.UnableToConnect)
+                                    .setHost(new Host(new IpAddress(new Ipv4Address("127.0.0.1"))))
+                                    .setPort(new PortNumber(65535))
+                                    .build())
+                    .build();
+        }
     }
 
     public class TestingSuccesfulStateAggregator implements StateAggregator {