Improving tests
This commit is contained in:
parent
25f2850114
commit
ec9b6665ca
File diff suppressed because it is too large
Load Diff
|
@ -3,40 +3,20 @@
|
|||
*/
|
||||
package org.gcube.informationsystem.resourceregistry.instances.multicontext;
|
||||
|
||||
import java.net.URI;
|
||||
import java.net.URL;
|
||||
import java.util.Calendar;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.gcube.com.fasterxml.jackson.databind.JsonNode;
|
||||
import org.gcube.informationsystem.model.impl.properties.PropagationConstraintImpl;
|
||||
import org.gcube.informationsystem.model.reference.entities.Facet;
|
||||
import org.gcube.informationsystem.model.reference.properties.PropagationConstraint;
|
||||
import org.gcube.informationsystem.model.reference.properties.PropagationConstraint.AddConstraint;
|
||||
import org.gcube.informationsystem.model.reference.properties.PropagationConstraint.RemoveConstraint;
|
||||
import org.gcube.informationsystem.resourceregistry.ContextTest;
|
||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;
|
||||
import org.gcube.informationsystem.resourceregistry.contexts.ContextUtility;
|
||||
import org.gcube.informationsystem.resourceregistry.instances.ERManagementTest;
|
||||
import org.gcube.informationsystem.resourceregistry.instances.model.ERManagementUtility;
|
||||
import org.gcube.informationsystem.resourceregistry.instances.model.entities.ResourceManagement;
|
||||
import org.gcube.informationsystem.utils.ElementMapper;
|
||||
import org.gcube.resourcemanagement.model.impl.entities.facets.AccessPointFacetImpl;
|
||||
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.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.properties.ValueSchemaImpl;
|
||||
import org.gcube.resourcemanagement.model.impl.relations.consistsof.IsIdentifiedByImpl;
|
||||
import org.gcube.resourcemanagement.model.reference.entities.facets.AccessPointFacet;
|
||||
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.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.properties.ValueSchema;
|
||||
import org.gcube.resourcemanagement.model.reference.relations.consistsof.IsIdentifiedBy;
|
||||
import org.junit.Test;
|
||||
import org.slf4j.Logger;
|
||||
|
@ -53,45 +33,8 @@ public class AnotherEnhancedTest extends MultiContextTest {
|
|||
@Test
|
||||
public void testNoFollows() throws Exception {
|
||||
ContextTest.setContextByName(DEFAULT_TEST_SCOPE);
|
||||
EService eService = new EServiceImpl();
|
||||
|
||||
SoftwareFacet softwareFacet = new SoftwareFacetImpl();
|
||||
softwareFacet.setGroup("InformationSystem");
|
||||
softwareFacet.setName("resource-registry");
|
||||
softwareFacet.setVersion("1.1.0");
|
||||
PropagationConstraint propagationConstraint = new PropagationConstraintImpl();
|
||||
propagationConstraint.setAddConstraint(AddConstraint.propagate);
|
||||
propagationConstraint.setRemoveConstraint(RemoveConstraint.cascade);
|
||||
|
||||
IsIdentifiedBy<EService, Facet> isIdentifiedBy = new IsIdentifiedByImpl<EService, Facet>(
|
||||
eService, softwareFacet, propagationConstraint);
|
||||
eService.addFacet(isIdentifiedBy);
|
||||
|
||||
AccessPointFacet accessPointFacet = new AccessPointFacetImpl();
|
||||
accessPointFacet.setEndpoint(new URI("https://localhost"));
|
||||
accessPointFacet.setEntryName("port1");
|
||||
eService.addFacet(accessPointFacet);
|
||||
|
||||
EventFacet eventFacet = new EventFacetImpl();
|
||||
eventFacet.setDate(Calendar.getInstance().getTime());
|
||||
ValueSchema event = new ValueSchemaImpl();
|
||||
event.setValue("Created");
|
||||
event.setSchema(new URI(""));
|
||||
eventFacet.setEvent(event);
|
||||
eService.addFacet(eventFacet);
|
||||
|
||||
StateFacet stateFacet = new StateFacetImpl();
|
||||
stateFacet.setValue("ready");
|
||||
eService.addFacet(stateFacet);
|
||||
|
||||
|
||||
LicenseFacet licenseFacet = new LicenseFacetImpl();
|
||||
licenseFacet.setName("EUPL");
|
||||
licenseFacet
|
||||
.setTextURL(new URL(
|
||||
"https://joinup.ec.europa.eu/community/eupl/og_page/european-union-public-licence-eupl-v11"));
|
||||
eService.addFacet(licenseFacet);
|
||||
|
||||
EService eService = ERManagementTest.instantiateValidEService();
|
||||
|
||||
ResourceManagement resourceManagement = new ResourceManagement();
|
||||
resourceManagement.setElementType(EService.NAME);
|
||||
|
|
|
@ -3,9 +3,6 @@
|
|||
*/
|
||||
package org.gcube.informationsystem.resourceregistry.instances.multicontext;
|
||||
|
||||
import java.net.URI;
|
||||
import java.net.URL;
|
||||
import java.util.Calendar;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
@ -14,7 +11,6 @@ import org.gcube.com.fasterxml.jackson.databind.JsonNode;
|
|||
import org.gcube.common.authorization.client.exceptions.ObjectNotFound;
|
||||
import org.gcube.informationsystem.base.reference.IdentifiableElement;
|
||||
import org.gcube.informationsystem.context.reference.entities.Context;
|
||||
import org.gcube.informationsystem.model.impl.properties.HeaderImpl;
|
||||
import org.gcube.informationsystem.model.impl.properties.PropagationConstraintImpl;
|
||||
import org.gcube.informationsystem.model.reference.entities.Facet;
|
||||
import org.gcube.informationsystem.model.reference.properties.PropagationConstraint;
|
||||
|
@ -30,6 +26,7 @@ import org.gcube.informationsystem.resourceregistry.api.exceptions.entity.resour
|
|||
import org.gcube.informationsystem.resourceregistry.api.exceptions.entity.resource.ResourceNotFoundException;
|
||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.relation.RelationAvailableInAnotherContextException;
|
||||
import org.gcube.informationsystem.resourceregistry.contexts.ContextUtility;
|
||||
import org.gcube.informationsystem.resourceregistry.instances.ERManagementTest;
|
||||
import org.gcube.informationsystem.resourceregistry.instances.SmartgearResourcesTest;
|
||||
import org.gcube.informationsystem.resourceregistry.instances.base.ElementManagement;
|
||||
import org.gcube.informationsystem.resourceregistry.instances.base.ElementManagementUtility;
|
||||
|
@ -37,35 +34,15 @@ import org.gcube.informationsystem.resourceregistry.instances.model.entities.Fac
|
|||
import org.gcube.informationsystem.resourceregistry.instances.model.entities.ResourceManagement;
|
||||
import org.gcube.informationsystem.resourceregistry.instances.model.relations.IsRelatedToManagement;
|
||||
import org.gcube.informationsystem.utils.ElementMapper;
|
||||
import org.gcube.resourcemanagement.model.impl.entities.facets.AccessPointFacetImpl;
|
||||
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.MemoryFacetImpl;
|
||||
import org.gcube.resourcemanagement.model.impl.entities.facets.NetworkingFacetImpl;
|
||||
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;
|
||||
import org.gcube.resourcemanagement.model.impl.relations.isrelatedto.ActivatesImpl;
|
||||
import org.gcube.resourcemanagement.model.reference.entities.facets.AccessPointFacet;
|
||||
import org.gcube.resourcemanagement.model.reference.entities.facets.CPUFacet;
|
||||
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.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.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;
|
||||
import org.gcube.resourcemanagement.model.reference.relations.isrelatedto.Activates;
|
||||
import org.junit.Assert;
|
||||
|
@ -214,38 +191,7 @@ public class BasicTest extends MultiContextTest {
|
|||
|
||||
@Test
|
||||
public void testCreateEServiceHostingNode() throws Exception {
|
||||
EService eService = new EServiceImpl();
|
||||
|
||||
SoftwareFacet softwareFacet = new SoftwareFacetImpl();
|
||||
softwareFacet.setGroup("InformationSystem");
|
||||
softwareFacet.setName("resource-registry");
|
||||
softwareFacet.setVersion("1.1.0");
|
||||
IsIdentifiedBy<EService, Facet> isIdentifiedBy = new IsIdentifiedByImpl<EService, Facet>(
|
||||
eService, softwareFacet, null);
|
||||
eService.addFacet(isIdentifiedBy);
|
||||
|
||||
AccessPointFacet accessPointFacet = new AccessPointFacetImpl();
|
||||
accessPointFacet.setEndpoint(new URI("https://localhost"));
|
||||
accessPointFacet.setEntryName("port1");
|
||||
eService.addFacet(accessPointFacet);
|
||||
|
||||
EventFacet eventFacet = new EventFacetImpl();
|
||||
eventFacet.setDate(Calendar.getInstance().getTime());
|
||||
ValueSchema event = new ValueSchemaImpl();
|
||||
event.setValue("Created");
|
||||
eventFacet.setEvent(event);
|
||||
eService.addFacet(eventFacet);
|
||||
|
||||
StateFacet stateFacet = new StateFacetImpl();
|
||||
stateFacet.setValue("ready");
|
||||
eService.addFacet(stateFacet);
|
||||
|
||||
LicenseFacet licenseFacet = new LicenseFacetImpl();
|
||||
licenseFacet.setName("EUPL");
|
||||
licenseFacet
|
||||
.setTextURL(new URL(
|
||||
"https://joinup.ec.europa.eu/community/eupl/og_page/european-union-public-licence-eupl-v11"));
|
||||
eService.addFacet(licenseFacet);
|
||||
EService eService = ERManagementTest.instantiateValidEService();
|
||||
|
||||
ResourceManagement resourceManagement = new ResourceManagement();
|
||||
resourceManagement.setElementType(EService.NAME);
|
||||
|
@ -263,65 +209,7 @@ public class BasicTest extends MultiContextTest {
|
|||
eServiceInstances.put(consistsOf.getTarget().getHeader().getUUID(), consistsOf.getTarget());
|
||||
}
|
||||
|
||||
|
||||
|
||||
HostingNode hostingNode = new HostingNodeImpl();
|
||||
|
||||
NetworkingFacet networkingFacet = new NetworkingFacetImpl();
|
||||
networkingFacet.setIPAddress("146.48.87.183");
|
||||
networkingFacet.setHostName("pc-frosini.isti.cnr.it");
|
||||
networkingFacet.setDomainName("isti.cnr.it");
|
||||
networkingFacet.setMask("255.255.248.0");
|
||||
networkingFacet.setBroadcastAddress("146.48.87.255");
|
||||
|
||||
IsIdentifiedBy<HostingNode, NetworkingFacet> isIdentifiedByHNNF = new IsIdentifiedByImpl<HostingNode, NetworkingFacet>(
|
||||
hostingNode, networkingFacet, null);
|
||||
hostingNode.addFacet(isIdentifiedByHNNF);
|
||||
|
||||
CPUFacet cpuFacet = new CPUFacetImpl();
|
||||
cpuFacet.setClockSpeed("1 GHz");
|
||||
cpuFacet.setModel("Opteron");
|
||||
cpuFacet.setVendor("AMD");
|
||||
hostingNode.addFacet(cpuFacet);
|
||||
|
||||
MemoryFacet ram = new MemoryFacetImpl();
|
||||
ram.setSize(8);
|
||||
ram.setUnit(MemoryUnit.GB);
|
||||
ram.setUsed(2);
|
||||
|
||||
HasVolatileMemory<HostingNode, MemoryFacet> hasVolatileMemory = new HasVolatileMemoryImpl<HostingNode, MemoryFacet>(
|
||||
hostingNode, ram, null);
|
||||
hostingNode.addFacet(hasVolatileMemory);
|
||||
|
||||
MemoryFacet disk = new MemoryFacetImpl();
|
||||
disk.setSize(256);
|
||||
disk.setUnit(MemoryUnit.GB);
|
||||
disk.setUsed(120);
|
||||
|
||||
HasPersistentMemory<HostingNode, MemoryFacet> hasPersistentMemory = new HasPersistentMemoryImpl<HostingNode, MemoryFacet>(
|
||||
hostingNode, disk, null);
|
||||
hostingNode.addFacet(hasPersistentMemory);
|
||||
|
||||
PropagationConstraint propagationConstraint = new PropagationConstraintImpl();
|
||||
propagationConstraint.setAddConstraint(AddConstraint.unpropagate);
|
||||
propagationConstraint.setRemoveConstraint(RemoveConstraint.cascade);
|
||||
Activates<HostingNode, EService> activates = new ActivatesImpl<HostingNode, EService>(
|
||||
hostingNode, eService, propagationConstraint);
|
||||
UUID activatedUUID = UUID.randomUUID();
|
||||
activates.setHeader(new HeaderImpl(activatedUUID));
|
||||
hostingNode.attachResource(activates);
|
||||
|
||||
StateFacet hnStateFacet = new StateFacetImpl();
|
||||
hnStateFacet.setValue("certified");
|
||||
hostingNode.addFacet(hnStateFacet);
|
||||
|
||||
EventFacet hnEventFacet = new EventFacetImpl();
|
||||
hnEventFacet.setDate(Calendar.getInstance().getTime());
|
||||
ValueSchema hnEvent = new ValueSchemaImpl();
|
||||
hnEvent.setSchema(new URI("Schema"));
|
||||
hnEvent.setValue("Created");
|
||||
hnEventFacet.setEvent(hnEvent);
|
||||
hostingNode.addFacet(hnEventFacet);
|
||||
HostingNode hostingNode = ERManagementTest.instantiateValidHostinNode();
|
||||
|
||||
resourceManagement = new ResourceManagement();
|
||||
resourceManagement.setElementType(HostingNode.NAME);
|
||||
|
|
|
@ -3,40 +3,20 @@
|
|||
*/
|
||||
package org.gcube.informationsystem.resourceregistry.instances.multicontext;
|
||||
|
||||
import java.net.URI;
|
||||
import java.net.URL;
|
||||
import java.util.Calendar;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.gcube.com.fasterxml.jackson.databind.JsonNode;
|
||||
import org.gcube.informationsystem.model.impl.properties.PropagationConstraintImpl;
|
||||
import org.gcube.informationsystem.model.reference.entities.Facet;
|
||||
import org.gcube.informationsystem.model.reference.properties.PropagationConstraint;
|
||||
import org.gcube.informationsystem.model.reference.properties.PropagationConstraint.AddConstraint;
|
||||
import org.gcube.informationsystem.model.reference.properties.PropagationConstraint.RemoveConstraint;
|
||||
import org.gcube.informationsystem.resourceregistry.ContextTest;
|
||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;
|
||||
import org.gcube.informationsystem.resourceregistry.contexts.ContextUtility;
|
||||
import org.gcube.informationsystem.resourceregistry.instances.ERManagementTest;
|
||||
import org.gcube.informationsystem.resourceregistry.instances.model.ERManagementUtility;
|
||||
import org.gcube.informationsystem.resourceregistry.instances.model.entities.ResourceManagement;
|
||||
import org.gcube.informationsystem.utils.ElementMapper;
|
||||
import org.gcube.resourcemanagement.model.impl.entities.facets.AccessPointFacetImpl;
|
||||
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.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.properties.ValueSchemaImpl;
|
||||
import org.gcube.resourcemanagement.model.impl.relations.consistsof.IsIdentifiedByImpl;
|
||||
import org.gcube.resourcemanagement.model.reference.entities.facets.AccessPointFacet;
|
||||
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.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.properties.ValueSchema;
|
||||
import org.gcube.resourcemanagement.model.reference.relations.consistsof.IsIdentifiedBy;
|
||||
import org.junit.Test;
|
||||
import org.slf4j.Logger;
|
||||
|
@ -53,45 +33,7 @@ public class EnhancedTest extends MultiContextTest {
|
|||
@Test
|
||||
public void testNoFollows() throws Exception {
|
||||
ContextTest.setContextByName(DEFAULT_TEST_SCOPE);
|
||||
EService eService = new EServiceImpl();
|
||||
|
||||
SoftwareFacet softwareFacet = new SoftwareFacetImpl();
|
||||
softwareFacet.setGroup("InformationSystem");
|
||||
softwareFacet.setName("resource-registry");
|
||||
softwareFacet.setVersion("1.1.0");
|
||||
PropagationConstraint propagationConstraint = new PropagationConstraintImpl();
|
||||
propagationConstraint.setAddConstraint(AddConstraint.propagate);
|
||||
propagationConstraint.setRemoveConstraint(RemoveConstraint.cascade);
|
||||
|
||||
IsIdentifiedBy<EService, Facet> isIdentifiedBy = new IsIdentifiedByImpl<EService, Facet>(
|
||||
eService, softwareFacet, propagationConstraint);
|
||||
eService.addFacet(isIdentifiedBy);
|
||||
|
||||
AccessPointFacet accessPointFacet = new AccessPointFacetImpl();
|
||||
accessPointFacet.setEndpoint(new URI("https://localhost"));
|
||||
accessPointFacet.setEntryName("port1");
|
||||
eService.addFacet(accessPointFacet);
|
||||
|
||||
EventFacet eventFacet = new EventFacetImpl();
|
||||
eventFacet.setDate(Calendar.getInstance().getTime());
|
||||
ValueSchema event = new ValueSchemaImpl();
|
||||
event.setValue("Created");
|
||||
event.setSchema(new URI(""));
|
||||
eventFacet.setEvent(event);
|
||||
eService.addFacet(eventFacet);
|
||||
|
||||
StateFacet stateFacet = new StateFacetImpl();
|
||||
stateFacet.setValue("ready");
|
||||
eService.addFacet(stateFacet);
|
||||
|
||||
|
||||
LicenseFacet licenseFacet = new LicenseFacetImpl();
|
||||
licenseFacet.setName("EUPL");
|
||||
licenseFacet
|
||||
.setTextURL(new URL(
|
||||
"https://joinup.ec.europa.eu/community/eupl/og_page/european-union-public-licence-eupl-v11"));
|
||||
eService.addFacet(licenseFacet);
|
||||
|
||||
EService eService = ERManagementTest.instantiateValidEService();
|
||||
|
||||
ResourceManagement resourceManagement = new ResourceManagement();
|
||||
resourceManagement.setElementType(EService.NAME);
|
||||
|
|
|
@ -1,33 +1,16 @@
|
|||
package org.gcube.informationsystem.resourceregistry.instances.multicontext;
|
||||
|
||||
import java.net.URI;
|
||||
import java.net.URL;
|
||||
import java.util.Calendar;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.gcube.informationsystem.model.reference.entities.Facet;
|
||||
import org.gcube.informationsystem.resourceregistry.ContextTest;
|
||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.entity.facet.FacetAlreadyPresentException;
|
||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.entity.resource.ResourceAlreadyPresentException;
|
||||
import org.gcube.informationsystem.resourceregistry.instances.ERManagementTest;
|
||||
import org.gcube.informationsystem.resourceregistry.instances.model.entities.FacetManagement;
|
||||
import org.gcube.informationsystem.resourceregistry.instances.model.entities.ResourceManagement;
|
||||
import org.gcube.informationsystem.utils.ElementMapper;
|
||||
import org.gcube.resourcemanagement.model.impl.entities.facets.AccessPointFacetImpl;
|
||||
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.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.properties.ValueSchemaImpl;
|
||||
import org.gcube.resourcemanagement.model.impl.relations.consistsof.IsIdentifiedByImpl;
|
||||
import org.gcube.resourcemanagement.model.reference.entities.facets.AccessPointFacet;
|
||||
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.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.properties.ValueSchema;
|
||||
import org.gcube.resourcemanagement.model.reference.relations.consistsof.IsIdentifiedBy;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import org.slf4j.Logger;
|
||||
|
@ -42,38 +25,7 @@ public class RuleTest extends ContextTest {
|
|||
.getLogger(RuleTest.class);
|
||||
|
||||
public EService createEservice() throws Exception {
|
||||
EService eService = new EServiceImpl();
|
||||
|
||||
SoftwareFacet softwareFacet = new SoftwareFacetImpl();
|
||||
softwareFacet.setGroup("InformationSystem");
|
||||
softwareFacet.setName("resource-registry");
|
||||
softwareFacet.setVersion("1.1.0");
|
||||
IsIdentifiedBy<EService, Facet> isIdentifiedBy = new IsIdentifiedByImpl<EService, Facet>(
|
||||
eService, softwareFacet, null);
|
||||
eService.addFacet(isIdentifiedBy);
|
||||
|
||||
AccessPointFacet accessPointFacet = new AccessPointFacetImpl();
|
||||
accessPointFacet.setEndpoint(new URI("https://localhost"));
|
||||
accessPointFacet.setEntryName("port1");
|
||||
eService.addFacet(accessPointFacet);
|
||||
|
||||
EventFacet eventFacet = new EventFacetImpl();
|
||||
eventFacet.setDate(Calendar.getInstance().getTime());
|
||||
ValueSchema event = new ValueSchemaImpl();
|
||||
event.setValue("Created");
|
||||
eventFacet.setEvent(event);
|
||||
eService.addFacet(eventFacet);
|
||||
|
||||
StateFacet stateFacet = new StateFacetImpl();
|
||||
stateFacet.setValue("ready");
|
||||
eService.addFacet(stateFacet);
|
||||
|
||||
LicenseFacet licenseFacet = new LicenseFacetImpl();
|
||||
licenseFacet.setName("EUPL");
|
||||
licenseFacet
|
||||
.setTextURL(new URL(
|
||||
"https://joinup.ec.europa.eu/community/eupl/og_page/european-union-public-licence-eupl-v11"));
|
||||
eService.addFacet(licenseFacet);
|
||||
EService eService = ERManagementTest.instantiateValidEService();
|
||||
|
||||
ResourceManagement resourceManagement = new ResourceManagement();
|
||||
resourceManagement.setElementType(EService.NAME);
|
||||
|
@ -157,8 +109,6 @@ public class RuleTest extends ContextTest {
|
|||
// TODO continue with checks
|
||||
|
||||
|
||||
|
||||
|
||||
eServiceManagement = new ResourceManagement();
|
||||
eServiceManagement.setElementType(EService.NAME);
|
||||
eServiceManagement.setJson(eServiceString);
|
||||
|
|
Loading…
Reference in New Issue