KeytabOverlay extends AbstractContainerOverlay { @Override public void configure(ContainerSpecification container) throws IOException { if(keytab != null) { container.getArtifacts().add(ContainerSpecification.Artifact.newBuilder() .setSource(keytab) .setDest(TARGET_PATH) .setCachable(false) .build()); container.getDynamicConfiguration().setString(SecurityOptions.KERBEROS_LOGIN_KEYTAB, TARGET_PATH.getPath()); } } KeytabOverlay(@Nullable File keytab);  KeytabOverlay(@Nullable Path keytab); @Override void configure(ContainerSpecification container); static Builder newBuilder();  }
@Test public void testConfigure() throws Exception { File keytab = tempFolder.newFile(); KeytabOverlay overlay = new KeytabOverlay(keytab); ContainerSpecification spec = new ContainerSpecification(); overlay.configure(spec); assertEquals(TARGET_PATH.getPath(), spec.getDynamicConfiguration().getString(SecurityOptions.KERBEROS_LOGIN_KEYTAB)); checkArtifact(spec, TARGET_PATH); }
@Test public void testNoConf() throws Exception { KeytabOverlay overlay = new KeytabOverlay((Path) null); ContainerSpecification containerSpecification = new ContainerSpecification(); overlay.configure(containerSpecification); }