Added tests for the convenient method introduced Resource in IS model
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/information-system/resource-registry@146678 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
8a985b16f3
commit
20359dd47b
|
@ -319,7 +319,7 @@ public class ERManagementTest extends ScopedTest {
|
|||
|
||||
isIdentifiedBy = new IsIdentifiedByImpl<Resource, Facet>(hostingNode,
|
||||
networkingFacet, null);
|
||||
hostingNode.attachFacet(isIdentifiedBy);
|
||||
hostingNode.addFacet(isIdentifiedBy);
|
||||
|
||||
|
||||
PropagationConstraint propagationConstraint = new PropagationConstraintImpl();
|
||||
|
|
|
@ -238,6 +238,42 @@ public class SmartgearResourcesTest extends ScopedTest {
|
|||
HostingNode hostingNodeToUpdate = ISMapper.unmarshal(HostingNode.class,
|
||||
json);
|
||||
|
||||
|
||||
/* Testing convenient methods */
|
||||
@SuppressWarnings("unchecked")
|
||||
List<ConsistsOf<? extends Resource, ? extends Facet>> hasVolatileMemoryList = hostingNodeToUpdate.getConsistsOf(HasVolatileMemory.class);
|
||||
Assert.assertTrue(hasVolatileMemoryList.size()==2);
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
List<ConsistsOf<? extends Resource, ? extends Facet>> hasPeristentMemoryList = hostingNodeToUpdate.getConsistsOf(HasPersistentMemory.class);
|
||||
Assert.assertTrue(hasPeristentMemoryList.size()==1);
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
List<ConsistsOf<? extends Resource, MemoryFacet>> memoryList = hostingNodeToUpdate.getConsistsOf(ConsistsOf.class, MemoryFacet.class);
|
||||
Assert.assertTrue(memoryList.size()==3);
|
||||
|
||||
List<ContainerStateFacet> csfList = hostingNodeToUpdate.getFacets(ContainerStateFacet.class);
|
||||
Assert.assertTrue(csfList.size()==1);
|
||||
|
||||
List<SimplePropertyFacet> spfList = hostingNodeToUpdate.getFacets(SimplePropertyFacet.class);
|
||||
Assert.assertTrue(spfList.size()==1);
|
||||
|
||||
List<SoftwareFacet> sfList = hostingNodeToUpdate.getFacets(SoftwareFacet.class);
|
||||
Assert.assertTrue(sfList.size()==1);
|
||||
|
||||
List<CPUFacet> cfList = hostingNodeToUpdate.getFacets(CPUFacet.class);
|
||||
Assert.assertTrue(cfList.size()==4);
|
||||
|
||||
List<NetworkingFacet> nfList = hostingNodeToUpdate.getFacets(NetworkingFacet.class);
|
||||
Assert.assertTrue(nfList.size()==1);
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
List<IsIdentifiedBy<? extends Resource, MemoryFacet>> isbnfList = hostingNodeToUpdate.getConsistsOf(IsIdentifiedBy.class, NetworkingFacet.class);
|
||||
Assert.assertTrue(isbnfList.size()==1);
|
||||
|
||||
/* Testing convenient methods */
|
||||
|
||||
|
||||
List<ConsistsOf<? extends Resource, ? extends Facet>> consistsOfToRemove = new ArrayList<>();
|
||||
|
||||
List<ConsistsOf<? extends Resource, ? extends Facet>> consistsOfList = hostingNodeToUpdate
|
||||
|
|
Loading…
Reference in New Issue