import static org.onap.cps.ncmp.impl.inventory.NcmpPersistence.NCMP_DMI_REGISTRY_ANCHOR;
import static org.onap.cps.ncmp.impl.inventory.NcmpPersistence.NCMP_DMI_REGISTRY_PARENT;
-import com.hazelcast.map.IMap;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
private final CpsQueryService cpsQueryService;
@Qualifier(TrustLevelCacheConfig.TRUST_LEVEL_PER_DMI_PLUGIN)
- private final IMap<String, TrustLevel> trustLevelPerDmiPlugin;
+ private final Map<String, TrustLevel> trustLevelPerDmiPlugin;
@Qualifier(TrustLevelCacheConfig.TRUST_LEVEL_PER_CM_HANDLE)
- private final IMap<String, TrustLevel> trustLevelPerCmHandleId;
+ private final Map<String, TrustLevel> trustLevelPerCmHandleId;
private final CpsValidator cpsValidator;
private void removeDeletedCmHandleFromModuleSyncMap(final String cmHandleId) {
if (moduleSyncStartedOnCmHandles.containsKey(cmHandleId)) {
moduleSyncStartedOnCmHandles.removeAsync(cmHandleId);
- log.debug("{} removed from in progress map", cmHandleId);
+ log.debug("{} will be removed asynchronously from in progress map", cmHandleId);
}
}
private void removeResetCmHandleFromModuleSyncMap(final String resetCmHandleId) {
if (moduleSyncStartedOnCmHandles.containsKey(resetCmHandleId)) {
moduleSyncStartedOnCmHandles.removeAsync(resetCmHandleId);
- log.info("{} removed from in progress map", resetCmHandleId);
+ log.info("{} will be removed asynchronously from in progress map", resetCmHandleId);
}
}
package org.onap.cps.ncmp.impl.inventory.trustlevel;
-import com.hazelcast.map.IMap;
import java.util.Collection;
+import java.util.Map;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.onap.cps.ncmp.api.inventory.models.TrustLevel;
private final TrustLevelManager trustLevelManager;
@Qualifier(TrustLevelCacheConfig.TRUST_LEVEL_PER_DMI_PLUGIN)
- private final IMap<String, TrustLevel> trustLevelPerDmiPlugin;
+ private final Map<String, TrustLevel> trustLevelPerDmiPlugin;
/**
* This class monitors the trust level of all DMI plugin by checking the health status
public static final String TRUST_LEVEL_PER_DMI_PLUGIN = "trustLevelPerDmiPlugin";
public static final String TRUST_LEVEL_PER_CM_HANDLE = "trustLevelPerCmHandle";
- private static final MapConfig trustLevelPerCmHandleIdCacheConfig =
+ private static final MapConfig trustLevelPerCmHandleIdNearCacheConfig =
createNearCacheMapConfig("trustLevelPerCmHandleCacheConfig");
private static final MapConfig trustLevelPerDmiPluginCacheConfig =
*/
@Bean(TRUST_LEVEL_PER_CM_HANDLE)
public IMap<String, TrustLevel> trustLevelPerCmHandleId() {
- return getOrCreateHazelcastInstance(trustLevelPerCmHandleIdCacheConfig).getMap(TRUST_LEVEL_PER_CM_HANDLE);
+ return getOrCreateHazelcastInstance(trustLevelPerCmHandleIdNearCacheConfig).getMap(TRUST_LEVEL_PER_CM_HANDLE);
}
/**
def mockCpsQueryService = Mock(CpsQueryService)
def mockCpsDataService = Mock(CpsDataService)
- def trustLevelPerDmiPlugin = HazelcastInstanceFactory
- .getOrCreateHazelcastInstance(new Config('hazelcastInstanceName'))
- .getMap('trustLevelPerDmiPlugin')
- def trustLevelPerCmHandleId = HazelcastInstanceFactory
- .getOrCreateHazelcastInstance(new Config('hazelcastInstanceName'))
- .getMap('trustLevelPerCmHandleId')
+ def trustLevelPerDmiPlugin = HazelcastInstanceFactory.getOrCreateHazelcastInstance(new Config('hazelcastInstanceName')).getMap('trustLevelPerDmiPlugin')
+ def trustLevelPerCmHandleId = HazelcastInstanceFactory.getOrCreateHazelcastInstance(new Config('hazelcastInstanceName')).getMap('trustLevelPerCmHandleId')
def mockCpsValidator = Mock(CpsValidator)
-
- def objectUnderTest = new CmHandleQueryServiceImpl(mockCpsDataService, mockCpsQueryService,
- trustLevelPerDmiPlugin, trustLevelPerCmHandleId, mockCpsValidator)
-
+ def objectUnderTest = new CmHandleQueryServiceImpl(mockCpsDataService, mockCpsQueryService, trustLevelPerDmiPlugin, trustLevelPerCmHandleId, mockCpsValidator)
def static sampleDataNodes = [new DataNode(xpath: "/dmi-registry/cm-handles[@id='ch-1']"),
new DataNode(xpath: "/dmi-registry/cm-handles[@id='ch-2']")]
mockInventoryPersistence.getYangModelCmHandle('cmhandle-3') >> new YangModelCmHandle(id: 'cmhandle-3', moduleSetTag: '', compositeState: new CompositeState(cmHandleState: CmHandleState.READY))
and: 'cm handle is in READY state'
mockCmHandleQueries.cmHandleHasState('cmhandle-3', CmHandleState.READY) >> true
- and: 'cm handle to be removed is in progress map'
+ and: 'cm handles is present in in-progress map'
mockModuleSyncStartedOnCmHandles.containsKey('cmhandle-2') >> true
when: 'registration is processed'
objectUnderTest.updateDmiRegistration(dmiRegistration)
and: 'successfully de-registered cm handle 3 is removed from in progress map even though it was already being removed'
1 * mockModuleSyncStartedOnCmHandles.removeAsync('cmhandle3')
and: 'failed de-registered cm handle entries should NOT be removed from in progress map'
- 0 * mockModuleSyncStartedOnCmHandles.containsKey('cmhandle2')
0 * mockModuleSyncStartedOnCmHandles.removeAsync('cmhandle2')
and: '1st and 3rd cm-handle deletes successfully'
with(response.removedCmHandles[0]) {
def loggingEvent = getLoggingEvent()
assert loggingEvent.level == Level.INFO
and: 'the log indicates the cm handle entry is removed successfully'
- assert loggingEvent.formattedMessage == 'ch-1 removed from in progress map'
+ assert loggingEvent.formattedMessage == 'ch-1 will be removed asynchronously from in progress map'
}
def 'Sync and upgrade CM handle if in upgrade state for #scenario'() {