/** * Create a schema reference using the schema as source. * * @return */ public SchemaReferenceImpl toReference() { SchemaReferenceImpl reference = new SchemaReferenceImpl(); reference.setUuid(getUuid()); reference.setVersion(getVersion()); reference.setName(getName()); return reference; }
public SchemaUpdateRequest getSchemaUpdateRequest() { SchemaUpdateRequest schema = new SchemaUpdateRequest(); // TODO should i allow changing the name? schema.setName("extended-content"); schema.setDescription("New description"); return schema; }
/** * Create a minimal valid test schema.. * * @return */ public static SchemaCreateRequest createMinimalValidSchemaCreateRequest() { SchemaCreateRequest request = new SchemaCreateRequest(); request.setName("test"); request.validate(); return request; }
public SchemaUpdateRequest toUpdateRequest() { SchemaUpdateRequest updateRequest = new SchemaUpdateRequest(); updateRequest.setContainer(isContainer()); updateRequest.getFields().addAll(getFields()); updateRequest.setName(getName()); updateRequest.setSegmentField(getSegmentField()); updateRequest.setDisplayField(getDisplayField()); updateRequest.setDescription(getDescription()); updateRequest.setElasticsearch(getElasticsearch()); updateRequest.setUrlFields(getUrlFields()); return updateRequest; }
public SchemaCreateRequestAssert matches(SchemaResponse response) { assertNotNull(response); assertNotNull(actual); assertEquals("The name of the schemas do not match.", actual.getName(), response.getName()); assertEquals("The description of the schemas do not match.", actual.getDescription(), response.getDescription()); assertEquals("The displayField of the schemas do not match.", actual.getDisplayField(), response.getDisplayField()); assertEquals("The segmentField of the schemas do not match.", actual.getSegmentField(), response.getSegmentField()); // TODO assert for schema properties return this; }
@Override public void apply(Map<String, Object> fieldProperties) { super.apply(fieldProperties); Object listType = fieldProperties.get(SchemaChangeModel.LIST_TYPE_KEY); if (listType != null && listType instanceof String) { setListType((String) listType); } Object allowedSchemas = fieldProperties.get(SchemaChangeModel.ALLOW_KEY); if (allowedSchemas != null && allowedSchemas instanceof String[]) { setAllowedSchemas((String[]) allowedSchemas); } }
@Override public Map<String, Object> getAllChangeProperties() { Map<String, Object> map = super.getAllChangeProperties(); // type property: map.put("listType", getListType()); // allow property: map.put("allow", getAllowedSchemas()); // min // max return map; }
public SchemaCreateRequestAssert isValid() { actual.validate(); return this; }
public SchemaResponseAssert isValid() { actual.validate(); return this; }
@Override public Map<String, Object> getAllChangeProperties() { Map<String, Object> properties = super.getAllChangeProperties(); properties.put("allow", getAllowedMimeTypes()); return properties; }
@Override public Map<String, Object> getAllChangeProperties() { Map<String, Object> map = super.getAllChangeProperties(); map.put(ALLOW_KEY, getAllowedSchemas()); return map; }
@Override public Map<String, Object> getAllChangeProperties() { Map<String, Object> map = super.getAllChangeProperties(); map.put(ALLOW_KEY, getAllowedValues()); return map; }
@Override public Map<String, Object> getAllChangeProperties() { Map<String, Object> map = super.getAllChangeProperties(); // allow map.put(SchemaChangeModel.ALLOW_KEY, getAllowedMicroSchemas()); return map; }
@Override public void apply(Map<String, Object> fieldProperties) { super.apply(fieldProperties); if (fieldProperties.get("allowedMimeTypes") != null) { setAllowedMimeTypes((String[]) fieldProperties.get("allowedMimeTypes")); } } }
@Override public void apply(Map<String, Object> fieldProperties) { super.apply(fieldProperties); if (fieldProperties.get(SchemaChangeModel.ALLOW_KEY) != null) { setAllowedMicroSchemas((String[]) fieldProperties.get(SchemaChangeModel.ALLOW_KEY)); } } }
@Override public void apply(Map<String, Object> fieldProperties) { super.apply(fieldProperties); if (fieldProperties.get(ALLOW_KEY) != null) { setAllowedSchemas((String[]) fieldProperties.get(ALLOW_KEY)); } } }
@Override public void apply(Map<String, Object> fieldProperties) { super.apply(fieldProperties); if (fieldProperties.get(ALLOW_KEY) != null) { setAllowedValues((String[]) fieldProperties.get(ALLOW_KEY)); } }
/** * Create a new schema with the given name. * * @param name */ public SchemaModelImpl(String name) { setName(name); }
/** * Create a minimal valid test schema create request. * * @return */ public static SchemaCreateRequest createSchemaCreateRequest() { SchemaCreateRequest request = new SchemaCreateRequest(); request.setName("test"); request.validate(); return request; }