-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into ZNTA-845-findbugs
- Loading branch information
Showing
38 changed files
with
2,202 additions
and
2,428 deletions.
There are no files selected for viewing
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
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 @@ | ||
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') | ||
} |
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,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 |
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,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 |
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
Oops, something went wrong.