NetworkPacketTaggingHandlerImpl implements ResourceHandler { @Override public List<PrivilegedOperation> bootstrap(Configuration configuration) throws ResourceHandlerException { conf = configuration; cGroupsHandler .initializeCGroupController(CGroupsHandler.CGroupController.NET_CLS); this.tagMappingManager = createNetworkTagMappingManager(conf); this.tagMappingManager.initialize(conf); return null; } NetworkPacketTaggingHandlerImpl(
      PrivilegedOperationExecutor privilegedOperationExecutor,
      CGroupsHandler cGroupsHandler); @Override List<PrivilegedOperation> bootstrap(Configuration configuration); @Override List<PrivilegedOperation> preStart(Container container); @Override List<PrivilegedOperation> reacquireContainer(ContainerId containerId); @Override List<PrivilegedOperation> updateContainer(Container container); @Override List<PrivilegedOperation> postComplete(ContainerId containerId); @Override List<PrivilegedOperation> teardown(); @Private @VisibleForTesting NetworkTagMappingManager createNetworkTagMappingManager(
      Configuration conf); @Override String toString();  }
@Test public void testBootstrap() { NetworkPacketTaggingHandlerImpl handlerImpl = createNetworkPacketTaggingHandlerImpl(); try { handlerImpl.bootstrap(conf); verify(cGroupsHandlerMock).initializeCGroupController( eq(CGroupsHandler.CGroupController.NET_CLS)); verifyNoMoreInteractions(cGroupsHandlerMock); } catch (ResourceHandlerException e) { LOG.error("Unexpected exception: " + e); Assert.fail("Caught unexpected ResourceHandlerException!"); } }
@Test public void testLifeCycle() { NetworkPacketTaggingHandlerImpl handlerImpl = createNetworkPacketTaggingHandlerImpl(); try { handlerImpl.bootstrap(conf); testPreStart(handlerImpl); testPostComplete(handlerImpl); } catch (ResourceHandlerException e) { LOG.error("Unexpected exception: " + e); Assert.fail("Caught unexpected ResourceHandlerException!"); } }