@Test
public void testFatCDIWabOptsOutOfOSGiCDIIntegration() throws Exception {

	WabProcessor wabProcessor = new TestWabProcessor(
		getFile("/jsf.cdi.applicant.portlet.war"),
		Collections.singletonMap(
			"Web-ContextPath",
			new String[] {"/jsf-cdi-applicant-portlet"}));
	File processedFile = wabProcessor.getProcessedFile();
	Assert.assertNotNull(processedFile);
	try (Jar jar = new Jar(processedFile)) {
		// Check if the basic metadata is correct
		Assert.assertEquals("jsf-cdi-applicant-portlet", jar.getBsn());
		Assert.assertEquals("4.1.2", jar.getVersion());
		// Does this WAR have a beans.xml file that would trigger
		// OSGi CDI Integration analysis?
		Resource beansXMLFile = jar.getResource("WEB-INF/beans.xml");
		Assert.assertNotNull(beansXMLFile);
		// Did the beans.xml file have a discovery mode of none?
		try (InputStream inputStream = beansXMLFile.openInputStream()) {
			Document document = SAXReaderUtil.read(inputStream);
			Node beanDiscoveryMode = document.selectSingleNode(
				"/beans/@bean-discovery-mode");
			String value = beanDiscoveryMode.getStringValue();
			Assert.assertNotEquals("none", value);
		}
		// Now that we've established CDI discovery would kick
		// in, check to see if the WAB opted-out of integration by
		// having the "-cdiannotations" instruction set to the empty
		// value in liferay-plugin-package.properties.
		Resource packageProperties = jar.getResource(
			"WEB-INF/liferay-plugin-package.properties");
		Properties properties = new Properties();
		try (InputStream inputStream =
				packageProperties.openInputStream()) {
			properties.load(inputStream);
		}
		Assert.assertEquals(
			"", properties.getProperty(Constants.CDIANNOTATIONS));
		// Finally, make sure no requirement on the OSGi CDI
		// Integration extender was added to the manifest
		Domain domain = Domain.domain(jar.getManifest());
		Parameters requirements = domain.getRequireCapability();
		Map<String, Object> arguments = HashMapBuilder.<String, Object>put(
			"osgi.extender", "osgi.cdi"
		).put(
			"version", new Version(1)
		).build();
		for (Attrs attrs : requirements.values()) {
			String filterString = attrs.get("filter:");
			if (filterString == null) {
				continue;
			}
			Filter filter = new Filter(filterString);
			Assert.assertFalse(filter.matchMap(arguments));
		}
	}
}