From 4998a3768eab4c711d74f5c5194cc6361d7ff58e Mon Sep 17 00:00:00 2001 From: Luca Frosini Date: Mon, 3 Feb 2020 10:52:57 +0100 Subject: [PATCH] Fixed imports and class names due to IS Model refactoring --- .../contexts/ContextCreator.java | 6 ++--- .../model/discovery/EntityDiscoveryTest.java | 26 +++++++++---------- .../resourceregistry/DataBaseCreator.java | 10 +++---- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/contexts/ContextCreator.java b/src/main/java/org/gcube/informationsystem/resourceregistry/contexts/ContextCreator.java index 9aff149..38264e8 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/contexts/ContextCreator.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/contexts/ContextCreator.java @@ -14,7 +14,7 @@ import org.gcube.informationsystem.resourceregistry.api.exceptions.context.Conte import org.gcube.informationsystem.resourceregistry.api.exceptions.context.ContextNotFoundException; import org.gcube.informationsystem.resourceregistry.contexts.ContextUtility; import org.gcube.informationsystem.resourceregistry.contexts.entities.ContextManagement; -import org.gcube.informationsystem.utils.ISMapper; +import org.gcube.informationsystem.utils.ElementMapper; import org.gcube.resourcemanagement.support.shared.types.datamodel.D4SEnvironment; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -34,10 +34,10 @@ public class ContextCreator extends ContextElaborator { protected Context create(Context context) throws ResourceRegistryException, IOException { ContextManagement contextManagement = new ContextManagement(); - contextManagement.setJson(ISMapper.marshal(context)); + contextManagement.setJson(ElementMapper.marshal(context)); String contextString = contextManagement.create(); logger.info("Created {}", contextString); - Context c = ISMapper.unmarshal(Context.class, contextString); + Context c = ElementMapper.unmarshal(Context.class, contextString); return c; } diff --git a/src/test/java/org/gcube/informationsystem/model/discovery/EntityDiscoveryTest.java b/src/test/java/org/gcube/informationsystem/model/discovery/EntityDiscoveryTest.java index 10cd54b..7250b0b 100644 --- a/src/test/java/org/gcube/informationsystem/model/discovery/EntityDiscoveryTest.java +++ b/src/test/java/org/gcube/informationsystem/model/discovery/EntityDiscoveryTest.java @@ -10,13 +10,13 @@ import org.gcube.informationsystem.base.reference.entities.EntityElement; import org.gcube.informationsystem.base.reference.properties.PropertyElement; import org.gcube.informationsystem.base.reference.relations.RelationElement; import org.gcube.informationsystem.types.TypeBinder; -import org.gcube.informationsystem.types.reference.TypeDefinition; +import org.gcube.informationsystem.types.reference.Type; import org.gcube.informationsystem.types.reference.entities.EntityType; import org.gcube.informationsystem.types.reference.properties.PropertyDefinition; import org.gcube.informationsystem.types.reference.properties.PropertyType; import org.gcube.informationsystem.types.reference.relations.RelationType; -import org.gcube.informationsystem.utils.ISMapper; -import org.gcube.informationsystem.utils.discovery.ISMDiscovery; +import org.gcube.informationsystem.utils.ElementMapper; +import org.gcube.informationsystem.utils.discovery.ElementSpecilizationDiscovery; import org.gcube.informationsystem.utils.discovery.RegistrationProvider; import org.gcube.informationsystem.utils.discovery.SchemaAction; import org.junit.Test; @@ -25,9 +25,9 @@ import org.slf4j.LoggerFactory; public class EntityDiscoveryTest { - private static Logger logger = LoggerFactory.getLogger(ISMDiscovery.class); + private static Logger logger = LoggerFactory.getLogger(ElementSpecilizationDiscovery.class); - private void addDiscoveredModel(ISMDiscovery ismDiscovery) { + private void addDiscoveredModel(ElementSpecilizationDiscovery ismDiscovery) { ServiceLoader regsitrationProviders = ServiceLoader .load(RegistrationProvider.class); for(RegistrationProvider registrationProvider : regsitrationProviders) { @@ -63,7 +63,7 @@ public class EntityDiscoveryTest { }; List packages = new ArrayList(); - Class tdClz = TypeDefinition.class; + Class tdClz = Type.class; packages.add(tdClz.getPackage()); AccessType[] accessTypes = AccessType.values(); @@ -77,20 +77,20 @@ public class EntityDiscoveryTest { for(RegistrationProvider registrationProvider : regsitrationProviders) { packages.addAll(registrationProvider.getPackagesToRegister()); } - ISMDiscovery.manageISM(schemaAction, packages); + ElementSpecilizationDiscovery.manageISM(schemaAction, packages); } @Test public void testPropertyDiscovery() throws Exception { - ISMDiscovery propertyDiscovery = new ISMDiscovery(PropertyElement.class); + ElementSpecilizationDiscovery propertyDiscovery = new ElementSpecilizationDiscovery(PropertyElement.class); addDiscoveredModel(propertyDiscovery); propertyDiscovery.discover(); for(Class propertyClass : propertyDiscovery.getDiscovered()) { String json = TypeBinder.serializeType(propertyClass); logger.info("{}", json); - TypeDefinition typeDefinition = TypeBinder.deserializeTypeDefinition(json); - logger.info("{}", ISMapper.marshal(typeDefinition)); + Type typeDefinition = TypeBinder.deserializeTypeDefinition(json); + logger.info("{}", ElementMapper.marshal(typeDefinition)); } } @@ -101,7 +101,7 @@ public class EntityDiscoveryTest { @Test public void testDefinitionSerialization() throws Exception { - logger.info("{}", TypeBinder.serializeType(TypeDefinition.class)); + logger.info("{}", TypeBinder.serializeType(Type.class)); logger.info("{}", TypeBinder.serializeType(EntityType.class)); logger.info("{}", TypeBinder.serializeType(RelationType.class)); logger.info("{}", TypeBinder.serializeType(PropertyType.class)); @@ -110,7 +110,7 @@ public class EntityDiscoveryTest { @Test public void testEntityDiscovery() throws Exception { - ISMDiscovery entityDiscovery = new ISMDiscovery<>(EntityElement.class); + ElementSpecilizationDiscovery entityDiscovery = new ElementSpecilizationDiscovery<>(EntityElement.class); addDiscoveredModel(entityDiscovery); entityDiscovery.discover(); @@ -122,7 +122,7 @@ public class EntityDiscoveryTest { @Test public void testRelationDiscovery() throws Exception { @SuppressWarnings("rawtypes") - ISMDiscovery relationDiscovery = new ISMDiscovery<>(RelationElement.class); + ElementSpecilizationDiscovery relationDiscovery = new ElementSpecilizationDiscovery<>(RelationElement.class); addDiscoveredModel(relationDiscovery); relationDiscovery.discover(); diff --git a/src/test/java/org/gcube/informationsystem/resourceregistry/DataBaseCreator.java b/src/test/java/org/gcube/informationsystem/resourceregistry/DataBaseCreator.java index 8acca2e..c5a0338 100644 --- a/src/test/java/org/gcube/informationsystem/resourceregistry/DataBaseCreator.java +++ b/src/test/java/org/gcube/informationsystem/resourceregistry/DataBaseCreator.java @@ -7,15 +7,15 @@ import org.gcube.informationsystem.context.reference.entities.Context; import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException; import org.gcube.informationsystem.resourceregistry.contexts.entities.ContextManagement; import org.gcube.informationsystem.resourceregistry.dbinitialization.DatabaseEnvironment; -import org.gcube.informationsystem.utils.ISMapper; -import org.gcube.informationsystem.utils.discovery.ISMDiscovery; +import org.gcube.informationsystem.utils.ElementMapper; +import org.gcube.informationsystem.utils.discovery.ElementSpecilizationDiscovery; import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class DataBaseCreator extends ContextTest { - private static Logger logger = LoggerFactory.getLogger(ISMDiscovery.class); + private static Logger logger = LoggerFactory.getLogger(ElementSpecilizationDiscovery.class); @Test public void createDatabase() throws Exception { @@ -26,10 +26,10 @@ public class DataBaseCreator extends ContextTest { protected Context create(Context context) throws ResourceRegistryException, IOException { ContextManagement contextManagement = new ContextManagement(); - contextManagement.setJson(ISMapper.marshal(context)); + contextManagement.setJson(ElementMapper.marshal(context)); String contextString = contextManagement.create(); logger.info("Created {}", contextString); - Context c = ISMapper.unmarshal(Context.class, contextString); + Context c = ElementMapper.unmarshal(Context.class, contextString); return c; }