use of org.apache.tomee.arquillian.remote.RemoteTomEEConfiguration in project tomee by apache.
the class TimeoutConfigTest method timeout.
@Test
public void timeout() {
new RemoteTomEEContainer() {
{
setup(new RemoteTomEEConfiguration() {
{
setProviderUrlPattern("%s?readTimeout=30000&connectTimeout=30000");
}
});
assertEquals("http://localhost:8080/tomee/ejb?readTimeout=30000&connectTimeout=30000", providerUrl());
}
};
}
use of org.apache.tomee.arquillian.remote.RemoteTomEEConfiguration in project tomee by apache.
the class MicroProfileJWTTCKArchiveProcessor method process.
@Override
public void process(final Archive<?> applicationArchive, final TestClass testClass) {
if (!(applicationArchive instanceof WebArchive)) {
return;
}
final WebArchive war = WebArchive.class.cast(applicationArchive);
// Add Required Libraries
war.addAsLibrary(JarLocation.jarLocation(TokenUtils.class)).addAsLibrary(JarLocation.jarLocation(JWSSigner.class)).addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
// Provide keys required for tests (vendor specific way)
war.addClass(JWTAuthContextInfoProvider.class);
// Spec says that vendor specific ways to load the keys take precedence, so we need to remove it in test
// cases that use the Config approach.
Stream.of(PublicKeyAsPEMTest.class, PublicKeyAsPEMLocationTest.class, PublicKeyAsFileLocationURLTest.class, PublicKeyAsJWKTest.class, PublicKeyAsBase64JWKTest.class, PublicKeyAsJWKLocationTest.class, PublicKeyAsJWKLocationURLTest.class, PublicKeyAsJWKSTest.class, PublicKeyAsJWKSLocationTest.class, IssValidationTest.class, ExpClaimValidationTest.class, ExpClaimAllowMissingExpValidationTest.class, org.apache.tomee.microprofile.tck.jwt.config.PublicKeyAsPEMLocationTest.class, org.apache.tomee.microprofile.tck.jwt.config.PublicKeyAsJWKLocationURLTest.class).filter(c -> c.equals(testClass.getJavaClass())).findAny().ifPresent(c -> war.deleteClass(JWTAuthContextInfoProvider.class));
// MP Config in wrong place - See https://github.com/eclipse/microprofile/issues/46.
final Map<ArchivePath, Node> content = war.getContent(object -> object.get().matches(".*META-INF/.*"));
content.forEach((archivePath, node) -> war.addAsResource(node.getAsset(), node.getPath()));
// Rewrite the correct server port in configuration
final Container container = containerRegistry.get().getContainer(TargetDescription.DEFAULT);
if (container.getDeployableContainer() instanceof RemoteTomEEContainer) {
final RemoteTomEEContainer remoteTomEEContainer = (RemoteTomEEContainer) container.getDeployableContainer();
final RemoteTomEEConfiguration configuration = remoteTomEEContainer.getConfiguration();
final String httpPort = configuration.getHttpPort() + "";
final Map<ArchivePath, Node> microprofileProperties = war.getContent(object -> object.get().matches(".*META-INF/microprofile-config\\.properties"));
microprofileProperties.forEach((archivePath, node) -> {
try {
final Properties properties = new Properties();
properties.load(node.getAsset().openStream());
properties.replaceAll((key, value) -> ((String) value).replaceAll("8080", httpPort + "/" + "KeyEndpoint.war".replaceAll("\\.war", "")));
final StringWriter stringWriter = new StringWriter();
properties.store(stringWriter, null);
war.delete(archivePath);
war.add(new StringAsset(stringWriter.toString()), node.getPath());
} catch (final IOException e) {
e.printStackTrace();
}
});
}
System.out.println(war.toString(true));
}
use of org.apache.tomee.arquillian.remote.RemoteTomEEConfiguration in project tomee by apache.
the class DeployInWebAppsDirectoryTest method test.
@Test
public void test() throws Exception {
final RemoteTomEEConfiguration configuration = new RemoteTomEEConfiguration();
configuration.setGroupId("org.apache.tomee");
configuration.setArtifactId("apache-tomee");
configuration.setClassifier("plus");
configuration.setVersion(System.getProperty("tomee.version"));
configuration.setHttpPort(-1);
final RemoteTomEEContainer container = new RemoteTomEEContainer();
container.setup(configuration);
try {
container.start();
final File webapps = new File(configuration.getDir(), "apache-tomee-" + configuration.getClassifier() + "-" + configuration.getVersion() + "/webapps");
webapps.mkdirs();
final File enterpriseArchive = Maven.resolver().resolve("org.superbiz:moviefun-ear:ear:1.1.0-SNAPSHOT").withoutTransitivity().asSingleFile();
IO.copy(enterpriseArchive, new File(webapps, "moviefun-ear.ear"));
final String appUrl = "http://localhost:" + configuration.getHttpPort() + "/moviefun";
runTests(appUrl);
container.stop();
// restart the container, make sure all is still well
container.start();
} finally {
container.stop();
}
}
Aggregations