From 92c081a8d8a5bbed00195f198da30dbf41376999 Mon Sep 17 00:00:00 2001 From: "luca.frosini" Date: Tue, 27 Dec 2016 10:27:01 +0000 Subject: [PATCH] Reorganizing code git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/information-system/resource-registry@141409 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../{ermanagement => er}/ERManagement.java | 2 +- .../EmbeddedMangement.java | 2 +- .../entity/EntityManagement.java | 6 +- .../entity/FacetManagement.java | 4 +- .../entity/ResourceManagement.java | 10 +- .../relation/ConsistsOfManagement.java | 2 +- .../relation/IsRelatedToManagement.java | 2 +- .../relation/RelationManagement.java | 10 +- .../resourceregistry/rest/Access.java | 4 +- .../resourceregistry/rest/ERManager.java | 8 +- .../AccessManagerFactory.java | 28 -- .../ContextManagerFactory.java | 57 ---- .../SchemaManagerFactory.java | 280 ------------------ .../resourceregistry/access/AccessTest.java | 73 ----- .../impl => access}/QueryImplTest.java | 2 +- .../ContextManagementImplTest.java | 3 +- .../context/ContextManagementTest.java | 56 ---- .../impl => context}/MultiContextTest.java | 6 +- .../dbinitialization/ContextCreation.java | 40 --- .../impl => er}/ERManagementTest.java | 8 +- .../impl => er}/SmartgearResourcesTest.java | 4 +- .../SchemaManagementImplTest.java | 2 +- 22 files changed, 37 insertions(+), 572 deletions(-) rename src/main/java/org/gcube/informationsystem/resourceregistry/{ermanagement => er}/ERManagement.java (98%) rename src/main/java/org/gcube/informationsystem/resourceregistry/{ermanagement => er}/EmbeddedMangement.java (97%) rename src/main/java/org/gcube/informationsystem/resourceregistry/{ermanagement => er}/entity/EntityManagement.java (98%) rename src/main/java/org/gcube/informationsystem/resourceregistry/{ermanagement => er}/entity/FacetManagement.java (91%) rename src/main/java/org/gcube/informationsystem/resourceregistry/{ermanagement => er}/entity/ResourceManagement.java (93%) rename src/main/java/org/gcube/informationsystem/resourceregistry/{ermanagement => er}/relation/ConsistsOfManagement.java (85%) rename src/main/java/org/gcube/informationsystem/resourceregistry/{ermanagement => er}/relation/IsRelatedToManagement.java (85%) rename src/main/java/org/gcube/informationsystem/resourceregistry/{ermanagement => er}/relation/RelationManagement.java (98%) delete mode 100644 src/test/java/org/gcube/informationsystem/resourceregistry/AccessManagerFactory.java delete mode 100644 src/test/java/org/gcube/informationsystem/resourceregistry/ContextManagerFactory.java delete mode 100644 src/test/java/org/gcube/informationsystem/resourceregistry/SchemaManagerFactory.java delete mode 100644 src/test/java/org/gcube/informationsystem/resourceregistry/access/AccessTest.java rename src/test/java/org/gcube/informationsystem/resourceregistry/{resources/impl => access}/QueryImplTest.java (91%) rename src/test/java/org/gcube/informationsystem/resourceregistry/{resources/impl => context}/ContextManagementImplTest.java (98%) delete mode 100644 src/test/java/org/gcube/informationsystem/resourceregistry/context/ContextManagementTest.java rename src/test/java/org/gcube/informationsystem/resourceregistry/{resources/impl => context}/MultiContextTest.java (97%) delete mode 100644 src/test/java/org/gcube/informationsystem/resourceregistry/dbinitialization/ContextCreation.java rename src/test/java/org/gcube/informationsystem/resourceregistry/{resources/impl => er}/ERManagementTest.java (97%) rename src/test/java/org/gcube/informationsystem/resourceregistry/{resources/impl => er}/SmartgearResourcesTest.java (99%) rename src/test/java/org/gcube/informationsystem/resourceregistry/{resources/impl => schema}/SchemaManagementImplTest.java (98%) diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/ermanagement/ERManagement.java b/src/main/java/org/gcube/informationsystem/resourceregistry/er/ERManagement.java similarity index 98% rename from src/main/java/org/gcube/informationsystem/resourceregistry/ermanagement/ERManagement.java rename to src/main/java/org/gcube/informationsystem/resourceregistry/er/ERManagement.java index 810905a..eb8ede6 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/ermanagement/ERManagement.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/er/ERManagement.java @@ -1,7 +1,7 @@ /** * */ -package org.gcube.informationsystem.resourceregistry.ermanagement; +package org.gcube.informationsystem.resourceregistry.er; import java.io.IOException; import java.util.ArrayList; diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/ermanagement/EmbeddedMangement.java b/src/main/java/org/gcube/informationsystem/resourceregistry/er/EmbeddedMangement.java similarity index 97% rename from src/main/java/org/gcube/informationsystem/resourceregistry/ermanagement/EmbeddedMangement.java rename to src/main/java/org/gcube/informationsystem/resourceregistry/er/EmbeddedMangement.java index 2363eb1..d23cca4 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/ermanagement/EmbeddedMangement.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/er/EmbeddedMangement.java @@ -1,7 +1,7 @@ /** * */ -package org.gcube.informationsystem.resourceregistry.ermanagement; +package org.gcube.informationsystem.resourceregistry.er; import java.util.HashSet; import java.util.Set; diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/ermanagement/entity/EntityManagement.java b/src/main/java/org/gcube/informationsystem/resourceregistry/er/entity/EntityManagement.java similarity index 98% rename from src/main/java/org/gcube/informationsystem/resourceregistry/ermanagement/entity/EntityManagement.java rename to src/main/java/org/gcube/informationsystem/resourceregistry/er/entity/EntityManagement.java index 1051e28..d5e54c8 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/ermanagement/entity/EntityManagement.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/er/entity/EntityManagement.java @@ -1,7 +1,7 @@ /** * */ -package org.gcube.informationsystem.resourceregistry.ermanagement.entity; +package org.gcube.informationsystem.resourceregistry.er.entity; import java.io.IOException; import java.util.HashSet; @@ -23,8 +23,8 @@ import org.gcube.informationsystem.resourceregistry.api.exceptions.schema.Schema import org.gcube.informationsystem.resourceregistry.context.ContextUtility; import org.gcube.informationsystem.resourceregistry.context.SecurityContextMapper; import org.gcube.informationsystem.resourceregistry.context.SecurityContextMapper.PermissionMode; -import org.gcube.informationsystem.resourceregistry.ermanagement.ERManagement; -import org.gcube.informationsystem.resourceregistry.ermanagement.relation.RelationManagement; +import org.gcube.informationsystem.resourceregistry.er.ERManagement; +import org.gcube.informationsystem.resourceregistry.er.relation.RelationManagement; import org.gcube.informationsystem.resourceregistry.schema.SchemaManagementImpl; import org.gcube.informationsystem.resourceregistry.utils.HeaderUtility; import org.gcube.informationsystem.resourceregistry.utils.Utility; diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/ermanagement/entity/FacetManagement.java b/src/main/java/org/gcube/informationsystem/resourceregistry/er/entity/FacetManagement.java similarity index 91% rename from src/main/java/org/gcube/informationsystem/resourceregistry/ermanagement/entity/FacetManagement.java rename to src/main/java/org/gcube/informationsystem/resourceregistry/er/entity/FacetManagement.java index a9877f7..d014c3f 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/ermanagement/entity/FacetManagement.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/er/entity/FacetManagement.java @@ -1,14 +1,14 @@ /** * */ -package org.gcube.informationsystem.resourceregistry.ermanagement.entity; +package org.gcube.informationsystem.resourceregistry.er.entity; import org.codehaus.jettison.json.JSONObject; import org.gcube.informationsystem.model.entity.Facet; import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException; import org.gcube.informationsystem.resourceregistry.api.exceptions.entity.facet.FacetAlreadyPresentException; import org.gcube.informationsystem.resourceregistry.api.exceptions.entity.facet.FacetNotFoundException; -import org.gcube.informationsystem.resourceregistry.ermanagement.ERManagement; +import org.gcube.informationsystem.resourceregistry.er.ERManagement; import org.gcube.informationsystem.resourceregistry.utils.Utility; import com.tinkerpop.blueprints.Vertex; diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/ermanagement/entity/ResourceManagement.java b/src/main/java/org/gcube/informationsystem/resourceregistry/er/entity/ResourceManagement.java similarity index 93% rename from src/main/java/org/gcube/informationsystem/resourceregistry/ermanagement/entity/ResourceManagement.java rename to src/main/java/org/gcube/informationsystem/resourceregistry/er/entity/ResourceManagement.java index 883869a..984f3f8 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/ermanagement/entity/ResourceManagement.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/er/entity/ResourceManagement.java @@ -1,7 +1,7 @@ /** * */ -package org.gcube.informationsystem.resourceregistry.ermanagement.entity; +package org.gcube.informationsystem.resourceregistry.er.entity; import java.util.Iterator; @@ -14,10 +14,10 @@ import org.gcube.informationsystem.model.relation.IsRelatedTo; import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException; import org.gcube.informationsystem.resourceregistry.api.exceptions.entity.EntityAlreadyPresentException; import org.gcube.informationsystem.resourceregistry.api.exceptions.entity.resource.ResourceNotFoundException; -import org.gcube.informationsystem.resourceregistry.ermanagement.ERManagement; -import org.gcube.informationsystem.resourceregistry.ermanagement.relation.ConsistsOfManagement; -import org.gcube.informationsystem.resourceregistry.ermanagement.relation.IsRelatedToManagement; -import org.gcube.informationsystem.resourceregistry.ermanagement.relation.RelationManagement; +import org.gcube.informationsystem.resourceregistry.er.ERManagement; +import org.gcube.informationsystem.resourceregistry.er.relation.ConsistsOfManagement; +import org.gcube.informationsystem.resourceregistry.er.relation.IsRelatedToManagement; +import org.gcube.informationsystem.resourceregistry.er.relation.RelationManagement; import org.gcube.informationsystem.resourceregistry.utils.Utility; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/ermanagement/relation/ConsistsOfManagement.java b/src/main/java/org/gcube/informationsystem/resourceregistry/er/relation/ConsistsOfManagement.java similarity index 85% rename from src/main/java/org/gcube/informationsystem/resourceregistry/ermanagement/relation/ConsistsOfManagement.java rename to src/main/java/org/gcube/informationsystem/resourceregistry/er/relation/ConsistsOfManagement.java index b4c86ec..52ebafa 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/ermanagement/relation/ConsistsOfManagement.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/er/relation/ConsistsOfManagement.java @@ -1,7 +1,7 @@ /** * */ -package org.gcube.informationsystem.resourceregistry.ermanagement.relation; +package org.gcube.informationsystem.resourceregistry.er.relation; import org.gcube.informationsystem.model.relation.ConsistsOf; diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/ermanagement/relation/IsRelatedToManagement.java b/src/main/java/org/gcube/informationsystem/resourceregistry/er/relation/IsRelatedToManagement.java similarity index 85% rename from src/main/java/org/gcube/informationsystem/resourceregistry/ermanagement/relation/IsRelatedToManagement.java rename to src/main/java/org/gcube/informationsystem/resourceregistry/er/relation/IsRelatedToManagement.java index b916c6d..938a2e4 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/ermanagement/relation/IsRelatedToManagement.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/er/relation/IsRelatedToManagement.java @@ -1,7 +1,7 @@ /** * */ -package org.gcube.informationsystem.resourceregistry.ermanagement.relation; +package org.gcube.informationsystem.resourceregistry.er.relation; import org.gcube.informationsystem.model.relation.IsRelatedTo; diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/ermanagement/relation/RelationManagement.java b/src/main/java/org/gcube/informationsystem/resourceregistry/er/relation/RelationManagement.java similarity index 98% rename from src/main/java/org/gcube/informationsystem/resourceregistry/ermanagement/relation/RelationManagement.java rename to src/main/java/org/gcube/informationsystem/resourceregistry/er/relation/RelationManagement.java index 210536c..1b46810 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/ermanagement/relation/RelationManagement.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/er/relation/RelationManagement.java @@ -1,7 +1,7 @@ /** * */ -package org.gcube.informationsystem.resourceregistry.ermanagement.relation; +package org.gcube.informationsystem.resourceregistry.er.relation; import java.io.IOException; import java.util.HashSet; @@ -28,10 +28,10 @@ import org.gcube.informationsystem.resourceregistry.api.exceptions.schema.Schema import org.gcube.informationsystem.resourceregistry.context.ContextUtility; import org.gcube.informationsystem.resourceregistry.context.SecurityContextMapper; import org.gcube.informationsystem.resourceregistry.context.SecurityContextMapper.PermissionMode; -import org.gcube.informationsystem.resourceregistry.ermanagement.ERManagement; -import org.gcube.informationsystem.resourceregistry.ermanagement.entity.EntityManagement; -import org.gcube.informationsystem.resourceregistry.ermanagement.entity.FacetManagement; -import org.gcube.informationsystem.resourceregistry.ermanagement.entity.ResourceManagement; +import org.gcube.informationsystem.resourceregistry.er.ERManagement; +import org.gcube.informationsystem.resourceregistry.er.entity.EntityManagement; +import org.gcube.informationsystem.resourceregistry.er.entity.FacetManagement; +import org.gcube.informationsystem.resourceregistry.er.entity.ResourceManagement; import org.gcube.informationsystem.resourceregistry.schema.SchemaManagementImpl; import org.gcube.informationsystem.resourceregistry.utils.HeaderUtility; import org.gcube.informationsystem.resourceregistry.utils.Utility; diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/rest/Access.java b/src/main/java/org/gcube/informationsystem/resourceregistry/rest/Access.java index 7234cb1..586c28b 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/rest/Access.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/rest/Access.java @@ -16,8 +16,8 @@ import org.gcube.informationsystem.resourceregistry.api.exceptions.entity.resour import org.gcube.informationsystem.resourceregistry.api.exceptions.schema.SchemaException; import org.gcube.informationsystem.resourceregistry.api.exceptions.schema.SchemaNotFoundException; import org.gcube.informationsystem.resourceregistry.api.rest.AccessPath; -import org.gcube.informationsystem.resourceregistry.ermanagement.entity.FacetManagement; -import org.gcube.informationsystem.resourceregistry.ermanagement.entity.ResourceManagement; +import org.gcube.informationsystem.resourceregistry.er.entity.FacetManagement; +import org.gcube.informationsystem.resourceregistry.er.entity.ResourceManagement; import org.gcube.informationsystem.resourceregistry.query.Query; import org.gcube.informationsystem.resourceregistry.query.QueryImpl; import org.gcube.informationsystem.resourceregistry.schema.SchemaManagement; diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/rest/ERManager.java b/src/main/java/org/gcube/informationsystem/resourceregistry/rest/ERManager.java index 45b825c..e7bee5e 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/rest/ERManager.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/rest/ERManager.java @@ -22,10 +22,10 @@ import org.gcube.informationsystem.resourceregistry.api.exceptions.entity.facet. import org.gcube.informationsystem.resourceregistry.api.exceptions.entity.resource.ResourceNotFoundException; import org.gcube.informationsystem.resourceregistry.api.rest.EntityPath; import org.gcube.informationsystem.resourceregistry.context.ContextUtility; -import org.gcube.informationsystem.resourceregistry.ermanagement.entity.FacetManagement; -import org.gcube.informationsystem.resourceregistry.ermanagement.entity.ResourceManagement; -import org.gcube.informationsystem.resourceregistry.ermanagement.relation.ConsistsOfManagement; -import org.gcube.informationsystem.resourceregistry.ermanagement.relation.IsRelatedToManagement; +import org.gcube.informationsystem.resourceregistry.er.entity.FacetManagement; +import org.gcube.informationsystem.resourceregistry.er.entity.ResourceManagement; +import org.gcube.informationsystem.resourceregistry.er.relation.ConsistsOfManagement; +import org.gcube.informationsystem.resourceregistry.er.relation.IsRelatedToManagement; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/src/test/java/org/gcube/informationsystem/resourceregistry/AccessManagerFactory.java b/src/test/java/org/gcube/informationsystem/resourceregistry/AccessManagerFactory.java deleted file mode 100644 index e84e405..0000000 --- a/src/test/java/org/gcube/informationsystem/resourceregistry/AccessManagerFactory.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.gcube.informationsystem.resourceregistry; - -import org.gcube.informationsystem.resourceregistry.api.exceptions.InvalidQueryException; -import org.gcube.informationsystem.resourceregistry.rest.Access; -import org.glassfish.hk2.api.Factory; - -public class AccessManagerFactory implements Factory{ - - @Override - public void dispose(Access arg0) { - // TODO Auto-generated method stub - - } - - @Override - public Access provide() { - return new Access() { - - @Override - public String query(String query, int limit, String fetchPlan) throws InvalidQueryException { - if (query.equals("error")) - throw new InvalidQueryException("error in query"); - return "result"; - } - }; - } - -} diff --git a/src/test/java/org/gcube/informationsystem/resourceregistry/ContextManagerFactory.java b/src/test/java/org/gcube/informationsystem/resourceregistry/ContextManagerFactory.java deleted file mode 100644 index 8ebf91b..0000000 --- a/src/test/java/org/gcube/informationsystem/resourceregistry/ContextManagerFactory.java +++ /dev/null @@ -1,57 +0,0 @@ -package org.gcube.informationsystem.resourceregistry; - -import java.util.UUID; - -import org.gcube.informationsystem.resourceregistry.api.exceptions.context.ContextCreationException; -import org.gcube.informationsystem.resourceregistry.api.exceptions.context.ContextException; -import org.gcube.informationsystem.resourceregistry.api.exceptions.context.ContextNotFoundException; -import org.gcube.informationsystem.resourceregistry.context.ContextManagement; -import org.glassfish.hk2.api.Factory; - -public class ContextManagerFactory implements Factory { - - @Override - public void dispose(ContextManagement arg0) { - } - - @Override - public ContextManagement provide() { - return new ContextManagement() { - - @Override - public boolean delete(UUID uuid) throws ContextNotFoundException { - return false; - } - - - @Override - public String create(UUID parentContextUUID, String name) - throws ContextCreationException { - return "{}"; - } - - @Override - public String rename(UUID contextUUID, String name) - throws ContextNotFoundException { - return "{}"; - } - - @Override - public String move(UUID newParentUUID, UUID contextToMoveUUID) - throws ContextNotFoundException { - return "{}"; - } - - - @Override - public String read(UUID contextUUID) - throws ContextNotFoundException, ContextException { - return "{}"; - } - - }; - - - } - -} \ No newline at end of file diff --git a/src/test/java/org/gcube/informationsystem/resourceregistry/SchemaManagerFactory.java b/src/test/java/org/gcube/informationsystem/resourceregistry/SchemaManagerFactory.java deleted file mode 100644 index b85b799..0000000 --- a/src/test/java/org/gcube/informationsystem/resourceregistry/SchemaManagerFactory.java +++ /dev/null @@ -1,280 +0,0 @@ -package org.gcube.informationsystem.resourceregistry; - -import org.gcube.informationsystem.resourceregistry.api.exceptions.schema.SchemaException; -import org.gcube.informationsystem.resourceregistry.api.exceptions.schema.SchemaNotFoundException; -import org.gcube.informationsystem.resourceregistry.schema.SchemaManagement; -import org.glassfish.hk2.api.Factory; - -public class SchemaManagerFactory implements Factory{ - - @Override - public void dispose(SchemaManagement arg0) { - // TODO Auto-generated method stub - - } - - @Override - public SchemaManagement provide() { - return new SchemaManagement() { - - @Override - public String registerEntitySchema(String jsonSchema) - throws SchemaException { - // TODO Auto-generated method stub - return null; - } - - @Override - public String getEntitySchema(String entityType) - throws SchemaNotFoundException { - // TODO Auto-generated method stub - return null; - } - - @Override - public String updateEntitySchema(String entityType, - String jsonSchema) throws SchemaNotFoundException, - SchemaException { - // TODO Auto-generated method stub - return null; - } - - @Override - public String deleteEntitySchema(String entityType) - throws SchemaNotFoundException { - // TODO Auto-generated method stub - return null; - } - - @Override - public String registerFacetSchema(String jsonSchema) - throws SchemaException { - // TODO Auto-generated method stub - return null; - } - - @Override - public String getFacetSchema(String facetType) - throws SchemaNotFoundException { - // TODO Auto-generated method stub - return null; - } - - @Override - public String updateFacetSchema(String facetType, String jsonSchema) - throws SchemaNotFoundException, SchemaException { - // TODO Auto-generated method stub - return null; - } - - @Override - public String deleteFacetSchema(String facetType) - throws SchemaNotFoundException { - // TODO Auto-generated method stub - return null; - } - - @Override - public String registerResourceSchema(String jsonSchema) - throws SchemaException { - // TODO Auto-generated method stub - return null; - } - - @Override - public String getResourceSchema(String resourceType) - throws SchemaNotFoundException { - // TODO Auto-generated method stub - return null; - } - - @Override - public String updateResourceSchema(String resourceType, - String jsonSchema) throws SchemaNotFoundException, - SchemaException { - // TODO Auto-generated method stub - return null; - } - - @Override - public String deleteResourceSchema(String resourceType) - throws SchemaNotFoundException { - // TODO Auto-generated method stub - return null; - } - - @Override - public String registerEmbeddedTypeSchema(String jsonSchema) - throws SchemaException { - // TODO Auto-generated method stub - return null; - } - - @Override - public String getEmbeddedTypeSchema(String embeddedType) - throws SchemaNotFoundException { - // TODO Auto-generated method stub - return null; - } - - @Override - public String updateEmbeddedTypeSchema(String embeddedType, - String jsonSchema) throws SchemaNotFoundException, - SchemaException { - // TODO Auto-generated method stub - return null; - } - - @Override - public String deleteEmbeddedTypeSchema(String embeddedType) - throws SchemaNotFoundException { - // TODO Auto-generated method stub - return null; - } - - @Override - public String registerRelationSchema(String jsonSchema) - throws SchemaException { - // TODO Auto-generated method stub - return null; - } - - @Override - public String getRelationSchema(String relationType) - throws SchemaNotFoundException { - // TODO Auto-generated method stub - return null; - } - - @Override - public String updateRelationSchema(String relationType, - String jsonSchema) throws SchemaNotFoundException, - SchemaException { - // TODO Auto-generated method stub - return null; - } - - @Override - public String deleteRelationSchema(String relationType) - throws SchemaNotFoundException { - // TODO Auto-generated method stub - return null; - } - - @Override - public String registerConsistsOfSchema(String jsonSchema) - throws SchemaException { - // TODO Auto-generated method stub - return null; - } - - @Override - public String getConsistsOfSchema(String consistsOfType) - throws SchemaNotFoundException { - // TODO Auto-generated method stub - return null; - } - - @Override - public String updateConsistsOfSchema(String consistsOfType, - String jsonSchema) throws SchemaNotFoundException, - SchemaException { - // TODO Auto-generated method stub - return null; - } - - @Override - public String deleteConsistsOfSchema(String consistsOfType) - throws SchemaException { - // TODO Auto-generated method stub - return null; - } - - @Override - public String registerIsRelatedToSchema(String jsonSchema) - throws SchemaException { - // TODO Auto-generated method stub - return null; - } - - @Override - public String getIsRelatedToSchema(String isRelatedToType) - throws SchemaNotFoundException { - // TODO Auto-generated method stub - return null; - } - - @Override - public String updateIsRelatedToSchema(String isRelatedToType, - String jsonSchema) throws SchemaNotFoundException, - SchemaException { - // TODO Auto-generated method stub - return null; - } - - @Override - public String deleteIsRelatedToSchema(String isRelatedToType) - throws SchemaException { - // TODO Auto-generated method stub - return null; - } - - @Override - public String getEntityTypes(String entityType, - boolean includeSchema) throws SchemaNotFoundException, - SchemaException { - // TODO Auto-generated method stub - return null; - } - - @Override - public String getFacetTypes(String facetType, boolean includeSchema) - throws SchemaNotFoundException, SchemaException { - // TODO Auto-generated method stub - return null; - } - - @Override - public String getResourceTypes(String resourceType, - boolean includeSchema) throws SchemaNotFoundException, - SchemaException { - // TODO Auto-generated method stub - return null; - } - - @Override - public String getEmbeddedTypes(String embeddedType, - boolean includeSchema) throws SchemaNotFoundException, - SchemaException { - // TODO Auto-generated method stub - return null; - } - - @Override - public String getRelationTypes(String relationType, - boolean includeSchema) throws SchemaNotFoundException, - SchemaException { - // TODO Auto-generated method stub - return null; - } - - @Override - public String getConsistsOfTypes(String consistsOfType, - boolean includeSchema) throws SchemaNotFoundException, - SchemaException { - // TODO Auto-generated method stub - return null; - } - - @Override - public String getIsRelatedToTypes(String isRelatedToType, - boolean includeSchema) throws SchemaNotFoundException, - SchemaException { - // TODO Auto-generated method stub - return null; - } - - }; - } - -} diff --git a/src/test/java/org/gcube/informationsystem/resourceregistry/access/AccessTest.java b/src/test/java/org/gcube/informationsystem/resourceregistry/access/AccessTest.java deleted file mode 100644 index 65249c2..0000000 --- a/src/test/java/org/gcube/informationsystem/resourceregistry/access/AccessTest.java +++ /dev/null @@ -1,73 +0,0 @@ -package org.gcube.informationsystem.resourceregistry.access; - -import javax.ws.rs.core.Application; -import javax.ws.rs.core.Response; - -import org.gcube.informationsystem.resourceregistry.AccessManagerFactory; -import org.gcube.informationsystem.resourceregistry.ContextManagerFactory; -import org.gcube.informationsystem.resourceregistry.SchemaManagerFactory; -import org.gcube.informationsystem.resourceregistry.context.ContextManagement; -import org.gcube.informationsystem.resourceregistry.rest.Access; -import org.gcube.informationsystem.resourceregistry.rest.ResourceRegistryExceptionMapper; -import org.gcube.informationsystem.resourceregistry.schema.SchemaManagement; -import org.glassfish.hk2.utilities.binding.AbstractBinder; -import org.glassfish.jersey.server.ResourceConfig; -import org.glassfish.jersey.test.JerseyTest; -import org.junit.Assert; -import org.junit.Test; - -public class AccessTest extends JerseyTest{ - - - @Override - protected Application configure() { - AbstractBinder binder = new AbstractBinder() { - @Override - protected void configure() { - bindFactory(ContextManagerFactory.class).to(ContextManagement.class); - bindFactory(AccessManagerFactory.class).to(Access.class); - bindFactory(SchemaManagerFactory.class).to(SchemaManagement.class); - } - }; - ResourceConfig config = new ResourceConfig(Access.class, ResourceRegistryExceptionMapper.class); - config.register(binder); - return config; - } - - @Test - public void validQuery(){ - Response response = target("access").queryParam("query", "select * from test").request().get(Response.class); - Assert.assertEquals(200, response.getStatus()); - } - - @Test - public void invalidQuery(){ - Response response = target("access").queryParam("query", "error").request().get(Response.class); - Assert.assertEquals(400, response.getStatus()); - } - - @Test - public void getfacet(){ - Response response = target("access").path("facet").path("facetId").request().get(Response.class); - Assert.assertEquals(200, response.getStatus()); - } - - @Test - public void getResource(){ - Response response = target("access").path("resource").path("resourceId").request().get(Response.class); - Assert.assertEquals(200, response.getStatus()); - } - - @Test - public void getfacetSchema(){ - Response response = target("access").path("facet").path("schema").path("facetType").request().get(Response.class); - Assert.assertEquals(200, response.getStatus()); - } - - @Test - public void getResourceSchema(){ - Response response = target("access").path("resource").path("schema").path("resourceType").request().get(Response.class); - Assert.assertEquals(200, response.getStatus()); - } - -} diff --git a/src/test/java/org/gcube/informationsystem/resourceregistry/resources/impl/QueryImplTest.java b/src/test/java/org/gcube/informationsystem/resourceregistry/access/QueryImplTest.java similarity index 91% rename from src/test/java/org/gcube/informationsystem/resourceregistry/resources/impl/QueryImplTest.java rename to src/test/java/org/gcube/informationsystem/resourceregistry/access/QueryImplTest.java index 5c9e041..25b8390 100644 --- a/src/test/java/org/gcube/informationsystem/resourceregistry/resources/impl/QueryImplTest.java +++ b/src/test/java/org/gcube/informationsystem/resourceregistry/access/QueryImplTest.java @@ -1,7 +1,7 @@ /** * */ -package org.gcube.informationsystem.resourceregistry.resources.impl; +package org.gcube.informationsystem.resourceregistry.access; import org.gcube.informationsystem.resourceregistry.ScopedTest; import org.gcube.informationsystem.resourceregistry.api.exceptions.InvalidQueryException; diff --git a/src/test/java/org/gcube/informationsystem/resourceregistry/resources/impl/ContextManagementImplTest.java b/src/test/java/org/gcube/informationsystem/resourceregistry/context/ContextManagementImplTest.java similarity index 98% rename from src/test/java/org/gcube/informationsystem/resourceregistry/resources/impl/ContextManagementImplTest.java rename to src/test/java/org/gcube/informationsystem/resourceregistry/context/ContextManagementImplTest.java index f8c83ad..6062c29 100644 --- a/src/test/java/org/gcube/informationsystem/resourceregistry/resources/impl/ContextManagementImplTest.java +++ b/src/test/java/org/gcube/informationsystem/resourceregistry/context/ContextManagementImplTest.java @@ -1,7 +1,7 @@ /** * */ -package org.gcube.informationsystem.resourceregistry.resources.impl; +package org.gcube.informationsystem.resourceregistry.context; import java.util.UUID; @@ -11,7 +11,6 @@ import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegis import org.gcube.informationsystem.resourceregistry.api.exceptions.context.ContextCreationException; import org.gcube.informationsystem.resourceregistry.api.exceptions.context.ContextException; import org.gcube.informationsystem.resourceregistry.api.exceptions.context.ContextNotFoundException; -import org.gcube.informationsystem.resourceregistry.context.ContextManagementImpl; import org.junit.Assert; import org.junit.Test; import org.slf4j.Logger; diff --git a/src/test/java/org/gcube/informationsystem/resourceregistry/context/ContextManagementTest.java b/src/test/java/org/gcube/informationsystem/resourceregistry/context/ContextManagementTest.java deleted file mode 100644 index c9b7a76..0000000 --- a/src/test/java/org/gcube/informationsystem/resourceregistry/context/ContextManagementTest.java +++ /dev/null @@ -1,56 +0,0 @@ -package org.gcube.informationsystem.resourceregistry.context; - -import javax.ws.rs.client.Entity; -import javax.ws.rs.core.Application; -import javax.ws.rs.core.Response; - -import org.gcube.informationsystem.resourceregistry.ContextManagerFactory; -import org.gcube.informationsystem.resourceregistry.rest.ContextManager; -import org.gcube.informationsystem.resourceregistry.rest.ResourceRegistryExceptionMapper; -import org.glassfish.hk2.utilities.binding.AbstractBinder; -import org.glassfish.jersey.server.ResourceConfig; -import org.glassfish.jersey.test.JerseyTest; -import org.junit.Assert; -import org.junit.Test; - -public class ContextManagementTest extends JerseyTest { - - @Override - protected Application configure() { - AbstractBinder binder = new AbstractBinder() { - @Override - protected void configure() { - bindFactory(ContextManagerFactory.class) - .to(ContextManagement.class); - } - }; - ResourceConfig config = new ResourceConfig(ContextManager.class, ResourceRegistryExceptionMapper.class); - config.register(binder); - return config; - } - - - @Test - public void create(){ - Response response = target("context").path("parentContextId").request().put(Entity.text(new String("{fake context creation}")), Response.class); - Assert.assertEquals(Response.Status.OK.getStatusCode(), response.getStatus()); - } - - @Test - public void delete(){ - Response response = target("context").path("contextID").request().delete(Response.class); - Assert.assertEquals(Response.Status.OK.getStatusCode(), response.getStatus()); - } - - @Test - public void move(){ - Response response = target("context").path("Move").path("contextID").request().put(Entity.text(new String("{newContextParentId}")), Response.class); - Assert.assertEquals(Response.Status.OK.getStatusCode(), response.getStatus()); - } - - @Test - public void rename(){ - Response response = target("context").path("Rename").path("contextID").request().put(Entity.text(new String("{newName}")), Response.class); - Assert.assertEquals(Response.Status.OK.getStatusCode(), response.getStatus()); - } -} diff --git a/src/test/java/org/gcube/informationsystem/resourceregistry/resources/impl/MultiContextTest.java b/src/test/java/org/gcube/informationsystem/resourceregistry/context/MultiContextTest.java similarity index 97% rename from src/test/java/org/gcube/informationsystem/resourceregistry/resources/impl/MultiContextTest.java rename to src/test/java/org/gcube/informationsystem/resourceregistry/context/MultiContextTest.java index c8e5fcf..6efaf6b 100644 --- a/src/test/java/org/gcube/informationsystem/resourceregistry/resources/impl/MultiContextTest.java +++ b/src/test/java/org/gcube/informationsystem/resourceregistry/context/MultiContextTest.java @@ -1,7 +1,7 @@ /** * */ -package org.gcube.informationsystem.resourceregistry.resources.impl; +package org.gcube.informationsystem.resourceregistry.context; import java.net.URI; import java.net.URL; @@ -47,8 +47,8 @@ import org.gcube.informationsystem.resourceregistry.ScopedTest; import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException; import org.gcube.informationsystem.resourceregistry.api.exceptions.context.ContextNotFoundException; import org.gcube.informationsystem.resourceregistry.api.exceptions.entity.resource.ResourceNotFoundException; -import org.gcube.informationsystem.resourceregistry.ermanagement.entity.FacetManagement; -import org.gcube.informationsystem.resourceregistry.ermanagement.entity.ResourceManagement; +import org.gcube.informationsystem.resourceregistry.er.entity.FacetManagement; +import org.gcube.informationsystem.resourceregistry.er.entity.ResourceManagement; import org.junit.Assert; import org.junit.Test; import org.slf4j.Logger; diff --git a/src/test/java/org/gcube/informationsystem/resourceregistry/dbinitialization/ContextCreation.java b/src/test/java/org/gcube/informationsystem/resourceregistry/dbinitialization/ContextCreation.java deleted file mode 100644 index 3645c6f..0000000 --- a/src/test/java/org/gcube/informationsystem/resourceregistry/dbinitialization/ContextCreation.java +++ /dev/null @@ -1,40 +0,0 @@ -/** - * - */ -package org.gcube.informationsystem.resourceregistry.dbinitialization; - -import org.gcube.informationsystem.impl.utils.discovery.ERDiscovery; -import org.gcube.informationsystem.model.embedded.Embedded; -import org.gcube.informationsystem.model.entity.Entity; -import org.gcube.informationsystem.model.relation.Relation; -import org.junit.Test; - -import com.tinkerpop.blueprints.impls.orient.OrientGraphFactory; - -/** - * @author Luca Frosini (ISTI - CNR) - * - */ -public class ContextCreation { - - @Test - public void aux() throws Exception{ - OrientGraphFactory factory = new OrientGraphFactory("remote:pc-frosini.isti.cnr.it", "admin", "admin").setupPool(1, 10); - factory.getTx(); - } - - @Test - public void test() throws Exception{ - ERDiscovery.addPackage(Embedded.class.getPackage()); - ERDiscovery.addPackage(Entity.class.getPackage()); - ERDiscovery.addPackage(Relation.class.getPackage()); - - ERDiscovery erDiscovery = new ERDiscovery(); - erDiscovery.discoverERTypes(); - - - //EntityRegistrationAction erEntityRegistrationAction = new EntityRegistrationAction(); - //erDiscovery.manageDiscoveredERTypes(erEntityRegistrationAction); - } - -} diff --git a/src/test/java/org/gcube/informationsystem/resourceregistry/resources/impl/ERManagementTest.java b/src/test/java/org/gcube/informationsystem/resourceregistry/er/ERManagementTest.java similarity index 97% rename from src/test/java/org/gcube/informationsystem/resourceregistry/resources/impl/ERManagementTest.java rename to src/test/java/org/gcube/informationsystem/resourceregistry/er/ERManagementTest.java index 8d8766b..ee83dea 100644 --- a/src/test/java/org/gcube/informationsystem/resourceregistry/resources/impl/ERManagementTest.java +++ b/src/test/java/org/gcube/informationsystem/resourceregistry/er/ERManagementTest.java @@ -1,7 +1,7 @@ /** * */ -package org.gcube.informationsystem.resourceregistry.resources.impl; +package org.gcube.informationsystem.resourceregistry.er; import java.net.URI; import java.net.URL; @@ -43,9 +43,9 @@ import org.gcube.informationsystem.model.relation.Relation; import org.gcube.informationsystem.model.relation.isrelatedto.Hosts; import org.gcube.informationsystem.resourceregistry.ScopedTest; import org.gcube.informationsystem.resourceregistry.api.exceptions.entity.facet.FacetNotFoundException; -import org.gcube.informationsystem.resourceregistry.ermanagement.entity.FacetManagement; -import org.gcube.informationsystem.resourceregistry.ermanagement.entity.ResourceManagement; -import org.gcube.informationsystem.resourceregistry.ermanagement.relation.ConsistsOfManagement; +import org.gcube.informationsystem.resourceregistry.er.entity.FacetManagement; +import org.gcube.informationsystem.resourceregistry.er.entity.ResourceManagement; +import org.gcube.informationsystem.resourceregistry.er.relation.ConsistsOfManagement; import org.junit.Assert; import org.junit.Test; import org.slf4j.Logger; diff --git a/src/test/java/org/gcube/informationsystem/resourceregistry/resources/impl/SmartgearResourcesTest.java b/src/test/java/org/gcube/informationsystem/resourceregistry/er/SmartgearResourcesTest.java similarity index 99% rename from src/test/java/org/gcube/informationsystem/resourceregistry/resources/impl/SmartgearResourcesTest.java rename to src/test/java/org/gcube/informationsystem/resourceregistry/er/SmartgearResourcesTest.java index e42a4c6..350b022 100644 --- a/src/test/java/org/gcube/informationsystem/resourceregistry/resources/impl/SmartgearResourcesTest.java +++ b/src/test/java/org/gcube/informationsystem/resourceregistry/er/SmartgearResourcesTest.java @@ -1,7 +1,7 @@ /** * */ -package org.gcube.informationsystem.resourceregistry.resources.impl; +package org.gcube.informationsystem.resourceregistry.er; import java.io.BufferedReader; import java.io.File; @@ -56,7 +56,7 @@ import org.gcube.informationsystem.model.relation.consistsof.HasPersistentMemory import org.gcube.informationsystem.model.relation.consistsof.HasVolatileMemory; import org.gcube.informationsystem.resourceregistry.ScopedTest; import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException; -import org.gcube.informationsystem.resourceregistry.ermanagement.entity.ResourceManagement; +import org.gcube.informationsystem.resourceregistry.er.entity.ResourceManagement; import org.junit.Assert; import org.junit.Test; import org.slf4j.Logger; diff --git a/src/test/java/org/gcube/informationsystem/resourceregistry/resources/impl/SchemaManagementImplTest.java b/src/test/java/org/gcube/informationsystem/resourceregistry/schema/SchemaManagementImplTest.java similarity index 98% rename from src/test/java/org/gcube/informationsystem/resourceregistry/resources/impl/SchemaManagementImplTest.java rename to src/test/java/org/gcube/informationsystem/resourceregistry/schema/SchemaManagementImplTest.java index d6509a0..2776258 100644 --- a/src/test/java/org/gcube/informationsystem/resourceregistry/resources/impl/SchemaManagementImplTest.java +++ b/src/test/java/org/gcube/informationsystem/resourceregistry/schema/SchemaManagementImplTest.java @@ -1,7 +1,7 @@ /** * */ -package org.gcube.informationsystem.resourceregistry.resources.impl; +package org.gcube.informationsystem.resourceregistry.schema; import java.util.List;