Skip to content

Commit

Permalink
[WFLY-8559] Added DWM test with multiple cases
Browse files Browse the repository at this point in the history
  • Loading branch information
LittleJohnII authored and maeste committed Apr 20, 2017
1 parent ebc7af1 commit d0e258f
Show file tree
Hide file tree
Showing 24 changed files with 2,012 additions and 2 deletions.
Expand Up @@ -55,9 +55,11 @@
<elytron-enabled>false</elytron-enabled>
<selector name="${test.expr:PING_TIME}">
<option name="myOption">${test.expr:ignored}</option>
<option name="myOtherOption">${test.expr:ignored}</option>
</selector>
<policy name="${test.expr:WATERMARK}">
<option name="watermark">${test.expr:0}</option>
<option name="unusedOption">${test.expr:ignored}</option>
</policy>
<short-running-threads>
<core-threads count="${test.expr:50}"/>
Expand Down
Expand Up @@ -57,9 +57,11 @@
<elytron-enabled>false</elytron-enabled>
<selector name="PING_TIME">
<option name="myOption">ignored</option>
<option name="myOtherOption">ignored</option>
</selector>
<policy name="WATERMARK">
<option name="watermark">0</option>
<option name="unusedOption">ignored</option>
</policy>
<short-running-threads>
<core-threads count="50"/>
Expand Down
80 changes: 78 additions & 2 deletions testsuite/integration/basic/pom.xml
Expand Up @@ -65,6 +65,49 @@
<build>
<plugins>

<!-- Build the target/jbossas server configuration. -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<!-- Copy in some jars. -->
<execution>
<id>prepare-jars-basic-integration.server</id>
<phase>process-test-resources</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<property name="tests.resources.dir" value="${basedir}/../src/test/resources"/>
<property name="tests.output.dir" value="${project.build.directory}"/>
<ant antfile="${basedir}/../src/test/scripts/basic-integration-build.xml">
<target name="build-basic-integration"/>
<!-- TODO: Unify names, then call "recursively". -->
</ant>
</target>
</configuration>
</execution>

<!-- Prepare two servers for distributed workmanager scenarios. -->
<!-- one should be in target/jbossas-distributed-0 the other in target/jbossas-distributed-1 -->
<execution>
<id>prepare-distributed-integration</id>
<phase>process-test-resources</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<ant antfile="${basedir}/../src/test/scripts/basic-integration-build.xml">
<target name="build-distributed"/>
</ant>
</target>
</configuration>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>keytool-maven-plugin</artifactId>
Expand Down Expand Up @@ -212,6 +255,7 @@
<exclude>org/jboss/as/test/integration/ee/naming/defaultbindings/**/*TestCase.java</exclude>
<exclude>org/jboss/as/test/integration/jca/moduledeployment/**/*TestCase*.java</exclude>
<exclude>org/jboss/as/test/integration/transaction/inflow/TransactionInflowTestCase.java</exclude>
<exclude>org/jboss/as/test/integration/jca/workmanager/**/*Dwm*.java</exclude>
</excludes>

<environmentVariables>
Expand Down Expand Up @@ -281,11 +325,38 @@
</configuration>
</execution>

</executions>
<execution>
<id>basic-integration-ha.surefire</id>
<phase>test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<!-- If you'd like to run these tests via -Dtest=<testname> you need to provide them
with the properties defined in systemPropertyVariablees -->
<!-- E.g. -Djboss.server.config.file.name=standalone-ha.xml -Darquillian.launch=distributed-group -->
<includes>
<include>org/jboss/as/test/integration/jca/workmanager/**/*Dwm*.java</include>
</includes>

</plugin>
<environmentVariables>
<JBOSS_HOME>${jboss.dist}</JBOSS_HOME>
</environmentVariables>

<!-- Parameters to test cases. -->
<systemPropertyVariables combine.children="append">
<arquillian.launch>distributed-group</arquillian.launch>
<jboss.server.config.file.name>standalone-ha.xml</jboss.server.config.file.name>
<jboss.inst>${basedir}/target/jbossas</jboss.inst>
</systemPropertyVariables>

<additionalClasspathElements>
<additionalClasspathElement>${project.basedir}/../src/test/resources</additionalClasspathElement>
</additionalClasspathElements>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
Expand Down Expand Up @@ -333,6 +404,7 @@
<excludes>
<exclude>org/jboss/as/test/integration/**/*SecondTestCase.java</exclude>
<exclude>org/jboss/as/test/integration/security/loginmodules/Ldap*TestCase.java</exclude>
<exclude>org/jboss/as/test/integration/jca/workmanager/**/*Dwm*.java</exclude>
</excludes>
</configuration>
</execution>
Expand Down Expand Up @@ -377,6 +449,10 @@
<id>basic-integration-ldap.surefire</id>
<phase>none</phase>
</execution>
<execution>
<id>basic-integration-ha.surefire</id>
<phase>none</phase>
</execution>
</executions>
</plugin>
</plugins>
Expand Down
34 changes: 34 additions & 0 deletions testsuite/integration/basic/src/test/config/arq/arquillian.xml
Expand Up @@ -22,4 +22,38 @@
</configuration>
</container>

<group qualifier="distributed-group">
<container qualifier="container-0">
<configuration>
<property name="jbossHome">${basedir}/target/wildfly-distributed-0</property>
<!-- AS7-2493 different jboss.node.name must be specified -->
<property name="javaVmArguments">${server.jvm.args} -Djboss.inst=${basedir}/target/wildfly-distributed-0 -Djboss.node.name=node-0</property>
<property name="serverConfig">${jboss.server.config.file.name:standalone-ha.xml}</property>
<property name="jbossArguments">${jboss.args}</property>
<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>

<container qualifier="container-1">
<configuration>
<property name="jbossHome">${basedir}/target/wildfly-distributed-1</property>
<property name="javaVmArguments">${server.jvm.args} -Djboss.inst=${basedir}/target/wildfly-distributed-1 -Djboss.node.name=node-1 -Djboss.port.offset=100</property>
<property name="serverConfig">${jboss.server.config.file.name:standalone-ha.xml}</property>
<property name="jbossArguments">${jboss.args}</property>
<property name="allowConnectingToRunningServer">true</property>
<property name="managementAddress">${node1:127.0.0.1}</property>
<property name="managementPort">${as.managementPort.node1:10090}</property>

<!-- AS7-4070 -->
<property name="waitForPorts">${as.debug.port.node1:8887} ${as.managementPort.node1:10090}</property>
<property name="waitForPortsTimeoutInSeconds">8</property>
</configuration>
</container>
</group>
</arquillian>
@@ -0,0 +1,36 @@
/*
* JBoss, Home of Professional Open Source.
* Copyright 2011, Red Hat Middleware LLC, 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.jboss.as.test.integration.jca.rar.distributed;

import javax.resource.Referenceable;
import java.io.Serializable;

/**
* DistributedAdminObject1 allows the tester to use the resource adapter and workmanager from
* outside EAP.
*/
public interface DistributedAdminObject1 extends Referenceable, Serializable {

void setName(String name);

String getName();
}
@@ -0,0 +1,128 @@
/*
* JBoss, Home of Professional Open Source.
* Copyright 2011, Red Hat Middleware LLC, 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.jboss.as.test.integration.jca.rar.distributed;

import org.jboss.logging.Logger;

import javax.naming.NamingException;
import javax.naming.Reference;
import javax.resource.Referenceable;
import javax.resource.spi.ResourceAdapter;
import javax.resource.spi.ResourceAdapterAssociation;
import java.io.Serializable;

/**
* Note that since the implementation contains a {@link ResourceAdapter} field, and that field is
* not serializable, the admin object can only be injected via {@link javax.annotation.Resource}.
*
* That means that the tests that you write can't use
* {@link org.jboss.arquillian.container.test.api.RunAsClient} and look up the object remotely.
*
* What you can do, is deploy an ejb, that will report the statistics via its admin object. You
* should be able to lookup that ejb and use it as a proxy to the resource adapter below. However,
* the ejb has to be {@link javax.ejb.Stateless}, otherwise, once started in a cluster, a session is
* going to be created for it which has to be serializable.
*/
public class DistributedAdminObject1Impl implements DistributedAdminObject1,
ResourceAdapterAssociation, Referenceable, Serializable {

private static final Logger log = Logger.getLogger(DistributedAdminObject1Impl.class.getCanonicalName());
private static final long serialVersionUID = 466880381773994922L;

static {
log.info("Initializing DistributedAdminObject1Impl");
}

private ResourceAdapter ra;
private Reference reference;
private String name;

public DistributedAdminObject1Impl() {
setName("DistributedAdminObject1Impl");
}

public void setName(String name) {
this.name = name;
}

public String getName() {
return name;
}

public ResourceAdapter getResourceAdapter() {
return ra;
}

public void setResourceAdapter(ResourceAdapter ra) {
this.ra = ra;
}

/**
* {@inheritDoc}
*/
@Override
public Reference getReference() throws NamingException {
return reference;
}

/**
* {@inheritDoc}
*/
@Override
public void setReference(Reference reference) {
this.reference = reference;
}

/**
* {@inheritDoc}
*/
@Override
public int hashCode() {
int result = 17;
if (name != null) { result += 31 * result + 7 * name.hashCode(); } else { result += 31 * result + 7; }
return result;
}

/**
* {@inheritDoc}
*/
@Override
public boolean equals(Object other) {
if (other == null) { return false; }
if (other == this) { return true; }
if (!(other instanceof DistributedAdminObject1Impl)) { return false; }
DistributedAdminObject1Impl obj = (DistributedAdminObject1Impl) other;
boolean result = true;
if (result) {
if (name == null) { result = obj.getName() == null; } else { result = name.equals(obj.getName()); }
}
return result;
}

/**
* {@inheritDoc}
*/
@Override
public String toString() {
return this.getClass().toString() + "name=" + name;
}
}
@@ -0,0 +1,29 @@
/*
* JBoss, Home of Professional Open Source.
* Copyright 2011, Red Hat Middleware LLC, 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.jboss.as.test.integration.jca.rar.distributed;

public interface DistributedConnection1 {

String test(String s);

void close();
}

0 comments on commit d0e258f

Please sign in to comment.