Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
Merge pull request #330 from zanata/zanata-server
Browse files Browse the repository at this point in the history
use zanata-server.zip as jboss server in test
  • Loading branch information
carlosmunoz committed Jan 14, 2014
2 parents 511fe87 + 06fa910 commit 45ca2dd
Show file tree
Hide file tree
Showing 11 changed files with 89 additions and 1,294 deletions.
88 changes: 16 additions & 72 deletions functional-test/pom.xml
Expand Up @@ -17,14 +17,14 @@
<!--Cargo Settings -->
<cargo.wait>false</cargo.wait>
<cargo.host>localhost</cargo.host>
<cargo.container>jboss71x</cargo.container>
<cargo.servlet.port>9898</cargo.servlet.port>
<!--<cargo.installation>http://aarnet.dl.sourceforge.net/project/jboss/JBoss/JBoss-5.1.0.GA/jboss-5.1.0.GA-jdk6.zip</cargo.installation>-->
<!--<cargo.installation>http://download.jboss.org/jbossas/7.1/jboss-as-7.1.1.Final/jboss-as-7.1.1.Final.zip</cargo.installation>-->
<cargo.installation>http://download.jboss.org/jbosseap/6/jboss-eap-6.1.0.Alpha/jboss-eap-6.1.0.Alpha.zip</cargo.installation>
<cargo.container>jboss72x</cargo.container>
<!--jboss port offset -->
<cargo.port.offset>100</cargo.port.offset>
<cargo.servlet.port>8180</cargo.servlet.port>
<cargo.installation>http://downloads.sourceforge.net/project/zanata/server/zanata-server.zip</cargo.installation>
<cargo.extract.dir>${project.build.directory}/cargo/installs</cargo.extract.dir>
<cargo.container.home>${project.build.directory}/jboss/container</cargo.container.home>
<cargo.install.relative.to.container.home>../../cargo/installs/jboss-eap-6.1.0.Alpha/jboss-eap-6.1</cargo.install.relative.to.container.home>
<cargo.install.relative.to.container.home>../../cargo/installs/zanata-server</cargo.install.relative.to.container.home>
<context.path>zanata</context.path>

<!--data source-->
Expand Down Expand Up @@ -135,20 +135,6 @@
<artifactId>hamcrest-library</artifactId>
</dependency>

<!-- cargo needs these-->
<!-- we need to include a newer version of hibernate and replace the ones come with JBoss EAP6-alpha -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>${hibernate.version}</version>
<exclusions>
<exclusion>
<groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
</exclusion>
</exclusions>
<scope>${hibernate.scope}</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
Expand All @@ -161,24 +147,13 @@
</exclusions>
<scope>${hibernate.scope}</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-infinispan</artifactId>
<version>${hibernate.version}</version>
<scope>${hibernate.scope}</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-envers</artifactId>
<version>${hibernate.version}</version>
<scope>${hibernate.scope}</scope>
</dependency>

<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>

<!-- cargo needs these-->
<dependency>
<groupId>${jdbc.groupId}</groupId>
<artifactId>${jdbc.artifactId}</artifactId>
Expand Down Expand Up @@ -412,10 +387,8 @@
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<version>1.3.1</version>
<version>1.4.5</version>
<configuration>
<wait>${cargo.wait}</wait>

<container>
<containerId>${cargo.container}</containerId>
<type>installed</type>
Expand All @@ -435,7 +408,10 @@
<ehcache.disk.store.dir>${project.build.directory}/ehcache</ehcache.disk.store.dir>
<jboss.server.log.threshold>WARN</jboss.server.log.threshold>
<hibernate.search.default.indexBase>${hibernate.search.default.indexBase}</hibernate.search.default.indexBase>
<jboss.socket.binding.port-offset>${cargo.port.offset}</jboss.socket.binding.port-offset>
</systemProperties>

<timeout>0</timeout>
</container>

<deployables>
Expand All @@ -445,7 +421,7 @@
<type>war</type>
<location>${zanata.target.war}</location>
<pingURL>http://${cargo.host}:${cargo.servlet.port}/${context.path}/</pingURL>
<pingTimeout>120000</pingTimeout>
<pingTimeout>180000</pingTimeout>
<properties>
<context>${context.path}</context>
</properties>
Expand All @@ -464,11 +440,6 @@
</configfile>
<!-- see above zipUrlInstaller/extractDir-->
<!-- cargo will force todir and tofile to be relative to container home directory -->
<!-- enable javamelody -->
<configfile>
<file>${project.basedir}/src/test/resources/as7module/sun/module.xml</file>
<todir>${cargo.install.relative.to.container.home}/modules/system/layers/base/sun/jdk/main</todir>
</configfile>

<!-- security and jndi for properties -->
<configfile>
Expand All @@ -479,42 +450,22 @@
</configfiles>

<files>
<!-- this is a hack to upgrade eap6-alpa's hibernate version-->
<file>
<!-- copy in the new jar and override the old one (this is ugly but inside cargo not much option we have -->
<file>${settings.localRepository}/org/hibernate/hibernate-core/${hibernate.version}/hibernate-core-${hibernate.version}.jar</file>
<tofile>${cargo.install.relative.to.container.home}/modules/system/layers/base/org/hibernate/main/hibernate-core-4.2.0.CR1.jar</tofile>
</file>
<file>
<file>${settings.localRepository}/org/hibernate/hibernate-entitymanager/${hibernate.version}/hibernate-entitymanager-${hibernate.version}.jar</file>
<tofile>${cargo.install.relative.to.container.home}/modules/system/layers/base/org/hibernate/main/hibernate-entitymanager-4.2.0.CR1.jar</tofile>
</file>
<file>
<file>${settings.localRepository}/org/hibernate/hibernate-infinispan/${hibernate.version}/hibernate-infinispan-${hibernate.version}.jar</file>
<tofile>${cargo.install.relative.to.container.home}/modules/system/layers/base/org/hibernate/main/hibernate-infinispan-4.2.0.CR1.jar</tofile>
</file>
<file>
<file>${settings.localRepository}/org/hibernate/hibernate-envers/${hibernate.version}/hibernate-envers-${hibernate.version}.jar</file>
<tofile>${cargo.install.relative.to.container.home}/modules/system/layers/base/org/hibernate/envers/main/hibernate-envers-4.2.0.CR1.jar</tofile>
</file>

<file>
<file>${settings.localRepository}/${jdbc.groupId}/${jdbc.artifactId}/${jdbc.version}/${jdbc.artifactId}-${jdbc.version}.jar</file>
<tofile>deployments/${jdbc.artifactId}.jar</tofile>
</file>
</files>

<properties>
<cargo.jboss.configuration>default</cargo.jboss.configuration>
<cargo.hostname>${cargo.host}</cargo.hostname>
<cargo.servlet.port>9898</cargo.servlet.port>

<cargo.jboss.configuration>standalone</cargo.jboss.configuration>
<cargo.jvmargs>
<!-- NB: JDom parser doesn't like comments starting with '-' -->
-XX:PermSize=512m -XX:MaxPermSize=1024
-XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled
${cargo.debug.jvm.args}
</cargo.jvmargs>
<cargo.port.offset>${cargo.port.offset}</cargo.port.offset>
<cargo.jboss.ajp.port>8109</cargo.jboss.ajp.port>
</properties>
</configuration>
</configuration>
Expand Down Expand Up @@ -578,11 +529,7 @@
<filtering>true</filtering>
<includes>
<include>**/*.properties</include>
<include>**/*.sql</include>
<include>**/log4j.xml</include>
<include>**/zanata-ds.xml</include>
<include>conf/standalone.xml</include>
<include>META-INF/persistence.xml</include>
<include>**/*.xml</include>
</includes>
</testResource>
<testResource>
Expand Down Expand Up @@ -655,10 +602,7 @@
<usedDependency>mysql:mysql-connector-java</usedDependency>
<usedDependency>org.apache.solr:solr-core</usedDependency>
<usedDependency>org.apache.solr:solr-solrj</usedDependency>
<usedDependency>org.hibernate:hibernate-core</usedDependency>
<usedDependency>org.hibernate:hibernate-envers</usedDependency>
<usedDependency>org.hibernate:hibernate-entitymanager</usedDependency>
<usedDependency>org.hibernate:hibernate-infinispan</usedDependency>
<usedDependency>org.hibernate:hibernate-testing</usedDependency>
<usedDependency>org.javassist:javassist</usedDependency>
<usedDependency>org.jboss.as:jboss-as-ejb-client-bom</usedDependency>
Expand Down
@@ -0,0 +1,51 @@
package org.zanata.page.administration;

import com.google.common.base.Predicate;
import java.util.List;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.zanata.page.BasePage;
import org.zanata.util.Checkbox;
import org.zanata.util.TableRow;
import org.zanata.util.WebElementUtil;

/**
* @author Patrick Huang
* <a href="mailto:pahuang@redhat.com">pahuang@redhat.com</a>
*/
public class ManageSearchPage extends BasePage {
private By classesTableBy = By.id("form:classList");

public ManageSearchPage(WebDriver driver) {
super(driver);
}


public ManageSearchPage selectAllActionsFor(String clazz) {
List<TableRow> tableRows =
WebElementUtil.getTableRows(getDriver(), classesTableBy);
for (TableRow tableRow : tableRows) {
if (tableRow.getCellContents().contains(clazz)) {
WebElement allActionsChkBox =
tableRow.getCells().get(0).findElement(By.tagName("input"));
Checkbox.of(allActionsChkBox).check();
}
}

return this;
}

public ManageSearchPage performSelectedActions() {
getDriver().findElement(By.id("form:reindex")).click();
waitForTenSec().until(new Predicate<WebDriver>() {
@Override
public boolean apply(WebDriver input) {
// once the button re-appears, it means the reindex is done.
input.findElement(By.id("form:reindex"));
return true;
}
});
return this;
}
}
Expand Up @@ -31,6 +31,7 @@
import org.junit.experimental.categories.Category;
import org.junit.rules.TestRule;
import org.zanata.feature.ConcordionTest;
import org.zanata.page.administration.ManageSearchPage;
import org.zanata.page.webtrans.EditorPage;
import org.zanata.util.RetryRule;
import org.zanata.util.SampleProjectRule;
Expand Down Expand Up @@ -80,6 +81,14 @@ public void testGlossaryDelete() {
assertThat(clientPushWorkFlow.isPushSuccessful(result),
Matchers.is(true));

new LoginWorkFlow().signIn("admin", "admin");
// for some reason on jenkins sometimes the index is out of sync.
ManageSearchPage manageSearchPage =
new BasicWorkFlow().goToPage("admin/search", ManageSearchPage.class);
manageSearchPage.selectAllActionsFor("HGlossaryEntry");
manageSearchPage.selectAllActionsFor("HGlossaryTerm");
manageSearchPage.performSelectedActions();

List<List<String>> hiGlossaryResult =
translate("hi").searchGlossary("hello")
.getGlossaryResultTable();
Expand All @@ -93,8 +102,6 @@ public void testGlossaryDelete() {
}

public EditorPage translate(String locale) {

new LoginWorkFlow().signIn("admin", "admin");
return new BasicWorkFlow().goToPage(
"webtrans/translate?project=about-fedora&iteration=master&localeId="
+ locale + "&locale=en#view:doc;doc:About_Fedora",
Expand Down
Expand Up @@ -42,7 +42,10 @@ public static String getDocumentStoragePath() {
env.put(Context.INITIAL_CONTEXT_FACTORY,
org.jboss.naming.remote.client.InitialContextFactory.class
.getName());
env.put(Context.PROVIDER_URL, "remote://localhost:4447");
long portOffset = Integer.parseInt(
PropertiesHolder.getProperty("cargo.port.offset", "0"));
long rmiPort = 4447 + portOffset;
env.put(Context.PROVIDER_URL, "remote://localhost:" + rmiPort);
InitialContext remoteContext = null;
try {
remoteContext = new InitialContext(env);
Expand Down
103 changes: 0 additions & 103 deletions functional-test/src/test/resources/as7module/sun/module.xml

This file was deleted.

0 comments on commit 45ca2dd

Please sign in to comment.