Fix sonar issues

- Move string literals to the left side of comparison
- Fix a typo

Change-Id: I3e59cde5d73d99d918b51fa5bcaa7c737ed7f525
diff --git a/apps/test/distributed-primitives/src/main/java/org/onosproject/distributedprimitives/cli/ConsistentMapTestCommand.java b/apps/test/distributed-primitives/src/main/java/org/onosproject/distributedprimitives/cli/ConsistentMapTestCommand.java
index d63a46c..208b518 100644
--- a/apps/test/distributed-primitives/src/main/java/org/onosproject/distributedprimitives/cli/ConsistentMapTestCommand.java
+++ b/apps/test/distributed-primitives/src/main/java/org/onosproject/distributedprimitives/cli/ConsistentMapTestCommand.java
@@ -65,31 +65,31 @@
                                     .withName(name)
                                     .withSerializer(Serializer.using(KryoNamespaces.BASIC))
                                     .build();
-        if (operation.equals("get")) {
+        if ("get".equals(operation)) {
             print(map.get(arg1));
-        } else if (operation.equals("put")) {
+        } else if ("put".equals(operation)) {
             print(map.put(arg1, arg2));
-        } else if (operation.equals("size")) {
+        } else if ("size".equals(operation)) {
             print("%d", map.size());
-        } else if (operation.equals("isEmpty")) {
+        } else if ("isEmpty".equals(operation)) {
             print("%b", map.isEmpty());
-        } else if (operation.equals("putIfAbsent")) {
+        } else if ("putIfAbsent".equals(operation)) {
             print(map.putIfAbsent(arg1, arg2));
-        } else if (operation.equals("putAndGet")) {
+        } else if ("putAndGet".equals(operation)) {
             print(map.putAndGet(arg1, arg2));
-        } else if (operation.equals("clear")) {
+        } else if ("clear".equals(operation)) {
             map.clear();
-        } else if (operation.equals("remove")) {
+        } else if ("remove".equals(operation)) {
             if (arg2 == null) {
                 print(map.remove(arg1));
             } else {
                 print("%b", map.remove(arg1, arg2));
             }
-        } else if (operation.equals("containsKey")) {
+        } else if ("containsKey".equals(operation)) {
             print("%b", map.containsKey(arg1));
-        } else if (operation.equals("containsValue")) {
+        } else if ("containsValue".equals(operation)) {
             print("%b", map.containsValue(arg1));
-        } else if (operation.equals("replace")) {
+        } else if ("replace".equals(operation)) {
             if (arg3 == null) {
                 print(map.replace(arg1, arg2));
             } else {
diff --git a/apps/test/distributed-primitives/src/main/java/org/onosproject/distributedprimitives/cli/CounterTestCommand.java b/apps/test/distributed-primitives/src/main/java/org/onosproject/distributedprimitives/cli/CounterTestCommand.java
index 992e77e..1056a11 100644
--- a/apps/test/distributed-primitives/src/main/java/org/onosproject/distributedprimitives/cli/CounterTestCommand.java
+++ b/apps/test/distributed-primitives/src/main/java/org/onosproject/distributedprimitives/cli/CounterTestCommand.java
@@ -54,21 +54,21 @@
     protected void execute() {
         StorageService storageService = get(StorageService.class);
         atomicCounter = storageService.getAsyncAtomicCounter(counter).asAtomicCounter();
-        if (operation.equals("get")) {
+        if ("get".equals(operation)) {
             print("%d", atomicCounter.get());
-        } else if (operation.equals("set")) {
+        } else if ("set".equals(operation)) {
             atomicCounter.set(value1);
-        } else if (operation.equals("incrementAndGet")) {
+        } else if ("incrementAndGet".equals(operation)) {
             print("%d", atomicCounter.incrementAndGet());
-        } else if (operation.equals("getAndIncrement")) {
+        } else if ("getAndIncrement".equals(operation)) {
             print("%d", atomicCounter.getAndIncrement());
-        } else if (operation.equals("getAndAdd")) {
+        } else if ("getAndAdd".equals(operation)) {
             print("%d", atomicCounter.getAndAdd(value1));
-        } else if (operation.equals("addAndGet")) {
+        } else if ("addAndGet".equals(operation)) {
             print("%d", atomicCounter.addAndGet(value1));
-        } else if (operation.equals("compareAndSet")) {
+        } else if ("compareAndSet".equals(operation)) {
             print("%b", atomicCounter.compareAndSet(value1, value2));
-        } else if (operation.equals("destroy")) {
+        } else if ("destroy".equals(operation)) {
             atomicCounter.destroy();
         }
     }
diff --git a/apps/test/distributed-primitives/src/main/java/org/onosproject/distributedprimitives/cli/LeaderElectorTestCommand.java b/apps/test/distributed-primitives/src/main/java/org/onosproject/distributedprimitives/cli/LeaderElectorTestCommand.java
index 2ac7a29..ef5e45c 100644
--- a/apps/test/distributed-primitives/src/main/java/org/onosproject/distributedprimitives/cli/LeaderElectorTestCommand.java
+++ b/apps/test/distributed-primitives/src/main/java/org/onosproject/distributedprimitives/cli/LeaderElectorTestCommand.java
@@ -56,11 +56,11 @@
                 .withName(name)
                 .build()
                 .asLeaderElector();
-        if (operation.equals("run")) {
+        if ("run".equals(operation)) {
             print(leaderElector.run(topic, localNodeId));
-        } else if (operation.equals("withdraw")) {
+        } else if ("withdraw".equals(operation)) {
             leaderElector.withdraw(topic);
-        } else if (operation.equals("show")) {
+        } else if ("show".equals(operation)) {
             print(leaderElector.getLeadership(topic));
         }
     }
diff --git a/apps/test/distributed-primitives/src/main/java/org/onosproject/distributedprimitives/cli/ValueTestCommand.java b/apps/test/distributed-primitives/src/main/java/org/onosproject/distributedprimitives/cli/ValueTestCommand.java
index aa17ca4..afb39ad 100644
--- a/apps/test/distributed-primitives/src/main/java/org/onosproject/distributedprimitives/cli/ValueTestCommand.java
+++ b/apps/test/distributed-primitives/src/main/java/org/onosproject/distributedprimitives/cli/ValueTestCommand.java
@@ -60,15 +60,15 @@
                                     .withSerializer(Serializer.using(KryoNamespaces.BASIC))
                                     .build()
                                     .asAtomicValue();
-        if (operation.equals("get")) {
+        if ("get".equals(operation)) {
             print("%s", atomicValue.get());
-        } else if (operation.equals("set")) {
+        } else if ("set".equals(operation)) {
             atomicValue.set(value1);
-        } else if (operation.equals("compareAndSet")) {
+        } else if ("compareAndSet".equals(operation)) {
             print("%b", atomicValue.compareAndSet(value1, value2));
-        } else if (operation.equals("getAndSet")) {
+        } else if ("getAndSet".equals(operation)) {
             print("%s", atomicValue.getAndSet(value1));
-        } else if (operation.equals("destroy")) {
+        } else if ("destroy".equals(operation)) {
             atomicValue.destroy();
         } else {
             print("Error, unknown operation %s", operation);
diff --git a/apps/test/distributed-primitives/src/main/java/org/onosproject/distributedprimitives/cli/WorkQueueTestCommand.java b/apps/test/distributed-primitives/src/main/java/org/onosproject/distributedprimitives/cli/WorkQueueTestCommand.java
index b23de26..f6f6e06 100644
--- a/apps/test/distributed-primitives/src/main/java/org/onosproject/distributedprimitives/cli/WorkQueueTestCommand.java
+++ b/apps/test/distributed-primitives/src/main/java/org/onosproject/distributedprimitives/cli/WorkQueueTestCommand.java
@@ -46,7 +46,7 @@
     String name = null;
 
     @Argument(index = 1, name = "operation",
-            description = "operation name. One of {add, addMutiple, "
+            description = "operation name. One of {add, addMultiple, "
                     + "takeAndComplete, totalPending, totalInProgress, totalCompleted, destroy}",
             required = true, multiValued = false)
     String operation = null;
@@ -68,35 +68,35 @@
         StorageService storageService = get(StorageService.class);
         Serializer serializer = Serializer.using(KryoNamespaces.BASIC);
         queue = storageService.getWorkQueue(name, serializer);
-        if (operation.equals("add")) {
+        if ("add".equals(operation)) {
             if (value1 == null) {
                 print("Usage: add <value1>");
             } else {
                 get(queue.addOne(value1));
                 print("Done");
             }
-        } else if (operation.equals("addMultiple")) {
+        } else if ("addMultiple".equals(operation)) {
             if (value1 == null || value2 == null) {
                 print("Usage: addMultiple <value1> <value2>");
             } else {
                 get(queue.addMultiple(Arrays.asList(value1, value2)));
                 print("Done");
             }
-        } else if (operation.equals("takeAndComplete")) {
+        } else if ("takeAndComplete".equals(operation)) {
             int maxItems = value1 != null ? Integer.parseInt(value1) : 1;
             Collection<Task<String>> tasks = get(queue.take(maxItems));
             tasks.forEach(task -> get(queue.complete(task.taskId())));
             print("Done");
-        } else if (operation.equals("totalPending")) {
+        } else if ("totalPending".equals(operation)) {
             WorkQueueStats stats = get(queue.stats());
             print("%d", stats.totalPending());
-        } else if (operation.equals("totalInProgress")) {
+        } else if ("totalInProgress".equals(operation)) {
             WorkQueueStats stats = get(queue.stats());
             print("%d", stats.totalInProgress());
-        } else if (operation.equals("totalCompleted")) {
+        } else if ("totalCompleted".equals(operation)) {
             WorkQueueStats stats = get(queue.stats());
             print("%d", stats.totalCompleted());
-        } else if (operation.equals("destroy")) {
+        } else if ("destroy".equals(operation)) {
             get(queue.destroy());
         } else {
             print("Invalid operation name. Valid operations names are:"