Fixed bugs introduced with refactoring

This commit is contained in:
Luca Frosini 2021-02-12 17:06:12 +01:00
parent 319fa760e3
commit a96cd187a2
3 changed files with 5 additions and 17 deletions

View File

@ -59,6 +59,7 @@ public class ElementManagementUtility {
case CONSISTS_OF:
erManagement = new ConsistsOfManagement();
break;
default:
throw new ResourceRegistryException(String.format("%s is not querable", type.toString()));

View File

@ -59,7 +59,7 @@ public class PropertyElementManagement {
CachedType cachedType = typesCache.getType(type);
oClass = cachedType.getOClass();
AccessType gotAccessType = cachedType.getAccessType();
if(AccessType.PROPERTY_ELEMENT!=gotAccessType) {
if(!AccessType.PROPERTY_ELEMENT.getClass().isAssignableFrom(gotAccessType.getClass())) {
throw new SchemaException(type + " is not a " + AccessType.PROPERTY_ELEMENT.getName());
}
} catch(SchemaNotFoundException e) {
@ -134,7 +134,7 @@ public class PropertyElementManagement {
CachedType cachedType = typesCache.getType(type);
OClass oClass = cachedType.getOClass();
AccessType gotAccessType = cachedType.getAccessType();
if(AccessType.PROPERTY_ELEMENT!=gotAccessType) {
if(!AccessType.PROPERTY_ELEMENT.getClass().isAssignableFrom(gotAccessType.getClass())) {
throw new SchemaException(type + " is not a " + AccessType.PROPERTY_ELEMENT.getName());
}
/*

View File

@ -224,23 +224,9 @@ public class ERManagementTest extends ContextTest {
StateFacet stateFacet = new StateFacetImpl();
stateFacet.setValue("ready");
/*
List<Map<String, String>> list = new ArrayList<>();
Map<String, String> map1 = new HashMap<String, String>();
map1.put("Key1", "Value1");
Map<String, String> map2 = new HashMap<String, String>();
map2.put("Key2", "Value2");
list.add(map1);
list.add(map2);
serviceStateFacet.setAdditionalProperty("MY-TEST", list);
*/
eService.addFacet(stateFacet);
LicenseFacet licenseFacet = new LicenseFacetImpl();
licenseFacet.setName("EUPL");
licenseFacet
@ -248,6 +234,7 @@ public class ERManagementTest extends ContextTest {
"https://joinup.ec.europa.eu/community/eupl/og_page/european-union-public-licence-eupl-v11"));
eService.addFacet(licenseFacet);
ResourceManagement resourceManagement = new ResourceManagement();
resourceManagement.setElementType(EService.NAME);
resourceManagement.setJson(ElementMapper.marshal(eService));