Fixing test
This commit is contained in:
parent
985d37a077
commit
2485f43510
File diff suppressed because one or more lines are too long
|
@ -431,29 +431,14 @@ public class BasicTest extends MultiContextTest {
|
|||
|
||||
@Test
|
||||
public void testAddAndRemoveFromContext() throws Exception {
|
||||
|
||||
/* Creating HostingNode */
|
||||
|
||||
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);
|
||||
|
||||
String json = ElementMapper.marshal(hostingNode);
|
||||
logger.trace("Going to create {}", json);
|
||||
|
||||
ResourceManagement resourceManagement = new ResourceManagement();
|
||||
resourceManagement.setElementType(HostingNode.NAME);
|
||||
resourceManagement.setJson(json);
|
||||
resourceManagement.setJson(SmartgearResourcesTest.HOSTING_NODE);
|
||||
|
||||
String hnJson = resourceManagement.create();
|
||||
logger.debug("Created : {}", hnJson);
|
||||
hostingNode = ElementMapper.unmarshal(HostingNode.class, hnJson);
|
||||
HostingNode hostingNode = ElementMapper.unmarshal(HostingNode.class, hnJson);
|
||||
logger.debug("Unmarshalled {} {}", HostingNode.NAME, hostingNode);
|
||||
|
||||
UUID hnUUID = hostingNode.getHeader().getUUID();
|
||||
|
@ -461,25 +446,13 @@ public class BasicTest extends MultiContextTest {
|
|||
|
||||
/* 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 = new ResourceManagement();
|
||||
resourceManagement.setElementType(EService.NAME);
|
||||
resourceManagement.setJson(ElementMapper.marshal(eService));
|
||||
resourceManagement.setJson(SmartgearResourcesTest.ESERVICE);
|
||||
|
||||
String eservicejson = resourceManagement.create();
|
||||
logger.debug("Created : {}", eservicejson);
|
||||
eService = ElementMapper.unmarshal(EService.class, eservicejson);
|
||||
EService eService = ElementMapper.unmarshal(EService.class, eservicejson);
|
||||
logger.debug("Unmarshalled {} {}", EService.NAME, eService);
|
||||
|
||||
UUID eServiceUUID = eService.getHeader().getUUID();
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package org.gcube.informationsystem.resourceregistry.instances.multicontext;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Calendar;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
|
@ -19,15 +17,9 @@ 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.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.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.HostingNode;
|
||||
import org.gcube.resourcemanagement.model.reference.properties.ValueSchema;
|
||||
import org.gcube.resourcemanagement.model.reference.relations.isrelatedto.Activates;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
@ -41,50 +33,28 @@ public class ComplexTest extends MultiContextTest {
|
|||
@Test
|
||||
public void testGetInstancesContexts() throws ResourceRegistryException, Exception {
|
||||
ContextTest.setContextByName(DEFAULT_TEST_SCOPE);
|
||||
/* Creating HostingNode */
|
||||
|
||||
ContextCache contextCache = ContextCache.getInstance();
|
||||
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);
|
||||
|
||||
/* Creating HostingNode */
|
||||
ResourceManagement hostingNodeManagement = new ResourceManagement();
|
||||
hostingNodeManagement.setElementType(HostingNode.NAME);
|
||||
hostingNodeManagement.setJson(ElementMapper.marshal(hostingNode));
|
||||
hostingNodeManagement.setJson(SmartgearResourcesTest.HOSTING_NODE);
|
||||
|
||||
String hnJson = hostingNodeManagement.create();
|
||||
logger.debug("Created : {}", hnJson);
|
||||
hostingNode = ElementMapper.unmarshal(HostingNode.class, hnJson);
|
||||
HostingNode hostingNode = ElementMapper.unmarshal(HostingNode.class, hnJson);
|
||||
logger.debug("Unmarshalled {} {}", HostingNode.NAME, hostingNode);
|
||||
|
||||
/* 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();
|
||||
eServiceManagement.setElementType(EService.NAME);
|
||||
eServiceManagement.setJson(ElementMapper.marshal(eService));
|
||||
eServiceManagement.setJson(SmartgearResourcesTest.ESERVICE);
|
||||
|
||||
String eservicejson = eServiceManagement.create();
|
||||
logger.debug("Created : {}", eservicejson);
|
||||
eService = ElementMapper.unmarshal(EService.class, eservicejson);
|
||||
EService eService = ElementMapper.unmarshal(EService.class, eservicejson);
|
||||
logger.debug("Unmarshalled {} {}", EService.NAME, eService);
|
||||
|
||||
|
||||
|
|
|
@ -148,51 +148,28 @@ public class EnhancedTest extends MultiContextTest {
|
|||
@Test
|
||||
public void testGetContextsInInstances() throws ResourceRegistryException, Exception {
|
||||
ContextTest.setContextByName(DEFAULT_TEST_SCOPE);
|
||||
/* Creating HostingNode */
|
||||
|
||||
ContextCache contextCache = ContextCache.getInstance();
|
||||
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);
|
||||
|
||||
|
||||
/* Creating HostingNode */
|
||||
ResourceManagement hostingNodeManagement = new ResourceManagement();
|
||||
hostingNodeManagement.setElementType(HostingNode.NAME);
|
||||
hostingNodeManagement.setJson(ElementMapper.marshal(hostingNode));
|
||||
hostingNodeManagement.setJson(SmartgearResourcesTest.HOSTING_NODE);
|
||||
|
||||
String hnJson = hostingNodeManagement.create();
|
||||
logger.debug("Created : {}", hnJson);
|
||||
hostingNode = ElementMapper.unmarshal(HostingNode.class, hnJson);
|
||||
HostingNode hostingNode = ElementMapper.unmarshal(HostingNode.class, hnJson);
|
||||
logger.debug("Unmarshalled {} {}", HostingNode.NAME, hostingNode);
|
||||
|
||||
/* 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();
|
||||
eServiceManagement.setElementType(EService.NAME);
|
||||
eServiceManagement.setJson(ElementMapper.marshal(eService));
|
||||
eServiceManagement.setJson(SmartgearResourcesTest.ESERVICE);
|
||||
|
||||
String eservicejson = eServiceManagement.create();
|
||||
logger.debug("Created : {}", eservicejson);
|
||||
eService = ElementMapper.unmarshal(EService.class, eservicejson);
|
||||
EService eService = ElementMapper.unmarshal(EService.class, eservicejson);
|
||||
logger.debug("Unmarshalled {} {}", EService.NAME, eService);
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue