This repository has been archived by the owner on Dec 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 44
Server Requirement Extension
jbdevstudioqajenkins edited this page Jun 22, 2015
·
58 revisions
RedDeer framework comes with basic support for apache tomcat server. XSD file is hosted at http://www.jboss.org/schema/reddeer/ApacheServerRequirements.xsd. Implementing support for custom server adapter is as easy as extending the ServerRequirementBase XSD file: http://www.jboss.org/schema/reddeer/ServerRequirementsBase.xsd and implementing the supporting java files.
Apache Tomcat Server requirement can help you configure the server adapter in your tests. Steps are similar to the general custom requirement extension:
- annotate tests and utilize requirement and it's configuration
- create configuration xml file following xsd template
- run test with given RedDeer configuration file
package org.jboss.reddeer.snippet.test;
import static org.junit.Assert.*;
import org.jboss.reddeer.eclipse.wst.server.ui.view.Server;
import org.jboss.reddeer.eclipse.wst.server.ui.view.ServersView;
import org.jboss.reddeer.eclipse.wst.server.ui.view.ServersViewEnums.ServerState;
import org.jboss.reddeer.junit.requirement.inject.InjectRequirement;
import org.jboss.reddeer.junit.runner.RedDeerSuite;
import org.jboss.reddeer.requirements.server.ServerReqState;
import org.jboss.reddeer.requirements.server.apache.tomcat.ServerRequirement;
import org.jboss.reddeer.requirements.server.apache.tomcat.ServerRequirement.ApacheTomcatServer;
import org.junit.Test;
import org.junit.runner.RunWith;
@RunWith(RedDeerSuite.class)
@ApacheTomcatServer(state = ServerReqState.RUNNING)
public class ServerRunningTest {
@InjectRequirement
protected ServerRequirement requirement;
@Test
public void isServerRunningTest() {
ServersView sw = new ServersView();
sw.open();
Server s = sw.getServer(requirement.getServerNameLabelText(requirement
.getConfig()));
assertTrue(s.getLabel().getState().equals(ServerState.STARTED));
}
}
<?xml version="1.0" encoding="UTF-8"?>
<testrun xmlns="http://www.jboss.org/NS/Req" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:db="http://www.jboss.org/NS/db-schema" xmlns:server="http://www.jboss.org/NS/ServerReq"
xsi:schemaLocation="http://www.jboss.org/NS/Req http://www.jboss.org/schema/reddeer/RedDeerSchema.xsd
http://www.jboss.org/NS/ServerReq http://www.jboss.org/schema/reddeer/ApacheServerRequirements.xsd">
<requirements>
<!-- Example server configuration -->
<server:server-requirement name="Tomcat7">
<server:type>
<server:familyApacheTomcat version="7.0" />
</server:type>
<server:runtime>${apache-tomcat-7.home}</server:runtime>
</server:server-requirement>
</requirements>
</testrun>
-Dreddeer.config=/opt/rd-conf/