JUnit tests works all again
This commit is contained in:
parent
68b108429c
commit
b1d35aef5d
|
@ -52,6 +52,9 @@ public class PropertyVariableImpl extends PropertyImpl implements PropertyVariab
|
||||||
|
|
||||||
public static void checkRegex(String regex, String text) {
|
public static void checkRegex(String regex, String text) {
|
||||||
try {
|
try {
|
||||||
|
if(regex==null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
Pattern pattern = Pattern.compile(regex);
|
Pattern pattern = Pattern.compile(regex);
|
||||||
if(text!=null) {
|
if(text!=null) {
|
||||||
Matcher matcher = pattern.matcher(text);
|
Matcher matcher = pattern.matcher(text);
|
||||||
|
@ -161,6 +164,7 @@ public class PropertyVariableImpl extends PropertyImpl implements PropertyVariab
|
||||||
return mandatory;
|
return mandatory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setMandatory(boolean mandatory) {
|
public void setMandatory(boolean mandatory) {
|
||||||
this.mandatory = mandatory;
|
this.mandatory = mandatory;
|
||||||
}
|
}
|
||||||
|
@ -170,6 +174,7 @@ public class PropertyVariableImpl extends PropertyImpl implements PropertyVariab
|
||||||
return readonly;
|
return readonly;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setReadonly(boolean readonly) {
|
public void setReadonly(boolean readonly) {
|
||||||
this.readonly = readonly;
|
this.readonly = readonly;
|
||||||
}
|
}
|
||||||
|
@ -179,6 +184,7 @@ public class PropertyVariableImpl extends PropertyImpl implements PropertyVariab
|
||||||
return notnull;
|
return notnull;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setNotnull(boolean notnull) {
|
public void setNotnull(boolean notnull) {
|
||||||
this.notnull = notnull;
|
this.notnull = notnull;
|
||||||
}
|
}
|
||||||
|
@ -188,6 +194,7 @@ public class PropertyVariableImpl extends PropertyImpl implements PropertyVariab
|
||||||
return max;
|
return max;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setMax(Integer max) {
|
public void setMax(Integer max) {
|
||||||
this.max = max;
|
this.max = max;
|
||||||
}
|
}
|
||||||
|
@ -197,6 +204,7 @@ public class PropertyVariableImpl extends PropertyImpl implements PropertyVariab
|
||||||
return min;
|
return min;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setMin(Integer min) {
|
public void setMin(Integer min) {
|
||||||
this.min = min;
|
this.min = min;
|
||||||
}
|
}
|
||||||
|
@ -206,6 +214,7 @@ public class PropertyVariableImpl extends PropertyImpl implements PropertyVariab
|
||||||
return regexp;
|
return regexp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setRegexp(String regexp) {
|
public void setRegexp(String regexp) {
|
||||||
PropertyVariableImpl.checkRegex(regexp, null);
|
PropertyVariableImpl.checkRegex(regexp, null);
|
||||||
this.regexp = regexp;
|
this.regexp = regexp;
|
||||||
|
@ -217,6 +226,7 @@ public class PropertyVariableImpl extends PropertyImpl implements PropertyVariab
|
||||||
}
|
}
|
||||||
|
|
||||||
@JsonSetter(value = PropertyVariable.PROPERTY_TYPE_PROPERTY)
|
@JsonSetter(value = PropertyVariable.PROPERTY_TYPE_PROPERTY)
|
||||||
|
@Override
|
||||||
public void setPropertyType(String type) {
|
public void setPropertyType(String type) {
|
||||||
this.propertyTypeName = new PropertyTypeName(type);
|
this.propertyTypeName = new PropertyTypeName(type);
|
||||||
}
|
}
|
||||||
|
@ -249,7 +259,7 @@ public class PropertyVariableImpl extends PropertyImpl implements PropertyVariab
|
||||||
+ ", min=" + min
|
+ ", min=" + min
|
||||||
+ ", regexpr=" + regexp
|
+ ", regexpr=" + regexp
|
||||||
+ ", type=" + propertyTypeName.toString()
|
+ ", type=" + propertyTypeName.toString()
|
||||||
+ ", defaultValue=" + defaultValue.toString()
|
+ ", defaultValue=" + (defaultValue == null ? "null" : defaultValue.toString())
|
||||||
+ "]";
|
+ "]";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -346,7 +356,7 @@ public class PropertyVariableImpl extends PropertyImpl implements PropertyVariab
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!(regexp==null && o.regexp==null)) {
|
if(regexp!=null && o.regexp!=null) {
|
||||||
ret = regexp.compareTo(o.regexp);
|
ret = regexp.compareTo(o.regexp);
|
||||||
if(ret != 0) {
|
if(ret != 0) {
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -359,7 +369,24 @@ public class PropertyVariableImpl extends PropertyImpl implements PropertyVariab
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
return defaultValue.toString().compareTo(o.defaultValue.toString());
|
|
||||||
|
if(defaultValue==null && o.defaultValue!=null) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(o.defaultValue==null && defaultValue!=null) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(defaultValue!=null && o.defaultValue!=null) {
|
||||||
|
if(defaultValue.getClass()!=o.defaultValue.getClass()) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,11 +9,9 @@ import java.util.Set;
|
||||||
|
|
||||||
import org.gcube.informationsystem.base.impl.entities.EntityElementImpl;
|
import org.gcube.informationsystem.base.impl.entities.EntityElementImpl;
|
||||||
import org.gcube.informationsystem.base.impl.properties.PropertyElementImpl;
|
import org.gcube.informationsystem.base.impl.properties.PropertyElementImpl;
|
||||||
import org.gcube.informationsystem.base.impl.properties.PropertyVariableImpl;
|
|
||||||
import org.gcube.informationsystem.base.impl.relations.RelationElementImpl;
|
import org.gcube.informationsystem.base.impl.relations.RelationElementImpl;
|
||||||
import org.gcube.informationsystem.base.reference.entities.EntityElement;
|
import org.gcube.informationsystem.base.reference.entities.EntityElement;
|
||||||
import org.gcube.informationsystem.base.reference.properties.PropertyElement;
|
import org.gcube.informationsystem.base.reference.properties.PropertyElement;
|
||||||
import org.gcube.informationsystem.base.reference.properties.PropertyVariable;
|
|
||||||
import org.gcube.informationsystem.base.reference.relations.RelationElement;
|
import org.gcube.informationsystem.base.reference.relations.RelationElement;
|
||||||
import org.gcube.informationsystem.contexts.impl.entities.ContextImpl;
|
import org.gcube.informationsystem.contexts.impl.entities.ContextImpl;
|
||||||
import org.gcube.informationsystem.contexts.impl.relations.IsParentOfImpl;
|
import org.gcube.informationsystem.contexts.impl.relations.IsParentOfImpl;
|
||||||
|
@ -59,7 +57,6 @@ import org.slf4j.LoggerFactory;
|
||||||
public enum AccessType {
|
public enum AccessType {
|
||||||
|
|
||||||
PROPERTY_ELEMENT(PropertyElement.class, PropertyElement.NAME, PropertyElementImpl.class, null),
|
PROPERTY_ELEMENT(PropertyElement.class, PropertyElement.NAME, PropertyElementImpl.class, null),
|
||||||
PROPERTY_FULL_INFO(PropertyVariable.class, PropertyVariable.NAME, PropertyVariableImpl.class, null),
|
|
||||||
PROPERTY_DEFINITION(PropertyDefinition.class, PropertyDefinition.NAME, PropertyDefinitionImpl.class, null),
|
PROPERTY_DEFINITION(PropertyDefinition.class, PropertyDefinition.NAME, PropertyDefinitionImpl.class, null),
|
||||||
PROPERTY_TYPE(PropertyType.class, PropertyType.NAME, PropertyTypeImpl.class, null),
|
PROPERTY_TYPE(PropertyType.class, PropertyType.NAME, PropertyTypeImpl.class, null),
|
||||||
TEMPLATE_VARIABLE(TemplateVariable.class, TemplateVariable.NAME, TemplateVariableImpl.class, null),
|
TEMPLATE_VARIABLE(TemplateVariable.class, TemplateVariable.NAME, TemplateVariableImpl.class, null),
|
||||||
|
|
|
@ -18,7 +18,7 @@ import org.gcube.informationsystem.utils.Version;
|
||||||
@Change(version = Version.MINIMAL_VERSION_STRING, description = Version.MINIMAL_VERSION_DESCRIPTION)
|
@Change(version = Version.MINIMAL_VERSION_STRING, description = Version.MINIMAL_VERSION_DESCRIPTION)
|
||||||
public interface PropertyVariable extends Property, Comparable<PropertyVariable> {
|
public interface PropertyVariable extends Property, Comparable<PropertyVariable> {
|
||||||
|
|
||||||
public static final String NAME = "PropertyFullInfo"; // PropertyFullInfo.class.getSimpleName();
|
public static final String NAME = "PropertyVariable"; // PropertyVariable.class.getSimpleName();
|
||||||
|
|
||||||
public static final String NAME_PROPERTY = "name";
|
public static final String NAME_PROPERTY = "name";
|
||||||
public static final String DESCRIPTION_PROPERTY = "description";
|
public static final String DESCRIPTION_PROPERTY = "description";
|
||||||
|
@ -44,24 +44,38 @@ public interface PropertyVariable extends Property, Comparable<PropertyVariable>
|
||||||
@ISProperty(name = MANDATORY_PROPERTY, readonly = false, mandatory = true, nullable = false, defaultValue="false")
|
@ISProperty(name = MANDATORY_PROPERTY, readonly = false, mandatory = true, nullable = false, defaultValue="false")
|
||||||
public boolean isMandatory();
|
public boolean isMandatory();
|
||||||
|
|
||||||
|
public void setMandatory(boolean mandatory);
|
||||||
|
|
||||||
@ISProperty(name = READ_ONLY_PROPERTY, readonly = false, mandatory = true, nullable = false, defaultValue="false")
|
@ISProperty(name = READ_ONLY_PROPERTY, readonly = false, mandatory = true, nullable = false, defaultValue="false")
|
||||||
public boolean isReadonly();
|
public boolean isReadonly();
|
||||||
|
|
||||||
|
public void setReadonly(boolean readonly);
|
||||||
|
|
||||||
@ISProperty(name = NOT_NULL_PROPERTY, readonly = false, mandatory = true, nullable = false, defaultValue="false")
|
@ISProperty(name = NOT_NULL_PROPERTY, readonly = false, mandatory = true, nullable = false, defaultValue="false")
|
||||||
public boolean isNotnull();
|
public boolean isNotnull();
|
||||||
|
|
||||||
|
public void setNotnull(boolean notnull);
|
||||||
|
|
||||||
@ISProperty(name = MAX_PROPERTY, readonly = false, mandatory = true, nullable = false)
|
@ISProperty(name = MAX_PROPERTY, readonly = false, mandatory = true, nullable = false)
|
||||||
public Integer getMax();
|
public Integer getMax();
|
||||||
|
|
||||||
|
public void setMax(Integer max);
|
||||||
|
|
||||||
@ISProperty(name = MIN_PROPERTY, readonly = false, mandatory = true, nullable = false)
|
@ISProperty(name = MIN_PROPERTY, readonly = false, mandatory = true, nullable = false)
|
||||||
public Integer getMin();
|
public Integer getMin();
|
||||||
|
|
||||||
|
public void setMin(Integer min);
|
||||||
|
|
||||||
@ISProperty(name = REGEX_PROPERTY, readonly = false, mandatory = true, nullable = false)
|
@ISProperty(name = REGEX_PROPERTY, readonly = false, mandatory = true, nullable = false)
|
||||||
public String getRegexp();
|
public String getRegexp();
|
||||||
|
|
||||||
|
public void setRegexp(String regexp);
|
||||||
|
|
||||||
@ISProperty(name = PROPERTY_TYPE_PROPERTY, readonly = false, mandatory = true, nullable = false)
|
@ISProperty(name = PROPERTY_TYPE_PROPERTY, readonly = false, mandatory = true, nullable = false)
|
||||||
public String getPropertyType();
|
public String getPropertyType();
|
||||||
|
|
||||||
|
public void setPropertyType(String type);
|
||||||
|
|
||||||
@ISProperty(name = DEFAULT_VALUE_PROPERTY, description = "The default value of the Property/Variable", readonly = false, mandatory = false, nullable = true)
|
@ISProperty(name = DEFAULT_VALUE_PROPERTY, description = "The default value of the Property/Variable", readonly = false, mandatory = false, nullable = true)
|
||||||
public Object getDefaultValue();
|
public Object getDefaultValue();
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,7 @@ import org.gcube.com.fasterxml.jackson.databind.node.ObjectNode;
|
||||||
import org.gcube.informationsystem.base.impl.entities.EntityElementImpl;
|
import org.gcube.informationsystem.base.impl.entities.EntityElementImpl;
|
||||||
import org.gcube.informationsystem.queries.templates.reference.entities.QueryTemplate;
|
import org.gcube.informationsystem.queries.templates.reference.entities.QueryTemplate;
|
||||||
import org.gcube.informationsystem.queries.templates.reference.properties.TemplateVariable;
|
import org.gcube.informationsystem.queries.templates.reference.properties.TemplateVariable;
|
||||||
|
import org.gcube.informationsystem.serialization.ElementMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Luca Frosini (ISTI - CNR)
|
* @author Luca Frosini (ISTI - CNR)
|
||||||
|
@ -95,8 +96,63 @@ public class QueryTemplateImpl extends EntityElementImpl implements QueryTemplat
|
||||||
@Override
|
@Override
|
||||||
public ObjectNode getParamsFromDefaultValues() {
|
public ObjectNode getParamsFromDefaultValues() {
|
||||||
ObjectNode objectNode = objectMapper.createObjectNode();
|
ObjectNode objectNode = objectMapper.createObjectNode();
|
||||||
|
|
||||||
for(TemplateVariable tv : templateVariables.values()) {
|
for(TemplateVariable tv : templateVariables.values()) {
|
||||||
objectNode.put(tv.getName(), tv.getDefaultValue());
|
Object defaultValue = tv.getDefaultValue();
|
||||||
|
JsonNode jsonNode = ElementMapper.getObjectMapper().valueToTree(defaultValue);
|
||||||
|
objectNode.put(tv.getName(), jsonNode);
|
||||||
|
|
||||||
|
// if(defaultValue instanceof Integer) {
|
||||||
|
// objectNode.put(tv.getName(), (Integer) defaultValue);
|
||||||
|
// continue;
|
||||||
|
// }
|
||||||
|
// if(defaultValue instanceof Boolean) {
|
||||||
|
// objectNode.put(tv.getName(), (Boolean) defaultValue);
|
||||||
|
// continue;
|
||||||
|
// }
|
||||||
|
// if(defaultValue instanceof Integer) {
|
||||||
|
// objectNode.put(tv.getName(), (Integer) defaultValue);
|
||||||
|
// continue;
|
||||||
|
// }
|
||||||
|
// if(defaultValue instanceof Short) {
|
||||||
|
// objectNode.put(tv.getName(), (Short) defaultValue);
|
||||||
|
// continue;
|
||||||
|
// }
|
||||||
|
// if(defaultValue instanceof Long) {
|
||||||
|
// objectNode.put(tv.getName(), (Long) defaultValue);
|
||||||
|
// continue;
|
||||||
|
// }
|
||||||
|
// if(defaultValue instanceof Float) {
|
||||||
|
// objectNode.put(tv.getName(), (Float) defaultValue);
|
||||||
|
// continue;
|
||||||
|
// }
|
||||||
|
// if(defaultValue instanceof Double) {
|
||||||
|
// objectNode.put(tv.getName(), (Double) defaultValue);
|
||||||
|
// continue;
|
||||||
|
// }
|
||||||
|
// if(defaultValue instanceof Date) {
|
||||||
|
// SimpleDateFormat sdf = new SimpleDateFormat(Element.DATETIME_PATTERN);
|
||||||
|
// objectNode.put(tv.getName(), sdf.format((Date)defaultValue));
|
||||||
|
// continue;
|
||||||
|
// }
|
||||||
|
// if(defaultValue instanceof String) {
|
||||||
|
// objectNode.put(tv.getName(), (String) defaultValue);
|
||||||
|
// continue;
|
||||||
|
// }
|
||||||
|
// if(defaultValue instanceof Byte[]) {
|
||||||
|
// objectNode.put(tv.getName(), defaultValue.toString().getBytes());
|
||||||
|
// continue;
|
||||||
|
// }
|
||||||
|
// if(defaultValue instanceof Byte) {
|
||||||
|
// objectNode.put(tv.getName(), (Byte) defaultValue);
|
||||||
|
// continue;
|
||||||
|
// }
|
||||||
|
// if(defaultValue instanceof Property) {
|
||||||
|
// JsonNode jsonNode = ElementMapper.getObjectMapper().valueToTree(defaultValue);
|
||||||
|
// objectNode.put(tv.getName(), jsonNode);
|
||||||
|
// continue;
|
||||||
|
// }
|
||||||
|
|
||||||
}
|
}
|
||||||
return objectNode;
|
return objectNode;
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,6 +38,10 @@ public final class PropertyDefinitionImpl extends PropertyVariableImpl implement
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public PropertyDefinitionImpl() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
public PropertyDefinitionImpl(ISProperty propertyAnnotation, Method method) {
|
public PropertyDefinitionImpl(ISProperty propertyAnnotation, Method method) {
|
||||||
String name = propertyAnnotation.name().isEmpty()?getPropertyNameFromMethodName(method):propertyAnnotation.name();
|
String name = propertyAnnotation.name().isEmpty()?getPropertyNameFromMethodName(method):propertyAnnotation.name();
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
|
|
@ -8,6 +8,7 @@ import org.gcube.com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
import org.gcube.com.fasterxml.jackson.annotation.JsonTypeName;
|
import org.gcube.com.fasterxml.jackson.annotation.JsonTypeName;
|
||||||
import org.gcube.informationsystem.base.reference.AccessType;
|
import org.gcube.informationsystem.base.reference.AccessType;
|
||||||
import org.gcube.informationsystem.base.reference.properties.PropertyElement;
|
import org.gcube.informationsystem.base.reference.properties.PropertyElement;
|
||||||
|
import org.gcube.informationsystem.base.reference.properties.PropertyVariable;
|
||||||
import org.gcube.informationsystem.queries.templates.reference.properties.TemplateVariable;
|
import org.gcube.informationsystem.queries.templates.reference.properties.TemplateVariable;
|
||||||
import org.gcube.informationsystem.serialization.ElementMapper;
|
import org.gcube.informationsystem.serialization.ElementMapper;
|
||||||
import org.gcube.informationsystem.types.impl.TypeImpl;
|
import org.gcube.informationsystem.types.impl.TypeImpl;
|
||||||
|
@ -34,6 +35,7 @@ public final class PropertyTypeImpl<P extends PropertyElement> extends TypeImpl
|
||||||
static {
|
static {
|
||||||
propertyElementAccesTypes = new HashSet<>();
|
propertyElementAccesTypes = new HashSet<>();
|
||||||
propertyElementAccesTypes.add(PropertyElement.NAME);
|
propertyElementAccesTypes.add(PropertyElement.NAME);
|
||||||
|
propertyElementAccesTypes.add(PropertyVariable.NAME);
|
||||||
propertyElementAccesTypes.add(LinkedEntity.NAME);
|
propertyElementAccesTypes.add(LinkedEntity.NAME);
|
||||||
propertyElementAccesTypes.add(TemplateVariable.NAME);
|
propertyElementAccesTypes.add(TemplateVariable.NAME);
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ import org.gcube.informationsystem.utils.Version;
|
||||||
*/
|
*/
|
||||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||||
@JsonDeserialize(as = PropertyDefinitionImpl.class)
|
@JsonDeserialize(as = PropertyDefinitionImpl.class)
|
||||||
@TypeMetadata(name = PropertyDefinition.NAME, description = "This type provides information for the definition of any properties", version = Version.MINIMAL_VERSION_STRING)
|
@TypeMetadata(name = PropertyDefinition.NAME, description = "This type provides information for the definition of any properties", version = PropertyDefinition.VERSION)
|
||||||
@Changelog ({
|
@Changelog ({
|
||||||
@Change(version = PropertyDefinition.VERSION, description = "The type now is a subclass of @link{PropertyVariable}"),
|
@Change(version = PropertyDefinition.VERSION, description = "The type now is a subclass of @link{PropertyVariable}"),
|
||||||
@Change(version = Version.MINIMAL_VERSION_STRING, description = Version.MINIMAL_VERSION_DESCRIPTION)
|
@Change(version = Version.MINIMAL_VERSION_STRING, description = Version.MINIMAL_VERSION_DESCRIPTION)
|
||||||
|
|
|
@ -48,6 +48,7 @@ public class QueryTemplateTest {
|
||||||
stateTemplateVariable.setName(stateVariableName);
|
stateTemplateVariable.setName(stateVariableName);
|
||||||
stateTemplateVariable.setDescription("StateFacet value");
|
stateTemplateVariable.setDescription("StateFacet value");
|
||||||
stateTemplateVariable.setDefaultValue("running");
|
stateTemplateVariable.setDefaultValue("running");
|
||||||
|
stateTemplateVariable.setPropertyType("String");
|
||||||
queryTemplate.addTemplateVariable(stateTemplateVariable);
|
queryTemplate.addTemplateVariable(stateTemplateVariable);
|
||||||
|
|
||||||
TemplateVariable nameTemplateVariable = new TemplateVariableImpl();
|
TemplateVariable nameTemplateVariable = new TemplateVariableImpl();
|
||||||
|
@ -55,6 +56,7 @@ public class QueryTemplateTest {
|
||||||
nameTemplateVariable.setName(nameVariableName);
|
nameTemplateVariable.setName(nameVariableName);
|
||||||
nameTemplateVariable.setDescription("SoftwareFacet name");
|
nameTemplateVariable.setDescription("SoftwareFacet name");
|
||||||
nameTemplateVariable.setDefaultValue("resource-registry");
|
nameTemplateVariable.setDefaultValue("resource-registry");
|
||||||
|
nameTemplateVariable.setPropertyType("String");
|
||||||
queryTemplate.addTemplateVariable(nameTemplateVariable);
|
queryTemplate.addTemplateVariable(nameTemplateVariable);
|
||||||
|
|
||||||
TemplateVariable groupTemplateVariable = new TemplateVariableImpl();
|
TemplateVariable groupTemplateVariable = new TemplateVariableImpl();
|
||||||
|
@ -62,12 +64,14 @@ public class QueryTemplateTest {
|
||||||
groupTemplateVariable.setName(groupVariableName);
|
groupTemplateVariable.setName(groupVariableName);
|
||||||
groupTemplateVariable.setDescription("SoftwareFacet group");
|
groupTemplateVariable.setDescription("SoftwareFacet group");
|
||||||
groupTemplateVariable.setDefaultValue("information-system");
|
groupTemplateVariable.setDefaultValue("information-system");
|
||||||
|
groupTemplateVariable.setPropertyType("String");
|
||||||
queryTemplate.addTemplateVariable(groupTemplateVariable);
|
queryTemplate.addTemplateVariable(groupTemplateVariable);
|
||||||
|
|
||||||
String json = ElementMapper.marshal(queryTemplate);
|
String json = ElementMapper.marshal(queryTemplate);
|
||||||
|
logger.info("Query Template is {}", json);
|
||||||
|
|
||||||
QueryTemplate gotQueryTemplate = ElementMapper.unmarshal(QueryTemplate.class, json);
|
QueryTemplate gotQueryTemplate = ElementMapper.unmarshal(QueryTemplate.class, json);
|
||||||
logger.info("{}", QueryTemplate.NAME, ElementMapper.marshal(gotQueryTemplate));
|
logger.info("{} {}", QueryTemplate.NAME, ElementMapper.marshal(gotQueryTemplate));
|
||||||
|
|
||||||
JsonNode gotTemplate = gotQueryTemplate.getTemplate();
|
JsonNode gotTemplate = gotQueryTemplate.getTemplate();
|
||||||
logger.info("Template is {}", gotTemplate.toString());
|
logger.info("Template is {}", gotTemplate.toString());
|
||||||
|
|
|
@ -90,6 +90,11 @@ public class SerializationTest {
|
||||||
Assert.assertTrue(propertyElement.getAccessType()==AccessType.PROPERTY_ELEMENT);
|
Assert.assertTrue(propertyElement.getAccessType()==AccessType.PROPERTY_ELEMENT);
|
||||||
logger.info(ElementMapper.marshal(propertyElement));
|
logger.info(ElementMapper.marshal(propertyElement));
|
||||||
|
|
||||||
|
@SuppressWarnings({ "unchecked" })
|
||||||
|
PropertyType<PropertyVariable> propertyVariable = (PropertyType<PropertyVariable>) TypeMapper.createTypeDefinition(PropertyVariable.class);
|
||||||
|
Assert.assertTrue(propertyVariable.getAccessType()==AccessType.PROPERTY_ELEMENT);
|
||||||
|
logger.info(ElementMapper.marshal(propertyVariable));
|
||||||
|
|
||||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||||
PropertyType<PropertyType> propertyType = (PropertyType<PropertyType>) TypeMapper.createTypeDefinition(PropertyType.class);
|
PropertyType<PropertyType> propertyType = (PropertyType<PropertyType>) TypeMapper.createTypeDefinition(PropertyType.class);
|
||||||
Assert.assertTrue(propertyType.getAccessType()==AccessType.PROPERTY_TYPE);
|
Assert.assertTrue(propertyType.getAccessType()==AccessType.PROPERTY_TYPE);
|
||||||
|
|
Loading…
Reference in New Issue