From 2c3d832207686788f097f058d2ca0388b1bfc145 Mon Sep 17 00:00:00 2001
From: pkupczyk <pkupczyk@ethz.ch>
Date: Fri, 31 May 2024 13:54:07 +0200
Subject: [PATCH] BIS-736 : external data table for AFS : fix test-integration

---
 test-integration/etc/{ => afs}/log4j2.xml     |   0
 test-integration/etc/afs/service.properties   |  31 ++
 test-integration/etc/{ => as}/log4j1.xml      |   0
 test-integration/etc/as/service.properties    | 315 ++++++++++++++++++
 .../common/AbstractIntegrationTest.java       |  10 +-
 5 files changed, 351 insertions(+), 5 deletions(-)
 rename test-integration/etc/{ => afs}/log4j2.xml (100%)
 create mode 100755 test-integration/etc/afs/service.properties
 rename test-integration/etc/{ => as}/log4j1.xml (100%)
 create mode 100644 test-integration/etc/as/service.properties

diff --git a/test-integration/etc/log4j2.xml b/test-integration/etc/afs/log4j2.xml
similarity index 100%
rename from test-integration/etc/log4j2.xml
rename to test-integration/etc/afs/log4j2.xml
diff --git a/test-integration/etc/afs/service.properties b/test-integration/etc/afs/service.properties
new file mode 100755
index 00000000000..37a8196abd6
--- /dev/null
+++ b/test-integration/etc/afs/service.properties
@@ -0,0 +1,31 @@
+logFactoryClass=ch.ethz.sis.shared.log.log4j2.Log4J2LogFactory
+logConfigFile=log.xml
+
+jsonObjectMapperClass=ch.ethz.sis.afsjson.jackson.JacksonObjectMapper
+# Where all the transactions information is written until the prepare step
+# For performance reasons should be on the save volume as the configured storage
+writeAheadLogRoot=./target/tests/transactions
+storageRoot=./target/tests/storage
+storageUuid=
+storageIncomingShareId=
+
+httpServerClass=ch.ethz.sis.afsserver.http.impl.NettyHttpServer
+httpServerUri=/afs-server
+httpServerPort=8085
+
+// 1 MiB of Base64 URL encoded data, 1 kiB of other data and 10% safety margin
+httpMaxContentLength=1540165
+
+maxReadSizeInBytes=1048576
+authenticationInfoProviderClass=ch.ethz.sis.afsserver.worker.providers.impl.DummyAuthenticationInfoProvider
+authorizationInfoProviderClass=ch.ethz.sis.afsserver.worker.providers.impl.DummyAuthorizationInfoProvider
+poolSize=50
+connectionFactoryClass=ch.ethz.sis.afsserver.worker.ConnectionFactory
+workerFactoryClass=ch.ethz.sis.afsserver.worker.WorkerFactory
+publicApiInterface=ch.ethz.sis.afsapi.api.PublicAPI
+apiServerInteractiveSessionKey=test-interactive-session-key
+apiServerTransactionManagerKey=test-transaction-coordinator-key
+apiServerObserver=
+apiServerWorkerTimeout=3600000
+openBISUrl=http://localhost:8888/openbis/openbis/rmi-application-server-v3
+openBISTimeout=30000
\ No newline at end of file
diff --git a/test-integration/etc/log4j1.xml b/test-integration/etc/as/log4j1.xml
similarity index 100%
rename from test-integration/etc/log4j1.xml
rename to test-integration/etc/as/log4j1.xml
diff --git a/test-integration/etc/as/service.properties b/test-integration/etc/as/service.properties
new file mode 100644
index 00000000000..2dd7a5a6b6a
--- /dev/null
+++ b/test-integration/etc/as/service.properties
@@ -0,0 +1,315 @@
+authentication-service = dummy-authentication-service
+
+# The time after which an inactive session is expired by the service (in minutes).
+session-timeout = 720 
+max-number-of-sessions-per-user = 0
+
+# Authorization
+# Supported: 'no-authorization' and 'active-authorization'
+authorization-component-factory = active-authorization
+
+authorization.project-level.enabled = true
+authorization.project-level.users = .*\\_pa\\_on
+
+script-folder = ./source/
+
+core-plugins-folder = source/core-plugins
+
+project-samples-enabled = true
+
+personal-access-tokens-enabled=true
+personal-access-tokens-file-path=targets/personal-access-tokens.json
+
+create-continuous-sample-codes = false
+
+data-set-types-with-no-experiment-needed = (?!REQUIRES\\_EXPERIMENT).*
+
+session-workspace-root-dir = targets/sessionWorkspace
+
+# Whether anonymous statistics of openBIS usage should be send from this server.
+collect-statistics = true
+
+# The base URL for Web client access.
+download-url = http://localhost:8888
+
+# Supported: currently only 'postgresql' is supported
+database.engine = postgresql
+database.create-from-scratch = false
+# For debugging set this value to true.
+database.script-single-step-mode = false
+database.url-host-part =
+# database.kind = new
+# database.kind = basynthec
+database.kind = dev
+# database.kind = basysbio
+# database.kind = system_test_strict
+# database.kind = system_test_plates_on_demand
+# database.kind = system_test_multi_groups
+database.owner =
+database.owner-password =
+database.admin-user =
+database.admin-password =
+# Max time (in seconds) to wait for a connection to become available before throwing an exception.
+# Default: 60s, set to -1 to wait indefinitely.
+database.max-wait-for-connection =
+# Max. number of active database connections. Default: 20.
+database.max-active-connections =
+# Max. number of idle database connections to keep open. Default: 20.
+database.max-idle-connections =
+# Log interval (in seconds) between two regular log entries of the number of active database
+# connections. Default: 3600.
+database.active-connections-log-interval = 30
+xls-import.version-data-file = targets/xls-import-version-info-${database.kind}.json
+
+# Export data limit in bytes, default to 10GiB
+export.data-limit=10485760
+
+# User id of the user used for anonymous login
+user-for-anonymous-login = observer
+
+crowd.service.host = crowd-bsse.ethz.ch
+crowd.service.port = 8443
+crowd.application.name = lims
+crowd.application.password =
+
+# The database instance local unique identifier. Used when the new database is created.
+database-instance = CISD 
+
+dss-rpc.put.dss-code = STANDARD
+openbis.support.email=openbis-support@id.ethz.ch
+
+trusted-cross-origin-domains= *
+
+# Comma-separated list of host names and IP addresses of clients on which an INSTANCE_ADMIN
+# user is allowed to change identity
+accepted-remote-hosts-for-identity-change = localhost
+
+# Online Help
+#
+# Online help is broken into two sections -- generic and specific. Generic help links back to
+# the CISD. Specific help is provided by the host of the installation
+#
+# OpenBIS needs to know the root URL for the online help and a template for the individual pages.
+# The template should have on parameter, called title, and should be constructed to automatically
+# create the page if it does not already exist.
+# The template can be created by going to the root page, adding a new link to the page, and
+# replacing the title of the new page with the ${title}
+onlinehelp.generic.root-url = https://wiki-bsse.ethz.ch/display/CISDDoc/OnlineHelp
+onlinehelp.generic.page-template = https://wiki-bsse.ethz.ch/pages/createpage.action?spaceKey=CISDDoc&title=${title}&linkCreation=true&fromPageId=40633829
+#onlinehelp.specific.root-url = https://wiki-bsse.ethz.ch/display/CISDDoc/OnlineHelp
+#onlinehelp.specific.page-template = https://wiki-bsse.ethz.ch/pages/createpage.action?spaceKey=CISDDoc&title=${title}&linkCreation=true&fromPageId=40633829
+# ---------------------------------------------------------------------------
+# (optional)  Database Configurations for Query module
+# ---------------------------------------------------------------------------
+
+# Comma separated keys of databases configured for Query module.
+# Each database should have configuration properties prefixed with its key.
+# Mandatory properties for each <database> include:
+#   <database>.label                - name shown to the openBIS user when adding or editing a customized query
+#		<database>.database-driver      - JDBC Driver of the database (e.g. org.postgresql.Driver)
+#   <database>.database-url	        - JDBC URL to the database (e.g. jdbc:postgresql://localhost/openbis)
+# Optional properties for each <database> include:
+#   <database>.database-user        - name of the database user (default: user.name from system properties)
+#   <database>.database-password    - password of the database user
+#   <database>.creator-minimal-role - minimal role required to create/edit queries on this database (default: POWER_USER)
+#   <database>.data-space           - If NOT specified OBSERVER of any space will be allowed to perform
+#                                     queries and <creator-minimal-role> of any space will allowed
+#                                     to create/edit queries on this DB.
+#                                   - If specified only OBSERVER of the space will be allowed to perform
+#                                     queries and <creator-minimal-role> of the space will allowed
+#                                     to create/edit queries on this DB.
+query-databases = 1
+
+1.label = openBIS meta data
+#1.data-space = CISD
+#1.creator-minimal-role = SPACE_ADMIN
+1.database-driver = org.postgresql.Driver
+1.database-url = jdbc:postgresql://localhost/openbis_${database.kind}
+#1.database-username =
+#1.database-password =
+
+# ---------------------------------------------------------------------------
+# maintenance plugins configuration
+# ---------------------------------------------------------------------------
+
+# Comma separated names of maintenance plugins.
+# Each plugin should have configuration properties prefixed with its name.
+# Mandatory properties for each <plugin> include:
+#   <plugin>.class - Fully qualified plugin class name
+#   <plugin>.interval - The time between plugin executions (in seconds)
+# Optional properties for each <plugin> include:
+#   <plugin>.start - Time of the first execution (HH:mm)
+#   <plugin>.execute-only-once - If true the task will be executed exactly once,
+#                                interval will be ignored. By default set to false.
+#maintenance-plugins = demo, dynamic-property-evaluator, remove-unused-ad-hoc-vocabulary-terms, batch-sample-temp-code-updater
+
+demo.class = ch.systemsx.cisd.openbis.generic.server.task.DemoMaintenanceTask
+demo.interval = 60
+#demo.execute-only-once = true
+demo.property_1 = some value
+demo.property_2 = some value 2
+
+#dynamic-property-evaluator.class = ch.systemsx.cisd.openbis.generic.server.task.DynamicPropertyEvaluationMaintenanceTask
+# run daily at midnight
+#dynamic-property-evaluator.interval = 86400
+#dynamic-property-evaluator.start = 00:00
+# run every 10min
+#dynamic-property-evaluator.interval = 6000
+
+#remove-unused-ad-hoc-vocabulary-terms.class = ch.systemsx.cisd.openbis.generic.server.task.RemoveUnusedUnofficialTermsMaintenanceTask
+## run once every 12 hours
+#remove-unused-ad-hoc-vocabulary-terms.interval = 43200
+## delete unused ad hoc terms older than 7 days
+#remove-unused-ad-hoc-vocabulary-terms.older-than-days = 7
+
+#batch-sample-temp-code-updater.class = ch.systemsx.cisd.openbis.generic.server.task.BatchSampleRegistrationTempCodeUpdaterTask
+#batch-sample-temp-code-updater.interval = 86400
+#batch-sample-temp-code-updater.start = 00:00
+
+#harvester.class = harvester.task.HarvesterTask
+#harvester.class.interval = 86400
+#harvester.class.start = 16:08
+
+# Name of the file that stores Web Client configuration
+web-client-configuration-file = etc/web-client.properties
+
+entity-history.enabled = true
+
+jython-version=2.7
+
+mail.from = application_server@localhost
+mail.smtp.host = file://targets/email
+mail.smtp.user =
+mail.smtp.password =
+
+concurrent-operation-limiter.timeout = 100
+concurrent-operation-limiter.limits = demo-operation-limit
+
+concurrent-operation-limiter.demo-operation-limit.operation = .*DemoOperation.*
+concurrent-operation-limiter.demo-operation-limit.limit = 1
+
+##########
+# V3 API #
+##########
+
+# -------------------------------------------------------------------------
+# The configuration below reflects the default values used by the V3 API.
+# Please uncomment and change the chosen values to overwrite the defaults.
+# -------------------------------------------------------------------------
+#
+# A path to a directory where operation execution details are stored.
+#
+  api.v3.operation-execution.store.path = targets/operation-execution-store
+#
+# A thread pool that is used for executing all asynchronous operations.
+#
+# api.v3.operation-execution.thread-pool.name = operation-execution-pool
+# api.v3.operation-execution.thread-pool.core-size = 10
+# api.v3.operation-execution.thread-pool.max-size = 10
+# api.v3.operation-execution.thread-pool.keep-alive-time = 0
+#
+# A name of a thread that updates operation execution progress information.
+#
+# api.v3.operation-execution.progress.thread-name = operation-execution-progress
+#
+# An interval that controls how often operation execution progress information gets updated. The interval is defined in seconds.
+#
+# api.v3.operation-execution.progress.interval = 5
+#
+# Availability times control for how long information about an operation execution is stored in the system.
+# There are 3 levels of such information:
+#
+# * core information (code, state, owner, description, creation_date, start_date, finish_date)
+# * summary information (summary of operations, progress, error, results)
+# * detailed information (details of operations, progress, error, results)
+#
+# Each level of information can have a different availability time.
+# The availability times can be defined at the moment of scheduling an operation execution.
+# If a time is not provided explicitly then a corresponding 'default' value is used.
+# The maximum possible value that can be used for a given availability time is controlled with the 'max' property.
+#
+# All availability times are defined in seconds.
+# Examples of values: 31536000 (1 year), 2592000 (30 days), 86400 (1 day), 3600 (1 hour).
+#
+# api.v3.operation-execution.availability-time.default = 31536000
+# api.v3.operation-execution.availability-time.max = 31536000
+# api.v3.operation-execution.availability-time.summary.default = 2592000
+# api.v3.operation-execution.availability-time.summary.max = 2592000
+# api.v3.operation-execution.availability-time.details.default = 86400
+# api.v3.operation-execution.availability-time.details.max = 86400
+#
+# Maintenance tasks responsible for marking and deleting timed out operation executions. Intervals are defined in seconds.
+#
+# api.v3.operation-execution.availability-update.mark-timeout-pending-task.name = operation-execution-mark-timeout-pending-task
+# api.v3.operation-execution.availability-update.mark-timeout-pending-task.interval = 60
+#
+# api.v3.operation-execution.availability-update.mark-timed-out-or-deleted-task.name = operation-execution-mark-timed-out-or-deleted-task
+# api.v3.operation-execution.availability-update.mark-timed-out-or-deleted-task.interval = 300
+#
+# Maintenance task responsible for marking new, scheduled and running operation executions as failed after server restart.
+#
+# api.v3.operation-execution.state-update.mark-failed-after-server-restart-task.name = operation-execution-mark-failed-after-server-restart-task
+#
+#
+
+# Maximum number of items in cache
+api.v3.operation-execution.cache.capacity = 10240
+
+# Cache implementation class, cache is disabled if this property is not set
+api.v3.operation-execution.cache.class = ch.ethz.sis.openbis.generic.server.asapi.v3.executor.common.search.cache.FileCache
+
+# Cache directory for file cache implementation
+api.v3.operation-execution.cache.directory = targets/sessionWorkspace/cache
+
+# Cache clearance task name
+api.v3.operation-execution.cache.clearance-task-name = cache-clearance-task
+
+# Cache items timeout in seconds
+api.v3.operation-execution.cache.timeout = 3600
+
+# Period in seconds of how often a maintenance task should run for timeout checks
+api.v3.operation-execution.cache.timeout-check-interval = 300
+
+#
+# Transactions
+#
+
+# Global switch to enable or disabled the transaction functionality. Default: false.
+api.v3.transaction.enabled = true
+
+# A secret known only to the transaction coordinator that proves its identity to the transaction participants. Default: a secure random key gets generated at startup.
+api.v3.transaction.coordinator-key = test-transaction-coordinator-key
+
+# A secret known only to chosen users of the API that proves they are allowed to use transactions. Default: a secure random key gets generated at startup.
+api.v3.transaction.interactive-session-key = test-interactive-session-key
+
+# A maximum number of simultaneous transactions. Default: 10.
+# api.v3.transaction.transaction-count-limit =
+
+# A timeout in seconds for transactions. After such an inactivity period a transaction will be regarded as abandoned and will be automatically rolled back. Default: 3600.
+api.v3.transaction.transaction-timeout = 60
+
+# An interval in seconds that controls how often a task that finishes failed and abandoned transactions runs. Default: 600.
+api.v3.transaction.finish-transactions-interval = 15
+
+# A path to a folder where transaction statuses are stored. Default: transaction-logs.
+api.v3.transaction.transaction-log-folder-path = targets/transaction-logs
+
+# An url of the application server that participates in the two phase commit (e.g. https://localhost:8443)
+api.v3.transaction.participant.application-server.url = http://localhost:8888
+
+# A timeout in seconds for the application server operations. Default: 3600
+# api.v3.transaction.participant.application-server.timeout =
+
+# An url of the afs server that participates in the two phase commit (e.g. http://localhost:8085/afs-server)
+api.v3.transaction.participant.afs-server.url = http://localhost:8085/afs-server
+
+# A timeout in seconds for the afs server operations. Default: 3600
+# api.v3.transaction.participant.afs-server.timeout =
+
+
+#
+# Server Public Information (returned by the V3 API's getServerPublicInformation() method)
+#
+
+server-public-information.afs-server.url = http://localhost:8085/afs-server
\ No newline at end of file
diff --git a/test-integration/sourceTest/java/ch/ethz/sis/openbis/systemtests/common/AbstractIntegrationTest.java b/test-integration/sourceTest/java/ch/ethz/sis/openbis/systemtests/common/AbstractIntegrationTest.java
index 7dff032c215..12f6a75b480 100644
--- a/test-integration/sourceTest/java/ch/ethz/sis/openbis/systemtests/common/AbstractIntegrationTest.java
+++ b/test-integration/sourceTest/java/ch/ethz/sis/openbis/systemtests/common/AbstractIntegrationTest.java
@@ -136,8 +136,8 @@ public abstract class AbstractIntegrationTest
 
     private void initLogging()
     {
-        System.setProperty("log4j.configuration", "etc/log4j1.xml");
-        System.setProperty("log4j.configurationFile", "etc/log4j1.xml");
+        System.setProperty("log4j.configuration", "etc/as/log4j1.xml");
+        System.setProperty("log4j.configurationFile", "etc/as/log4j1.xml");
     }
 
     private void cleanupApplicationServerFolders() throws Exception
@@ -405,7 +405,7 @@ public abstract class AbstractIntegrationTest
     private Properties getApplicationServerConfiguration(boolean createDatabase) throws Exception
     {
         Properties configuration = new Properties();
-        configuration.load(new FileInputStream("../server-application-server/source/java/service.properties"));
+        configuration.load(new FileInputStream("etc/as/service.properties"));
         configuration.setProperty("database.create-from-scratch", String.valueOf(createDatabase));
         configuration.setProperty("database.kind", "integration");
         configuration.setProperty("script-folder", "../server-application-server/source");
@@ -423,8 +423,8 @@ public abstract class AbstractIntegrationTest
     private Configuration getAfsServerConfiguration()
     {
         Configuration configuration = new Configuration(List.of(AtomicFileSystemServerParameter.class),
-                "../server-data-store/src/main/resources/service.properties");
-        configuration.setProperty(AtomicFileSystemServerParameter.logConfigFile, "etc/log4j2.xml");
+                "etc/afs/service.properties");
+        configuration.setProperty(AtomicFileSystemServerParameter.logConfigFile, "etc/afs/log4j2.xml");
         configuration.setProperty(AtomicFileSystemServerParameter.writeAheadLogRoot, "./targets/afs/transaction-logs");
         configuration.setProperty(AtomicFileSystemServerParameter.storageRoot, "./targets/afs/storage");
         configuration.setProperty(AtomicFileSystemServerParameter.apiServerTransactionManagerKey, TEST_TRANSACTION_COORDINATOR_KEY);
-- 
GitLab