@Override public <T> T doAs(NamespacedEntityId entityId, final Callable<T> callable) throws Exception { return doAs(entityId, callable, ImpersonatedOpType.OTHER); }
@Override public UserGroupInformation getUGI(NamespacedEntityId entityId) throws IOException { return getUGI(entityId, ImpersonatedOpType.OTHER); }
private void writeArtifact(Id.Artifact artifactId, ArtifactMeta meta, String contents) throws ArtifactAlreadyExistsException, IOException, WriteConflictException { File artifactFile = TEMP_FOLDER.newFile(); Files.write(artifactFile.toPath(), Bytes.toBytes(contents)); artifactStore.write(artifactId, meta, artifactFile, new EntityImpersonator(artifactId.toEntityId(), new DefaultImpersonator(CConfiguration.create(), null))); } }
@Test(expected = InvalidArtifactException.class) public void testInvalidConfigApp() throws Exception { Manifest manifest = new Manifest(); File appFile = createJar(InvalidConfigApp.class, new File(TMP_FOLDER.newFolder(), "InvalidConfigApp-1.0.0.jar"), manifest); Id.Artifact artifactId = Id.Artifact.from(Id.Namespace.DEFAULT, "InvalidConfigApp", "1.0.0"); Location artifactLocation = Locations.toLocation(appFile); try (CloseableClassLoader artifactClassLoader = classLoaderFactory.createClassLoader( ImmutableList.of(artifactLocation).iterator(), new EntityImpersonator(artifactId.toEntityId(), new DefaultImpersonator(CConfiguration.create(), null)))) { artifactInspector.inspectArtifact(artifactId, appFile, artifactClassLoader); } }
classLoaderFactory.createClassLoader( ImmutableList.of(artifactLocation).iterator(), new EntityImpersonator(artifactId.toEntityId(), new DefaultImpersonator(CConfiguration.create(), null)))) {
@Override public <T> T doAs(NamespacedEntityId entityId, Callable<T> callable, ImpersonatedOpType impersonatedOpType) throws Exception { UserGroupInformation ugi = getUGI(entityId, impersonatedOpType); if (!UserGroupInformation.getCurrentUser().equals(ugi)) { LOG.debug("Performing doAs with UGI {} for entity {} and impersonation operation type {}", ugi, entityId, impersonatedOpType); } return ImpersonationUtils.doAs(ugi, callable); }
ArtifactRepository baseArtifactRepo = new DefaultArtifactRepository(conf, null, null, new DummyProgramRunnerFactory(), new DefaultImpersonator(cConf, null)); ArtifactRepository artifactRepo = new AuthorizationArtifactRepository(baseArtifactRepo, authEnforcer, authenticationContext); artifactRepo.createArtifactClassLoader( appJar, new EntityImpersonator(artifactId.getNamespace().toEntityId(), new DefaultImpersonator(cConf, null)))) { Configurator configuratorWithConfig = new InMemoryConfigurator(conf, Id.Namespace.DEFAULT, artifactId, ConfigTestApp.class.getName(),
Impersonator impersonator = new DefaultImpersonator(cConf, null); DatasetAdminService datasetAdminService = new DatasetAdminService(dsFramework, cConf, locationFactory, datasetInstantiatorFactory, impersonator);
ArtifactRepository baseArtifactRepo = new DefaultArtifactRepository(conf, null, null, new DummyProgramRunnerFactory(), new DefaultImpersonator(cConf, null)); ArtifactRepository artifactRepo = new AuthorizationArtifactRepository(baseArtifactRepo, authEnforcer, authenticationContext); artifactRepo.createArtifactClassLoader( appJar, new EntityImpersonator(artifactId.getNamespace().toEntityId(), new DefaultImpersonator(cConf, null)))) { Configurator configurator = new InMemoryConfigurator(conf, Id.Namespace.DEFAULT, artifactId, AllProgramsApp.class.getName(), artifactRepo,
Impersonator impersonator = new DefaultImpersonator(cConf, null);