diff options
24 files changed, 70 insertions, 69 deletions
diff --git a/docs/conf.py b/docs/conf.py index 5371015..d211470 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -12,4 +12,4 @@ intersphinx_mapping = {} html_last_updated_fmt = '%d-%b-%y %H:%M' def setup(app): - app.add_stylesheet("css/ribbon.css") + app.add_css_file("css/ribbon.css") diff --git a/docs/requirements-docs.txt b/docs/requirements-docs.txt index b3188dd..74a3b7a 100644 --- a/docs/requirements-docs.txt +++ b/docs/requirements-docs.txt @@ -1,15 +1 @@ -tox -Sphinx -doc8 -docutils -setuptools -six -sphinx_rtd_theme>=0.4.3 -sphinxcontrib-blockdiag -sphinxcontrib-needs>=0.2.3 -sphinxcontrib-nwdiag -sphinxcontrib-seqdiag -sphinxcontrib-swaggerdoc -sphinxcontrib-plantuml -sphinx_bootstrap_theme lfdocs-conf diff --git a/docs/tox.ini b/docs/tox.ini index edac8c3..42ffa68 100644 --- a/docs/tox.ini +++ b/docs/tox.ini @@ -5,7 +5,10 @@ skipsdist = true [testenv:docs] basepython = python3 -deps = -r{toxinidir}/requirements-docs.txt +deps = + -r{toxinidir}/requirements-docs.txt + -chttps://git.onap.org/doc/plain/etc/upper-constraints.os.txt + -chttps://git.onap.org/doc/plain/etc/upper-constraints.onap.txt commands = sphinx-build -b html -n -d {envtmpdir}/doctrees ./ {toxinidir}/_build/html echo "Generated docs available in {toxinidir}/_build/html" diff --git a/sparkybe-onap-service/src/main/java/org/onap/aai/sparky/aggregation/sync/AggregationSyncControllerFactory.java b/sparkybe-onap-service/src/main/java/org/onap/aai/sparky/aggregation/sync/AggregationSyncControllerFactory.java index 7fd7e9c..dd938b8 100644 --- a/sparkybe-onap-service/src/main/java/org/onap/aai/sparky/aggregation/sync/AggregationSyncControllerFactory.java +++ b/sparkybe-onap-service/src/main/java/org/onap/aai/sparky/aggregation/sync/AggregationSyncControllerFactory.java @@ -201,9 +201,6 @@ public class AggregationSyncControllerFactory implements SyncControllerRegistrar syncControllers.add(aggregationSyncController); } catch (Exception exc) { - - exc.printStackTrace(); - LOG.error(AaiUiMsgs.ERROR_GENERIC, "Failed to build aggregation sync controller. Error : " + exc.getMessage()); } diff --git a/sparkybe-onap-service/src/main/java/org/onap/aai/sparky/aggregation/sync/AggregationSynchronizer.java b/sparkybe-onap-service/src/main/java/org/onap/aai/sparky/aggregation/sync/AggregationSynchronizer.java index 70aaa93..eeee01d 100644 --- a/sparkybe-onap-service/src/main/java/org/onap/aai/sparky/aggregation/sync/AggregationSynchronizer.java +++ b/sparkybe-onap-service/src/main/java/org/onap/aai/sparky/aggregation/sync/AggregationSynchronizer.java @@ -68,7 +68,7 @@ import com.fasterxml.jackson.databind.ObjectReader; import com.fasterxml.jackson.databind.node.ArrayNode; /** - * The Class AutosuggestionSynchronizer. + * The Class AggregationSynchronizer. */ public class AggregationSynchronizer extends AbstractEntitySynchronizer implements IndexSynchronizer { @@ -212,7 +212,9 @@ public class AggregationSynchronizer extends AbstractEntitySynchronizer * syncs */ retryLimitTracker.clear(); - + } catch (InterruptedException e) { + // Restore interrupted state... + Thread.currentThread().interrupt(); } catch (Exception exc) { // TODO -> LOG, waht should be logged here? } @@ -396,17 +398,17 @@ public class AggregationSynchronizer extends AbstractEntitySynchronizer boolean isRetryAllowed = true; if (retryLimitTracker.get(id) != null) { Integer currentCount = retryLimitTracker.get(id); - if (currentCount.intValue() >= RETRY_COUNT_PER_ENTITY_LIMIT.intValue()) { + if (currentCount >= RETRY_COUNT_PER_ENTITY_LIMIT) { isRetryAllowed = false; String message = "Aggregation entity re-sync limit reached for " + id + ", re-sync will no longer be attempted for this entity"; LOG.error(AaiUiMsgs.ERROR_GENERIC, message); } else { - Integer newCount = new Integer(currentCount.intValue() + 1); + Integer newCount = currentCount + 1; retryLimitTracker.put(id, newCount); } } else { - Integer firstRetryCount = new Integer(1); + Integer firstRetryCount = 1; retryLimitTracker.put(id, firstRetryCount); } diff --git a/sparkybe-onap-service/src/main/java/org/onap/aai/sparky/autosuggestion/sync/AutosuggestionSynchronizer.java b/sparkybe-onap-service/src/main/java/org/onap/aai/sparky/autosuggestion/sync/AutosuggestionSynchronizer.java index 0cb7922..b774f40 100644 --- a/sparkybe-onap-service/src/main/java/org/onap/aai/sparky/autosuggestion/sync/AutosuggestionSynchronizer.java +++ b/sparkybe-onap-service/src/main/java/org/onap/aai/sparky/autosuggestion/sync/AutosuggestionSynchronizer.java @@ -229,7 +229,9 @@ public class AutosuggestionSynchronizer extends AbstractEntitySynchronizer * syncs */ retryLimitTracker.clear(); - + } catch (InterruptedException e) { + // Restore interrupted state... + Thread.currentThread().interrupt(); } catch (Exception exc) { LOG.error(AaiUiMsgs.ERROR_GENERIC, "An error occurred while performing the sync. Error: " + exc.getMessage()); diff --git a/sparkybe-onap-service/src/main/java/org/onap/aai/sparky/autosuggestion/sync/VnfAliasSuggestionSynchronizer.java b/sparkybe-onap-service/src/main/java/org/onap/aai/sparky/autosuggestion/sync/VnfAliasSuggestionSynchronizer.java index 7501e5d..e78760b 100644 --- a/sparkybe-onap-service/src/main/java/org/onap/aai/sparky/autosuggestion/sync/VnfAliasSuggestionSynchronizer.java +++ b/sparkybe-onap-service/src/main/java/org/onap/aai/sparky/autosuggestion/sync/VnfAliasSuggestionSynchronizer.java @@ -101,6 +101,9 @@ public class VnfAliasSuggestionSynchronizer extends AbstractEntitySynchronizer syncEntity(); } Thread.sleep(1000); + } catch (InterruptedException e) { + // Restore interrupted state... + Thread.currentThread().interrupt(); } catch (Exception exc) { // We don't care about this exception } diff --git a/sparkybe-onap-service/src/main/java/org/onap/aai/sparky/crossentityreference/sync/CrossEntityReferenceSynchronizer.java b/sparkybe-onap-service/src/main/java/org/onap/aai/sparky/crossentityreference/sync/CrossEntityReferenceSynchronizer.java index 4b6b7a5..e764e7b 100644 --- a/sparkybe-onap-service/src/main/java/org/onap/aai/sparky/crossentityreference/sync/CrossEntityReferenceSynchronizer.java +++ b/sparkybe-onap-service/src/main/java/org/onap/aai/sparky/crossentityreference/sync/CrossEntityReferenceSynchronizer.java @@ -277,7 +277,9 @@ public class CrossEntityReferenceSynchronizer extends AbstractEntitySynchronizer * syncs */ retryLimitTracker.clear(); - + } catch (InterruptedException e) { + // Restore interrupted state... + Thread.currentThread().interrupt(); } catch (Exception exc) { LOG.error(AaiUiMsgs.ERROR_GENERIC, "An error occurred during entity synchronization. Error: " + exc.getMessage()); diff --git a/sparkybe-onap-service/src/main/java/org/onap/aai/sparky/dal/ActiveInventoryAdapter.java b/sparkybe-onap-service/src/main/java/org/onap/aai/sparky/dal/ActiveInventoryAdapter.java index ebcc56a..96cd44f 100644 --- a/sparkybe-onap-service/src/main/java/org/onap/aai/sparky/dal/ActiveInventoryAdapter.java +++ b/sparkybe-onap-service/src/main/java/org/onap/aai/sparky/dal/ActiveInventoryAdapter.java @@ -354,7 +354,7 @@ public class ActiveInventoryAdapter { // package protected for test classes instead of private OperationResult queryActiveInventory(String url, String acceptContentType, String uiRequestType) { - if (uiRequestType == UI_REQUEST_TYPE) { + if (UI_REQUEST_TYPE.equals(uiRequestType)) { messageHeaders = getMessageHeaders(); } else { messageHeaders = getSyncMessageHeaders(); diff --git a/sparkybe-onap-service/src/main/java/org/onap/aai/sparky/security/filter/CspCookieFilter.java b/sparkybe-onap-service/src/main/java/org/onap/aai/sparky/security/filter/CspCookieFilter.java index 0f58e09..94d9013 100644 --- a/sparkybe-onap-service/src/main/java/org/onap/aai/sparky/security/filter/CspCookieFilter.java +++ b/sparkybe-onap-service/src/main/java/org/onap/aai/sparky/security/filter/CspCookieFilter.java @@ -140,14 +140,16 @@ public class CspCookieFilter implements Filter { * @throws IOException if the properties failed to load. */ private void setConfigurationProperties(FilterConfig filterConfig) throws IOException { - InputStream inputStream = new FileInputStream(SparkyConstants.CONFIG_HOME - + filterConfig.getInitParameter(FILTER_PARAMETER_CONFIG)); - Properties cspProperties = new Properties(); - cspProperties.load(inputStream); - globalLoginUrl = cspProperties.getProperty(PROPERTY_GLOBAL_LOGIN_URL); - applicationId = cspProperties.getProperty(PROPERTY_APPLICATION_ID); - gateKeeperEnvironment = cspProperties.getProperty(PROPERTY_GATEKEEPER_ENVIRONMENT); - redirectDomains = Arrays.asList(cspProperties.getProperty(PROPERTY_REDIRECT_DOMAINS).split(",")); + try (InputStream inputStream = new FileInputStream(SparkyConstants.CONFIG_HOME + + filterConfig.getInitParameter(FILTER_PARAMETER_CONFIG))) { + Properties cspProperties = new Properties(); + cspProperties.load(inputStream); + globalLoginUrl = cspProperties.getProperty(PROPERTY_GLOBAL_LOGIN_URL); + applicationId = cspProperties.getProperty(PROPERTY_APPLICATION_ID); + gateKeeperEnvironment = cspProperties.getProperty(PROPERTY_GATEKEEPER_ENVIRONMENT); + redirectDomains = + Arrays.asList(cspProperties.getProperty(PROPERTY_REDIRECT_DOMAINS).split(",")); + } } /** diff --git a/sparkybe-onap-service/src/main/java/org/onap/aai/sparky/security/portal/PortalRestAPIServiceImpl.java b/sparkybe-onap-service/src/main/java/org/onap/aai/sparky/security/portal/PortalRestAPIServiceImpl.java index 7a71fbc..68c833e 100644 --- a/sparkybe-onap-service/src/main/java/org/onap/aai/sparky/security/portal/PortalRestAPIServiceImpl.java +++ b/sparkybe-onap-service/src/main/java/org/onap/aai/sparky/security/portal/PortalRestAPIServiceImpl.java @@ -93,7 +93,7 @@ public class PortalRestAPIServiceImpl implements IPortalRestAPIService { public void editUser(String loginId, EcompUser user) throws PortalAPIException { LOG.debug("Edit user [loginId:" + loginId + "]"); - userManager.getUser(loginId).orElseThrow(() -> { + EcompUser eUser = userManager.getUser(loginId).orElseThrow(() -> { String message = getMessage(ERROR_MESSAGE, "edit", loginId) + ", unknown user"; LOG.error(message); return new PortalAPIException(message); diff --git a/sparkybe-onap-service/src/main/java/org/onap/aai/sparky/subscription/payload/entity/ObjectInspectorPayload.java b/sparkybe-onap-service/src/main/java/org/onap/aai/sparky/subscription/payload/entity/ObjectInspectorPayload.java index ac925e0..6b10ba5 100644 --- a/sparkybe-onap-service/src/main/java/org/onap/aai/sparky/subscription/payload/entity/ObjectInspectorPayload.java +++ b/sparkybe-onap-service/src/main/java/org/onap/aai/sparky/subscription/payload/entity/ObjectInspectorPayload.java @@ -117,8 +117,7 @@ public class ObjectInspectorPayload { lic.setMessageType(subscriptionConf.getLaunchOIMessageType()); } catch (Exception e) { // TODO Auto-generated catch block - e.printStackTrace(); - } + } } } diff --git a/sparkybe-onap-service/src/main/java/org/onap/aai/sparky/util/ConfigHelper.java b/sparkybe-onap-service/src/main/java/org/onap/aai/sparky/util/ConfigHelper.java index 9f43405..29436f0 100644 --- a/sparkybe-onap-service/src/main/java/org/onap/aai/sparky/util/ConfigHelper.java +++ b/sparkybe-onap-service/src/main/java/org/onap/aai/sparky/util/ConfigHelper.java @@ -77,14 +77,12 @@ public class ConfigHelper { * @throws Exception the exception */ public static Properties loadConfig(String fileName) throws Exception { - String basePath = System.getProperty("user.dir"); - InputStream fileInputStream = new FileInputStream(basePath + "//" + fileName); - - Properties props = new Properties(); - props.load(fileInputStream); - - return props; + try (InputStream fileInputStream = new FileInputStream(basePath + "//" + fileName)) { + Properties props = new Properties(); + props.load(fileInputStream); + return props; + } } /** @@ -96,14 +94,11 @@ public class ConfigHelper { public static Properties loadConfigFromExplicitPath(String fileName) { Properties props = new Properties(); - - try { - InputStream fileInputStream = new FileInputStream(fileName); + try (InputStream fileInputStream = new FileInputStream(fileName)) { props.load(fileInputStream); } catch (Exception exc) { LOG.warn(AaiUiMsgs.CONFIG_NOT_FOUND_VERBOSE, fileName, exc.getLocalizedMessage()); } - return props; } diff --git a/sparkybe-onap-service/src/main/java/org/onap/aai/sparky/util/Encryptor.java b/sparkybe-onap-service/src/main/java/org/onap/aai/sparky/util/Encryptor.java index a239b36..5c09eab 100644 --- a/sparkybe-onap-service/src/main/java/org/onap/aai/sparky/util/Encryptor.java +++ b/sparkybe-onap-service/src/main/java/org/onap/aai/sparky/util/Encryptor.java @@ -36,7 +36,7 @@ import org.onap.aai.sparky.logging.AaiUiMsgs; public class Encryptor { private static final Logger LOG = LoggerFactory.getInstance().getLogger(Encryptor.class); - private static final String PWD_OBFUSCATION_PATTERN = "OBF:"; + private static final String START_OBFUSCATION_PATTERN = "OBF:"; /** * Instantiates a new encryptor. @@ -69,7 +69,7 @@ public class Encryptor { public String decryptValue(String value) { String decyptedValue = ""; try { - decyptedValue = value.startsWith(PWD_OBFUSCATION_PATTERN)? Password.deobfuscate(value) : value; + decyptedValue = value.startsWith(START_OBFUSCATION_PATTERN)? Password.deobfuscate(value) : value; } catch (Exception exc) { LOG.error(AaiUiMsgs.DECRYPTION_ERROR, value, exc.toString()); } diff --git a/sparkybe-onap-service/src/main/java/org/onap/aai/sparky/util/NodeUtils.java b/sparkybe-onap-service/src/main/java/org/onap/aai/sparky/util/NodeUtils.java index 25aa8b4..cce4be8 100644 --- a/sparkybe-onap-service/src/main/java/org/onap/aai/sparky/util/NodeUtils.java +++ b/sparkybe-onap-service/src/main/java/org/onap/aai/sparky/util/NodeUtils.java @@ -71,7 +71,7 @@ public class NodeUtils { private static SecureRandom sRandom = new SecureRandom(); private static final Pattern URL_VERSION_PREFIX = Pattern.compile("/v[0-9]+/(.*)"); - private static final Pattern OXM_VERSION_PREFIX = Pattern.compile(".*_v([0-9]+).*"); + private static final Pattern OXM_VERSION_PREFIX = Pattern.compile(".{0,256}_v([0-9]{1,5})[^_]*"); private static final Pattern GIZMO_VERSION_PREFIX = Pattern.compile("[/]*services/inventory/v[0-9]+/(.*)"); private static final Pattern GIZMO_RELATIONSHIP_VERSION_PREFIX = Pattern.compile("services/inventory/relationships/v[0-9]+/(.*)"); @@ -116,9 +116,8 @@ public class NodeUtils { return null; - } - - + } + public static String extractRawPathWithoutVersion(String selfLinkUri) { try { diff --git a/sparkybe-onap-service/src/main/java/org/onap/aai/sparky/viewandinspect/context/BaseGizmoVisualizationContext.java b/sparkybe-onap-service/src/main/java/org/onap/aai/sparky/viewandinspect/context/BaseGizmoVisualizationContext.java index f058c48..32c97c3 100644 --- a/sparkybe-onap-service/src/main/java/org/onap/aai/sparky/viewandinspect/context/BaseGizmoVisualizationContext.java +++ b/sparkybe-onap-service/src/main/java/org/onap/aai/sparky/viewandinspect/context/BaseGizmoVisualizationContext.java @@ -168,7 +168,6 @@ public class BaseGizmoVisualizationContext implements VisualizationContext { try { gizmoEntity = mapper.readValue(ain.getOpResult().getResult(), GizmoEntity.class); } catch (Exception exc) { - exc.printStackTrace(); LOG.error(AaiUiMsgs.SELF_LINK_JSON_PARSE_ERROR, "Failed to marshal json" + " response str into JsonNode with error, " + exc.getLocalizedMessage()); ain.changeState(NodeProcessingState.ERROR, diff --git a/sparkybe-onap-service/src/main/java/org/onap/aai/sparky/viewandinspect/entity/ActiveInventoryNode.java b/sparkybe-onap-service/src/main/java/org/onap/aai/sparky/viewandinspect/entity/ActiveInventoryNode.java index 1a91a1b..eec9de3 100644 --- a/sparkybe-onap-service/src/main/java/org/onap/aai/sparky/viewandinspect/entity/ActiveInventoryNode.java +++ b/sparkybe-onap-service/src/main/java/org/onap/aai/sparky/viewandinspect/entity/ActiveInventoryNode.java @@ -201,7 +201,7 @@ public class ActiveInventoryNode { public void addQueryParams(Collection<String> params) { - if (params != null & params.size() > 0) { + if (params != null && params.size() > 0) { for (String param : params) { addQueryParam(param); diff --git a/sparkybe-onap-service/src/main/java/org/onap/aai/sparky/viewinspect/sync/ViewInspectEntitySynchronizer.java b/sparkybe-onap-service/src/main/java/org/onap/aai/sparky/viewinspect/sync/ViewInspectEntitySynchronizer.java index bc5e122..0ee7edd 100644 --- a/sparkybe-onap-service/src/main/java/org/onap/aai/sparky/viewinspect/sync/ViewInspectEntitySynchronizer.java +++ b/sparkybe-onap-service/src/main/java/org/onap/aai/sparky/viewinspect/sync/ViewInspectEntitySynchronizer.java @@ -223,7 +223,9 @@ public class ViewInspectEntitySynchronizer extends AbstractEntitySynchronizer * syncs */ retryLimitTracker.clear(); - + } catch (InterruptedException e) { + // Restore interrupted state... + Thread.currentThread().interrupt(); } catch (Exception exc) { // TODO -> LOG, waht should be logged here? } diff --git a/sparkybe-onap-service/src/test/java/org/onap/aai/sparky/dal/NetworkTransactionTest.java b/sparkybe-onap-service/src/test/java/org/onap/aai/sparky/dal/NetworkTransactionTest.java index dd7983c..be023d8 100644 --- a/sparkybe-onap-service/src/test/java/org/onap/aai/sparky/dal/NetworkTransactionTest.java +++ b/sparkybe-onap-service/src/test/java/org/onap/aai/sparky/dal/NetworkTransactionTest.java @@ -22,6 +22,7 @@ package org.onap.aai.sparky.dal; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; @@ -62,7 +63,6 @@ public class NetworkTransactionTest { networkTransaction.setOperationType(HttpMethod.PUT); assertNotNull(networkTransaction.getOperationType()); networkTransaction.setTaskAgeInMs(); - assertNotNull(networkTransaction.getTaskAgeInMs()); networkTransaction.setEntityType("searchedNodeClass"); assertNotNull(networkTransaction.getEntityType()); networkTransaction.setLink("/etc/aaiEntityNodeDescriptors.json"); diff --git a/sparkybe-onap-service/src/test/java/org/onap/aai/sparky/search/EntityTypeSummaryTest.java b/sparkybe-onap-service/src/test/java/org/onap/aai/sparky/search/EntityTypeSummaryTest.java index 68c9e91..1c3b5f4 100644 --- a/sparkybe-onap-service/src/test/java/org/onap/aai/sparky/search/EntityTypeSummaryTest.java +++ b/sparkybe-onap-service/src/test/java/org/onap/aai/sparky/search/EntityTypeSummaryTest.java @@ -21,6 +21,7 @@ package org.onap.aai.sparky.search; +import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import java.util.ArrayList; @@ -48,7 +49,7 @@ public class EntityTypeSummaryTest { public void updateValues() { entityTypeSummaryBucket.setTotalChartHits(8); - assertNotNull(entityTypeSummaryBucket.getTotalChartHits()); + assertEquals(8,entityTypeSummaryBucket.getTotalChartHits()); entityTypeSummaryBucket.setBuckets(bucketList); assertNotNull(entityTypeSummaryBucket.getBuckets()); entityTypeSummaryBucket.addBucket(bucket); diff --git a/sparkybe-onap-service/src/test/java/org/onap/aai/sparky/security/EcompSsoTest.java b/sparkybe-onap-service/src/test/java/org/onap/aai/sparky/security/EcompSsoTest.java index 42ea4a5..ecda59c 100644 --- a/sparkybe-onap-service/src/test/java/org/onap/aai/sparky/security/EcompSsoTest.java +++ b/sparkybe-onap-service/src/test/java/org/onap/aai/sparky/security/EcompSsoTest.java @@ -34,6 +34,7 @@ import javax.servlet.http.HttpServletRequest; import java.util.ArrayList; import static org.junit.Assert.*; +import static org.junit.Assert.assertNull; public class EcompSsoTest { @@ -53,7 +54,7 @@ public class EcompSsoTest { Mockito.when(portalRestCentralServiceImpl.getUserRoles(Mockito.anyString())) .thenReturn(new ArrayList<EcompRole>()); - assertNotNull(ecompSso.validateUserAccess("ui_view")); + assertFalse(ecompSso.validateUserAccess("ui_view")); } @Test @@ -67,6 +68,7 @@ public class EcompSsoTest { HttpServletRequest request = Mockito.mock(HttpServletRequest.class); Mockito.when(request.getCookies()).thenReturn(cookies); Cookie result = EcompSso.getCookie(request, testCookieName + "1"); + assertNotNull(result); assertEquals(cookie1.getName(), result.getName()); assertEquals(cookie1.getValue(), result.getValue()); assertNull(EcompSso.getCookie(request, testCookieName + "3")); diff --git a/sparkybe-onap-service/src/test/java/org/onap/aai/sparky/sync/config/SyncControllerConfigTest.java b/sparkybe-onap-service/src/test/java/org/onap/aai/sparky/sync/config/SyncControllerConfigTest.java index d94e8c4..94529c7 100644 --- a/sparkybe-onap-service/src/test/java/org/onap/aai/sparky/sync/config/SyncControllerConfigTest.java +++ b/sparkybe-onap-service/src/test/java/org/onap/aai/sparky/sync/config/SyncControllerConfigTest.java @@ -45,11 +45,6 @@ public class SyncControllerConfigTest { @Test public void updateValues() { - - - - - syncControllerConfig.setNumInternalSyncWorkers(3); assertEquals(3,syncControllerConfig.getNumInternalSyncWorkers()); syncControllerConfig.setNumSyncElasticWorkers(5); @@ -72,7 +67,7 @@ public class SyncControllerConfigTest { assertTrue(syncControllerConfig.isRunOnceSyncEnabled()); syncControllerConfig.setPeriodicSyncEnabled(true); assertTrue(syncControllerConfig.isPeriodicSyncEnabled()); - assertNotNull(syncControllerConfig.getSyncFrequencyInMs()); + assertEquals(259200000,syncControllerConfig.getSyncFrequencyInMs()); assertNotNull(syncControllerConfig.getTargetSyncTime()); assertNotNull(syncControllerConfig.getNextSyncTime()); syncControllerConfig.setTimeZoneOfSyncStartTimeStamp("UTC+00:00"); diff --git a/sparkybe-onap-service/src/test/java/org/onap/aai/sparky/synchronizer/TestSyncController.java b/sparkybe-onap-service/src/test/java/org/onap/aai/sparky/synchronizer/TestSyncController.java index 9e1e9e8..ae40e06 100644 --- a/sparkybe-onap-service/src/test/java/org/onap/aai/sparky/synchronizer/TestSyncController.java +++ b/sparkybe-onap-service/src/test/java/org/onap/aai/sparky/synchronizer/TestSyncController.java @@ -68,7 +68,7 @@ public class TestSyncController implements SyncController { Thread.sleep(10000L); } catch (InterruptedException e) { // TODO Auto-generated catch block - e.printStackTrace(); + Thread.currentThread().interrupt(); } System.out.println("Sync done with thread = " + Thread.currentThread().getName() diff --git a/sparkybe-onap-service/src/test/java/org/onap/aai/sparky/util/NodeUtilsTest.java b/sparkybe-onap-service/src/test/java/org/onap/aai/sparky/util/NodeUtilsTest.java index 6263e28..e24d164 100644 --- a/sparkybe-onap-service/src/test/java/org/onap/aai/sparky/util/NodeUtilsTest.java +++ b/sparkybe-onap-service/src/test/java/org/onap/aai/sparky/util/NodeUtilsTest.java @@ -21,6 +21,7 @@ package org.onap.aai.sparky.util; +import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; @@ -58,7 +59,7 @@ public class NodeUtilsTest { assertNotNull(nodeUtils.buildDepthPadding(2)); - assertNotNull(nodeUtils.isNumeric("234")); + assertTrue(nodeUtils.isNumeric("234")); assertNull(nodeUtils.calculateEditAttributeUri(null)); assertNotNull(nodeUtils.generateUniqueShaDigest("unique-101")); assertNull(nodeUtils.getNodeFieldAsText(jsonNode,"")); @@ -77,4 +78,15 @@ public class NodeUtilsTest { } + + @Test + public void extractOxmVersionFromPath() { + assertEquals("8",NodeUtils.extractOxmVersionFromPath("test_oxm_v8.xml")); + assertEquals("9",NodeUtils.extractOxmVersionFromPath("test_oxm_v9.xml")); + assertEquals("11",NodeUtils.extractOxmVersionFromPath("test_oxm_v11.xml")); + assertEquals("11",NodeUtils.extractOxmVersionFromPath("test_oxm_v11.json")); + assertEquals("11",NodeUtils.extractOxmVersionFromPath("test_oxm_v11other.json")); + assertEquals("11",NodeUtils.extractOxmVersionFromPath("/path_v10/test_oxm_v11.xml")); + assertEquals("11",NodeUtils.extractOxmVersionFromPath("\\pathv10\\test_oxm_v11.xml")); + } } |