List of usage examples for org.eclipse.jdt.apt.core.internal.util FactoryContainer getType
public abstract FactoryType getType();
From source file:org.jboss.tools.maven.apt.tests.M2eAptProjectconfiguratorTest.java
License:Open Source License
private void defaultTest(String projectName, String expectedOutputFolder) throws Exception { IProject p = importProject("projects/" + projectName + "/pom.xml"); waitForJobsToComplete();//from w w w .j av a 2s.co m p.build(IncrementalProjectBuilder.FULL_BUILD, monitor); waitForJobsToComplete(); IJavaProject javaProject = JavaCore.create(p); assertNotNull(javaProject); assertTrue("Annotation processing is disabled for " + p, AptConfig.isEnabled(javaProject)); IFolder annotationsFolder = p.getFolder(expectedOutputFolder); assertTrue(annotationsFolder + " was not generated", annotationsFolder.exists()); FactoryPath factoryPath = (FactoryPath) AptConfig.getFactoryPath(javaProject); Iterator<FactoryContainer> ite = factoryPath.getEnabledContainers().keySet().iterator(); FactoryContainer jpaModelGen = ite.next(); assertEquals(FactoryContainer.FactoryType.VARJAR, jpaModelGen.getType()); assertEquals( "M2_REPO/org/hibernate/hibernate-jpamodelgen/1.1.1.Final/hibernate-jpamodelgen-1.1.1.Final.jar", jpaModelGen.getId()); FactoryContainer jpaApi = ite.next(); assertEquals(FactoryContainer.FactoryType.VARJAR, jpaApi.getType()); assertEquals( "M2_REPO/org/hibernate/javax/persistence/hibernate-jpa-2.0-api/1.0.0.Final/hibernate-jpa-2.0-api-1.0.0.Final.jar", jpaApi.getId()); /* There's an ugly bug in Tycho which makes JavaModelManager.getJavaModelManager().createAnnotationProcessorManager() return null as a consequence, no annotation processors are run during Tycho builds See http://dev.eclipse.org/mhonarc/lists/tycho-user/msg02344.html For the time being, only APT configuration can be tested, not APT build outcomes */ if (JavaModelManager.getJavaModelManager().createAnnotationProcessorManager() == null) { return; } IFile generatedFile = p.getFile(expectedOutputFolder + "/foo/bar/Dummy_.java"); assertTrue(generatedFile + " was not generated", generatedFile.exists()); assertNoErrors(p); }