Merge remote-tracking branch 'origin/feature/20367' into feature/20298

This commit is contained in:
Luca Frosini 2020-12-22 11:38:31 +01:00
commit 18a552a3b7
3 changed files with 31 additions and 27 deletions

View File

@ -46,7 +46,6 @@ import org.gcube.resourcemanagement.model.impl.entities.facets.CPUFacetImpl;
import org.gcube.resourcemanagement.model.impl.entities.facets.EventFacetImpl;
import org.gcube.resourcemanagement.model.impl.entities.facets.LicenseFacetImpl;
import org.gcube.resourcemanagement.model.impl.entities.facets.NetworkingFacetImpl;
import org.gcube.resourcemanagement.model.impl.entities.facets.ServiceStateFacetImpl;
import org.gcube.resourcemanagement.model.impl.entities.facets.SimpleFacetImpl;
import org.gcube.resourcemanagement.model.impl.entities.facets.SoftwareFacetImpl;
import org.gcube.resourcemanagement.model.impl.entities.facets.StateFacetImpl;
@ -61,7 +60,6 @@ import org.gcube.resourcemanagement.model.reference.entities.facets.ContactFacet
import org.gcube.resourcemanagement.model.reference.entities.facets.EventFacet;
import org.gcube.resourcemanagement.model.reference.entities.facets.LicenseFacet;
import org.gcube.resourcemanagement.model.reference.entities.facets.NetworkingFacet;
import org.gcube.resourcemanagement.model.reference.entities.facets.ServiceStateFacet;
import org.gcube.resourcemanagement.model.reference.entities.facets.SimpleFacet;
import org.gcube.resourcemanagement.model.reference.entities.facets.SoftwareFacet;
import org.gcube.resourcemanagement.model.reference.entities.facets.StateFacet;
@ -128,7 +126,7 @@ public class ERManagementTest extends ContextTest {
ValueSchema authorization = new ValueSchemaImpl();
authorization.setValue("pwd");
URI uri = new URI("http://www.gcube-system.org");
authorization.setType(uri);
authorization.setSchema(uri);
accessPointFacet.setAuthorization(authorization);
accessPointFacet.setAdditionalProperty("Test", "MyTest");
@ -187,11 +185,14 @@ public class ERManagementTest extends ContextTest {
EventFacet eventFacet = new EventFacetImpl();
eventFacet.setDate(Calendar.getInstance().getTime());
eventFacet.setValue("Created");
ValueSchema event = new ValueSchemaImpl();
event.setValue("Created");
event.setSchema(new URI(""));
eventFacet.setEvent(event);
eService.addFacet(eventFacet);
ServiceStateFacet serviceStateFacet = new ServiceStateFacetImpl();
serviceStateFacet.setValue("ready");
StateFacet stateFacet = new StateFacetImpl();
stateFacet.setValue("ready");
/*
List<Map<String, String>> list = new ArrayList<>();
@ -205,7 +206,7 @@ public class ERManagementTest extends ContextTest {
serviceStateFacet.setAdditionalProperty("MY-TEST", list);
*/
eService.addFacet(serviceStateFacet);
eService.addFacet(stateFacet);

View File

@ -46,22 +46,22 @@ import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegis
import org.gcube.informationsystem.resourceregistry.instances.model.entities.ResourceManagement;
import org.gcube.informationsystem.utils.ElementMapper;
import org.gcube.resourcemanagement.model.impl.entities.facets.CPUFacetImpl;
import org.gcube.resourcemanagement.model.impl.entities.facets.ContainerStateFacetImpl;
import org.gcube.resourcemanagement.model.impl.entities.facets.MemoryFacetImpl;
import org.gcube.resourcemanagement.model.impl.entities.facets.NetworkingFacetImpl;
import org.gcube.resourcemanagement.model.impl.entities.facets.SimplePropertyFacetImpl;
import org.gcube.resourcemanagement.model.impl.entities.facets.SoftwareFacetImpl;
import org.gcube.resourcemanagement.model.impl.entities.facets.StateFacetImpl;
import org.gcube.resourcemanagement.model.impl.entities.resources.HostingNodeImpl;
import org.gcube.resourcemanagement.model.impl.relations.consistsof.HasPersistentMemoryImpl;
import org.gcube.resourcemanagement.model.impl.relations.consistsof.HasVolatileMemoryImpl;
import org.gcube.resourcemanagement.model.impl.relations.consistsof.IsIdentifiedByImpl;
import org.gcube.resourcemanagement.model.reference.entities.facets.CPUFacet;
import org.gcube.resourcemanagement.model.reference.entities.facets.ContainerStateFacet;
import org.gcube.resourcemanagement.model.reference.entities.facets.MemoryFacet;
import org.gcube.resourcemanagement.model.reference.entities.facets.MemoryFacet.MemoryUnit;
import org.gcube.resourcemanagement.model.reference.entities.facets.NetworkingFacet;
import org.gcube.resourcemanagement.model.reference.entities.facets.SimplePropertyFacet;
import org.gcube.resourcemanagement.model.reference.entities.facets.SoftwareFacet;
import org.gcube.resourcemanagement.model.reference.entities.facets.StateFacet;
import org.gcube.resourcemanagement.model.reference.entities.resources.EService;
import org.gcube.resourcemanagement.model.reference.entities.resources.HostingNode;
import org.gcube.resourcemanagement.model.reference.relations.consistsof.HasPersistentMemory;
@ -214,8 +214,8 @@ public class SmartgearResourcesTest extends ContextTest {
hostingNode, simplePropertyFacet, propagationConstraint);
hostingNode.addFacet(spfR);
ContainerStateFacet containerStateFacet = getContainerStateFacet(null);
hostingNode.addFacet(containerStateFacet);
StateFacet stateFacet = getStateFacet(null);
hostingNode.addFacet(stateFacet);
MemoryFacet ramFacet = getRamInfo(null);
HasVolatileMemory<HostingNode, MemoryFacet> hasVolatileRAMMemory = new HasVolatileMemoryImpl<HostingNode, MemoryFacet>(
@ -259,7 +259,7 @@ public class SmartgearResourcesTest extends ContextTest {
List<? extends ConsistsOf<? extends Resource, MemoryFacet>> memoryList = hostingNodeToUpdate.getConsistsOf(ConsistsOf.class, MemoryFacet.class);
Assert.assertTrue(memoryList.size()==3);
List<ContainerStateFacet> csfList = hostingNodeToUpdate.getFacets(ContainerStateFacet.class);
List<StateFacet> csfList = hostingNodeToUpdate.getFacets(StateFacet.class);
Assert.assertTrue(csfList.size()==1);
List<SimplePropertyFacet> spfList = hostingNodeToUpdate.getFacets(SimplePropertyFacet.class);
@ -287,9 +287,9 @@ public class SmartgearResourcesTest extends ContextTest {
.getConsistsOf();
for (ConsistsOf<? extends Resource, ? extends Facet> c : consistsOfList) {
if (c.getTarget() instanceof ContainerStateFacet) {
containerStateFacet = (ContainerStateFacet) c.getTarget();
containerStateFacet = getContainerStateFacet(containerStateFacet);
if (c.getTarget() instanceof StateFacet) {
stateFacet = (StateFacet) c.getTarget();
stateFacet = getStateFacet(stateFacet);
continue;
}
@ -340,13 +340,12 @@ public class SmartgearResourcesTest extends ContextTest {
}
private ContainerStateFacet getContainerStateFacet(
ContainerStateFacet containerStateFacet) {
if (containerStateFacet == null) {
containerStateFacet = new ContainerStateFacetImpl();
private StateFacet getStateFacet(StateFacet stateFacet) {
if (stateFacet == null) {
stateFacet = new StateFacetImpl();
}
containerStateFacet.setValue("ready");
return containerStateFacet;
stateFacet.setValue("ready");
return stateFacet;
}
public static final String MESSAGE = "message";

View File

@ -46,10 +46,11 @@ import org.gcube.resourcemanagement.model.impl.entities.facets.EventFacetImpl;
import org.gcube.resourcemanagement.model.impl.entities.facets.LicenseFacetImpl;
import org.gcube.resourcemanagement.model.impl.entities.facets.MemoryFacetImpl;
import org.gcube.resourcemanagement.model.impl.entities.facets.NetworkingFacetImpl;
import org.gcube.resourcemanagement.model.impl.entities.facets.ServiceStateFacetImpl;
import org.gcube.resourcemanagement.model.impl.entities.facets.SoftwareFacetImpl;
import org.gcube.resourcemanagement.model.impl.entities.facets.StateFacetImpl;
import org.gcube.resourcemanagement.model.impl.entities.resources.EServiceImpl;
import org.gcube.resourcemanagement.model.impl.entities.resources.HostingNodeImpl;
import org.gcube.resourcemanagement.model.impl.properties.ValueSchemaImpl;
import org.gcube.resourcemanagement.model.impl.relations.consistsof.HasPersistentMemoryImpl;
import org.gcube.resourcemanagement.model.impl.relations.consistsof.HasVolatileMemoryImpl;
import org.gcube.resourcemanagement.model.impl.relations.consistsof.IsIdentifiedByImpl;
@ -61,10 +62,11 @@ import org.gcube.resourcemanagement.model.reference.entities.facets.LicenseFacet
import org.gcube.resourcemanagement.model.reference.entities.facets.MemoryFacet;
import org.gcube.resourcemanagement.model.reference.entities.facets.MemoryFacet.MemoryUnit;
import org.gcube.resourcemanagement.model.reference.entities.facets.NetworkingFacet;
import org.gcube.resourcemanagement.model.reference.entities.facets.ServiceStateFacet;
import org.gcube.resourcemanagement.model.reference.entities.facets.SoftwareFacet;
import org.gcube.resourcemanagement.model.reference.entities.facets.StateFacet;
import org.gcube.resourcemanagement.model.reference.entities.resources.EService;
import org.gcube.resourcemanagement.model.reference.entities.resources.HostingNode;
import org.gcube.resourcemanagement.model.reference.properties.ValueSchema;
import org.gcube.resourcemanagement.model.reference.relations.consistsof.HasPersistentMemory;
import org.gcube.resourcemanagement.model.reference.relations.consistsof.HasVolatileMemory;
import org.gcube.resourcemanagement.model.reference.relations.consistsof.IsIdentifiedBy;
@ -194,12 +196,14 @@ public class BasicTest extends ContextTest {
EventFacet eventFacet = new EventFacetImpl();
eventFacet.setDate(Calendar.getInstance().getTime());
eventFacet.setValue("Created");
ValueSchema event = new ValueSchemaImpl();
event.setValue("Created");
eventFacet.setEvent(event);
eService.addFacet(eventFacet);
ServiceStateFacet serviceStateFacet = new ServiceStateFacetImpl();
serviceStateFacet.setValue("ready");
eService.addFacet(serviceStateFacet);
StateFacet stateFacet = new StateFacetImpl();
stateFacet.setValue("ready");
eService.addFacet(stateFacet);
LicenseFacet licenseFacet = new LicenseFacetImpl();
licenseFacet.setName("EUPL");