Fixing
This commit is contained in:
parent
6c664bb6d3
commit
ff916ae3cd
|
@ -183,6 +183,8 @@ public abstract class AbstractLifeCycleManager extends AbstractPlugin implements
|
|||
EventExecutionReport report=new EventExecutionReport(request);
|
||||
report.getToSetLifecycleInformation().addEventReport(new TriggeredEvents());
|
||||
TriggeredEvents info = report.getToSetLifecycleInformation().getLastEvent();
|
||||
info.setLastOperationStatus(LifecycleInformation.Status.OK);
|
||||
info.setEvent(request.getEvent());
|
||||
try {
|
||||
if(!registeredEvent.containsKey(request.getEvent()))
|
||||
throw new UnrecognizedEventException("Unexpected Event "+request.getEvent());
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
package org.gcube.application.cms.commons.model;
|
||||
|
||||
import org.gcube.application.cms.tests.TestProfiles;
|
||||
import org.gcube.application.cms.tests.model.BasicTests;
|
||||
import org.gcube.application.geoportal.common.model.document.accounting.User;
|
||||
import org.gcube.application.geoportal.common.model.useCaseDescriptor.UseCaseDescriptor;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
import static junit.framework.TestCase.assertNotNull;
|
||||
|
||||
public class RolesTesting extends BasicTests {
|
||||
|
||||
|
||||
|
||||
public UseCaseDescriptor getUcd() {
|
||||
return TestProfiles.profiles.get("profiledConcessioni");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void checkRoles(){
|
||||
User u = getCurrentUser();
|
||||
UseCaseDescriptor ucd = getUcd();
|
||||
u.setRoles(Collections.emptySet());
|
||||
assertNotNull(ucd.getMatching(u));
|
||||
|
||||
u.setRoles(Collections.singleton("FakeUser"));
|
||||
assertNotNull(ucd.getMatching(u));
|
||||
u.setRoles(Collections.singleton("FakeAdmin"));
|
||||
assertNotNull(ucd.getMatching(u));
|
||||
u.setRoles(Collections.singleton("FakeEditor"));
|
||||
assertNotNull(ucd.getMatching(u));
|
||||
u.setRoles(Collections.singleton("FakeMember"));
|
||||
assertNotNull(ucd.getMatching(u));
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -672,7 +672,7 @@ public class ProfiledMongoManager extends MongoManager implements MongoManagerI<
|
|||
|
||||
if(lcConfig.getIndexes()!=null)
|
||||
indexes.addAll(lcConfig.getIndexes());
|
||||
}catch(ConfigurationException e){
|
||||
}catch(Throwable e){
|
||||
toReturn.addErrorMessage("Unable to get Lifecycle info "+e.getMessage());
|
||||
log.error("Unable to get Lifecycle info ",e);
|
||||
}
|
||||
|
|
|
@ -45,4 +45,10 @@ public class InexistentUseCaseDescriptorTests extends AbstractProfiledDocumentsT
|
|||
public void getByID() {
|
||||
super.getByID();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Test(expected = Exception.class)
|
||||
public void getConfiguration() {
|
||||
super.getByID();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@ import org.gcube.application.geoportal.service.utils.UserUtils;
|
|||
import org.gcube.common.storagehub.model.exceptions.StorageHubException;
|
||||
import org.geotoolkit.referencing.operation.provider.PolarStereographic;
|
||||
import org.junit.Before;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.File;
|
||||
|
@ -33,12 +34,18 @@ public class LockTests extends BasicServiceTestUnit {
|
|||
String profileID = "rolesTesting";
|
||||
ProfiledMongoManager manager= null;
|
||||
|
||||
@BeforeClass
|
||||
public static void setLocalFolder(){
|
||||
USE_LOCAL_FOLDER=true;
|
||||
}
|
||||
@Before
|
||||
public void inits() throws RegistrationException, ConfigurationException {
|
||||
assumeTrue(GCubeTest.isTestInfrastructureEnabled());
|
||||
TokenSetter.set(GCubeTest.getContext());
|
||||
manager = new ProfiledMongoManager(profileID);
|
||||
|
||||
// NB Role testing not expected in VRE
|
||||
|
||||
|
||||
UserUtils.DEFAULT_ROLES.add("FakeAdmin");
|
||||
}
|
||||
|
|
|
@ -1,7 +1,11 @@
|
|||
package org.gcube.application.geoportal.service.profiledDocuments;
|
||||
|
||||
import org.gcube.application.cms.tests.TestProfiles;
|
||||
import org.gcube.application.geoportal.common.model.document.accounting.User;
|
||||
import org.gcube.application.geoportal.common.model.useCaseDescriptor.DataAccessPolicy;
|
||||
import org.gcube.application.geoportal.common.model.useCaseDescriptor.UseCaseDescriptor;
|
||||
import org.gcube.application.geoportal.common.rest.InterfaceConstants;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
import javax.ws.rs.client.WebTarget;
|
||||
|
@ -9,6 +13,12 @@ import javax.ws.rs.client.WebTarget;
|
|||
public class RolesTests extends AbstractProfiledDocumentsTests{
|
||||
|
||||
|
||||
@BeforeClass
|
||||
public static void setup(){
|
||||
//NB Profile is only in local resources
|
||||
USE_LOCAL_FOLDER=true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected WebTarget baseTarget() {
|
||||
String testProfileId="rolesTesting";
|
||||
|
@ -19,6 +29,9 @@ public class RolesTests extends AbstractProfiledDocumentsTests{
|
|||
@Test
|
||||
public void testRoles(){
|
||||
// Insert for each
|
||||
UseCaseDescriptor ucd = TestProfiles.profiles.get("rolesTesting");
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue