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)))) {
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);