-
Notifications
You must be signed in to change notification settings - Fork 464
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3387 from mackaypeter/WFCORE-3897
[WFCORE-3897] Add test coverage
- Loading branch information
Showing
2 changed files
with
214 additions
and
0 deletions.
There are no files selected for viewing
80 changes: 80 additions & 0 deletions
80
...in/src/test/java/org/jboss/as/test/integration/domain/NonExistentServerGroupTestCase.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
/* | ||
* JBoss, Home of Professional Open Source. | ||
* Copyright 2018, 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.jboss.as.test.integration.domain; | ||
|
||
import org.jboss.as.test.integration.domain.management.util.DomainTestSupport; | ||
import org.junit.After; | ||
import org.junit.Assert; | ||
import org.junit.Rule; | ||
import org.junit.Test; | ||
import org.junit.rules.ExpectedException; | ||
|
||
/** | ||
* @author Peter Mackay | ||
*/ | ||
public class NonExistentServerGroupTestCase { | ||
|
||
private static DomainTestSupport testSupport; | ||
|
||
@Rule | ||
public ExpectedException thrown = ExpectedException.none(); | ||
|
||
@After | ||
public void cleanUp() { | ||
if (testSupport != null) { | ||
testSupport.stop(); | ||
} | ||
} | ||
|
||
/** | ||
* Test that the host doesn't start when there are servers assigned to non-existent groups. | ||
*/ | ||
@Test | ||
public void testFailureOnBoot() { | ||
DomainTestSupport.Configuration configuration = getDomainConfiguration(); | ||
thrown.expect(RuntimeException.class); | ||
thrown.expectMessage("Could not start container"); | ||
testSupport = DomainTestSupport.createAndStartSupport(configuration); | ||
} | ||
|
||
/** | ||
* Test that the host does start in admin-only mode even with servers assigned to non-existent groups. | ||
*/ | ||
@Test | ||
public void testBootAdminOnly() { | ||
DomainTestSupport.Configuration configuration = getDomainConfiguration(); | ||
configuration.getMasterConfiguration().setAdminOnly(true); | ||
testSupport = DomainTestSupport.createAndStartSupport(configuration); | ||
Assert.assertTrue(testSupport.getDomainMasterLifecycleUtil().areServersStarted()); | ||
} | ||
|
||
private static DomainTestSupport.Configuration getDomainConfiguration() { | ||
DomainTestSupport.Configuration configuration = DomainTestSupport.Configuration.create( | ||
NonExistentServerGroupTestCase.class.getSimpleName(), | ||
"domain-configs/domain-minimal.xml", | ||
"host-configs/host-nonexistent-group.xml", | ||
null); | ||
return configuration; | ||
} | ||
|
||
} |
134 changes: 134 additions & 0 deletions
134
testsuite/domain/src/test/resources/host-configs/host-nonexistent-group.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
<!-- | ||
~ JBoss, Home of Professional Open Source. | ||
~ Copyright 2018, 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. | ||
--> | ||
|
||
<host xmlns="urn:jboss:domain:8.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="urn:jboss:domain:8.0 wildfly-config_8_0.xsd" | ||
name="master" organization="core-master"> | ||
|
||
<extensions> | ||
<extension module="org.jboss.as.jmx"/> | ||
<extension module="org.wildfly.extension.core-management"/> | ||
</extensions> | ||
|
||
<paths> | ||
<path name="domainTestPath" path="/tmp" /> | ||
</paths> | ||
|
||
<management> | ||
<security-realms> | ||
<security-realm name="ManagementRealm"> | ||
<authentication> | ||
<local default-user="$local" skip-group-loading="true"/> | ||
<properties path="mgmt-users.properties" relative-to="jboss.domain.config.dir" /> | ||
</authentication> | ||
</security-realm> | ||
<security-realm name="ApplicationRealm"> | ||
<authentication> | ||
<local default-user="$local" allowed-users="*" skip-group-loading="true"/> | ||
<properties path="domain/configuration/application-users.properties" relative-to="jboss.home.dir" /> | ||
</authentication> | ||
</security-realm> | ||
</security-realms> | ||
<audit-log> | ||
<formatters> | ||
<json-formatter name="json-formatter"/> | ||
</formatters> | ||
<handlers> | ||
<file-handler name="host-file" formatter="json-formatter" relative-to="jboss.domain.data.dir" path="audit-log.log"/> | ||
<file-handler name="server-file" formatter="json-formatter" relative-to="jboss.server.data.dir" path="audit-log.log"/> | ||
</handlers> | ||
<logger log-boot="true" log-read-only="true" enabled="false"> | ||
<handlers> | ||
<handler name="host-file"/> | ||
</handlers> | ||
</logger> | ||
<server-logger log-boot="true" log-read-only="true" enabled="false"> | ||
<handlers> | ||
<handler name="server-file"/> | ||
</handlers> | ||
</server-logger> | ||
</audit-log> | ||
<management-interfaces> | ||
<native-interface security-realm="ManagementRealm"> | ||
<socket interface="management" port="9999"/> | ||
</native-interface> | ||
<http-interface security-realm="ManagementRealm"> | ||
<http-upgrade enabled="true" /> | ||
<socket interface="management" port="9990"/> | ||
</http-interface> | ||
</management-interfaces> | ||
</management> | ||
|
||
<domain-controller> | ||
<local/> | ||
</domain-controller> | ||
|
||
<interfaces> | ||
<interface name="management"> | ||
<inet-address value="${jboss.test.host.master.address}"/> | ||
</interface> | ||
<!-- AS7-4177 specify the "public" interface in each server to test that handling --> | ||
</interfaces> | ||
|
||
<jvms> | ||
<jvm name="default"> | ||
<heap size="64m" max-size="128m"/> | ||
<jvm-options> | ||
<option value="-ea"/> | ||
<option value="--add-exports=java.base/sun.nio.ch=ALL-UNNAMED"/> | ||
</jvm-options> | ||
<environment-variables> | ||
<variable name="DOMAIN_TEST_JVM" value="jvm"/> | ||
</environment-variables> | ||
<!-- | ||
<jvm-options> | ||
<option value="-Xdebug"/> | ||
<option value="-Xnoagent"/> | ||
<option value="-Djava.compiler=NONE"/> | ||
<option value="-agentlib:jdwp=transport=dt_socket,address=5005,server=y,suspend=y"/> | ||
</jvm-options> | ||
--> | ||
</jvm> | ||
</jvms> | ||
|
||
<servers> | ||
<server name="server-one" group="nonexistent-server-group" auto-start="false"> | ||
<socket-bindings socket-binding-group="standard-sockets" port-offset="350"/> | ||
<jvm name="default"/> | ||
</server> | ||
<server name="server-two" group="nonexistent-server-group" auto-start="false"> | ||
<socket-bindings port-offset="450"/> | ||
</server> | ||
</servers> | ||
|
||
<profile> | ||
<subsystem xmlns="urn:jboss:domain:jmx:1.3"> | ||
<expose-resolved-model/> | ||
<expose-expression-model/> | ||
<remoting-connector/> | ||
</subsystem> | ||
<subsystem xmlns="urn:jboss:domain:core-management:1.0"> | ||
</subsystem> | ||
</profile> | ||
</host> |