aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/main/java/org/onap/music/lockingservice/ZkStatelessLockService.java12
-rw-r--r--src/main/java/org/onap/music/response/jsonobjects/JsonResponse.java33
2 files changed, 29 insertions, 16 deletions
diff --git a/src/main/java/org/onap/music/lockingservice/ZkStatelessLockService.java b/src/main/java/org/onap/music/lockingservice/ZkStatelessLockService.java
index b09668b7..2aae4969 100644
--- a/src/main/java/org/onap/music/lockingservice/ZkStatelessLockService.java
+++ b/src/main/java/org/onap/music/lockingservice/ZkStatelessLockService.java
@@ -1,7 +1,10 @@
/*
* ============LICENSE_START========================================== org.onap.music
- * =================================================================== Copyright (c) 2017 AT&T
- * Intellectual Property ===================================================================
+ * ===================================================================
+ * Copyright (c) 2017 AT&T Intellectual Property
+ * ===================================================================
+ * Modifications Copyright (c) 2018 IBM.
+ * ===================================================================
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
@@ -72,6 +75,7 @@ public class ZkStatelessLockService extends ProtocolSupport {
}
}
+ @Override
public void close() {
try {
zookeeper.close();
@@ -198,7 +202,7 @@ public class ZkStatelessLockService extends ProtocolSupport {
names = zookeeper.getChildren(id, false);
if (names.isEmpty())
return "";
- SortedSet<ZNodeName> sortedNames = new TreeSet<ZNodeName>();
+ SortedSet<ZNodeName> sortedNames = new TreeSet<>();
for (String name : names) {
sortedNames.add(new ZNodeName(id + "/" + name));
}
@@ -328,7 +332,7 @@ public class ZkStatelessLockService extends ProtocolSupport {
// lets sort them explicitly (though they do seem to come back in order
// ususally :)
ZNodeName idName = new ZNodeName(id);
- SortedSet<ZNodeName> sortedNames = new TreeSet<ZNodeName>();
+ SortedSet<ZNodeName> sortedNames = new TreeSet<>();
for (String name : names) {
sortedNames.add(new ZNodeName(dir + "/" + name));
}
diff --git a/src/main/java/org/onap/music/response/jsonobjects/JsonResponse.java b/src/main/java/org/onap/music/response/jsonobjects/JsonResponse.java
index a406afce..207911d7 100644
--- a/src/main/java/org/onap/music/response/jsonobjects/JsonResponse.java
+++ b/src/main/java/org/onap/music/response/jsonobjects/JsonResponse.java
@@ -26,12 +26,7 @@ import java.util.Map;
import org.onap.music.lockingservice.MusicLockState.LockStatus;
import org.onap.music.main.ResultType;
-import org.powermock.core.spi.testresult.Result;
-import com.datastax.driver.core.ColumnDefinitions;
-import com.datastax.driver.core.ResultSet;
-import com.datastax.driver.core.Row;
-import com.datastax.driver.core.ColumnDefinitions.Definition;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@@ -231,10 +226,16 @@ public class JsonResponse {
public Map<String, Object> toMap() {
Map<String, Object> fullMap = new HashMap<>();
fullMap.put("status", status);
- if (error!=null) {fullMap.put("error", error);}
- if (message!=null) {fullMap.put("message", message);}
+ if (error!=null) {
+ fullMap.put("error", error);
+ }
+ if (message!=null) {
+ fullMap.put("message", message);
+ }
- if (musicVersion!=null) {fullMap.put("version", musicVersion);}
+ if (musicVersion!=null) {
+ fullMap.put("version", musicVersion);
+ }
if (dataResult!=null) {
fullMap.put("result", dataResult);
@@ -242,10 +243,18 @@ public class JsonResponse {
if (lock!=null) {
Map<String, Object> lockMap = new HashMap<>();
- if (lock!=null) {lockMap.put("lock", lock);}
- if (lockStatus!=null) {lockMap.put("lock-status", lockStatus);}
- if (lockHolder!=null) {lockMap.put("lock-holder", lockHolder);}
- if (lockLease!=null) {lockMap.put("lock-lease", lockLease);}
+ if (lock!=null) {
+ lockMap.put("lock", lock);
+ }
+ if (lockStatus!=null) {
+ lockMap.put("lock-status", lockStatus);
+ }
+ if (lockHolder!=null) {
+ lockMap.put("lock-holder", lockHolder);
+ }
+ if (lockLease!=null) {
+ lockMap.put("lock-lease", lockLease);
+ }
fullMap.put("lock", lockMap);
}