@Test public void should_return_null_when_ear_contains_multiple_sub_archives_with_persistence_xml() throws Exception { final JavaArchive jar1 = ShrinkWrap.create(JavaArchive.class, "test1.jar") .addClass(PersistenceDescriptorExtractorTest.class) .addAsManifestResource("persistence-jta.xml", "persistence.xml"); final JavaArchive jar2 = ShrinkWrap.create(JavaArchive.class, "test2.jar") .addClass(PersistenceDescriptorExtractorTest.class) .addAsManifestResource("persistence-non-jta.xml", "persistence.xml"); final EnterpriseArchive ear = ShrinkWrap.create(EnterpriseArchive.class, "test.ear") .addAsLibraries(jar1, jar2); InputStream inputStream = persistenceDescriptorArchiveExtractor.getAsStream(ear); assertThat(inputStream).isNull(); }
public InputStream getAsStream(final Archive<?> archive) { final Archive<?> testable = findTestableArchive(archive); final Collection<Node> values = collectPersistenceXml(testable); if (values.size() == 1) { return values.iterator().next().getAsset().openStream(); } return null; }
PersistenceDescriptorExtractor { public InputStream getAsStream(final Archive<?> archive) { final Archive<?> testable = findTestableArchive(archive); final Collection<Node> values = collectPersistenceXml(testable); if (values.size() == 1) { return values.iterator().next().getAsset().openStream(); } return null; } }
PersistenceDescriptorExtractor { public InputStream getAsStream(final Archive<?> archive) { final Archive<?> testable = findTestableArchive(archive); final Collection<Node> values = collectPersistenceXml(testable); if (values.size() == 1) { return values.iterator().next().getAsset().openStream(); } return null; }  }
PersistenceDescriptorExtractor { public InputStream getAsStream(final Archive<?> archive) { final Archive<?> testable = findTestableArchive(archive); final Collection<Node> values = collectPersistenceXml(testable); if (values.size() == 1) { return values.iterator().next().getAsset().openStream(); } return null; }  InputStream getAsStream(final Archive<?> archive); }
PersistenceDescriptorExtractor { public InputStream getAsStream(final Archive<?> archive) { final Archive<?> testable = findTestableArchive(archive); final Collection<Node> values = collectPersistenceXml(testable); if (values.size() == 1) { return values.iterator().next().getAsset().openStream(); } return null; }  InputStream getAsStream(final Archive<?> archive);  }