Bugfixing
This commit is contained in:
parent
3ae21711f9
commit
085074740a
|
@ -48,8 +48,8 @@ public abstract class TimedMap <K,V> implements Cache<K,V> {
|
|||
scopeMap.put(key, newer);
|
||||
found=scopeMap.get(key);
|
||||
}
|
||||
}else {log.debug(name+" : TTL is null, never disposing..");}
|
||||
log.debug(name+"Returning {} ",found);
|
||||
}else {log.trace(name+" : TTL is null, never disposing..");}
|
||||
log.trace(name+"Returning {} ",found);
|
||||
return found.getTheObject();
|
||||
}
|
||||
|
||||
|
|
|
@ -6,6 +6,8 @@ import org.gcube.application.cms.caches.Cache;
|
|||
import org.gcube.application.cms.caches.Engine;
|
||||
import org.gcube.application.geoportal.common.model.rest.ConfigurationException;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
public class ImplementationProvider {
|
||||
|
@ -36,4 +38,11 @@ public class ImplementationProvider {
|
|||
//Defaults
|
||||
setEngine(new DefaultISProvider(),ISInterface.class);
|
||||
}
|
||||
public Map<Class,String> getManagerList(){
|
||||
HashMap<Class,String> toReturn=new HashMap<>();
|
||||
implementationsRegistry.forEach(
|
||||
(aClass, engine) -> {toReturn.put(engine.getClass(),aClass.getCanonicalName());}
|
||||
);
|
||||
return toReturn;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -177,6 +177,7 @@ public abstract class AbstractLifeCycleManager extends AbstractPlugin implements
|
|||
@Override
|
||||
public EventExecutionReport onEvent(EventExecutionRequest request) throws EventException, InvalidPluginRequestException {
|
||||
EventExecutionReport report=new EventExecutionReport(request);
|
||||
report.getToSetLifecycleInformation().addEventReport(new TriggeredEvents());
|
||||
TriggeredEvents info = report.getToSetLifecycleInformation().getLastEvent();
|
||||
try {
|
||||
if(!registeredEvent.containsKey(request.getEvent()))
|
||||
|
|
|
@ -11,6 +11,7 @@ public class EventExecutionReport extends DocumentHandlingReport<EventExecutionR
|
|||
public EventExecutionReport(EventExecutionRequest req) throws InvalidPluginRequestException {
|
||||
super(req);
|
||||
this.setToSetLifecycleInformation(theRequest.getDocument().getLifecycleInformation().cleanState());
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -65,7 +65,6 @@ public class UseCaseDescriptor {
|
|||
* Returns map Type -> Handler Declaration
|
||||
* @return
|
||||
*/
|
||||
|
||||
@JsonIgnore
|
||||
public Map<String,List<HandlerDeclaration>> getHandlersMapByType(){
|
||||
HashMap<String,List<HandlerDeclaration>> toReturn=new HashMap<>();
|
||||
|
@ -100,6 +99,7 @@ public class UseCaseDescriptor {
|
|||
@JsonIgnore
|
||||
public DataAccessPolicy getMatching(User u){
|
||||
DataAccessPolicy defaultPolicy = null;
|
||||
if(dataAccessPolicies!=null)
|
||||
for (DataAccessPolicy dataAccessPolicy : dataAccessPolicies) {
|
||||
if(dataAccessPolicy.getRoles()==null||dataAccessPolicy.getRoles().isEmpty())
|
||||
defaultPolicy= dataAccessPolicy;
|
||||
|
|
|
@ -15,12 +15,12 @@ public class ContextUtils {
|
|||
public static String getCurrentScope(){
|
||||
try{
|
||||
String token=SecurityTokenProvider.instance.get();
|
||||
log.debug("Token is : "+token.substring(0,2)+"..."+token.substring(token.length()-3));
|
||||
log.trace("Token is : "+token.substring(0,2)+"..."+token.substring(token.length()-3));
|
||||
if(token==null) throw new Exception("Security Token is null");
|
||||
AuthorizationEntry entry = authorizationService().get(token);
|
||||
return entry.getContext();
|
||||
}catch(Exception e ){
|
||||
log.debug("Unable to resolve token, checking scope provider..",e);
|
||||
log.trace("Unable to resolve token, checking scope provider..",e);
|
||||
return ScopeProvider.instance.get();
|
||||
}
|
||||
}
|
||||
|
@ -29,12 +29,12 @@ public class ContextUtils {
|
|||
public static String getCurrentCaller(){
|
||||
try{
|
||||
String token=SecurityTokenProvider.instance.get();
|
||||
log.debug("Token is : "+token.substring(0,2)+"..."+token.substring(token.length()-3));
|
||||
log.trace("Token is : "+token.substring(0,2)+"..."+token.substring(token.length()-3));
|
||||
if(token==null) throw new Exception("Security Token is null");
|
||||
AuthorizationEntry entry = authorizationService().get(token);
|
||||
return entry.getClientInfo().getId();
|
||||
}catch(Exception e ){
|
||||
log.debug("Unable to resolve token, checking scope provider..",e);
|
||||
log.trace("Unable to resolve token, checking scope provider..",e);
|
||||
return "Unidentified data-transfer user";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ public class GCubeTest {
|
|||
}
|
||||
|
||||
|
||||
// testContext = "/pred4s/preprod/preVRE";
|
||||
// testContext = "/pred4s/preprod/preVRE";
|
||||
testContext = "/gcube/devsec/devVRE";
|
||||
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ package org.gcube.application.geoportal.service;
|
|||
|
||||
import com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.gcube.application.cms.caches.Engine;
|
||||
import org.gcube.application.cms.implementations.ImplementationProvider;
|
||||
import org.gcube.application.geoportal.common.rest.InterfaceConstants;
|
||||
import org.gcube.application.geoportal.common.utils.StorageUtils;
|
||||
|
@ -20,20 +21,25 @@ import org.gcube.application.geoportal.service.rest.ProfiledDocuments;
|
|||
import org.gcube.application.cms.serialization.Serialization;
|
||||
import org.gcube.application.geoportal.service.rest.UseCaseDescriptors;
|
||||
import org.gcube.common.storagehub.client.dsl.StorageHubClient;
|
||||
import org.geotoolkit.internal.sql.table.Entry;
|
||||
import org.glassfish.jersey.server.ResourceConfig;
|
||||
|
||||
import javax.ws.rs.ApplicationPath;
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
|
||||
@ApplicationPath(InterfaceConstants.APPLICATION_PATH)
|
||||
@Slf4j
|
||||
public class GeoPortalService extends ResourceConfig{
|
||||
|
||||
|
||||
public <T> Map<Engine<T>,Class<T>> customImplementations(){
|
||||
return Collections.EMPTY_MAP;
|
||||
}
|
||||
|
||||
public GeoPortalService() {
|
||||
super();
|
||||
//Register interrfaces
|
||||
// registerClasses(Concessioni.class);
|
||||
|
||||
registerClasses(ConcessioniOverMongo.class);
|
||||
registerClasses(ProfiledDocuments.class);
|
||||
|
||||
|
@ -44,7 +50,6 @@ public class GeoPortalService extends ResourceConfig{
|
|||
ImplementationProvider.get().setEngine(new MongoClientProvider(), Mongo.class);
|
||||
ImplementationProvider.get().setEngine(new StorageClientProvider(), StorageUtils.class);
|
||||
ImplementationProvider.get().setEngine(new PostgisConnectionProvider(), PostgisDBManager.class);
|
||||
// ImplementationProvider.get().setEngine(new LocalFolderProfileMapCache(), ProfileMap.class);
|
||||
ImplementationProvider.get().setEngine(new SingleISResourceUCDProvider(), ProfileMap.class);
|
||||
ImplementationProvider.get().setEngine(new PluginManager(), PluginManager.PluginMap.class);
|
||||
ImplementationProvider.get().setEngine(new StorageHubProvider(), StorageHubClient.class);
|
||||
|
@ -52,6 +57,17 @@ public class GeoPortalService extends ResourceConfig{
|
|||
ImplementationProvider.get().setEngine(new ConfigurationCache(), ConfigurationCache.ConfigurationMap.class);
|
||||
|
||||
|
||||
for(Map.Entry<Engine<Object>, Class<Object>> entry : customImplementations().entrySet()){
|
||||
log.warn("LOADING CUSTOM ENGINE : {} serving {}",entry.getKey(),entry.getValue());
|
||||
ImplementationProvider.get().setEngine(entry.getKey(), entry.getValue());
|
||||
}
|
||||
|
||||
log.debug("ENGINES ARE : ");
|
||||
ImplementationProvider.get().getManagerList().forEach(
|
||||
(aClass, s) -> log.debug("{} serving {} ",aClass,s));
|
||||
|
||||
|
||||
log.info("Initializing serialization");
|
||||
JacksonJaxbJsonProvider provider = new JacksonJaxbJsonProvider();
|
||||
provider.setMapper(Serialization.mapper);
|
||||
register(provider);
|
||||
|
|
|
@ -39,7 +39,7 @@ public abstract class MongoManager {
|
|||
|
||||
public MongoManager() throws ConfigurationException {
|
||||
client=ImplementationProvider.get().getEngineByManagedClass(Mongo.class);
|
||||
log.debug("Cached client is {} ",client);
|
||||
log.trace("Cached client is {} ",client);
|
||||
}
|
||||
|
||||
protected void init(String collectionName){
|
||||
|
@ -92,9 +92,9 @@ public abstract class MongoManager {
|
|||
public FindIterable<Document> iterateDoc(Document filter, Document projection) {
|
||||
MongoCollection<Document> coll=getCollection();
|
||||
if(filter == null) filter=new Document();
|
||||
log.debug("Applying Filter "+filter.toJson());
|
||||
log.trace("Applying Filter "+filter.toJson());
|
||||
if(projection != null ) {
|
||||
log.debug("Applying projection "+projection.toJson());
|
||||
log.trace("Applying projection "+projection.toJson());
|
||||
return coll.find(filter).projection(projection);
|
||||
}else return coll.find(filter);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package org.gcube.application.geoportal.service.engine.providers.ucd;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.mongodb.util.JSON;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.gcube.application.cms.caches.AbstractScopedMap;
|
||||
import org.gcube.application.geoportal.common.model.useCaseDescriptor.UseCaseDescriptor;
|
||||
|
@ -8,14 +9,19 @@ import org.gcube.application.geoportal.common.utils.Files;
|
|||
import org.gcube.application.geoportal.common.model.rest.ConfigurationException;
|
||||
import org.gcube.application.cms.serialization.Serialization;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileFilter;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.Charset;
|
||||
|
||||
@Slf4j
|
||||
public class LocalFolderProfileMapCache extends AbstractScopedMap<ProfileMap> {
|
||||
|
||||
public LocalFolderProfileMapCache() {
|
||||
String folderPath = null;
|
||||
|
||||
public LocalFolderProfileMapCache(String folderPath) {
|
||||
super("Local Profiles CACHE");
|
||||
this.folderPath=folderPath;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -27,6 +33,7 @@ public class LocalFolderProfileMapCache extends AbstractScopedMap<ProfileMap> {
|
|||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected ProfileMap retrieveObject(String context) throws ConfigurationException {
|
||||
|
||||
|
@ -35,17 +42,23 @@ public class LocalFolderProfileMapCache extends AbstractScopedMap<ProfileMap> {
|
|||
ProfileMap toReturn=new ProfileMap();
|
||||
|
||||
try {
|
||||
UseCaseDescriptor p=Serialization.read(Files.
|
||||
readFileAsString(Files.getFileFromResources("profiles/profiledConcessioni.json").getAbsolutePath(), Charset.defaultCharset()), UseCaseDescriptor.class);
|
||||
log.debug("Loaded "+p.getName()+" ID "+p.getId());
|
||||
log.debug("Loading from {} ",folderPath);
|
||||
File baseFolder = new File (folderPath);
|
||||
for (File file : baseFolder.listFiles(pathname -> pathname.getName().endsWith(".json"))) {
|
||||
try {
|
||||
UseCaseDescriptor p = Serialization.read(Files.readFileAsString(file.getAbsolutePath(), Charset.defaultCharset()), UseCaseDescriptor.class);
|
||||
toReturn.put(p.getId(),p);
|
||||
|
||||
|
||||
}catch (JsonProcessingException e) {
|
||||
} catch (JsonProcessingException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}catch(Throwable t){
|
||||
t.printStackTrace();
|
||||
}
|
||||
|
||||
return toReturn;
|
||||
|
||||
}
|
||||
|
|
|
@ -97,17 +97,17 @@ public class UCDManager extends AbstractScopedMap<UCDManagerI> implements UCDMan
|
|||
|
||||
|
||||
private void forceUpdateCache() throws ConfigurationException {
|
||||
log.trace("UPDATING PROFILE CACHE..");
|
||||
log.info("UPDATING PROFILE CACHE..");
|
||||
final UCDMongoManager manager = getMongoManager();
|
||||
final AtomicLong counter= new AtomicLong(0l);
|
||||
for (Map.Entry<String, UseCaseDescriptor> entry : getLiveMap().entrySet()) {
|
||||
String s = entry.getKey();
|
||||
ProfileMap liveMap=getLiveMap();
|
||||
log.debug("LiveMap size is {} ",liveMap.size());
|
||||
for (Map.Entry<String, UseCaseDescriptor> entry : liveMap.entrySet()) {
|
||||
UseCaseDescriptor useCaseDescriptor = entry.getValue();
|
||||
try {
|
||||
log.info("Updateing cache with {} ", useCaseDescriptor.getId());
|
||||
log.debug("Updateing cache with {} ", useCaseDescriptor.getId());
|
||||
// insert/update into DB
|
||||
manager.put(useCaseDescriptor);
|
||||
|
||||
} catch (RegistrationException e) {
|
||||
log.warn("Unable to cache UCD {}",entry.getKey(),e);
|
||||
}
|
||||
|
|
|
@ -27,11 +27,11 @@ public abstract class GuardedMethod<T> {
|
|||
public GuardedMethod<T> execute() throws WebApplicationException{
|
||||
try {
|
||||
if(!preoperations.isEmpty()) {
|
||||
log.debug("Running preops (size : {} )", preoperations.size());
|
||||
log.trace("Running preops (size : {} )", preoperations.size());
|
||||
for (Runnable r : preoperations)
|
||||
r.run();
|
||||
}
|
||||
log.debug("Executing actual method..");
|
||||
log.trace("Executing actual method..");
|
||||
result=run();
|
||||
return this;
|
||||
}catch(WebApplicationException e) {
|
||||
|
|
|
@ -13,6 +13,7 @@ import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
|||
import org.gcube.common.scope.api.ScopeProvider;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
@ -85,7 +86,8 @@ public class UserUtils {
|
|||
}catch(Exception e){
|
||||
log.warn("Unable to determine user id, using FAKE");
|
||||
user.setUsername("FAKE");
|
||||
user.setRoles(Collections.EMPTY_SET);
|
||||
user.setRoles(new HashSet<>());
|
||||
user.getRoles().addAll(Arrays.asList(new String[] {"FakeUser","FakeAdmin","FakeEditor"}));
|
||||
}
|
||||
|
||||
info.setUser(user);
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
package org.gcube.application.geoportal.service;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.gcube.application.cms.caches.Engine;
|
||||
import org.gcube.application.cms.implementations.ImplementationProvider;
|
||||
import org.gcube.application.cms.tests.TestProfiles;
|
||||
import org.gcube.application.cms.tests.TokenSetter;
|
||||
import org.gcube.application.geoportal.common.utils.tests.GCubeTest;
|
||||
import org.gcube.application.geoportal.service.engine.providers.ucd.LocalFolderProfileMapCache;
|
||||
|
@ -10,20 +12,34 @@ import org.gcube.application.geoportal.service.rest.GuardedMethod;
|
|||
import org.gcube.application.cms.serialization.Serialization;
|
||||
import org.glassfish.jersey.test.JerseyTest;
|
||||
import org.junit.BeforeClass;
|
||||
import org.opengis.annotation.Profile;
|
||||
|
||||
import javax.ws.rs.core.Application;
|
||||
import javax.ws.rs.core.Response;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.junit.Assume.assumeTrue;
|
||||
|
||||
@Slf4j
|
||||
public class BasicServiceTestUnit extends JerseyTest {
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
protected Application configure() {
|
||||
return new GeoPortalService();
|
||||
return new GeoPortalService(){
|
||||
@Override
|
||||
public Map<Engine<?>, Class<?>> customImplementations() {
|
||||
return Collections.singletonMap((Engine<ProfileMap>)
|
||||
new LocalFolderProfileMapCache(TestProfiles.BASE_FOLDER.getAbsolutePath()),ProfileMap.class);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// Loads UCDs from local folder
|
||||
|
||||
|
||||
@BeforeClass
|
||||
|
@ -31,13 +47,13 @@ public class BasicServiceTestUnit extends JerseyTest {
|
|||
GuardedMethod.addPreoperation(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
String context = GCubeTest.getContext();
|
||||
log.debug("TEST IMPL : Setting context "+context+" in received call");
|
||||
TokenSetter.set(context);
|
||||
}
|
||||
});
|
||||
// Loads UCDs from local folder
|
||||
ImplementationProvider.get().setEngine(new LocalFolderProfileMapCache(), ProfileMap.class);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -5,17 +5,23 @@ import org.gcube.application.geoportal.common.utils.tests.GCubeTest;
|
|||
import org.gcube.application.geoportal.service.profiledDocuments.AbstractProfiledDocumentsTests;
|
||||
import org.junit.Test;
|
||||
|
||||
import javax.ws.rs.InternalServerErrorException;
|
||||
import javax.ws.rs.WebApplicationException;
|
||||
import javax.ws.rs.client.WebTarget;
|
||||
import javax.ws.rs.core.Response;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assume.assumeTrue;
|
||||
|
||||
public class InexistentUseCaseDescriptorTests extends AbstractProfiledDocumentsTests {
|
||||
|
||||
private static String inexistentUCID= UUID.randomUUID().toString();
|
||||
|
||||
@Override
|
||||
protected WebTarget baseTarget() {
|
||||
String testProfileId="profiledConcessioni";
|
||||
String testProfileId=inexistentUCID;
|
||||
return target(InterfaceConstants.Methods.PROJECTS).path(testProfileId);
|
||||
}
|
||||
|
||||
|
@ -24,7 +30,19 @@ public class InexistentUseCaseDescriptorTests extends AbstractProfiledDocumentsT
|
|||
public void testMissingProfile(){
|
||||
assumeTrue(GCubeTest.isTestInfrastructureEnabled());
|
||||
Response resp = target(InterfaceConstants.Methods.PROJECTS)
|
||||
.path("non-existent-useCaseDescriptor").request().get();
|
||||
.path(inexistentUCID).request().get();
|
||||
assertEquals(404,resp.getStatus());
|
||||
}
|
||||
|
||||
@Override
|
||||
@Test(expected = Exception.class)
|
||||
public void getAll() {
|
||||
super.getAll();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Test(expected = Exception.class)
|
||||
public void getByID() {
|
||||
super.getByID();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ import static org.junit.Assume.assumeTrue;
|
|||
|
||||
public class LockTests extends BasicServiceTestUnit {
|
||||
|
||||
String profileID = "profiledConcessioni";
|
||||
String profileID = "rolesTesting";
|
||||
ProfiledMongoManager manager= null;
|
||||
|
||||
@Before
|
||||
|
@ -40,7 +40,7 @@ public class LockTests extends BasicServiceTestUnit {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testLocking() throws StepException, EventException, IOException, ProjectLockedException, ProjectNotFoundException, InvalidLockException {
|
||||
public void testLocking() throws StepException, EventException, IOException, ProjectLockedException, ProjectNotFoundException, InvalidLockException, InvalidUserRoleException, UnauthorizedAccess {
|
||||
assumeTrue(GCubeTest.isTestInfrastructureEnabled());
|
||||
Project p = manager.registerNew(new Document("dummyField","dummyValue"));
|
||||
// lock
|
||||
|
|
|
@ -55,7 +55,7 @@ public class UCDCalls extends BasicServiceTestUnit {
|
|||
|
||||
public void getByWrongID() throws Exception {
|
||||
String testProfileId="gnegne";
|
||||
assertEquals(baseTarget().path(testProfileId).request(MediaType.APPLICATION_JSON_TYPE).get().getStatus(), Response.Status.NOT_FOUND);
|
||||
assertEquals(baseTarget().path(testProfileId).request(MediaType.APPLICATION_JSON_TYPE).get().getStatus(), Response.Status.NOT_FOUND.getStatusCode());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package org.gcube.application.geoportal.service.engine.providers.ucd;
|
||||
|
||||
import org.gcube.application.cms.tests.TestProfiles;
|
||||
import org.gcube.application.cms.tests.TokenSetter;
|
||||
import org.gcube.application.geoportal.common.model.rest.ConfigurationException;
|
||||
import org.gcube.application.geoportal.common.utils.tests.GCubeTest;
|
||||
|
@ -33,13 +34,16 @@ public class UCDLoadingTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testLoading() throws ConfigurationException {
|
||||
public void testLoadingFromIS() throws ConfigurationException {
|
||||
assumeTrue(GCubeTest.isTestInfrastructureEnabled());
|
||||
TokenSetter.set(GCubeTest.getContext());
|
||||
SingleISResourceUCDProvider provider = new SingleISResourceUCDProvider();
|
||||
ProfileMap map = provider.getObject();
|
||||
System.out.println("loaded "+map.size()+" ucds");
|
||||
assertTrue(map.size()>0);
|
||||
System.out.println("UCIDs IN "+GCubeTest.getContext()+": "+map.keySet());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLocalLoading() throws ConfigurationException {
|
||||
assertTrue(new LocalFolderProfileMapCache(TestProfiles.BASE_FOLDER.getAbsolutePath()).getObject().size()>0);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -93,7 +93,7 @@ public abstract class AbstractProfiledDocumentsTests extends BasicServiceTestUni
|
|||
Project doc =check(baseTarget().request(MediaType.APPLICATION_JSON).
|
||||
post(Entity.entity(content, MediaType.APPLICATION_JSON)), Project.class);
|
||||
validate(doc);
|
||||
assertTrue(doc.getLifecycleInformation().getPhase().equals(LifecycleInformation.DRAFT_PHASE));
|
||||
assertTrue(doc.getLifecycleInformation().getPhase().equals(LifecycleInformation.CommonPhases.DRAFT_PHASE));
|
||||
return doc;
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ public class RolesTests extends AbstractProfiledDocumentsTests{
|
|||
|
||||
|
||||
@Test
|
||||
private void testRoles(){
|
||||
public void testRoles(){
|
||||
// Insert for each
|
||||
}
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
</encoder>
|
||||
</appender>
|
||||
|
||||
<logger name="org.gcube.application" level="TRACE">
|
||||
<logger name="org.gcube.application" level="DEBUG">
|
||||
</logger>
|
||||
|
||||
<root level="ERROR">
|
||||
|
|
|
@ -11,10 +11,10 @@
|
|||
},
|
||||
"_data_access_policy" : [
|
||||
{"_policy" : {"_read" : "own", "_write" : "own"}, "_roles":[]},
|
||||
{"_policy" : {"_read" : "any", "_write" : "none"}, "_roles":["Guest"],
|
||||
{"_policy" : {"_read" : "any", "_write" : "none"}, "_roles":["FakeUser"],
|
||||
"_enforcer": {"_filter" : {"_lifecycleInformation._phase" : {"$eq" : "Published"}}}},
|
||||
{"_policy" : {"_read" : "any", "_write" : "none"}, "_roles":["Admin"]},
|
||||
{"_policy" : {"_read" : "any", "_write" : "any"}, "_roles":["Data-Manager"]}
|
||||
{"_policy" : {"_read" : "any", "_write" : "none"}, "_roles":["FakeEditor"]},
|
||||
{"_policy" : {"_read" : "any", "_write" : "any"}, "_roles":["FakeAdmin"]}
|
||||
],
|
||||
"_handlers" : []
|
||||
}
|
|
@ -0,0 +1,215 @@
|
|||
{
|
||||
"_id" : "profiledConcessioni",
|
||||
"_version" : "1.0.0",
|
||||
"_name" : "Concessione",
|
||||
|
||||
"_schema" : {
|
||||
"abstractRelazione" : { "_min" : 1,
|
||||
"_children" : [
|
||||
{"filesetIta" :{"_type" : "RegisteredFileSet", "_min": 1}},
|
||||
{"filesetEng" :{"_type" : "RegisteredFileSet"}},
|
||||
{"title" : {"_min" : 1}}
|
||||
]
|
||||
},
|
||||
"relazioneScavo" : { "_max" : 1, "_min" : 1,
|
||||
"_children" : [
|
||||
{"fileset" :{"_type" : "RegisteredFileSet", "_min": 1}},
|
||||
{"title" : {"_min" : 1}}
|
||||
]
|
||||
},
|
||||
"immaginiRappresentative" : {
|
||||
"_max" : 8,
|
||||
"_children" : [
|
||||
{"fileset" :{"_type" : "RegisteredFileSet","_min": 1}},
|
||||
{"title" : {"_min" : 1}}
|
||||
]
|
||||
},
|
||||
"posizionamentoScavo" : { "_max" : 1, "_min" : 1,
|
||||
"_children" : [
|
||||
{"fileset" :{"_type" : "RegisteredFileSet","_min": 1}},
|
||||
{"title" : {"_min" : 1}}
|
||||
]
|
||||
},
|
||||
"pianteFineScavo" : { "_max" : -1,
|
||||
"_children" : [
|
||||
{"fileset" :{"_type" : "RegisteredFileSet","_min": 1}},
|
||||
{"title" : {"_min" : 1}}
|
||||
]
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
"_description" : "Embedded profile for concessioni [mibac] management",
|
||||
"_creationInfo": {
|
||||
"_user" : {
|
||||
"_username": "fabio.sinibaldi"
|
||||
}
|
||||
},
|
||||
|
||||
"_data_access_policy" : [
|
||||
{"_policy" : {"_read" : "own", "_write" : "own"}, "_roles":[]},
|
||||
{"_policy" : {"_read" : "any", "_write" : "none"}, "_roles":["Guest"],
|
||||
"_enforcer": {"_filter" : {"_lifecycleInformation._phase" : {"$eq" : "Published"}}}},
|
||||
{"_policy" : {"_read" : "any", "_write" : "none"}, "_roles":["Admin"]},
|
||||
{"_policy" : {"_read" : "any", "_write" : "any"}, "_roles":["Data-Manager"]}
|
||||
],
|
||||
|
||||
"_handlers" : [
|
||||
{
|
||||
"_id" : "GNA-CONCESSIONI-LC",
|
||||
"_type" : "LifecycleManagement",
|
||||
"_configuration" : {
|
||||
"step_access" : [
|
||||
{"STEP" : "PUBLISH", "roles" :[ "DataManager"]}
|
||||
]
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"_id" : "SDI-Default-Materializer",
|
||||
"_type" : "Materializer",
|
||||
"_configuration" : {
|
||||
"registeredFileSetPaths" : [
|
||||
{"schemaField" : "pianteFineScavo","documentPath" : "pianteFineScavo[*].fileset"},
|
||||
{"schemaField" : "posizionamentoScavo","documentPath" : "posizionamentoScavo.fileset"}
|
||||
]
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
|
||||
{
|
||||
"_id" : "SDI-Indexer-Plugin",
|
||||
"_type" : "Indexer",
|
||||
"_configuration" : {
|
||||
"bboxEvaluation" : ["$..posizionamentoScavo.._bbox"],
|
||||
"explicitFieldMapping" : [
|
||||
{"name" : "titolo", "path" : "$._theDocument.title", "type" : "TEXT"}
|
||||
],
|
||||
"jslt" : {},
|
||||
"additionalLayers" : [
|
||||
{"source" : {"url" : "..."},"toSetTitle":""}
|
||||
]
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"_id": "org.gcube.portlets.user.geoportal-data-entry-app",
|
||||
"_type": "DATA_ENTRY_GUI",
|
||||
"_item_type": "Concessione",
|
||||
"_configuration": {
|
||||
"gcubeProfiles": [
|
||||
{
|
||||
"gcubeSecondaryType": "GeoNaMetadata",
|
||||
"gcubeName": "Informazioni_di_progetto",
|
||||
"sectionName": "$.",
|
||||
"sectionTitle": "Informazioni di Progetto"
|
||||
},
|
||||
{
|
||||
"gcubeSecondaryType": "GeoNaMetadata",
|
||||
"gcubeName": "Abstract_Relazione_di_Scavo",
|
||||
"sectionName": "abstractRelazione",
|
||||
"sectionTitle": "Abstract Relazione Scavo",
|
||||
"parentName": "$.",
|
||||
"filePaths": [
|
||||
{
|
||||
"gcubeProfileFieldName": "Carica Abstract Ita (in PDF)",
|
||||
"fieldDefinition": "abstractRelazione.children[?(@.filesetIta)]",
|
||||
"fieldName": "filesetIta"
|
||||
},
|
||||
{
|
||||
"gcubeProfileFieldName": "Carica Abstract Eng (in PDF)",
|
||||
"fieldDefinition": "abstractRelazione.children[?(@.filesetEng)]",
|
||||
"fieldName": "filesetEng"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"gcubeSecondaryType": "GeoNaMetadata",
|
||||
"gcubeName": "Relazione_di_Scavo",
|
||||
"sectionName": "relazioneScavo",
|
||||
"sectionTitle": "Relazione di Scavo",
|
||||
"parentName": "$.",
|
||||
"filePaths": [
|
||||
{
|
||||
"gcubeProfileFieldName": "Relazione di fine scavo (in PDF)",
|
||||
"fieldDefinition": "relazioneScavo.children[?(@.fileset)]",
|
||||
"fieldName": "fileset"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"gcubeSecondaryType": "GeoNaMetadata",
|
||||
"gcubeName": "Immagine_Rappresentativa_di_Scavo",
|
||||
"sectionName": "immaginiRappresentative",
|
||||
"sectionTitle": "Immagini Rappresentative",
|
||||
"minOccurs": 1,
|
||||
"maxOccurs": 8,
|
||||
"parentName": "$.",
|
||||
"filePaths": [
|
||||
{
|
||||
"gcubeProfileFieldName": "Immagine",
|
||||
"fieldDefinition": "immaginiRappresentative.children[?(@.fileset)]",
|
||||
"fieldName": "fileset"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"gcubeSecondaryType": "GeoNaMetadata",
|
||||
"gcubeName": "Posizionamento_dell_area_di_indagine",
|
||||
"sectionName": "posizionamentoScavo",
|
||||
"sectionTitle": "Posizionamento dell'Area di Indagine",
|
||||
"parentName": "$.",
|
||||
"filePaths": [
|
||||
{
|
||||
"gcubeProfileFieldName": "File",
|
||||
"fieldDefinition": "posizionamentoScavo.children[?(@.fileset)]",
|
||||
"fieldName": "fileset"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"gcubeSecondaryType": "GeoNaMetadata",
|
||||
"gcubeName": "Pianta_di_fine_Scavo",
|
||||
"sectionName": "pianteFineScavo",
|
||||
"sectionTitle": "Piante di fine Scavo",
|
||||
"parentName": "$.",
|
||||
"minOccurs": 0,
|
||||
"maxOccurs": 0,
|
||||
"filePaths": [
|
||||
{
|
||||
"gcubeProfileFieldName": "File",
|
||||
"fieldDefinition": "pianteFineScavo.children[?(@.fileset)]",
|
||||
"fieldName": "fileset"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"saveStep": "SUBMIT-FOR-REVIEW"
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
"_id" : "org.gcubegeoportal-data-list",
|
||||
"_type" : "DATA_LIST_GUI",
|
||||
"_case" : "smallList",
|
||||
"_configuration" : {
|
||||
"projection" : "{\"nome\" : 1, \"lifecycleInformation.phase\" : 1}",
|
||||
"orderPaths":[
|
||||
{"label" : "author", "path" : "info.creationInfo.user.username"}],
|
||||
"searchPaths":[
|
||||
{"label" : "author", "path" : "info.creationInfo.user.username"}],
|
||||
"actions" :[
|
||||
{ "status" : "OK",
|
||||
"phase" : "VALIDATE_DRAFT",
|
||||
"butoonsDefintion" : [
|
||||
{"id" : "report_forward","action" : "STEP", "label" : "Sottometti"},
|
||||
{"id" : "list_back_workflow", "action" : "STEP" , "label" : "Rifiuta"},
|
||||
{"id" : "report_backward", "action" : "STEP" , "label" : "Rifiuta"}
|
||||
]}
|
||||
],
|
||||
"implicit_filter":"{\"nome\" : {\"$eq\" : \"ciao\" }}"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
"_id" : "rolesTesting",
|
||||
"_version" : "1.0.0",
|
||||
"_name" : "Roles Testing",
|
||||
"_description" : "Simple uC for roles management testing",
|
||||
"_schema" : {},
|
||||
"_creationInfo": {
|
||||
"_user" : {
|
||||
"_username": "fabio.sinibaldi"
|
||||
}
|
||||
},
|
||||
"_data_access_policy" : [
|
||||
{"_policy" : {"_read" : "own", "_write" : "own"}, "_roles":[]},
|
||||
{"_policy" : {"_read" : "any", "_write" : "none"}, "_roles":["FakeUser"],
|
||||
"_enforcer": {"_filter" : {"_lifecycleInformation._phase" : {"$eq" : "Published"}}}},
|
||||
{"_policy" : {"_read" : "any", "_write" : "none"}, "_roles":["FakeEditor"]},
|
||||
{"_policy" : {"_read" : "any", "_write" : "any"}, "_roles":["FakeAdmin"]}
|
||||
],
|
||||
"_handlers" : []
|
||||
}
|
Loading…
Reference in New Issue