Document Updates and Bug Fixes 67/50967/2
authorThomas Nelson Jr (arthurdent3) tn1381@att.com <tn1381@att.com>
Thu, 7 Jun 2018 19:43:03 +0000 (15:43 -0400)
committerThomas Nelson Jr (arthurdent3) tn1381@att.com <tn1381@att.com>
Thu, 7 Jun 2018 19:59:49 +0000 (15:59 -0400)
Added latest Bug Fix

Change-Id: I6e40e50a3e077c81f8098582b718bc60e39f8253
Issue-ID: MUSIC-76
Signed-off-by: Thomas Nelson Jr (arthurdent3) tn1381@att.com <tn1381@att.com>
20 files changed:
docs/architecture.rst
docs/configuration.rst
docs/consumedapis.rst [deleted file]
docs/delivery.rst [deleted file]
docs/index.rst
docs/installation.rst
docs/logging.rst
docs/release-notes.rst
docs/setup.rst
docs/single.rst
jar/pom.xml
jar/version.properties
pom.xml
src/main/java/org/onap/music/conductor/conditionals/MusicContional.java
src/main/java/org/onap/music/lockingservice/MusicLockState.java
src/main/java/org/onap/music/main/CachingUtil.java
src/main/java/org/onap/music/main/MusicCore.java
src/test/java/org/onap/music/unittests/TestMusicCore.java
src/test/java/org/onap/music/unittests/TestRestMusicData.java
version.properties

index 8daa0d3..ae29f9e 100644 (file)
@@ -4,15 +4,7 @@
 Architecture
 ============
 
-.. note::
-   * This section is used to describe a software component from a high level
-     view of capability, common usage scenarios, and interactions with other
-     components required in the usage scenarios.  
-   
-   * The architecture section is typically: provided in a platform-component
-     and sdk collections; and referenced from developer and user guides.
-   
-   * This note must be removed after content has been added.
+` See ONAP Wiki <https://wiki.onap.org/display/DW/MUSIC-Multi-site+State+Coordination+Service>`_
 
 
 Capabilities
index 085f9c6..609b33e 100644 (file)
@@ -4,24 +4,25 @@
 Configuration
 =============
 
-.. note::
-   * This section is used to describe the options a software component offers for configuration.
+See the following pages for Configuration Information:
 
-   * Configuration is typically: provided for platform-component and sdk projects;
-     and referenced in developer and user guides.
-   
-   * This note must be removed after content has been added.
+.. toctree::
+   :maxdepth: 1
 
+   Single-Site Install <single>
+   Muili-Site Install <multi>
+   Authentication <authentication>
 
 
-Example ...
 
-You can provide the following in ``basic.conf``
+.. Example ...
 
-``host=ADDRESS``
-  The address of the host
+.. You can provide the following in ``basic.conf``
 
-``port=PORT``
-  The port used for signaling
+.. ``host=ADDRESS``
+..   The address of the host
 
-  Optional. Default: ``8080``
+.. ``port=PORT``
+..   The port used for signaling
+
+..   Optional. Default: ``8080``
diff --git a/docs/consumedapis.rst b/docs/consumedapis.rst
deleted file mode 100644 (file)
index c2af4c2..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-.. This work is licensed under a Creative Commons Attribution 4.0 International License.
-.. http://creativecommons.org/licenses/by/4.0
-
-Consumed APIs
-=============
-
-.. note::
-   * This section is used to reference APIs that a software component depends on
-     and uses from other sources.  
-   
-   * Consumed APIs should be a specific link to the offered APIs from another component
-     or external source.
-
-   * This note must be removed after content has been added.
-
-
diff --git a/docs/delivery.rst b/docs/delivery.rst
deleted file mode 100644 (file)
index f3f083a..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-.. This work is licensed under a Creative Commons Attribution 4.0 International License.
-.. http://creativecommons.org/licenses/by/4.0
-
-Delivery
-========
-
-.. note::
-   * This section is used to describe a software component packaging.
-     For a run-time component this might be executable images, containers, etc.
-     For an SDK this might be libraries.
-
-   * This section is typically provided for a platform-component and sdk;
-     and referenced in developer and user guides
-   
-   * This note must be removed after content has been added.
-
-Example use of a block diagram.
-
-.. blockdiag::
-   
-
-   blockdiag layers {
-   orientation = portrait
-   a -> m;
-   b -> n;
-   c -> x;
-   m -> y;
-   m -> z;
-   group l1 {
-       color = blue;
-       x; y; z;
-       }
-   group l2 {
-       color = yellow;
-       m; n; 
-       }
-   group l3 {
-       color = orange;
-       a; b; c;
-       }
-
-   }
-
-
index 3ef9775..437a50d 100755 (executable)
@@ -8,17 +8,17 @@ Music Developer Documentation
 .. toctree::
    :maxdepth: 1
 
-   Single-SIte Install <single>
-   Muili-Site Install <multi>
+   installation
    setup
    release-notes
-
+   architecture 
+   logging
+   configuration
+   
    
 ..   architecture
-..   configuration
 ..   consumedapis
 ..   delivery
 ..   index
-..   installation 
-..   logging
+..    
 ..   offeredapis
index be64a63..0f591eb 100644 (file)
@@ -4,17 +4,17 @@
 Installation
 ============
 
-.. note::
-   * This section is used to describe how a software component is acquired and installed.
-   
-   * This section is typically: provided for a platform-component and application; and
-     referenced in user guides.
 
-   * This note must be removed after content has been added.
+.. toctree::
+   :maxdepth: 1
 
-Environment
------------
+   Single-Site Install <single>
+   Muili-Site Install <multi>
 
 
-Steps
------
+.. Environment
+.. -----------
+
+
+.. Steps
+.. -----
index 39eabfb..b1d3a18 100644 (file)
@@ -4,14 +4,8 @@
 Logging
 =======
 
-.. note::
-   * This section is used to describe the informational or diagnostic messages emitted from 
-     a software component and the methods or collecting them.
-   
-   * This section is typically: provided for a platform-component and sdk; and
-     referenced in developer and user guides
-   
-   * This note must be removed after content has been added.
+Log file produced will be in /opt/app/music/logs/MUSIC/music.log,error.log,debug.log
+Log files are in EELF format. 
 
 
 Where to Access Information
@@ -20,3 +14,6 @@ Where to Access Information
 
 Error / Warning Messages
 ------------------------
+
+
+
index d67e564..096d5cb 100644 (file)
@@ -7,12 +7,17 @@ Release Notes
 Initial Release for Beijing
 
 Version: 2.5.4
--------
+--------------
 
 :Release Date: 2018-06-07
 
 **New Features**
 
+MUSIC provides a service with recipes that individual ONAP components and microservice can use for 
+    - state replication across multiple geo-distributed sites
+    - flexible fine-grained consistency management of state
+    - policy driven state-ownership across replicas of the service 
+
 
 **Bug Fixes**
 
index 208c779..8406361 100644 (file)
@@ -6,7 +6,7 @@ Setup for Developing MUSIC
 
    Single-Site Install <single>
    Muili-Site Install <multi>
-   Authentication
+   Authentication <authentication>
 
 MUSIC is to be installed in a single Dir on a vm. 
 
@@ -47,4 +47,4 @@ Continue by selecting the link to the setup you are doing.
 
    Single-Site Install <single>
    Muili-Site Install <multi>
-   Authentication
+   Authentication <authentication>
index 08c5e31..060f02b 100644 (file)
@@ -15,7 +15,7 @@ Instructions
 - Ensure you have OpenJDK 8 on your machine.
 - Download Apache Cassandra 3.0, install into /opt/app/music and follow these instructions http://cassandra.apache.org/doc/latest/getting_started/installing.html till and including Step
 - By the end of this you should have Cassandra working.
-- Download Apache Zookeeper 3.4.6, install into /opt/app/music and follow these instructions https://zookeeper.apache.org/doc/trunk/zookeeperStarted.html pertaining to the standalone operation. By the end of this you should have Zookeeper working.
+- Download Apache Zookeeper 3.4.6, install into /opt/app/music and follow these instructions https://zookeeper.apache.org/doc/r3.4.6/zookeeperStarted.html pertaining to the standalone operation. By the end of this you should have Zookeeper working.
 - Download the Version 8.5 Apache Tomcat and install it using these instructions https://tomcat.apache.org/download-80.cgi (this is for version 8.5).
 - Create a music.properties file and place it in /opt/app/music/etc/. Here is a sample of the file:
 
index 9165283..ccd2367 100644 (file)
@@ -25,7 +25,7 @@
     <groupId>org.onap.music</groupId>
     <artifactId>MUSIC</artifactId>
     <packaging>jar</packaging>
-    <version>2.5.11</version>
+    <version>2.5.6</version>
     <description>
             This is the MUSIC REST interface, packaged as a war file.
     </description>
index d80599b..2ffa634 100644 (file)
@@ -4,7 +4,7 @@
 
 major=2
 minor=5
-patch=11
+patch=6
 
 base_version=${major}.${minor}.${patch}
 
diff --git a/pom.xml b/pom.xml
index be207fe..b3e0ebb 100755 (executable)
--- a/pom.xml
+++ b/pom.xml
@@ -25,7 +25,7 @@
     <groupId>org.onap.music</groupId>
     <artifactId>MUSIC</artifactId>
     <packaging>war</packaging>
-    <version>2.5.11</version>
+    <version>2.5.14</version>
     <description>
             This is the MUSIC REST interface, packaged as a war file.
     </description>
                 <configuration>
                     <source>1.7</source>
                     <target>1.7</target>
+                    <excludes>
+                       <exclude>jar/**</exclude>
+                   </excludes>
                 </configuration>
             </plugin>
             <plugin>
index 93e3472..492f7c6 100644 (file)
@@ -95,7 +95,7 @@ public class MusicContional {
                        if (lockAcqResult.getResult().equals(ResultType.SUCCESS)) {
                                ReturnType criticalPutResult = conditionalInsertAtomic(lockId, keyspace, tablename, primaryKey,
                                                queryBank);
-                               MusicCore.destroyLockRef(lockId);
+                               MusicCore.releaseLock(lockId, true);
                                if (criticalPutResult.getMessage().contains("insert"))
                                        criticalPutResult
                                                        .setMessage("Insert values: ");
@@ -105,11 +105,11 @@ public class MusicContional {
                                return criticalPutResult;
 
                        } else {
-                               MusicCore.destroyLockRef(lockId);
+                               MusicCore.releaseLock(lockId, true);
                                return lockAcqResult;
                        }
                } catch (Exception e) {
-                       MusicCore.destroyLockRef(lockId);
+                       MusicCore.releaseLock(lockId, true);
                        return new ReturnType(ResultType.FAILURE, e.getMessage());
                }
 
@@ -163,15 +163,17 @@ public class MusicContional {
                try {
 
                        if (lockAcqResult.getResult().equals(ResultType.SUCCESS)) {
-                               return updateAtomic(lockId, keyspace, tableName, primaryKey,primaryKeyValue, queryBank,planId,cascadeColumnValues,cascadeColumnName);
+                               ReturnType updateResult= updateAtomic(lockId, keyspace, tableName, primaryKey,primaryKeyValue, queryBank,planId,cascadeColumnValues,cascadeColumnName);
+                               MusicCore.releaseLock(lockId, true);
+                               return updateResult;
 
                        } else {
-                               MusicCore.destroyLockRef(lockId);
+                               MusicCore.releaseLock(lockId, true);
                                return lockAcqResult;
                        }
 
                } catch (Exception e) {
-                       MusicCore.destroyLockRef(lockId);
+                       MusicCore.releaseLock(lockId, true);
                        return new ReturnType(ResultType.FAILURE, e.getMessage());
 
                }
index 6c31410..448a36e 100644 (file)
@@ -134,4 +134,11 @@ public class MusicLockState implements Serializable {
         }
         return (MusicLockState) o;
     }
+    
+    @Override
+       public String toString() {
+               // TODO Auto-generated method stub
+               return "lockStatus:"+ (lockStatus == null ? null : lockStatus.toString())+" |needToSyncQuorum:"+needToSyncQuorum+" |lockHolder:"+lockHolder
+                               +" |leasePeriod:"+leasePeriod+" |leaseStartTime:"+leaseStartTime;
+       }
 }
index 2649130..b34721b 100755 (executable)
@@ -133,9 +133,9 @@ public class CachingUtil implements Runnable {
                     String keySpace) throws Exception {
 
         if (aafCache.get(nameSpace) != null) {
-            if (keySpace != null && !musicCache.get(keySpace).equals(nameSpace)) {
+          /*  if (keySpace != null && !musicCache.get(keySpace).equals(nameSpace)) {
                logger.info(EELFLoggerDelegate.applicationLogger,"Create new application for the same namespace.");
-            } else if (aafCache.get(nameSpace).get(userId).equals(password)) {
+            } else */if (aafCache.get(nameSpace).get(userId).equals(password)) {
                logger.info(EELFLoggerDelegate.applicationLogger,"Authenticated with cache value..");
                 // reset invalid attempts to 0
                 userAttempts.put(nameSpace, 0);
@@ -167,9 +167,9 @@ public class CachingUtil implements Runnable {
         if (aafRresponse) {
                //TODO
             //if (responseObj.getNs().get(0).getAdmin().contains(userId)) {
-               //Map<String, String> map = new HashMap<>();
-                //map.put(userId, password);
-                //aafCache.put(nameSpace, map);
+               Map<String, String> map = new HashMap<>();
+                map.put(userId, password);
+                aafCache.put(nameSpace, map);
                return true;
             //}
         }
index cc147d5..661d7ad 100644 (file)
@@ -294,6 +294,10 @@ public class MusicCore {
                 logger.info(EELFLoggerDelegate.applicationLogger,"In acquire lock: You already have the lock!");
                 return new ReturnType(ResultType.SUCCESS, "You already have the lock!");
             }
+            if (currentMls.getLockStatus() != MusicLockState.LockStatus.UNLOCKED || currentMls.getLockHolder() != null) {
+                               logger.info("In acquire lock: the previous lock has not been released yet! current mls:"+currentMls.toString());
+                               return new ReturnType(ResultType.FAILURE, "The previous lock has not been released yet."); 
+                       }
         } catch (NullPointerException e) {
                logger.error(EELFLoggerDelegate.errorLogger,e.getMessage(), AppMessages.INVALIDLOCK+lockId,ErrorSeverity.CRITICAL, ErrorTypes.LOCKINGERROR);
         }
@@ -511,6 +515,14 @@ public class MusicCore {
     public static  void  voluntaryReleaseLock(String lockId) throws MusicLockingException{
                try {
                        getLockingServiceHandle().unlockAndDeleteId(lockId);
+                       String lockName = getLockNameFromId(lockId);
+               String lockHolder = null;
+               MusicLockState mls = new MusicLockState(MusicLockState.LockStatus.UNLOCKED, lockHolder);
+               try {
+                   getLockingServiceHandle().setLockState(lockName, mls);
+               } catch (MusicLockingException e) {
+                       logger.error(EELFLoggerDelegate.errorLogger,e.getMessage(), AppMessages.RELEASELOCK+lockId  ,ErrorSeverity.CRITICAL, ErrorTypes.LOCKINGERROR);
+               }
                } catch (KeeperException.NoNodeException e) {
                        // ??? No way
                }
@@ -641,6 +653,7 @@ public class MusicCore {
         try {
             MusicLockState mls = getLockingServiceHandle()
                             .getLockState(keyspaceName + "." + tableName + "." + primaryKey);
+            logger.info("Got MusicLockState object... :"+mls.toString());
             if (mls.getLockHolder().equals(lockId) == true) {
                 if (conditionInfo != null)
                   try {
@@ -762,7 +775,7 @@ public class MusicCore {
             ReturnType criticalPutResult = criticalPut(keyspaceName, tableName, primaryKey,
                             queryObject, lockId, conditionInfo);
             long criticalPutTime = System.currentTimeMillis();
-            voluntaryReleaseLock(lockId);
+            releaseLock(lockId, true);
             long lockDeleteTime = System.currentTimeMillis();
             String timingInfo = "|lock creation time:" + (lockCreationTime - start)
                             + "|lock accquire time:" + (lockAcqTime - lockCreationTime)
@@ -772,7 +785,7 @@ public class MusicCore {
             return criticalPutResult;
         } else {
             logger.info(EELFLoggerDelegate.applicationLogger,"unable to acquire lock, id " + lockId);
-            destroyLockRef(lockId);
+            releaseLock(lockId, true);;
             return lockAcqResult;
         }
     }
@@ -842,10 +855,10 @@ public class MusicCore {
             logger.info(EELFLoggerDelegate.applicationLogger,"acquired lock with id " + lockId);
             ResultSet result =
                             criticalGet(keyspaceName, tableName, primaryKey, queryObject, lockId);
-            voluntaryReleaseLock(lockId);
+            releaseLock(lockId, true);
             return result;
         } else {
-               destroyLockRef(lockId);
+               releaseLock(lockId, true);
             logger.info(EELFLoggerDelegate.applicationLogger,"unable to acquire lock, id " + lockId);
             return null;
         }
index e798aaf..d1da319 100644 (file)
@@ -136,11 +136,11 @@ public class TestMusicCore {
     @Test
     public void testAcquireLockifisMyTurnTrueandIsTableOrKeySpaceLockFalseandDontHaveLock() throws MusicLockingException {
         MusicLockState musicLockState = new MusicLockState(LockStatus.LOCKED, "id2");
-        Mockito.when(mLockHandle.isMyTurn("id1")).thenReturn(true);
+        Mockito.when(mLockHandle.isMyTurn("id2")).thenReturn(true);
         Mockito.when(mLockHandle.getLockState("ks1.tn1.pk1")).thenReturn(musicLockState);
-        ReturnType lock = MusicCore.acquireLock("ks1.tn1.pk1", "id1");
+        ReturnType lock = MusicCore.acquireLock("ks1.tn1.pk1", "id2");
         assertEquals(lock.getResult(), ResultType.SUCCESS);
-        Mockito.verify(mLockHandle).isMyTurn("id1");
+        Mockito.verify(mLockHandle).isMyTurn("id2");
         Mockito.verify(mLockHandle).getLockState("ks1.tn1.pk1");
     }
     
index b9fd058..4234c88 100644 (file)
@@ -470,7 +470,7 @@ public class TestRestMusicData {
         JsonDelete jsonDelete = new JsonDelete();
         Map<String, String> consistencyInfo = new HashMap<>();
         MultivaluedMap<String, String> row = new MultivaluedMapImpl();
-        consistencyInfo.put("type", "atomic");
+        consistencyInfo.put("type", "eventual");
         jsonDelete.setConsistencyInfo(consistencyInfo);
         Mockito.doNothing().when(http).addHeader(xLatestVersion, MusicUtil.getVersion());
         Mockito.when(info.getQueryParameters()).thenReturn(row);
index d80599b..3f9e0c6 100644 (file)
@@ -4,7 +4,7 @@
 
 major=2
 minor=5
-patch=11
+patch=14
 
 base_version=${major}.${minor}.${patch}