From be56383397388d35f41089723e912856c03f4673 Mon Sep 17 00:00:00 2001 From: Denes Nemeth Date: Mon, 5 Mar 2018 11:34:34 +0100 Subject: [PATCH] Fix release artifacts Change-Id: Ic61a50d8c7b9c2121b7ebbac5324b1c2b99e1f3a Signed-off-by: Denes Nemeth Issue-ID: VFC-728 --- .../docs/sample/cbam.collectConnectionPoints.js | 16 +--------- nokiav2/docs/sampleVnfs/simple/simple.csar | Bin 12147 -> 12044 bytes nokiav2/docs/sampleVnfs/simpleDual/simpleDual.csar | Bin 11470 -> 11367 bytes .../vnfm/svnfm/nokia/restapi/ConverterApi.java | 19 +++++++---- .../vnfm/svnfm/nokia/restapi/SwaggerApi.java | 11 +++++-- .../driver/vnfm/svnfm/nokia/util/CbamUtils.java | 18 +++++++++-- .../driver/vnfm/svnfm/nokia/util/StoreLoader.java | 35 +++++++++++---------- .../vnfm/svnfm/nokia/util/SystemFunctions.java | 17 +++++----- .../nfvo/driver/vnfm/svnfm/nokia/ct/CTReal.java | 7 ++--- .../TestGenericExternalSystemInfoProvider.java | 4 ++- .../driver/vnfm/svnfm/nokia/vnfm/TestBase.java | 4 +-- nokiav2/generatedapis/pom.xml | 7 ----- 12 files changed, 72 insertions(+), 66 deletions(-) diff --git a/nokiav2/docs/sample/cbam.collectConnectionPoints.js b/nokiav2/docs/sample/cbam.collectConnectionPoints.js index f5cfc675..c721c935 100644 --- a/nokiav2/docs/sample/cbam.collectConnectionPoints.js +++ b/nokiav2/docs/sample/cbam.collectConnectionPoints.js @@ -26,21 +26,7 @@ function collectPorts(resourceModel, diff){ transformedPort.macAddress = port.attributes.mac_address; transformedPort.serverProviderId = port.attributes.device_id; transformedPort.networkProviderId = port.attributes.network_id; - transformedPort.changeType = 'untouched'; - var added = contains(diff.add, path); - var removed = contains(diff.remove, path); - if(added && removed){ - transformedPort.changeType = "MODIFIED"; - } - else{ - if(removed){ - transformedPort.changeType = "REMOVED"; - } - if(added){ - transformedPort.changeType = "ADDED"; - } - } - if('untouched' != transformedPort.changeType && managedPort){ + if(managedPort){ transformedPorts.push(transformedPort) } }) diff --git a/nokiav2/docs/sampleVnfs/simple/simple.csar b/nokiav2/docs/sampleVnfs/simple/simple.csar index 3d87246d2937556907028709740c0fb2a53b4836..13d35620a3453d95623dcc4a2f3aa5d1837f2e93 100644 GIT binary patch delta 879 zcmewy*AurvmYr{-bE?mcxtEq~R%T$>tUOtp-HiS2$2n0zJb5F#$mSaMseE8Hdu@;F zS28g$*lnUTW$-A%4eYD{|?Q9lu zok`ZCrTiOI_*z$=&)a=={(COp|A7k@>;J8f zwcF3=*!uEr+|;Q1QA+3c8@0W6{5~c94@b_~;=O;iI6asZb|P_;tZ(~GgZj$(j?K54 zqwegQ#PiLjb+#|30sG2(d6%w8w6llbyLs^K-d7g-U(~)Vnz(&K@s+K1^OZiX^^-W| znqBNKtrh1O&KG)mBmbFMeA}*URan1d+xlNI-5om<3g)D56}3H+_T+K8NI~w_wc$}3 zyOvHlX6R|+H_N|6L_B5fS*4SY7i;q**I)0GC}Q5dPVv!;+>Qln7Q9T&^|NG|c43lE zZe1wTv;E61%LhoP9xcgIm#o1f!xF6GTGw)tEa7Oi2aUU25lF(ZB;mMH>P4^dH1G;2l6k~@!n()k?fD%^f`ke za`JA`7ptFMXPtb`uD+-ez7B!PL85e)0RZVZ&KoGt2D>fWrTcuWe#X?mS zQi($fN~2y7LK}M=wt-!1cMU`l|Gl$o8@$FCMfD}he7t!x^Oo6CNn){HL#*!w=lF*S zJ`;>bx5a5@2#9!Y^4$Eph>n2`0;k4WoFS(h)4Bl;sn(LcCnx^;VnYuU9# zmfa-@z6aHkp0Yh8OO~nmw*>|+X%TrDY(wMAXz09-pg?Xx&blO-z?Q|(*%Sx86Y_tp z6Q+#m#EDmwzryo-W?q$-b1m|C1&Qa%9h(AE0e7n@fL-A{BAt% zfOZ~jZBOK8)P;*9tv$K!v8pi3)yjWwSc3+ILr}kTO^B#@*~6w9Iz}?) z#^4a@7pIX@3Z|@UB0|O!*iX~)^4yF@Cu1T=%d2`>YFvtEg^nO|<6qc->F?q27vx$BJ{*6VNqUW4 zHOUr76h~%&F6iD+Fa<^GmP4@#+fTny#B74YZenTIr$K&@exD49L5SK?X2|C3P*!TS zBCT+-cN1kyUb9K_RbXF`W!U-BYLO+l8-2F?GGS1gMw<$5>M}S}f1&VyP)h>@6aWAK z2ml$ZAx!8gl$>Y)004jh006W87@!Ug8LS~pgi-xw-~s>uD+-gWCqt9iC>fJ|C<>Dj zC>jIP5df0`88VaAC>)c0C?o--lcFed0$CH27b#W&rIT(cU;+7)&nZa)Hx`o`DqaI$ z832=wAS9EYDnJ4~8X`8;C7XBOUr&Z#~V6LR7hR2Uc-Cb62c|NJ;73Wzt`vEJh21Ig~SJ+5EL#K2&~ zFqxSRa(K#z{v8Ik%56l1gLdsh;RQb1A)DtwfD%Fb$TuS=GC$)>*`^-sDRtj zPA8=O#mW!%<+Ss!{qbJ*dGir9#?Z5@hM%APJlpg4Tgb$ayzLWascW+QE6^01#J%`r zPfDu>^Fk(F?x}~$PbOF^_M}I;+;eBKXI&Ohzeq9CBeg`oro_)}aoY#GJxb?S-uyGo z{EvFLrfV!?Xxy^?odo%?9RecIV9B0D@A!R6`X7#*v&DP=Y;k%pE9^w#CRyM1n+Elj^BtRSHAmgqHHqh& zP3vr5P6PIp_wp`Xk!WWRzjyQC+r6(W^uMTmSu}C`hTsV!AtaCKSv`-zsW*Chf`NbdiGGt!u-hG3lHR9s^h)M9wONvyXkWVL*(S$qAylI zz0NxMoXM}egU;WjV($KX)%KrtbCCEojMQqT=FALCt&=~hDNLTDCdE8gkYRGZxY6Wz zb(zU^8f=q!)#aG;gcv3}NEiae92k`+FHjF>%m delta 960 zcmV;x13&!dSk76n^8^iNTq{h40r(wfBme+sk_9)D0}dCnP6f&i4jHT=OoUPWX5az< z04oZUCKNT3Jr@^$rBzLD+CUJ!^D8zSVq2wFd&NRk6jF&p3QD715JDS!9JYa7Yj+Jq z5&yljYa6`A7)A9Z%6zUZCRy#~qYx*;wv2u@RLV*zoNoTy(w zi5v)*pV{`wf4E9C{v<(%U;O{Pn)n(x<+^oyg=^WhM3&tp3BCu_lAf|XBukd5`L_iI zE@=^Y8Eix2%V_Alj-WtpLC(4)nZTCC(Ag9Ry%X|(trMn<>BNawl)u9BduCphmvb%h zcm;{)${m{mQvr9YDdWmFKT9E6i(i(&jh3(x+m`skewKnNEbwn{tJG_HtCQ|OPREm< zlZSD?O-g_-(*?tF?NzQOB8vJfN?tpe4ZEa8FX4Hj?BdtBT?y;&c z%hk$%Z&-r{g+oxkbWMn;dD+VSSLf*7Qd6Y{3OYtI=EmR<>KCVxQVOQ5Ya&9%6WCAF z^77n_M&#>vByfINPp8p@;&Bv0J2w&UB+Ujy@MC1j%|x0ZI>gX+egJ)@VN<_Xt*X z3ENM`+!}wIZ!>v3C|U>lYuB_$ELBij$Ei6_ZXU zLIKv3ktbjRDi)LTCrANklRPM20g{uPC}sh0lLIM50%RVuN-3fO4QE^{OoajX9cLr} i0B4i=D@Bu{B^49}1^@s600;mG00RR60JSLq0002L=B;i3 diff --git a/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/restapi/ConverterApi.java b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/restapi/ConverterApi.java index 2013a7bf..4a737480 100644 --- a/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/restapi/ConverterApi.java +++ b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/restapi/ConverterApi.java @@ -28,9 +28,16 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.Part; +import java.io.IOException; + +import static org.apache.http.entity.ContentType.APPLICATION_OCTET_STREAM; import static org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.util.SystemFunctions.systemFunctions; import static org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.vnfm.DriverProperties.BASE_URL; import static org.slf4j.LoggerFactory.getLogger; +import static org.springframework.http.HttpHeaders.CONTENT_DISPOSITION; +import static org.springframework.http.HttpHeaders.CONTENT_LENGTH; +import static org.springframework.http.HttpHeaders.CONTENT_TYPE; +import static org.springframework.http.HttpStatus.OK; import static org.springframework.http.MediaType.TEXT_HTML_VALUE; import static org.springframework.web.bind.annotation.RequestMethod.GET; import static org.springframework.web.bind.annotation.RequestMethod.POST; @@ -56,10 +63,10 @@ public class ConverterApi { logger.info("REST: convert package"); Part part = request.getParts().iterator().next(); byte[] bytes = vnfPackageConverter.covert(part.getInputStream()); - httpResponse.addHeader(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_OCTET_STREAM.getMimeType()); - httpResponse.setStatus(HttpStatus.OK.value()); - httpResponse.addHeader(HttpHeaders.CONTENT_LENGTH, Integer.toString(bytes.length)); - httpResponse.addHeader(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\"" + "core.csar" + "\""); + httpResponse.addHeader(CONTENT_TYPE, APPLICATION_OCTET_STREAM.getMimeType()); + httpResponse.setStatus(OK.value()); + httpResponse.addHeader(CONTENT_LENGTH, Integer.toString(bytes.length)); + httpResponse.addHeader(CONTENT_DISPOSITION, "attachment; filename=\"" + "core.csar" + "\""); httpResponse.getOutputStream().write(bytes); httpResponse.getOutputStream().flush(); } @@ -72,10 +79,10 @@ public class ConverterApi { */ @RequestMapping(value = "/convert", method = GET, produces = TEXT_HTML_VALUE) @ResponseBody - public void getUploadPageForConvertingVnfd(HttpServletResponse httpResponse) throws Exception { + public void getUploadPageForConvertingVnfd(HttpServletResponse httpResponse) throws IOException { logger.info("REST: get converter main page"); byte[] bytes = systemFunctions().loadFile("upload.html"); - httpResponse.addHeader(HttpHeaders.CONTENT_LENGTH, Integer.toString(bytes.length)); + httpResponse.addHeader(CONTENT_LENGTH, Integer.toString(bytes.length)); httpResponse.getOutputStream().write(bytes); } } diff --git a/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/restapi/SwaggerApi.java b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/restapi/SwaggerApi.java index 6d4d19e6..659e82fd 100644 --- a/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/restapi/SwaggerApi.java +++ b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/restapi/SwaggerApi.java @@ -26,8 +26,13 @@ import org.springframework.web.bind.annotation.ResponseBody; import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + import static org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.vnfm.DriverProperties.BASE_URL; import static org.slf4j.LoggerFactory.getLogger; +import static org.springframework.http.HttpHeaders.CONTENT_LENGTH; +import static org.springframework.http.HttpHeaders.CONTENT_TYPE; +import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE; import static org.springframework.web.bind.annotation.RequestMethod.GET; /** @@ -52,11 +57,11 @@ public class SwaggerApi { */ @RequestMapping(value = "/swagger.json", method = GET) @ResponseBody - public void getSwaggerApiDefinition(HttpServletResponse httpResponse) throws Exception { + public void getSwaggerApiDefinition(HttpServletResponse httpResponse) throws IOException { logger.info("REST: get swagger definition"); - httpResponse.addHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE); + httpResponse.addHeader(CONTENT_TYPE, APPLICATION_JSON_VALUE); byte[] bytes = selfRegistrationManager.getSwaggerApiDefinition(); - httpResponse.addHeader(HttpHeaders.CONTENT_LENGTH, Integer.toString(bytes.length)); + httpResponse.addHeader(CONTENT_LENGTH, Integer.toString(bytes.length)); httpResponse.getOutputStream().write(bytes); } } diff --git a/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/util/CbamUtils.java b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/util/CbamUtils.java index 7377abfc..ebd4234a 100644 --- a/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/util/CbamUtils.java +++ b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/util/CbamUtils.java @@ -20,8 +20,20 @@ import com.google.gson.JsonElement; import com.google.gson.JsonObject; import org.slf4j.Logger; +/** + * Collection of utility functions + */ public class CbamUtils { + private static class OperationMustBeAborted extends RuntimeException{ + OperationMustBeAborted(String msg){ + super(msg); + } + OperationMustBeAborted(Exception e, String msg){ + super(msg, e); + } + } + private CbamUtils() { //use static way } @@ -43,7 +55,7 @@ public class CbamUtils { public static JsonElement childElement(JsonObject parent, String name) { JsonElement child = parent.get(name); if (child == null) { - throw new RuntimeException("Missing child " + name); + throw new OperationMustBeAborted("Missing child " + name); } return child; } @@ -58,7 +70,7 @@ public class CbamUtils { */ public static RuntimeException fatalFailure(Logger logger, String msg, Exception e) { logger.error(msg, e); - throw new RuntimeException(msg, e); + throw new OperationMustBeAborted(e, msg); } /** @@ -70,6 +82,6 @@ public class CbamUtils { */ public static RuntimeException fatalFailure(Logger logger, String msg) { logger.error(msg); - throw new RuntimeException(msg); + throw new OperationMustBeAborted(msg); } } diff --git a/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/util/StoreLoader.java b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/util/StoreLoader.java index faa436e3..249925ea 100644 --- a/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/util/StoreLoader.java +++ b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/util/StoreLoader.java @@ -18,6 +18,7 @@ package org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.util; import org.apache.commons.codec.binary.Base64; +import javax.swing.text.html.Option; import java.io.ByteArrayInputStream; import java.io.InputStream; import java.security.KeyFactory; @@ -34,6 +35,9 @@ import java.util.HashSet; import java.util.Optional; import java.util.Set; +import static java.util.Optional.empty; +import static java.util.Optional.of; +import static org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.util.CbamUtils.fatalFailure; import static org.slf4j.LoggerFactory.getLogger; /** @@ -41,7 +45,7 @@ import static org.slf4j.LoggerFactory.getLogger; */ public final class StoreLoader { - public static final String PASSWORD = "password"; + public static final String PASS_ALIAS = "password"; private static final String RSA = "RSA"; private static final String X_509 = "X.509"; private static final String SUN = "SUN"; @@ -59,8 +63,7 @@ public final class StoreLoader { if (rindex == -1 || lindex == -1) { return ""; } - String substring = content.substring(rindex, lindex) + end(scope); - return substring; + return content.substring(rindex, lindex) + end(scope); } /** @@ -105,17 +108,17 @@ public final class StoreLoader { */ public static KeyStore loadStore(String pem, String storePassword, String keyPassword) { Optional privateKey = generatePrivateKey(pem); - Certificate[] certs = createCertificates(pem); + Optional certs = createCertificates(pem); try { KeyStore ks = KeyStore.getInstance(JKS, SUN); ks.load(null, storePassword.toCharArray()); if (privateKey.isPresent()) { - ks.setKeyEntry(PASSWORD, privateKey.get(), keyPassword.toCharArray(), certs); - } else if (certs != null) { + ks.setKeyEntry(PASS_ALIAS, privateKey.get(), keyPassword.toCharArray(), certs.orElse(null)); + } else if (certs.isPresent()) { int index = 0; - for (Certificate cert : certs) { + for (Certificate cert : certs.get()) { TrustedCertificateEntry ts = new TrustedCertificateEntry(cert); - ks.setEntry(PASSWORD + index, ts, null); + ks.setEntry(PASS_ALIAS + index, ts, null); index++; } } @@ -125,7 +128,7 @@ public final class StoreLoader { } } - private static Certificate[] createCertificates(String pem) { + private static Optional createCertificates(String pem) { Set certificates = new HashSet<>(); try { for (String certificate : getCertifacates(pem)) { @@ -136,14 +139,13 @@ public final class StoreLoader { certificates.addAll(c); } } catch (Exception e) { - logger.error(e.getMessage(), e); - throw new RuntimeException("Unable to load certificates", e); + throw fatalFailure(logger, "Unable to load certificates", e); } if (certificates.size() > 0) { - return certificates.toArray(new Certificate[certificates.size()]); + return of(certificates.toArray(new Certificate[certificates.size()])); } else { - return null; + return empty(); } } @@ -153,12 +155,11 @@ public final class StoreLoader { if (!key.isEmpty()) { KeyFactory keyFactory = KeyFactory.getInstance(RSA); PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(toDer(key, RSA_PRIVATE_KEY)); - return Optional.of(keyFactory.generatePrivate(keySpec)); + return of(keyFactory.generatePrivate(keySpec)); } - return Optional.empty(); + return empty(); } catch (NoSuchAlgorithmException | InvalidKeySpecException e) { - logger.error("Unable to load key", e); - throw new RuntimeException("Unable to load key", e); + throw fatalFailure(logger, "Unable to load key", e); } } diff --git a/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/util/SystemFunctions.java b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/util/SystemFunctions.java index e2a2e660..805be641 100644 --- a/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/util/SystemFunctions.java +++ b/nokiav2/driver/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/util/SystemFunctions.java @@ -28,19 +28,19 @@ import java.io.PrintStream; * the classes that uses static calls. */ public class SystemFunctions { - private static SystemFunctions INSTANCE; + private static SystemFunctions singletonInstance; /** * @return singleton instance */ public static SystemFunctions systemFunctions() { - if (INSTANCE != null) { - return INSTANCE; + if (singletonInstance != null) { + return singletonInstance; } else { synchronized (SystemFunctions.class) { - INSTANCE = new SystemFunctions(); + singletonInstance = new SystemFunctions(); } - return INSTANCE; + return singletonInstance; } } @@ -56,6 +56,7 @@ public class SystemFunctions { try { Thread.sleep(millis); } catch (InterruptedException e) { + Thread.currentThread().interrupt(); throw new RuntimeException(e); } } @@ -108,7 +109,7 @@ public class SystemFunctions { * destination that is typically not continuously monitored. */ public PrintStream err() { - return System.err; + return System.err; //NO SONAR (intentional wrapping of system err } /** @@ -137,7 +138,7 @@ public class SystemFunctions { * @see java.io.PrintStream#println(java.lang.String) */ public PrintStream out() { - return System.out; + return System.out; //NO SONAR (intentional wrapping of system out) } /** @@ -147,7 +148,7 @@ public class SystemFunctions { * the host environment or user. */ public InputStream in() { - return System.in; + return System.in; //NO SONAR (intentional wrapping of system in) } /** diff --git a/nokiav2/driver/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/ct/CTReal.java b/nokiav2/driver/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/ct/CTReal.java index e013142a..c40dcfb1 100644 --- a/nokiav2/driver/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/ct/CTReal.java +++ b/nokiav2/driver/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/ct/CTReal.java @@ -19,6 +19,7 @@ package org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.ct; import org.junit.Test; import org.junit.runner.RunWith; import org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.NokiaSvnfmApplication; +import org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.util.SystemFunctions; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.junit4.SpringRunner; @@ -33,10 +34,8 @@ public class CTReal { * It takes parameters from application-real.properties */ @Test - public void testBasicWorkflow() throws Exception { - - - Thread.sleep(10000000 * 1000L); + public void testBasicWorkflow() { + SystemFunctions.systemFunctions().sleep(10000000 * 1000L); } } diff --git a/nokiav2/driver/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/onap/core/TestGenericExternalSystemInfoProvider.java b/nokiav2/driver/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/onap/core/TestGenericExternalSystemInfoProvider.java index 44263835..ea1afe5f 100644 --- a/nokiav2/driver/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/onap/core/TestGenericExternalSystemInfoProvider.java +++ b/nokiav2/driver/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/onap/core/TestGenericExternalSystemInfoProvider.java @@ -77,7 +77,9 @@ public class TestGenericExternalSystemInfoProvider extends TestBase { assertEquals(expectedVnfmInfo, vnfmInfo); //when //sleeping is required to make time pass (for cache to notice the change) - Thread.sleep(10); + //cache is configured with 1 ms cache eviction without sleep it is not + //deterministic that at least 1 ms time will pass between calls + Thread.sleep(10); //NO SONAR VnfmInfo vnfmInfo2 = genericExternalSystemInfoProvider.getVnfmInfo(VNFM_ID); //verify source system called again verify(logger, times(2)).info("Quering VNFM info from source with " + VNFM_ID + " identifier"); diff --git a/nokiav2/driver/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/TestBase.java b/nokiav2/driver/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/TestBase.java index 99e95b4c..5f1d6007 100644 --- a/nokiav2/driver/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/TestBase.java +++ b/nokiav2/driver/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nokia/vnfm/TestBase.java @@ -116,7 +116,7 @@ public class TestBase { @Before public void genericSetup() throws Exception { MockitoAnnotations.initMocks(this); - ReflectionTestUtils.setField(SystemFunctions.class, "INSTANCE", systemFunctions); + ReflectionTestUtils.setField(SystemFunctions.class, "singletonInstance", systemFunctions); when(cbamRestApiProvider.getCbamLcmApi(VNFM_ID)).thenReturn(vnfApi); when(cbamRestApiProvider.getCbamOperationExecutionApi(VNFM_ID)).thenReturn(operationExecutionApi); when(cbamRestApiProvider.getCbamLcnApi(VNFM_ID)).thenReturn(lcnApi); @@ -133,7 +133,7 @@ public class TestBase { @After public void tearGeneric() { - ReflectionTestUtils.setField(SystemFunctions.class, "INSTANCE", null); + ReflectionTestUtils.setField(SystemFunctions.class, "singletonInstance", null); } protected void assertFileInZip(byte[] zip, String path, byte[] expectedContent) throws Exception { diff --git a/nokiav2/generatedapis/pom.xml b/nokiav2/generatedapis/pom.xml index 3dfeba34..1e2c7d98 100644 --- a/nokiav2/generatedapis/pom.xml +++ b/nokiav2/generatedapis/pom.xml @@ -121,13 +121,6 @@ - - - org.onap.vfc.nfvo.driver.vnfm.svnfm.nokiav2 - generatortools - 1.1.0-SNAPSHOT - - org.apache.maven.plugins -- 2.16.6