UCD loading fixed MongoId in live Map
This commit is contained in:
parent
8eb1cd3f9d
commit
3d3f618f50
|
@ -54,7 +54,7 @@ public class SingleISResourceUCDProvider extends AbstractScopedMap<ProfileMap> i
|
|||
|
||||
public SingleISResourceUCDProvider() {
|
||||
super("Single IS Resource UCD Provider");
|
||||
setTTL(Duration.of(2, ChronoUnit.MINUTES));
|
||||
setTTL(Duration.of(1, ChronoUnit.MICROS)); // no cache
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -5,6 +5,7 @@ import org.gcube.application.cms.caches.AbstractScopedMap;
|
|||
import org.gcube.application.cms.caches.Engine;
|
||||
import org.gcube.application.cms.caches.ObjectManager;
|
||||
import org.gcube.application.cms.implementations.ImplementationProvider;
|
||||
import org.gcube.application.cms.serialization.Serialization;
|
||||
import org.gcube.application.geoportal.common.model.rest.ConfigurationException;
|
||||
import org.gcube.application.geoportal.common.model.rest.QueryRequest;
|
||||
import org.gcube.application.geoportal.common.model.useCaseDescriptor.UseCaseDescriptor;
|
||||
|
@ -48,7 +49,7 @@ public class UCDManager extends AbstractScopedMap<UCDManagerI> implements UCDMan
|
|||
|
||||
public UCDManager() {
|
||||
super("UCD MANAGER");
|
||||
setTTL(Duration.of(1, ChronoUnit.MINUTES));
|
||||
setTTL(Duration.of(2, ChronoUnit.MINUTES));
|
||||
}
|
||||
|
||||
|
||||
|
@ -186,11 +187,13 @@ public class UCDManager extends AbstractScopedMap<UCDManagerI> implements UCDMan
|
|||
final UCDMongoManager manager = getMongoManager();
|
||||
manager.deleteAll();
|
||||
memCache.clear();
|
||||
|
||||
ProfileMap liveMap=ImplementationProvider.get().getProvidedObjectByClass(ProfileMap.class);
|
||||
Engine<ProfileMap> liveMapProvider =ImplementationProvider.get().getEngineByManagedClass(ProfileMap.class);
|
||||
log.trace("LiveMap Provider class is {} ",liveMapProvider.getClass());
|
||||
ProfileMap liveMap= liveMapProvider.getObject();
|
||||
log.debug("LiveMap size is {} ",liveMap.size());
|
||||
for (Map.Entry<String, UseCaseDescriptor> entry : liveMap.entrySet()) {
|
||||
UseCaseDescriptor useCaseDescriptor = entry.getValue();
|
||||
// Copying object so we don't alter live Map
|
||||
UseCaseDescriptor useCaseDescriptor = Serialization.convert(entry.getValue(),UseCaseDescriptor.class);
|
||||
try {
|
||||
log.debug("Updateing cache with {}, mongo id is {}", useCaseDescriptor.getId(),useCaseDescriptor.getMongoId());
|
||||
if(useCaseDescriptor.getMongoId()!=null){
|
||||
|
|
|
@ -40,6 +40,14 @@ public class UCDLoadingTest {
|
|||
TokenSetter.set(GCubeTest.getContext());
|
||||
SingleISResourceUCDProvider provider = new SingleISResourceUCDProvider();
|
||||
ProfileMap map = provider.getObject();
|
||||
map.forEach((s, useCaseDescriptor) -> {
|
||||
System.out.println("Checking "+s);
|
||||
assertNotNull(useCaseDescriptor);
|
||||
assertNotNull(useCaseDescriptor.getId());
|
||||
assertNull(useCaseDescriptor.getMongoId());
|
||||
assertNotNull(useCaseDescriptor.getDataAccessPolicies());
|
||||
assertNotNull(useCaseDescriptor.getHandlers());
|
||||
});
|
||||
System.out.println("UCIDs IN "+GCubeTest.getContext()+": "+map.keySet());
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue