|
|
|
@ -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 {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|