VufsServiceImpl implements IVufsService { @Override public void setAllocationStrategyByMetafileUuid(String metafileUuid, AllocationStrategy allocationStrategy) throws MetafileDoesNotExistException { Metafile requestedMetafile = null; for (Metafile metafile : currentMetatable.getMetafileSet()) { if (metafile.getFileUuid().equalsIgnoreCase(metafileUuid)) { requestedMetafile = metafile; break; } } if (requestedMetafile != null) { requestedMetafile.setAllocationStrategy(allocationStrategy); } else { throw new MetafileDoesNotExistException(getExceptionInfo(currentMetatable, metafileUuid, "setAllocationStrategyByMetafileUuid")); } } @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 setAllocationStrategyByMetafileUuid() throws MetafileDoesNotExistException { Metafile newMetafile = vufsService.createEmptyMetafile(); newMetafile.setAllocationStrategy(AllocationStrategy.UNION); String metafileUUid = newMetafile.getFileUuid(); vufsService.addMetafileToMetatable(newMetafile); vufsService.setAllocationStrategyByMetafileUuid(metafileUUid, AllocationStrategy.HA); Metafile changedMetafile = vufsService.getMetafileByUuid(metafileUUid); assertEquals(AllocationStrategy.HA, changedMetafile.getAllocationStrategy()); }
@Test(expected = MetafileDoesNotExistException.class) public void setAllocationStrategyByMetafileUuidWithException() throws MetafileDoesNotExistException { vufsService.setAllocationStrategyByMetafileUuid(UUID.randomUUID().toString(), AllocationStrategy.HA); }