git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/information-system/resource-registry-publisher@133702 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
8fa72b179f
commit
a746eb869b
7
pom.xml
7
pom.xml
|
@ -89,6 +89,13 @@
|
||||||
<artifactId>gcube-resources</artifactId>
|
<artifactId>gcube-resources</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.gcube.information-system</groupId>
|
||||||
|
<artifactId>resource-registry-client</artifactId>
|
||||||
|
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|
|
@ -254,6 +254,7 @@ public class ResourceRegistryPublisherImpl implements ResourceRegistryPublisher
|
||||||
public <F extends Facet> F createFacet(Class<F> facetClass, F facet) {
|
public <F extends Facet> F createFacet(Class<F> facetClass, F facet) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
logger.info("Going to create: {}", facet);
|
||||||
StringWriter stringWriter = new StringWriter();
|
StringWriter stringWriter = new StringWriter();
|
||||||
stringWriter.append(PATH_SEPARATOR);
|
stringWriter.append(PATH_SEPARATOR);
|
||||||
stringWriter.append(EntityPath.ENTITY_PATH_PART);
|
stringWriter.append(EntityPath.ENTITY_PATH_PART);
|
||||||
|
@ -269,7 +270,9 @@ public class ResourceRegistryPublisherImpl implements ResourceRegistryPublisher
|
||||||
|
|
||||||
ResourceRegistryCall<F> call = new ResourceRegistryCall<>(facetClass, httpInputs);
|
ResourceRegistryCall<F> call = new ResourceRegistryCall<>(facetClass, httpInputs);
|
||||||
|
|
||||||
return delegate.make(call);
|
F f = delegate.make(call);
|
||||||
|
logger.info("{} successfully created", f);
|
||||||
|
return f;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("Error Creating {}", facet, e);
|
logger.error("Error Creating {}", facet, e);
|
||||||
throw new ServiceException(e);
|
throw new ServiceException(e);
|
||||||
|
@ -279,6 +282,7 @@ public class ResourceRegistryPublisherImpl implements ResourceRegistryPublisher
|
||||||
@Override
|
@Override
|
||||||
public <F extends Facet> F updateFacet(Class<F> facetClass, F facet) {
|
public <F extends Facet> F updateFacet(Class<F> facetClass, F facet) {
|
||||||
try {
|
try {
|
||||||
|
logger.info("Going to update: {}", facet);
|
||||||
StringWriter stringWriter = new StringWriter();
|
StringWriter stringWriter = new StringWriter();
|
||||||
stringWriter.append(PATH_SEPARATOR);
|
stringWriter.append(PATH_SEPARATOR);
|
||||||
stringWriter.append(EntityPath.ENTITY_PATH_PART);
|
stringWriter.append(EntityPath.ENTITY_PATH_PART);
|
||||||
|
@ -294,7 +298,9 @@ public class ResourceRegistryPublisherImpl implements ResourceRegistryPublisher
|
||||||
|
|
||||||
ResourceRegistryCall<F> call = new ResourceRegistryCall<>(facetClass, httpInputs);
|
ResourceRegistryCall<F> call = new ResourceRegistryCall<>(facetClass, httpInputs);
|
||||||
|
|
||||||
return delegate.make(call);
|
F f = delegate.make(call);
|
||||||
|
logger.info("{} successfully updated", f);
|
||||||
|
return f;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("Error Updating {}", facet, e);
|
logger.error("Error Updating {}", facet, e);
|
||||||
throw new ServiceException(e);
|
throw new ServiceException(e);
|
||||||
|
@ -304,6 +310,7 @@ public class ResourceRegistryPublisherImpl implements ResourceRegistryPublisher
|
||||||
@Override
|
@Override
|
||||||
public <F extends Facet> boolean deleteFacet(F facet) {
|
public <F extends Facet> boolean deleteFacet(F facet) {
|
||||||
try {
|
try {
|
||||||
|
logger.info("Going to delete: {}", facet);
|
||||||
StringWriter stringWriter = new StringWriter();
|
StringWriter stringWriter = new StringWriter();
|
||||||
stringWriter.append(PATH_SEPARATOR);
|
stringWriter.append(PATH_SEPARATOR);
|
||||||
stringWriter.append(EntityPath.ENTITY_PATH_PART);
|
stringWriter.append(EntityPath.ENTITY_PATH_PART);
|
||||||
|
@ -316,7 +323,9 @@ public class ResourceRegistryPublisherImpl implements ResourceRegistryPublisher
|
||||||
|
|
||||||
ResourceRegistryCall<Boolean> call = new ResourceRegistryCall<>(Boolean.class, httpInputs);
|
ResourceRegistryCall<Boolean> call = new ResourceRegistryCall<>(Boolean.class, httpInputs);
|
||||||
|
|
||||||
return delegate.make(call);
|
boolean deleted = delegate.make(call);
|
||||||
|
logger.info("{} {}", facet, deleted?" successfully deleted": "was NOT deleted");
|
||||||
|
return deleted;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("Error Removing {}", facet, e);
|
logger.error("Error Removing {}", facet, e);
|
||||||
throw new ServiceException(e);
|
throw new ServiceException(e);
|
||||||
|
@ -327,6 +336,7 @@ public class ResourceRegistryPublisherImpl implements ResourceRegistryPublisher
|
||||||
public <R extends Resource> R createResource(Class<R> resourceClass,
|
public <R extends Resource> R createResource(Class<R> resourceClass,
|
||||||
R resource) {
|
R resource) {
|
||||||
try {
|
try {
|
||||||
|
logger.info("Going to create: {}", resource);
|
||||||
StringWriter stringWriter = new StringWriter();
|
StringWriter stringWriter = new StringWriter();
|
||||||
stringWriter.append(PATH_SEPARATOR);
|
stringWriter.append(PATH_SEPARATOR);
|
||||||
stringWriter.append(EntityPath.ENTITY_PATH_PART);
|
stringWriter.append(EntityPath.ENTITY_PATH_PART);
|
||||||
|
@ -342,7 +352,9 @@ public class ResourceRegistryPublisherImpl implements ResourceRegistryPublisher
|
||||||
|
|
||||||
ResourceRegistryCall<R> call = new ResourceRegistryCall<>(resourceClass, httpInputs);
|
ResourceRegistryCall<R> call = new ResourceRegistryCall<>(resourceClass, httpInputs);
|
||||||
|
|
||||||
return delegate.make(call);
|
R r = delegate.make(call);
|
||||||
|
logger.info("{} successfully created", r);
|
||||||
|
return r;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("Error Creating Facet", e);
|
logger.error("Error Creating Facet", e);
|
||||||
throw new ServiceException(e);
|
throw new ServiceException(e);
|
||||||
|
@ -352,6 +364,7 @@ public class ResourceRegistryPublisherImpl implements ResourceRegistryPublisher
|
||||||
@Override
|
@Override
|
||||||
public <R extends Resource> boolean deleteResource(R resource) {
|
public <R extends Resource> boolean deleteResource(R resource) {
|
||||||
try {
|
try {
|
||||||
|
logger.info("Going to delete: {}", resource);
|
||||||
StringWriter stringWriter = new StringWriter();
|
StringWriter stringWriter = new StringWriter();
|
||||||
stringWriter.append(PATH_SEPARATOR);
|
stringWriter.append(PATH_SEPARATOR);
|
||||||
stringWriter.append(EntityPath.ENTITY_PATH_PART);
|
stringWriter.append(EntityPath.ENTITY_PATH_PART);
|
||||||
|
@ -364,7 +377,9 @@ public class ResourceRegistryPublisherImpl implements ResourceRegistryPublisher
|
||||||
|
|
||||||
ResourceRegistryCall<Boolean> call = new ResourceRegistryCall<>(Boolean.class, httpInputs);
|
ResourceRegistryCall<Boolean> call = new ResourceRegistryCall<>(Boolean.class, httpInputs);
|
||||||
|
|
||||||
return delegate.make(call);
|
boolean deleted = delegate.make(call);
|
||||||
|
logger.info("{} {}", resource, deleted?" successfully deleted": "was NOT deleted");
|
||||||
|
return deleted;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("Error Removing {}", resource, e);
|
logger.error("Error Removing {}", resource, e);
|
||||||
throw new ServiceException(e);
|
throw new ServiceException(e);
|
||||||
|
@ -375,6 +390,7 @@ public class ResourceRegistryPublisherImpl implements ResourceRegistryPublisher
|
||||||
public <C extends ConsistsOf<? extends Resource, ? extends Facet>> C createConsistsOf(
|
public <C extends ConsistsOf<? extends Resource, ? extends Facet>> C createConsistsOf(
|
||||||
Class<C> consistsOfClass, C consistsOf) {
|
Class<C> consistsOfClass, C consistsOf) {
|
||||||
try {
|
try {
|
||||||
|
logger.info("Going to create: {}", consistsOf);
|
||||||
StringWriter stringWriter = new StringWriter();
|
StringWriter stringWriter = new StringWriter();
|
||||||
stringWriter.append(PATH_SEPARATOR);
|
stringWriter.append(PATH_SEPARATOR);
|
||||||
stringWriter.append(EntityPath.ENTITY_PATH_PART);
|
stringWriter.append(EntityPath.ENTITY_PATH_PART);
|
||||||
|
@ -398,7 +414,9 @@ public class ResourceRegistryPublisherImpl implements ResourceRegistryPublisher
|
||||||
|
|
||||||
ResourceRegistryCall<C> call = new ResourceRegistryCall<>(consistsOfClass, httpInputs);
|
ResourceRegistryCall<C> call = new ResourceRegistryCall<>(consistsOfClass, httpInputs);
|
||||||
|
|
||||||
return delegate.make(call);
|
C c = delegate.make(call);
|
||||||
|
logger.info("{} successfully created", c);
|
||||||
|
return c;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("Error Creating Facet", e);
|
logger.error("Error Creating Facet", e);
|
||||||
throw new ServiceException(e);
|
throw new ServiceException(e);
|
||||||
|
@ -409,6 +427,7 @@ public class ResourceRegistryPublisherImpl implements ResourceRegistryPublisher
|
||||||
public <C extends ConsistsOf<? extends Resource, ? extends Facet>> boolean deleteConsistsOf(
|
public <C extends ConsistsOf<? extends Resource, ? extends Facet>> boolean deleteConsistsOf(
|
||||||
C consistsOf) {
|
C consistsOf) {
|
||||||
try {
|
try {
|
||||||
|
logger.info("Going to delete: {}", consistsOf);
|
||||||
StringWriter stringWriter = new StringWriter();
|
StringWriter stringWriter = new StringWriter();
|
||||||
stringWriter.append(PATH_SEPARATOR);
|
stringWriter.append(PATH_SEPARATOR);
|
||||||
stringWriter.append(EntityPath.ENTITY_PATH_PART);
|
stringWriter.append(EntityPath.ENTITY_PATH_PART);
|
||||||
|
@ -421,7 +440,9 @@ public class ResourceRegistryPublisherImpl implements ResourceRegistryPublisher
|
||||||
|
|
||||||
ResourceRegistryCall<Boolean> call = new ResourceRegistryCall<>(Boolean.class, httpInputs);
|
ResourceRegistryCall<Boolean> call = new ResourceRegistryCall<>(Boolean.class, httpInputs);
|
||||||
|
|
||||||
return delegate.make(call);
|
boolean deleted = delegate.make(call);
|
||||||
|
logger.info("{} {}", consistsOf, deleted?" successfully deleted": "was NOT deleted");
|
||||||
|
return deleted;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("Error Removing {}", consistsOf, e);
|
logger.error("Error Removing {}", consistsOf, e);
|
||||||
throw new ServiceException(e);
|
throw new ServiceException(e);
|
||||||
|
@ -433,6 +454,7 @@ public class ResourceRegistryPublisherImpl implements ResourceRegistryPublisher
|
||||||
Class<I> isRelatedToClass, I isRelatedTo) {
|
Class<I> isRelatedToClass, I isRelatedTo) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
logger.info("Going to create: {}", isRelatedTo);
|
||||||
StringWriter stringWriter = new StringWriter();
|
StringWriter stringWriter = new StringWriter();
|
||||||
stringWriter.append(PATH_SEPARATOR);
|
stringWriter.append(PATH_SEPARATOR);
|
||||||
stringWriter.append(EntityPath.ENTITY_PATH_PART);
|
stringWriter.append(EntityPath.ENTITY_PATH_PART);
|
||||||
|
@ -456,7 +478,9 @@ public class ResourceRegistryPublisherImpl implements ResourceRegistryPublisher
|
||||||
ResourceRegistryCall<I> call = new ResourceRegistryCall<>(
|
ResourceRegistryCall<I> call = new ResourceRegistryCall<>(
|
||||||
isRelatedToClass, httpInputs);
|
isRelatedToClass, httpInputs);
|
||||||
|
|
||||||
return delegate.make(call);
|
I i = delegate.make(call);
|
||||||
|
logger.info("{} successfully created", i);
|
||||||
|
return i;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("Error Creating Facet", e);
|
logger.error("Error Creating Facet", e);
|
||||||
throw new ServiceException(e);
|
throw new ServiceException(e);
|
||||||
|
@ -466,6 +490,7 @@ public class ResourceRegistryPublisherImpl implements ResourceRegistryPublisher
|
||||||
@Override
|
@Override
|
||||||
public <I extends IsRelatedTo<? extends Resource, ? extends Resource>> boolean deleteIsRelatedTo(I isRelatedTo) {
|
public <I extends IsRelatedTo<? extends Resource, ? extends Resource>> boolean deleteIsRelatedTo(I isRelatedTo) {
|
||||||
try {
|
try {
|
||||||
|
logger.info("Going to delete: {}", isRelatedTo);
|
||||||
StringWriter stringWriter = new StringWriter();
|
StringWriter stringWriter = new StringWriter();
|
||||||
stringWriter.append(PATH_SEPARATOR);
|
stringWriter.append(PATH_SEPARATOR);
|
||||||
stringWriter.append(EntityPath.ENTITY_PATH_PART);
|
stringWriter.append(EntityPath.ENTITY_PATH_PART);
|
||||||
|
@ -478,7 +503,9 @@ public class ResourceRegistryPublisherImpl implements ResourceRegistryPublisher
|
||||||
|
|
||||||
ResourceRegistryCall<Boolean> call = new ResourceRegistryCall<>(Boolean.class, httpInputs);
|
ResourceRegistryCall<Boolean> call = new ResourceRegistryCall<>(Boolean.class, httpInputs);
|
||||||
|
|
||||||
return delegate.make(call);
|
boolean deleted = delegate.make(call);
|
||||||
|
logger.info("{} {}", isRelatedTo, deleted?" successfully deleted": "was NOT deleted");
|
||||||
|
return deleted;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("Error Removing {}", isRelatedTo, e);
|
logger.error("Error Removing {}", isRelatedTo, e);
|
||||||
throw new ServiceException(e);
|
throw new ServiceException(e);
|
||||||
|
|
|
@ -14,7 +14,6 @@ import org.gcube.informationsystem.impl.entity.resource.EServiceImpl;
|
||||||
import org.gcube.informationsystem.impl.entity.resource.HostingNodeImpl;
|
import org.gcube.informationsystem.impl.entity.resource.HostingNodeImpl;
|
||||||
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.Entities;
|
|
||||||
import org.gcube.informationsystem.model.entity.Facet;
|
import org.gcube.informationsystem.model.entity.Facet;
|
||||||
import org.gcube.informationsystem.model.entity.Resource;
|
import org.gcube.informationsystem.model.entity.Resource;
|
||||||
import org.gcube.informationsystem.model.entity.facet.CPUFacet;
|
import org.gcube.informationsystem.model.entity.facet.CPUFacet;
|
||||||
|
@ -56,9 +55,7 @@ public class EntityManagementTest {
|
||||||
cpuFacet.setModel("Opteron");
|
cpuFacet.setModel("Opteron");
|
||||||
cpuFacet.setVendor("AMD");
|
cpuFacet.setVendor("AMD");
|
||||||
|
|
||||||
logger.debug("Going to create: {}", cpuFacet);
|
|
||||||
CPUFacet createdCpuFacet = resourceRegistryPublisher.createFacet(CPUFacet.class, cpuFacet);
|
CPUFacet createdCpuFacet = resourceRegistryPublisher.createFacet(CPUFacet.class, cpuFacet);
|
||||||
logger.debug("Created: {}", createdCpuFacet);
|
|
||||||
|
|
||||||
Assert.assertTrue(cpuFacet.getClockSpeed().compareTo(createdCpuFacet.getClockSpeed())==0);
|
Assert.assertTrue(cpuFacet.getClockSpeed().compareTo(createdCpuFacet.getClockSpeed())==0);
|
||||||
Assert.assertTrue(cpuFacet.getModel().compareTo(createdCpuFacet.getModel())==0);
|
Assert.assertTrue(cpuFacet.getModel().compareTo(createdCpuFacet.getModel())==0);
|
||||||
|
@ -75,9 +72,7 @@ public class EntityManagementTest {
|
||||||
String additionPropertyValue = "Test";
|
String additionPropertyValue = "Test";
|
||||||
createdCpuFacet.setAdditionalProperty(additionPropertyKey, additionPropertyValue);
|
createdCpuFacet.setAdditionalProperty(additionPropertyKey, additionPropertyValue);
|
||||||
|
|
||||||
logger.debug("Going to update: {}", cpuFacet);
|
|
||||||
CPUFacet updatedCpuFacet = resourceRegistryPublisher.updateFacet(CPUFacet.class, createdCpuFacet);
|
CPUFacet updatedCpuFacet = resourceRegistryPublisher.updateFacet(CPUFacet.class, createdCpuFacet);
|
||||||
logger.debug("Updated: {}", updatedCpuFacet);
|
|
||||||
Assert.assertTrue(createdCpuFacet.getClockSpeed().compareTo(updatedCpuFacet.getClockSpeed())==0);
|
Assert.assertTrue(createdCpuFacet.getClockSpeed().compareTo(updatedCpuFacet.getClockSpeed())==0);
|
||||||
Assert.assertTrue(createdCpuFacet.getModel().compareTo(updatedCpuFacet.getModel())==0);
|
Assert.assertTrue(createdCpuFacet.getModel().compareTo(updatedCpuFacet.getModel())==0);
|
||||||
Assert.assertTrue(createdCpuFacet.getVendor().compareTo(updatedCpuFacet.getVendor())==0);
|
Assert.assertTrue(createdCpuFacet.getVendor().compareTo(updatedCpuFacet.getVendor())==0);
|
||||||
|
@ -86,7 +81,6 @@ public class EntityManagementTest {
|
||||||
|
|
||||||
boolean deleted = resourceRegistryPublisher.deleteFacet(updatedCpuFacet);
|
boolean deleted = resourceRegistryPublisher.deleteFacet(updatedCpuFacet);
|
||||||
Assert.assertTrue(deleted);
|
Assert.assertTrue(deleted);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -102,11 +96,8 @@ public class EntityManagementTest {
|
||||||
IsIdentifiedBy<EService, SoftwareFacet> isIdentifiedByESSF = new IsIdentifiedByImpl<>(eService, softwareFacet, null);
|
IsIdentifiedBy<EService, SoftwareFacet> isIdentifiedByESSF = new IsIdentifiedByImpl<>(eService, softwareFacet, null);
|
||||||
eService.addFacet(isIdentifiedByESSF);
|
eService.addFacet(isIdentifiedByESSF);
|
||||||
|
|
||||||
Entities.registerSubtypes(IsIdentifiedBy.class, SoftwareFacet.class, EService.class, HostingNode.class, NetworkingFacet.class, CPUFacet.class);
|
|
||||||
|
|
||||||
logger.debug("Going to create : {}", eService);
|
|
||||||
EService createdEService = resourceRegistryPublisher.createResource(EService.class, eService);
|
EService createdEService = resourceRegistryPublisher.createResource(EService.class, eService);
|
||||||
logger.debug("Created : {}", createdEService);
|
|
||||||
List<? extends Facet> idenficationFacets = createdEService.getIdentificationFacets();
|
List<? extends Facet> idenficationFacets = createdEService.getIdentificationFacets();
|
||||||
Assert.assertTrue(idenficationFacets!=null);
|
Assert.assertTrue(idenficationFacets!=null);
|
||||||
Assert.assertTrue(idenficationFacets.size()==1);
|
Assert.assertTrue(idenficationFacets.size()==1);
|
||||||
|
@ -124,10 +115,7 @@ public class EntityManagementTest {
|
||||||
networkingFacet.setMask("255.255.248.0");
|
networkingFacet.setMask("255.255.248.0");
|
||||||
networkingFacet.setBroadcastAddress("146.48.87.255");
|
networkingFacet.setBroadcastAddress("146.48.87.255");
|
||||||
|
|
||||||
logger.debug("Going to create : {}", networkingFacet);
|
|
||||||
NetworkingFacet createdNetworkingFacet = resourceRegistryPublisher.createFacet(NetworkingFacet.class, networkingFacet);
|
NetworkingFacet createdNetworkingFacet = resourceRegistryPublisher.createFacet(NetworkingFacet.class, networkingFacet);
|
||||||
logger.debug("Created : {}", createdNetworkingFacet);
|
|
||||||
|
|
||||||
|
|
||||||
HostingNode hostingNode = new HostingNodeImpl();
|
HostingNode hostingNode = new HostingNodeImpl();
|
||||||
|
|
||||||
|
@ -145,10 +133,7 @@ public class EntityManagementTest {
|
||||||
|
|
||||||
hostingNode.attachResource(hosts);
|
hostingNode.attachResource(hosts);
|
||||||
|
|
||||||
|
|
||||||
logger.debug("Going to create : {}", hostingNode);
|
|
||||||
HostingNode createdHostingNode = resourceRegistryPublisher.createResource(HostingNode.class, hostingNode);
|
HostingNode createdHostingNode = resourceRegistryPublisher.createResource(HostingNode.class, hostingNode);
|
||||||
logger.debug("Created : {}", createdHostingNode);
|
|
||||||
|
|
||||||
List<ConsistsOf<? extends Resource, ? extends Facet>> consistsOfList = createdHostingNode.getConsistsOf();
|
List<ConsistsOf<? extends Resource, ? extends Facet>> consistsOfList = createdHostingNode.getConsistsOf();
|
||||||
CPUFacet createdCPUFacet = null;
|
CPUFacet createdCPUFacet = null;
|
||||||
|
@ -159,28 +144,23 @@ public class EntityManagementTest {
|
||||||
|
|
||||||
}
|
}
|
||||||
Assert.assertTrue(createdCPUFacet!=null);
|
Assert.assertTrue(createdCPUFacet!=null);
|
||||||
logger.debug("Created : {}", createdCPUFacet);
|
logger.info("Created : {}", createdCPUFacet);
|
||||||
|
|
||||||
|
|
||||||
logger.debug("Going to delete : {}", createdHostingNode);
|
|
||||||
boolean deleted = resourceRegistryPublisher.deleteResource(createdHostingNode);
|
boolean deleted = resourceRegistryPublisher.deleteResource(createdHostingNode);
|
||||||
Assert.assertTrue(deleted);
|
Assert.assertTrue(deleted);
|
||||||
|
|
||||||
logger.debug("Going to delete : {}", createdCPUFacet);
|
|
||||||
deleted = resourceRegistryPublisher.deleteFacet(createdCPUFacet);
|
deleted = resourceRegistryPublisher.deleteFacet(createdCPUFacet);
|
||||||
Assert.assertTrue(deleted);
|
Assert.assertTrue(deleted);
|
||||||
|
|
||||||
logger.debug("Going to delete : {}", createdNetworkingFacet);
|
|
||||||
deleted = resourceRegistryPublisher.deleteFacet(createdNetworkingFacet);
|
deleted = resourceRegistryPublisher.deleteFacet(createdNetworkingFacet);
|
||||||
Assert.assertTrue(deleted);
|
Assert.assertTrue(deleted);
|
||||||
|
|
||||||
|
|
||||||
logger.debug("Going to delete : {}", createdSoftwareFacet);
|
|
||||||
deleted = resourceRegistryPublisher.deleteFacet(createdSoftwareFacet);
|
deleted = resourceRegistryPublisher.deleteFacet(createdSoftwareFacet);
|
||||||
Assert.assertTrue(deleted);
|
Assert.assertTrue(deleted);
|
||||||
|
|
||||||
|
|
||||||
logger.debug("Going to delete : {}", createdEService);
|
|
||||||
deleted = resourceRegistryPublisher.deleteResource(createdEService);
|
deleted = resourceRegistryPublisher.deleteResource(createdEService);
|
||||||
Assert.assertTrue(deleted);
|
Assert.assertTrue(deleted);
|
||||||
|
|
||||||
|
@ -198,19 +178,10 @@ public class EntityManagementTest {
|
||||||
IsIdentifiedBy<Resource, Facet> isIdentifiedBy = new IsIdentifiedByImpl<Resource, Facet>(eService, softwareFacet, null);
|
IsIdentifiedBy<Resource, Facet> isIdentifiedBy = new IsIdentifiedByImpl<Resource, Facet>(eService, softwareFacet, null);
|
||||||
eService.addFacet(isIdentifiedBy);
|
eService.addFacet(isIdentifiedBy);
|
||||||
|
|
||||||
Entities.registerSubtypes(IsIdentifiedBy.class, SoftwareFacet.class, EService.class);
|
|
||||||
|
|
||||||
|
|
||||||
logger.debug("Going to create : {}", eService);
|
|
||||||
EService createdEService = resourceRegistryPublisher.createResource(EService.class, eService);
|
EService createdEService = resourceRegistryPublisher.createResource(EService.class, eService);
|
||||||
logger.debug("Created : {}", createdEService);
|
|
||||||
|
|
||||||
|
|
||||||
HostingNode hostingNode = new HostingNodeImpl();
|
HostingNode hostingNode = new HostingNodeImpl();
|
||||||
|
|
||||||
logger.debug("Going to create : {}", hostingNode);
|
|
||||||
HostingNode createdHostingNode = resourceRegistryPublisher.createResource(HostingNode.class, hostingNode);
|
HostingNode createdHostingNode = resourceRegistryPublisher.createResource(HostingNode.class, hostingNode);
|
||||||
logger.debug("Created : {}", createdHostingNode);
|
|
||||||
|
|
||||||
|
|
||||||
CPUFacet cpuFacet = new CPUFacetImpl();
|
CPUFacet cpuFacet = new CPUFacetImpl();
|
||||||
|
@ -218,44 +189,30 @@ public class EntityManagementTest {
|
||||||
cpuFacet.setModel("Opteron");
|
cpuFacet.setModel("Opteron");
|
||||||
cpuFacet.setVendor("AMD");
|
cpuFacet.setVendor("AMD");
|
||||||
|
|
||||||
|
|
||||||
Entities.registerSubtypes(HostingNode.class, CPUFacet.class);
|
|
||||||
|
|
||||||
|
|
||||||
logger.debug("Going to create: {}", cpuFacet);
|
|
||||||
CPUFacet createdCpuFacet = resourceRegistryPublisher.createFacet(CPUFacet.class, cpuFacet);
|
CPUFacet createdCpuFacet = resourceRegistryPublisher.createFacet(CPUFacet.class, cpuFacet);
|
||||||
logger.debug("Created: {}", createdCpuFacet);
|
|
||||||
|
|
||||||
|
|
||||||
IsIdentifiedBy<HostingNode, CPUFacet> isIdentifiedByCPUFacet = new IsIdentifiedByImpl<>(createdHostingNode, createdCpuFacet, null);
|
IsIdentifiedBy<HostingNode, CPUFacet> isIdentifiedByCPUFacet = new IsIdentifiedByImpl<>(createdHostingNode, createdCpuFacet, null);
|
||||||
logger.debug("Going to create : {}", isIdentifiedByCPUFacet);
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
IsIdentifiedBy<HostingNode, CPUFacet> createdIsIdentifiedByCPUFacet = resourceRegistryPublisher.createConsistsOf(IsIdentifiedBy.class, isIdentifiedByCPUFacet);
|
IsIdentifiedBy<HostingNode, CPUFacet> createdIsIdentifiedByCPUFacet = resourceRegistryPublisher.createConsistsOf(IsIdentifiedBy.class, isIdentifiedByCPUFacet);
|
||||||
logger.debug("Created : {}", createdIsIdentifiedByCPUFacet);
|
|
||||||
|
|
||||||
Hosts<HostingNode, EService> hosts = new HostsImpl<>(createdHostingNode, createdEService, null);
|
Hosts<HostingNode, EService> hosts = new HostsImpl<>(createdHostingNode, createdEService, null);
|
||||||
logger.debug("Going to create : {}", hosts);
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
Hosts<HostingNode, EService> createdHosts = resourceRegistryPublisher.createIsRelatedTo(Hosts.class, hosts);
|
Hosts<HostingNode, EService> createdHosts = resourceRegistryPublisher.createIsRelatedTo(Hosts.class, hosts);
|
||||||
logger.debug("Created : {}", createdHosts);
|
|
||||||
|
|
||||||
|
|
||||||
logger.debug("Going to delete : {}", createdIsIdentifiedByCPUFacet);
|
|
||||||
boolean deleted = resourceRegistryPublisher.deleteConsistsOf(createdIsIdentifiedByCPUFacet);
|
boolean deleted = resourceRegistryPublisher.deleteConsistsOf(createdIsIdentifiedByCPUFacet);
|
||||||
Assert.assertTrue(deleted);
|
Assert.assertTrue(deleted);
|
||||||
|
|
||||||
|
|
||||||
logger.debug("Going to delete : {}", createdCpuFacet);
|
|
||||||
deleted = resourceRegistryPublisher.deleteFacet(createdCpuFacet);
|
deleted = resourceRegistryPublisher.deleteFacet(createdCpuFacet);
|
||||||
Assert.assertTrue(deleted);
|
Assert.assertTrue(deleted);
|
||||||
|
|
||||||
|
|
||||||
logger.debug("Going to delete : {}", createdHosts);
|
|
||||||
deleted = resourceRegistryPublisher.deleteIsRelatedTo(createdHosts);
|
deleted = resourceRegistryPublisher.deleteIsRelatedTo(createdHosts);
|
||||||
Assert.assertTrue(deleted);
|
Assert.assertTrue(deleted);
|
||||||
|
|
||||||
|
|
||||||
logger.debug("Going to delete : {}", createdHostingNode);
|
|
||||||
deleted = resourceRegistryPublisher.deleteResource(createdHostingNode);
|
deleted = resourceRegistryPublisher.deleteResource(createdHostingNode);
|
||||||
Assert.assertTrue(deleted);
|
Assert.assertTrue(deleted);
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,8 @@
|
||||||
</appender>
|
</appender>
|
||||||
|
|
||||||
|
|
||||||
<logger name="org.gcube" level="TRACE" />
|
<logger name="org.gcube" level="INFO" />
|
||||||
|
<logger name="org.gcube.informationsystem" level="INFO" />
|
||||||
|
|
||||||
<root level="WARN">
|
<root level="WARN">
|
||||||
<appender-ref ref="STDOUT" />
|
<appender-ref ref="STDOUT" />
|
||||||
|
|
Loading…
Reference in New Issue