From 27666ce5feb0e073f0e7dc43b4f1aa267a6b0975 Mon Sep 17 00:00:00 2001 From: sa282w Date: Wed, 20 Jun 2018 09:44:06 -0400 Subject: API Versioning for ECOMP Components in SDK Issue-ID: PORTAL-263 Included the missing changes for V3 API's and changes from release/2.3.0 to release/2.4.0. Change-Id: I42173a61ecb6ec29de537c3463d405e1c74d9aaa Signed-off-by: sa282w --- .../core/service/LoginServiceCentralizedImpl.java | 2 +- .../core/service/UserServiceCentalizedImpl.java | 2 +- .../core/service/UserServiceCentalizedImplTest.java | 2 +- .../org/onap/portalapp/music/conf/MusicSession.java | 4 ++-- .../portalapp/music/conf/MusicSessionRepository.java | 2 +- .../onap/portalapp/music/service/MusicService.java | 20 ++++++++++---------- 6 files changed, 16 insertions(+), 16 deletions(-) (limited to 'ecomp-sdk') diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/service/LoginServiceCentralizedImpl.java b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/service/LoginServiceCentralizedImpl.java index 8b7d7fcb..09fb374a 100644 --- a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/service/LoginServiceCentralizedImpl.java +++ b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/service/LoginServiceCentralizedImpl.java @@ -72,7 +72,7 @@ public class LoginServiceCentralizedImpl extends FusionService implements LoginS @Autowired private UserService userService; - private static String portalApiVersion = "/v1"; + private static String portalApiVersion = "/v3"; @Override public LoginBean findUser(LoginBean bean, String menuPropertiesFilename, diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/service/UserServiceCentalizedImpl.java b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/service/UserServiceCentalizedImpl.java index 45ef1557..d44c9d72 100644 --- a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/service/UserServiceCentalizedImpl.java +++ b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/service/UserServiceCentalizedImpl.java @@ -65,7 +65,7 @@ public class UserServiceCentalizedImpl implements UserService { @Autowired private DataAccessService dataAccessService; - private static String portalApiVersion = "/v1"; + private static String portalApiVersion = "/v3"; public DataAccessService getDataAccessService() { return dataAccessService; diff --git a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/UserServiceCentalizedImplTest.java b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/UserServiceCentalizedImplTest.java index 6feb5fe6..92adc193 100644 --- a/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/UserServiceCentalizedImplTest.java +++ b/ecomp-sdk/epsdk-core/src/test/java/org/onap/portalsdk/core/service/UserServiceCentalizedImplTest.java @@ -75,7 +75,7 @@ public class UserServiceCentalizedImplTest { params.put("user_id", new Long(id)); Mockito.when(dataAccessService.executeNamedQuery("getUserByProfileId", params, null)).thenReturn(orgUsreIds); String responseString = " { \"id\": 2, \"userApps\":[{\"app\":{\"id\":1},\"role\":{\"active\":true, \"roleFunctions\":[{\"id\":1}] } } ] }"; - Mockito.when(restApiRequestBuilder.getViaREST("/v1/user/" + orgUserId, true, id)).thenReturn(responseString); + Mockito.when(restApiRequestBuilder.getViaREST("/v3/user/" + orgUserId, true, id)).thenReturn(responseString); User user = userServiceCentalizedImpl.getUser(id); Assert.assertNotNull(user); diff --git a/ecomp-sdk/epsdk-music/src/main/java/org/onap/portalapp/music/conf/MusicSession.java b/ecomp-sdk/epsdk-music/src/main/java/org/onap/portalapp/music/conf/MusicSession.java index f1defe3c..1f68bda0 100644 --- a/ecomp-sdk/epsdk-music/src/main/java/org/onap/portalapp/music/conf/MusicSession.java +++ b/ecomp-sdk/epsdk-music/src/main/java/org/onap/portalapp/music/conf/MusicSession.java @@ -158,7 +158,7 @@ public final class MusicSession implements Session, Serializable { public void setLastAccessedTime(Instant lastAccessedTime) { logger.debug(EELFLoggerDelegate.debugLogger, "setLastAccessedTime: start"); try{ - MusicService.setAttribute(MusicProperties.LAST_ACCESS_TIME, this.lastAccessedTime, this.id); + MusicService.setAttribute(MusicProperties.LAST_ACCESS_TIME, lastAccessedTime, this.id); }catch(Exception e){ logger.error(EELFLoggerDelegate.errorLogger, "setLastAccessedTime failed with id " + this.id, e); } @@ -375,7 +375,7 @@ public final class MusicSession implements Session, Serializable { } private static String generateId() { - return UUID.randomUUID().toString(); + return UUID.randomUUID().toString().replaceAll("-", "~"); } private static final long serialVersionUID = 7160779239673823561L; diff --git a/ecomp-sdk/epsdk-music/src/main/java/org/onap/portalapp/music/conf/MusicSessionRepository.java b/ecomp-sdk/epsdk-music/src/main/java/org/onap/portalapp/music/conf/MusicSessionRepository.java index 4bebfc2b..f2f8fee5 100644 --- a/ecomp-sdk/epsdk-music/src/main/java/org/onap/portalapp/music/conf/MusicSessionRepository.java +++ b/ecomp-sdk/epsdk-music/src/main/java/org/onap/portalapp/music/conf/MusicSessionRepository.java @@ -38,8 +38,8 @@ package org.onap.portalapp.music.conf; import java.time.Duration; -import java.util.Map; +import org.springframework.session.MapSession; import org.springframework.session.Session; import org.springframework.session.SessionRepository; import org.springframework.session.events.SessionDeletedEvent; diff --git a/ecomp-sdk/epsdk-music/src/main/java/org/onap/portalapp/music/service/MusicService.java b/ecomp-sdk/epsdk-music/src/main/java/org/onap/portalapp/music/service/MusicService.java index 801e9c03..3861b2dd 100644 --- a/ecomp-sdk/epsdk-music/src/main/java/org/onap/portalapp/music/service/MusicService.java +++ b/ecomp-sdk/epsdk-music/src/main/java/org/onap/portalapp/music/service/MusicService.java @@ -112,7 +112,7 @@ public class MusicService { } if (isAtomicPut) - result = MusicCore.atomicPut(musicKeySpace, tableName, sessionId, queryObject, null); + result = MusicCore.atomicPutWithDeleteLock(musicKeySpace, tableName, sessionId, queryObject, null); else result = MusicCore.eventualPut(queryObject); logger.debug(EELFLoggerDelegate.debugLogger, "setAttribute: attributeName: " + attributeName @@ -144,7 +144,7 @@ public class MusicService { queryObject.addValue(String.valueOf(session.getMaxInactiveInterval())); queryObject.addValue(session.getId()); if (isAtomicPut) - result = MusicCore.atomicPut(musicKeySpace, musicMetaTable, session.getId(), queryObject, null); + result = MusicCore.atomicPutWithDeleteLock(musicKeySpace, musicMetaTable, session.getId(), queryObject, null); else result = MusicCore.eventualPut(queryObject); logger.debug(EELFLoggerDelegate.debugLogger, @@ -170,7 +170,7 @@ public class MusicService { queryObject.appendQueryString(querySB.toString()); queryObject.addValue(sessionId); if (isAtomicGet) - result = MusicCore.atomicGet(musicKeySpace, musicMetaTable, sessionId, queryObject); + result = MusicCore.atomicGetWithDeleteLock(musicKeySpace, musicMetaTable, sessionId, queryObject); else result = MusicCore.get(queryObject); logger.debug(EELFLoggerDelegate.debugLogger, "getMetaAttribute: with session id: " + sessionId); @@ -226,7 +226,7 @@ public class MusicService { queryObject.appendQueryString(querySB.toString()); if (isAtomicGet) - result = MusicCore.atomicGet(musicKeySpace, tableName, sessionId, queryObject); + result = MusicCore.atomicGetWithDeleteLock(musicKeySpace, tableName, sessionId, queryObject); else result = MusicCore.get(queryObject); return MusicUtil.musicRestResponseDataParsing(result, attributeName); @@ -262,7 +262,7 @@ public class MusicService { tableName = musicMetaTable; queryObject.appendQueryString(querySB.toString()); if (isAtomicPut) - result = MusicCore.atomicPut(musicKeySpace, tableName, sessionId, queryObject, null); + result = MusicCore.atomicPutWithDeleteLock(musicKeySpace, tableName, sessionId, queryObject, null); else result = MusicCore.eventualPut(queryObject); logger.debug(EELFLoggerDelegate.debugLogger, @@ -290,7 +290,7 @@ public class MusicService { queryObject.appendQueryString(querySB.toString()); queryObject.addValue(sessionId); if (isAtomic) - result = MusicCore.atomicPut(musicKeySpace, musicMetaTable, sessionId, queryObject, null); + result = MusicCore.atomicPutWithDeleteLock(musicKeySpace, musicMetaTable, sessionId, queryObject, null); else result = MusicCore.eventualPut(queryObject); logger.debug(EELFLoggerDelegate.debugLogger, "removeSession: " + musicMetaTable + " with session id: " @@ -303,7 +303,7 @@ public class MusicService { queryObject.appendQueryString(querySB.toString()); queryObject.addValue(sessionId); if (isAtomic) - result = MusicCore.atomicPut(musicKeySpace, musicAttrTable, sessionId, queryObject, null); + result = MusicCore.atomicPutWithDeleteLock(musicKeySpace, musicAttrTable, sessionId, queryObject, null); else result = MusicCore.eventualPut(queryObject); @@ -570,7 +570,7 @@ public class MusicService { try{ if (isAtomicGet) - result = MusicCore.atomicGet(musicKeySpace, musicMetaTable, null, queryObject); + result = MusicCore.atomicGetWithDeleteLock(musicKeySpace, musicMetaTable, null, queryObject); else result = MusicCore.get(queryObject); Row row = result.one(); @@ -616,7 +616,7 @@ public class MusicService { queryObject.appendQueryString(querySB.toString()); try{ if (isAtomicPut) - result = MusicCore.atomicPut(musicKeySpace, null, null, queryObject, null); + result = MusicCore.atomicPutWithDeleteLock(musicKeySpace, null, null, queryObject, null); else result = MusicCore.eventualPut(queryObject); }catch(Exception e){ @@ -634,7 +634,7 @@ public class MusicService { queryObject.appendQueryString(querySB.toString()); try{ if (isAtomicPut) - result = MusicCore.atomicPut(musicKeySpace, null, null, queryObject, null); + result = MusicCore.atomicPutWithDeleteLock(musicKeySpace, null, null, queryObject, null); else result = MusicCore.eventualPut(queryObject); }catch(Exception e){ -- cgit 1.2.3-korg