Implement cluster wide topology notifications and let routing use it
[controller.git] / opendaylight / clustering / test / src / main / java / org / opendaylight / controller / clustering / test / internal / SimpleClient.java
index 3e9717fa62a751744d9a9f9633b2925a0cb72faa..f681c35c8c9ea376a3d0399269d798479a296689 100644 (file)
@@ -151,7 +151,7 @@ public class SimpleClient implements CommandProvider {
                 .getILoggerFactory();
         if (lc != null) {
             for (ch.qos.logback.classic.Logger l : lc.getLoggerList()) {
-                if (loggerName == null || l.getName().startsWith(loggerName)) {
+                if ((loggerName == null) || l.getName().startsWith(loggerName)) {
                     ci.println(retrieveLogLevel(l));
                 }
             }
@@ -243,6 +243,7 @@ public class SimpleClient implements CommandProvider {
         }
     }
 
+    @SuppressWarnings("deprecation") //IGetUpdates intentionally deprecated
     public void _unlisten(CommandInterpreter ci) {
         if (this.icluster == null) {
             ci.println("\nNo Clustering services available");
@@ -272,7 +273,7 @@ public class SimpleClient implements CommandProvider {
             ci.println("\nNo Clustering services available");
             return;
         }
-        String containerName = ci.nextArgument();
+        String containerName = ci.nextArgument().toLowerCase();
         if (containerName == null) {
             ci.println("containerName not supplied");
             return;
@@ -370,8 +371,8 @@ public class SimpleClient implements CommandProvider {
     }
 
     public void _dumper(CommandInterpreter ci) {
-        ConcurrentMap c;
-        String containerName = ci.nextArgument();
+        ConcurrentMap<Object, Object> c;
+        String containerName = ci.nextArgument().toLowerCase();
         if (containerName == null) {
             ci.println("containerName not supplied");
             return;
@@ -381,10 +382,11 @@ public class SimpleClient implements CommandProvider {
             ci.println("Cache not supplied");
             return;
         }
-        c = (ConcurrentMap) this.icluster.getCache(containerName, cacheName);
+        int count = 0;
+        c = (ConcurrentMap<Object, Object>) this.icluster.getCache(containerName, cacheName);
         if (c != null) {
-            for (Object e : c.entrySet()) {
-                Map.Entry entry = (Map.Entry) e;
+            for (Map.Entry<Object, Object> e : c.entrySet()) {
+                Map.Entry<Object, Object> entry = e;
                 Object v = entry.getValue();
                 String res = "<NOT KNOWN>";
                 if (v != null) {
@@ -393,7 +395,9 @@ public class SimpleClient implements CommandProvider {
                 ci.println("Element " + entry.getKey() + "(hashCode="
                         + entry.getKey().hashCode() + ") has value = (" + res
                         + ")");
+                count++;
             }
+            ci.println("Dumped " + count + " records");
         } else {
             ci.println("Cache " + cacheName + " on container " + containerName
                     + " not existant!");
@@ -437,6 +441,7 @@ public class SimpleClient implements CommandProvider {
         }
     }
 
+    @SuppressWarnings("deprecation") //TODO: remove call to deprecated amIStandby
     public void _getRole(CommandInterpreter ci) {
         if (this.icluster == null) {
             ci.println("\nNo Clustering services available");
@@ -449,6 +454,7 @@ public class SimpleClient implements CommandProvider {
         ci.println("My role is: " + role);
     }
 
+    @SuppressWarnings("deprecation") //TODO: remove call to deprecated getActiveAddres
     public void _getActive(CommandInterpreter ci) {
         if (this.icluster == null) {
             ci.println("\nNo Clustering services available");
@@ -458,6 +464,7 @@ public class SimpleClient implements CommandProvider {
                 + this.icluster.getActiveAddress());
     }
 
+    @SuppressWarnings("deprecation") //TODO: remove use of deprecated listenRoleChange
     public void _listenActive(CommandInterpreter ci) {
         if (this.icluster == null) {
             ci.println("\nNo Clustering services available");
@@ -473,6 +480,7 @@ public class SimpleClient implements CommandProvider {
         ci.println("Register listenRoleChanges");
     }
 
+    @SuppressWarnings("deprecation") //TODO: remove deprecated call to unlistenRoleChange
     public void _unlistenActive(CommandInterpreter ci) {
         if (this.icluster == null) {
             ci.println("\nNo Clustering services available");
@@ -485,6 +493,7 @@ public class SimpleClient implements CommandProvider {
     }
 
     class DoListenRoleChanged implements IListenRoleChange {
+        @Override
         public void newActiveAvailable() {
             logger.debug("New Active is available");
         }