@Test public void testUnmountsOnUndeploy() throws Exception { DescriptorRootMountProcessor deployer = new DescriptorRootMountProcessor( "foo" ); appendDeployer( deployer ); MockDeploymentPhaseContext phaseContext = createPhaseContext(); DeploymentUnit unit = phaseContext.getMockDeploymentUnit(); MountHandle mountHandle = mock( MountHandle.class ); ResourceRoot resourceRoot = new ResourceRoot( VFS.getChild( "." ), mountHandle ); unit.putAttachment( DescriptorRootMountProcessor.DESCRIPTOR_ROOT, resourceRoot ); undeploy( unit ); verify( mountHandle ).close(); }
@Override public void undeploy(DeploymentUnit context) { final ResourceRoot knobRoot = context.removeAttachment( DESCRIPTOR_ROOT ); if (knobRoot != null) { final MountHandle mountHandle = knobRoot.getMountHandle(); VFSUtils.safeClose( mountHandle ); } }
DescriptorRootMountProcessor implements DeploymentUnitProcessor { @Override public void undeploy(DeploymentUnit context) { final ResourceRoot knobRoot = context.removeAttachment( DESCRIPTOR_ROOT ); if (knobRoot != null) { final MountHandle mountHandle = knobRoot.getMountHandle(); VFSUtils.safeClose( mountHandle ); } } }
DescriptorRootMountProcessor implements DeploymentUnitProcessor { @Override public void undeploy(DeploymentUnit context) { final ResourceRoot knobRoot = context.removeAttachment( DESCRIPTOR_ROOT ); if (knobRoot != null) { final MountHandle mountHandle = knobRoot.getMountHandle(); VFSUtils.safeClose( mountHandle ); } } DescriptorRootMountProcessor(String fileSuffix); }
DescriptorRootMountProcessor implements DeploymentUnitProcessor { @Override public void undeploy(DeploymentUnit context) { final ResourceRoot knobRoot = context.removeAttachment( DESCRIPTOR_ROOT ); if (knobRoot != null) { final MountHandle mountHandle = knobRoot.getMountHandle(); VFSUtils.safeClose( mountHandle ); } } DescriptorRootMountProcessor(String fileSuffix); @Override void deploy(DeploymentPhaseContext phaseContext); @Override void undeploy(DeploymentUnit context); }
DescriptorRootMountProcessor implements DeploymentUnitProcessor { @Override public void undeploy(DeploymentUnit context) { final ResourceRoot knobRoot = context.removeAttachment( DESCRIPTOR_ROOT ); if (knobRoot != null) { final MountHandle mountHandle = knobRoot.getMountHandle(); VFSUtils.safeClose( mountHandle ); } } DescriptorRootMountProcessor(String fileSuffix); @Override void deploy(DeploymentPhaseContext phaseContext); @Override void undeploy(DeploymentUnit context); static final AttachmentKey<ResourceRoot> DESCRIPTOR_ROOT; }