summaryrefslogtreecommitdiffstats
path: root/cps-ncmp-service
diff options
context:
space:
mode:
Diffstat (limited to 'cps-ncmp-service')
-rw-r--r--cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/config/embeddedcache/SynchronizationCacheConfig.java13
-rw-r--r--cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/event/avc/ForwardedSubscriptionEventCacheConfig.java3
-rw-r--r--cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/config/embeddedcache/SynchronizationCacheConfigSpec.groovy26
-rw-r--r--cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/event/avc/ForwardedSubscriptionEventCacheConfigSpec.groovy8
-rw-r--r--cps-ncmp-service/src/test/resources/application.yml1
5 files changed, 28 insertions, 23 deletions
diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/config/embeddedcache/SynchronizationCacheConfig.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/config/embeddedcache/SynchronizationCacheConfig.java
index ff7afc9eb7..62a380ca5c 100644
--- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/config/embeddedcache/SynchronizationCacheConfig.java
+++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/config/embeddedcache/SynchronizationCacheConfig.java
@@ -51,9 +51,7 @@ public class SynchronizationCacheConfig extends HazelcastCacheConfig {
*/
@Bean
public BlockingQueue<DataNode> moduleSyncWorkQueue() {
- return createHazelcastInstance("moduleSyncWorkQueue", commonQueueConfig,
- "synchronization-caches")
- .getQueue("moduleSyncWorkQueue");
+ return createHazelcastInstance("moduleSyncWorkQueue", commonQueueConfig).getQueue("moduleSyncWorkQueue");
}
/**
@@ -63,9 +61,8 @@ public class SynchronizationCacheConfig extends HazelcastCacheConfig {
*/
@Bean
public IMap<String, Object> moduleSyncStartedOnCmHandles() {
- return createHazelcastInstance("moduleSyncStartedOnCmHandles", moduleSyncStartedConfig,
- "synchronization-caches")
- .getMap("moduleSyncStartedOnCmHandles");
+ return createHazelcastInstance("moduleSyncStartedOnCmHandles", moduleSyncStartedConfig).getMap(
+ "moduleSyncStartedOnCmHandles");
}
/**
@@ -75,8 +72,6 @@ public class SynchronizationCacheConfig extends HazelcastCacheConfig {
*/
@Bean
public IMap<String, Boolean> dataSyncSemaphores() {
- return createHazelcastInstance("dataSyncSemaphores", dataSyncSemaphoresConfig,
- "synchronization-caches")
- .getMap("dataSyncSemaphores");
+ return createHazelcastInstance("dataSyncSemaphores", dataSyncSemaphoresConfig).getMap("dataSyncSemaphores");
}
}
diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/event/avc/ForwardedSubscriptionEventCacheConfig.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/event/avc/ForwardedSubscriptionEventCacheConfig.java
index d2c3dc2599..443ebc627a 100644
--- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/event/avc/ForwardedSubscriptionEventCacheConfig.java
+++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/event/avc/ForwardedSubscriptionEventCacheConfig.java
@@ -45,7 +45,6 @@ public class ForwardedSubscriptionEventCacheConfig extends HazelcastCacheConfig
@Bean
public IMap<String, Set<String>> forwardedSubscriptionEventCache() {
return createHazelcastInstance("hazelCastInstanceSubscriptionEvents",
- forwardedSubscriptionEventCacheMapConfig, "cps-ncmp-service-caches")
- .getMap("forwardedSubscriptionEventCache");
+ forwardedSubscriptionEventCacheMapConfig).getMap("forwardedSubscriptionEventCache");
}
}
diff --git a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/config/embeddedcache/SynchronizationCacheConfigSpec.groovy b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/config/embeddedcache/SynchronizationCacheConfigSpec.groovy
index 567debdded..c0fc18abfc 100644
--- a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/config/embeddedcache/SynchronizationCacheConfigSpec.groovy
+++ b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/config/embeddedcache/SynchronizationCacheConfigSpec.groovy
@@ -59,20 +59,28 @@ class SynchronizationCacheConfigSpec extends Specification {
def 'Verify configs for Distributed objects'(){
given: 'the Module Sync Work Queue config'
- def queueConfig = Hazelcast.getHazelcastInstanceByName('moduleSyncWorkQueue').config.queueConfigs.get('defaultQueueConfig')
+ def moduleSyncWorkQueueConfig = Hazelcast.getHazelcastInstanceByName('moduleSyncWorkQueue').config
+ def moduleSyncDefaultWorkQueueConfig = moduleSyncWorkQueueConfig.queueConfigs.get('defaultQueueConfig')
and: 'the Module Sync Started Cm Handle Map config'
- def moduleSyncStartedOnCmHandlesConfig = Hazelcast.getHazelcastInstanceByName('moduleSyncStartedOnCmHandles').config.mapConfigs.get('moduleSyncStartedConfig')
+ def moduleSyncStartedOnCmHandlesConfig = Hazelcast.getHazelcastInstanceByName('moduleSyncStartedOnCmHandles').config
+ def moduleSyncStartedOnCmHandlesMapConfig = moduleSyncStartedOnCmHandlesConfig.mapConfigs.get('moduleSyncStartedConfig')
and: 'the Data Sync Semaphores Map config'
- def dataSyncSemaphoresConfig = Hazelcast.getHazelcastInstanceByName('dataSyncSemaphores').config.mapConfigs.get('dataSyncSemaphoresConfig')
+ def dataSyncSemaphoresConfig = Hazelcast.getHazelcastInstanceByName('dataSyncSemaphores').config
+ def dataSyncSemaphoresMapConfig = dataSyncSemaphoresConfig.mapConfigs.get('dataSyncSemaphoresConfig')
expect: 'system created instance with correct config of Module Sync Work Queue'
- assert queueConfig.backupCount == 3
- assert queueConfig.asyncBackupCount == 3
+ assert moduleSyncDefaultWorkQueueConfig.backupCount == 3
+ assert moduleSyncDefaultWorkQueueConfig.asyncBackupCount == 3
and: 'Module Sync Started Cm Handle Map has the correct settings'
- assert moduleSyncStartedOnCmHandlesConfig.backupCount == 3
- assert moduleSyncStartedOnCmHandlesConfig.asyncBackupCount == 3
+ assert moduleSyncStartedOnCmHandlesMapConfig.backupCount == 3
+ assert moduleSyncStartedOnCmHandlesMapConfig.asyncBackupCount == 3
and: 'Data Sync Semaphore Map has the correct settings'
- assert dataSyncSemaphoresConfig.backupCount == 3
- assert dataSyncSemaphoresConfig.asyncBackupCount == 3
+ assert dataSyncSemaphoresMapConfig.backupCount == 3
+ assert dataSyncSemaphoresMapConfig.asyncBackupCount == 3
+ and: 'all instances are part of same cluster'
+ def testClusterName = 'cps-and-ncmp-test-caches'
+ assert moduleSyncWorkQueueConfig.clusterName == testClusterName
+ assert moduleSyncStartedOnCmHandlesConfig.clusterName == testClusterName
+ assert dataSyncSemaphoresConfig.clusterName == testClusterName
}
def 'Verify deployment network configs for Distributed objects'() {
diff --git a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/event/avc/ForwardedSubscriptionEventCacheConfigSpec.groovy b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/event/avc/ForwardedSubscriptionEventCacheConfigSpec.groovy
index 7448daf598..03d3a1c105 100644
--- a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/event/avc/ForwardedSubscriptionEventCacheConfigSpec.groovy
+++ b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/event/avc/ForwardedSubscriptionEventCacheConfigSpec.groovy
@@ -44,10 +44,12 @@ class ForwardedSubscriptionEventCacheConfigSpec extends Specification {
def 'Verify configs for Distributed Caches'(){
given: 'the Forwarded Subscription Event Cache config'
- def forwardedSubscriptionEventCacheConfig = Hazelcast.getHazelcastInstanceByName('hazelCastInstanceSubscriptionEvents').config.mapConfigs.get('forwardedSubscriptionEventCacheMapConfig')
+ def forwardedSubscriptionEventCacheConfig = Hazelcast.getHazelcastInstanceByName('hazelCastInstanceSubscriptionEvents').config
+ def forwardedSubscriptionEventCacheMapConfig = forwardedSubscriptionEventCacheConfig.mapConfigs.get('forwardedSubscriptionEventCacheMapConfig')
expect: 'system created instance with correct config'
- assert forwardedSubscriptionEventCacheConfig.backupCount == 3
- assert forwardedSubscriptionEventCacheConfig.asyncBackupCount == 3
+ assert forwardedSubscriptionEventCacheConfig.clusterName == 'cps-and-ncmp-test-caches'
+ assert forwardedSubscriptionEventCacheMapConfig.backupCount == 3
+ assert forwardedSubscriptionEventCacheMapConfig.asyncBackupCount == 3
}
def 'Verify deployment network configs for Distributed Caches'() {
diff --git a/cps-ncmp-service/src/test/resources/application.yml b/cps-ncmp-service/src/test/resources/application.yml
index 679248ba86..66194ad9e5 100644
--- a/cps-ncmp-service/src/test/resources/application.yml
+++ b/cps-ncmp-service/src/test/resources/application.yml
@@ -39,6 +39,7 @@ ncmp:
# Custom Hazelcast Config.
hazelcast:
+ cluster-name: "cps-and-ncmp-test-caches"
mode:
kubernetes:
enabled: false