Fixed header update

This commit is contained in:
Luca Frosini 2023-02-10 18:26:19 +01:00
parent 580ce0d721
commit 403222835e
2 changed files with 22 additions and 3 deletions

View File

@ -1076,6 +1076,11 @@ public abstract class ElementManagement<El extends OElement, T extends Type> {
for(String key : properties.keySet()) {
try {
if(key.compareTo(IdentifiableElement.HEADER_PROPERTY)==0) {
// We never update the header with the value provided
continue;
}
JsonNode value = properties.get(key);
OProperty oProperty = oClass.getProperty(key);

View File

@ -15,6 +15,7 @@ import org.gcube.informationsystem.model.reference.entities.Facet;
import org.gcube.informationsystem.model.reference.entities.Resource;
import org.gcube.informationsystem.model.reference.properties.Encrypted;
import org.gcube.informationsystem.model.reference.properties.Header;
import org.gcube.informationsystem.model.reference.properties.PropagationConstraint;
import org.gcube.informationsystem.model.reference.properties.Property;
import org.gcube.informationsystem.model.reference.relations.ConsistsOf;
import org.gcube.informationsystem.model.reference.relations.IsRelatedTo;
@ -33,7 +34,6 @@ import org.gcube.resourcemanagement.model.reference.entities.resources.Actor;
import org.gcube.resourcemanagement.model.reference.entities.resources.EService;
import org.gcube.resourcemanagement.model.reference.entities.resources.RunningPlugin;
import org.gcube.resourcemanagement.model.reference.entities.resources.Service;
import org.gcube.resourcemanagement.model.reference.properties.ValueSchema;
import org.gcube.resourcemanagement.model.reference.relations.consistsof.HasVolatileMemory;
import org.gcube.resourcemanagement.model.reference.relations.isrelatedto.Hosts;
import org.gcube.resourcemanagement.model.reference.relations.isrelatedto.Uses;
@ -236,9 +236,9 @@ public class SchemaManagementImplTest extends ContextTest {
return ret;
}
@Test(expected=SchemaAlreadyPresentException.class)
@Test
public void createPropertyType() throws Exception {
create(ValueSchema.class);
create(PropagationConstraint.class);
}
@Test(expected=SchemaAlreadyPresentException.class)
@ -317,6 +317,8 @@ public class SchemaManagementImplTest extends ContextTest {
}
}
@Test
public void createUpdateDeleteFacetType() throws Exception {
@ -388,4 +390,16 @@ public class SchemaManagementImplTest extends ContextTest {
typeManagement.setTypeName(TestFacet.NAME);
typeManagement.delete(AccessType.FACET);
}
// @Test
public void updateType() throws Exception {
Type type = TypeMapper.createTypeDefinition(PropagationConstraint.class);
logger.info("Going to update {} : {}", type.getName(), TypeMapper.serializeTypeDefinition(type));
String ret = update(PropagationConstraint.class, true);
logger.info("Updated {} : {}", type.getName(), ret);
Type typeManaged = TypeMapper.deserializeTypeDefinition(ret);
compareTypes(type, typeManaged);
}
}