aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVikram Potturi(apotturi) <apotturi@gmail.com>2018-04-09 16:47:50 -0400
committerVikram Potturi(apotturi) <apotturi@gmail.com>2018-04-09 16:56:47 -0400
commit587e3d75c651f97b6e11cc61d7159e607c3f0f90 (patch)
treeb98f1ef1ea6c389c58ec6e0801a7aa398c29ee6e
parent0d0e1f6dcf7bb27f5604615772d55b8cc903e9c7 (diff)
Adding HEAT map information.
Change-Id: I676137f72ab3cf451532c8f8fcfd032f83c31d5b Issue-ID: MUSIC-63 Signed-off-by: Vikram Potturi(apotturi) <apotturi@gmail.com>
-rw-r--r--distribution/README.md11
-rw-r--r--distribution/dockermusic/README.md35
-rw-r--r--distribution/dockermusic/properties/music.properties6
-rw-r--r--distribution/dockermusic/start.sh82
-rwxr-xr-xpom.xml2
-rw-r--r--src/main/java/org/onap/music/lockingservice/MusicLockingService.java8
-rw-r--r--src/main/java/org/onap/music/main/MusicCore.java4
-rw-r--r--src/main/java/org/onap/music/rest/RestMusicLocksAPI.java6
-rw-r--r--src/test/java/org/onap/music/unittests/TestMusicCore.java2
9 files changed, 52 insertions, 104 deletions
diff --git a/distribution/README.md b/distribution/README.md
index cced66dc..8b137891 100644
--- a/distribution/README.md
+++ b/distribution/README.md
@@ -1,12 +1 @@
-# Docker Setup
----------------
-```bash
-# Start the Container
-docker run -d --name cassandra_music -v $PWD/data:/var/lib/cassandra cassandra_music:3.0
-# Load cql script into DB
-docker run -it --link cassandra1:cassandra -v $PWD/music.cql:/music.cql cassandra_music1:3.0 cqlsh -u cassandra -p cassandra cassandra1 -f music.cql
-# Start cqlsh
-docker run -it --link cassandra_music:cassandra cassandra_music:3.0 cqlsh -u cassandra -p cassandra cassandra1
-
-```
diff --git a/distribution/dockermusic/README.md b/distribution/dockermusic/README.md
index 436921b0..14c108f9 100644
--- a/distribution/dockermusic/README.md
+++ b/distribution/dockermusic/README.md
@@ -1,8 +1,8 @@
### Docker Setup for Single instance of MUSIC
<p>Please update the <b>properties/music.properties</b> file to fit your env.<br/>
-Update the start.sh file.<br/>
-The beginning of the <b>start.sh</b> file contains various variables.<br/></p>
+Update the music.sh file.<br/>
+The beginning of the <b>music.sh</b> file contains various variables.<br/></p>
CASS_IMG - Cassandra Image<br/>
TOMCAT_IMG - Tomcat Image<br/>
@@ -15,3 +15,34 @@ CASS_PASSWORD - Password for Cassandra - should match cassandra.password in musi
MUSIC Logs will be saved in logs/MUSIC after start of tomcat.<br/>
+```bash
+# Start containers
+./music.sh start
+# Stop containers
+./music.sh stop
+```
+
+If you want to check out Cassandra db with cqlsh.
+```bash
+docker exec –it music-db bash
+#at the prompt youcan run cqlsh as:
+cqlsh –u <user> -p <password>
+```
+
+Zookeeper:
+
+```bash
+docker exec –it music-zk bash
+#and then run:
+zkCli.sh
+```
+
+For other logs do <br/>
+```bash
+docker logs music-tomcat (tomcat)<br/>
+```
+to have rolling logs use –f as docker logs –f music-tomcat<br/>
+```bash
+docker logs music-zk (zookeeper)<br/>
+docker logs music-db (Cassandra )<br/>
+``` \ No newline at end of file
diff --git a/distribution/dockermusic/properties/music.properties b/distribution/dockermusic/properties/music.properties
index 02ba435c..65378d8c 100644
--- a/distribution/dockermusic/properties/music.properties
+++ b/distribution/dockermusic/properties/music.properties
@@ -11,9 +11,9 @@ cassandra.host=music-db
#debug=true
#music.rest.ip=localhost
#lock.lease.period=6000
-cassandra.user=xxuserxxx
-cassandra.password=xxpasswordxx
+cassandra.user=cassandra1
+cassandra.password=cassandra1
# AAF Endpoint if using AAF
-#aaf.endpoint.url=
+aaf.endpoint.url=https://aaf.api.simpledemo.onap.org
diff --git a/distribution/dockermusic/start.sh b/distribution/dockermusic/start.sh
deleted file mode 100644
index c3763c45..00000000
--- a/distribution/dockermusic/start.sh
+++ /dev/null
@@ -1,82 +0,0 @@
-#
-# -------------------------------------------------------------------------
-# Copyright (c) 2017 AT&T Intellectual Property
-#
-# 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
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-# -------------------------------------------------------------------------
-# In this example we are building a docker bridge network(music-net) for all
-# the containers
-# Then we connect the host bridge network(bridge) to the internal network(music-net)
-#
-#
-#
-CASS_IMG=nexus3.onap.org:10001/onap/music/cassandra_music:latest
-TOMCAT_IMG=nexus3.onap.org:10001/library/tomcat:8.0
-ZK_IMG=nexus3.onap.org:10001/library/zookeeper:3.4
-MUSIC_IMG=nexus3.onap.org:10001/onap/music/music:latest
-WORK_DIR=${PWD}
-CASS_USERNAME=cassandra1
-CASS_PASSWORD=cassandra1
-
-if [ "$1" = "start" ]; then
-
-# Create Volume for mapping war file and tomcat
-docker volume create music-vol;
-
-# Create a network for all the containers to run in.
-docker network create music-net;
-
-# Start Cassandra
-docker run -d --rm --name music-db --network music-net \
--p "7000:7000" -p "7001:7001" -p "7199:7199" -p "9042:9042" -p "9160:9160" \
--e CASSUSER=${CASS_USERNAME} \
--e CASSPASS=${CASS_PASSWORD} \
-${CASS_IMG};
-
-# Start Music war
-docker run -d --rm --name music-war \
--v music-vol:/app \
-${MUSIC_IMG};
-
-# Start Zookeeper
-docker run -d --rm --name music-zk --network music-net
--p "2181:2181" -p "2888:2888" -p "3888:3888" \
-${ZK_IMG};
-
-# Delay for Cassandra
-sleep 20;
-
-# Start Up tomcat - Needs to have properties,logs dir and war file volume mapped.
-docker run -d --rm --name music-tomcat --network music-net -p "8080:8080" \
--v music-vol:/usr/local/tomcat/webapps \
--v ${WORK_DIR}/properties:/opt/app/music/etc:ro \
--v ${WORK_DIR}/logs:/opt/app/music/logs \
-${TOMCAT_IMG};
-
-# Connect tomcat to host bridge network so that its port can be seen.
-docker network connect bridge music-tomcat;
-
-fi
-
-
-# Shutdown and clean up.
-if [ "$1" = "stop" ]; then
-docker stop music-war;
-docker stop music-db;
-docker stop music-zk;
-docker stop music-tomcat;
-docker network rm music-net;
-sleep 5;
-docker volume rm music-vol;
-fi
diff --git a/pom.xml b/pom.xml
index 2509f96a..76505ad5 100755
--- a/pom.xml
+++ b/pom.xml
@@ -55,7 +55,7 @@
<sitePath>/content/sites/site/org/onap/music/${project.version}</sitePath>
<!--maven -->
<timestamp>${maven.build.timestamp}</timestamp>
- <maven.build.timestamp.format>yyyyMMdd'T'HHmmss'Z'</maven.build.timestamp.format>
+ <maven.build.timestamp.format>yyyy.MM.dd.HH.mm</maven.build.timestamp.format>
<!--docker -->
<docker.tag>${project.version}-${timestamp}</docker.tag>
<docker.latest.tag>${project.version}-latest</docker.latest.tag>
diff --git a/src/main/java/org/onap/music/lockingservice/MusicLockingService.java b/src/main/java/org/onap/music/lockingservice/MusicLockingService.java
index 44a00bcf..ae026903 100644
--- a/src/main/java/org/onap/music/lockingservice/MusicLockingService.java
+++ b/src/main/java/org/onap/music/lockingservice/MusicLockingService.java
@@ -133,8 +133,12 @@ public class MusicLockingService implements Watcher {
zkLockHandle.unlock(lockId);
}
- public void deleteLock(String lockName) {
- zkLockHandle.deleteLock(lockName);
+ public void deleteLock(String lockName) throws MusicLockingException {
+ if(lockIdExists(lockName))
+ zkLockHandle.deleteLock(lockName);
+ else{
+ throw new MusicLockingException("Lock does not exist.Please check the lock: " + lockName + " and try again");
+ }
}
public String whoseTurnIsIt(String lockName) {
diff --git a/src/main/java/org/onap/music/main/MusicCore.java b/src/main/java/org/onap/music/main/MusicCore.java
index d38a4d6a..dfc93ccc 100644
--- a/src/main/java/org/onap/music/main/MusicCore.java
+++ b/src/main/java/org/onap/music/main/MusicCore.java
@@ -518,14 +518,16 @@ public class MusicCore {
/**
*
* @param lockName
+ * @throws MusicLockingException
*/
- public static void deleteLock(String lockName) {
+ public static void deleteLock(String lockName) throws MusicLockingException {
long start = System.currentTimeMillis();
logger.info(EELFLoggerDelegate.applicationLogger,"Deleting lock for " + lockName);
try {
getLockingServiceHandle().deleteLock("/" + lockName);
} catch (MusicLockingException e) {
logger.error(EELFLoggerDelegate.errorLogger,e.getMessage(), AppMessages.DELTELOCK+lockName ,ErrorSeverity.CRITICAL, ErrorTypes.LOCKINGERROR);
+ throw new MusicLockingException(e.getMessage());
}
long end = System.currentTimeMillis();
logger.info(EELFLoggerDelegate.applicationLogger,"Time taken to delete lock:" + (end - start) + " ms");
diff --git a/src/main/java/org/onap/music/rest/RestMusicLocksAPI.java b/src/main/java/org/onap/music/rest/RestMusicLocksAPI.java
index 9189fbb3..22112ddf 100644
--- a/src/main/java/org/onap/music/rest/RestMusicLocksAPI.java
+++ b/src/main/java/org/onap/music/rest/RestMusicLocksAPI.java
@@ -412,7 +412,11 @@ public class RestMusicLocksAPI {
logger.error(EELFLoggerDelegate.errorLogger,"", AppMessages.UNKNOWNERROR ,ErrorSeverity.CRITICAL, ErrorTypes.GENERALSERVICEERROR);
return response.status(Status.BAD_REQUEST).entity(resultMap).build();
}
- MusicCore.deleteLock(lockName);
+ try{
+ MusicCore.deleteLock(lockName);
+ }catch (Exception e) {
+ return response.status(Status.BAD_REQUEST).entity(new JsonResponse(ResultType.FAILURE).setError(e.getMessage()).toMap()).build();
+ }
return response.status(Status.OK).entity(new JsonResponse(ResultType.SUCCESS).toMap()).build();
}
diff --git a/src/test/java/org/onap/music/unittests/TestMusicCore.java b/src/test/java/org/onap/music/unittests/TestMusicCore.java
index 876c78b1..e798aaf1 100644
--- a/src/test/java/org/onap/music/unittests/TestMusicCore.java
+++ b/src/test/java/org/onap/music/unittests/TestMusicCore.java
@@ -257,7 +257,7 @@ public class TestMusicCore {
}
@Test
- public void testDeleteLock() {
+ public void testDeleteLock() throws MusicLockingException {
Mockito.doNothing().when(mLockHandle).deleteLock("/" + "id1");
MusicCore.deleteLock("id1");
Mockito.verify(mLockHandle).deleteLock("/" + "id1");