use of org.wildfly.swarm.spi.api.JARArchive in project wildfly-swarm by wildfly-swarm.
the class JPATest method testFractionMatching.
@Test
public void testFractionMatching() throws Exception {
JARArchive archive = ShrinkWrap.create(JARArchive.class);
archive.addAsResource("META-INF/persistence.xml");
FractionUsageAnalyzer analyzer = new FractionUsageAnalyzer();
File out = Files.createTempFile(archive.getName(), ".war").toFile();
archive.as(ZipExporter.class).exportTo(out, true);
analyzer.source(out);
assertThat(analyzer.detectNeededFractions().stream().filter(fd -> fd.getArtifactId().equals("jpa")).count()).isEqualTo(1);
out.delete();
}
use of org.wildfly.swarm.spi.api.JARArchive in project wildfly-swarm by wildfly-swarm.
the class ArqSecuredManagementInterfaceTest method createDeployment.
@Deployment(testable = false)
public static Archive createDeployment() {
JARArchive deployment = ShrinkWrap.create(JARArchive.class, "myapp.jar");
deployment.add(EmptyAsset.INSTANCE, "nothing");
return deployment;
}
use of org.wildfly.swarm.spi.api.JARArchive in project wildfly-swarm by wildfly-swarm.
the class KeycloakArquillianTest method createDeployment.
@Deployment(testable = false)
public static Archive createDeployment() {
JARArchive deployment = ShrinkWrap.create(JARArchive.class);
deployment.add(EmptyAsset.INSTANCE, "nothing");
return deployment;
}
use of org.wildfly.swarm.spi.api.JARArchive in project wildfly-swarm by wildfly-swarm.
the class SecuredTest method testShouldContainOneLoginConfig.
@Test
public void testShouldContainOneLoginConfig() throws Exception {
JARArchive archive = ShrinkWrap.create(JARArchive.class, "test.jar");
archive.as(Secured.class).protect("/companies").withRole("default");
archive.as(Secured.class).protect("/accounts").withRole("manager");
InputStream assetStream = archive.get(WebXmlAsset.NAME).getAsset().openStream();
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
Document document = factory.newDocumentBuilder().parse(assetStream);
XPath xpath = XPathFactory.newInstance().newXPath();
XPathExpression xpr = xpath.compile("count(//web-app/login-config)");
Number count = (Number) xpr.evaluate(document, XPathConstants.NUMBER);
Assert.assertEquals("Should have only one login-config element", 1, count.intValue());
}
use of org.wildfly.swarm.spi.api.JARArchive in project wildfly-swarm by wildfly-swarm.
the class LoggingArquillianDefaultTest method createDeployment.
@Deployment
public static Archive createDeployment() {
JARArchive deployment = ShrinkWrap.create(JARArchive.class);
deployment.add(EmptyAsset.INSTANCE, "nothing");
return deployment;
}
Aggregations