public static void deployApplication(Id.Namespace namespace, Class<?> applicationClz, @Nullable String config, CConfiguration cConf) throws Exception { deployApplication(namespace, applicationClz, config, null, cConf); }
private void setUpPrivilegesAndExpectFailedDeploy(Map<EntityId, Set<Action>> neededPrivileges) throws Exception { int count = 0; for (Map.Entry<EntityId, Set<Action>> privilege : neededPrivileges.entrySet()) { authorizer.grant(Authorizable.fromEntityId(privilege.getKey()), ALICE, privilege.getValue()); count++; if (count < neededPrivileges.size()) { try { AppFabricTestHelper.deployApplication(Id.Namespace.DEFAULT, AllProgramsApp.class, null, cConf); Assert.fail(); } catch (Exception e) { // expected } } } } }
@Test public void testPublishing() throws Exception { AppFabricTestHelper.deployApplication(Id.Namespace.DEFAULT, AllProgramsApp.class, null, cConf); Set<String> addedMetadata = new HashSet<>(); // TODO (CDAP-14670): this test is brittle, find a better condition to wait on Tasks.waitFor(26, () -> addAllSystemMetadata(addedMetadata), 10, TimeUnit.SECONDS); namespaceAdmin.delete(NamespaceId.DEFAULT); Set<String> removedMetadata = new HashSet<>(); // expect the same number of changes when namespace is deleted Tasks.waitFor(addedMetadata.size(), () -> addAllSystemMetadata(removedMetadata), 5, TimeUnit.SECONDS); // Assert that the exact same system properties and tags got added upon app deployment and removed upon deletion Assert.assertEquals(addedMetadata, removedMetadata); }
@BeforeClass public static void setup() throws Exception { CConfiguration cConf = CConfiguration.create(); cConf.set(Constants.INSTANCE_NAME, EXISTS); Injector injector = AppFabricTestHelper.getInjector(cConf); NamespaceStore nsStore = injector.getInstance(NamespaceStore.class); ArtifactRepository artifactRepository = injector.getInstance(ArtifactRepository.class); cConf = injector.getInstance(CConfiguration.class); nsStore.create(new NamespaceMeta.Builder().setName(EXISTS).build()); existenceVerifier = injector.getInstance(Key.get(new TypeLiteral<EntityExistenceVerifier<EntityId>>() { })); LocalLocationFactory lf = new LocalLocationFactory(TEMPORARY_FOLDER.newFolder()); File artifactFile = new File(AppJarHelper.createDeploymentJar(lf, AllProgramsApp.class).toURI()); artifactRepository.addArtifact(Id.Artifact.fromEntityId(ARTIFACT), artifactFile); AppFabricTestHelper.deployApplication(Id.Namespace.fromEntityId(NAMESPACE), AllProgramsApp.class, null, cConf); }
AppFabricTestHelper.deployApplication(Id.Namespace.DEFAULT, AllProgramsApp.class, null, cConf);
AppFabricTestHelper.deployApplication(Id.Namespace.DEFAULT, AllProgramsApp.class, null, cConf);
Collections.singleton(Action.EXECUTE)); AppFabricTestHelper.deployApplication(Id.Namespace.DEFAULT, AllProgramsApp.class, "{}", cConf);