VufsServiceImpl implements IVufsService { @Override public boolean addMetafileAsChildToParent(Metafile childMetafile, String parentMetafileUuid) { boolean isAdded = false; if (currentMetatable.addMetafile(childMetafile)) { for (Metafile metafile : currentMetatable.getMetafileSet()) { if (metafile.getFileUuid().equalsIgnoreCase(parentMetafileUuid)) { isAdded = metafile.addChildFileUUid(childMetafile.getFileUuid()); } } } if (isAdded) { childMetafile.setParentFileUuid(parentMetafileUuid); return true; } return false; } @Autowired  VufsServiceImpl(IProfile profile,
            MetatableTransformer metatableTransformer,
            IMetatableService persistingService); @Override Metafile createEmptyMetafile(); @Override Metafile getMetafileByUuid(String fileUuid); @Override Metafile addBlockByUuidToMetafile(String blockUuid, Metafile metafile); @Override Metafile removeBlockByUuidFromMetafile(String blockUuid, Metafile metafile); @Override boolean addMetafileToMetatable(Metafile metafile); @Override boolean removeMetafileFromMetatable(Metafile metafile); @Override Set<String> getAllocationByBlockUuid(String blockUuid); @Override void setAllocationForBlockByUuid(String blockUuid, Set<String> allocationSet); @Override boolean addMetafileAsChildToParent(Metafile childMetafile,
            String parentMetafileUuid); @Override boolean removeMetafileFromParent(String childMetafileUuid,
            String parentMetafileUuid); @Override AllocationStrategy getAllocationStrategyByMetafileUuid(String metafileUuid); @Override void setAllocationStrategyByMetafileUuid(String metafileUuid,
            AllocationStrategy allocationStrategy); @PreDestroy void persistChanges();  }
@Test public void addMetafileAsChildToParent() { Metafile parentMetafile = vufsService.createEmptyMetafile(); String parentMetafileUuid = parentMetafile.getFileUuid(); Metafile childMetafile = vufsService.createEmptyMetafile(); String childMetafileUuid = childMetafile.getFileUuid(); assertEquals(parentMetafile.getChildFileUuidSet().size(), 0); assertEquals(childMetafile.getChildFileUuidSet().size(), 0); vufsService.addMetafileToMetatable(parentMetafile); boolean isAdded = vufsService.addMetafileAsChildToParent(childMetafile, parentMetafileUuid); assertTrue(isAdded); assertEquals(parentMetafile.getChildFileUuidSet().size(), 1); assertTrue(parentMetafile.getChildFileUuidSet().contains(childMetafileUuid)); }