Removed not needed / from path

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/information-system/resource-registry-publisher@148279 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Luca Frosini 2017-05-03 15:51:37 +00:00
parent 7fbd6b419a
commit 3a432bc345
2 changed files with 61 additions and 3 deletions

View File

@ -350,8 +350,8 @@ public class ResourceRegistryPublisherImpl implements ResourceRegistryPublisher
stringWriter.append(ERPath.ER_PATH_PART); stringWriter.append(ERPath.ER_PATH_PART);
stringWriter.append(PATH_SEPARATOR); stringWriter.append(PATH_SEPARATOR);
stringWriter.append(ERPath.IS_RELATED_TO_PATH_PART); stringWriter.append(ERPath.IS_RELATED_TO_PATH_PART);
stringWriter.append(PATH_SEPARATOR);
/* /*
stringWriter.append(PATH_SEPARATOR);
stringWriter.append(ERPath.SOURCE_PATH_PART); stringWriter.append(ERPath.SOURCE_PATH_PART);
stringWriter.append(PATH_SEPARATOR); stringWriter.append(PATH_SEPARATOR);
stringWriter.append(isRelatedTo.getSource().getHeader().getUUID() stringWriter.append(isRelatedTo.getSource().getHeader().getUUID()

View File

@ -25,6 +25,7 @@ import org.gcube.informationsystem.impl.entity.resource.HostingNodeImpl;
import org.gcube.informationsystem.impl.relation.ConsistsOfImpl; import org.gcube.informationsystem.impl.relation.ConsistsOfImpl;
import org.gcube.informationsystem.impl.relation.IsIdentifiedByImpl; import org.gcube.informationsystem.impl.relation.IsIdentifiedByImpl;
import org.gcube.informationsystem.impl.relation.isrelatedto.HostsImpl; import org.gcube.informationsystem.impl.relation.isrelatedto.HostsImpl;
import org.gcube.informationsystem.impl.utils.ISMapper;
import org.gcube.informationsystem.model.embedded.PropagationConstraint; import org.gcube.informationsystem.model.embedded.PropagationConstraint;
import org.gcube.informationsystem.model.embedded.PropagationConstraint.AddConstraint; import org.gcube.informationsystem.model.embedded.PropagationConstraint.AddConstraint;
import org.gcube.informationsystem.model.embedded.PropagationConstraint.RemoveConstraint; import org.gcube.informationsystem.model.embedded.PropagationConstraint.RemoveConstraint;
@ -48,8 +49,6 @@ import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegis
import org.gcube.informationsystem.resourceregistry.client.Direction; import org.gcube.informationsystem.resourceregistry.client.Direction;
import org.gcube.informationsystem.resourceregistry.client.ResourceRegistryClient; import org.gcube.informationsystem.resourceregistry.client.ResourceRegistryClient;
import org.gcube.informationsystem.resourceregistry.client.ResourceRegistryClientFactory; import org.gcube.informationsystem.resourceregistry.client.ResourceRegistryClientFactory;
import org.gcube.informationsystem.resourceregistry.publisher.ResourceRegistryPublisher;
import org.gcube.informationsystem.resourceregistry.publisher.ResourceRegistryPublisherFactory;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -545,4 +544,63 @@ public class ERManagementTest extends ScopedTest {
Assert.assertTrue(deleted); Assert.assertTrue(deleted);
} }
@SuppressWarnings("unchecked")
@Test
public void testCreateHostingNodeThenHostsWithEService()
throws Exception {
HostingNode hostingNode = new HostingNodeImpl();
CPUFacet cpuFacet = new CPUFacetImpl();
cpuFacet.setClockSpeed("1 GHz");
cpuFacet.setModel("Opteron");
cpuFacet.setVendor("AMD");
hostingNode.addFacet(cpuFacet);
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> hnIsIdentifiedBy = new IsIdentifiedByImpl<HostingNode, NetworkingFacet>(hostingNode,
networkingFacet, null);
hostingNode.addFacet(hnIsIdentifiedBy);
hostingNode = resourceRegistryPublisher.createResource(HostingNode.class, hostingNode);
/* -------- */
EService eService = new EServiceImpl();
SoftwareFacet softwareFacet = new SoftwareFacetImpl();
softwareFacet.setGroup("InformationSystem");
softwareFacet.setName("resource-registry");
softwareFacet.setVersion("1.1.0");
IsIdentifiedBy<Resource, Facet> isIdentifiedBy = new IsIdentifiedByImpl<Resource, Facet>(
eService, softwareFacet, null);
eService.addFacet(isIdentifiedBy);
PropagationConstraint propagationConstraint = new PropagationConstraintImpl();
propagationConstraint.setRemoveConstraint(RemoveConstraint.cascade);
propagationConstraint.setAddConstraint(AddConstraint.unpropagate);
Hosts<HostingNode, EService> hosts = new HostsImpl<HostingNode, EService>(
hostingNode, eService, propagationConstraint);
hosts = resourceRegistryPublisher.createIsRelatedTo(Hosts.class, hosts);
hostingNode.attachResource(hosts);
logger.debug("Created Hosts is {}", ISMapper.marshal(hosts));
boolean deleted = resourceRegistryPublisher.deleteResource(hostingNode);
Assert.assertTrue(deleted);
}
} }