Skip to content

Commit

Permalink
Issue #398 - Add resources for worker test
Browse files Browse the repository at this point in the history
I've added the config.properties file to the resources for test and
other config file as I wonder if it's the reason causing test to fail on
Travis.
  • Loading branch information
WilliamPetit committed Dec 13, 2017
1 parent fad835a commit 52f70c6
Show file tree
Hide file tree
Showing 5 changed files with 177 additions and 56 deletions.
7 changes: 6 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,13 @@ before_install:
script:
# docker needs jar file to start
- mvn clean test package
- docker-compose build
- docker-compose up -d
- sleep 20 # wait that containers are ready
- sleep 120 # wait that containers are ready
- docker-compose logs workers
- docker-compose logs rabbitmq
- docker-compose ps
- docker-compose top
- mvn integration-test -P integration-test

after_script:
Expand Down
123 changes: 123 additions & 0 deletions datavault-worker/src/test/resources/config.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
# This is the DataVault configuration file. Settings are used to customise different options.
#
# This file is used to set properties in the various Spring files located in each application.

# Broker settings
# ===============
# The URL of the broker API for use by the default web application
broker.url = http://localhost:58080/datavault-broker
# API key for the default web client
broker.api.key = datavault-webapp
# Debug setting to disable API authentication
broker.validateclient = true

# Database settings
# =================
# The location of the MySQL database
db.url = localhost:53306/datavault?useUnicode=true
#The MySQL username
db.username = datavault
# The MySQL password
db.password = datavault

# Message queue settings
# ======================
# The location of the RabbitMQ server
queue.server = localhost
# The RabbitMQ username
queue.user = datavault
# The RabbitMQ password
queue.password = datavault
# The name of the primary RabbitMQ queue for communication between the broker and workers
queue.name = datavault
# The name of the RabbitMQ queue to use for notifying the broker of events
queue.events = datavault-event

# Worker settings
# ===============
# The number of concurrent workers to start
worker.number = 1

# Top level storage location settings
# ===================================
# A default directory for sample user data (if per-user storage is not configured)
activeDir = /Users
# Directory for archive data (if using 'local storage')
archiveDir = /tmp/datavault/archive
# A temporary directory for workers to process files before storing in the archive
tempDir = /tmp/datavault/temp
# A directory for storing archive metadata
metaDir = /tmp/datavault/meta

# Email server settings
# =====================
# The email account of the system administrator
mail.administrator = [email protected]
# SMTP host for sending mail
mail.host = smtp.gmail.com
# SMTP port for sending mail
mail.port = 587
# SMTP account name for sending mail
mail.username = [email protected]
# SMTP password for sending mail
mail.password = XXX

# Welcome settings
# ================
# Welcome message (HTML) displayed by the (non-shibboleth) login page.
webapp.welcome =

# CRIS system settings
# ====================
# The URL of the external metadata service (for example, a Pure CRIS API). Leave this blank to use a mock provider
# eg. https://example.org/ws/rest/datasets
# If using HTTP BASIC authentication, use: https://username:[email protected]/ws/rest/datasets
metadata.url =
# Name displayed in the help page for the institutional CRIS or external metadata system
metadata.system = CRIS
# URL displayed in the help page for the institutional CRIS or external metadata system
metadata.link = http://cris.example.com/

# Retention policy checker settings
# =================================
# How frequently the retention policy check job is run (in 'cron' format)
# Example: Check the retention policies each weekday at 9am
retentioncheck.schedule = 0 0 9 * * MON-FRI

# SFTP server settings
# ====================
# Default SFTP host
sftp.host = localhost
# Default SFTP port
sftp.port = 22
# Default SFTP path
sftp.rootPath = /
# Default SFTP key passphrase
sftp.passphrase = datavault

# Shibboleth authentication settings
# ==================================
# Shibboleth header containing the username
shibboleth.principal= uid
# Shibboleth header containing the user's first name
shibboleth.firstname = givenName
# Shibboleth header containing the user's last name
shibboleth.lastname = sn
# Shibboleth header containing the user's email
shibboleth.email = mail

# LDAP settings
# =============
# Set this to false if you don't need to retrieve attributes from LDAP
ldap.enabled = true
ldap.host = hostname
ldap.port = 636
ldap.useSsl = true
# In this example the uun is an account with privileged access to LDAP
ldap.dn = uid=uun,ou=people,o=myu.ed
ldap.password = secret
ldap.searchContext = ou=people,o=myu.ed
ldap.searchFilter = uid
# A list of the attributes you want to retrieve from LDAP
ldap.attrs = attr1,attr2,etc

33 changes: 33 additions & 0 deletions datavault-worker/src/test/resources/config/datavault-worker.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd">

<!-- Note:- You need to set DATAVAULT_HOME! -->
<context:property-placeholder location="file:///${DATAVAULT_HOME}/config/datavault.properties"/>

<bean id="workerManager" class="org.datavaultplatform.worker.WorkerManager">
<property name="numberOfWorkers" value="${worker.number}"/>
</bean>

<bean id="receiver" class="org.datavaultplatform.worker.queue.Receiver">
<property name="queueServer" value="${queue.server}"/>
<property name="queueName" value="${queue.name}"/>
<property name="queueUser" value="${queue.user}"/>
<property name="queuePassword" value="${queue.password}"/>
<property name="tempDir" value="${tempDir}"/>
<property name="metaDir" value="${metaDir}"/>
</bean>

<bean id="eventSender" class="org.datavaultplatform.worker.queue.EventSender">
<property name="queueServer" value="${queue.server}"/>
<property name="eventQueueName" value="${queue.events}"/>
<property name="queueUser" value="${queue.user}"/>
<property name="queuePassword" value="${queue.password}"/>
</bean>

</beans>
15 changes: 15 additions & 0 deletions datavault-worker/src/test/resources/config/log4j.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
log4j.rootCategory=INFO, stdout, file

log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %t %c{2}:%L - %m%n

log4j.appender.file=org.datavaultplatform.worker.logger.WorkerDailyRollingFileAppender
log4j.appender.file.append=true
log4j.appender.file.file=${datavault-home}/logs/worker
log4j.appender.file.threshold=INFO
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=%d{ABSOLUTE} %5p %t %c{2}:%L - %m%n

log4j.category.org.springframework=INFO
log4j.category.org.datavaultplatform=INFO
55 changes: 0 additions & 55 deletions datavault-worker/src/test/resources/docker-compose.yml

This file was deleted.

0 comments on commit 52f70c6

Please sign in to comment.