Skip to content

Commit

Permalink
Add java8 testsuite and test for WFLY-4362
Browse files Browse the repository at this point in the history
  • Loading branch information
ctomc committed Feb 26, 2015
1 parent 3de2fd2 commit 53840e6
Show file tree
Hide file tree
Showing 8 changed files with 639 additions and 0 deletions.
59 changes: 59 additions & 0 deletions testsuite/integration/java8/pom.xml
@@ -0,0 +1,59 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<artifactId>wildfly-ts-integ</artifactId>
<groupId>org.wildfly</groupId>
<version>9.0.0.Alpha2-SNAPSHOT</version>
</parent>

<artifactId>wildfly-ts-integ-java8</artifactId>
<packaging>jar</packaging>
<name>WildFly Test Suite: Integration - Java 8</name>

<properties>
<!-- use java 8 for this module -->
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.source>1.8</maven.compiler.source>


<jbossas.ts.integ.dir>${basedir}/..</jbossas.ts.integ.dir>
<jbossas.ts.dir>${jbossas.ts.integ.dir}/..</jbossas.ts.dir>
<jbossas.project.dir>${jbossas.ts.dir}/..</jbossas.project.dir>
</properties>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions combine.children="append">
<execution>
<id>add-java8-config</id>
<phase>process-test-resources</phase>
<configuration>
<target>
<copy file="${project.build.testOutputDirectory}/standalone-java8.xml"
todir="${project.build.directory}/jbossas/standalone/configuration" overwrite="true"/>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
<!--
Surefire test executions
-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
</plugin>
</plugins>
</build>

</project>
25 changes: 25 additions & 0 deletions testsuite/integration/java8/src/test/config/arq/arquillian.xml
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<arquillian xmlns="http://jboss.org/schema/arquillian" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://jboss.org/schema/arquillian http://jboss.org/schema/arquillian/arquillian_1_0.xsd">

<defaultProtocol type="jmx-as7" />

<container qualifier="jboss" default="true">
<configuration>
<property name="jbossHome">${basedir}/target/jbossas</property>
<property name="javaVmArguments">${server.jvm.args} -Djboss.inst=${basedir}/target/jbossas -Djboss.bind.address=${node0} -Dtest.bind.address=${node0}</property>
<property name="serverConfig">${jboss.server.config.file.name:standalone-java8.xml}</property>
<property name="jbossArguments">${jboss.args}</property>
<!-- -Djboss.inst is not necessarily needed, only in case the test case neeeds path to the instance it runs in.
In the future, Arquillian should capable of injecting it into @ArquillianResource File or such. -->
<property name="allowConnectingToRunningServer">true</property>
<property name="managementAddress">${node0:127.0.0.1}</property>
<property name="managementPort">${as.managementPort:9990}</property>

<!-- AS7-4070 -->
<property name="waitForPorts">${as.debug.port:8787} ${as.managementPort:9990}</property>
<property name="waitForPortsTimeoutInSeconds">8</property>
</configuration>
</container>

</arquillian>
@@ -0,0 +1,9 @@
package org.wildfly.test.integration.jsp;

/**
* @author Tomaz Cerar (c) 2015 Red Hat Inc.
*/
@FunctionalInterface
public interface AnswerToEverythingComputation {
int compute();
}
@@ -0,0 +1,69 @@
/*
* JBoss, Home of Professional Open Source.
* Copyright 2014, Red Hat, Inc., and individual contributors
* as indicated by the @author tags. See the copyright.txt file in the
* distribution for a full listing of individual contributors.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.wildfly.test.integration.jsp;

import java.net.URL;
import java.util.concurrent.TimeUnit;

import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.container.test.api.RunAsClient;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.arquillian.test.api.ArquillianResource;
import org.jboss.as.test.integration.common.HttpRequest;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.asset.EmptyAsset;
import org.jboss.shrinkwrap.api.asset.StringAsset;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.junit.Test;
import org.junit.runner.RunWith;

/**
* See WFLY-2690
*/
@RunWith(Arquillian.class)
@RunAsClient
public class JspCompilerTestCase {

private static final StringAsset WEB_XML = new StringAsset(
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
"<web-app xmlns=\"http://java.sun.com/xml/ns/javaee\"\n" +
" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n" +
" xsi:schemaLocation=\"http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_1.xsd\"\n" +
" version=\"3.1\">\n" +
"</web-app>");



@Deployment
public static WebArchive deploy() {
return ShrinkWrap.create(WebArchive.class)
.addAsWebInfResource(WEB_XML, "web.xml")
.addClasses(AnswerToEverythingComputation.class)
.addAsWebResource(JspCompilerTestCase.class.getResource("jsp-with-lambdas.jsp"), "index.jsp");

}

@Test
public void test(@ArquillianResource URL url) throws Exception {
HttpRequest.get(url + "index.jsp", 10, TimeUnit.SECONDS);
}
}
52 changes: 52 additions & 0 deletions testsuite/integration/java8/src/test/resources/logging.properties
@@ -0,0 +1,52 @@
#
# JBoss, Home of Professional Open Source.
# Copyright 2010, Red Hat, Inc., and individual contributors
# as indicated by the @author tags. See the copyright.txt file in the
# distribution for a full listing of individual contributors.
#
# This is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation; either version 2.1 of
# the License, or (at your option) any later version.
#
# This software is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this software; if not, write to the Free
# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
# 02110-1301 USA, or see the FSF site: http://www.fsf.org.
#

# Additional logger names to configure (root logger is always configured)
loggers=sun.rmi,org.jboss.shrinkwrap
logger.org.jboss.shrinkwrap.level=INFO
logger.sun.rmi.level=WARNING

# Root logger level
logger.level=DEBUG

# Root logger handlers
logger.handlers=FILE, CONSOLE

# Console handler configuration
handler.CONSOLE=org.jboss.logmanager.handlers.ConsoleHandler
handler.CONSOLE.properties=autoFlush
handler.CONSOLE.level=INFO
handler.CONSOLE.autoFlush=true
handler.CONSOLE.formatter=PATTERN

# File handler configuration
handler.FILE=org.jboss.logmanager.handlers.FileHandler
handler.FILE.level=DEBUG
handler.FILE.properties=autoFlush,fileName
handler.FILE.autoFlush=true
handler.FILE.fileName=./target/test.log
handler.FILE.formatter=PATTERN

# Formatter pattern configuration
formatter.PATTERN=org.jboss.logmanager.formatters.PatternFormatter
formatter.PATTERN.properties=pattern
formatter.PATTERN.pattern=%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%e%n
@@ -0,0 +1,11 @@
<%@ page import="java.io.IOException" %>
<%@ page import="org.wildfly.test.integration.jsp.AnswerToEverythingComputation" %>


<%
try {
response.getWriter().write("Answer to everything is: " + ((AnswerToEverythingComputation) () -> 42).compute());
} catch (IOException ex) {
throw new RuntimeException(ex);
}
%>

0 comments on commit 53840e6

Please sign in to comment.