Fixed AccessType from type definition. Added Assertion on tests
This commit is contained in:
parent
62752a369d
commit
384be462bb
|
@ -13,6 +13,7 @@ import org.gcube.com.fasterxml.jackson.annotation.JsonInclude;
|
|||
import org.gcube.com.fasterxml.jackson.annotation.JsonInclude.Include;
|
||||
import org.gcube.com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import org.gcube.com.fasterxml.jackson.annotation.JsonSetter;
|
||||
import org.gcube.informationsystem.base.reference.AccessType;
|
||||
import org.gcube.informationsystem.base.reference.Element;
|
||||
import org.gcube.informationsystem.base.reference.entities.EntityElement;
|
||||
import org.gcube.informationsystem.base.reference.properties.PropertyElement;
|
||||
|
@ -260,5 +261,10 @@ public class TypeImpl implements Type {
|
|||
public Set<PropertyDefinition> getProperties() {
|
||||
return properties;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AccessType getAccessType() {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -11,6 +11,8 @@ import org.gcube.informationsystem.model.reference.entities.Resource;
|
|||
import org.gcube.informationsystem.model.reference.properties.Header;
|
||||
import org.gcube.informationsystem.types.impl.TypeImpl;
|
||||
import org.gcube.informationsystem.types.reference.entities.EntityType;
|
||||
import org.gcube.informationsystem.types.reference.entities.FacetType;
|
||||
import org.gcube.informationsystem.types.reference.entities.ResourceType;
|
||||
import org.gcube.informationsystem.utils.ElementMapper;
|
||||
|
||||
/**
|
||||
|
@ -106,14 +108,16 @@ public class EntityTypeImpl extends TypeImpl implements EntityType {
|
|||
return AccessType.CONTEXT;
|
||||
}
|
||||
|
||||
if(name.compareTo(EntityType.NAME)==0) {
|
||||
return AccessType.ENTITY_TYPE;
|
||||
}
|
||||
|
||||
if(name.compareTo(EntityElement.NAME)==0) {
|
||||
return AccessType.ENTITY_ELEMENT;
|
||||
}
|
||||
|
||||
if(name.compareTo(EntityType.NAME)==0 ||
|
||||
name.compareTo(ResourceType.NAME)==0 ||
|
||||
name.compareTo(FacetType.NAME)==0) {
|
||||
return AccessType.ENTITY_TYPE;
|
||||
}
|
||||
|
||||
return AccessType.ENTITY;
|
||||
}
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ package org.gcube.informationsystem.types.impl.entities;
|
|||
import java.util.Set;
|
||||
|
||||
import org.gcube.com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
import org.gcube.informationsystem.base.reference.AccessType;
|
||||
import org.gcube.informationsystem.model.reference.entities.Entity;
|
||||
import org.gcube.informationsystem.model.reference.entities.Facet;
|
||||
import org.gcube.informationsystem.types.reference.entities.FacetType;
|
||||
|
@ -36,4 +37,9 @@ public class FacetTypeImpl extends EntityTypeImpl implements FacetType {
|
|||
return properties;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AccessType getAccessType() {
|
||||
return AccessType.FACET;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
import org.gcube.com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
import org.gcube.informationsystem.base.reference.AccessType;
|
||||
import org.gcube.informationsystem.model.reference.entities.Entity;
|
||||
import org.gcube.informationsystem.model.reference.entities.Resource;
|
||||
import org.gcube.informationsystem.types.TypeMapper;
|
||||
|
@ -78,4 +79,9 @@ public class ResourceTypeImpl extends EntityTypeImpl implements ResourceType {
|
|||
return resources;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AccessType getAccessType() {
|
||||
return AccessType.RESOURCE;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ import org.gcube.com.fasterxml.jackson.annotation.JsonTypeName;
|
|||
import org.gcube.informationsystem.base.reference.AccessType;
|
||||
import org.gcube.informationsystem.base.reference.properties.PropertyElement;
|
||||
import org.gcube.informationsystem.types.impl.TypeImpl;
|
||||
import org.gcube.informationsystem.types.reference.properties.LinkedEntity;
|
||||
import org.gcube.informationsystem.types.reference.properties.PropertyDefinition;
|
||||
import org.gcube.informationsystem.types.reference.properties.PropertyType;
|
||||
|
||||
|
@ -43,7 +44,16 @@ public final class PropertyTypeImpl<P extends PropertyElement> extends TypeImpl
|
|||
@Override
|
||||
public AccessType getAccessType() {
|
||||
|
||||
if(name.compareTo(PropertyElement.NAME)==0) {
|
||||
if(name.compareTo(PropertyType.NAME)==0) {
|
||||
return AccessType.PROPERTY_TYPE;
|
||||
}
|
||||
|
||||
if(name.compareTo(PropertyDefinition.NAME)==0) {
|
||||
return AccessType.PROPERTY_DEFINITION;
|
||||
}
|
||||
|
||||
if(name.compareTo(PropertyElement.NAME)==0 ||
|
||||
name.compareTo(LinkedEntity.NAME)==0) {
|
||||
return AccessType.PROPERTY_ELEMENT;
|
||||
}
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ package org.gcube.informationsystem.types.impl.relations;
|
|||
import java.lang.reflect.Type;
|
||||
|
||||
import org.gcube.com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
import org.gcube.informationsystem.base.reference.AccessType;
|
||||
import org.gcube.informationsystem.model.reference.entities.Facet;
|
||||
import org.gcube.informationsystem.model.reference.entities.Resource;
|
||||
import org.gcube.informationsystem.model.reference.relations.ConsistsOf;
|
||||
|
@ -56,4 +57,10 @@ public class ConsistsOfTypeImpl extends RelationTypeImpl<ResourceType, FacetType
|
|||
this.source = new ResourceTypeImpl((Class<? extends Resource>) sourceClass);
|
||||
this.target = new FacetTypeImpl((Class<? extends Facet>) targetClass);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AccessType getAccessType() {
|
||||
return AccessType.CONSISTS_OF;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package org.gcube.informationsystem.types.impl.relations;
|
|||
import java.lang.reflect.Type;
|
||||
|
||||
import org.gcube.com.fasterxml.jackson.annotation.JsonTypeName;
|
||||
import org.gcube.informationsystem.base.reference.AccessType;
|
||||
import org.gcube.informationsystem.model.reference.entities.Resource;
|
||||
import org.gcube.informationsystem.model.reference.relations.IsRelatedTo;
|
||||
import org.gcube.informationsystem.model.reference.relations.Relation;
|
||||
|
@ -53,4 +54,10 @@ public class IsRelatedToTypeImpl extends RelationTypeImpl<ResourceType, Resource
|
|||
this.source = new ResourceTypeImpl((Class<? extends Resource>) sourceClass);
|
||||
this.target = new ResourceTypeImpl((Class<? extends Resource>) targetClass);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AccessType getAccessType() {
|
||||
return AccessType.IS_RELATED_TO;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -15,6 +15,8 @@ import org.gcube.informationsystem.model.reference.relations.IsRelatedTo;
|
|||
import org.gcube.informationsystem.types.impl.TypeImpl;
|
||||
import org.gcube.informationsystem.types.impl.entities.EntityTypeImpl;
|
||||
import org.gcube.informationsystem.types.reference.entities.EntityType;
|
||||
import org.gcube.informationsystem.types.reference.relations.ConsistsOfType;
|
||||
import org.gcube.informationsystem.types.reference.relations.IsRelatedToType;
|
||||
import org.gcube.informationsystem.types.reference.relations.RelationType;
|
||||
|
||||
/**
|
||||
|
@ -140,14 +142,17 @@ public class RelationTypeImpl<S extends EntityType, T extends EntityType>
|
|||
return AccessType.IS_PARENT_OF;
|
||||
}
|
||||
|
||||
if(name.compareTo(RelationType.NAME)==0) {
|
||||
return AccessType.RELATION_TYPE;
|
||||
}
|
||||
|
||||
if(name.compareTo(RelationElement.NAME)==0) {
|
||||
return AccessType.RELATION_ELEMENT;
|
||||
}
|
||||
|
||||
if(name.compareTo(RelationType.NAME)==0 ||
|
||||
name.compareTo(IsRelatedToType.NAME)==0 ||
|
||||
name.compareTo(ConsistsOfType.NAME)==0) {
|
||||
return AccessType.RELATION_TYPE;
|
||||
}
|
||||
|
||||
return AccessType.RELATION;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -54,9 +54,6 @@ public interface Type extends IdentifiableElement {
|
|||
|
||||
public Set<PropertyDefinition> getProperties();
|
||||
|
||||
@JsonIgnore
|
||||
public default AccessType getAccessType() {
|
||||
return null;
|
||||
}
|
||||
public AccessType getAccessType();
|
||||
|
||||
}
|
||||
|
|
|
@ -44,9 +44,6 @@ public interface EntityType extends Type, EntityElement {
|
|||
|
||||
/* {@link Type} is just a Java useful class. The type is not created in the IS. Hence the fields must be redefined */
|
||||
|
||||
@Override
|
||||
public default AccessType getAccessType() {
|
||||
return AccessType.ENTITY_ELEMENT;
|
||||
}
|
||||
public AccessType getAccessType();
|
||||
|
||||
}
|
||||
|
|
|
@ -4,7 +4,6 @@ import java.util.Set;
|
|||
|
||||
import org.gcube.com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import org.gcube.com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import org.gcube.informationsystem.base.reference.AccessType;
|
||||
import org.gcube.informationsystem.types.annotations.ISProperty;
|
||||
import org.gcube.informationsystem.types.impl.entities.FacetTypeImpl;
|
||||
import org.gcube.informationsystem.types.reference.Change;
|
||||
|
@ -27,9 +26,4 @@ public interface FacetType extends EntityType {
|
|||
@ISProperty(name = Type.PROPERTIES_PROPERTY, readonly = false, mandatory = true, nullable = false)
|
||||
public Set<PropertyDefinition> getProperties();
|
||||
|
||||
@Override
|
||||
public default AccessType getAccessType() {
|
||||
return AccessType.FACET;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -3,7 +3,6 @@ package org.gcube.informationsystem.types.reference.entities;
|
|||
import java.util.List;
|
||||
|
||||
import org.gcube.com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import org.gcube.informationsystem.base.reference.AccessType;
|
||||
import org.gcube.informationsystem.types.annotations.ISProperty;
|
||||
import org.gcube.informationsystem.types.impl.entities.ResourceTypeImpl;
|
||||
import org.gcube.informationsystem.types.reference.Change;
|
||||
|
@ -30,9 +29,4 @@ public interface ResourceType extends EntityType {
|
|||
@ISProperty(name = RESOURCES_PROPERTY, readonly = false, mandatory = true, nullable = false)
|
||||
public List<LinkedEntity> getResources();
|
||||
|
||||
@Override
|
||||
public default AccessType getAccessType() {
|
||||
return AccessType.RESOURCE;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -4,7 +4,6 @@ import java.util.Set;
|
|||
|
||||
import org.gcube.com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import org.gcube.com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import org.gcube.informationsystem.base.reference.AccessType;
|
||||
import org.gcube.informationsystem.base.reference.IdentifiableElement;
|
||||
import org.gcube.informationsystem.base.reference.properties.PropertyElement;
|
||||
import org.gcube.informationsystem.model.reference.properties.Header;
|
||||
|
@ -53,8 +52,5 @@ public interface PropertyType<P extends PropertyElement> extends PropertyElement
|
|||
public Set<PropertyDefinition> getProperties();
|
||||
|
||||
/* TypeDefinition is just a Java useful class. The type is not created in the IS. Hence the fields must be redefined */
|
||||
@Override
|
||||
public default AccessType getAccessType() {
|
||||
return AccessType.PROPERTY_ELEMENT;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package org.gcube.informationsystem.types.reference.relations;
|
||||
|
||||
import org.gcube.com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import org.gcube.informationsystem.base.reference.AccessType;
|
||||
import org.gcube.informationsystem.types.impl.relations.ConsistsOfTypeImpl;
|
||||
import org.gcube.informationsystem.types.reference.Change;
|
||||
import org.gcube.informationsystem.types.reference.TypeMetadata;
|
||||
|
@ -19,9 +18,4 @@ public interface ConsistsOfType extends RelationType<ResourceType, FacetType> {
|
|||
|
||||
public static final String NAME = "ConsistsOfType"; // ConsistsOfType.class.getSimpleName();
|
||||
|
||||
@Override
|
||||
public default AccessType getAccessType() {
|
||||
return AccessType.CONSISTS_OF;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package org.gcube.informationsystem.types.reference.relations;
|
||||
|
||||
import org.gcube.com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import org.gcube.informationsystem.base.reference.AccessType;
|
||||
import org.gcube.informationsystem.types.impl.relations.IsRelatedToTypeImpl;
|
||||
import org.gcube.informationsystem.types.reference.Change;
|
||||
import org.gcube.informationsystem.types.reference.TypeMetadata;
|
||||
|
@ -18,9 +17,4 @@ public interface IsRelatedToType extends RelationType<ResourceType, ResourceType
|
|||
|
||||
public static final String NAME = "IsRelatedToType"; // IsRelatedToType.class.getSimpleName();
|
||||
|
||||
@Override
|
||||
public default AccessType getAccessType() {
|
||||
return AccessType.IS_RELATED_TO;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -4,7 +4,6 @@ import java.util.Set;
|
|||
|
||||
import org.gcube.com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import org.gcube.com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import org.gcube.informationsystem.base.reference.AccessType;
|
||||
import org.gcube.informationsystem.base.reference.relations.RelationElement;
|
||||
import org.gcube.informationsystem.types.annotations.ISProperty;
|
||||
import org.gcube.informationsystem.types.impl.relations.RelationTypeImpl;
|
||||
|
@ -62,9 +61,4 @@ public interface RelationType<S extends EntityType, T extends EntityType>
|
|||
@JsonGetter(value=TARGET_PROPERTY)
|
||||
public String getTargetType();*/
|
||||
|
||||
@Override
|
||||
public default AccessType getAccessType() {
|
||||
return AccessType.RELATION_ELEMENT;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package org.gcube.informationsystem.types;
|
||||
|
||||
import org.gcube.informationsystem.base.reference.AccessType;
|
||||
import org.gcube.informationsystem.base.reference.entities.EntityElement;
|
||||
import org.gcube.informationsystem.base.reference.properties.PropertyElement;
|
||||
import org.gcube.informationsystem.context.reference.entities.Context;
|
||||
|
@ -25,6 +26,7 @@ import org.gcube.informationsystem.types.reference.relations.IsRelatedToType;
|
|||
import org.gcube.informationsystem.types.reference.relations.RelationType;
|
||||
import org.gcube.informationsystem.utils.ElementMapper;
|
||||
import org.gcube.informationsystem.utils.TypeVersion;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -57,91 +59,115 @@ public class SerializationTest {
|
|||
@Test
|
||||
public void testPropertyTypeDefinition() throws Exception{
|
||||
@SuppressWarnings("unchecked")
|
||||
PropertyType<PropertyElement> basePropertyTypeDefinition = (PropertyType<PropertyElement>) TypeMapper.createTypeDefinition(PropertyElement.class);
|
||||
logger.info(ElementMapper.marshal(basePropertyTypeDefinition));
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
PropertyType<Property> propertyTypeDefinition = (PropertyType<Property>) TypeMapper.createTypeDefinition(Property.class);
|
||||
logger.info(ElementMapper.marshal(propertyTypeDefinition));
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
PropertyType<Header> headerTypeDefinition = (PropertyType<Header>) TypeMapper.createTypeDefinition(Header.class);
|
||||
logger.info(ElementMapper.marshal(headerTypeDefinition));
|
||||
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
PropertyType<PropagationConstraint> propagationConstraintDefinition = (PropertyType<PropagationConstraint>) TypeMapper.createTypeDefinition(PropagationConstraint.class);
|
||||
logger.info(ElementMapper.marshal(propagationConstraintDefinition));
|
||||
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
PropertyType<Encrypted> encryptedTypeDefinition = (PropertyType<Encrypted>) TypeMapper.createTypeDefinition(Encrypted.class);
|
||||
logger.info(ElementMapper.marshal(encryptedTypeDefinition));
|
||||
PropertyType<PropertyElement> propertyElement = (PropertyType<PropertyElement>) TypeMapper.createTypeDefinition(PropertyElement.class);
|
||||
Assert.assertTrue(propertyElement.getAccessType()==AccessType.PROPERTY_ELEMENT);
|
||||
logger.info(ElementMapper.marshal(propertyElement));
|
||||
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
PropertyType<PropertyType> propertyType = (PropertyType<PropertyType>) TypeMapper.createTypeDefinition(PropertyType.class);
|
||||
Assert.assertTrue(propertyType.getAccessType()==AccessType.PROPERTY_TYPE);
|
||||
logger.info(ElementMapper.marshal(propertyType));
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
PropertyType<PropertyDefinition> propertyDefinition = (PropertyType<PropertyDefinition>) TypeMapper.createTypeDefinition(PropertyDefinition.class);
|
||||
Assert.assertTrue(propertyDefinition.getAccessType()==AccessType.PROPERTY_DEFINITION);
|
||||
logger.info(ElementMapper.marshal(propertyDefinition));
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
PropertyType<LinkedEntity> resourceEntryDefinition = (PropertyType<LinkedEntity>) TypeMapper.createTypeDefinition(LinkedEntity.class);
|
||||
logger.info(ElementMapper.marshal(resourceEntryDefinition));
|
||||
PropertyType<LinkedEntity> linkedEntity = (PropertyType<LinkedEntity>) TypeMapper.createTypeDefinition(LinkedEntity.class);
|
||||
Assert.assertTrue(linkedEntity.getAccessType()==AccessType.PROPERTY_ELEMENT);
|
||||
logger.info(ElementMapper.marshal(linkedEntity));
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
PropertyType<Property> property = (PropertyType<Property>) TypeMapper.createTypeDefinition(Property.class);
|
||||
Assert.assertTrue(property.getAccessType()==AccessType.PROPERTY);
|
||||
logger.info(ElementMapper.marshal(property));
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
PropertyType<Header> header = (PropertyType<Header>) TypeMapper.createTypeDefinition(Header.class);
|
||||
Assert.assertTrue(header.getAccessType()==AccessType.PROPERTY);
|
||||
logger.info(ElementMapper.marshal(header));
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
PropertyType<PropagationConstraint> propagationConstraint = (PropertyType<PropagationConstraint>) TypeMapper.createTypeDefinition(PropagationConstraint.class);
|
||||
Assert.assertTrue(propagationConstraint.getAccessType()==AccessType.PROPERTY);
|
||||
logger.info(ElementMapper.marshal(propagationConstraint));
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
PropertyType<Encrypted> encrypted = (PropertyType<Encrypted>) TypeMapper.createTypeDefinition(Encrypted.class);
|
||||
Assert.assertTrue(encrypted.getAccessType()==AccessType.PROPERTY);
|
||||
logger.info(ElementMapper.marshal(encrypted));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEntityTypeDefinition() throws Exception{
|
||||
EntityType baseEntityTypeDefinition = (EntityType) TypeMapper.createTypeDefinition(EntityElement.class);
|
||||
logger.info(ElementMapper.marshal(baseEntityTypeDefinition));
|
||||
EntityType entityElement = (EntityType) TypeMapper.createTypeDefinition(EntityElement.class);
|
||||
Assert.assertTrue(entityElement.getAccessType()==AccessType.ENTITY_ELEMENT);
|
||||
logger.info(ElementMapper.marshal(entityElement));
|
||||
|
||||
EntityType entityTypeDefinition = (EntityType) TypeMapper.createTypeDefinition(Entity.class);
|
||||
logger.info(ElementMapper.marshal(entityTypeDefinition));
|
||||
EntityType entity = (EntityType) TypeMapper.createTypeDefinition(Entity.class);
|
||||
Assert.assertTrue(entity.getAccessType()==AccessType.ENTITY);
|
||||
logger.info(ElementMapper.marshal(entity));
|
||||
|
||||
ResourceType resourceTypeDefinition = (ResourceType) TypeMapper.createTypeDefinition(Resource.class);
|
||||
logger.info(ElementMapper.marshal(resourceTypeDefinition));
|
||||
ResourceType resource = (ResourceType) TypeMapper.createTypeDefinition(Resource.class);
|
||||
Assert.assertTrue(resource.getAccessType()==AccessType.RESOURCE);
|
||||
logger.info(ElementMapper.marshal(resource));
|
||||
|
||||
FacetType facetTypeDefinition = (FacetType) TypeMapper.createTypeDefinition(Facet.class);
|
||||
logger.info(ElementMapper.marshal(facetTypeDefinition));
|
||||
FacetType facet = (FacetType) TypeMapper.createTypeDefinition(Facet.class);
|
||||
Assert.assertTrue(facet.getAccessType()==AccessType.FACET);
|
||||
logger.info(ElementMapper.marshal(facet));
|
||||
|
||||
EntityType contextTypeDefinition = (EntityType) TypeMapper.createTypeDefinition(Context.class);
|
||||
logger.info(ElementMapper.marshal(contextTypeDefinition));
|
||||
EntityType context = (EntityType) TypeMapper.createTypeDefinition(Context.class);
|
||||
Assert.assertTrue(context.getAccessType()==AccessType.CONTEXT);
|
||||
logger.info(ElementMapper.marshal(context));
|
||||
|
||||
EntityType entityTypeDefinitionSelf = (EntityType) TypeMapper.createTypeDefinition(EntityType.class);
|
||||
logger.info(ElementMapper.marshal(entityTypeDefinitionSelf));
|
||||
EntityType entityType = (EntityType) TypeMapper.createTypeDefinition(EntityType.class);
|
||||
Assert.assertTrue(entityType.getAccessType()==AccessType.ENTITY_TYPE);
|
||||
logger.info(ElementMapper.marshal(entityType));
|
||||
|
||||
EntityType resourceTypeDefinitionSelf = (EntityType) TypeMapper.createTypeDefinition(ResourceType.class);
|
||||
logger.info(ElementMapper.marshal(resourceTypeDefinitionSelf));
|
||||
EntityType resourceType = (EntityType) TypeMapper.createTypeDefinition(ResourceType.class);
|
||||
Assert.assertTrue(resourceType.getAccessType()==AccessType.ENTITY_TYPE);
|
||||
logger.info(ElementMapper.marshal(resourceType));
|
||||
|
||||
EntityType facetTypeDefinitionSelf = (EntityType) TypeMapper.createTypeDefinition(FacetType.class);
|
||||
logger.info(ElementMapper.marshal(facetTypeDefinitionSelf));
|
||||
EntityType facetType = (EntityType) TypeMapper.createTypeDefinition(FacetType.class);
|
||||
Assert.assertTrue(facetType.getAccessType()==AccessType.ENTITY_TYPE);
|
||||
logger.info(ElementMapper.marshal(facetType));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRelationTypeDefinition() throws Exception{
|
||||
@SuppressWarnings("unchecked")
|
||||
RelationType<EntityType,EntityType> relationTypeDefinition = (RelationType<EntityType,EntityType>) TypeMapper.createTypeDefinition(Relation.class);
|
||||
logger.info(ElementMapper.marshal(relationTypeDefinition));
|
||||
RelationType<EntityType,EntityType> relation = (RelationType<EntityType,EntityType>) TypeMapper.createTypeDefinition(Relation.class);
|
||||
Assert.assertTrue(relation.getAccessType()==AccessType.RELATION);
|
||||
logger.info(ElementMapper.marshal(relation));
|
||||
|
||||
IsRelatedToType isRelatedToTypeDefinition = (IsRelatedToType) TypeMapper.createTypeDefinition(IsRelatedTo.class);
|
||||
logger.info(ElementMapper.marshal(isRelatedToTypeDefinition));
|
||||
IsRelatedToType isRelatedTo = (IsRelatedToType) TypeMapper.createTypeDefinition(IsRelatedTo.class);
|
||||
Assert.assertTrue(isRelatedTo.getAccessType()==AccessType.IS_RELATED_TO);
|
||||
logger.info(ElementMapper.marshal(isRelatedTo));
|
||||
|
||||
ConsistsOfType consistsOfTypeDefinition = (ConsistsOfType) TypeMapper.createTypeDefinition(ConsistsOf.class);
|
||||
logger.info(ElementMapper.marshal(consistsOfTypeDefinition));
|
||||
ConsistsOfType consistsOf = (ConsistsOfType) TypeMapper.createTypeDefinition(ConsistsOf.class);
|
||||
Assert.assertTrue(consistsOf.getAccessType()==AccessType.CONSISTS_OF);
|
||||
logger.info(ElementMapper.marshal(consistsOf));
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
RelationType<EntityType,EntityType> isParentOfTypeDefinition = (RelationType<EntityType,EntityType>) TypeMapper.createTypeDefinition(IsParentOf.class);
|
||||
logger.info(ElementMapper.marshal(isParentOfTypeDefinition));
|
||||
RelationType<EntityType,EntityType> isParentOf = (RelationType<EntityType,EntityType>) TypeMapper.createTypeDefinition(IsParentOf.class);
|
||||
Assert.assertTrue(isParentOf.getAccessType()==AccessType.IS_PARENT_OF);
|
||||
logger.info(ElementMapper.marshal(isParentOf));
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
RelationType<EntityType,EntityType> rtdSelf = (RelationType<EntityType,EntityType>) TypeMapper.createTypeDefinition(RelationType.class);
|
||||
logger.info(ElementMapper.marshal(rtdSelf));
|
||||
RelationType<EntityType,EntityType> relationType = (RelationType<EntityType,EntityType>) TypeMapper.createTypeDefinition(RelationType.class);
|
||||
Assert.assertTrue(relationType.getAccessType()==AccessType.RELATION_TYPE);
|
||||
logger.info(ElementMapper.marshal(relationType));
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
RelationType<EntityType,EntityType> isRelatedToTypeDefinitionSelf = (RelationType<EntityType,EntityType>) TypeMapper.createTypeDefinition(IsRelatedToType.class);
|
||||
logger.info(ElementMapper.marshal(isRelatedToTypeDefinitionSelf));
|
||||
RelationType<EntityType,EntityType> isRelatedToType = (RelationType<EntityType,EntityType>) TypeMapper.createTypeDefinition(IsRelatedToType.class);
|
||||
Assert.assertTrue(isRelatedToType.getAccessType()==AccessType.RELATION_TYPE);
|
||||
logger.info(ElementMapper.marshal(isRelatedToType));
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
RelationType<EntityType,EntityType> consistsOfTypeDefinitionSelf = (RelationType<EntityType,EntityType>) TypeMapper.createTypeDefinition(ConsistsOfType.class);
|
||||
logger.info(ElementMapper.marshal(consistsOfTypeDefinitionSelf));
|
||||
RelationType<EntityType,EntityType> consistsOfType = (RelationType<EntityType,EntityType>) TypeMapper.createTypeDefinition(ConsistsOfType.class);
|
||||
Assert.assertTrue(consistsOfType.getAccessType()==AccessType.RELATION_TYPE);
|
||||
logger.info(ElementMapper.marshal(consistsOfType));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
Loading…
Reference in New Issue