Code Review
/
integration
/
csit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Adding owning-entity endpoint
[integration/csit.git]
/
plans
/
so
/
integration-etsi-testing
/
so-simulators
/
aai-simulator
/
src
/
main
/
java
/
org
/
onap
/
so
/
aai
/
simulator
/
service
/
providers
/
ProjectCacheServiceProviderImpl.java
diff --git
a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aai/simulator/service/providers/ProjectCacheServiceProviderImpl.java
b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aai/simulator/service/providers/ProjectCacheServiceProviderImpl.java
index
a104788
..
4fca311
100644
(file)
--- a/
plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aai/simulator/service/providers/ProjectCacheServiceProviderImpl.java
+++ b/
plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aai/simulator/service/providers/ProjectCacheServiceProviderImpl.java
@@
-22,7
+22,6
@@
package org.onap.so.aai.simulator.service.providers;
import static org.onap.so.aai.simulator.utils.Constants.PROJECT_CACHE;
import static org.onap.so.aai.simulator.utils.Constants.SERVICE_RESOURCE_TYPE;
import java.util.Optional;
import static org.onap.so.aai.simulator.utils.Constants.PROJECT_CACHE;
import static org.onap.so.aai.simulator.utils.Constants.SERVICE_RESOURCE_TYPE;
import java.util.Optional;
-import java.util.concurrent.ConcurrentHashMap;
import org.onap.aai.domain.yang.Project;
import org.onap.aai.domain.yang.Relationship;
import org.onap.aai.domain.yang.RelationshipList;
import org.onap.aai.domain.yang.Project;
import org.onap.aai.domain.yang.Relationship;
import org.onap.aai.domain.yang.RelationshipList;
@@
-38,23
+37,23
@@
import org.springframework.stereotype.Service;
*
*/
@Service
*
*/
@Service
-public class ProjectCacheServiceProviderImpl implements ProjectCacheServiceProvider {
+public class ProjectCacheServiceProviderImpl extends AbstractCacheServiceProvider
+ implements ProjectCacheServiceProvider {
private static final String RELATIONSHIPS_LABEL = "org.onap.relationships.inventory.Uses";
private static final Logger LOGGER = LoggerFactory.getLogger(ProjectCacheServiceProviderImpl.class);
private static final String RELATIONSHIPS_LABEL = "org.onap.relationships.inventory.Uses";
private static final Logger LOGGER = LoggerFactory.getLogger(ProjectCacheServiceProviderImpl.class);
- public final CacheManager cacheManager;
@Autowired
public ProjectCacheServiceProviderImpl(final CacheManager cacheManager) {
@Autowired
public ProjectCacheServiceProviderImpl(final CacheManager cacheManager) {
-
this.cacheManager = cacheManager
;
+
super(cacheManager)
;
}
@Override
public void putProject(final String projectName, final Project project) {
LOGGER.info("Adding project: {} with name to cache", project, projectName);
}
@Override
public void putProject(final String projectName, final Project project) {
LOGGER.info("Adding project: {} with name to cache", project, projectName);
- final Cache cache =
cacheManager.
getCache(PROJECT_CACHE);
+ final Cache cache = getCache(PROJECT_CACHE);
cache.put(projectName, project);
}
cache.put(projectName, project);
}
@@
-62,7
+61,7
@@
public class ProjectCacheServiceProviderImpl implements ProjectCacheServiceProvi
@Override
public Optional<Project> getProject(final String projectName) {
LOGGER.info("getting project from cache using key: {}", projectName);
@Override
public Optional<Project> getProject(final String projectName) {
LOGGER.info("getting project from cache using key: {}", projectName);
- final Cache cache =
cacheManager.
getCache(PROJECT_CACHE);
+ final Cache cache = getCache(PROJECT_CACHE);
final Project value = cache.get(projectName, Project.class);
if (value != null) {
return Optional.of(value);
final Project value = cache.get(projectName, Project.class);
if (value != null) {
return Optional.of(value);
@@
-72,7
+71,7
@@
public class ProjectCacheServiceProviderImpl implements ProjectCacheServiceProvi
@Override
public boolean putProjectRelationShip(final String projectName, final Relationship relationship) {
@Override
public boolean putProjectRelationShip(final String projectName, final Relationship relationship) {
- final Cache cache =
cacheManager.
getCache(PROJECT_CACHE);
+ final Cache cache = getCache(PROJECT_CACHE);
final Project value = cache.get(projectName, Project.class);
if (value != null) {
RelationshipList relationshipList = value.getRelationshipList();
final Project value = cache.get(projectName, Project.class);
if (value != null) {
RelationshipList relationshipList = value.getRelationshipList();
@@
-90,15
+89,13
@@
public class ProjectCacheServiceProviderImpl implements ProjectCacheServiceProvi
return relationshipList.getRelationship().add(relationship);
}
return relationshipList.getRelationship().add(relationship);
}
+ LOGGER.error("Project not found in cache for {}", projectName);
return false;
}
@Override
public void clearAll() {
return false;
}
@Override
public void clearAll() {
- final Cache cache = cacheManager.getCache(PROJECT_CACHE);
- final ConcurrentHashMap<?, ?> nativeCache = (ConcurrentHashMap<?, ?>) cache.getNativeCache();
- LOGGER.info("Clear all entries from cahce: {}", cache.getName());
- nativeCache.clear();
+ clearCahce(PROJECT_CACHE);
}
}
}
}