Fixing tests
This commit is contained in:
parent
b7a2e6c6eb
commit
a0ffe74776
|
@ -3,6 +3,9 @@
|
||||||
*/
|
*/
|
||||||
package org.gcube.informationsystem.resourceregistry.instances.multicontext;
|
package org.gcube.informationsystem.resourceregistry.instances.multicontext;
|
||||||
|
|
||||||
|
import java.net.URI;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.util.Calendar;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -28,13 +31,23 @@ 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.entities.ResourceManagement;
|
||||||
import org.gcube.informationsystem.resourceregistry.instances.model.relations.IsRelatedToManagement;
|
import org.gcube.informationsystem.resourceregistry.instances.model.relations.IsRelatedToManagement;
|
||||||
import org.gcube.informationsystem.utils.ElementMapper;
|
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.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.EServiceImpl;
|
||||||
|
import org.gcube.resourcemanagement.model.impl.properties.ValueSchemaImpl;
|
||||||
import org.gcube.resourcemanagement.model.impl.relations.consistsof.IsIdentifiedByImpl;
|
import org.gcube.resourcemanagement.model.impl.relations.consistsof.IsIdentifiedByImpl;
|
||||||
import org.gcube.resourcemanagement.model.impl.relations.isrelatedto.ActivatesImpl;
|
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.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.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.EService;
|
||||||
import org.gcube.resourcemanagement.model.reference.entities.resources.HostingNode;
|
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.IsIdentifiedBy;
|
import org.gcube.resourcemanagement.model.reference.relations.consistsof.IsIdentifiedBy;
|
||||||
import org.gcube.resourcemanagement.model.reference.relations.isrelatedto.Activates;
|
import org.gcube.resourcemanagement.model.reference.relations.isrelatedto.Activates;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
|
@ -64,9 +77,35 @@ public class EnhancedTest extends MultiContextTest {
|
||||||
propagationConstraint.setRemoveConstraint(RemoveConstraint.cascade);
|
propagationConstraint.setRemoveConstraint(RemoveConstraint.cascade);
|
||||||
|
|
||||||
IsIdentifiedBy<EService, Facet> isIdentifiedBy = new IsIdentifiedByImpl<EService, Facet>(
|
IsIdentifiedBy<EService, Facet> isIdentifiedBy = new IsIdentifiedByImpl<EService, Facet>(
|
||||||
eService, softwareFacet, null);
|
eService, softwareFacet, propagationConstraint);
|
||||||
eService.addFacet(isIdentifiedBy);
|
eService.addFacet(isIdentifiedBy);
|
||||||
|
|
||||||
|
AccessPointFacet accessPointFacet = new AccessPointFacetImpl();
|
||||||
|
accessPointFacet.setEndpoint(new URI("http://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);
|
||||||
|
|
||||||
|
|
||||||
ResourceManagement resourceManagement = new ResourceManagement();
|
ResourceManagement resourceManagement = new ResourceManagement();
|
||||||
resourceManagement.setElementType(EService.NAME);
|
resourceManagement.setElementType(EService.NAME);
|
||||||
resourceManagement.setJson(ElementMapper.marshal(eService));
|
resourceManagement.setJson(ElementMapper.marshal(eService));
|
||||||
|
|
Loading…
Reference in New Issue