Fixed tests
This commit is contained in:
parent
6bcebf1f97
commit
0949e44ccb
|
@ -1,8 +1,10 @@
|
|||
package org.gcube.informationsystem.model.discovery;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.ServiceLoader;
|
||||
|
||||
import org.gcube.informationsystem.base.reference.AccessType;
|
||||
import org.gcube.informationsystem.base.reference.ISManageable;
|
||||
import org.gcube.informationsystem.base.reference.entities.BaseEntity;
|
||||
import org.gcube.informationsystem.base.reference.properties.BaseProperty;
|
||||
|
@ -16,6 +18,7 @@ import org.gcube.informationsystem.types.reference.relations.RelationTypeDefinit
|
|||
import org.gcube.informationsystem.utils.ISMapper;
|
||||
import org.gcube.informationsystem.utils.discovery.ISMDiscovery;
|
||||
import org.gcube.informationsystem.utils.discovery.RegistrationProvider;
|
||||
import org.gcube.informationsystem.utils.discovery.SchemaAction;
|
||||
import org.junit.Test;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -35,6 +38,48 @@ public class ISMDiscoveryTest {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDiscovery() throws Exception {
|
||||
SchemaAction schemaAction = new SchemaAction() {
|
||||
|
||||
@Override
|
||||
public <R extends BaseRelation<? extends BaseEntity,? extends BaseEntity>> void manageRelationClass(Class<R> r)
|
||||
throws Exception {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public <P extends BaseProperty> void managePropertyClass(Class<P> e) throws Exception {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public <E extends BaseEntity> void manageEntityClass(Class<E> e) throws Exception {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
};
|
||||
List<Package> packages = new ArrayList<Package>();
|
||||
|
||||
Class<TypeDefinition> tdClz = TypeDefinition.class;
|
||||
packages.add(tdClz.getPackage());
|
||||
|
||||
AccessType[] accessTypes = AccessType.values();
|
||||
for(AccessType accessType : accessTypes) {
|
||||
Class<ISManageable> clz = accessType.getTypeClass();
|
||||
packages.add(clz.getPackage());
|
||||
}
|
||||
|
||||
ServiceLoader<? extends RegistrationProvider> regsitrationProviders = ServiceLoader
|
||||
.load(RegistrationProvider.class);
|
||||
for(RegistrationProvider registrationProvider : regsitrationProviders) {
|
||||
packages.addAll(registrationProvider.getPackagesToRegister());
|
||||
}
|
||||
ISMDiscovery.manageISM(schemaAction, packages);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPropertyDiscovery() throws Exception {
|
||||
ISMDiscovery<BaseProperty> propertyDiscovery = new ISMDiscovery<BaseProperty>(BaseProperty.class);
|
||||
|
@ -86,4 +131,6 @@ public class ISMDiscoveryTest {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@ import org.gcube.common.authorization.library.utils.Caller;
|
|||
import org.gcube.common.scope.api.ScopeProvider;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
@ -48,6 +49,11 @@ public class ContextTest {
|
|||
DEFAULT_TEST_SCOPE_NAME = "/gcube";
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test() throws ObjectNotFound, Exception {
|
||||
ContextTest.setContext("a34b486c-874c-4539-97c9-be8d9e00fd7f-98187548");
|
||||
}
|
||||
|
||||
public static String getCurrentScope(String token) throws ObjectNotFound, Exception {
|
||||
AuthorizationEntry authorizationEntry = Constants.authorizationService().get(token);
|
||||
String context = authorizationEntry.getContext();
|
||||
|
|
|
@ -24,8 +24,6 @@ public class DataBaseCreator extends ContextTest {
|
|||
logger.debug("{} created", db);
|
||||
}
|
||||
|
||||
|
||||
|
||||
protected Context create(Context context) throws ResourceRegistryException, IOException {
|
||||
ContextManagement contextManagement = new ContextManagement();
|
||||
contextManagement.setJson(ISMapper.marshal(context));
|
||||
|
@ -56,15 +54,6 @@ public class DataBaseCreator extends ContextTest {
|
|||
nextNext.setParent(devNext);
|
||||
nextNext = create(nextNext);
|
||||
|
||||
/*
|
||||
Context preprod = new ContextImpl("preprod");
|
||||
preprod.setParent(gcube);
|
||||
preprod = create(preprod);
|
||||
|
||||
Context preVRE = new ContextImpl("preVRE");
|
||||
preVRE.setParent(preprod);
|
||||
preVRE = create(preVRE);
|
||||
*/
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -11,7 +11,9 @@
|
|||
|
||||
<logger name="org.gcube" level="ERROR" />
|
||||
<logger name="org.gcube.informationsystem" level="INFO" />
|
||||
<logger name="org.gcube.informationsystem.resourceregistry" level="TRACE" />
|
||||
<logger name="org.gcube.informationsystem.resourceregistry.context" level="TRACE" />
|
||||
<logger name="org.gcube.informationsystem.utils.discovery" level="INFO" />
|
||||
|
||||
<root level="WARN">
|
||||
<appender-ref ref="STDOUT" />
|
||||
|
|
Loading…
Reference in New Issue