Fixing test
This commit is contained in:
parent
c443ae8c4e
commit
985d37a077
|
@ -1,5 +1,7 @@
|
||||||
package org.gcube.informationsystem.resourceregistry.instances.multicontext;
|
package org.gcube.informationsystem.resourceregistry.instances.multicontext;
|
||||||
|
|
||||||
|
import java.net.URI;
|
||||||
|
import java.util.Calendar;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
@ -17,9 +19,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.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.EventFacetImpl;
|
||||||
|
import org.gcube.resourcemanagement.model.impl.entities.facets.StateFacetImpl;
|
||||||
|
import org.gcube.resourcemanagement.model.impl.properties.ValueSchemaImpl;
|
||||||
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.EventFacet;
|
||||||
|
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.isrelatedto.Activates;
|
import org.gcube.resourcemanagement.model.reference.relations.isrelatedto.Activates;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
@ -37,25 +45,46 @@ public class ComplexTest extends MultiContextTest {
|
||||||
ContextCache contextCache = ContextCache.getInstance();
|
ContextCache contextCache = ContextCache.getInstance();
|
||||||
contextCache.setContextCacheRenewal(contextCacheRenewal);
|
contextCache.setContextCacheRenewal(contextCacheRenewal);
|
||||||
|
|
||||||
|
HostingNode hostingNode = ElementMapper.unmarshal(HostingNode.class, SmartgearResourcesTest.HOSTING_NODE);
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
ResourceManagement hostingNodeManagement = new ResourceManagement();
|
ResourceManagement hostingNodeManagement = new ResourceManagement();
|
||||||
hostingNodeManagement.setElementType(HostingNode.NAME);
|
hostingNodeManagement.setElementType(HostingNode.NAME);
|
||||||
hostingNodeManagement.setJson(SmartgearResourcesTest.HOSTING_NODE);
|
hostingNodeManagement.setJson(ElementMapper.marshal(hostingNode));
|
||||||
|
|
||||||
String hnJson = hostingNodeManagement.create();
|
String hnJson = hostingNodeManagement.create();
|
||||||
logger.debug("Created : {}", hnJson);
|
logger.debug("Created : {}", hnJson);
|
||||||
HostingNode hostingNode = ElementMapper.unmarshal(HostingNode.class, hnJson);
|
hostingNode = ElementMapper.unmarshal(HostingNode.class, hnJson);
|
||||||
logger.debug("Unmarshalled {} {}", HostingNode.NAME, hostingNode);
|
logger.debug("Unmarshalled {} {}", HostingNode.NAME, hostingNode);
|
||||||
|
|
||||||
/* Creating EService */
|
/* Creating EService */
|
||||||
|
|
||||||
|
EService eService = ElementMapper.unmarshal(EService.class, SmartgearResourcesTest.ESERVICE);
|
||||||
|
StateFacet stateFacet = new StateFacetImpl();
|
||||||
|
stateFacet.setValue("ready");
|
||||||
|
eService.addFacet(stateFacet);
|
||||||
|
|
||||||
|
EventFacet eventFacet = new EventFacetImpl();
|
||||||
|
eventFacet.setDate(Calendar.getInstance().getTime());
|
||||||
|
ValueSchema event = new ValueSchemaImpl();
|
||||||
|
event.setValue("Created");
|
||||||
|
eventFacet.setEvent(event);
|
||||||
|
eService.addFacet(eventFacet);
|
||||||
|
|
||||||
ResourceManagement eServiceManagement = new ResourceManagement();
|
ResourceManagement eServiceManagement = new ResourceManagement();
|
||||||
eServiceManagement.setElementType(EService.NAME);
|
eServiceManagement.setElementType(EService.NAME);
|
||||||
eServiceManagement.setJson(SmartgearResourcesTest.ESERVICE);
|
eServiceManagement.setJson(ElementMapper.marshal(eService));
|
||||||
|
|
||||||
String eservicejson = eServiceManagement.create();
|
String eservicejson = eServiceManagement.create();
|
||||||
logger.debug("Created : {}", eservicejson);
|
logger.debug("Created : {}", eservicejson);
|
||||||
EService eService = ElementMapper.unmarshal(EService.class, eservicejson);
|
eService = ElementMapper.unmarshal(EService.class, eservicejson);
|
||||||
logger.debug("Unmarshalled {} {}", EService.NAME, eService);
|
logger.debug("Unmarshalled {} {}", EService.NAME, eService);
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue