diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index e3dca06..21a43f2 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -21,6 +21,6 @@ jobs:
fqcn: 'middleware_automation/amq'
debug_verbosity: "${{ github.event.inputs.debug_verbosity }}"
podman_tests_current: >-
- [ "default", "amq_upgrade", "static_cluster", "replication", "live_only", "mirroring", "custom_xml", "federation", "mask_passwords", "uninstall", "console_access" ]
+ [ "default", "amq_upgrade", "static_cluster", "replication", "schema_validation", "live_only", "mirroring", "custom_xml", "federation", "mask_passwords", "uninstall", "console_access" ]
podman_tests_next: >-
- [ "default", "amq_upgrade", "static_cluster", "replication", "live_only", "mirroring", "custom_xml", "federation", "mask_passwords", "uninstall", "console_access" ]
\ No newline at end of file
+ [ "default", "amq_upgrade", "static_cluster", "replication", "schema_validation", "live_only", "mirroring", "custom_xml", "federation", "mask_passwords", "uninstall", "console_access" ]
\ No newline at end of file
diff --git a/molecule/schema_validation/converge.yml b/molecule/schema_validation/converge.yml
new file mode 100644
index 0000000..3906994
--- /dev/null
+++ b/molecule/schema_validation/converge.yml
@@ -0,0 +1,16 @@
+---
+- name: Converge
+ hosts: all
+ gather_facts: yes
+ environment:
+ http_proxy: "{{ lookup('env', 'PROXY') }}"
+ https_proxy: "{{ lookup('env', 'PROXY') }}"
+ no_proxy: "{{ lookup('env', 'NO_PROXY') }}"
+ module_defaults:
+ ansible.builtin.get_url:
+ validate_certs: "{{ not lookup('env', 'PROXY') != '' }}"
+ vars:
+ activemq_version: 2.36.0
+ activemq_schema_src: "/tmp/amq_test/schema/activemq.xsd"
+ roles:
+ - middleware_automation.amq.activemq
\ No newline at end of file
diff --git a/molecule/schema_validation/files/activemq.xsd b/molecule/schema_validation/files/activemq.xsd
new file mode 100644
index 0000000..bcf3b28
--- /dev/null
+++ b/molecule/schema_validation/files/activemq.xsd
@@ -0,0 +1,265 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/molecule/schema_validation/molecule.yml b/molecule/schema_validation/molecule.yml
new file mode 100644
index 0000000..8ff7bf9
--- /dev/null
+++ b/molecule/schema_validation/molecule.yml
@@ -0,0 +1,45 @@
+---
+driver:
+ name: podman
+platforms:
+ - name: amq_custom_xml
+ image: registry.access.redhat.com/ubi9/ubi-init:latest
+ pre_build_image: true
+ privileged: true
+ command: "/usr/sbin/init"
+ systemd: always
+ tmpfs:
+ "/tmp": "exec"
+ "/run": "rw,noexec,nosuid,nodev"
+provisioner:
+ name: ansible
+ config_options:
+ defaults:
+ interpreter_python: auto_silent
+ ssh_connection:
+ pipelining: false
+ playbooks:
+ prepare: prepare.yml
+ converge: converge.yml
+ verify: verify.yml
+ inventory:
+ host_vars:
+ localhost:
+ ansible_python_interpreter: "{{ ansible_playbook_python }}"
+ env:
+ ANSIBLE_FORCE_COLOR: "true"
+ PROXY: "${PROXY}"
+ NO_PROXY: "${NO_PROXY}"
+verifier:
+ name: ansible
+scenario:
+ test_sequence:
+ - cleanup
+ - destroy
+ - create
+ - prepare
+ - converge
+ - idempotence
+ - side_effect
+ - cleanup
+ - destroy
diff --git a/molecule/schema_validation/prepare.yml b/molecule/schema_validation/prepare.yml
new file mode 100644
index 0000000..d349672
--- /dev/null
+++ b/molecule/schema_validation/prepare.yml
@@ -0,0 +1,23 @@
+---
+- name: Prepare
+ hosts: all
+ vars:
+ temp_dir: "/tmp/amq_test"
+
+ tasks:
+ - name: "Run preparation common to all scenario"
+ ansible.builtin.include_tasks: ../prepare.yml
+
+ - name: "Setup: Create a fake installation directory"
+ ansible.builtin.file:
+ path: "{{ temp_dir }}/schema"
+ state: directory
+ mode: '0755'
+
+ - name: "Setup: Place the broken XSD file"
+ ansible.builtin.copy:
+ src: "activemq.xsd"
+ dest: "{{ temp_dir }}/schema/activemq.xsd"
+ owner: root
+ group: root
+ mode: '0644'
\ No newline at end of file
diff --git a/roles/activemq/defaults/main.yml b/roles/activemq/defaults/main.yml
index 07497b6..e08fd18 100644
--- a/roles/activemq/defaults/main.yml
+++ b/roles/activemq/defaults/main.yml
@@ -52,6 +52,7 @@ activemq_name: 'Apache ActiveMQ'
activemq_service_name: activemq
activemq_service_override_template: ''
activemq_modular_configuration: false
+activemq_schema_src: "{{ activemq_installdir }}/schema/activemq.xsd"
### Enable configuration for clustering / high availability
activemq_ha_enabled: false
diff --git a/roles/activemq/tasks/user_roles.yml b/roles/activemq/tasks/user_roles.yml
index faa4b0a..7515837 100644
--- a/roles/activemq/tasks/user_roles.yml
+++ b/roles/activemq/tasks/user_roles.yml
@@ -128,9 +128,9 @@
notify:
- restart amq_broker
-- name: Create a corrected XSD for validation
+- name: Create a copy of the schema to correct for validation
ansible.builtin.copy:
- src: "{{ activemq_installdir }}/schema/activemq.xsd"
+ src: "{{ activemq_schema_src }}"
dest: "{{ activemq.instance_home }}/etc/activemq_fix.xsd"
mode: '0644'
remote_src: true
@@ -140,20 +140,11 @@
- name: Create correct non-deterministic model in XSD
ansible.builtin.replace:
path: "{{ activemq.instance_home }}/etc/activemq_fix.xsd"
- # This regex finds the ambiguous choice and wraps it to make it deterministic
- regexp: '(\s*)\s*()'
- replace: '\1\2'
+ regexp: '()\s*'
+ replace: '\1'
become: "{{ activemq_install_requires_become | default(true) }}"
changed_when: false
-- name: Validate the corrected XSD file
- ansible.builtin.command:
- cmd: "xmllint --noout {{ activemq.instance_home }}/etc/activemq_fix.xsd"
- become: "{{ activemq_install_requires_become | default(true) }}"
- changed_when: false
- register: xsd_check_result
- failed_when: "'validates' not in xsd_check_result.stderr and xsd_check_result.rc != 0"
-
- name: Validate access configuration
middleware_automation.common.xml:
xsd_path: "{{ activemq.instance_home }}/etc/activemq_fix.xsd"