Skip to content

Commit

Permalink
Merge branch 'master' into ZNTA-845-findbugs
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Eng committed May 10, 2017
2 parents c8a7bc1 + 9819a47 commit e76f872
Show file tree
Hide file tree
Showing 38 changed files with 2,202 additions and 2,428 deletions.
4 changes: 2 additions & 2 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -240,14 +240,14 @@ timestamps {

step([$class: 'WarningsPublisher',
consoleParsers: [
[parserName: 'Java Compiler (javac)'], // 357 warnings
[parserName: 'Java Compiler (javac)'], // 400 warnings
// [parserName: 'JavaDoc'],
// [parserName: 'Maven'], // ~279 warnings, but too variable
// TODO check integration test warnings (EAP and WildFly)
//[parserName: 'appserver log messages'], // 119 warnings
//[parserName: 'browser warnings'], // 0 warnings
],
unstableTotalAll: '357',
unstableTotalAll: '400',
unstableTotalHigh: '0',
])
// TODO check integration test warnings (EAP and WildFly)
Expand Down
80 changes: 80 additions & 0 deletions server/etc/scripts/runJbossCli.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
import java.nio.file.Files
import java.nio.file.attribute.PosixFilePermission

import static java.nio.file.attribute.PosixFilePermission.*


/*
* Copyright 2017, 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.
*/
/**
* @author Patrick Huang
* <a href="mailto:pahuang@redhat.com">pahuang@redhat.com</a>
*/
String appServerHome = project.properties.get('appserver.home')

if (appServerHome == null) {
throw new Exception('Missing appserver properties. Please invoke mvn with -Dappserver=jbosseap6 or -Dappserver=wildfly8')
}

File baseDir = new File(project.basedir as String)

// basedir will be either functional-test module or zanata-war module
File commonCLIScript = new File(baseDir.getParentFile(), "etc/scripts/zanata-config-test-common.cli")
File arqTestCLIScript = new File(baseDir.getParentFile(), "etc/scripts/zanata-config-arq-test.cli")

File serverHome = new File(appServerHome)

String ext = isWindows() ? 'bat' : 'sh'

File jbossCLI = new File(serverHome, "bin/jboss-cli.$ext")

// need to set file to executable
Set<PosixFilePermission> permissions = [GROUP_READ, GROUP_EXECUTE, OTHERS_EXECUTE, OTHERS_READ, OWNER_EXECUTE, OWNER_READ, OWNER_WRITE]
Files.setPosixFilePermissions(jbossCLI.toPath(), permissions)

runJBossCLI(jbossCLI, commonCLIScript)
if (project.artifactId == 'zanata-war') {
// we are running arquillian test. need to run extra script
runJBossCLI(jbossCLI, arqTestCLIScript)
}

static void runJBossCLI(File jbossCLI, File cliScript) {
String cmd = "$jbossCLI.absolutePath --file=$cliScript.absolutePath"

println "about to execute $cmd"

def sout = new StringBuilder(), serr = new StringBuilder()
def proc = cmd.execute()
proc.consumeProcessOutput(sout, serr)
// give it 30 seconds
proc.waitForOrKill(30000)
println "jboss cli execution:stdout> $sout"
if (!serr.toString().isEmpty()) {
println "jboss cli execution:stderr> $serr"
}
def exitValue = proc.exitValue()
assert exitValue == 0 : "jboss cli execution returned non-zero code:$exitValue"
}


static boolean isWindows() {
System.properties.getProperty('os.name').toLowerCase().contains('windows')
}
14 changes: 14 additions & 0 deletions server/etc/scripts/zanata-config-arq-test.cli
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# in addition to functional test cli script, this will add a h2 datasource

# run cli in offline (embeded server) mode, pipe std out to local script terminal
embed-server --std-out=echo --server-config=standalone-full.xml

# ==== add datasource ====
data-source add --name=zanataDatasource \
--jndi-name=java:jboss/datasources/zanataDatasource --driver-name=h2 \
--connection-url=jdbc:h2:mem:zanata;DB_CLOSE_DELAY=-1 \
--user-name=sa --password=sa \
--validate-on-match=false --background-validation=false \
--valid-connection-checker-class-name=org.jboss.jca.adapters.jdbc.extensions.novendor.JDBC4ValidConnectionChecker \
--exception-sorter-class-name=org.jboss.jca.adapters.jdbc.extensions.novendor.NullExceptionSorter \
--use-ccm=true
105 changes: 105 additions & 0 deletions server/etc/scripts/zanata-config-test-common.cli
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
# jboss cli specification for an operation request
# [/node-type=node-name (/node-type=node-name)*] : operation-name [( [parameter-name=parameter-value (,parameter-name=parameter-value)*] )]
# The default variable substitution are turned off by default in bin/jboss-cli.xml so ${var} will be passed to standalone-full.xml as is.

# run cli in offline (embeded server) mode, pipe std out to local script terminal
embed-server --std-out=echo --server-config=standalone-full.xml

batch
# ==== system properties /system-property=foo:add(value=bar) ====
/system-property="zanata.javaScriptTestHelper":add(value="true")
/system-property="jboss.as.management.blocking.timeout":add(value="1000")
/system-property="javamelody.storage-directory":add(value="${jboss.server.data.dir}/zanata/stats: ")
/system-property="hibernate.search.default.indexBase":add(value="${jboss.server.data.dir}/zanata/indexes: ")
/system-property="zanata.security.authpolicy.internal":add(value="zanata.internal")
/system-property="zanata.security.authpolicy.openid":add(value="zanata.openid")
/system-property="zanata.email.defaultfromaddress":add(value="no-reply@zanata.org")
/system-property="zanata.file.directory":add(value="./target/documents")
/system-property="zanata.support.oauth":add(value="true")
/system-property="zanata.security.adminusers":add(value="admin")
/system-property="virusScanner":add(value="DISABLED")

# ==== cached connection manager ====
/subsystem=jca/cached-connection-manager=cached-connection-manager/:write-attribute(name=debug,value=true)
# we don't want error=true in production, but we use it here to help catch connection leaks during tests
/subsystem=jca/cached-connection-manager=cached-connection-manager/:write-attribute(name=error,value=true)

# ==== logging configuration ====
# /subsystem=logging/logger=LOG_CATEGORY:add
# /subsystem=logging/logger=LOG_CATEGORY:write-attribute(name=level,value=DEBUG)
# /subsystem=logging/logger=LOG_CATEGORY:write-attribute(name=filter-spec, value=FILTER_EXPRESSION)

## default file logging (server.log) unchanged
## Allow stdout handler to handle INFO logging
/subsystem=logging/console-handler=CONSOLE:write-attribute(name=level,value=INFO)

## Disable some startup warnings triggered by third-party jars
/subsystem=logging/logger=org.jboss.as.server.deployment:add
/subsystem=logging/logger=org.jboss.as.server.deployment:write-attribute(name=level,value=INFO)
/subsystem=logging/logger=org.jboss.as.server.deployment:write-attribute(name=filter-spec, value="not(any( match(\"JBAS015960\"), match(\"JBAS015893\") ))")
## Disable WARN about GWT's org.hibernate.validator.ValidationMessages
/subsystem=logging/logger=org.jboss.modules:add
/subsystem=logging/logger=org.jboss.modules:write-attribute(name=level,value=ERROR)
## Disable WARN: "RP discovery / realm validation disabled;"
/subsystem=logging/logger=org.openid4java.server.RealmVerifier:add
/subsystem=logging/logger=org.openid4java.server.RealmVerifier:write-attribute(name=level,value=ERROR)
## Disable WARN: "JMS API was found on the classpath...
/subsystem=logging/logger=org.richfaces.log.Application:add
/subsystem=logging/logger=org.richfaces.log.Application:write-attribute(name=level,value=ERROR)
/subsystem=logging/logger=org.richfaces.log.Application:write-attribute(name=filter-spec, value="not( match(\"JMS API was found on the classpath\") )")
## Disable WARN: "Queue with name '...' has already been registered"
/subsystem=logging/logger=org.richfaces.log.Components:add
/subsystem=logging/logger=org.richfaces.log.Components:write-attribute(name=level,value=ERROR)
## Enable more CDI weld error log
/subsystem=logging/logger=org.jboss.weld:add
/subsystem=logging/logger=org.jboss.weld:write-attribute(name=level,value=DEBUG)
/subsystem=logging/logger=org.jboss.weld:write-attribute(name=filter-spec, value="any(match(\".*Catching.*\"), levelRange[INFO, FATAL])")
## Log Hibernate SQL statements to server.log
# /subsystem=logging/logger=org.hibernate.SQL:add
# /subsystem=logging/logger=org.hibernate.SQL:write-attribute(name=level,value=DEBUG)
## Log Hibernate SQL parameter values to server.log
# /subsystem=logging/logger=org.hibernate.type.descriptor.sql:add
# /subsystem=logging/logger=org.hibernate.type.descriptor.sql:write-attribute(name=level,value=TRACE)
# /subsystem=logging/logger=jboss.jdbc.spy:add
# /subsystem=logging/logger=jboss.jdbc.spy:write-attribute(name=level,value=TRACE)


# ==== infinispan ====
/subsystem=infinispan/cache-container=zanata:add(module="org.jboss.as.clustering.web.infinispan",default-cache="default",jndi-name="java:jboss/infinispan/container/zanata",statistics-enabled="true")
/subsystem=infinispan/cache-container=zanata/local-cache=default:add(statistics-enabled="true")
/subsystem=infinispan/cache-container=zanata/local-cache=default/transaction=TRANSACTION:add(mode="NON_XA")
/subsystem=infinispan/cache-container=zanata/local-cache=default/eviction=EVICTION:add(max-entries="10000",strategy="LRU")
/subsystem=infinispan/cache-container=zanata/local-cache=default/expiration=EXPIRATION:add(max-idle="100000")


# ==== message queue ====
jms-queue add --queue-address=MailsQueue --durable=true --entries=["java:/jms/queue/MailsQueue"]


# ==== security ====
## add zanata security domain
/subsystem=security/security-domain=zanata:add()
/subsystem=security/security-domain=zanata/authentication=classic:add()
/subsystem=security/security-domain=zanata/authentication=classic/login-module=ZanataCentralLoginModule:add(code="org.zanata.security.ZanataCentralLoginModule",flag="required")
## add zanata.internal security domain
/subsystem=security/security-domain=zanata.internal:add()
/subsystem=security/security-domain=zanata.internal/authentication=classic:add()
/subsystem=security/security-domain=zanata.internal/authentication=classic/login-module=ZanataInternalLoginModule:add(code="org.zanata.security.jaas.InternalLoginModule",flag="required")
## add zanata.openid security domain
/subsystem=security/security-domain=zanata.openid:add()
/subsystem=security/security-domain=zanata.openid/authentication=classic:add()
/subsystem=security/security-domain=zanata.openid/authentication=classic/login-module=ZanataOpenIdLoginModule:add(code="org.zanata.security.OpenIdLoginModule",flag="required")

# ==== mail session ====
/socket-binding-group=standard-sockets/remote-destination-outbound-socket-binding=mail-smtp:write-attribute(name="port", value=${smtp.port,env.SMTP_PORT:2552})
/socket-binding-group=standard-sockets/socket-binding=management-http:write-attribute(name="port", value=${jboss.management.http.port,env.JBOSS_MANAGEMENT_HTTP_PORT:10090})
/socket-binding-group=standard-sockets/socket-binding=management-https:write-attribute(name="port", value=${jboss.management.http.port,env.JBOSS_MANAGEMENT_HTTPS_PORT:10093})
/socket-binding-group=standard-sockets/socket-binding=ajp:write-attribute(name="port", value=${jboss.ajp.port,env.JBOSS_AJP_PORT:8109})
/socket-binding-group=standard-sockets/socket-binding=http:write-attribute(name="port", value=${jboss.http.port,env.JBOSS_HTTP_PORT:8180})
/socket-binding-group=standard-sockets/socket-binding=https:write-attribute(name="port", value=${jboss.https.port,env.JBOSS_HTTPS_PORT:8543})
/socket-binding-group=standard-sockets/socket-binding=iiop:write-attribute(name="port", value=${jboss.iiop.port,env.JBOSS_IIOP_PORT:3628})
/socket-binding-group=standard-sockets/socket-binding=iiop-ssl:write-attribute(name="port", value=${jboss.iiop.ssl.port,env.JBOSS_IIOP_SSL_PORT:3629})
/socket-binding-group=standard-sockets/socket-binding=txn-recovery-environment:write-attribute(name="port", value=${jboss.txn.recovery.port,env.JBOSS_TXN_RECOVERY_PORT:4812})
/socket-binding-group=standard-sockets/socket-binding=txn-status-manager:write-attribute(name="port", value=${jboss.txn.status.port,env.JBOSS_TXN_STATUS_PORT:4813})

run-batch
29 changes: 14 additions & 15 deletions server/functional-test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,13 @@
<cargo.container.home>${project.build.directory}/jboss/container</cargo.container.home>
<context.path>zanata</context.path>

<!-- this may be changed by the MYSQL_PORT profile -->
<mysql.port>13306</mysql.port>

<!--mysql-maven-plugin will use these setup-->
<ds.database>root</ds.database>
<ds.username>root</ds.username>
<ds.password>root</ds.password>
<mysql.port>13306</mysql.port>
<ds.connection.url>jdbc:mysql://localhost:${mysql.port}/${ds.database}?characterEncoding=UTF-8</ds.connection.url>
<test.db.connection.url>jdbc:mysql://localhost:${mysql.port}/test?characterEncoding=UTF-8</test.db.connection.url>
<ds.driver.class>com.mysql.jdbc.Driver</ds.driver.class>
Expand Down Expand Up @@ -83,7 +85,6 @@
<jndi-remote-client.groupId>org.wildfly.core</jndi-remote-client.groupId>
<jndi-remote-client.artifactId>wildfly-controller-client</jndi-remote-client.artifactId>
<jndi-remote-client.version>${wildfly.client.version}</jndi-remote-client.version>
<standalone.xml.file>standalone.xml</standalone.xml.file>
</properties>

<dependencyManagement>
Expand Down Expand Up @@ -541,9 +542,6 @@
<value>wildfly8</value>
</property>
</activation>
<properties>
<standalone.xml.file>standalone_wildfly.xml</standalone.xml.file>
</properties>
</profile>

<profile>
Expand Down Expand Up @@ -695,6 +693,16 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.gmavenplus</groupId>
<artifactId>gmavenplus-plugin</artifactId>
<executions>
<execution>
<id>run-jboss-cli</id>
<phase>package</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
Expand Down Expand Up @@ -1102,15 +1110,6 @@
<file>${project.basedir}/src/test/conf/zanata-ds.xml</file>
<todir>deployments</todir>
</configfile>
<!-- see above zipUrlInstaller/extractDir-->
<!-- cargo will force todir and tofile to be relative to container home directory -->

<!-- security and jndi for properties -->
<configfile>
<file>${project.basedir}/src/test/conf/${standalone.xml.file}</file>
<tofile>configuration/standalone.xml</tofile>
</configfile>

</configfiles>

<files>
Expand All @@ -1121,7 +1120,7 @@
</files>

<properties>
<cargo.jboss.configuration>standalone</cargo.jboss.configuration>
<cargo.jboss.configuration>standalone-full</cargo.jboss.configuration>
<cargo.port.offset>${cargo.port.offset}</cargo.port.offset>
<cargo.jboss.ajp.port>8109</cargo.jboss.ajp.port>
<!-- These properties will be interpolated by Cargo into the configfiles above -->
Expand Down
Loading

0 comments on commit e76f872

Please sign in to comment.