@Test public void installContainerWithDownload() throws Exception { Project project = initializeJavaProject(); MavenCoreFacet coreFacet = project.getFacet(MavenCoreFacet.class); List<Profile> profiles = coreFacet.getPOM().getProfiles(); for (Profile profile : profiles) { System.out.println(profile.getId()); } assertThat(profiles.size(), is(0)); queueInputLines("JBOSS_AS_MANAGED_4.2.X", "", "19", "10", "", "", "", "", "y", ""); getShell().execute("arquillian setup"); assertThat(coreFacet.getPOM().getProfiles().size(), is(1)); Profile profile = coreFacet.getPOM().getProfiles().get(0); assertThat( profile.getDependencies(), hasItems( new DependencyMatcher("arquillian-jbossas-managed-4.2"), new DependencyMatcher("jboss-server-manager"), new DependencyMatcher("dom4j"), new DependencyMatcher("jbossall-client"))); assertThat(profile.getBuild().getPlugins().size(), is(1)); assertThat( profile.getBuild().getPlugins().get(0).getArtifactId(), is("maven-dependency-plugin")); }
/** * Adds information about defined profile. * * @param pomDescriptor The descriptor for the current POM. * @param model The Maven Model. * @param scannerContext The scanner context. */ private void addProfiles( MavenPomDescriptor pomDescriptor, Model model, ScannerContext scannerContext) { List<Profile> profiles = model.getProfiles(); Store store = scannerContext.getStore(); for (Profile profile : profiles) { MavenProfileDescriptor mavenProfileDescriptor = store.create(MavenProfileDescriptor.class); pomDescriptor.getProfiles().add(mavenProfileDescriptor); mavenProfileDescriptor.setId(profile.getId()); addProperties(mavenProfileDescriptor, profile.getProperties(), store); addModules(mavenProfileDescriptor, profile.getModules(), store); addPlugins(mavenProfileDescriptor, profile.getBuild(), scannerContext); addManagedPlugins(mavenProfileDescriptor, profile.getBuild(), scannerContext); addManagedDependencies( mavenProfileDescriptor, profile.getDependencyManagement(), scannerContext, ProfileManagesDependencyDescriptor.class); addProfileDependencies(mavenProfileDescriptor, profile.getDependencies(), scannerContext); addActivation(mavenProfileDescriptor, profile.getActivation(), store); } }
@Test public void testSetupCommand() throws Exception { Project project = initializeJavaProject(); getShell().execute("jacoco setup"); MavenCoreFacet facet = project.getFacet(MavenCoreFacet.class); Model pom = facet.getPOM(); Profile jacocoProfile = pom.getProfiles().get(0); assertEquals("jacoco", jacocoProfile.getId()); Plugin jacocoPlugin = jacocoProfile.getBuild().getPlugins().get(0); assertEquals("jacoco-maven-plugin", jacocoPlugin.getArtifactId()); PluginExecution exec = jacocoPlugin.getExecutions().get(0); assertEquals("prepare-agent", exec.getGoals().get(0)); }