@Test public void should_extract_persistence_descriptor_from_war() throws Exception { final WebArchive war = ShrinkWrap.create(WebArchive.class, "test.war") .addPackages(true, "org.assertj.core") .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml") .addAsResource("persistence-non-jta.xml", "META-INF/persistence.xml"); InputStream inputStream = persistenceDescriptorArchiveExtractor.getAsStream(war); String dataSourceName = persistenceDescriptorParser.obtainDataSourceName(inputStream); assertThat(dataSourceName).isEqualTo("java:app/datasources/postgresql_ds_non_jta"); }
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);  }